(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[9645],{75009:function(or,U,z){"use strict";z.d(U,{Z:function(){return Xg}});var B={};z.r(B),z.d(B,{GADDI:function(){return to},Stack:function(){return ni},breadthFirstSearch:function(){return ht},connectedComponent:function(){return Qe},cosineSimilarity:function(){return he},default:function(){return Ss},depthFirstSearch:function(){return xr},detectAllCycles:function(){return qt},detectAllDirectedCycle:function(){return Bt},detectAllUndirectedCycle:function(){return ft},detectCycle:function(){return br},detectDirectedCycle:function(){return lo},dijkstra:function(){return Hr},findAllPath:function(){return Gr},findShortestPath:function(){return qr},floydWarshall:function(){return Gn},getAdjMatrix:function(){return te},getDegree:function(){return St},getInDegree:function(){return Ct},getNeighbors:function(){return pe},getOutDegree:function(){return _t},iLouvain:function(){return rt},kCore:function(){return ae},kMeans:function(){return C},labelPropagation:function(){return $r},louvain:function(){return K},minimumSpanningTree:function(){return Ot},nodesCosineSimilarity:function(){return Ee},pageRank:function(){return pr}});var j={};z.r(j),z.d(j,{Line:function(){return ga},applyMatrix:function(){return _n},compare:function(){return Yi},distance:function(){return Va},floydWarshall:function(){return Ko},fractionToLine:function(){return Ao},getAdjMatrix:function(){return Li},getBBoxBoundLine:function(){return vo},getCircleCenterByPoints:function(){return Go},getCircleIntersectByPoint:function(){return Oo},getDegree:function(){return $o},getEllipseIntersectByPoint:function(){return Hi},getLineIntersect:function(){return Bo},getPointsCenter:function(){return as},getRectIntersectByPoint:function(){return _s},intersectBBox:function(){return Qo},invertMatrix:function(){return Fo},isPointInPolygon:function(){return ro},isPointsOverlap:function(){return _i},isPolygonsIntersect:function(){return zi},itemIntersectByLine:function(){return Pi},lerp:function(){return da},lerpArray:function(){return Fa},move:function(){return ho},pointLineDistance:function(){return Ui},pointLineSquareDist:function(){return Zi},pointRectSquareDist:function(){return no},rotate:function(){return Di},scale:function(){return Gi},scaleMatrix:function(){return Ms},squareDist:function(){return vi},translate:function(){return Mo}});var R={};z.r(R),z.d(R,{cloneBesidesImg:function(){return Uo},getAnimateCfgWithCallback:function(){return bo},getBBox:function(){return Eo},getComboBBox:function(){return us},getLabelPosition:function(){return Hu},getLetterWidth:function(){return Zs},getLoopCfgs:function(){return Yu},getTextSize:function(){return Ks},plainCombosToTrees:function(){return os},reconstructTree:function(){return ss},shouldRefreshEdge:function(){return $s},traverseTree:function(){return Ei},traverseTreeUp:function(){return Ki},truncateLabelByLength:function(){return io}});var A={};z.r(A),z.d(A,{calculationItemsBBox:function(){return $u},cloneEvent:function(){return cs},formatPadding:function(){return Cs},isNaN:function(){return xo},isViewportChanged:function(){return $i},processParallelEdges:function(){return Mf},uniqueId:function(){return Co}});var N={};z.r(N),z.d(N,{getClosedSpline:function(){return ls},getControlPoint:function(){return ca},getSpline:function(){return Os},getStarPath:function(){return Lo},paddedHull:function(){return Nf},pathToPoints:function(){return Eu},pointsToPolygon:function(){return Lf},roundedHull:function(){return ef}});var L={};z.r(L),z.d(L,{defaultSubjectColors:function(){return ol}});var y={};z.r(y),z.d(y,{isForce:function(){return _u}});var x={};z.r(x),z.d(x,{getColorSetsBySubjectColors:function(){return Bs},getColorsWithSubjectColor:function(){return vs},mixColor:function(){return gi}});var v={};z.r(v),z.d(v,{arrayToTextureData:function(){return Lc},attributesToTextureData:function(){return Gs},buildTextureData:function(){return Jf},buildTextureDataWithOneEdgeAttr:function(){return qf},buildTextureDataWithTwoEdgeAttr:function(){return Ac},proccessToFunc:function(){return hf},radialLayout:function(){return Dc}});var g={};z.r(g),z.d(g,{gpuDetector:function(){return Nc}});var d=z(67294),_=z(24561),E=function(c){var t=c.loadingTemplate,e=function(){return t||d.createElement(_.ZP,{viewBox:"0 0 400 180",width:200,height:90,speed:1},d.createElement("rect",{x:"20",y:"5",rx:"0",ry:"0",width:"1",height:"170"}),d.createElement("rect",{x:"20",y:"175",rx:"0",ry:"0",width:"360",height:"1"}),d.createElement("rect",{x:"40",y:"75",rx:"0",ry:"0",width:"35",height:"100"}),d.createElement("rect",{x:"80",y:"125",rx:"0",ry:"0",width:"35",height:"50"}),d.createElement("rect",{x:"120",y:"105",rx:"0",ry:"0",width:"35",height:"70"}),d.createElement("rect",{x:"160",y:"35",rx:"0",ry:"0",width:"35",height:"140"}),d.createElement("rect",{x:"200",y:"55",rx:"0",ry:"0",width:"35",height:"120"}),d.createElement("rect",{x:"240",y:"15",rx:"0",ry:"0",width:"35",height:"160"}),d.createElement("rect",{x:"280",y:"135",rx:"0",ry:"0",width:"35",height:"40"}),d.createElement("rect",{x:"320",y:"85",rx:"0",ry:"0",width:"35",height:"90"}))};return d.createElement("div",{style:{position:"absolute",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",left:0,top:0,zIndex:99,backgroundColor:"#fff"}},e())},w=function(){var c=function(t,e){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},c(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),T=function(c){w(t,c);function t(){var e=c!==null&&c.apply(this,arguments)||this;return e.state={hasError:!1},e.renderError=function(r){var n=e.props.errorTemplate;switch(r){default:return typeof n=="function"?n(r):n||d.createElement("h5",null,"\u7EC4\u4EF6\u51FA\u9519\u4E86\uFF0C\u8BF7\u6838\u67E5\u540E\u91CD\u8BD5\uFF1A ",r.message)}},e}return t.getDerivedStateFromError=function(e){return{hasError:!0,error:e}},t.getDerivedStateFromProps=function(e,r){return r.children!==e.children?{children:e.children,hasError:!1,error:void 0}:null},t.prototype.render=function(){return this.state.hasError?this.renderError(this.state.error):d.createElement(d.Fragment,null,this.props.children)},t}(d.Component),k=T,b=z(70655),m=z(49242),$={getDefaultCfg:function(){return{}},getEvents:function(){return{}},updateCfg:function(t){return Object.assign(this,t),!0},shouldBegin:function(){return!0},shouldUpdate:function(){return!0},shouldEnd:function(){return!0},bind:function(t){var e=this,r=this.events;this.graph=t,(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&t.get("canvas").set("draggable",!0),(0,m.each)(r,function(n,a){t.on(a,n)}),document.addEventListener("visibilitychange",function(){e.keydown=!1})},unbind:function(t){var e=this.events,r=t.get("canvas").get("draggable");(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&t.get("canvas").set("draggable",!1),(0,m.each)(e,function(n,a){t.off(a,n)}),t.get("canvas").set("draggable",r)},get:function(t){return this[t]},set:function(t,e){return this[t]=e,this}},W=function(){function c(){}return c.registerBehavior=function(t,e){if(!e)throw new Error("please specify handler for this behavior: ".concat(t));var r=(0,m.clone)($);Object.assign(r,e);var n=function(i){var o=this;Object.assign(this,this.getDefaultCfg(),i);var s=this.getEvents();this.events=null;var l={};s&&((0,m.each)(s,function(h,p){l[p]=(0,m.wrapBehavior)(o,h)}),this.events=l)};n.prototype=r,c.types[t]=n},c.hasBehavior=function(t){return!!c.types[t]},c.getBehavior=function(t){return c.types[t]},c.types={},c}(),X=W,H=X,Q=z(90494),q=z(31506),J=function(t,e){var r=t.nodes,n=t.edges,a=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(function(o,s){i[o.id]=s;var l=[];a.push(l)}),n&&n.forEach(function(o){var s=o.source,l=o.target,h=i[s],p=i[l];!h&&h!==0||!p&&p!==0||(a[h][p]=1,e||(a[p][h]=1))}),a},te=J,fe=function(t,e){return t===e},de=function(){function c(t,e){e===void 0&&(e=null),this.value=t,this.next=e}return c.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},c}(),Te=function(){function c(t){t===void 0&&(t=fe),this.head=null,this.tail=null,this.compare=t}return c.prototype.prepend=function(t){var e=new de(t,this.head);return this.head=e,this.tail||(this.tail=e),this},c.prototype.append=function(t){var e=new de(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},c.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var r=this.head;if(r!==null)for(;r.next;)this.compare(r.next.value,t)?(e=r.next,r.next=r.next.next):r=r.next;return this.compare(this.tail.value,t)&&(this.tail=r),e},c.prototype.find=function(t){var e=t.value,r=e===void 0?void 0:e,n=t.callback,a=n===void 0?void 0:n;if(!this.head)return null;for(var i=this.head;i;){if(a&&a(i.value)||r!==void 0&&this.compare(i.value,r))return i;i=i.next}return null},c.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},c.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},c.prototype.fromArray=function(t){var e=this;return t.forEach(function(r){return e.append(r)}),this},c.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},c.prototype.reverse=function(){for(var t=this.head,e=null,r=null;t;)r=t.next,t.next=e,e=t,t=r;this.tail=this.head,this.head=e},c.prototype.toString=function(t){return t===void 0&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},c}(),Se=Te,Ie=function(){function c(){this.linkedList=new Se}return c.prototype.isEmpty=function(){return!this.linkedList.head},c.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},c.prototype.enqueue=function(t){this.linkedList.append(t)},c.prototype.dequeue=function(){var t=this.linkedList.deleteHead();return t?t.value:null},c.prototype.toString=function(t){return this.linkedList.toString(t)},c}(),be=Ie,pe=function(t,e,r){e===void 0&&(e=[]);var n=e.filter(function(s){return s.source===t||s.target===t});if(r==="target"){var a=function(l){return l.source===t};return n.filter(a).map(function(s){return s.target})}if(r==="source"){var i=function(l){return l.target===t};return n.filter(i).map(function(s){return s.source})}var o=function(l){return l.source===t?l.target:l.source};return n.map(o)},Me=function(t,e){return e.filter(function(r){return r.source===t})},De=function(t,e){return e.filter(function(r){return r.source===t||r.target===t})},Ue=function(t){t===void 0&&(t=0);var e="".concat(Math.random()).split(".")[1].substr(0,5),r="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(t,"-").concat(e).concat(r)};function nt(c){c===void 0&&(c={});var t=c,e=function(){},r=function(){var n={};return function(a){var i=a.next,o=i;return n[o]?!1:(n[o]=!0,!0)}}();return t.allowTraversal=c.allowTraversal||r,t.enter=c.enter||e,t.leave=c.leave||e,t}var Ze=function(t,e,r,n){n===void 0&&(n=!0);var a=nt(r),i=new be,o=t.edges,s=o===void 0?[]:o;i.enqueue(e);for(var l="",h=function(){var D=i.dequeue();a.enter({current:D,previous:l}),pe(D,s,n?"target":void 0).forEach(function(I){a.allowTraversal({previous:l,current:D,next:I})&&i.enqueue(I)}),a.leave({current:D,previous:l}),l=D};!i.isEmpty();)h()},ht=Ze,Rt=function(t){for(var e=t.nodes,r=e===void 0?[]:e,n=t.edges,a=n===void 0?[]:n,i=[],o={},s=[],l=function I(F){s.push(F),o[F.id]=!0;for(var Z=pe(F.id,a),ee=function(ce){var we=Z[ce];if(!o[we]){var Re=r.filter(function(Oe){return Oe.id===we});Re.length>0&&I(Re[0])}},se=0;se0;)D.push(s.pop());i.push(D)}}return i},tr=function(t){for(var e=t.nodes,r=e===void 0?[]:e,n=t.edges,a=n===void 0?[]:n,i=[],o={},s={},l={},h=[],p=0,D=function ee(se){s[se.id]=p,l[se.id]=p,p+=1,i.push(se),o[se.id]=!0;for(var oe=pe(se.id,a,"target").filter(function(Pe){return r.map(function(He){return He.id}).indexOf(Pe)>-1}),ce=function(He){var at=oe[He];if(!s[at]&&s[at]!==0){var qe=r.filter(function(yt){return yt.id===at});qe.length>0&&ee(qe[0]),l[se.id]=Math.min(l[se.id],l[at])}else o[at]&&(l[se.id]=Math.min(l[se.id],s[at]))},we=0;we0;){var Oe=i.pop();if(o[Oe.id]=!1,Re.push(Oe),Oe===se)break}Re.length>0&&h.push(Re)}},I=0,F=r;I0;)for(var ee=I.pop(),se=ee.id,oe=pe(se,t.edges),ce=function(Oe){var Pe,He=oe[Oe],at=t.nodes.find(function(lr){return lr.id===He});if(He===se)i.push((Pe={},Pe[He]=ee,Pe));else if(!(He in Z))F[He]=ee,I.push(at),Z[He]=new Set([ee]);else if(!Z[se].has(at)){for(var qe=!0,yt=[at,ee],Ft=F[se];Z[He].size&&!Z[He].has(Ft)&&(yt.push(Ft),Ft!==F[Ft.id]);)Ft=F[Ft.id];if(yt.push(Ft),e&&r?(qe=!1,yt.findIndex(function(lr){return e.indexOf(lr.id)>-1})>-1&&(qe=!0)):e&&!r&&yt.findIndex(function(lr){return e.indexOf(lr.id)>-1})>-1&&(qe=!1),qe){for(var yr={},fr=1;fr0;){var fr=yr.pop();a.has(fr)&&(a.delete(fr),i[fr.id].forEach(function(lr){yr.push(lr)}),i[fr.id].clear())}},p=function yt(Ft,yr,fr){var lr=!1;if(e&&r===!1&&e.indexOf(Ft.id)>-1)return lr;n.push(Ft),a.add(Ft);for(var Kt=fr[Ft.id],jr=0;jr-1});Jr-1)?o.push((yr={},yr[Fr.id]=Fr,yr)):kr[Fr.id].push(l[Vn])}}return{component:mr,adjList:kr,minIdx:lr}},ce=0;ce=ce}),Re=tr({nodes:we,edges:t.edges}).filter(function(yt){return yt.length>1});if(Re.length===0)break;var Oe=oe(Re),Pe=Oe.minIdx,He=Oe.adjList,at=Oe.component;if(at.length>1){at.forEach(function(yt){i[yt.id]=new Set});var qe=s[Pe];if(e&&r&&e.indexOf(qe.id)===-1)return o;p(qe,qe,He),ce=Pe+1}else break}return o},qt=function(t,e,r,n){return n===void 0&&(n=!0),e?Bt(t,r,n):ft(t,r,n)},br=Vt,Ur=function(t,e,r){for(var n=Infinity,a,i=0;ip[Re.id]+Ft?(p[yt]=p[Re.id]+Ft,D[yt]=[Re.id]):p[yt]===p[Re.id]+Ft&&D[yt].push(Re.id)})},Z=0;Z0&&h.length>0;){var I=h[h.length-1];if(I.length){var F=I.shift();F&&(s.push(F),l[F]=!0,D=n?pe(F,o,"target"):pe(F,o),h.push(D.filter(function(se){return!l[se]})))}else{var Z=s.pop();l[Z]=!1,h.pop();continue}if(s[s.length-1]===r){var ee=s.map(function(oe){return oe});p.push(ee);var Z=s.pop();l[Z]=!1,h.pop()}}return p},vn=function(t,e){for(var r=te(t,e),n=[],a=r.length,i=0;in[i][s]+n[s][o]&&(n[i][o]=n[i][s]+n[s][o]);return n},Gn=vn,mn=function(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r="weight"),n===void 0&&(n=1e3);var a=t.nodes,i=a===void 0?[]:a,o=t.edges,s=o===void 0?[]:o,l={},h={};i.forEach(function(we,Re){var Oe=Ue();we.clusterId=Oe,l[Oe]={id:Oe,nodes:[we]},h[we.id]={node:we,idx:Re}});var p=te(t,e),D=[],I={};p.forEach(function(we,Re){var Oe=0,Pe=i[Re].id;I[Pe]={},we.forEach(function(He,at){if(!!He){Oe+=He;var qe=i[at].id;I[Pe][qe]=He}}),D.push(Oe)});for(var F=0,Z=function(){var Re=!1;if(i.forEach(function(Oe){var Pe={};Object.keys(I[Oe.id]).forEach(function(lr){var Kt=I[Oe.id][lr],jr=h[lr].node,Xr=jr.clusterId;Pe[Xr]||(Pe[Xr]=0),Pe[Xr]+=Kt});var He=-Infinity,at=[];if(Object.keys(Pe).forEach(function(lr){He=0&&at.splice(qe,1),at&&at.length){Re=!0;var yt=l[Oe.clusterId],Ft=yt.nodes.indexOf(Oe);yt.nodes.splice(Ft,1);var yr=Math.floor(Math.random()*at.length),fr=l[at[yr]];fr.nodes.push(Oe),Oe.clusterId=fr.id}}}),!Re)return"break";F++};F0&&He>at&&He-atat&&(yt=p.map(function(er){return{node:er,clusterId:er.clusterId}}),Ft=(0,m.clone)(oe),at=He),yr||qe>100)break;qe++,Object.keys(oe).forEach(function(er){var mr=0;I.forEach(function(kr){var Fr=kr.source,Jr=kr.target,fn=ce[Fr].node.clusterId,Vn=ce[Jr].node.clusterId;(fn===er&&Vn!==er||Vn===er&&fn!==er)&&(mr=mr+(kr[r]||1))}),oe[er].sumTot=mr}),p.forEach(function(er,mr){var kr=oe[er.clusterId],Fr=0,Jr,fn=Re[mr]/(2*Pe),Vn=0,Tn=kr.nodes;Tn.forEach(function(Qa){var Ja=ce[Qa.id].idx;Vn+=we[mr][Ja]||0});var wa=Vn-kr.sumTot*fn,ua=Tn.filter(function(Qa){return Qa.id!==er.id}),fa=[];ua.forEach(function(Qa,Ja){fa[Ja]=F[Qa.originIndex]});var Ma=ln(ua,F)*l,ja=Oe[er.id];if(Object.keys(ja).forEach(function(Qa){var Ja=ce[Qa].node,oi=Ja.clusterId;if(oi!==er.clusterId){var Si=oe[oi],Ai=Si.nodes;if(!(!Ai||!Ai.length)){var la=0;Ai.forEach(function(pa){var ma=ce[pa.id].idx;la+=we[mr][ma]||0});var Ca=la-Si.sumTot*fn,Xn=Ai.concat([er]),Ta=[];Xn.forEach(function(pa,ma){Ta[ma]=F[pa.originIndex]});var Na=ln(Xn,F)*l,cn=Ca-wa;a&&(cn=Ca+Na-(wa+Ma)),cn>Fr&&(Fr=cn,Jr=Si)}}}),Fr>0){Jr.nodes.push(er);var Ra=er.clusterId;er.clusterId=Jr.id;var uo=kr.nodes.indexOf(er);kr.nodes.splice(uo,1);var Da=0,fo=0;I.forEach(function(Qa){var Ja=Qa.source,oi=Qa.target,Si=ce[Ja].node.clusterId,Ai=ce[oi].node.clusterId;(Si===Jr.id&&Ai!==Jr.id||Ai===Jr.id&&Si!==Jr.id)&&(Da=Da+(Qa[r]||1)),(Si===Ra&&Ai!==Ra||Ai===Ra&&Si!==Ra)&&(fo=fo+(Qa[r]||1))}),Jr.sumTot=Da,kr.sumTot=fo}})}var fr={},lr=0;Object.keys(Ft).forEach(function(er){var mr=Ft[er];if(!mr.nodes||!mr.nodes.length){delete Ft[er];return}var kr=String(lr+1);kr!==er&&(mr.id=kr,mr.nodes=mr.nodes.map(function(Fr){return{id:Fr.id,clusterId:kr}}),Ft[kr]=mr,fr[er]=kr,delete Ft[er],lr++)}),yt.forEach(function(er){var mr=er.node,kr=er.clusterId;!mr||(mr.clusterId=kr,mr.clusterId&&fr[mr.clusterId]&&(mr.clusterId=fr[mr.clusterId]))});var Kt=[],jr={};I.forEach(function(er){var mr=er.source,kr=er.target,Fr=er[r]||1,Jr=ce[mr].node.clusterId,fn=ce[kr].node.clusterId;if(!(!Jr||!fn)){var Vn="".concat(Jr,"---").concat(fn);if(jr[Vn])jr[Vn].weight+=Fr,jr[Vn].count++;else{var Tn={source:Jr,target:fn,weight:Fr,count:1};jr[Vn]=Tn,Kt.push(Tn)}}});var Xr=[];return Object.keys(Ft).forEach(function(er){Xr.push(Ft[er])}),{clusters:Xr,clusterEdges:Kt}},K=va,Dt=function(t,e,r,n,a,i,o,s){return e===void 0&&(e=!1),r===void 0&&(r="weight"),n===void 0&&(n=1e-4),a===void 0&&(a=void 0),i===void 0&&(i=[]),o===void 0&&(o=["id"]),s===void 0&&(s=1),K(t,e,r,n,!0,a,i,o,s)},rt=Dt,ne=function(t,e){var r;e===void 0&&(e=1);for(var n=(0,m.clone)(t),a=n.nodes,i=a===void 0?[]:a,o=n.edges,s=o===void 0?[]:o,l=function(){var D=St({nodes:i,edges:s}),I=Object.keys(D);I.sort(function(ee,se){var oe,ce;return((oe=D[ee])===null||oe===void 0?void 0:oe.degree)-((ce=D[se])===null||ce===void 0?void 0:ce.degree)});var F=I[0];if(!i.length||((r=D[F])===null||r===void 0?void 0:r.degree)>=e)return"break";var Z=i.findIndex(function(ee){return ee.id===F});i.splice(Z,1),s=s.filter(function(ee){return!(ee.source===F||ee.target===F)})};;){var h=l();if(h==="break")break}return{nodes:i,edges:s}},ae=ne,P=function(t,e,r){var n=[];switch(t){case Sn.EuclideanDistance:n=e[r];break;default:n=[];break}return n},S=function(t,e,r,n,a,i){e===void 0&&(e=3),r===void 0&&(r=void 0),n===void 0&&(n=[]),a===void 0&&(a=["id"]),i===void 0&&(i=Sn.EuclideanDistance);var o=t.nodes,s=o===void 0?[]:o,l=t.edges,h=l===void 0?[]:l,p={clusters:[{id:"0",nodes:s}],clusterEdges:[]};if(i===Sn.EuclideanDistance&&!s.every(function(kr){return kr.hasOwnProperty(r)}))return p;var D=[],I=[];if(i===Sn.EuclideanDistance&&(D=pn(s,r),I=$n(D,n,a)),!I.length)return p;for(var F=(0,m.uniq)(I.map(function(kr){return kr.join("")})),Z=Math.min(e,s.length,F.length),ee=0;eeRe&&!se.find(function(ua){return(0,m.isEqual)(ua,P(i,I,s[Jr].originIndex))})&&(Re=wa,Oe=Jr)}},He=0;He=0;fr--)ce[Number(s[ee].clusterId)][fr].id===s[ee].id&&ce[Number(s[ee].clusterId)].splice(fr,1);s[ee].clusterId=String(qe),ce[qe].push(s[ee])}}for(var lr=!1,ee=0;ee=1e3)break}var er=[],mr={};return h.forEach(function(kr){var Fr,Jr,fn=kr.source,Vn=kr.target,Tn=(Fr=s.find(function(Ma){return Ma.id===fn}))===null||Fr===void 0?void 0:Fr.clusterId,wa=(Jr=s.find(function(Ma){return Ma.id===Vn}))===null||Jr===void 0?void 0:Jr.clusterId,ua="".concat(Tn,"---").concat(wa);if(mr[ua])mr[ua].count++;else{var fa={source:Tn,target:wa,count:1};mr[ua]=fa,er.push(fa)}}),{clusters:ce,clusterEdges:er}},C=S,V=function(t,e){var r=new Rr(e),n=r.norm2(),a=new Rr(t),i=a.norm2(),o=r.dot(a),s=n*i,l=s?o/s:0;return l},he=V,xe=function(t,e,r,n,a){t===void 0&&(t=[]),r===void 0&&(r=void 0),n===void 0&&(n=[]),a===void 0&&(a=[]);var i=(0,m.clone)(t.filter(function(D){return D.id!==e.id})),o=t.findIndex(function(D){return D.id===e.id}),s=pn(t,r),l=$n(s,n,a),h=l[o],p=[];return i.forEach(function(D,I){if(D.id!==e.id){var F=l[I],Z=he(F,h);p.push(Z),D.cosineSimilarity=Z}}),i.sort(function(D,I){return I.cosineSimilarity-D.cosineSimilarity}),{allCosineSimilarity:p,similarNodes:i}},Ee=xe,Ne=function(){function c(t){this.count=t.length,this.parent={};for(var e=0,r=t;e0&&(this.list[0]=e,this.moveDown(0)),t},c.prototype.insert=function(t){if(t!==null){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},c.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var r=this.list[e];this.list[e]=this.list[t],this.list[t]=r,t=e,e=this.getParent(t)}},c.prototype.moveDown=function(t){var e,r=t,n=this.getLeft(t),a=this.getRight(t),i=this.list.length;n!==null&&n0?r=n:a!==null&&a0&&(r=a),t!==r&&(e=[this.list[r],this.list[t]],this.list[t]=e[0],this.list[r]=e[1],this.moveDown(r))},c}(),$t=Pt,Ht=function(t,e){var r=[],n=t.nodes,a=n===void 0?[]:n,i=t.edges,o=i===void 0?[]:i;if(a.length===0)return r;var s=a[0],l=new Set;l.add(s);var h=function(ee,se){return e?ee.weight-se.weight:0},p=new $t(h);for(De(s.id,o).forEach(function(Z){p.insert(Z)});!p.isEmpty();){var D=p.delMin(),I=D.source,F=D.target;l.has(I)&&l.has(F)||(r.push(D),l.has(I)||(l.add(I),De(I,o).forEach(function(Z){p.insert(Z)})),l.has(F)||(l.add(F),De(F,o).forEach(function(Z){p.insert(Z)})))}return r},Br=function(t,e){var r=[],n=t.nodes,a=n===void 0?[]:n,i=t.edges,o=i===void 0?[]:i;if(a.length===0)return r;var s=o.map(function(I){return I});e&&s.sort(function(I,F){return I.weight-F.weight});for(var l=new Et(a.map(function(I){return I.id}));s.length>0;){var h=s.shift(),p=h.source,D=h.target;l.connected(p,D)||(r.push(h),l.union(p,D))}return r},hn=function(t,e,r){var n={prim:Ht,kruskal:Br};return r?n[r](t,e):Br(t,e)},Ot=hn,Qt=function(t,e,r){typeof e!="number"&&(e=1e-6),typeof r!="number"&&(r=.85);for(var n=1,a=0,i=1e3,o=t.nodes,s=o===void 0?[]:o,l=t.edges,h=l===void 0?[]:l,p=s.length,D,I={},F={},Z=0;Z0&&n>e;){a=0;for(var Z=0;Z0&&(D+=F[Re]/Oe)}I[se]=r*D,a+=I[se]}}a=(1-a)/p,n=0;for(var Z=0;Z=0;r--){var n=this.dfsEdgeList[r],a=n.fromNode,i=n.toNode;aI||n.hasNode(i[D.to])||(e.labelce;Re--){var Oe=we(Re);if(Oe==="break")break}if(se){var Pe=t.findMinLabel(ee);i.dfsEdgeList.push(new Ce(Z,oe,kn,Pe.edgeLabel,kn));var He=i.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[He]!==i.dfsEdgeList[He]?!1:p(ee[Pe.edgeLabel].projected)}var at={};se=!1;var qe=0;D.forEach(function(Kt){var jr=new ut(Kt),Xr=t.findForwardPureEdges(n,jr.edges[I[0]],F,jr);Xr.length>0&&(se=!0,qe=Z,Xr.forEach(function(er){var mr="".concat(er.label,"-").concat(a[er.to].label);at[mr]||(at[mr]={projected:[],edgeLabel:er.label,nodeLabel2:a[er.to].label}),at[mr].projected.push({graphId:n.id,edge:er,preNode:Kt})}))});for(var yt=I.length,Ft=function(jr){if(se)return"break";var Xr=I[jr];D.forEach(function(er){var mr=new ut(er),kr=t.findForwardRmpathEdges(n,mr.edges[Xr],F,mr);kr.length>0&&(se=!0,qe=i.dfsEdgeList[Xr].fromNode,kr.forEach(function(Fr){var Jr="".concat(Fr.label,"-").concat(a[Fr.to].label);at[Jr]||(at[Jr]={projected:[],edgeLabel:Fr.label,nodeLabel2:a[Fr.to].label}),at[Jr].projected.push({graphId:n.id,edge:Fr,preNode:er})}))})},Re=0;Re=0;F--){var Z=e.findBackwardEdge(p,I.edges[a[F]],I.edges[a[0]],I);if(Z){var ee="".concat(e.dfsCode.dfsEdgeList[a[F]].fromNode,"-").concat(Z.label);l[ee]||(l[ee]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[a[F]].fromNode,edgeLabel:Z.label}),l[ee].projected.push({graphId:h.graphId,edge:Z,preNode:h})}}if(!(n>=e.maxNodeNum)){var se=e.findForwardPureEdges(p,I.edges[a[0]],o,I);se.forEach(function(ce){var we="".concat(i,"-").concat(ce.label,"-").concat(D[ce.to].label);s[we]||(s[we]={projected:[],fromNodeId:i,edgeLabel:ce.label,nodeLabel2:D[ce.to].label}),s[we].projected.push({graphId:h.graphId,edge:ce,preNode:h})});for(var oe=function(we){var Re=e.findForwardRmpathEdges(p,I.edges[a[we]],o,I);Re.forEach(function(Oe){var Pe="".concat(e.dfsCode.dfsEdgeList[a[we]].fromNode,"-").concat(Oe.label,"-").concat(D[Oe.to].label);s[Pe]||(s[Pe]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[a[we]].fromNode,edgeLabel:Oe.label,nodeLabel2:D[Oe.to].label}),s[Pe].projected.push({graphId:h.graphId,edge:Oe,preNode:h})})},F=0;Fce){var we=ce;ce=oe,oe=we}var Re=se.label,Oe="".concat(l,"-").concat(oe,"-").concat(Re,"-").concat(ce),Pe="".concat(oe,"-").concat(Re,"-").concat(ce);if(!i[Pe]){var He=i[Pe]||0;He++,i[Pe]=He}s[Oe]={graphId:l,nodeLabel1:oe,edgeLabel:Re,nodeLabel2:ce}})})}),Object.keys(a).forEach(function(l){var h=a[l];if(!(h2*e)););if(ee<2*e&&(o["".concat(h,"-").concat(Z)]={start:h,end:Z,distance:a[h][Z]},p++,s++,s>=r))return o;if(D++,D>2*e)break}if(pD&&(s=D);var I=r[p.id].inDegree;l>I&&(l=I);var F=r[p.id].outDegree;h>F&&(h=F)}),t[e]={degree:s,inDegree:l,outDegree:h}),{minPatternNodeLabelDegree:s,minPatternNodeLabelInDegree:l,minPatternNodeLabelOutDegree:h}},So=function(t,e,r,n,a,i,o){var s;if(r===void 0&&(r=!1),i===void 0&&(i="cluster"),o===void 0&&(o="cluster"),!(!t||!t.nodes)){var l=t.nodes.length;if(!!l){var h=Gn(t,r),p=Gn(e,r),D=qa(t.nodes,h,r),I=qa(e.nodes,p,r),F=Ba(t.nodes,i),Z=F.nodeMap,ee=F.nodeLabelMap,se=Ba(e.nodes,i),oe=se.nodeMap,ce=se.nodeLabelMap;Ea(t.edges,o,Z);var we=Ea(e.edges,o,oe).edgeLabelMap,Re=[];p==null||p.forEach(function(la){Re=Re.concat(la)}),a||(a=Math.max.apply(Math,(0,b.__spreadArray)((0,b.__spreadArray)([],Re,!1),[2],!1))),n||(n=a);var Oe=xn(t,h,i,n),Pe=xn(e,p,i,n),He=Math.min(100,l*(l-1)/2),at=Qn(n,l,He,Oe,h),qe=ia(at,Oe,t),yt=10,Ft=1,yr=1,fr=4,lr={graphs:qe,nodeLabelProp:i,edgeLabelProp:o,minSupport:Ft,minNodeNum:yr,maxNodeNum:fr,directed:r},Kt=on(lr).slice(0,yt),jr=Kt.length,Xr=[];Kt.forEach(function(la,Ca){Xr[Ca]={},Object.keys(qe).forEach(function(Xn){var Ta=qe[Xn],Na=Wa(Ta,la,i,o);Xr[Ca][Xn]=Na})});var er=Ia(Xr,jr,Kt),mr=er.structure,kr=er.structureCountMap,Fr=e.nodes[0],Jr=[],fn=(s=e.nodes[0])===null||s===void 0?void 0:s[i],Vn=-Infinity;e.nodes.forEach(function(la){var Ca=la[i],Xn=ee[Ca];(Xn==null?void 0:Xn.length)>Vn&&(Vn=Xn.length,Jr=Xn,fn=Ca,Fr=la)});var Tn={},wa={},ua={},fa={},Ma={},ja={};Object.keys(ce).forEach(function(la,Ca){Ma[la]=[],r&&(ja[la]=[]);var Xn=-Infinity,Ta=ce[la],Na={};Ta.forEach(function(xa){var Nn=I["".concat(Fr.id,"-").concat(xa.id)];if(Nn&&Ma[la].push(Nn),XnMa[la][Po]){qc=!0;break}if(qc)return Jr.splice(Nn,1),"continue";var ws={};Ci.neighbors.forEach(function(ko){var Xs=D["".concat(Xa.id,"-").concat(ko.id)];ws["".concat(Xa.id,"-").concat(ko.id)]={start:Z[Xa.id].idx,end:Z[ko.id].idx,distance:Xs}}),qe=ia(ws,Oe,t,qe);var fu=[];Object.keys(ws).forEach(function(ko){if(kr[ko]){fu.push(kr[ko]);return}var Xs=qe[ko];kr[ko]=Wa(Xs,mr,i,o),fu.push(kr[ko])}),fu=fu.sort(function(ko,Xs){return Xs-ko});for(var Sf=!1,Po=0;Po=0;Ua--)ma(Ua)});var Ra=[];Jr==null||Jr.forEach(function(la){for(var Ca=Z[la.id].idx,Xn=zn(t.nodes,h[Ca],Ca,i,a),Ta=Xn.neighbors,Na=Ta.length,cn=!1,pa=Na-1;pa>=0;pa--){if(Ta.length+1Ci){Ta.splice(pa,1);continue}if(r){var Ti="".concat(ma.id,"-").concat(la.id),uc=D[Ti];Xa=ja[Ua].length-1;var qc=ja[Ua][Xa];if(uc>qc){Ta.splice(pa,1);continue}}var Po=kr[xa]?kr[xa]:si(t,la,ma,Z,Nn,Oe,mr,i,o,kr,qe),ws="".concat(Fr.id,"-").concat(Ua),fu=fa[ws][fa[ws].length-1];if(Po=0;Nn--){var qc=uc(Nn);if(qc==="break")break}if(Ti)return Ra.splice(Ca,1),"continue";Xn.edges=pa;var Po=Hr(Xn,Xn.nodes[0].id,!1).length;if(Object.keys(Po).reverse().forEach(function(hi){if(!(hi===Xn.nodes[0].id||Ti)){if(Po[hi]===Infinity){var rs=cn[hi].node[i];if(Na[rs]--,Na[rs]Da[cu][Da[cu].length-1]){var rs=cn[hi].node[i];if(Na[rs]--,Na[rs]=0;Xs--){var Xu=Xn.nodes[Xs],uh=cn[Xu.id].degree,Vg=cn[Xu.id].inDegree,Yg=cn[Xu.id].outDegree,Hg=Xu[i],dd=_a(Tn,Hg,oe,ce),fh=dd.minPatternNodeLabelDegree,Zg=dd.minPatternNodeLabelInDegree,Kg=dd.minPatternNodeLabelOutDegree,$g=r?uh=0;Ql--){var Vu=pa[Ql];if(!cn[Vu.source]||!cn[Vu.target]){pa.splice(Ql,1);var Jl=Vu[o];if(ma[Jl]--,cn[Vu.source]&&(cn[Vu.source].degree--,cn[Vu.source].outDegree--),cn[Vu.target]&&(cn[Vu.target].degree--,cn[Vu.target].inDegree--),we[Jl]&&ma[Jl]=0;Ja--){var oi=Qa(Ja);if(oi==="break")break}for(var Si=Ra.length,Ai=function(Ca){var Xn=Ra[Ca],Ta={};Xn.edges.forEach(function(pa){var ma="".concat(pa.source,"-").concat(pa.target,"-").concat(pa.label);Ta[ma]?Ta[ma]++:Ta[ma]=1});for(var Na=function(ma){var Ua=Ra[ma],xa={};Ua.edges.forEach(function(Xa){var Ci="".concat(Xa.source,"-").concat(Xa.target,"-").concat(Xa.label);xa[Ci]?xa[Ci]++:xa[Ci]=1});var Nn=!0;Object.keys(xa).length!==Object.keys(Ta).length?Nn=!1:Object.keys(Ta).forEach(function(Xa){xa[Xa]!==Ta[Xa]&&(Nn=!1)}),Nn&&Ra.splice(ma,1)},cn=Si-1;cn>Ca;cn--)Na(cn);Si=Ra.length},Ja=0;Ja<=Si-1;Ja++)Ai(Ja);return Ra}}},to=So,co=function(){function c(t){t===void 0&&(t=10),this.linkedList=new Se,this.maxStep=t}return Object.defineProperty(c.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),c.prototype.isEmpty=function(){return!this.linkedList.head},c.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},c.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},c.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},c.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},c.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},c.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},c}(),ni=co,lo=br,Ss={getAdjMatrix:te,breadthFirstSearch:ht,connectedComponent:Qe,getDegree:St,getInDegree:Ct,getOutDegree:_t,detectCycle:br,detectDirectedCycle:lo,detectAllCycles:qt,detectAllDirectedCycle:Bt,detectAllUndirectedCycle:ft,depthFirstSearch:xr,dijkstra:Hr,findAllPath:Gr,findShortestPath:qr,floydWarshall:Gn,labelPropagation:$r,louvain:K,iLouvain:rt,kCore:ae,kMeans:C,cosineSimilarity:he,nodesCosineSimilarity:Ee,minimumSpanningTree:Ot,pageRank:pr,getNeighbors:pe,Stack:ni,GADDI:to},Ro=z(77160),mi=z(35600),ya=z(31437),_o=q.vs,Yi=function(t){return function(e,r){return e[t]-r[t]}},Fi=function(t,e,r){return t>=e&&t<=r},Bo=function(t,e,r,n){var a=1e-4,i={x:r.x-t.x,y:r.y-t.y},o={x:e.x-t.x,y:e.y-t.y},s={x:n.x-r.x,y:n.y-r.y},l=o.x*s.y-o.y*s.x,h=l*l,p=1/l,D=o.x*o.x+o.y*o.y,I=s.x*s.x+s.y*s.y;if(h>a*D*I){var F=(i.x*s.y-i.y*s.x)*p,Z=(i.x*o.y-i.y*o.x)*p;return!Fi(F,0,1)||!Fi(Z,0,1)?null:{x:t.x+F*o.x,y:t.y+F*o.y}}return null},_s=function(t,e){var r=t.x,n=t.y,a=t.width,i=t.height,o=r+a/2,s=n+i/2,l=[],h={x:o,y:s};l.push({x:r,y:n}),l.push({x:r+a,y:n}),l.push({x:r+a,y:n+i}),l.push({x:r,y:n+i}),l.push({x:r,y:n});for(var p=null,D=1;De[n][i]+e[i][a]&&(e[n][a]=e[n][i]+e[i][a]);return e},Li=function(t,e){var r=t.nodes,n=t.edges,a=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(function(o,s){i[o.id]=s;var l=[];a.push(l)}),n&&n.forEach(function(o){var s=o.source,l=o.target,h=i[s],p=i[l];a[h][p]=1,e||(a[p][h]=1)}),a},Mo=function(t,e){t.translate(e.x,e.y)},ho=function(t,e,r,n){n===void 0&&(n={duration:500});var a=t.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]);var i=t.getCanvasBBox(),o=e.x-i.minX,s=e.y-i.minY;if(r){var l=o*a[0],h=s*a[4],p=0,D=0,I=0,F=0;t.animate(function(ee){return I=l*ee,F=h*ee,a=_o(a,[["t",I-p,F-D]]),p=I,D=F,{matrix:a}},n)}else{var Z=_o(a,[["t",o,s]]);t.setMatrix(Z)}},Gi=function(t,e){var r=t.getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]);var n=e;(0,m.isArray)(e)||(n=[e,e]),(0,m.isArray)(e)&&e.length===1&&(n=[e[0],e[0]]),r=_o(r,[["s",n[0],n[1]]]),t.setMatrix(r)},Di=function(t,e){var r=t.getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]),r=_o(r,[["r",e]]),t.setMatrix(r)},$o=function(t,e,r){for(var n=[],a=0;a0!=o(h[1]-r)>0&&o(e-(r-l[1])*(l[0]-h[0])/(l[1]-h[1])-l[0])<0&&(n=!n)}return n},Qo=function(t,e){return!(e.minX>t.maxX||e.maxXt.maxY||e.maxY1){var oe=D[0],ce=D[F-1];I.push({from:{x:ce[0],y:ce[1]},to:{x:oe[0],y:oe[1]}})}return I};if(t.length<2||e.length<2)return!1;var a=r(t),i=r(e);if(!Qo(a,i))return!1;var o=!1;if((0,m.each)(e,function(p){if(ro(t,p[0],p[1]))return o=!0,!1}),o||((0,m.each)(t,function(p){if(ro(e,p[0],p[1]))return o=!0,!1}),o))return!0;var s=n(t),l=n(e),h=!1;return(0,m.each)(l,function(p){if(ns(s,p))return h=!0,!1}),h},ga=function(){function c(t,e,r,n){this.x1=t,this.y1=e,this.x2=r,this.y2=n}return c.prototype.getBBox=function(){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),r=Math.max(this.x1,this.x2),n=Math.max(this.y1,this.y2),a={x:t,y:e,minX:t,minY:e,maxX:r,maxY:n,width:r-t,height:n-e};return a},c}(),vo=function(t,e){var r={top:[t.minX,t.minY,t.maxX,t.minY],left:[t.minX,t.minY,t.minX,t.maxY],bottom:[t.minX,t.maxY,t.maxX,t.maxY],right:[t.maxX,t.minY,t.maxX,t.maxY]};return r[e]},Vs=function(t,e){var r=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),n=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),a=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(a){var i=r/a,o=n/a;if(i>=0&&i<=1&&o>=0&&o<=1)return i}return Number.POSITIVE_INFINITY},Pi=function(t,e){for(var r=["top","left","bottom","right"],n=t.getBBox(),a=0,i=[],o=0;o<4;o++){var s=vo(n,r[o]),l=s[0],h=s[1],p=s[2],D=s[3];i[o]=Bo({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:l,y:h},{x:p,y:D}),i[o]&&(a+=1)}return[i,a]},Ao=function(t,e){for(var r=["top","left","bottom","right"],n=t.getBBox(),a=Number.POSITIVE_INFINITY,i=0,o=0;o<4;o++){var s=vo(n,r[o]),l=s[0],h=s[1],p=s[2],D=s[3],I=Vs(e,new ga(l,h,p,D));I=Math.abs(I-.5),I>=0&&I<=1&&(i+=1,a=I0){for(var n=0,a=t;ne.x+e.width,a=t.y>e.y+e.height,i=t.y":.604998779296875,"/":.5,"?":.53699951171875},Xi=Math.PI,zo=Math.sin,is=Math.cos,ui=zo(Xi/8),ai=is(Xi/8),Eo=function(t,e){var r=t.getBBox(),n={x:r.minX,y:r.minY},a={x:r.maxX,y:r.maxY};if(e){var i=e.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]),n=_n(n,i),a=_n(a,i)}var o=n.x,s=n.y,l=a.x,h=a.y;return{x:o,y:s,minX:o,minY:s,maxX:l,maxY:h,width:l-o,height:h-s}},Yu=function(t){var e=t.sourceNode||t.targetNode,r=e.get("group"),n=r.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var a=e.getKeyShape(),i=a.getBBox(),o=t.loopCfg||{},s=o.dist||Math.max(i.width,i.height)*2,l=o.position||an.defaultLoopPosition,h=[(i.minX+i.maxX)/2+n[6],(i.minY+i.maxY)/2+n[7]],p=[t.startPoint.x,t.startPoint.y],D=[t.endPoint.x,t.endPoint.y],I=i.height/2,F=i.width/2,Z=I,ee=I,se=Z*ui,oe=Z*ai,ce=ee*ui,we=ee*ai,Re=a.get("type"),Oe=Math.min(I/2,F/2),Pe=Math.min(I,F),He=(o==null?void 0:o.pointPadding)?Math.min(Pe,o==null?void 0:o.pointPadding):Oe;if(p[0]===D[0]&&p[1]===D[1]){switch(l){case"top":Re==="circle"?(p=[h[0]-se,h[1]-oe],D=[h[0]+ce,h[1]-we]):(p=[h[0]-He,h[1]-I],D=[h[0]+He,h[1]-I]);break;case"top-right":Z=I,ee=F,Re==="circle"?(se=Z*ui,oe=Z*ai,ce=ee*ui,we=ee*ai,p=[h[0]+se,h[1]-oe],D=[h[0]+we,h[1]-ce]):(p=[h[0]+F-He,h[1]-I],D=[h[0]+F,h[1]-I+He]);break;case"right":Z=F,ee=F,Re==="circle"?(se=Z*ui,oe=Z*ai,ce=ee*ui,we=ee*ai,p=[h[0]+oe,h[1]-se],D=[h[0]+we,h[1]+ce]):(p=[h[0]+F,h[1]-He],D=[h[0]+F,h[1]+He]);break;case"bottom-right":Z=F,ee=I,Re==="circle"?(se=Z*ui,oe=Z*ai,ce=ee*ui,we=ee*ai,p=[h[0]+oe,h[1]+se],D=[h[0]+ce,h[1]+we]):(p=[h[0]+F,h[1]+I-He],D=[h[0]+F-He,h[1]+I]);break;case"bottom":Z=I,ee=I,Re==="circle"?(se=Z*ui,oe=Z*ai,ce=ee*ui,we=ee*ai,p=[h[0]+se,h[1]+oe],D=[h[0]-ce,h[1]+we]):(p=[h[0]-He,h[1]+I],D=[h[0]+He,h[1]+I]);break;case"bottom-left":Z=I,ee=F,Re==="circle"?(se=Z*ui,oe=Z*ai,ce=ee*ui,we=ee*ai,p=[h[0]-se,h[1]+oe],D=[h[0]-we,h[1]+ce]):(p=[h[0]-F,h[1]+I-He],D=[h[0]-F+He,h[1]+I]);break;case"left":Z=F,ee=F,Re==="circle"?(se=Z*ui,oe=Z*ai,ce=ee*ui,we=ee*ai,p=[h[0]-oe,h[1]+se],D=[h[0]-we,h[1]-ce]):(p=[h[0]-F,h[1]-He],D=[h[0]-F,h[1]+He]);break;case"top-left":Z=F,ee=I,Re==="circle"?(se=Z*ui,oe=Z*ai,ce=ee*ui,we=ee*ai,p=[h[0]-oe,h[1]-se],D=[h[0]-ce,h[1]-we]):(p=[h[0]-F+He,h[1]-I],D=[h[0]-F,h[1]-I+He]);break;default:Z=F,ee=F,se=Z*ui,oe=Z*ai,ce=ee*ui,we=ee*ai,p=[h[0]-se,h[1]-oe],D=[h[0]+ce,h[1]-we]}if(o.clockwise===!1){var at=[p[0],p[1]];p=[D[0],D[1]],D=[at[0],at[1]]}}var qe=[p[0]-h[0],p[1]-h[1]],yt=(Z+s)/Z,Ft=(ee+s)/ee;o.clockwise===!1&&(yt=(ee+s)/ee,Ft=(Z+s)/Z);var yr=ya.scale([0,0],qe,yt),fr=[h[0]+yr[0],h[1]+yr[1]],lr=[D[0]-h[0],D[1]-h[1]],Kt=ya.scale([0,0],lr,Ft),jr=[h[0]+Kt[0],h[1]+Kt[1]];return t.startPoint={x:p[0],y:p[1]},t.endPoint={x:D[0],y:D[1]},t.controlPoints=[{x:fr[0],y:fr[1]},{x:jr[0],y:jr[1]}],t},Hu=function(t,e,r,n,a){var i=1e-4,o=[],s=t==null?void 0:t.getPoint(e);if(!s)return{x:0,y:0,angle:0};if(e1-i)o=t.getEndTangent();else{var l=t==null?void 0:t.getPoint(e+i);o.push([s.x,s.y]),o.push([l.x,l.y])}var h=Math.atan2(o[1][1]-o[0][1],o[1][0]-o[0][0]);if(h<0&&(h+=Xi*2),r&&(s.x+=is(h)*r,s.y+=zo(h)*r),n){var p=h-Xi/2;h>1/2*Xi&&h<3*1/2*Xi&&(p-=Xi),s.x+=is(p)*n,s.y+=zo(p)*n}var D={x:s.x,y:s.y,angle:h};return a?(h>.5*Xi&&h<1.5*Xi&&(h-=Xi),(0,b.__assign)({rotate:h},D)):D},du=function c(t,e,r,n){if(n(t,e,r)===!1)return!1;if(t&&t.children){for(var a=t.children.length-1;a>=0;a--)if(!c(t.children[a],t,a,n))return!1}return!0},hu=function c(t,e,r,n){if(t&&t.children){for(var a=t.children.length-1;a>=0;a--)if(!c(t.children[a],t,a,n))return}return n(t,e,r)!==!1},Ei=function(t,e){typeof e=="function"&&du(t,null,-1,e)},Ki=function(t,e){typeof e=="function"&&hu(t,null,-1,e)},Zs=function(t,e){return e*(Hs[t]||1)},Ks=function(t,e){var r=0,n=new RegExp("[\u4E00-\u9FA5]+");return t.split("").forEach(function(a){n.test(a)?r+=e:r+=Zs(a,e)}),[r,e]},io=function(t,e){return typeof e!="number"||e<=0||e>=t.length?t:t.substring(0,e)+"..."},os=function(t,e){var r=[],n={},a={};t.forEach(function(s){a[s.id]=s}),t.forEach(function(s,l){var h=(0,m.clone)(s);h.itemType="combo",h.children=void 0,h.parentId===h.id?(console.warn("The parentId for combo ".concat(h.id," can not be the same as the combo's id")),delete h.parentId):h.parentId&&!a[h.parentId]&&(console.warn("The parent combo for combo ".concat(h.id," does not exist!")),delete h.parentId);var p=n[h.id];if(p){if(h.children=p.children,n[h.id]=h,p=h,!p.parentId){r.push(p);return}var D=n[p.parentId];if(D)D.children?D.children.push(h):D.children=[h];else{var I={id:p.parentId,children:[p]};n[p.parentId]=I,n[h.id]=h}return}if((0,m.isString)(s.parentId)){var F=n[s.parentId];if(F)F.children?F.children.push(h):F.children=[h],n[h.id]=h;else{var Z={id:s.parentId,children:[h]};n[Z.id]=Z,n[h.id]=h}}else r.push(h),n[h.id]=h});var i={};(e||[]).forEach(function(s){i[s.id]=s;var l=n[s.comboId];if(l){var h={id:s.id,comboId:s.comboId};l.children?l.children.push(h):l.children=[h],h.itemType="node",n[s.id]=h}});var o=0;return r.forEach(function(s){s.depth=o+10,Ei(s,function(l){var h,p=n[l.id].itemType;p==="node"?h=n[l.comboId]:h=n[l.parentId],h&&p==="node"?l.depth=o+1:l.depth=o+10,o-1&&a.splice(h,1),s||(i={id:e,itemType:"node",comboId:r},o[e]={children:void 0}),e){var p=!1;if(r){var D=0;(t||[]).forEach(function(F){p||Ei(F,function(Z){return r===Z.id?(p=!0,Z.children?Z.children.push(i):Z.children=[i],D=Z.depth,i.itemType==="node"?i.depth=D+2:i.depth=D+1,!1):!0})})}else(!r||!p)&&i.itemType!=="node"&&t.push(i);var I=i.depth;Ei(i,function(F){return F.itemType==="node"?I+=2:I+=1,F.depth=I,!0})}return t},us=function(t,e,r){var n={minX:Infinity,minY:Infinity,maxX:-Infinity,maxY:-Infinity,x:void 0,y:void 0,width:void 0,height:void 0,centerX:void 0,centerY:void 0};if(!t||t.length===0){var a=r==null?void 0:r.getModel(),i=a||{},o=i.x,s=i.y,l=i.fixSize,h=i.collapsed,p=i.fixCollapseSize,D=h?p:l,I=(0,m.isArray)(D)?D:[D,D],F=I[0],Z=I[1],ee=[F/2,Z/2];return{minX:o-ee[0],minY:s-ee[1],maxX:o+ee[0],maxY:s+ee[1],x:o,y:s,width:F,height:Z}}return t.forEach(function(se){var oe=e.findById(se.id);if(!(!oe||!oe.isVisible())){oe.set("bboxCanvasCache",void 0);var ce=oe.getCanvasBBox();ce.x&&n.minX>ce.minX&&(n.minX=ce.minX),ce.y&&n.minY>ce.minY&&(n.minY=ce.minY),ce.x&&n.maxXr&&(r=p),D>a&&(a=D)}var I=Math.floor(e),F=Math.floor(n),Z=Math.ceil(r)-Math.floor(e),ee=Math.ceil(a)-Math.floor(n);return{x:I,y:F,width:Z,height:ee,minX:e,minY:n,maxX:r,maxY:a}},Mf=function(t,e,r,n,a){e===void 0&&(e=15),r===void 0&&(r="quadratic"),n===void 0&&(n=void 0),a===void 0&&(a=void 0);for(var i=t.length,o=e*2,s=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],l={},h=[],p={},D=0;Dr.get("optimizeThreshold")){var o=Infinity,s=Infinity,l=-Infinity,h=-Infinity;i.forEach(function(we){var Re=we.getModel(),Oe=Re.x,Pe=Re.y;o>Oe&&(o=Oe),s>Pe&&(s=Pe),lee&&(se=ee,console.warn("fitview failed, ratio out of range, ratio: %f",o,"graph maxzoom has been used instead"));var oe=(0,Ts.vs)(I,[["t",-a.x,-a.y],["s",se,se],["t",a.x,a.y]]),ce=bo({animateCfg:r,callback:function(){t.setMatrix(oe),l.emit("viewportchange",{action:"translate",matrix:I}),l.emit("viewportchange",{action:"zoom",matrix:oe})}});t.stopAnimate(),t.setMatrix(e),t.animate(function(we){return{matrix:Fa(e,oe,we)}},ce)}},c.prototype.fitView=function(t,e){var r=this.graph,n=this.getFormatPadding(),a=r.get("width"),i=r.get("height"),o=r.get("group"),s=o.getMatrix()||[1,0,0,0,1,0,0,0,1];o.resetMatrix();var l,h=r.getNodes();if(h.length>r.get("optimizeThreshold")){var p=Infinity,D=Infinity,I=-Infinity,F=-Infinity;h.forEach(function(Oe){var Pe=Oe.getModel(),He=Pe.x,at=Pe.y;p>He&&(p=He),D>at&&(D=at),Ioe&&(ce=oe),t)this.animatedFitView(o,s,e,l,Z,ee,ce,!0);else{var we=Z.x-ee.x,Re=Z.y-ee.y;if(xo(we)||xo(Re))return;r.translate(we,Re),r.zoom(ce,Z)||console.warn("zoom failed, ratio out of range, ratio: %f",ce)}}},c.prototype.fitViewByRules=function(t,e,r){var n=t.onlyOutOfViewPort,a=n===void 0?!1:n,i=t.direction,o=i===void 0?"both":i,s=t.ratioRule,l=s===void 0?"min":s,h=this.graph,p=this.getFormatPadding(),D=h.get("width"),I=h.get("height"),F=h.get("group"),Z=F.getMatrix()||[1,0,0,0,1,0,0,0,1];F.resetMatrix();var ee,se=h.getNodes();if(se.length>h.get("optimizeThreshold")){var oe=Infinity,ce=Infinity,we=-Infinity,Re=-Infinity;se.forEach(function(fr){var lr=fr.getModel(),Kt=lr.x,jr=lr.y;oe>Kt&&(oe=Kt),ce>jr&&(ce=jr),wep.maxX&&(p.maxX=Z.maxX),Z.maxY>p.maxY&&(p.maxY=Z.maxY)}if(p.x=p.minX,p.y=p.minY,p.width=p.maxX-p.minX,p.height=p.maxY-p.minY,!(p.width===0||p.height===0)){var ee=this.getViewCenter(),se={x:p.x+p.width/2,y:p.y+p.height/2},oe=(o-i[1]-i[3])/p.width,ce=(s-i[0]-i[2])/p.height,we=oe;oe>ce&&(we=ce),r?this.animatedFitView(l,h,n,p,ee,se,we,e):(a.translate(ee.x-se.x,ee.y-se.y),e&&!a.zoom(we,ee)&&console.warn("zoom failed, ratio out of range, ratio: %f",we))}}},c.prototype.changeSize=function(t,e){var r=this.graph;if(!(0,m.isNumber)(t)||!(0,m.isNumber)(e))throw Error("invalid canvas width & height, please make sure width & height type is number");r.set({width:t,height:e});var n=r.get("canvas");n.changeSize(t,e);var a=r.get("plugins");a.forEach(function(i){i.get("gridContainer")&&i.positionInit()})},c.prototype.destroy=function(){this.graph=null,this.destroyed=!1},c}(),u=Cf;function O(c){return O=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},O(c)}function ue(c){if(typeof c!="string")return c;var t=function(Pe){if(typeof Pe!="string")return Pe;try{return JSON.parse(Pe.trim())}catch(He){return Pe.trim()}},e=t(c);if(typeof e!="string")return e;for(var r=function(Pe){return Pe[Pe.length-1]},n=c.trim(),a=[],i=[],o=function(){for(var Pe=[],He=0;He=0&&(a.height=i),o>=0&&(a.width=o),n.marginTop&&(a.y+=n.marginTop),n.marginLeft&&(a.x+=n.marginLeft),a}function Ye(c,t){var e;t===void 0&&(t={x:0,y:0});var r=(0,b.__assign)({x:0,y:0,width:0,height:0},t);if((e=c.children)===null||e===void 0?void 0:e.length){var n=c.attrs,a=n===void 0?{}:n,i=a.marginTop,o=(0,b.__assign)({},t);i&&(o.y+=i);for(var s=0;sr.width&&(r.width=h.width+h.x),h.height+h.y>r.height&&(r.height=h.height+h.y)}}}return c.bbox=Be(c,t,r),c.attrs=(0,b.__assign)((0,b.__assign)({},c.attrs),c.bbox),c}function Je(c,t){var e,r,n,a,i=(c||{}).type,o=((t==null?void 0:t.attrs)||{}).key;if(o&&c&&(c.attrs.key=o),!c&&t)return{action:"delete",val:t,type:i,key:o};if(c&&!t)return{action:"add",val:c,type:i};if(!c&&!t)return{action:"same",type:i};var s=[];if(((e=c.children)===null||e===void 0?void 0:e.length)>0||((r=t.children)===null||r===void 0?void 0:r.length)>0)for(var l=Math.max((n=c.children)===null||n===void 0?void 0:n.length,(a=t.children)===null||a===void 0?void 0:a.length),h=t.children||[],p=c.children||[],D=0;D-1)return;r.push(a)}else s>-1&&r.splice(s,1)}else if((0,m.isString)(e)){var l=r.filter(function(D){return D.includes(i)});l.length>0&&this.clearStates(l),o=o.filter(function(D){return!D.includes(i)}),o.push(a),this.set("states",o)}if(n){var h=this.get("model"),p=h.type;n.setState(p,t,e,this)}},c.prototype.clearStates=function(t){var e=this,r=e.getStates(),n=e.get("shapeFactory"),a=e.get("model"),i=a.type;t||(t=r),(0,m.isString)(t)&&(t=[t]);var o=r.filter(function(s){return t.indexOf(s)===-1});e.set("states",o),t.forEach(function(s){n.setState(i,s,!1,e)})},c.prototype.setOptimize=function(t){this.optimize=t},c.prototype.getContainer=function(){return this.get("group")},c.prototype.getKeyShape=function(){return this.get("keyShape")},c.prototype.getModel=function(){return this.get("model")},c.prototype.getType=function(){return this.get("type")},c.prototype.getID=function(){return this.get("id")},c.prototype.isItem=function(){return!0},c.prototype.getStates=function(){return this.get("states")},c.prototype.hasState=function(t){var e=this.getStates();return e.indexOf(t)>=0},c.prototype.refresh=function(t){var e=this.get("model");this.updatePosition(e),this.updateShape(t),this.afterUpdate(),this.clearCache()},c.prototype.getUpdateType=function(t){},c.prototype.update=function(t,e){e===void 0&&(e=void 0);var r=this.get("model");if(e==="move")this.updatePosition(t);else{var n=r.visible,a=t.visible;n!==a&&a!==void 0&&this.changeVisibility(a);var i={x:r.x,y:r.y};t.x=isNaN(+t.x)?r.x:+t.x,t.y=isNaN(+t.y)?r.y:+t.y;var o=this.get("styles");if(t.stateStyles){var s=t.stateStyles;(0,m.mix)(o,s),delete t.stateStyles}Object.assign(r,t),(i.x!==t.x||i.y!==t.y)&&this.updatePosition(t),this.updateShape(e)}this.afterUpdate(),this.clearCache()},c.prototype.updateShape=function(t){var e=this.get("shapeFactory"),r=this.get("model"),n=r.type;if(e.shouldUpdate(n)&&n===this.get("currentShape")){var a=this.getShapeCfg(r,t);e.baseUpdate(n,a,this,t),t!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(e,n)},c.prototype.updatePosition=function(t){var e=this.get("model"),r=isNaN(+t.x)?+e.x:+t.x,n=isNaN(+t.y)?+e.y:+t.y,a=this.get("group");if(isNaN(r)||isNaN(n))return!1;e.x=r,e.y=n;var i=a.getMatrix();return i&&i[6]===r&&i[7]===n?!1:(a.resetMatrix(),Mo(a,{x:r,y:n}),this.clearCache(),!0)},c.prototype.getBBox=function(){var t=this.get(hr);return t||(t=this.calculateBBox(),this.set(hr,t)),t},c.prototype.getCanvasBBox=function(){var t=this.get(rn);return t||(t=this.calculateCanvasBBox(),this.set(rn,t)),t},c.prototype.toFront=function(){var t=this.get("group");t.toFront()},c.prototype.toBack=function(){var t=this.get("group");t.toBack()},c.prototype.show=function(){this.changeVisibility(!0)},c.prototype.hide=function(){this.changeVisibility(!1)},c.prototype.changeVisibility=function(t){var e=this.get("group");t?e.show():e.hide(),this.set("visible",t)},c.prototype.isVisible=function(){return this.get("visible")},c.prototype.enableCapture=function(t){var e=this.get("group");e&&e.set("capture",t)},c.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),e.remove(),this._cfg=null,this.destroyed=!0}},c}(),Un=qn,Mn={source:"start",target:"end"},Cn="Node",Ga="Point",ei="Anchor",Ka=function(c){(0,b.__extends)(t,c);function t(){return c!==null&&c.apply(this,arguments)||this}return t.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},t.prototype.setEnd=function(e,r){var n=Mn[e]+Ga,a=e+Cn,i=this.get(a);i&&!i.destroyed&&i.removeEdge(this),(0,m.isPlainObject)(r)?(this.set(n,r),this.set(a,null)):r&&(r.addEdge(this),this.set(a,r),this.set(n,null))},t.prototype.getLinkPoint=function(e,r,n){var a=Mn[e]+Ga,i=e+Cn,o=this.get(a);if(!o){var s=this.get(i),l=e+ei,h=this.getPrePoint(e,n),p=r[l];(0,m.isNil)(p)||(o=s.getLinkPointByAnchor(p)),o=o||s.getLinkPoint(h),(0,m.isNil)(o.index)||this.set("".concat(e,"AnchorIndex"),o.index)}return o},t.prototype.getPrePoint=function(e,r){if(r&&r.length){var n=e==="source"?0:r.length-1;return r[n]}var a=e==="source"?"target":"source";return this.getEndPoint(a)},t.prototype.getEndPoint=function(e){var r=e+Cn,n=Mn[e]+Ga,a=this.get(r);return a&&!a.destroyed?a.get("model"):this.get(n)},t.prototype.getControlPointsByCenter=function(e){var r=this.getEndPoint("source"),n=this.getEndPoint("target"),a=this.get("shapeFactory"),i=e.type;return a.getControlPoints(i,{startPoint:r,endPoint:n})},t.prototype.getEndCenter=function(e){var r=e+Cn,n=Mn[e]+Ga,a=this.get(r);if(a){var i=a.getBBox();return{x:i.centerX,y:i.centerY}}return this.get(n)},t.prototype.init=function(){c.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},t.prototype.getShapeCfg=function(e,r){var n=this,a=n.get("linkCenter"),i=(r==null?void 0:r.includes("move"))?e:c.prototype.getShapeCfg.call(this,e);if(a)i.startPoint=n.getEndCenter("source"),i.endPoint=n.getEndCenter("target");else{var o=i.controlPoints||n.getControlPointsByCenter(i);i.startPoint=n.getLinkPoint("source",e,o),i.endPoint=n.getLinkPoint("target",e,o)}return i.sourceNode=n.get("sourceNode"),i.targetNode=n.get("targetNode"),i},t.prototype.getModel=function(){var e=this.get("model"),r=this.get("source".concat(Cn)),n=this.get("target".concat(Cn));return r?delete e["source".concat(Cn)]:e.source=this.get("start".concat(Ga)),n?delete e["target".concat(Cn)]:e.target=this.get("end".concat(Ga)),!(0,m.isString)(e.source)&&!(0,m.isPlainObject)(e.source)&&(e.source=e.source.getID()),!(0,m.isString)(e.target)&&!(0,m.isPlainObject)(e.target)&&(e.target=e.target.getID()),e},t.prototype.setSource=function(e){this.setEnd("source",e),this.set("source",e)},t.prototype.setTarget=function(e){this.setEnd("target",e),this.set("target",e)},t.prototype.getSource=function(){return this.get("source")},t.prototype.getTarget=function(){return this.get("target")},t.prototype.updatePosition=function(){return!1},t.prototype.update=function(e,r){r===void 0&&(r=void 0);var n=this.get("model"),a=n.visible,i=e.visible;a!==i&&i!==void 0&&this.changeVisibility(i);var o=this.get("source"),s=this.get("target");if(!(!o||o.destroyed||!s||s.destroyed)){var l=this.get("styles");if(e.stateStyles){var h=e.stateStyles;(0,m.mix)(l,h),delete e.stateStyles}Object.assign(n,e),this.updateShape(r),this.afterUpdate(),this.clearCache()}},t.prototype.destroy=function(){var e=this.get("source".concat(Cn)),r=this.get("target".concat(Cn));e&&!e.destroyed&&e.removeEdge(this),r&&!r.destroyed&&r.removeEdge(this),c.prototype.destroy.call(this)},t}(Un),$a=Ka,Ha="anchorPointsCache",fi="bboxCache",bi=function(c){(0,b.__extends)(t,c);function t(){return c!==null&&c.apply(this,arguments)||this}return t.prototype.getNearestPoint=function(e,r){for(var n=0,a=e[0],i=Va(e[0],r),o=0;o-1&&r.splice(n,1)},t.prototype.clearCache=function(){this.set(fi,null),this.set(Ha,null)},t.prototype.getUpdateType=function(e){var r,n,a,i,o;if(!!e){var s=!(0,m.isNil)(e.x),l=!(0,m.isNil)(e.y),h=Object.keys(e);if(h.length===1&&(s||l)||h.length===2&&s&&l)return"move";if((0,m.isNumber)(e.x)||(0,m.isNumber)(e.y)||e.type||e.anchorPoints||e.size||(e==null?void 0:e.style)&&(((r=e==null?void 0:e.style)===null||r===void 0?void 0:r.r)||((n=e==null?void 0:e.style)===null||n===void 0?void 0:n.width)||((a=e==null?void 0:e.style)===null||a===void 0?void 0:a.height)||((i=e==null?void 0:e.style)===null||i===void 0?void 0:i.rx)||((o=e==null?void 0:e.style)===null||o===void 0?void 0:o.ry)))return"bbox|label";var p=h.includes("label")||h.includes("labelCfg");return p?"style|label":"style"}},t.prototype.setState=function(e,r){var n=this;if(this.optimize){c.prototype.setState.call(this,e,r);return}this.runWithBBoxAffected(function(){return c.prototype.setState.call(n,e,r)})},t.prototype.clearStates=function(e){var r=this;if(this.optimize){c.prototype.clearStates.call(this,e);return}this.runWithBBoxAffected(function(){return c.prototype.clearStates.call(r,e)})},t.prototype.runWithBBoxAffected=function(e){var r=["r","width","height","rx","ry","lineWidth"],n=this.getKeyShape().attr(),a={};Object.keys(this.getKeyShape().attr()).forEach(function(l){r.includes(l)&&(a[l]=n[l])}),e();for(var i=this.getKeyShape().attr(),o=0;o-1?(r.splice(n,1),!0):!1}},t.prototype.removeNode=function(e){if(!!e){var r=this.getNodes(),n=r.indexOf(e);return n>-1?(r.splice(n,1),!0):!1}},t.prototype.getUpdateType=function(e){},t.prototype.getBBox=function(){this.set(Jo,null);var e=this.calculateCanvasBBox();return e},t.prototype.clearCache=function(){this.set(Oa,null),this.set(Jo,null),this.set(oo,null)},t.prototype.destroy=function(){if(!this.destroyed){var e=this.get("animate"),r=this.get("group");e&&r.stopAnimate(),r.shapeMap={},this.clearCache(),this.set(Wo,null),this.set("bbox",null),r.remove(),this._cfg=null,this.destroyed=!0}},t}(ha),Tf=Qs,Qu="node",Ju="edge",cc="vedge",yu="combo",If="default",Of="Mapper",qo="stateStyles",Af=function(){function c(t){var e=this;this.edgeToBeUpdateMap={},this.throttleRefresh=(0,m.throttle)(function(r){var n=e.graph;if(!(!n||n.get("destroyed"))){var a=e.edgeToBeUpdateMap;if(!!a){var i=Object.values(a);!i.length||(i.forEach(function(o){var s=o.edge;if(!(!s||s.destroyed)){var l=s.getSource(),h=s.getTarget();!l||l.destroyed||!h||h.destroyed||s.refresh(o.updateType)}}),e.edgeToBeUpdateMap={})}}},16,{trailing:!0,leading:!0}),this.graph=t,this.destroyed=!1}return c.prototype.addItem=function(t,e){var r=this.graph,n=t===cc?Ju:t,a=r.get("".concat(n,"Group"))||r.get("group"),i=(0,m.upperFirst)(n),o=null,s=r.get(n+(0,m.upperFirst)(qo))||{},l=r.get(If+i);e[qo]&&(s=e[qo]),l&&(0,m.each)(l,function(Oe,Pe){(0,m.isObject)(Oe)&&!(0,m.isArray)(Oe)?e[Pe]=(0,m.deepMix)({},Oe,e[Pe]):(0,m.isArray)(Oe)?e[Pe]=e[Pe]||(0,m.clone)(l[Pe]):e[Pe]=e[Pe]||l[Pe]});var h=r.get(n+Of);if(h){var p=h(e);p[qo]&&(s=p[qo],delete p[qo]),(0,m.each)(p,function(Oe,Pe){(0,m.isObject)(Oe)&&!(0,m.isArray)(Oe)?e[Pe]=(0,m.deepMix)({},e[Pe],Oe):e[Pe]=p[Pe]||e[Pe]})}if(r.emit("beforeadditem",{type:t,model:e}),t===Ju||t===cc){var D=void 0,I=void 0;if(D=e.source,I=e.target,D&&(0,m.isString)(D)&&(D=r.findById(D)),I&&(0,m.isString)(I)&&(I=r.findById(I)),!D||!I){console.warn("The source or target node of edge ".concat(e.id," does not exist!"));return}D.getType&&D.getType()==="combo"&&(e.isComboEdge=!0),I.getType&&I.getType()==="combo"&&(e.isComboEdge=!0),o=new $a({model:e,source:D,target:I,styles:s,linkCenter:r.get("linkCenter"),group:a.addGroup()})}else if(t===Qu)o=new ha({model:e,styles:s,group:a.addGroup()});else if(t===yu){var F=e.children,Z=us(F,r),ee=void 0,se=void 0;if(isNaN(Z.x)?isNaN(e.x)&&(ee=Math.random()*100):ee=Z.x,isNaN(Z.y)?isNaN(e.y)&&(se=Math.random()*100):se=Z.y,isNaN(e.x)||isNaN(e.y))e.x=ee,e.y=se;else{var oe=e.x-ee,ce=e.y-se;this.updateComboSucceeds(e.id,oe,ce,F)}var we=a.addGroup();we.setZIndex(e.depth),o=new Tf({model:e,styles:s,animate:r.get("animate"),bbox:e.collapsed?us([],r):Z,group:we}),!e.collapsed&&o.getKeyShape().get("type")==="circle"&&(Z.width=Math.hypot(Z.height,Z.width),Z.height=Z.width,o.set("bbox",Z),o.refresh());var Re=o.getModel();(F||[]).forEach(function(Oe){var Pe=r.findById(Oe.id);o.addChild(Pe),Oe.depth=Re.depth+2})}if(o)return o.setOptimize(r.getNodes().length>r.get("optimizeThreshold")),r.get("".concat(t,"s")).push(o),r.get("itemMap")[o.get("id")]=o,r.emit("afteradditem",{item:o,model:e}),o},c.prototype.updateItem=function(t,e){var r=this,n,a,i=this.graph;if((0,m.isString)(t)&&(t=i.findById(t)),!(!t||t.destroyed)){var o="";t.getType&&(o=t.getType());var s=i.get(o+Of),l=t.getModel(),h=l.x,p=l.y,D=t.getUpdateType(e);if(s){var I=(0,m.deepMix)({},l,e),F=s(I),Z=(0,m.deepMix)({},l,F,e);F[qo]&&(t.set("styles",Z[qo]),delete Z[qo]),(0,m.each)(Z,function(qe,yt){e[yt]=qe})}else(0,m.each)(e,function(qe,yt){l[yt]&&(0,m.isObject)(qe)&&!(0,m.isArray)(qe)&&(e[yt]=(0,b.__assign)((0,b.__assign)({},l[yt]),e[yt]))});if(i.emit("beforeupdateitem",{item:t,cfg:e}),o===Ju){if(e.source){var ee=e.source;(0,m.isString)(ee)&&(ee=i.findById(ee)),t.setSource(ee)}if(e.target){var se=e.target;(0,m.isString)(se)&&(se=i.findById(se)),t.setTarget(se)}t.update(e)}else if(o===Qu){t.update(e,D);var oe=t.getEdges();D==="move"?(0,m.each)(oe,function(qe){r.edgeToBeUpdateMap[qe.getID()]={edge:qe,updateType:D},r.throttleRefresh()}):(D==null?void 0:D.includes("bbox"))&&(0,m.each)(oe,function(qe){qe.refresh(D)})}else if(o===yu){if(t.update(e,D),!isNaN(e.x)||!isNaN(e.y)){var ce=e.x-h||0,we=e.y-p||0;this.updateComboSucceeds(l.id,ce,we)}var Re=t.getEdges(),Oe=(D==null?void 0:D.includes("bbox"))||D==="move";if(Oe&&o===yu){var Pe=t.get("shapeFactory"),He=l.type||"circle",at=l.animate===void 0||e.animate===void 0?(a=(n=Pe[He])===null||n===void 0?void 0:n.options)===null||a===void 0?void 0:a.animate:l.animate||e.animate;at?setTimeout(function(){if(!(!t||t.destroyed)){var qe=t.getKeyShape();!qe||qe.destroyed||(0,m.each)(Re,function(yt){yt&&!yt.destroyed&&yt.refresh()})}},201):(0,m.each)(Re,function(qe){qe.refresh()})}}t.setOptimize(i.getNodes().length>i.get("optimizeThreshold")),i.emit("afterupdateitem",{item:t,cfg:e})}},c.prototype.updateCombo=function(t,e,r){var n=this,a,i,o=this.graph;if((0,m.isString)(t)&&(t=o.findById(t)),!(!t||t.destroyed)){var s=t.getModel(),l=us(e,o,t),h=l.x,p=l.y;t.set("bbox",l);var D=h,I=p;r?(D=isNaN(s.x)?h:s.x,I=isNaN(s.y)?p:s.y):(D=isNaN(h)?s.x:h,I=isNaN(p)?s.y:p),t.update({x:D,y:I});var F=t.get("shapeFactory"),Z=s.type||"circle",ee=s.animate===void 0?(i=(a=F[Z])===null||a===void 0?void 0:a.options)===null||i===void 0?void 0:i.animate:s.animate;ee?setTimeout(function(){if(!(!t||t.destroyed)){var se=t.getKeyShape();!se||se.destroyed||(t.getShapeCfg(s),n.updateComboEdges(t))}},201):this.updateComboEdges(t)}},c.prototype.updateComboEdges=function(t){for(var e,r,n=t.getEdges()||[],a=0;a-1&&i.splice(o,1),a===Ju){var s=r.get("v".concat(a,"s")),l=s.indexOf(t);l>-1&&s.splice(l,1)}var h=t.get("id"),p=r.get("itemMap");delete p[h];var D=r.get("comboTrees"),I=t.get("id");if(a===Qu){var F=t.getModel().comboId;if(D&&F){var Z=D,ee=!1;D.forEach(function(Oe){ee||Ei(Oe,function(Pe){if(Pe.id===I&&Z){var He=Z.indexOf(Pe);return Z.splice(He,1),ee=!0,!1}return Z=Pe.children,!0})})}for(var se=t.getEdges(),oe=se.length-1;oe>=0;oe--)r.removeItem(se[oe],!1);F&&r.updateCombo(F)}else if(a===yu){var ce=t.getModel().parentId,we,Re=!1;(D||[]).forEach(function(Pe){Re||Ei(Pe,function(He){return He.id===I?(we=He,Re=!0,!1):!0})}),we.removed=!0,we&&we.children&&we.children.forEach(function(Pe){e.removeItem(Pe.id)});for(var se=t.getEdges(),oe=se.length;oe>=0;oe--)r.removeItem(se[oe],!1);ce&&r.updateCombo(ce)}t.destroy(),r.emit("afterremoveitem",{item:n,type:a})}},c.prototype.setItemState=function(t,e,r){var n=this.graph,a=e;(0,m.isString)(r)&&(a="".concat(e,":").concat(r)),!(t.hasState(a)===r&&r||(0,m.isString)(r)&&t.hasState(a))&&(n.emit("beforeitemstatechange",{item:t,state:a,enabled:r}),t.setState(e,r),n.autoPaint(),n.emit("afteritemstatechange",{item:t,state:a,enabled:r}))},c.prototype.priorityState=function(t,e){var r=this.graph,n=t;(0,m.isString)(t)&&(n=r.findById(t)),this.setItemState(n,e,!1),this.setItemState(n,e,!0)},c.prototype.clearItemStates=function(t,e){var r=this.graph;(0,m.isString)(t)&&(t=r.findById(t)),r.emit("beforeitemstatesclear",{item:t,states:e}),t.clearStates(e),r.emit("afteritemstatesclear",{item:t,states:e})},c.prototype.refreshItem=function(t){var e=this.graph;(0,m.isString)(t)&&(t=e.findById(t)),e.emit("beforeitemrefresh",{item:t}),t.refresh(),e.emit("afteritemrefresh",{item:t})},c.prototype.addCombos=function(t,e){var r=this,n=this.graph;(t||[]).forEach(function(i){Ki(i,function(o){var s;return e.forEach(function(l){l.id===o.id&&(l.children=o.children,l.depth=o.depth,s=l)}),s&&r.addItem("combo",s),!0})});var a=n.get("comboGroup");a&&a.sort()},c.prototype.changeItemVisibility=function(t,e){var r=this,n=this.graph;if((0,m.isString)(t)&&(t=n.findById(t)),!t){console.warn("The item to be shown or hidden does not exist!");return}if(n.emit("beforeitemvisibilitychange",{item:t,visible:e}),t.changeVisibility(e),t.getType&&t.getType()===Qu){var a=t.getEdges();(0,m.each)(a,function(h){e&&!(h.get("source").isVisible()&&h.get("target").isVisible())||r.changeItemVisibility(h,e)})}else if(t.getType&&t.getType()===yu){var i=n.get("comboTrees"),o=t.get("id"),s=[],l=!1;(i||[]).forEach(function(p){l||!p.children||p.children.length===0||Ei(p,function(D){return D.id===o?(s=D.children,l=!0,!1):!0})}),s&&(!e||e&&!t.getModel().collapsed)&&s.forEach(function(p){var D=n.findById(p.id);r.changeItemVisibility(D,e)});var a=t.getEdges();(0,m.each)(a,function(p){e&&!(p.get("source").isVisible()&&p.get("target").isVisible())||r.changeItemVisibility(p,e)})}return n.emit("afteritemvisibilitychange",{item:t,visible:e}),t},c.prototype.destroy=function(){this.graph=null,this.destroyed=!0},c}(),lc=Af,el=function(){function c(t){this.graph=t,this.destroyed=!1}return c.prototype.updateState=function(t,e,r){var n=this.graph.get("states"),a=e;(0,m.isString)(r)&&(a="".concat(e,":").concat(r)),n[a]||(n[a]=[]),r?n[a].push(t):n[a]=n[a].filter(function(i){return i!==t}),this.graph.set("states",n),this.graph.emit("graphstatechange",{states:n})},c.prototype.updateStates=function(t,e,r){var n=this.graph.get("states"),a=(0,m.isString)(e)?[e]:e;a.forEach(function(i){var o=i;n[o]||(n[o]=[]),(0,m.isString)(r)&&(o="".concat(i,":").concat(r)),r?n[o].push(t):n[o]=n[o].filter(function(s){return s!==t})}),this.graph.set("states",n),this.graph.emit("graphstatechange",{states:e})},c.prototype.destroy=function(){this.graph=null,this.destroyed=!0},c}(),Is=el,mu=z(80389),Qr=function(t,e){return!t||!e?t:t.replace(/\\?\{([^{}]+)\}/g,function(r,n){if(r.charAt(0)==="\\")return r.slice(1);var a=e[n];return a===0&&(a="0"),a||""})},Os=function(t){var e=[];if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));for(var r=0,n=t;r0?i-1:e-1,s=ya.normalize([0,0],ya.add([0,0],a[o].v,ya.scale([0,0],a[i].v,-1)));a[i].p=ya.add([0,0],a[i].p,ya.scale([0,0],s,t))}return a.map(function(l){var h=l.p;return{x:h[0],y:h[1]}})}var Lo=function(t,e){for(var r=[],n=0;n<5;n++){var a=Math.cos((18+72*n)/180*Math.PI)*t,i=Math.sin((18+72*n)/180*Math.PI)*t,o=Math.cos((54+72*n)/180*Math.PI)*e,s=Math.sin((54+72*n)/180*Math.PI)*e;n===0?r.push(["M",a,-i]):r.push(["L",a,-i]),r.push(["L",o,-s])}return r.push(["Z"]),r},Pf=function(t,e,r){return(t.y-r.y)*(e.x-r.x)-(t.x-r.x)*(e.y-r.y)},kf=function(t){var e=t.map(function(p){return{x:p.getModel().x,y:p.getModel().y}});e.sort(function(p,D){return p.x===D.x?p.y-D.y:p.x-D.x});for(var r={},n=e.length-1;n>=0;n--){var a=e[n],i=a.x,o=a.y;r["".concat(i,"-").concat(o)]&&e.splice(n,1),r["".concat(i,"-").concat(o)]=!0}if(e.length===1)return e;for(var s=[],n=0;n=2&&Pf(s[s.length-2],s[s.length-1],e[n])<=0;)s.pop();s.push(e[n])}for(var l=[],n=e.length-1;n>=0;n--){for(;l.length>=2&&Pf(l[l.length-2],l[l.length-1],e[n])<=0;)l.pop();l.push(e[n])}l.pop(),s.pop();var h=s.concat(l);return h},xi={maxRoutingIterations:100,maxMarchingIterations:100,pixelGroupSize:2,edgeR0:10,edgeR1:10,nodeR0:5,nodeR1:10,morphBuffer:5,threshold:.001,skip:16,nodeInfluenceFactor:1,edgeInfluenceFactor:1,negativeNodeInfluenceFactor:-.5};function tf(c,t,e){var r=!1,n=function(s,l){return t.cells[s+l*t.width]},a=function(s,l){var h=0;return n(s-1,l-1)>=e&&(h+=1),n(s,l-1)>e&&(h+=2),n(s-1,l)>e&&(h+=4),n(s,l)>e&&(h+=8),h},i=function(s,l){for(var h=s,p=l,D,I,F=0;F-1){if(!(c[0].x!==h||c[0].y!==p))return!0}else c.push({x:h,y:p});var Z=a(h,p);switch(Z){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:h++;break;case 12:case 14:case 4:h--;break;case 6:D===0&&(I===-1?h-=1:h+=1);break;case 1:case 13:case 5:p--;break;case 9:D===1&&(I===0?p-=1:p+=1);break;case 10:case 8:case 11:p++;break;default:return console.warn("Marching squares invalid state: ".concat(Z)),!0}}};this.march=function(){for(var o=0;oe&&a(o,s)!==15&&(r=i(o,s));return r}}var As=function(t,e,r){var n=Math.ceil(t/r),a=Math.ceil(e/r),i=new Float32Array(Math.max(0,n*a)).fill(0);return{cells:i,width:n,height:a}},rf=function(t,e,r){var n=null,a=Number.POSITIVE_INFINITY;return e.forEach(function(i){var o={x:t.getModel().x,y:t.getModel().y},s={x:i.getModel().x,y:i.getModel().y},l=vi(o,s),h=new ga(o.x,o.y,s.x,s.y),p=r.reduce(function(D,I){return Ao(I,h)>0?D+1:D},0);l*Math.pow(p+1,2)=0&&i=1;)Re/=1.5,Oe=xu(F,Re,ee,we),Pe=l(Oe,i)||l(Oe,a),He=h(Oe,e);Oe&&!Pe&&(!we||!He)&&(i.push(new ga(I.x1,I.y1,Oe.x,Oe.y)),i.push(new ga(Oe.x,Oe.y,I.x2,I.y2)),o=!0)};oe(!0),o||oe(!1)}}o||a.push(I),s+=1};!o&&i.length;)p()}for(;i.length;)a.push(i.pop());return a};function hc(c,t,e,r,n){var a=rf(c,e,t);if(a===null)return[];var i=function(p){for(var D=[];p.length>0;){var I=p.pop();if(p.length===0){D.push(I);break}var F=p.pop(),Z=new ga(I.x1,I.y1,F.x2,F.y2),ee=nf(t,Z);ee?(D.push(I),p.push(F)):p.push(Z)}return D},o=new ga(c.getModel().x,c.getModel().y,a.getModel().x,a.getModel().y),s=dc(o,t,r,n),l=i(s);return l}var vc=function(t,e,r){var n=Object.assign(xi,r),a=as(t.map(function(oe){return{x:oe.getModel().x,y:oe.getModel().y}}));t=t.sort(function(oe,ce){return vi({x:oe.getModel().x,y:oe.getModel().y},a)-vi({x:ce.getModel().x,y:ce.getModel().y},a)});var i=[],o=[];t.forEach(function(oe){var ce=hc(oe,e,i,n.maxRoutingIterations,n.morphBuffer);ce.forEach(function(we){o.push(we)}),i.push(oe)});for(var s=af(t,o,n.nodeR0),l=As(s.width,s.height,n.pixelGroupSize),h=[],p=[],D=0;D1)for(F=Math.floor(I.length/n.skip);F<3&&n.skip>1;)n.skip-=1,F=Math.floor(I.length/n.skip);for(var Z=0,ee=0;ee0)n.nonMemberInfluenceFactor*=.8;else break}return p};function af(c,t,e){var r={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,width:0,height:0,x:0,y:0},n=[];c.forEach(function(s){n.push(s.getBBox())}),t.forEach(function(s){n.push(s.getBBox())});for(var a=0,i=n;ar.maxX?o.maxX:r.maxX)+e,r.maxY=(o.maxY>r.maxY?o.maxY:r.maxY)+e}return r.width=r.maxX-r.minX,r.height=r.maxY-r.minY,r.x=r.minX,r.y=r.minY,r}function gc(c,t,e,r,n,a){function i(I,F){var Z=Math.floor((I-F)/a.pixelGroupSize);return Z<0?0:Z}function o(I,F){return I*a.pixelGroupSize+F}var s=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),l=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1),h=function(F,Z){var ee=Math.min(i(F.minX,Z+r.minX),n.width),se=Math.min(i(F.minY,Z+r.minY),n.height),oe=Math.min(i(F.maxX,-Z+r.minX),n.width),ce=Math.min(i(F.maxY,-Z+r.minY),n.height);return[ee,se,oe,ce]},p=function(F,Z){for(var ee=F.getBBox(),se=h(ee,a.nodeR1),oe=se[0],ce=se[1],we=se[2],Re=se[3],Oe=ce;Oes.y?r?l.topLeft:l.bottomRight:r?l.topRight:l.bottomLeft:i.yo.x?r?l.topLeft:l.bottomRight:r?l.bottomLeft:l.topRight:a.x0?this.cfg.padding+t:10+t,this.cfg.bubbleCfg={nodeR0:this.padding-t,nodeR1:this.padding-t,morphBuffer:this.padding-t}},c.prototype.setType=function(){this.type=this.cfg.type,this.members.length<3&&(this.type="round-convex"),this.type!=="round-convex"&&this.type!=="smooth-convex"&&this.type!=="bubble"&&(console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default."),this.type="round-convex")},c.prototype.calcPath=function(t,e){var r,n,a;switch(this.type){case"round-convex":r=kf(t),a=ef(r.map(function(i){return[i.x,i.y]}),this.padding),n=(0,mu.tr)(a);break;case"smooth-convex":r=kf(t),r.length===2?(a=ef(r.map(function(i){return[i.x,i.y]}),this.padding),n=(0,mu.tr)(a)):r.length>2&&(a=Nf(r.map(function(i){return[i.x,i.y]}),this.padding),n=ls(a));break;case"bubble":r=vc(t,e,this.cfg.bubbleCfg),n=r.length>=2&&ls(r);break;default:}return n},c.prototype.render=function(){this.group.addShape("path",{attrs:(0,b.__assign)({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},c.prototype.addMember=function(t){if(!!t){(0,m.isString)(t)&&(t=this.graph.findById(t)),this.members.push(t);var e=this.nonMembers.indexOf(t);return e>-1&&this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},c.prototype.addNonMember=function(t){if(!!t){(0,m.isString)(t)&&(t=this.graph.findById(t)),this.nonMembers.push(t);var e=this.members.indexOf(t);return e>-1&&this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},c.prototype.removeMember=function(t){if(!!t){(0,m.isString)(t)&&(t=this.graph.findById(t));var e=this.members.indexOf(t);return e>-1?(this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0):!1}},c.prototype.removeNonMember=function(t){if(!!t){(0,m.isString)(t)&&(t=this.graph.findById(t));var e=this.nonMembers.indexOf(t);return e>-1?(this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0):!1}},c.prototype.updateData=function(t,e){var r=this;this.group.findById(this.id).remove(),t&&(this.members=t.map(function(n){return(0,m.isString)(n)?r.graph.findById(n):n})),e&&(this.nonMembers=e.map(function(n){return(0,m.isString)(n)?r.graph.findById(n):n})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},c.prototype.updateStyle=function(t){var e=this.group.findById(this.id);e.attr((0,b.__assign)({},t))},c.prototype.updateCfg=function(t){var e=this;this.cfg=(0,m.deepMix)(this.cfg,t),this.id=this.cfg.id,this.group=this.cfg.group,t.members&&(this.members=this.cfg.members.map(function(r){return(0,m.isString)(r)?e.graph.findById(r):r})),t.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(r){return(0,m.isString)(r)?e.graph.findById(r):r})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},c.prototype.contain=function(t){var e=this,r;(0,m.isString)(t)?r=this.graph.findById(t):r=t;var n,a=r.getKeyShape();if(r.get("type")==="path")n=Eu(a.attr("path"));else{var i=a.getCanvasBBox();n=[[i.minX,i.minY],[i.maxX,i.minY],[i.maxX,i.maxY],[i.minX,i.maxY]]}return n=n.map(function(o){var s=e.graph.getPointByCanvas(o[0],o[1]);return[s.x,s.y]}),zi(n,Eu(this.path))},c.prototype.destroy=function(){this.group.remove(),this.cfg=null},c}(),Rf=pc,ds=q.vs,tl="node",Do=function(c){(0,b.__extends)(t,c);function t(e){var r=c.call(this)||this;return r.sortCombos=(0,m.debounce)(function(){var n=r.get("comboSorted");if(!(!r||r.destroyed||n)){r.set("comboSorted",!0);var a=[],i={},o=r.get("comboTrees");(o||[]).forEach(function(l){Ei(l,function(h){return a[h.depth]?a[h.depth].push(h.id):a[h.depth]=[h.id],i[h.id]=h.depth,!0})});var s=r.getEdges().concat(r.get("vedges"));(s||[]).forEach(function(l){var h=l.getModel(),p=i[h.source]||0,D=i[h.target]||0,I=Math.max(p,D);a[I]?a[I].push(h.id):a[I]=[h.id]}),a.forEach(function(l){if(!(!l||!l.length))for(var h=l.length-1;h>=0;h--){var p=r.findById(l[h]);p&&p.toFront()}})}},500,!1),r.cfg=(0,m.deepMix)(r.getDefaultCfg(),e),r.init(),r.animating=!1,r.destroyed=!1,r.cfg.enabledStack&&(r.undoStack=new ni(r.cfg.maxStep),r.redoStack=new ni(r.cfg.maxStep)),r}return t.prototype.init=function(){this.initCanvas();var e=new u(this),r=new gu(this),n=new lc(this),a=new Is(this);this.set({viewController:e,modeController:r,itemController:n,stateController:a}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},t.prototype.initGroups=function(){var e=this.get("canvas");if(!!e){var r=e.get("el"),n=(r||{}).id,a=n===void 0?"g6":n,i=e.addGroup({id:"".concat(a,"-root"),className:an.rootContainerClassName});if(this.get("groupByTypes")){var o=i.addGroup({id:"".concat(a,"-edge"),className:an.edgeContainerClassName}),s=i.addGroup({id:"".concat(a,"-node"),className:an.nodeContainerClassName}),l=i.addGroup({id:"".concat(a,"-combo"),className:an.comboContainerClassName});l.toBack(),this.set({nodeGroup:s,edgeGroup:o,comboGroup:l})}var h=i.addGroup({id:"".concat(a,"-delegate"),className:an.delegateContainerClassName});this.set({delegateGroup:h}),this.set("group",i)}},t.prototype.getDefaultCfg=function(){return{container:void 0,width:void 0,height:void 0,renderer:"canvas",modes:{},plugins:[],data:{},fitViewPadding:10,minZoom:.02,maxZoom:10,event:!0,groupByTypes:!0,directed:!1,autoPaint:!0,nodes:[],edges:[],combos:[],vedges:[],itemMap:{},linkCenter:!1,defaultNode:{},defaultEdge:{},nodeStateStyles:{},edgeStateStyles:{},states:{},animate:!1,animateCfg:{onFrame:void 0,duration:500,easing:"easeLinear"},callback:void 0,enabledStack:!1,maxStep:10,tooltips:[],optimizeThreshold:1e3}},t.prototype.set=function(e,r){return(0,m.isPlainObject)(e)?this.cfg=(0,b.__assign)((0,b.__assign)({},this.cfg),e):this.cfg[e]=r,e==="enabledStack"&&r&&!this.undoStack&&!this.redoStack&&(this.undoStack=new ni(this.cfg.maxStep),this.redoStack=new ni(this.cfg.maxStep)),this},t.prototype.get=function(e){var r;return(r=this.cfg)===null||r===void 0?void 0:r[e]},t.prototype.getGroup=function(){return this.get("group")},t.prototype.getContainer=function(){return this.get("container")},t.prototype.getMinZoom=function(){return this.get("minZoom")},t.prototype.setMinZoom=function(e){return this.set("minZoom",e)},t.prototype.getMaxZoom=function(){return this.get("maxZoom")},t.prototype.setMaxZoom=function(e){return this.set("maxZoom",e)},t.prototype.getWidth=function(){return this.get("width")},t.prototype.getHeight=function(){return this.get("height")},t.prototype.clearItemStates=function(e,r){(0,m.isString)(e)&&(e=this.findById(e));var n=this.get("itemController");r||(r=e.get("states")),n.clearItemStates(e,r);var a=this.get("stateController");a.updateStates(e,r,!1)},t.prototype.node=function(e){typeof e=="function"&&this.set("nodeMapper",e)},t.prototype.edge=function(e){typeof e=="function"&&this.set("edgeMapper",e)},t.prototype.combo=function(e){typeof e=="function"&&this.set("comboMapper",e)},t.prototype.findById=function(e){return this.get("itemMap")[e]},t.prototype.find=function(e,r){var n,a=this.get("".concat(e,"s"));return(0,m.each)(a,function(i,o){if(r(i,o))return n=i,n}),n},t.prototype.findAll=function(e,r){var n=[];return(0,m.each)(this.get("".concat(e,"s")),function(a,i){r(a,i)&&n.push(a)}),n},t.prototype.findAllByState=function(e,r,n){return n?this.findAll(e,function(a){return a.hasState(r)&&n(a)}):this.findAll(e,function(a){return a.hasState(r)})},t.prototype.translate=function(e,r,n,a){var i=this,o=this.get("group"),s=(0,m.clone)(o.getMatrix());if(s||(s=[1,0,0,0,1,0,0,0,1]),n){var l=bo({animateCfg:a,callback:function(){return i.emit("viewportchange",{action:"translate",matrix:o.getMatrix()})}});ho(o,{x:o.getCanvasBBox().x+e,y:o.getCanvasBBox().y+r},n,l||{duration:500,easing:"easeCubic"})}else s=ds(s,[["t",e,r]]),o.setMatrix(s),this.emit("viewportchange",{action:"translate",matrix:s}),this.autoPaint()},t.prototype.moveTo=function(e,r,n,a){var i=this.get("group");ho(i,{x:e,y:r},n,a||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:i.getMatrix()})},t.prototype.fitView=function(e,r,n,a){e&&this.set("fitViewPadding",e);var i=this.get("viewController");r?i.fitViewByRules(r,n,a):i.fitView(n,a),this.autoPaint()},t.prototype.fitCenter=function(e,r){var n=this.get("viewController");n.fitCenter(e,r),this.autoPaint()},t.prototype.addBehaviors=function(e,r){var n=this.get("modeController");return n.manipulateBehaviors(e,r,!0),this},t.prototype.removeBehaviors=function(e,r){var n=this.get("modeController");return n.manipulateBehaviors(e,r,!1),this},t.prototype.updateBehavior=function(e,r,n){var a=this.get("modeController");return a.updateBehavior(e,r,n),this},t.prototype.zoom=function(e,r,n,a){var i=this,o=this.get("group"),s=(0,m.clone)(o.getMatrix())||[1,0,0,0,1,0,0,0,1],l=this.get("minZoom"),h=this.get("maxZoom"),p=this.getZoom()||1,D=p*e,I=e,F=!1;if(l&&Dh&&(I=h/p,F=!0),r?s=ds(s,[["t",-r.x,-r.y],["s",I,I],["t",r.x,r.y]]):s=ds(s,[["s",I,I]]),n){var Z=(0,m.clone)(o.getMatrix());Z||(Z=[1,0,0,0,1,0,0,0,1]);var ee=Z[0],se=ee*I,oe=bo({animateCfg:a,callback:function(){return i.emit("viewportchange",{action:"zoom",matrix:o.getMatrix()})}});o.animate(function(ce){if(ce===1)Z=s;else{var we=da(ee,se,ce)/Z[0];r?Z=ds(Z,[["t",-r.x,-r.y],["s",we,we],["t",r.x,r.y]]):Z=ds(Z,[["s",we,we]])}return{matrix:Z}},oe)}else o.setMatrix(s),this.emit("viewportchange",{action:"zoom",matrix:s}),this.autoPaint();return!F},t.prototype.zoomTo=function(e,r,n,a){var i=e/this.getZoom();return this.zoom(i,r,n,a)},t.prototype.focusItem=function(e,r,n){var a=this.get("viewController"),i=!1;r?i=!0:r===void 0&&(i=this.get("animate"));var o={};n?o=n:n===void 0&&(o=this.get("animateCfg")),a.focus(e,i,o),this.autoPaint()},t.prototype.focusItems=function(e,r,n,a){var i=this.get("viewController");i.focusItems(e,r,n,a)},t.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},t.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},t.prototype.getPointByClient=function(e,r){var n=this.get("viewController");return n.getPointByClient(e,r)},t.prototype.getClientByPoint=function(e,r){var n=this.get("viewController");return n.getClientByPoint(e,r)},t.prototype.getPointByCanvas=function(e,r){var n=this.get("viewController");return n.getPointByCanvas(e,r)},t.prototype.getCanvasByPoint=function(e,r){var n=this.get("viewController");return n.getCanvasByPoint(e,r)},t.prototype.getGraphCenterPoint=function(){var e=this.get("group").getCanvasBBox();return{x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}},t.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},t.prototype.showItem=function(e,r){r===void 0&&(r=!0);var n=this.get("itemController"),a=n.changeItemVisibility(e,!0);if(r&&this.get("enabledStack")){var i=a.getID(),o=a.getType(),s={},l={};switch(o){case"node":s.nodes=[{id:i,visible:!1}],l.nodes=[{id:i,visible:!0}];break;case"edge":s.nodes=[{id:i,visible:!1}],l.edges=[{id:i,visible:!0}];break;case"combo":s.nodes=[{id:i,visible:!1}],l.combos=[{id:i,visible:!0}];break;default:break}this.pushStack("visible",{before:s,after:l})}},t.prototype.hideItem=function(e,r){r===void 0&&(r=!0);var n=this.get("itemController"),a=n.changeItemVisibility(e,!1);if(r&&this.get("enabledStack")){var i=a.getID(),o=a.getType(),s={},l={};switch(o){case"node":s.nodes=[{id:i,visible:!0}],l.nodes=[{id:i,visible:!1}];break;case"edge":s.nodes=[{id:i,visible:!0}],l.edges=[{id:i,visible:!1}];break;case"combo":s.nodes=[{id:i,visible:!0}],l.combos=[{id:i,visible:!1}];break;default:break}this.pushStack("visible",{before:s,after:l})}},t.prototype.refreshItem=function(e){var r=this.get("itemController");r.refreshItem(e)},t.prototype.setAutoPaint=function(e){var r=this;r.set("autoPaint",e);var n=r.get("canvas");n.set("autoDraw",e)},t.prototype.remove=function(e,r){r===void 0&&(r=!0),this.removeItem(e,r)},t.prototype.removeItem=function(e,r){r===void 0&&(r=!0);var n=e;if((0,m.isString)(e)&&(n=this.findById(e)),!n&&(0,m.isString)(e))console.warn("The item ".concat(e," to be removed does not exist!"));else if(n){var a="";if(n.getType&&(a=n.getType()),r&&this.get("enabledStack")){var i=(0,b.__assign)((0,b.__assign)({},n.getModel()),{itemType:a}),o={};switch(a){case"node":{o.nodes=[i],o.edges=[];for(var s=n.getEdges(),l=s.length-1;l>=0;l--)o.edges.push((0,b.__assign)((0,b.__assign)({},s[l].getModel()),{itemType:"edge"}));break}case"edge":o.edges=[i];break;case"combo":o.combos=[i];break;default:break}this.pushStack("delete",{before:o,after:{}})}if(a==="node"){var h=n.getModel();h.comboId&&this.updateComboTree(n,void 0,!1)}var p=this.get("itemController");if(p.removeItem(n),a==="combo"){var D=ss(this.get("comboTrees"));this.set("comboTrees",D)}}},t.prototype.innerAddItem=function(e,r,n){if(!Zu(e,r))return!1;if(r.id&&this.findById(r.id)){console.warn("This item exists already. Be sure the id %c".concat(r.id,"%c is unique."),"font-size: 20px; color: red;","");return}var a,i=this.get("comboTrees")||[];if(e==="combo"){var o=this.get("itemMap"),s=!1;if(i.forEach(function(F){s||Ki(F,function(Z){if(r.parentId===Z.id){s=!0;var ee=(0,b.__assign)({id:r.id,depth:Z.depth+2},r);Z.children?Z.children.push(ee):Z.children=[ee],r.depth=ee.depth,a=n.addItem(e,r)}var se=o[Z.id];return s&&se&&se.getType&&se.getType()==="combo"&&n.updateCombo(se,Z.children),!0})}),!s){var l=(0,b.__assign)({id:r.id,depth:0},r);r.depth=l.depth,i.push(l),a=n.addItem(e,r)}this.set("comboTrees",i),r.collapsed&&(this.collapseCombo(a,!1),this.updateCombo(a))}else if(e==="node"&&(0,m.isString)(r.comboId)&&i){var h=this.findById(r.comboId);h&&h.getType&&h.getType()!=="combo"&&console.warn("'".concat(r.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),a=n.addItem(e,r);var p=this.get("itemMap"),D=!1,I=!1;i.forEach(function(F){I||D||Ki(F,function(Z){if(Z.id===r.id)return I=!0,!1;if(r.comboId===Z.id&&!I){D=!0;var ee=(0,m.clone)(r);ee.itemType="node",Z.children?Z.children.push(ee):Z.children=[ee],ee.depth=Z.depth+1}return D&&p[Z.id].getType&&p[Z.id].getType()==="combo"&&n.updateCombo(p[Z.id],Z.children),!0})})}else a=n.addItem(e,r);if(e==="node"&&r.comboId||e==="combo"&&r.parentId){var h=this.findById(r.comboId||r.parentId);h&&h.getType&&h.getType()==="combo"&&h.addChild(a)}return a},t.prototype.addItem=function(e,r,n,a){n===void 0&&(n=!0),a===void 0&&(a=!0);var i=this.get("comboSorted");this.set("comboSorted",i&&!a);var o=this.get("itemController"),s=this.innerAddItem(e,r,o);if(s===!1||s===!0)return s;var l=this.get("combos");if(l&&l.length>0&&this.sortCombos(),this.autoPaint(),n&&this.get("enabledStack")){var h=(0,b.__assign)((0,b.__assign)({},s.getModel()),{itemType:e}),p={};switch(e){case"node":p.nodes=[h];break;case"edge":p.edges=[h];break;case"combo":p.combos=[h];break;default:break}this.pushStack("add",{before:{},after:p})}return s},t.prototype.addItems=function(e,r,n){e===void 0&&(e=[]),r===void 0&&(r=!0),n===void 0&&(n=!0);var a=this.get("comboSorted");this.set("comboSorted",a&&!n);for(var i=this.get("itemController"),o=[],s=0;s0&&this.sortCombos()}if(this.autoPaint(),r&&this.get("enabledStack")){for(var p={nodes:[],edges:[],combos:[]},s=0;s=0;ee--)F[ee].destroyed&&F.splice(ee,1);D&&(i.addCombos(D),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",p,o.edges),(0,m.each)(h,function(oe,ce){oe.getType&&(oe.getType()==="node"||oe.getType()==="combo")||p.edges.indexOf(oe)<0&&(delete h[ce],i.remove(oe,!1))}),(this.get("comboTrees")||[]).forEach(function(oe){Ki(oe,function(ce){var we=n.findById(ce.id);return we.getType()==="combo"&&ce.collapsed&&n.collapseCombo(ce.id,!1),!0})}),this.set({nodes:p.nodes,edges:p.edges});var se=this.get("layoutController");return se&&(se.changeData(function(){setTimeout(function(){var oe;(oe=i.getCombos())===null||oe===void 0||oe.forEach(function(ce){ce.set("animate",!0)})},0)}),i.get("animate")&&!se.getLayoutType()?(i.positionsAnimate(),(a=i.getCombos())===null||a===void 0||a.forEach(function(oe){return oe.set("animate",!0)})):i.autoPaint()),setTimeout(function(){s.set("localRefresh",l)},16),this.set("data",o),this.emit("afterchangedata"),this},t.prototype.addCombos=function(e){var r=this,n=r.get("comboTrees"),a=this.get("itemController");a.addCombos(n,e)},t.prototype.createCombo=function(e,r,n){var a=this;n===void 0&&(n=!0);var i=this.get("itemController");this.set("comboSorted",!1);var o="",s;if(!!e){if((0,m.isString)(e))o=e,s={id:e};else{if(o=e.id,!o){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}s=e}var l=n&&this.get("enabledStack"),h={nodes:[],combos:[]};l&&r.forEach(function(se){var oe=a.findById(se),ce=oe.getType();if(!(ce!=="node"&&ce!=="combo")){var we=oe.getModel();h["".concat(ce,"s")].push({id:se,parentId:ce==="node"?we.comboId:we.parentId})}});var p=this.get("comboTrees"),D=new Set(r),I=new Map;p&&(p.forEach(function(se){Ki(se,function(oe,ce,we){if(D.has(oe.id)){if(ce){var Re=a.findById(ce.id),Oe=a.findById(oe.id);ce.children.splice(we,1),Re.removeChild(Oe),i.updateCombo(Re,ce.children)}oe.itemType==="combo"&&I.set(oe.id,oe)}return!0})}),p=p.filter(function(se){return!D.has(se.id)}),this.set("comboTrees",p));var F={nodes:[],combos:[]},Z=r.map(function(se){var oe=a.findById(se),ce=oe.getModel(),we="";oe.getType&&(we=oe.getType());var Re=I.get(se)||{id:oe.getID(),itemType:we};return we==="combo"?(Re.parentId=o,ce.parentId=o):we==="node"&&(Re.comboId=o,ce.comboId=o),l&&F["".concat(we,"s")].push({id:ce.id,parentId:o}),Re});s.children=Z,this.addItem("combo",s,!1),this.set("comboSorted",!1),p&&(p.forEach(function(se){Ei(se,function(oe){return oe.id===o?(oe.itemType="combo",oe.children=Z,!1):!0})}),this.sortCombos()),l&&(F.combos.push(s),this.pushStack("createCombo",{before:h,after:F}));var ee=this.findById(o);!ee.getModel().parentId&&ee.getChildren().combos.length&&this.updateComboTree(ee,void 0,!1)}},t.prototype.uncombo=function(e,r){var n=this,a,i;r===void 0&&(r=!0);var o=this,s=e;if((0,m.isString)(e)&&(s=this.findById(e)),!s||s.getType&&s.getType()!=="combo"){console.warn("The item is not a combo!");return}var l=s.getModel(),h=s.getModel().parentId,p=o.get("comboTrees");p||(p=[]);var D=this.get("itemMap"),I=s.get("id"),F,Z=[],ee=this.get("combos"),se=this.findById(h),oe=r&&this.get("enabledStack"),ce={};if(oe&&(ce=(0,m.clone)(l),ce.children=[]),p.forEach(function(Pe){F||Ki(Pe,function(He){var at;if(He.id===I){F=He;var qe=s.getEdges().map(function(yr){return yr.getID()});qe.forEach(function(yr){n.removeItem(yr,!1)});var yt=ee.indexOf(s);ee.splice(yt,1),delete D[I];var Ft=(0,m.clone)(s.getModel());s.destroy(),n.emit("afterremoveitem",{item:Ft,type:"combo"})}if(h&&F&&He.id===h){se.removeCombo(s),Z=He.children;var yt=Z.indexOf(F);return yt!==-1&&Z.splice(yt,1),(at=F.children)===null||at===void 0||at.forEach(function(fr){var lr=n.findById(fr.id),Kt=lr.getModel();lr.getType&&lr.getType()==="combo"?(fr.parentId=h,delete fr.comboId,Kt.parentId=h,delete Kt.comboId):lr.getType&&lr.getType()==="node"&&(fr.comboId=h,Kt.comboId=h),se.addChild(lr),Z.push(fr)}),n.updateCombo(se),!1}return!0})}),!h&&F){var we=p.indexOf(F);p.splice(we,1),(a=F.children)===null||a===void 0||a.forEach(function(Pe){Pe.parentId=void 0;var He=n.findById(Pe.id).getModel();delete He.parentId,delete He.comboId,Pe.itemType!=="node"&&p.push(Pe)})}if(oe){var Re={nodes:[],combos:[]},Oe={nodes:[],combos:[]};(i=F.children)===null||i===void 0||i.forEach(function(Pe){var He=n.findById(Pe.id),at=He.getType();at!=="node"&&at!=="combo"||(Re["".concat(at,"s")].push({id:Pe.id,parentId:I}),Oe["".concat(at,"s")].push({id:Pe.id,parentId:h}))}),Re.combos.push(ce),this.pushStack("uncombo",{before:Re,after:Oe})}},t.prototype.updateCombos=function(e){var r=this;e===void 0&&(e=!1);var n=this,a=this.get("comboTrees"),i=n.get("itemController"),o=n.get("itemMap");(a||[]).forEach(function(s){Ki(s,function(l){var h;if(!l)return!0;var p=o[l.id];if(((h=p==null?void 0:p.getType)===null||h===void 0?void 0:h.call(p))==="combo"){var D=(0,b.__spreadArray)([],p.getStates(),!0);(0,m.each)(D,function(I){return r.setItemState(p,I,!1)}),i.updateCombo(p,l.children,e),(0,m.each)(D,function(I){return r.setItemState(p,I,!0)})}return!0})}),n.sortCombos()},t.prototype.updateCombo=function(e){var r=this,n=this,a=e,i;if((0,m.isString)(e)&&(a=this.findById(e)),!a||a.getType&&a.getType()!=="combo"){console.warn("The item to be updated is not a combo!");return}i=a.get("id");var o=this.get("comboTrees"),s=n.get("itemController"),l=n.get("itemMap");(o||[]).forEach(function(h){Ki(h,function(p){if(!p)return!0;var D=l[p.id];if(i===p.id&&D&&D.getType&&D.getType()==="combo"){var I=(0,b.__spreadArray)([],D.getStates(),!0);(0,m.each)(I,function(F){D.getStateStyle(F)&&r.setItemState(D,F,!1)}),s.updateCombo(D,p.children),(0,m.each)(I,function(F){D.getStateStyle(F)&&r.setItemState(D,F,!0)}),i&&(i=p.parentId)}return!0})})},t.prototype.updateComboTree=function(e,r,n){n===void 0&&(n=!0);var a=this;this.set("comboSorted",!1);var i;(0,m.isString)(e)?i=a.findById(e):i=e;var o=i.getModel(),s=o.comboId||o.parentId,l="";if(i.getType&&(l=i.getType()),r&&l==="combo"){var h=this.get("comboTrees"),p=!0,D;if((h||[]).forEach(function(oe){D||Ei(oe,function(ce){if(!D)return ce.id===i.getID()&&(D=ce),!0})}),Ei(D,function(oe){return oe.id===r?(p=!1,!1):!0}),!p){console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!");return}}if(n&&this.get("enabledStack")){var I={},F={};l==="combo"?(I.combos=[{id:o.id,parentId:o.parentId}],F.combos=[{id:o.id,parentId:r}]):l==="node"&&(I.nodes=[{id:o.id,parentId:o.comboId}],F.nodes=[{id:o.id,parentId:r}]),this.pushStack("updateComboTree",{before:I,after:F})}if(o.parentId||o.comboId){var Z=this.findById(o.parentId||o.comboId);Z&&Z.removeChild(i)}if(l==="combo"?o.parentId=r:l==="node"&&(o.comboId=r),r){var ee=this.findById(r);ee&&ee.addChild(i)}if(s){var ee=this.findById(s);ee&&ee.removeChild(i)}var se=ss(this.get("comboTrees"),o.id,r);this.set("comboTrees",se),this.updateCombos()},t.prototype.save=function(){var e=[],r=[],n=[];return(0,m.each)(this.get("nodes"),function(a){e.push(a.getModel())}),(0,m.each)(this.get("edges"),function(a){r.push(a.getModel())}),(0,m.each)(this.get("combos"),function(a){n.push(a.getModel())}),{nodes:e,edges:r,combos:n}},t.prototype.changeSize=function(e,r){var n=this.get("viewController");return n.changeSize(e,r),this},t.prototype.refresh=function(){var e=this;if(e.emit("beforegraphrefresh"),e.get("animate"))e.positionsAnimate();else{var r=e.get("nodes"),n=e.get("edges"),a=e.get("edges");(0,m.each)(r,function(i){i.refresh()}),(0,m.each)(n,function(i){i.refresh()}),(0,m.each)(a,function(i){i.refresh()})}e.emit("aftergraphrefresh"),e.autoPaint()},t.prototype.getNodes=function(){return this.get("nodes")},t.prototype.getEdges=function(){return this.get("edges")},t.prototype.getCombos=function(){return this.get("combos")},t.prototype.getComboChildren=function(e){if((0,m.isString)(e)&&(e=this.findById(e)),!e||e.getType&&e.getType()!=="combo"){console.warn("The combo does not exist!");return}return e.getChildren()},t.prototype.positionsAnimate=function(e){var r=this;r.emit("beforeanimate");var n=r.get("animateCfg"),a=n.onFrame,i=e?r.getNodes().concat(r.getCombos()):r.getNodes(),o=i.map(function(l){var h=l.getModel();return{id:h.id,x:h.x,y:h.y}});r.stopAnimate();var s=r.get("canvas");r.animating=!0,s.animate(function(l){(0,m.each)(o,function(h){var p=r.findById(h.id);if(!(!p||p.destroyed)){var D=p.get("originAttrs"),I=p.get("model"),F=p.getContainer().getMatrix();if(D==null&&(F&&(D={x:F[6],y:F[7]}),p.set("originAttrs",D||0)),a){var Z=a(p,l,h,D||{x:0,y:0});p.set("model",Object.assign(I,Z))}else D?(I.x=D.x+(h.x-D.x)*l,I.y=D.y+(h.y-D.y)*l):(I.x=h.x,I.y=h.y)}}),r.refreshPositions(e)},{duration:n.duration,easing:n.easing,callback:function(){(0,m.each)(i,function(h){h.set("originAttrs",null)}),n.callback&&n.callback(),r.emit("afteranimate"),r.animating=!1}})},t.prototype.refreshPositions=function(e){var r=this;r.emit("beforegraphrefreshposition");var n=r.get("nodes"),a=r.get("edges"),i=r.get("vedges"),o=r.get("combos"),s,l={},h=function(D){(0,m.each)(D,function(I){s=I.getModel();var F=I.get("originAttrs");if(!(F&&s.x===F.x&&s.y===F.y)){var Z=I.updatePosition({x:s.x,y:s.y});l[s.id]=Z,s.comboId&&(l[s.comboId]=l[s.comboId]||Z),s.parentId&&(l[s.parentId]=l[s.parentId]||Z)}})};h(o),h(n),o&&o.length!==0&&(e&&h(o),r.updateCombos()),(0,m.each)(a,function(p){var D=p.getSource().getModel(),I=p.getTarget();if(!(0,m.isPlainObject)(I)){var F=I.getModel();(l[D.id]||l[F.id]||p.getModel().isComboEdge)&&p.refresh()}}),(0,m.each)(i,function(p){p.refresh()}),r.emit("aftergraphrefreshposition"),r.autoPaint()},t.prototype.stopAnimate=function(){this.isAnimating()&&this.get("canvas").stopAnimate()},t.prototype.isAnimating=function(){return this.animating},t.prototype.getZoom=function(){var e=this.get("group").getMatrix();return e?e[0]:1},t.prototype.getCurrentMode=function(){var e=this.get("modeController");return e.getMode()},t.prototype.setMode=function(e){var r=this.get("modeController");return r.setMode(e),this},t.prototype.clear=function(e){var r;return e===void 0&&(e=!1),(r=this.get("canvas"))===null||r===void 0||r.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),e||this.emit("afterrender"),this},t.prototype.updateLayout=function(e,r,n,a){var i=this;e===void 0&&(e={}),a===void 0&&(a=!0);var o=this.get("layoutController");if((0,m.isString)(e)&&(e={type:e}),r){var s=n;s||(r==="begin"?s={x:0,y:0}:s={x:this.getWidth()/2,y:this.getHeight()/2}),s=this.getPointByCanvas(s.x,s.y);var l=["force","gForce","fruchterman","force2"];l.includes(e.type)||!e.type&&l.includes(o==null?void 0:o.layoutType)?e.center=[s.x,s.y]:this.once("afterlayout",function(D){var I=i.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];s.x=s.x*I[0]+I[6],s.y=s.y*I[0]+I[7];var F=i.getGroup().getCanvasBBox(),Z=F.minX,ee=F.maxX,se=F.minY,oe=F.maxY,ce={x:(Z+ee)/2,y:(se+oe)/2};r==="begin"&&(ce.x=Z,ce.y=se),i.translate(s.x-ce.x,s.y-ce.y)})}var h=(0,b.__assign)({},this.get("layout")),p={};Object.assign(p,h,e),e.pipes&&!e.type?delete p.type:!e.pipes&&p.type&&delete p.pipes,this.set("layout",p),!!o&&(o.isLayoutTypeSame(p)&&p.gpuEnabled===h.gpuEnabled?o.updateLayoutCfg(p):o.changeLayout(p),a&&this.get("enabledStack")&&this.pushStack("layout",{before:h,after:p}))},t.prototype.destroyLayout=function(){var e=this.get("layoutController");e==null||e.destroyLayout()},t.prototype.layout=function(){var e,r=this.get("layoutController"),n=this.get("layout");if(!(!n||!r)){if(n.workerEnabled){r.layout();return}((e=r.layoutMethods)===null||e===void 0?void 0:e.length)?r.relayout(!0):r.layout()}},t.prototype.collapseCombo=function(e,r){var n=this;if(r===void 0&&(r=!0),!this.destroyed){if((0,m.isString)(e)&&(e=this.findById(e)),!e){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:e});var a=e.getModel(),i=this.get("itemController");i.collapseCombo(e,r),a.collapsed=!0;var o=this.getEdges().concat(this.get("vedges")),s=[],l=this.get("comboTrees"),h=!1;(l||[]).forEach(function(D){h||Ei(D,function(I){if(h&&I.depth<=a.depth)return!1;if(a.id===I.id&&(h=!0),h){var F=n.findById(I.id);F&&F.getType&&F.getType()==="combo"&&(s=s.concat(F.getNodes()),s=s.concat(F.getCombos()))}return!0})});var p={};o.forEach(function(D){var I=D.getModel(),F=I.isVEdge,Z=I.size,ee=Z===void 0?1:Z;if(!(D.isVisible()&&!F)){var se=D.getSource(),oe=D.getTarget(),ce=null,we;if(se.getModel().id===a.id||s.includes(se)&&!s.includes(oe)?(ce=oe,we=!1):(oe.getModel().id===a.id||!s.includes(se)&&s.includes(oe))&&(ce=se,we=!0),ce){if(F){n.removeItem(D,!1);return}for(var Re=ce.getModel();!ce.isVisible();){var Oe=Re.parentId,Pe=Re.comboId,He=Oe||Pe;if(ce=n.findById(He),!ce||!He)return;Re=ce.getModel()}var at=Re.id,qe=we?{source:at,target:a.id,size:ee,isVEdge:!0}:{source:a.id,target:at,size:ee,isVEdge:!0},yt="".concat(qe.source,"-").concat(qe.target);if(p[yt]){p[yt].size+=ee;return}p[yt]=qe}}}),this.addItems(Object.values(p).map(function(D){return{type:"vedge",model:D}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:e})}},t.prototype.expandCombo=function(e,r){var n=this;if(r===void 0&&(r=!0),(0,m.isString)(e)&&(e=this.findById(e)),!e||e.getType&&e.getType()!=="combo"){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:e});var a=e.getModel(),i=this.get("itemController");i.expandCombo(e,r),a.collapsed=!1;var o=this.getEdges().concat(this.get("vedges")),s=[],l=this.get("comboTrees"),h=!1;(l||[]).forEach(function(D){h||Ei(D,function(I){if(h&&I.depth<=a.depth)return!1;if(a.id===I.id&&(h=!0),h){var F=n.findById(I.id);F&&F.getType&&F.getType()==="combo"&&(s=s.concat(F.getNodes()),s=s.concat(F.getCombos()))}return!0})});var p={};o.forEach(function(D){if(!(D.isVisible()&&!D.getModel().isVEdge)){var I=D.getSource(),F=D.getTarget(),Z=I.get("id"),ee=F.get("id"),se=null,oe;if(Z===a.id||s.includes(I)&&!s.includes(F)?(se=F,oe=!1):ee===a.id||!s.includes(I)&&s.includes(F)?(se=I,oe=!0):s.includes(I)&&s.includes(F)&&I.isVisible()&&F.isVisible()&&D.show(),se){var ce=D.getModel(),we=ce.isVEdge,Re=ce.size,Oe=Re===void 0?1:Re;if(we){n.removeItem(D,!1);return}for(var Pe=se.getModel();!se.isVisible();){var He=Pe.parentId,at=Pe.comboId,qe=He||at;if(se=n.findById(qe),!se||!qe)return;Pe=se.getModel()}for(var yt=Pe.id,Ft=oe?F:I,yr=Ft.getModel();!Ft.isVisible();){var fr=yr.parentId,lr=yr.comboId,Kt=fr||lr;if(Ft=n.findById(Kt),!Ft||!Kt)return;if(yr.comboId===a.id||yr.parentId===a.id)break;yr=Ft.getModel()}var jr=yr.id;if(yt){var Xr=oe?{source:yt,target:jr,isVEdge:!0,size:Oe}:{source:jr,target:yt,isVEdge:!0,size:Oe},er="".concat(Xr.source,"-").concat(Xr.target);if(p[er]){p[er].size+=Oe;return}p[er]=Xr}}}}),this.addItems(Object.values(p).map(function(D){return{type:"vedge",model:D}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:e})},t.prototype.collapseExpandCombo=function(e,r){if(r===void 0&&(r=!0),(0,m.isString)(e)&&(e=this.findById(e)),!(!e||e.getType&&e.getType()!=="combo")){for(var n=e.getModel(),a=this.findById(n.parentId);a;){var i=a.getModel();if(i.collapsed){console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),a=void 0;return}a=this.findById(i.parentId)}var o=n.collapsed;o?this.expandCombo(e,r):this.collapseCombo(e,r),this.updateCombo(e)}},t.prototype.getNeighbors=function(e,r){var n=e;return(0,m.isString)(e)&&(n=this.findById(e)),n.getNeighbors(r)},t.prototype.getNodeDegree=function(e,r,n){r===void 0&&(r=void 0),n===void 0&&(n=!1);var a=e;(0,m.isString)(e)&&(a=this.findById(e));var i=this.get("degrees");(!i||n)&&(i=St(this.save()),this.set("degrees",i));var o=i[a.getID()],s=0;if(!o)return 0;switch(r){case"in":s=o.inDegree;break;case"out":s=o.outDegree;break;case"all":s=o;break;default:s=o.degree;break}return s},t.prototype.getUndoStack=function(){return this.undoStack},t.prototype.getRedoStack=function(){return this.redoStack},t.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},t.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear(),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack}))},t.prototype.pushStack=function(e,r,n){if(e===void 0&&(e="update"),n===void 0&&(n="undo"),!this.get("enabledStack")){console.warn("\u8BF7\u5148\u542F\u7528 undo & redo \u529F\u80FD\uFF0C\u5728\u5B9E\u4F8B\u5316 Graph \u65F6\u5019\u914D\u7F6E enabledStack: true !");return}var a=r?(0,m.clone)(r):{before:{},after:(0,m.clone)(this.save())};n==="redo"?this.redoStack.push({action:e,data:a}):this.undoStack.push({action:e,data:a}),this.emit("stackchange",{action:e,stackType:n,undoStack:this.undoStack,redoStack:this.redoStack})},t.prototype.getAdjMatrix=function(e,r){e===void 0&&(e=!0),r===void 0&&(r=this.get("directed"));var n=this.get("adjMatrix");return(!n||!e)&&(n=te(this.save(),r),this.set("adjMatrix",n)),n},t.prototype.getShortestPathMatrix=function(e,r){e===void 0&&(e=!0),r===void 0&&(r=this.get("directed"));var n=this.get("adjMatrix"),a=this.get("shortestPathMatrix");return(!n||!e)&&(n=te(this.save(),r),this.set("adjMatrix",n)),(!a||!e)&&(a=Gn(this.save(),r),this.set("shortestPathMatrix",a)),a},t.prototype.on=function(e,r,n){return c.prototype.on.call(this,e,r,n)},t.prototype.destroy=function(){var e,r,n,a,i;this.clear(),this.clearStack(),(e=this.get("itemController"))===null||e===void 0||e.destroy(),(r=this.get("modeController"))===null||r===void 0||r.destroy(),(n=this.get("viewController"))===null||n===void 0||n.destroy(),(a=this.get("stateController"))===null||a===void 0||a.destroy(),(i=this.get("canvas"))===null||i===void 0||i.destroy(),this.cfg=null,this.destroyed=!0,this.redoStack=null,this.undoStack=null},t.prototype.createHull=function(e){if(!e.members||e.members.length<1){console.warn("Create hull failed! The members is empty.");return}var r=this.get("hullGroup"),n=this.get("hullMap");if(n||(n={},this.set("hullMap",n)),(!r||r.get("destroyed"))&&(r=this.get("group").addGroup({id:"hullGroup"}),r.toBack(),this.set("hullGroup",r)),n[e.id])return console.warn("Existed hull id."),n[e.id];var a=r.addGroup({id:"".concat(e.id,"-container")}),i=new Rf(this,(0,b.__assign)((0,b.__assign)({},e),{group:a})),o=i.id;return n[o]=i,i},t.prototype.getHulls=function(){return this.get("hullMap")},t.prototype.getHullById=function(e){return this.get("hullMap")[e]},t.prototype.removeHull=function(e){var r,n;(0,m.isString)(e)?n=this.getHullById(e):n=e,(r=this.get("hullMap"))===null||r===void 0||delete r[n.id],n.destroy()},t.prototype.removeHulls=function(){var e=this.getHulls();!e||!Object.keys(e).length||(Object.keys(e).forEach(function(r){var n=e[r];n.destroy()}),this.set("hullMap",{}))},t}(Q.Z),Bf=Do;function hs(c){return hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hs(c)}var Ls=q.vs,yc="-shape",wu="-label",Ds=["startArrow","endArrow"],mc={lineWidth:1,stroke:void 0,fill:void 0,lineAppendWidth:1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,x:0,y:0,r:10,width:20,height:20,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},rl={lineWidth:1,stroke:"#000",lineDash:void 0,startArrow:!1,endArrow:!1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},of={edge:rl,node:mc,combo:mc},Ff="-label-bg",Gf={options:{labelCfg:{style:{fontFamily:an.windowFontFamily}},descriptionCfg:{style:{fontFamily:an.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(t){return{}},getOptions:function(t,e){return e==="move"||(e==null?void 0:e.includes("bbox"))?t:(0,m.deepMix)({},this.options,this.getCustomConfig(t)||{},t)},draw:function(t,e){e.shapeMap={},this.mergeStyle=this.getOptions(t);var r=this.drawShape(t,e);if(r.set("className",this.itemType+yc),e.shapeMap[this.itemType+yc]=r,t.label){var n=this.drawLabel(t,e);n.set("className",this.itemType+wu),e.shapeMap[this.itemType+wu]=n}return r},afterDraw:function(t,e,r){},drawShape:function(t,e){return null},drawLabel:function(t,e){var r=(this.mergeStyle||this.getOptions(t)||{}).labelCfg,n=r||{},a=this.getLabelStyle(t,n,e),i=a.rotate;delete a.rotate;var o=e.addShape("text",{attrs:a,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=o,!isNaN(i)&&i!==""){var s=o.getBBox(),l=[1,0,0,0,1,0,0,0,1];if(a.rotateCenter)switch(a.rotateCenter){case"center":l=Ls(l,[["t",-s.width/2,-s.height/2],["r",i],["t",s.width/2,s.height/2]]);break;case"lefttop":l=Ls(l,[["t",-a.x,-a.y],["r",i],["t",a.x,a.y]]);break;case"leftcenter":l=Ls(l,[["t",-a.x,-a.y-s.height/2],["r",i],["t",a.x,a.y+s.height/2]]);break;default:l=Ls(l,[["t",-s.width/2,-s.height/2],["r",i],["t",s.width/2,s.height/2]]);break}else l=Ls(l,[["t",-a.x,-a.y-s.height/2],["r",i],["t",a.x,a.y+s.height/2]]);o.setMatrix(l)}if(a.background){var h=this.drawLabelBg(t,e,o),p=this.itemType+Ff;h.set("classname",p),e.shapeMap[p]=h,o.toFront()}return o},drawLabelBg:function(t,e,r){var n=this.options.labelCfg,a=(0,m.mix)({},n,t.labelCfg),i=this.getLabelBgStyleByPosition(r,a),o=e.addShape("rect",{name:"text-bg-shape",attrs:i,labelRelated:!0});return e.shapeMap["text-bg-shape"]=o,o},getLabelStyleByPosition:function(t,e,r){return{text:t.label}},getLabelBgStyleByPosition:function(t,e){return{}},getLabelStyle:function(t,e,r){var n=this.getLabelStyleByPosition(t,e,r),a="".concat(this.itemType,"Label"),i=an[a]?an[a].style:null;return(0,b.__assign)((0,b.__assign)((0,b.__assign)({},i),n),e.style)},getShapeStyle:function(t){return t.style},update:function(t,e,r){this.updateShapeStyle(t,e,r),this.updateLabel(t,e,r)},updateShapeStyle:function(t,e,r){var n,a=e.getContainer(),i=e.getKeyShape(),o=(0,m.mix)({},i.attr(),t.style),s=function(p){var D,I=o[p];if((0,m.isPlainObject)(I)){var F=((n=a.shapeMap)===null||n===void 0?void 0:n[p])||a.find(function(Z){return Z.get("name")===p});F==null||F.attr(I)}else i.attr((D={},D[p]=I,D))};for(var l in o)s(l)},updateLabel:function(t,e,r){var n,a;if(t.label||t.label===""){var i=e.getContainer(),o=(this.mergeStyle||this.getOptions({},r)||{}).labelCfg,s=o===void 0?{}:o,l=this.itemType+wu,h=i.shapeMap[l]||i.find(function(we){return we.get("className")===l}),p=this.itemType+Ff,D=i.shapeMap[p]||i.find(function(we){return we.get("className")===p});if(h){(!r||r==="bbox|label"||this.itemType==="edge"&&r!=="style")&&(s=(0,m.deepMix)(s,t.labelCfg));var F=this.getLabelStyleByPosition(t,s,i),Z=(n=t.labelCfg)===null||n===void 0?void 0:n.style,ee=(0,b.__assign)((0,b.__assign)({},F),Z),se=ee.rotate;if(delete ee.rotate,!isNaN(se)&&se!==""){var oe=[1,0,0,0,1,0,0,0,1];oe=Ls(oe,[["t",-ee.x,-ee.y],["r",se],["t",ee.x,ee.y]]),ee.matrix=oe,h.attr(ee)}else((a=h.getMatrix())===null||a===void 0?void 0:a[4])!==1&&h.resetMatrix(),h.attr(ee);if(!D)ee.background&&(D=this.drawLabelBg(t,i,h),D.set("classname",p),i.shapeMap[p]=D,h.toFront());else if(ee.background){var ce=this.getLabelBgStyleByPosition(h,s);D.attr(ce)}else i.removeChild(D)}else{var I=this.drawLabel(t,i);I.set("className",l),i.shapeMap[l]=I}}},afterUpdate:function(t,e){},setState:function(t,e,r){var n,a,i,o=r.get("keyShape");if(!(!o||o.destroyed)){var s=r.getType(),l=(0,m.isBoolean)(e)?t:"".concat(t,":").concat(e),h=this.getStateStyle(l,r),p=r.getStateStyle(l);if(!(!p&&!h)){var D=(0,m.mix)({},p||h),I=r.getContainer(),F={x:1,y:1,cx:1,cy:1,matrix:1};if(s==="combo"&&(F.r=1,F.width=1,F.height=1),e){var Z=function(Kt){var jr,Xr=D[Kt];if((0,m.isPlainObject)(Xr)&&!Ds.includes(Kt)){var er=((i=I.shapeMap)===null||i===void 0?void 0:i[Kt])||I.find(function(mr){return mr.get("name")===Kt});er==null||er.attr(Xr)}else o.attr((jr={},jr[Kt]=Xr,jr))};for(var ee in D)Z(ee)}else{var se=Uo(r.getCurrentStatesStyle()),oe=r.getModel(),ce=(0,m.mix)({},oe.style,Uo(r.getOriginStyle())),we=o.get("name"),Re=o.attr(),Oe={};Object.keys(Re).forEach(function(lr){if(lr!=="img"){var Kt=Re[lr];Kt&&hs(Kt)==="object"?Oe[lr]=(0,m.clone)(Kt):Oe[lr]=Kt}});var Pe={},He=function(Kt){var jr=D[Kt];if((0,m.isPlainObject)(jr)&&!Ds.includes(Kt)){var Xr=I.shapeMap[Kt]||I.find(function(kr){return kr.get("name")===Kt});if(Xr){var er=Uo(Xr.attr());(0,m.each)(jr,function(kr,Fr){if(Kt===we&&Oe[Fr]&&!F[Fr]){delete Oe[Fr];var Jr=ce[Kt][Fr]||of[s][Fr];o.attr(Fr,Jr)}else if(er[Fr]||er[Fr]===0){delete er[Fr];var fn=ce[Kt][Fr]||of[s][Fr];Xr.attr(Fr,fn)}}),Pe[Kt]=er}}else if(Oe[Kt]&&!F[Kt]){delete Oe[Kt];var mr=ce[Kt]||(ce[we]?ce[we][Kt]:void 0)||of[s][Kt];o.attr(Kt,mr)}};for(var at in D)He(at);we?Pe[we]=Oe:(0,m.mix)(Pe,Oe);for(var ee in se)if(!F[ee]){var qe=se[ee];(!(0,m.isPlainObject)(qe)||Ds.includes(ee))&&(we?((0,m.mix)(ce[we],(a={},a[ee]=qe,a)),delete ce[ee]):(0,m.mix)(ce,(n={},n[ee]=qe,n)),delete se[ee])}var yt={};(0,m.deepMix)(yt,ce,Pe,se);var Ft=!1,yr=function(Kt){var jr,Xr,er=yt[Kt];if((0,m.isPlainObject)(er)&&!Ds.includes(Kt)){var mr=I.shapeMap[Kt]||I.find(function(Fr){return Fr.get("name")===Kt});mr&&((mr.get("type")==="text"||mr.get("labelRelated"))&&(delete er.x,delete er.y,delete er.matrix),Kt===we&&(s==="combo"&&(delete er.r,delete er.width,delete er.height),Ft=!0),mr.attr(er))}else if(!Ft){var kr=er||of[s][Kt];s==="combo"?we||o.attr((jr={},jr[Kt]=kr,jr)):o.attr((Xr={},Xr[Kt]=kr,Xr))}};for(var fr in yt)yr(fr)}}}},getStateStyle:function(t,e){var r=e.getModel(),n=e.getType(),a=this.getOptions(r),i=a.stateStyles,o=a.style,s=o===void 0?{}:o,l=r.stateStyles?r.stateStyles[t]:i&&i[t];return n==="combo"?(0,m.clone)(l):(0,m.mix)({},s,l)},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e,r,n=(t==null?void 0:t.anchorPoints)||((e=this.getCustomConfig(t))===null||e===void 0?void 0:e.anchorPoints)||((r=this.options)===null||r===void 0?void 0:r.anchorPoints);return n}},Ec={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:an.nodeLabel.offset,getSize:function(t){var e,r=((e=this.mergeStyle)===null||e===void 0?void 0:e.size)||t.size||this.getOptions({}).size||an.defaultNode.size;return(0,m.isArray)(r)&&r.length===1&&(r=[r[0],r[0]]),(0,m.isArray)(r)||(r=[r,r]),r},getLabelStyleByPosition:function(t,e){var r=e.maxLength,n=t.label;r&&(n=io(n,r));var a=e.position||this.labelPosition;if(a==="center")return{x:0,y:0,text:n,textBaseline:"middle",textAlign:"center"};var i=e.offset;(0,m.isNil)(i)&&(i=this.offset);var o=this.getSize(t),s;switch(a){case"top":s={x:0,y:-o[1]/2-i,textBaseline:"bottom",textAlign:"center"};break;case"bottom":s={x:0,y:o[1]/2+i,textBaseline:"top",textAlign:"center"};break;case"left":s={x:-o[0]/2-i,y:0,textBaseline:"middle",textAlign:"right"};break;default:s={x:o[0]/2+i,y:0,textBaseline:"middle",textAlign:"left"};break}return s.text=n,s},getLabelBgStyleByPosition:function(t,e){var r;if(!t)return{};var n=(r=e.style)===null||r===void 0?void 0:r.background;if(!n)return{};var a=t.getBBox(),i=Cs(n.padding),o=a.width+i[1]+i[3],s=a.height+i[0]+i[2];return(0,b.__assign)((0,b.__assign)({x:a.minX-i[3],y:a.minY-i[0]},n),{width:o,height:s})},drawShape:function(t,e){var r=this.shapeType,n=this.getShapeStyle(t),a=e.addShape(r,{attrs:n,draggable:!0,name:"node-shape"});return e.shapeMap["node-shape"]=a,a},updateLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=e.shapeMap["link-point-left"]||e.find(function(yt){return yt.get("className")==="link-point-left"}),a=e.shapeMap["link-point-right"]||e.find(function(yt){return yt.get("className")==="link-point-right"}),i=e.shapeMap["link-point-top"]||e.find(function(yt){return yt.get("className")==="link-point-top"}),o=e.shapeMap["link-point-bottom"]||e.find(function(yt){return yt.get("className")==="link-point-bottom"}),s;n&&(s=n.attr()),a&&!s&&(s=a.attr()),i&&!s&&(s=i.attr()),o&&!s&&(s=o.attr()),s||(s=r);var l=(0,m.mix)({},s,t.linkPoints),h=l.fill,p=l.stroke,D=l.lineWidth,I=l.size/2;I||(I=l.r);var F=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},Z=F.left,ee=F.right,se=F.top,oe=F.bottom,ce=this.getSize(t),we=ce[0],Re=ce[1],Oe={r:I,fill:h,stroke:p,lineWidth:D};if(n)!Z&&Z!==void 0?(n.remove(),delete e.shapeMap["link-point-left"]):n.attr((0,b.__assign)((0,b.__assign)({},Oe),{x:-we/2,y:0}));else if(Z){var Pe="link-point-left";e.shapeMap[Pe]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},Oe),{x:-we/2,y:0}),className:Pe,name:Pe,isAnchorPoint:!0})}if(a)!ee&&ee!==void 0&&(a.remove(),delete e.shapeMap["link-point-right"]),a.attr((0,b.__assign)((0,b.__assign)({},Oe),{x:we/2,y:0}));else if(ee){var He="link-point-right";e.shapeMap[He]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},Oe),{x:we/2,y:0}),className:He,name:He,isAnchorPoint:!0})}if(i)!se&&se!==void 0&&(i.remove(),delete e.shapeMap["link-point-top"]),i.attr((0,b.__assign)((0,b.__assign)({},Oe),{x:0,y:-Re/2}));else if(se){var at="link-point-top";e.shapeMap[at]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},Oe),{x:0,y:-Re/2}),className:at,name:at,isAnchorPoint:!0})}if(o)!oe&&oe!==void 0?(o.remove(),delete e.shapeMap["link-point-bottom"]):o.attr((0,b.__assign)((0,b.__assign)({},Oe),{x:0,y:Re/2}));else if(oe){var qe="link-point-bottom";e.shapeMap[qe]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},Oe),{x:0,y:Re/2}),className:qe,name:qe,isAnchorPoint:!0})}},updateShape:function(t,e,r,n,a){var i=e.get("keyShape");i.attr((0,b.__assign)({},r)),this.updateLabel(t,e,a),n&&this.updateIcon(t,e)},updateIcon:function(t,e){var r=this,n=e.getContainer(),a=(this.mergeStyle||this.getOptions(t)).icon,i=t.icon?t.icon:{show:void 0,text:void 0},o=i.show,s=i.text,l=n.shapeMap["".concat(this.type,"-icon")]||n.find(function(se){return se.get("name")==="".concat(r.type,"-icon")});if(l)if(o||o===void 0){var h=(0,m.mix)({},l.attr(),a),p=h.width,D=p===void 0?20:p,I=h.height,F=I===void 0?20:I;(h.fontFamily==="iconfont"||h.hasOwnProperty("text"))&&(D=0,F=0),l.attr((0,b.__assign)((0,b.__assign)({},h),{x:-D/2,y:-F/2}))}else l.remove(),delete n.shapeMap["".concat(this.type,"-icon")];else if(o){var Z="".concat(this.type,"-icon");if(s)n.shapeMap[Z]=n.addShape("text",{attrs:(0,b.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:Z,name:Z});else{var D=a.width,F=a.height;n.shapeMap[Z]=n.addShape("image",{attrs:(0,b.__assign)((0,b.__assign)({},a),{x:-D/2,y:-F/2}),className:Z,name:Z})}var ee=n.shapeMap["node-label"]||n.find(function(se){return se.get("name")==="node-label"});ee&&ee.toFront()}}},sf=(0,b.__assign)((0,b.__assign)({},Gf),Ec);Cr.registerNode("single-node",sf);var uf="edge-shape";function nl(c){var t=c;return c==="start"?t="end":c==="end"&&(t="start"),t}var al={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:an.defaultEdge.size,style:{x:0,y:0,stroke:an.defaultEdge.style.stroke,lineAppendWidth:an.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:an.edgeLabel.style.fill,fontSize:an.edgeLabel.style.fontSize,fontFamily:an.windowFontFamily}},stateStyles:(0,b.__assign)({},an.edgeStateStyles)},getPath:function(t){var e=[];return(0,m.each)(t,function(r,n){n===0?e.push(["M",r.x,r.y]):e.push(["L",r.x,r.y])}),e},getShapeStyle:function(t){var e=this.options.style,r={stroke:t.color},n=(0,m.mix)({},e,r,t.style),a=t.size||an.defaultEdge.size;t=this.getPathPoints(t);var i=t.startPoint,o=t.endPoint,s=this.getControlPoints(t),l=[i];s&&(l=l.concat(s)),l.push(o);var h=this.getPath(l),p=(0,m.mix)({},an.defaultEdge.style,{stroke:an.defaultEdge.color,lineWidth:a,path:h},n);return p},updateShapeStyle:function(t,e,r){var n,a=e.getContainer(),i=((n=e.getKeyShape)===null||n===void 0?void 0:n.call(e))||a.shapeMap["edge-shape"],o=t.size;t=this.getPathPoints(t);var s=t.startPoint,l=t.endPoint,h=this.getControlPoints(t),p=[s];h&&(p=p.concat(h)),p.push(l);var D=i.attr(),I=t.style||{};I.stroke===void 0&&(I.stroke=t.color);var F=t.sourceNode,Z=t.targetNode,ee={radius:I.radius};h||(ee={source:F,target:Z,offset:I.offset,radius:I.radius});var se=this.getPath(p,ee),oe={};r==="move"?oe={path:se}:(D.endArrow&&I.endArrow===!1&&(t.style.endArrow={path:""}),D.startArrow&&I.startArrow===!1&&(t.style.startArrow={path:""}),oe=(0,b.__assign)({},t.style),oe.lineWidth===void 0&&(oe.lineWdith=((0,m.isNumber)(o)?o:o==null?void 0:o[0])||D.lineWidth),oe.path===void 0&&(oe.path=se),oe.stroke===void 0&&(oe.stroke=D.stroke||t.color)),i&&i.attr(oe)},getLabelStyleByPosition:function(t,e,r){var n=e.position||this.labelPosition,a={},i=r==null?void 0:r.shapeMap[uf],o;n==="start"?o=0:n==="end"?o=1:o=.5;var s=e.refX||this.refX,l=e.refY||this.refY;if(t.startPoint.x===t.endPoint.x&&t.startPoint.y===t.endPoint.y)return a.x=t.startPoint.x+s,a.y=t.startPoint.y+l,a.text=t.label,a;var h;(0,m.isNil)(e.autoRotate)?h=this.labelAutoRotate:h=e.autoRotate;var p=Hu(i,o,s,l,h);return a.x=p.x,a.y=p.y,a.rotate=p.rotate,a.textAlign=this._getTextAlign(n,p.angle),a.text=t.label,a},getLabelBgStyleByPosition:function(t,e){if(!t)return{};var r=t.getBBox(),n=e.style&&e.style.background;if(!n)return{};var a=n.padding,i=r.width+a[1]+a[3],o=r.height+a[0]+a[2],s=(0,b.__assign)((0,b.__assign)({},n),{width:i,height:o,x:r.minX-a[3],y:r.minY-a[0],matrix:[1,0,0,0,1,0,0,0,1]}),l;return(0,m.isNil)(e.autoRotate)?l=this.labelAutoRotate:l=e.autoRotate,l&&(s.matrix=t.attr("matrix")||[1,0,0,0,1,0,0,0,1]),s},_getTextAlign:function(t,e){var r="center";return e?(e=e%(Math.PI*2),t!=="center"&&(e>=0&&e<=Math.PI/2||e>=3/2*Math.PI&&e<2*Math.PI?r=t:r=nl(t)),r):t},getControlPoints:function(t){return t.controlPoints},getPathPoints:function(t){return t},drawShape:function(t,e){var r=this.getShapeStyle(t),n=e.addShape("path",{className:uf,name:uf,attrs:r});return e.shapeMap[uf]=n,n},drawLabel:function(t,e){var r=this.options.labelCfg,n=(0,m.deepMix)({},r,t.labelCfg),a=this.getLabelStyle(t,n,e),i=a.rotate;delete a.rotate;var o=e.addShape("text",{attrs:a,name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=o,!isNaN(i)&&i!==""&&o.rotateAtStart(i),a.background){var s=this.drawLabelBg(t,e,o,a,i),l=this.itemType+Ff;s.set("classname",l),e.shapeMap[l]=s,o.toFront()}return o},drawLabelBg:function(t,e,r,n,a){var i=this.options.labelCfg,o=(0,m.deepMix)({},i,t.labelCfg),s=this.getLabelBgStyleByPosition(r,o),l=e.addShape("rect",{name:"text-bg-shape",attrs:s,labelRelated:!0});return e.shapeMap["text-bg-shape"]=l,l}},bc=(0,b.__assign)((0,b.__assign)({},Gf),al);Cr.registerEdge("single-edge",bc),Cr.registerEdge("line",{getControlPoints:function(){}},"single-edge"),Cr.registerEdge("spline",{getPath:function(t){var e=Os(t);return e}},"single-edge"),Cr.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(t){var e=t.startPoint,r=t.endPoint,n={x:(e.x+r.x)/2,y:(e.y+r.y)/2},a,i;if(t.controlPoints!==void 0){if(i=t.controlPoints[0],a=Go(e,i,r),e.x<=r.x&&e.y>r.y?this.clockwise=a.x>i.x?0:1:e.x<=r.x&&e.yi.x?1:0:e.x>r.x&&e.y<=r.y?this.clockwise=a.y=60&&Math.round(c.h)<=240?r=e?Math.round(c.h)-tu*t:Math.round(c.h)+tu*t:r=e?Math.round(c.h)+tu*t:Math.round(c.h)-tu*t,r<0?r+=360:r>=360&&(r-=360),r}function Xf(c,t,e){if(c.h===0&&c.s===0)return c.s;var r;return e?r=c.s-Tu*t:t===Wf?r=c.s+Tu:r=c.s+Mc*t,r>1&&(r=1),e&&t===Uf&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2))}function Vf(c,t,e){var r;return e?r=c.v+Cc*t:r=c.v-Tc*t,r>1&&(r=1),Number(r.toFixed(2))}function Iu(c){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=[],r=(0,eu.Z)(c),n=Uf;n>0;n-=1){var a=r.toHsv(),i=(0,eu.Z)({h:cf(a,n,!0),s:Xf(a,n,!0),v:Vf(a,n,!0)}).toHexString();e.push(i)}e.push(r.toHexString());for(var o=1;o<=Wf;o+=1){var s=r.toHsv(),l=(0,eu.Z)({h:cf(s,o),s:Xf(s,o),v:Vf(s,o)}).toHexString();e.push(l)}return t.theme==="dark"?jf.map(function(h){var p=h.index,D=h.opacity,I=eu.Z.mix(t.backgroundColor||"#141414",e[p],D*100).toHexString();return I}):e}var Rs={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Oi={},gt={};Object.keys(Rs).forEach(function(c){Oi[c]=Iu(Rs[c]),Oi[c].primary=Oi[c][5],gt[c]=Iu(Rs[c],{theme:"dark",backgroundColor:"#141414"}),gt[c].primary=gt[c][5]});var cl=Oi.red,Ou=Oi.volcano,Yf=Oi.gold,ll=Oi.orange,Ic=Oi.yellow,dl=Oi.lime,hl=Oi.green,lf=Oi.cyan,Hf=Oi.blue,Oc=Oi.geekblue,Zf=Oi.purple,Mi=Oi.magenta,Au=Oi.grey,gi=function(t,e,r){var n=ks()(t),a=ks()(e);return ks()([(1-r)*n.red()+r*a.red(),(1-r)*n.green()+r*a.green(),(1-r)*n.blue()+r*a.blue()]).rgb()},Lu=function(t,e,r){e===void 0&&(e="#fff"),r===void 0&&(r="rgb(150, 150, 150)");var n=gi(e,t,.05).rgb().toString(),a=gi(e,t,.1).rgb().toString(),i=gi(e,t,.2).rgb().toString(),o=gi(e,t,.4).rgb().toString(),s=gi(e,r,.02).rgb().toString(),l=gi(e,r,.05).rgb().toString(),h=gi(e,r,.1).rgb().toString(),p=gi(e,r,.2).rgb().toString(),D=gi(e,r,.3).rgb().toString(),I=Iu(t,{theme:"default",backgroundColor:e}),F=ks()(t).hex().toLowerCase(),Z=I.indexOf(F),ee=t;return Z!==-1&&(ee=I[Z+1]),{mainStroke:t,mainFill:a,activeStroke:t,activeFill:n,inactiveStroke:o,inactiveFill:n,selectedStroke:t,selectedFill:e,highlightStroke:ee,highlightFill:i,disableStroke:D,disableFill:l,edgeMainStroke:D,edgeActiveStroke:t,edgeInactiveStroke:p,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:h,comboMainStroke:D,comboMainFill:s,comboActiveStroke:t,comboActiveFill:n,comboInactiveStroke:D,comboInactiveFill:s,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:ee,comboHighlightFill:s,comboDisableStroke:p,comboDisableFill:l}},Xo=function(t,e,r){e===void 0&&(e="#fff"),r===void 0&&(r="#777");var n=gi(e,t,.2).rgb().toString(),a=gi(e,t,.3).rgb().toString(),i=gi(e,t,.6).rgb().toString(),o=gi(e,t,.8).rgb().toString(),s=gi(e,r,.2).rgb().toString(),l=gi(e,r,.25).rgb().toString(),h=gi(e,r,.3).rgb().toString(),p=gi(e,r,.4).rgb().toString(),D=gi(e,r,.5).rgb().toString(),I=Iu(t,{theme:"dark",backgroundColor:e}),F=ks()(t).hex().toLowerCase(),Z=I.indexOf(F),ee=t;return Z!==-1&&(ee=I[Z+1]),{mainStroke:o,mainFill:n,activeStroke:t,activeFill:a,inactiveStroke:o,inactiveFill:n,selectedStroke:t,selectedFill:n,highlightStroke:t,highlightFill:i,disableStroke:D,disableFill:l,edgeMainStroke:r,edgeActiveStroke:t,edgeInactiveStroke:r,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:h,comboMainStroke:p,comboMainFill:l,comboActiveStroke:t,comboActiveFill:s,comboInactiveStroke:p,comboInactiveFill:l,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:ee,comboHighlightFill:l,comboDisableStroke:p,comboDisableFill:s}},vs=function(t,e,r,n){return e===void 0&&(e="#fff"),r===void 0&&(r="default"),n===void 0&&(n="rgb(150, 150, 150)"),r==="default"?Lu(t,e,"rgb(150, 150, 150)"):Xo(t,e,"#777")},Bs=function(t,e,r,n){e===void 0&&(e="#fff"),r===void 0&&(r="default"),n===void 0&&(n="rgb(150, 150, 150)");var a=[];return t.forEach(function(i){a.push(vs(i,e,r,n))}),a},gs="rgb(95, 149, 255)",ru="rgb(255, 255, 255)",ps="rgb(0, 0, 0)",ra=vs(gs,ru),wo={version:"0.8.9",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:ra.mainStroke,fill:ra.mainFill},size:20,color:ra.mainStroke,linkPoints:{size:8,lineWidth:1,fill:ra.activeFill,stroke:ra.activeStroke}},nodeStateStyles:{active:{fill:ra.activeFill,stroke:ra.activeStroke,lineWidth:2,shadowColor:ra.mainStroke,shadowBlur:10},selected:{fill:ra.selectedFill,stroke:ra.selectedStroke,lineWidth:4,shadowColor:ra.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:ra.highlightFill,stroke:ra.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:ra.inactiveFill,stroke:ra.inactiveStroke,lineWidth:1},disable:{fill:ra.disableFill,stroke:ra.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:ps,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:ra.edgeMainStroke,lineAppendWidth:2},color:ra.edgeMainStroke},edgeStateStyles:{active:{stroke:ra.edgeActiveStroke,lineWidth:1},selected:{stroke:ra.edgeSelectedStroke,lineWidth:2,shadowColor:ra.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ra.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:ra.edgeInactiveStroke,lineWidth:1},disable:{stroke:ra.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:ps,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:ra.comboMainFill,lineWidth:1,stroke:ra.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:ra.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:ra.comboActiveStroke,lineWidth:1,fill:ra.comboActiveFill},selected:{stroke:ra.comboSelectedStroke,lineWidth:2,fill:ra.comboSelectedFill,shadowColor:ra.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ra.comboHighlightStroke,lineWidth:2,fill:ra.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:ra.comboInactiveStroke,fill:ra.comboInactiveFill,lineWidth:1},disable:{stroke:ra.comboDisableStroke,fill:ra.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},textWaterMarkerConfig:{width:150,height:100,compatible:!1,text:{x:0,y:60,lineHeight:20,rotate:20,fontSize:14,fontFamily:"Microsoft YaHei",fill:"rgba(0, 0, 0, 0.1)",baseline:"Middle"}},imageWaterMarkerConfig:{width:150,height:130,compatible:!1,image:{x:0,y:0,width:30,height:20,rotate:0}},waterMarkerImage:"https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"},Fs=z(57817),df=ki.cloneEvent,Du=ki.isViewportChanged,Kf=function(c){(0,b.__extends)(t,c);function t(e){var r=c.call(this,e)||this;return r.extendEvents=[],r.dragging=!1,r.mousedown=!1,r.preItem=null,r.destroy(),r.graph=e,r.destroyed=!1,r.initEvents(),r}return t.prototype.initEvents=function(){var e=this,r=e.graph,n=e.extendEvents,a=n===void 0?[]:n,i=r.get("canvas"),o=i.get("el"),s=(0,m.wrapBehavior)(this,"onCanvasEvents"),l=(0,m.wrapBehavior)(this,"onExtendEvents"),h=(0,m.wrapBehavior)(this,"onWheelEvent");i.off("*").on("*",s),this.canvasHandler=s,a.push((0,Fs.Z)(o,"wheel",h)),typeof window!="undefined"&&(a.push((0,Fs.Z)(window,"keydown",l)),a.push((0,Fs.Z)(window,"keyup",l)),a.push((0,Fs.Z)(window,"focus",l))),this.resetHandler&&r.off("afterchangedata",this.resetHandler),this.resetHandler=(0,m.wrapBehavior)(this,"resetStatus"),r.on("afterchangedata",this.resetHandler)},t.getItemRoot=function(e){for(;e&&!e.get("item");)e=e.get("parent");return e},t.prototype.onCanvasEvents=function(e){var r=this,n=this.graph,a=n.get("canvas"),i=e.target,o=e.type;switch(o){case"drag":this.onCanvasEvents(Object.assign({},e,{type:"mousemove"}));break;case"dragend":this.onCanvasEvents(Object.assign({},e,{type:"mouseup"}));break;case"mousedown":this.mousedown=!0;break;case"dragend":case"mouseup":setTimeout(function(){return r.mousedown=!1});break;case"click":if(!this.mousedown)return;break;default:break}e.canvasX=e.x,e.canvasY=e.y;var s={x:e.canvasX,y:e.canvasY},l=n.get("group"),h=l.getMatrix();if(h||(h=[1,0,0,0,1,0,0,0,1]),Du(h)&&(s=n.getPointByClient(e.clientX,e.clientY)),e.x=s.x,e.y=s.y,e.currentTarget=n,i===a){(o==="mousemove"||o==="mouseleave")&&this.handleMouseMove(e,"canvas"),e.target=a,e.item=null,n.emit(o,e),n.emit("canvas:".concat(o),e);return}var p=t.getItemRoot(i);if(!p){n.emit(o,e);return}var D=p.get("item");if(!D.destroyed){var I=D.getType();if(e.target=i,e.item=D,e.canvasX===e.x&&e.canvasY===e.y){var F=n.getCanvasByPoint(e.x,e.y);e.canvasX=F.x,e.canvasY=F.y}e.name&&!e.name.includes(":")?(n.emit("".concat(I,":").concat(o),e),n.emit(o,e)):e.name&&n.emit(e.name,e),o==="dragstart"&&(this.dragging=!0),o==="dragend"&&(this.dragging=!1),o==="mousemove"&&this.handleMouseMove(e,I)}},t.prototype.onExtendEvents=function(e){this.graph.emit(e.type,e)},t.prototype.onWheelEvent=function(e){(0,m.isNil)(e.wheelDelta)&&(e.wheelDelta=-e.detail),this.graph.emit("wheel",e)},t.prototype.handleMouseMove=function(e,r){var n=this,a=n.graph,i=n.preItem,o=a.get("canvas"),s=e.target===o?null:e.item;e=df(e),i&&i!==s&&!i.destroyed&&(e.item=i,this.emitCustomEvent(i.getType(),"mouseleave",e),this.dragging&&this.emitCustomEvent(i.getType(),"dragleave",e)),s&&i!==s&&(e.item=s,this.emitCustomEvent(r,"mouseenter",e),this.dragging&&this.emitCustomEvent(r,"dragenter",e)),this.preItem=s},t.prototype.emitCustomEvent=function(e,r,n){n.type=r,this.graph.emit("".concat(e,":").concat(r),n)},t.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},t.prototype.destroy=function(){var e=this,r=e.graph,n=e.canvasHandler,a=e.extendEvents,i=r.get("canvas");i.off("*",n),(0,m.each)(a,function(o){o.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},t}(ff),$f=Kf,ea=z(67320),Io=z(81746),nu=z.n(Io),Qf=ki.traverseTree,hf=function(t,e){var r;return t?(0,m.isNumber)(t)?r=function(a){return t}:r=t:r=function(a){return e||1},r},Jf=function(t,e){var r=[],n=[],a={},i=0;for(i=0;i=0&&(o="x",i="y");var s=0;Qf(t,function(p){return s++,p.x>a.x&&(a.x=p.x),p.xa.y&&(a.y=p.y),p.yWebGL.
','Find out how to get it here.'].join(` `):['Your browser does not seem to support WebGL.
','Find out how to get it here.'].join(` `)),e},addGetWebGLMessage:function(e){e=e||{};var r=e.parent!==void 0?e.parent:document.body,n=e.id!==void 0?e.id:"oldie",a=c().getWebGLErrorMessage();a.id=n,r.appendChild(a)}}},Pc=(0,b.__assign)((0,b.__assign)((0,b.__assign)((0,b.__assign)({},ki),x),v),g),Vo=Pc,vl=Vo.radialLayout,kc=function(){function c(t){this.type=t.type,this.radial=t.radial,this.config=t}return c.prototype.init=function(t){var e=this;if(this.data=t,this.radial){this.layoutMethod=function(r){var n=nu()[e.type](r,e.config);return vl(n),n};return}this.layoutMethod=function(r){return nu()[e.type](r,e.config)}},c.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},c.prototype.layout=function(t){return this.init(t),this.execute()},c}(),Rc=kc;(0,ea.registerLayout)("grid",ea.GridLayout),(0,ea.registerLayout)("random",ea.RandomLayout),(0,ea.registerLayout)("force",ea.ForceLayout),(0,ea.registerLayout)("circular",ea.CircularLayout),(0,ea.registerLayout)("dagre",ea.DagreLayout),(0,ea.registerLayout)("dagreCompound",ea.DagreCompoundLayout),(0,ea.registerLayout)("radial",ea.RadialLayout),(0,ea.registerLayout)("concentric",ea.ConcentricLayout),(0,ea.registerLayout)("mds",ea.MDSLayout),(0,ea.registerLayout)("fruchterman",ea.FruchtermanLayout),(0,ea.registerLayout)("fruchterman-gpu",ea.FruchtermanGPULayout),(0,ea.registerLayout)("gForce",ea.GForceLayout),(0,ea.registerLayout)("force2",ea.Force2Layout),(0,ea.registerLayout)("gForce-gpu",ea.GForceGPULayout),(0,ea.registerLayout)("comboForce",ea.ComboForceLayout),(0,ea.registerLayout)("comboCombined",ea.ComboCombinedLayout),(0,ea.registerLayout)("forceAtlas2",ea.ForceAtlas2Layout);var gl=function(t,e){e.isCustomLayout=!0,ea.Layouts[t]=(0,ea.registerLayout)(t,e)},Bc=function(){function c(t,e){var r=t.toString(),n=new Blob(["importScripts('".concat(e,"');(").concat(r,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(n))}return c}(),Fc=Bc,Gc=function(t){t===void 0&&(t="https://unpkg.com/@antv/layout@latest/dist/layout.min.js");function e(){var n={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout);function a(o){var s=o.data.type;return s===n.RUN||s===n.GPURUN}function i(o){var s=this,l=o.data.type;switch(l){case n.RUN:{var h=o.data,p=h.nodes,D=h.edges,I=h.layoutCfg,F=I===void 0?{}:I,Z=F.type,ee=layout.getLayoutByName(Z);if(!ee){this.postMessage({type:n.ERROR,message:"layout ".concat(Z," not found")});break}var se;F.onLayoutEnd=function(){s.postMessage({type:n.END,nodes:p}),se==null||se.destroy()},se=new ee(F),se.init({nodes:p,edges:D}),se.execute();break}case n.GPURUN:{var oe=o.data,ce=oe.nodes,D=oe.edges,we=oe.layoutCfg,F=we===void 0?{}:we,Re=oe.canvas,Z=F.type,ee=layout.getLayoutByName(Z);if(!ee){this.postMessage({type:n.ERROR,message:"layout ".concat(Z," not found")});break}if(Z.split("-")[1]!=="gpu"){this.postMessage({type:n.ERROR,message:"layout ".concat(Z," does not support GPU")});break}var Oe=new ee(F);Oe.init({nodes:ce,edges:D}),Oe.executeWithWorker(Re,this);break}default:break}}onmessage=function(s){a(s)&&i(s)}}var r=new Fc(e,t);return r},zs={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function Nu(c){return Nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nu(c)}var au=function(t){return setTimeout(t,16)},Pu=function(t){return clearTimeout(t)},Us={requestAnimationFrame:function(t){var e=typeof window!="undefined"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||au;return e(t)},cancelAnimationFrame:function(t){var e=typeof window!="undefined"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||Pu;return e(t)}},vf=["fruchterman","gForce"],ec=["force","grid","circular"],gf=function(c){(0,b.__extends)(t,c);function t(e){var r=c.call(this,e)||this;return r.graph=e,r.layoutCfg=e.get("layout")||{},r.layoutType=r.getLayoutType(),r.worker=null,r.workerData={},r.initLayout(),r}return t.prototype.initLayout=function(){},t.prototype.getWorker=function(){return this.worker?this.worker:(typeof Worker=="undefined"?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=Gc(this.layoutCfg.workerScriptURL),this.worker)},t.prototype.stopWorker=function(){var e=this.workerData;!this.worker||(this.worker.terminate(),this.worker=null,e.requestId&&(Us.cancelAnimationFrame(e.requestId),e.requestId=null),e.requestId2&&(Us.cancelAnimationFrame(e.requestId2),e.requestId2=null))},t.prototype.execLayoutMethod=function(e,r){var n=this;return new Promise(function(a,i){return(0,b.__awaiter)(n,void 0,void 0,function(){var o,s,l,h,p,D,I,F,Z,D,ee;return(0,b.__generator)(this,function(se){switch(se.label){case 0:if(o=this.graph,!o||o.get("destroyed"))return[2];s=e.type,e.onLayoutEnd=function(){o.emit("aftersublayout",{type:s}),a()},s&&this.isGPU&&(ku(s)?s="".concat(s,"-gpu"):console.warn("The '".concat(s,"' layout does not support GPU calculation for now, it will run in CPU."))),ki.isForce(s)?(l=e.onTick,h=e.animate,p=h===void 0&&(s==="force"||s==="force2"),D=function(){l&&l(),(h||p)&&o.refreshPositions()},e.tick=D):(s==="comboForce"||s==="comboCombined")&&(e.comboTrees=o.get("comboTrees")),I=!1;try{F=new ea.Layouts[s](e),this.layoutMethods[r]&&this.layoutMethods[r].destroy(),this.layoutMethods[r]=F}catch(oe){console.warn("The layout method: '".concat(s,"' does not exist! Please specify it first.")),i()}return I=F.enableTick,I&&(Z=e.onTick,D=function(){Z&&Z(),o.refreshPositions()},F.tick=D),ee=this.filterLayoutData(this.data,e),mf(ee,r),F.init(ee),o.emit("beforesublayout",{type:s}),[4,F.execute()];case 1:return se.sent(),F.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd(),[2]}})})})},t.prototype.updateLayoutMethod=function(e,r){var n=this;return new Promise(function(a,i){return(0,b.__awaiter)(n,void 0,void 0,function(){var o,s,l;return(0,b.__generator)(this,function(h){switch(h.label){case 0:return o=this.graph,s=r==null?void 0:r.type,r.onLayoutEnd=function(){o.emit("aftersublayout",{type:s}),a()},l=this.filterLayoutData(this.data,r),e.init(l),e.updateCfg(r),o.emit("beforesublayout",{type:s}),[4,e.execute()];case 1:return h.sent(),e.isCustomLayout&&r.onLayoutEnd&&r.onLayoutEnd(),[2]}})})})},t.prototype.layout=function(e){var r=this,n,a=this.graph;if(!(!a||a.get("destroyed"))){this.data=this.setDataFromGraph();var i=this.data,o=i.nodes,s=i.hiddenNodes;if(!o)return!1;var l=a.get("width"),h=a.get("height"),p={};Object.assign(p,{width:l,height:h,center:[l/2,h/2]},this.layoutCfg),this.layoutCfg=p;var D=p.type,I=!1;(n=this.layoutMethods)===null||n===void 0||n.forEach(function(Re){var Oe;return I=!!((Oe=Re.nodes)===null||Oe===void 0?void 0:Oe.length)||I});var F=this.destoryLayoutMethods();a.emit("beforelayout");var Z=Promise.resolve();I&&D&&(F==null?void 0:F.length)===1&&F[0]===D?this.tweakInit():Z=this.initPositions(p.center,o);var ee=this.initPositions(p.center,s);ee.then(),this.isGPU=iu(p,D);var se=p.onLayoutEnd,oe=p.layoutEndFormatted,ce=p.adjust;if(oe||(p.layoutEndFormatted=!0,p.onAllLayoutEnd=function(){return(0,b.__awaiter)(r,void 0,void 0,function(){return(0,b.__generator)(this,function(Re){switch(Re.label){case 0:return se&&se(o),this.refreshLayout(),ce&&p.pipes?[4,this.adjustPipesBox(this.data,ce)]:[3,2];case 1:Re.sent(),this.refreshLayout(),Re.label=2;case 2:return a.emit("afterlayout"),[2]}})})}),this.stopWorker(),p.workerEnabled&&this.layoutWithWorker(this.data,e))return!0;var we=!1;return p.type?(we=!0,Z=Z.then(function(){return(0,b.__awaiter)(r,void 0,void 0,function(){return(0,b.__generator)(this,function(Re){switch(Re.label){case 0:return[4,this.execLayoutMethod(p,0)];case 1:return[2,Re.sent()]}})})})):p.pipes&&(we=!0,p.pipes.forEach(function(Re,Oe){Z=Z.then(function(){return(0,b.__awaiter)(r,void 0,void 0,function(){return(0,b.__generator)(this,function(Pe){switch(Pe.label){case 0:return[4,this.execLayoutMethod(Re,Oe)];case 1:return[2,Pe.sent()]}})})})})),we?Z.then(function(){p.onAllLayoutEnd&&p.onAllLayoutEnd(),e&&e()}).catch(function(Re){console.warn("graph layout failed,",Re)}):(a.refreshPositions(),e==null||e()),!1}},t.prototype.tweakInit=function(){var e=this,r=e.data,n=e.graph,a=r.nodes,i=r.edges;if(!!(a==null?void 0:a.length)){var o={};a.forEach(function(h){var p=h.x,D=h.y;!isNaN(p)&&!isNaN(D)&&(o[h.id]={x:p,y:D},h.mass=h.mass||2)}),i.forEach(function(h){var p=h.source,D=h.target,I=o[p],F=o[D];!I&&F?o[p]={x:F.x+(Math.random()-.5)*80,y:F.y+(Math.random()-.5)*80}:!F&&I&&(o[D]={x:I.x+(Math.random()-.5)*80,y:I.y+(Math.random()-.5)*80})});var s=n.get("width"),l=n.get("height");a.forEach(function(h){var p=o[h.id]||{x:s/2+(Math.random()-.5)*20,y:l/2+(Math.random()-.5)*20};h.x=p.x,h.y=p.y})}},t.prototype.initWithPreset=function(e,r){var n=this;return new Promise(function(a,i){return(0,b.__awaiter)(n,void 0,void 0,function(){var o,s,l,h,p,D,I;return(0,b.__generator)(this,function(F){switch(F.label){case 0:return o=this,s=o.layoutCfg,l=o.data,h=s.preset,!(h==null?void 0:h.type)||!ea.Layouts[h==null?void 0:h.type]?(r==null||r(),a(),[2,!1]):(p=iu(h,h.type),D=p?"".concat(h.type,"-gpu"):h.type,I=new ea.Layouts[D](h),delete s.preset,I.init(l),[4,I.execute()]);case 1:return F.sent(),e==null||e(),a(),[2,!0]}})})})},t.prototype.layoutWithWorker=function(e,r){var n=this,a=this,i=a.layoutCfg,o=a.graph,s=this.getWorker(),l=this.workerData;if(!s)return!1;l.requestId=null,l.requestId2=null,l.currentTick=null,l.currentTickData=null,o.emit("beforelayout");var h=Promise.resolve(),p=!1;if(i.type)p=!0,h=h.then(function(){return n.runWebworker(s,e,i)});else if(i.pipes){p=!0;for(var D=function(se){h=h.then(function(){return n.runWebworker(s,e,se)})},I=0,F=i.pipes;I'),h=n?n.backgroundColor:void 0,p=n?n.padding:void 0;p?(0,m.isNumber)(p)&&(p=[p,p,p,p]):p=[0,0,0,0];var D=i+p[0]+p[2],I=o+p[1]+p[3],F={container:l,height:D,width:I,quickHit:!0},Z=s==="svg"?new Ps.Canvas(F):new so.Canvas(F),ee=this.get("group"),se=ee.clone(),oe=(0,m.clone)(se.getMatrix());oe||(oe=[1,0,0,0,1,0,0,0,1]);var ce=(a.maxX+a.minX)/2,we=(a.maxY+a.minY)/2;oe=js(oe,[["t",-ce,-we],["t",o/2+p[3],i/2+p[0]]]),se.resetMatrix(),se.setMatrix(oe),Z.add(se);var Re=Z.get("el"),Oe="";r||(r="image/png"),setTimeout(function(){if(s==="svg"){var Pe=Re.cloneNode(!0),He=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),at=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",He);at.replaceChild(Pe,at.documentElement);var qe=new XMLSerializer().serializeToString(at);Oe="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(qe))}else{var yt=void 0,Ft=Re.getContext("2d"),yr=void 0;if(h){var fr=typeof window!="undefined"?window.devicePixelRatio:1;try{yt=Ft.getImageData(0,0,I*fr,D*fr),yr=Ft.globalCompositeOperation,Ft.globalCompositeOperation="destination-over",Ft.fillStyle=h,Ft.fillRect(0,0,I,D)}catch(lr){console.error("Download image failed. Out of memory at ImageData creation")}}Oe=Re.toDataURL(r),h&&(Ft.clearRect(0,0,I,D),Ft.putImageData(yt,0,0),Ft.globalCompositeOperation=yr)}e&&e(Oe)},16)},t.prototype.downloadFullImage=function(e,r,n){var a=this,i=this.get("group").getCanvasBBox(),o=i.height,s=i.width,l=this.get("renderer"),h=(0,Aa.Z)('
'),p=document.querySelector(".g6-graph-watermarker"),D=n?n.backgroundColor:void 0,I=n?n.padding:void 0;I?(0,m.isNumber)(I)&&(I=[I,I,I,I]):I=[0,0,0,0];var F=o+I[0]+I[2],Z=s+I[1]+I[3];if(p){var ee=this.get("graphWaterMarker").cfg||{},se=ee.width,oe=ee.height;F=Math.ceil(F/oe)*oe,Z=Math.ceil(Z/se)*se}var ce={container:h,height:F,width:Z},we=l==="svg"?new Ps.Canvas(ce):new so.Canvas(ce),Re=this.get("group"),Oe=ou(Re),Pe=(0,m.clone)(Oe.getMatrix());Pe||(Pe=[1,0,0,0,1,0,0,0,1]);var He=(i.maxX+i.minX)/2,at=(i.maxY+i.minY)/2;Pe=js(Pe,[["t",-He,-at],["t",s/2+I[3],o/2+I[0]]]),Oe.resetMatrix(),Oe.setMatrix(Pe),we.add(Oe);var qe=we.get("el");r||(r="image/png"),this.asyncToDataUrl(r,D,function(yt){var Ft=document.createElement("a"),yr=(e||"graph")+(l==="svg"?".svg":".".concat(r.split("/")[1]));a.dataURLToImage(yt,l,Ft,yr);var fr=document.createEvent("MouseEvents");fr.initEvent("click",!1,!1),Ft.dispatchEvent(fr)},Z,F,qe)},t.prototype.downloadImage=function(e,r,n){var a=this,i=this;i.stopAnimate();var o=i.get("canvas"),s=o.getRenderer();r||(r="image/png");var l=(e||"graph")+(s==="svg"?".svg":r.split("/")[1]),h=document.createElement("a");i.asyncToDataUrl(r,n,function(p){a.dataURLToImage(p,s,h,l);var D=document.createEvent("MouseEvents");D.initEvent("click",!1,!1),h.dispatchEvent(D)})},t.prototype.dataURLToImage=function(e,r,n,a){if(!e||e==="data:"){console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items");return}if(typeof window!="undefined")if(window.Blob&&window.URL&&r!=="svg"){var i=e.split(","),o="";if(i&&i.length>0){var s=i[0].match(/:(.*?);/);s&&s.length>=2&&(o=s[1])}for(var l=atob(i[1]),h=l.length,p=new Uint8Array(h);h--;)p[h]=l.charCodeAt(h);var D=new Blob([p],{type:o});window.navigator.msSaveBlob?window.navigator.msSaveBlob(D,a):n.addEventListener("click",function(){n.download=a,n.href=window.URL.createObjectURL(D)})}else n.addEventListener("click",function(){n.download=a,n.href=e})},t.prototype.addPlugin=function(e){var r=this;e.destroyed||(r.get("plugins").push(e),e.initPlugin(r))},t.prototype.removePlugin=function(e){var r=this.get("plugins"),n=r.indexOf(e);n>=0&&(e.destroyPlugin(),r.splice(n,1))},t.prototype.setImageWaterMarker=function(e,r){e===void 0&&(e=wo.waterMarkerImage);var n=this.get("container");(0,m.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var a=this.get("graphWaterMarker"),i=(0,m.deepMix)({},wo.imageWaterMarkerConfig,r),o=i.width,s=i.height,l=i.compatible,h=i.image;if(!e){var p=l?n:document.querySelector(".g6-graph-watermarker");p&&(p.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var D={container:n,width:o,height:s,capture:!1},I=this.get("pixelRatio");I&&(D.pixelRatio=I,window.devicePixelRatio=I),a=new so.Canvas(D),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var F=a.get("context"),Z=h.rotate,ee=h.x,se=h.y;F.rotate(-Z*Math.PI/180);var oe=new Image;oe.crossOrigin="anonymous",oe.src=e,oe.onload=function(){if(F.drawImage(oe,ee,se,h.width,h.height),F.rotate(Z*Math.PI/180),l)n.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var ce=document.querySelector(".g6-graph-watermarker");ce||(ce=document.createElement("div"),ce.className="g6-graph-watermarker"),ce.className="g6-graph-watermarker",a.destroyed||(ce.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),n.appendChild(ce))}}},t.prototype.setTextWaterMarker=function(e,r){var n=this.get("container");(0,m.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var a=this.get("graphWaterMarker"),i=(0,m.deepMix)({},wo.textWaterMarkerConfig,r),o=i.width,s=i.height,l=i.compatible,h=i.text;if(!(e==null?void 0:e.length)){var p=l?n:document.querySelector(".g6-graph-watermarker");p&&(p.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var D={container:n,width:o,height:s,capture:!1},I=this.get("pixelRatio");I&&(D.pixelRatio=I,window.devicePixelRatio=I),a=new so.Canvas(D),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var F=a.get("context"),Z=h.rotate,ee=h.fill,se=h.fontFamily,oe=h.fontSize,ce=h.baseline,we=h.x,Re=h.y,Oe=h.lineHeight;F.rotate(-Z*Math.PI/180),F.font="".concat(oe,"px ").concat(se),F.fillStyle=ee,F.textBaseline=ce;for(var Pe=(0,m.isString)(e)?[e]:e,He=Pe.length-1;He>=0;He--)F.fillText(Pe[He],we,Re+He*Oe);if(F.rotate(Z*Math.PI/180),l)n.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var at=document.querySelector(".g6-graph-watermarker");at||(at=document.createElement("div"),at.className="g6-graph-watermarker"),at.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),n.appendChild(at)}},t.prototype.destroy=function(){var e,r,n,a;(0,m.each)(this.get("plugins"),function(h){h.destroyPlugin()});var i=this.get("tooltips");if(i)for(var o=0;o0)for(var l=o.length-1;l>=0;l--){var h=o[l].getModel();t.indexOfChild(e.children||[],h.id)===-1&&(a.innerRemoveChild(h.id,{x:e.x,y:e.y},n),o.splice(l,1))}}var p,D;i.get("originAttrs")&&(p=i.get("originAttrs").x,D=i.get("originAttrs").y);var I=i.getModel();n&&i.set("originAttrs",{x:I.x,y:I.y}),i.set("model",Object.assign(I,e.data)),(p!==e.x||D!==e.y)&&i.updatePosition({x:e.x,y:e.y})},t.prototype.innerRemoveChild=function(e,r,n){var a=this,i=a.findById(e);if(!!i)if((0,m.each)(i.get("children"),function(s){a.innerRemoveChild(s.getModel().id,r,n)}),n){var o=i.getModel();i.set("to",r),i.set("originAttrs",{x:o.x,y:o.y}),a.get("removeList").push(i)}else a.removeItem(i,!1)},t.prototype.changeData=function(e,r){r===void 0&&(r=!0);var n=this;this.getNodes().map(function(a){return n.clearItemStates(a)}),this.getEdges().map(function(a){return n.clearItemStates(a)}),r&&this.get("enabledStack")&&this.pushStack("changedata",{before:n.get("originData"),after:e||n.get("data")}),e?(n.data(e),n.render(!1)):n.layout(this.get("fitView"))},t.prototype.changeLayout=function(e){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");var r=this;r.updateLayout(e)},t.prototype.updateLayout=function(e,r,n,a){a===void 0&&(a=!0);var i=this;if(!e){console.warn("layout cannot be null");return}if(a&&this.get("enabledStack")&&this.pushStack("layout",{before:i.get("layout"),after:e}),i.set("layout",e),i.set("layoutMethod",i.getLayout()),i.layout(),r){var o=n;o||(r==="begin"?o={x:0,y:0}:o={x:this.getWidth()/2,y:this.getHeight()/2}),o=this.getPointByCanvas(o.x,o.y);var s=this.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];o.x=o.x*s[0]+s[6],o.y=o.y*s[0]+s[7];var l=this.getGroup().getCanvasBBox(),h=l.minX,p=l.maxX,D=l.minY,I=l.maxY,F={x:(h+p)/2,y:(D+I)/2};r==="begin"&&(F.x=h,F.y=D),this.translate(o.x-F.x,o.y-F.y)}},t.prototype.refreshLayout=function(e){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");var r=this;r.layout(e)},t.prototype.layout=function(e){var r=this,n=this,a=n.get("data"),i=n.get("layoutMethod"),o=n.get("layout"),s=a;if(o==null?void 0:o.excludeInvisibles){a=(0,m.clone)(n.get("data"));var l={};su(a,function(D){var I=D.children;if(!(I==null?void 0:I.length))return!0;for(var F=I.length-1;F>=0;F--){var Z=r.findById(I[F].id),ee=Z?!Z.isVisible():I[F].visible===!1;ee&&(l[D.id]=l[D.id]||[],l[D.id].push({idx:F,child:I.splice(F,1)[0]}))}}),s=i?i(a,n.get("layout")):a,su(s,function(D){var I=l[D.id];if(I==null?void 0:I.length)for(var F=I.length-1;F>=0;F--){var Z=I[F],ee=Z.idx,se=Z.child;D.children.splice(ee,0,se)}})}else s=i?i(a,n.get("layout")):a;var h=n.get("animate");if(n.emit("beforerefreshlayout",{data:a,layoutData:s}),n.emit("beforelayout"),n.innerUpdateChild(s,void 0,h),e){var p=n.get("viewController");p.fitView()}h?n.layoutAnimate(s):(n.refresh(),n.paint()),n.emit("afterrefreshlayout",{data:a,layoutData:s}),n.emit("afterlayout")},t.prototype.addChild=function(e,r,n){n===void 0&&(n=!0);var a=this;a.emit("beforeaddchild",{model:e,parent:r}),(0,m.isString)(r)||(r=r.get("id"));var i=a.findDataById(r);if(i){i.children||(i.children=[]),i.children.push(e);var o=a.findById(r);o.refresh(),a.changeData(void 0,n)}},t.prototype.updateChildren=function(e,r,n){n===void 0&&(n=!0);var a=this,i=a.findById(r);if(!r||!i){console.warn("Update children failed! There is no node with id '".concat(r,"'"));return}var o=a.findDataById(r);o.children=e,i.refresh(),a.changeData(void 0,n)},t.prototype.updateChild=function(e,r,n){n===void 0&&(n=!0);var a=this;if(!r||!a.findById(r)){a.changeData(e,n);return}var i=a.findDataById(r),o=a.findById(e.id);if(i.children||(i.children=[]),!o)i.children.push(e);else{var s=t.indexOfChild(i.children,e.id);s>-1&&(i.children[s]=e)}var l=a.findById(r);l==null||l.refresh(),a.changeData(void 0,n)},t.prototype.removeChild=function(e,r){r===void 0&&(r=!0);var n=this,a=n.findById(e),i;if(a?i=a==null?void 0:a.get("parent"):i=n.getNodes().find(function(p){var D=p.getModel().children||[];return!!D.find(function(I){return I.id===e})}),i&&!i.destroyed){var o=i.get("id"),s=n.findDataById(o),l=s&&s.children||[],h=t.indexOfChild(l,e);l.splice(h,1),i.refresh()}n.changeData(void 0,r)},t.prototype.findDataById=function(e,r){var n=this;if(r||(r=n.get("data")),e===r.id)return r;var a=null;return(0,m.each)(r.children||[],function(i){if(i.id===e)return a=i,!1;if(a=n.findDataById(e,i),a)return!1}),a},t.prototype.layoutAnimate=function(e,r){var n=this,a=this.get("animateCfg");n.emit("beforeanimate",{data:e}),n.getEdges().forEach(function(i){var o=i.get("model");o.sourceAnchor||(o.sourceAnchor=i.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(i){su(e,function(o){var s=n.findById(o.id);if(s){var l=s.get("originAttrs"),h=s.get("model");if(l||(l={x:h.x,y:h.y},s.set("originAttrs",l)),r){var p=r(s,i,l,e);s.set("model",Object.assign(h,p))}else h.x=l.x+(o.x-l.x)*i,h.y=l.y+(o.y-l.y)*i}return!0}),(0,m.each)(n.get("removeList"),function(o){var s=o.getModel(),l=o.get("originAttrs"),h=o.get("to");s.x=l.x+(h.x-l.x)*i,s.y=l.y+(h.y-l.y)*i}),n.refreshPositions()},{duration:a.duration,easing:a.ease,callback:function(){(0,m.each)(n.getNodes(),function(o){o.set("originAttrs",null)}),(0,m.each)(n.get("removeList"),function(o){n.removeItem(o,!1)}),n.set("removeList",[]),a.callback&&a.callback(),n.emit("afteranimate",{data:e})},delay:a.delay})},t.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},t.prototype.isLayoutAnimating=function(){return this.layoutAnimating},t.prototype.render=function(e){e===void 0&&(e=!0);var r=this,n=r.get("data");if(!n||!(0,m.isObject)(n)||!Object.keys(n).length)throw new Error("data must be defined first");r.clear(),e&&this.get("enabledStack")&&this.clearStack(),r.emit("beforerender"),r.layout(this.get("fitView")),r.emit("afterrender")},t.prototype.save=function(){return this.get("data")},t.prototype.data=function(e){c.prototype.data.call(this,e),this.set("originData",JSON.parse(JSON.stringify(e)))},t}(ys),yl=pl,Kn=z(45442),ms=function(){function c(t){this._cfgs=(0,m.deepMix)(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return c.prototype.getDefaultCfgs=function(){return{}},c.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var r=e.getEvents(),n={};(0,m.each)(r,function(a,i){var o=(0,m.wrapBehavior)(e,a);n[i]=o,t.on(i,o)}),this._events=n,this.init()},c.prototype.getEvents=function(){return{}},c.prototype.get=function(t){var e;return(e=this._cfgs)===null||e===void 0?void 0:e[t]},c.prototype.set=function(t,e){this._cfgs[t]=e},c.prototype.destroy=function(){},c.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;(0,m.each)(e,function(r,n){t.off(n,r)}),this._events=null,this._cfgs=null,this.destroyed=!0},c}(),Qi=ms,Wc=function(){var c=function(e,r){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},c(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),rc="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",ml=function(c){Wc(t,c);function t(e){return c.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{img:rc,follow:!0}},t.prototype.init=function(){var e=this.get("graph"),r=e.get("container"),n=e.get("canvas").get("el"),a=this.get("img")||rc;a.includes("url(")||(a='url("'.concat(a,'")'));var i=(0,Aa.Z)(`
`),o=(0,Aa.Z)(`
`));this.set("container",i),this.set("gridContainer",o),this.positionInit(),i.appendChild(o),r.insertBefore(i,n)},t.prototype.positionInit=function(){var e=this.get("graph"),r=e.get("minZoom"),n=e.get("width"),a=e.get("height");(0,Kn.Z)(this.get("container"),{width:"".concat(n,"px"),height:"".concat(a,"px")});var i=n*80/r,o=a*80/r;(0,Kn.Z)(this.get("gridContainer"),{width:"".concat(i,"px"),height:"".concat(o,"px"),left:"-".concat(i/2,"px"),top:"-".concat(o/2,"px")})},t.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},t.prototype.updateGrid=function(e){var r=this.get("gridContainer"),n=e.matrix;n||(n=[1,0,0,0,1,0,0,0,1]);var a=this.get("follow"),i="matrix(".concat(n[0],", ").concat(n[1],", ").concat(n[3],", ").concat(n[4],", ").concat(a?n[6]:"0",", ").concat(a?n[7]:"0",")");(0,Kn.Z)(r,{transform:i})},t.prototype.getContainer=function(){return this.get("container")},t.prototype.destroy=function(){var e=this.get("graph"),r=e.get("container"),n=this.get("container");r.removeChild(n)},t}(Qi),jc=ml,El=z(38186),pi=z.n(El),Xc=function(){var c=function(e,r){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},c(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();typeof document!="undefined"&&pi()(` .g6-component-contextmenu { border: 1px solid #e2e2e2; border-radius: 4px; font-size: 12px; color: #545454; background-color: rgba(255, 255, 255, 0.9); padding: 10px 8px; box-shadow: rgb(174, 174, 174) 0px 0px 10px; } .g6-contextmenu-ul { padding: 0; margin: 0; list-style: none; } `);var uu=function(c){Xc(t,c);function t(e){return c.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(r){return`
  • \u83DC\u5355\u98791
  • \u83DC\u5355\u98792
`},shouldBegin:function(r){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},t.prototype.getEvents=function(){return this.get("trigger")==="click"?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},t.prototype.init=function(){var e=this.get("className"),r=(0,Aa.Z)("
"));(0,Kn.Z)(r,{top:"0px",position:"absolute",visibility:"hidden"});var n=this.get("container");n||(n=this.get("graph").get("container")),(0,m.isString)(n)&&(n=document.getElementById(n)),n.appendChild(r),this.set("menu",r)},t.prototype.onMenuShow=function(e){var r=this;e.preventDefault();var n=this.get("itemTypes");if(e.item){if(e.item&&e.item.getType&&n.indexOf(e.item.getType())===-1){r.onMenuHide();return}}else if(n.indexOf("canvas")===-1){r.onMenuHide();return}var a=this.get("shouldBegin");if(!!a(e)){var i=this.get("menu"),o=this.get("getContent"),s=this.get("graph"),l=o(e,s);(0,m.isString)(l)?i.innerHTML=l:i.innerHTML=l.outerHTML,this.removeMenuEventListener();var h=this.get("handleMenuClick");if(h){var p=function(He){h(He.target,e.item,s)};this.set("handleMenuClickWrapper",p),i.addEventListener("click",p)}var D=s.get("width"),I=s.get("height"),F=i.getBoundingClientRect(),Z=this.get("offsetX")||0,ee=this.get("offsetY")||0,se=s.getContainer().offsetTop,oe=s.getContainer().offsetLeft,ce=e.canvasX+oe+Z,we=e.canvasY+se+ee;ce+F.width>D&&(ce=e.canvasX-F.width-Z+oe),we+F.height>I&&(we=e.canvasY-F.height-ee+se),(0,Kn.Z)(i,{top:"".concat(we,"px"),left:"".concat(ce,"px"),visibility:"visible"});var Re=this.get("trigger")==="click",Oe=function(He){if(Re){Re=!1;return}r.onMenuHide()};document.body.addEventListener("click",Oe),this.set("handler",Oe)}},t.prototype.removeMenuEventListener=function(){var e=this.get("handleMenuClickWrapper"),r=this.get("handler");if(e){var n=this.get("menu");n.removeEventListener("click",e),this.set("handleMenuClickWrapper",null)}r&&document.body.removeEventListener("click",r)},t.prototype.onMenuHide=function(){var e=this.get("menu");e&&(0,Kn.Z)(e,{visibility:"hidden"}),this.removeMenuEventListener()},t.prototype.destroy=function(){var e=this.get("menu");if(this.removeMenuEventListener(),e){var r=this.get("container");r||(r=this.get("graph").get("container")),(0,m.isString)(r)&&(r=document.getElementById(r)),r.removeChild(e)}},t}(Qi),Es=uu,Vc=function(){var c=function(e,r){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},c(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Fu=function(){return Fu=Object.assign||function(c){for(var t,e=1,r=arguments.length;e-1,l=navigator.userAgent.toLowerCase().indexOf("safari")>-1,h=(0,Aa.Z)(`
`)),p=0,D=0,I=!1,F=0,Z=0,ee=0,se=0,oe=0,ce=0,we=l||s?"mousedown":"dragstart";h.addEventListener(we,function(He){var at,qe;if(He.dataTransfer){var yt=new Image;yt.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",(qe=(at=He.dataTransfer).setDragImage)===null||qe===void 0||qe.call(at,yt,0,0);try{He.dataTransfer.setData("text/html","view-port-minimap")}catch(yr){He.dataTransfer.setData("text","view-port-minimap")}}if(r.refresh=!1,He.target===h){var Ft=h.style;F=parseInt(Ft.left,10),Z=parseInt(Ft.top,10),ee=parseInt(Ft.width,10),se=parseInt(Ft.height,10),!(ee>n[0]||se>n[1])&&(ce=a.getZoom(),oe=e.get("ratio"),I=!0,p=He.clientX,D=He.clientY)}},!1);var Re=function(at){if(!(!I||(0,m.isNil)(at.clientX)||(0,m.isNil)(at.clientY))){var qe=p-at.clientX,yt=D-at.clientY;(F-qe<0||F-qe+ee>=n[0])&&(qe=0),(Z-yt<0||Z-yt+se>=n[1])&&(yt=0),F-=qe,Z-=yt,(0,Kn.Z)(h,{left:"".concat(F,"px"),top:"".concat(Z,"px")}),a.translate(qe*ce/oe,yt*ce/oe),p=at.clientX,D=at.clientY}};!l&&!s&&h.addEventListener("drag",Re,!1);var Oe=function(){I=!1,r.refresh=!0},Pe=l||s?"mouseup":"dragend";h.addEventListener(Pe,Oe,!1),o.addEventListener("mouseleave",Oe),o.addEventListener("mouseup",Oe),(l||s)&&o.addEventListener("mousemove",Re,!1),this.set("viewport",h),o.appendChild(h)}},t.prototype.updateViewport=function(){if(!this.destroyed){var e=this.get("ratio"),r=this.get("totaldx"),n=this.get("totaldy"),a=this.get("graph"),i=this.get("size"),o=a.get("canvas").get("el"),s=a.get("width")||o.scrollWidth||500,l=a.get("height")||o.scrollHeight||500,h=a.getPointByCanvas(0,0),p=a.getPointByCanvas(s,l),D=this.get("viewport");D||this.initViewport();var I=(p.x-h.x)*e,F=(p.y-h.y)*e,Z=h.x*e+r,ee=h.y*e+n,se=Z+I,oe=ee+F;Z<0&&(I+=Z,Z=0),se>i[0]&&(I=I-(se-i[0])),ee<0&&(F+=ee,ee=0),oe>i[1]&&(F=F-(oe-i[1])),this.set("ratio",e);var ce="".concat(Z,"px"),we="".concat(ee,"px");(0,Kn.Z)(D,{left:ce,top:we,width:"".concat(I,"px"),height:"".concat(F,"px")})}},t.prototype.updateGraphShapes=function(){var e=this._cfgs.graph,r=this.get("canvas"),n=e.get("group");if(!n.destroyed){r.clear();var a;this.get("hideEdge")?(a=r.addGroup(),n.get("children").forEach(function(o){o.get("id").includes("-edge")||a.add(o.clone())})):(a=n.clone(),a.resetMatrix(),r.add(a));var i=e.get("renderer");i===Ri&&this.updateVisible(a)}},t.prototype.updateVisible=function(e){var r=this;if(!e.isGroup()&&!e.get("visible"))e.hide();else{var n=e.get("children");if(!n||!n.length)return;n.forEach(function(a){a.get("visible")||a.hide(),r.updateVisible(a)})}},t.prototype.updateKeyShapes=function(){var e=this,r=this._cfgs.graph,n=this.get("canvas"),a=n.get("children")[0]||n.addGroup();this.get("hideEdge")||(0,m.each)(r.getEdges(),function(s){e.updateOneEdgeKeyShape(s,a)}),(0,m.each)(r.getNodes(),function(s){e.updateOneNodeKeyShape(s,a)});var i=r.getCombos();if(i&&i.length){var o=a.find(function(s){return s.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){e.destroyed||((0,m.each)(i,function(s){e.updateOneComboKeyShape(s,o)}),o==null||o.sort(),o==null||o.toBack(),e.updateCanvas())},250)}this.clearDestroyedShapes()},t.prototype.updateOneComboKeyShape=function(e,r){if(!this.destroyed){var n=this.get("itemMap")||{},a=n[e.get("id")],i=e.getBBox(),o=e.get("keyShape").clone(),s=o.attr(),l={x:i.centerX,y:i.centerY};a?l=Object.assign(s,l):(a=o,r.add(a));var h=a.get("type");(h==="rect"||h==="image")&&(l.x=i.minX,l.y=i.minY),a.attr(l),e.isVisible()?a.show():a.hide(),a.exist=!0;var p=e.getModel().depth;isNaN(p)||a.set("zIndex",p),n[e.get("id")]=a,this.set("itemMap",n)}},t.prototype.updateOneNodeKeyShape=function(e,r){var n=this.get("itemMap")||{},a=n[e.get("id")],i=e.getBBox(),o=e.get("keyShape").clone(),s=o.attr(),l={x:i.centerX,y:i.centerY};a?(l=Object.assign(s,l),a.toFront()):(a=o,r.add(a));var h=a.get("type");(h==="rect"||h==="image")&&(l.x=i.minX,l.y=i.minY),a.attr(l),e.isVisible()?a.show():a.hide(),a.exist=!0;var p=e.getModel().depth;isNaN(p)||a.set("zIndex",p),n[e.get("id")]=a,this.set("itemMap",n)},t.prototype.updateDelegateShapes=function(){var e=this,r=this._cfgs.graph,n=this.get("canvas"),a=n.get("children")[0]||n.addGroup();this.get("hideEdge")||(0,m.each)(r.getEdges(),function(s){e.updateOneEdgeKeyShape(s,a)}),(0,m.each)(r.getNodes(),function(s){e.updateOneNodeDelegateShape(s,a)});var i=r.getCombos();if(i&&i.length){var o=a.find(function(s){return s.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){e.destroyed||((0,m.each)(i,function(s){e.updateOneComboKeyShape(s,o)}),o==null||o.sort(),o==null||o.toBack(),e.updateCanvas())},250)}this.clearDestroyedShapes()},t.prototype.clearDestroyedShapes=function(){var e=this.get("itemMap")||{},r=Object.keys(e);if(!(!r||r.length===0))for(var n=r.length-1;n>=0;n--){var a=e[r[n]],i=a.exist;a.exist=!1,i||(a.remove(),delete e[r[n]])}},t.prototype.updateOneEdgeKeyShape=function(e,r){var n=this.get("itemMap")||{},a=n[e.get("id")];if(a){var i=e.get("keyShape").attr("path");a.attr("path",i)}else a=e.get("keyShape").clone(),r.add(a);e.isVisible()?a.show():a.hide(),a.exist=!0,n[e.get("id")]=a,this.set("itemMap",n)},t.prototype.updateOneNodeDelegateShape=function(e,r){var n=this.get("delegateStyle"),a=this.get("itemMap")||{},i=a[e.get("id")],o=e.getBBox();if(i){var s={x:o.minX,y:o.minY,width:o.width,height:o.height};i.attr(s),i.toFront()}else i=r.addShape("rect",{attrs:Fu({x:o.minX,y:o.minY,width:o.width,height:o.height},n),name:"minimap-node-shape"});e.isVisible()?i.show():i.hide(),i.exist=!0,a[e.get("id")]=i,this.set("itemMap",a)},t.prototype.init=function(){this.initContainer(),this.get("graph").on("afterupdateitem",this.handleUpdateCanvas),this.get("graph").on("afteritemstatechange",this.handleUpdateCanvas),this.get("graph").on("afteradditem",this.handleUpdateCanvas),this.get("graph").on("afterremoveitem",this.handleUpdateCanvas),this.get("graph").on("afterrender",this.handleUpdateCanvas),this.get("graph").on("afterlayout",this.handleUpdateCanvas)},t.prototype.initContainer=function(){var e=this,r=e.get("graph"),n=e.get("size"),a=e.get("className"),i=e.get("container"),o=(0,Aa.Z)("
"));(0,m.isString)(i)&&(i=document.getElementById(i)),i?i.appendChild(o):r.get("container").appendChild(o),e.set("container",o);var s=(0,Aa.Z)('
');o.appendChild(s),s.addEventListener("dragenter",function(p){p.preventDefault()}),s.addEventListener("dragover",function(p){p.preventDefault()});var l,h=r.get("renderer");h===Ri?l=new Ps.Canvas({container:s,width:n[0],height:n[1]}):l=new so.Canvas({container:s,width:n[0],height:n[1]}),e.set("canvas",l),e.updateCanvas()},t.prototype.updateCanvas=function(){if(!this.destroyed){var e=this.get("refresh");if(!!e){var r=this.get("graph");if(!r.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var n=this.get("size"),a=this.get("canvas"),i=this.get("type"),o=this.get("padding");if(!a.destroyed){switch(i){case Ji:this.updateGraphShapes();break;case bs:this.updateKeyShapes();break;case ci:this.updateDelegateShapes();break;default:break}var s=a.get("children")[0];if(!!s){s.resetMatrix();var l=s.getCanvasBBox(),h=r.get("canvas").getCanvasBBox(),p=r.getZoom()||1,D=h.width/p,I=h.height/p;Number.isFinite(l.width)&&(D=Gu(l.width,D),I=Gu(l.height,I)),D+=2*o,I+=2*o;var F=Math.min(n[0]/D,n[1]/I),Z=[1,0,0,0,1,0,0,0,1],ee=0,se=0;Number.isFinite(l.minX)&&(ee=-l.minX),Number.isFinite(l.minY)&&(se=-l.minY);var oe=(n[0]-(D-2*o)*F)/2,ce=(n[1]-(I-2*o)*F)/2;Z=Yc(Z,[["t",ee,se],["s",F,F],["t",oe,ce]]),s.setMatrix(Z),this.set("ratio",F),this.set("totaldx",oe+ee*F),this.set("totaldy",ce+se*F),this.set("dx",oe),this.set("dy",ce),this.updateViewport()}}}}}},t.prototype.getCanvas=function(){return this.get("canvas")},t.prototype.getViewport=function(){return this.get("viewport")},t.prototype.getContainer=function(){return this.get("container")},t.prototype.destroy=function(){var e;(e=this.get("canvas"))===null||e===void 0||e.destroy();var r=this.get("container");(r==null?void 0:r.parentNode)&&r.parentNode.removeChild(r)},t}(Qi),bl=Ef,Hc=function(){var c=function(e,r){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},c(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();function Yo(c,t,e){var r=c.x-t.x,n=c.y-t.y;return!e||Math.abs(r)>e||Math.abs(n)>e?Math.sqrt(r*r+n*n):e}function xl(c,t){return c.x*t.x+c.y*t.y}function nc(c,t){var e=(t.source.y-t.target.y)/(t.source.x-t.target.x),r=(e*e*t.source.x+e*(c.y-t.source.y)+c.x)/(e*e+1),n=e*(r-t.source.x)+t.source.y;return{x:r,y:n}}var wl=function(c){Hc(t,c);function t(e){return c.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{edgeBundles:[],edgePoints:[],K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:.6666667,bundleThreshold:.6,eps:1e-6,onLayoutEnd:function(){},onTick:function(){}}},t.prototype.init=function(){var e=this.get("graph"),r=this.get("onTick"),n=function(){r&&r(),e.refreshPositions()};this.set("tick",n)},t.prototype.bundling=function(e){var r=this;if(r.set("data",e),!r.isTicking()){var n=e.edges||[],a=e.nodes||[],i={},o=!1;if(a.forEach(function(we){(we.x===null||!we.y===null||we.x===void 0||!we.y===void 0)&&(o=!0),i[we.id]=we}),o)throw new Error("please layout the graph or assign x and y for nodes first");r.set("nodeIdMap",i);var s=r.get("divisions"),l=r.get("divRate"),h=r.divideEdges(s);r.set("edgePoints",h);var p=r.getEdgeBundles();r.set("edgeBundles",p);for(var D=r.get("cycles"),I=r.get("iterations"),F=r.get("iterRate"),Z=r.get("lambda"),ee=0;eeF;){var ce=F/oe,we={x:i[s][se-1].x,y:i[s][se-1].y};we.x+=ce*(ee.x-i[s][se-1].x),we.y+=ce*(ee.y-i[s][se-1].y),Z.push(we),oe-=F,F=I}F-=oe}}),Z.push({x:p.x,y:p.y}),i[s]=Z}}),i},t.prototype.getEdgeLength=function(e){var r=0;return e.forEach(function(n,a){a!==0&&(r+=Yo(n,e[a-1]))}),r},t.prototype.getEdgeBundles=function(){var e=this,r=e.get("data"),n=r.edges||[],a=e.get("bundleThreshold"),i=e.get("nodeIdMap"),o=e.get("edgeBundles");return o||(o=[]),n.forEach(function(s,l){(!o[l]||o[l]===void 0)&&(o[l]=[])}),n.forEach(function(s,l){var h=i[s.source],p=i[s.target];n.forEach(function(D,I){if(!(I<=l)){var F=i[D.source],Z=i[D.target],ee=e.getBundleScore({source:h,target:p},{source:F,target:Z});ee>=a&&(o[l].push(I),o[I].push(l))}})}),o},t.prototype.getBundleScore=function(e,r){var n=this;e.vx=e.target.x-e.source.x,e.vy=e.target.y-e.source.y,r.vx=r.target.x-r.source.x,r.vy=r.target.y-r.source.y,e.length=Yo({x:e.source.x,y:e.source.y},{x:e.target.x,y:e.target.y}),r.length=Yo({x:r.source.x,y:r.source.y},{x:r.target.x,y:r.target.y});var a=n.getAngleScore(e,r),i=n.getScaleScore(e,r),o=n.getPositionScore(e,r),s=n.getVisibilityScore(e,r);return a*i*o*s},t.prototype.getAngleScore=function(e,r){var n=xl({x:e.vx,y:e.vy},{x:r.vx,y:r.vy});return n/(e.length*r.length)},t.prototype.getScaleScore=function(e,r){var n=(e.length+r.length)/2,a=2/(n/Math.min(e.length,r.length)+Math.max(e.length,r.length)/n);return a},t.prototype.getPositionScore=function(e,r){var n=(e.length+r.length)/2,a={x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2},i={x:(r.source.x+r.target.x)/2,y:(r.source.y+r.target.y)/2},o=Yo(a,i);return n/(n+o)},t.prototype.getVisibilityScore=function(e,r){var n=this.getEdgeVisibility(e,r),a=this.getEdgeVisibility(r,e);return na||Math.abs(p.y)>a){var D=Yo(o[h][e],o[r][e]),I=1/D;l.x+=p.x*I,l.y+=p.y*I}}),l},t.prototype.isTicking=function(){return this.get("ticking")},t.prototype.getSimulation=function(){return this.get("forceSimulation")},t.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),c.prototype.destroy.call(this)},t}(Qi),Sl=wl,_l=function(){var c=function(e,r){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},c(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),ac=function(){return ac=Object.assign||function(c){for(var t,e=1,r=arguments.length;e(l||n.get("height"))&&a>1||p<(h||n.get("height")*.05)&&a<1)&&(a=1),p*=a,r.set("r",p),r.set("r2",p*p);var D=r.get("d");r.set("molecularParam",(D+1)*p),r.set("delegateCenterDiff",void 0),r.magnify(e,s)}},t.prototype.scaleRByDrag=function(e){var r=this;if(!!e){var n=r.get("dragPrePos"),a=r.get("graph"),i,o=a.getPointByClient(e.clientX,e.clientY);e.x-n.x<0?i=1-zu:i=1/(1-zu);var s=r.get("maxR"),l=r.get("minR"),h=r.get("r");(h>(s||a.get("height"))&&i>1||h<(l||a.get("height")*.05)&&i<1)&&(i=1),h*=i,r.set("r",h),r.set("r2",h*h);var p=r.get("d");r.set("molecularParam",(p+1)*h),r.magnify(e,o),r.set("dragPrePos",{x:e.x,y:e.y})}},t.prototype.scaleDByWheel=function(e){var r=this;if(!(!e&&!e.originalEvent)){e.preventDefault&&e.preventDefault();var n=0;e.originalEvent.wheelDelta<0?n=-.1:n=.1;var a=r.get("d"),i=a+n,o=r.get("maxD"),s=r.get("minD");if(is){r.set("d",i);var l=r.get("r");r.set("molecularParam",(i+1)*l);var h=r.get("delegate"),p=h?{x:h.attr("x"),y:h.attr("y")}:void 0;r.set("delegateCenterDiff",void 0),r.magnify(e,p)}}},t.prototype.scaleDByDrag=function(e){var r=this,n=r.get("dragPrePos"),a=e.x-n.x>0?.1:-.1,i=r.get("d"),o=i+a,s=r.get("maxD"),l=r.get("minD");if(ol){r.set("d",o);var h=r.get("r");r.set("molecularParam",(o+1)*h),r.magnify(e)}r.set("dragPrePos",{x:e.x,y:e.y})},t.prototype.magnify=function(e,r){var n=this;n.restoreCache();var a=n.get("graph"),i=n.get("cachedMagnifiedModels"),o=n.get("cachedOriginPositions"),s=n.get("showLabel"),l=n.get("r"),h=n.get("r2"),p=n.get("d"),D=n.get("molecularParam"),I=a.getNodes(),F=I.length,Z=r?{x:r.x,y:r.y}:{x:e.x,y:e.y};n.get("dragging")&&(n.get("trigger")==="mousemove"||n.get("trigger")==="click")&&(Z=n.get("cacheCenter"));var ee=n.get("delegateCenterDiff");ee&&(Z.x+=ee.x,Z.y+=ee.y),n.updateDelegate(Z,l);for(var se=0;se
  • `},zoomSensitivity:2}},t.prototype.init=function(){var e=this,r=this.get("graph"),n=this.get("getContent"),a=n(r),i=a;(0,m.isString)(a)&&(i=(0,Aa.Z)(a));var o=this.get("className");i.setAttribute("class",o||"g6-component-toolbar");var s=this.get("container");s||(s=this.get("graph").get("container")),(0,m.isString)(s)&&(s=document.getElementById(s)),s.appendChild(i),this.set("toolBar",i);var l=this.get("handleClick");i.addEventListener("click",function(p){var D=Kc(p).filter(function(F){return F.nodeName==="LI"});if(D.length!==0){var I=D[0].getAttribute("code");!I||(l?l(I,r):e.handleDefaultOperator(I))}});var h=this.get("position");h&&(0,Kn.Z)(i,{top:"".concat(h.y,"px"),left:"".concat(h.x,"px")}),this.bindUndoRedo()},t.prototype.bindUndoRedo=function(){var e=this.get("graph"),r=document.querySelector('.g6-component-toolbar li[code="undo"]'),n=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),a=document.querySelector('.g6-component-toolbar li[code="redo"]'),i=document.querySelector('.g6-component-toolbar li[code="redo"] svg');!r||!n||!a||!i||(r.setAttribute("style","cursor: not-allowed"),n.setAttribute("style","opacity: 0.4"),a.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4"),e.on("stackchange",function(o){var s=o.undoStack,l=o.redoStack,h=s.length,p=l.length;h===0?(r.setAttribute("style","cursor: not-allowed"),n.setAttribute("style","opacity: 0.4")):(r.removeAttribute("style"),n.removeAttribute("style")),p===0?(a.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4")):(a.removeAttribute("style"),i.removeAttribute("style"))}))},t.prototype.undo=function(){var e=this.get("graph"),r=e.getUndoStack();if(!(!r||r.length===0)){var n=r.pop();if(n){var a=n.action;e.pushStack(a,(0,m.clone)(n.data),"redo");var i=n.data.before;if(a==="add"&&(i=n.data.after),!i)return;switch(a){case"visible":{Object.keys(i).forEach(function(p){var D=i[p];!D||D.forEach(function(I){var F=e.findById(I.id);I.visible?e.showItem(F,!1):e.hideItem(F,!1)})});break}case"render":case"update":Object.keys(i).forEach(function(p){var D=i[p];!D||D.forEach(function(I){var F=e.findById(I.id);delete I.id,e.updateItem(F,I,!1),F.getType()==="combo"&&e.updateCombo(F)})});break;case"changedata":e.changeData(i,!1);break;case"delete":{Object.keys(i).forEach(function(p){var D=i[p];!D||D.forEach(function(I){var F=I.itemType;delete I.itemType,e.addItem(F,I,!1)})});break}case"add":Object.keys(i).forEach(function(p){var D=i[p];!D||D.forEach(function(I){e.removeItem(I.id,!1)})});break;case"updateComboTree":Object.keys(i).forEach(function(p){var D=i[p];!D||D.forEach(function(I){e.updateComboTree(I.id,I.parentId,!1)})});break;case"createCombo":var o=n.data.after.combos,s=o[o.length-1];Object.keys(i).forEach(function(p){var D=i[p];!D||D.forEach(function(I){e.updateComboTree(I.id,I.parentId,!1)})}),e.removeItem(s.id,!1);break;case"uncombo":var l=i.combos[i.combos.length-1],h=i.nodes.concat(i.combos).map(function(p){return p.id}).filter(function(p){return p!==l.id});e.createCombo(l,h,!1);break;case"layout":e.updateLayout(i,void 0,void 0,!1);break;default:}}}},t.prototype.redo=function(){var e=this.get("graph"),r=e.getRedoStack();if(!(!r||r.length===0)){var n=r.pop();if(n){var a=n.action,i=n.data.after;if(e.pushStack(a,(0,m.clone)(n.data)),a==="delete"&&(i=n.data.before),!i)return;switch(a){case"visible":{Object.keys(i).forEach(function(h){var p=i[h];!p||p.forEach(function(D){var I=e.findById(D.id);D.visible?e.showItem(I,!1):e.hideItem(I,!1)})});break}case"render":case"update":Object.keys(i).forEach(function(h){var p=i[h];!p||p.forEach(function(D){var I=e.findById(D.id);delete D.id,e.updateItem(I,D,!1),I.getType()==="combo"&&e.updateCombo(I)})});break;case"changedata":e.changeData(i,!1);break;case"delete":i.edges&&i.edges.forEach(function(h){e.removeItem(h.id,!1)}),i.nodes&&i.nodes.forEach(function(h){e.removeItem(h.id,!1)}),i.combos&&i.combos.forEach(function(h){e.removeItem(h.id,!1)});break;case"add":{Object.keys(i).forEach(function(h){var p=i[h];!p||p.forEach(function(D){var I=D.itemType;delete D.itemType,e.addItem(I,D,!1)})});break}case"updateComboTree":Object.keys(i).forEach(function(h){var p=i[h];!p||p.forEach(function(D){e.updateComboTree(D.id,D.parentId,!1)})});break;case"createCombo":var o=i.combos[i.combos.length-1];e.createCombo(o,o.children.map(function(h){return h.id}),!1);break;case"uncombo":var s=n.data.before.combos,l=s[s.length-1];e.uncombo(l.id,!1);break;case"layout":e.updateLayout(i,void 0,void 0,!1);break;default:}}}},t.prototype.zoomOut=function(){var e=this.get("graph"),r=e.getZoom(),n=1/(1-ic*this.get("zoomSensitivity")),a=this.get("maxZoom")||e.get("maxZoom");n*r>a||e.zoomTo(r*n)},t.prototype.zoomIn=function(){var e=this.get("graph"),r=e.getZoom(),n=1-ic*this.get("zoomSensitivity"),a=this.get("minZoom")||e.get("minZoom");n*r\u7C7B\u578B\uFF1A`.concat(r.item.getType(),` ID\uFF1A`).concat(r.item.getID(),` `)},shouldBegin:function(r){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},t.prototype.getEvents=function(){return this.get("trigger")==="click"?{"node:click":"onClick","edge:click":"onClick","combo:click":"onClick","canvas:click":"onMouseLeave",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave",drag:"onMouseLeave"}:{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove","edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove","combo:mouseenter":"onMouseEnter","combo:mouseleave":"onMouseLeave","combo:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave","node:drag":"onMouseLeave"}},t.prototype.init=function(){var e=this,r=e.get("className")||"g6-component-tooltip",n=(0,Aa.Z)("
    ")),a=e.get("container");a||(a=e.get("graph").get("container")),(0,m.isString)(a)&&(a=document.getElementById(a)),(0,Kn.Z)(n,{position:"absolute",visibility:"hidden",display:"none"}),a.appendChild(n),e.get("trigger")!=="click"&&(n.addEventListener("mouseenter",function(i){(0,Kn.Z)(n,{visibility:"visible",display:"unset"})}),n.addEventListener("mouseleave",function(i){e.hideTooltip()})),e.set("tooltip",n)},t.prototype.onClick=function(e){var r=this.get("itemTypes");if(!(e.item&&e.item.getType&&r.indexOf(e.item.getType())===-1)){var n=e.item,a=this.get("graph");this.currentTarget===n?(this.currentTarget=null,this.hideTooltip(),a.emit("tooltipchange",{item:e.item,action:"hide"})):(this.currentTarget=n,this.showTooltip(e),a.emit("tooltipchange",{item:e.item,action:"show"}))}},t.prototype.onMouseEnter=function(e){var r=this.get("itemTypes");if(!(e.item&&e.item.getType&&r.indexOf(e.item.getType())===-1)){var n=e.item,a=this.get("graph");this.currentTarget=n,this.showTooltip(e),a.emit("tooltipchange",{item:e.item,action:"show"})}},t.prototype.onMouseMove=function(e){var r=this.get("itemTypes");e.item&&e.item.getType&&r.indexOf(e.item.getType())===-1||!this.currentTarget||e.item!==this.currentTarget||this.showTooltip(e)},t.prototype.onMouseLeave=function(){this.hideTooltip();var e=this.get("graph");e.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},t.prototype.clearContainer=function(){var e=this.get("tooltip");e&&(e.innerHTML="")},t.prototype.showTooltip=function(e){if(!!e.item){var r=this.get("itemTypes");if(!(e.item.getType&&r.indexOf(e.item.getType())===-1)){var n=this.get("tooltip"),a=this.get("getContent"),i=a(e);(0,m.isString)(i)?n.innerHTML=i:(this.clearContainer(),n.appendChild(i)),this.updatePosition(e)}}},t.prototype.hideTooltip=function(){var e=this.get("tooltip");e&&(0,Kn.Z)(e,{visibility:"hidden",display:"none"})},t.prototype.updatePosition=function(e){var r=this.get("shouldBegin"),n=this.get("tooltip");if(!r(e)){(0,Kn.Z)(n,{visibility:"hidden",display:"none"});return}var a=this.get("graph"),i=a.get("width"),o=a.get("height"),s=this.get("offsetX")||0,l=this.get("offsetY")||0,h=a.getPointByClient(e.clientX,e.clientY),p=this.get("fixToNode"),D=e.item;if(D.getType&&D.getType()==="node"&&p&&(0,m.isArray)(p)&&p.length>=2){var I=D.getBBox();h={x:I.minX+I.width*p[0],y:I.minY+I.height*p[1]}}var F=a.getCanvasByPoint(h.x,h.y),Z=F.x,ee=F.y,se=a.getContainer(),oe={x:Z+se.offsetLeft+s,y:ee+se.offsetTop+l};(0,Kn.Z)(n,{visibility:"visible",display:"unset"});var ce=n.getBoundingClientRect();Z+ce.width+s>i&&(oe.x-=ce.width+s),ee+ce.height+l>o&&(oe.y-=ce.height+l,oe.y<0&&(oe.y=0)),(0,Kn.Z)(n,{left:"".concat(oe.x,"px"),top:"".concat(oe.y,"px")})},t.prototype.hide=function(){this.onMouseLeave()},t.prototype.destroy=function(){var e=this.get("tooltip");if(e){var r=this.get("container");r||(r=this.get("graph").get("container")),(0,m.isString)(r)&&(r=document.getElementById(r)),r.removeChild(e)}},t}(Qi),Zt=it,dr=z(86429),Yt=function(c,t,e){if(e||arguments.length===2)for(var r=0,n=t.length,a;rh&&(i=h,a=l)})}e.originalEvent.deltaY>0?a=Math.max(0,a-1):a=Math.min(t.speedAxisY.length-1,a+1);var o=t.speedAxisY[a]-n;r=Bn(r,[["t",0,o]]),t.speedPoint.setMatrix(r),t.currentSpeed=t.speedAxisY.length-a,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit(Nt,{speed:t.currentSpeed,type:t.currentType})}),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",function(e){var r,n,a=e.target.get("isChecked");a?(t.checkedIcon.hide(),t.checkedText.attr("text",((n=t.controllerCfg)===null||n===void 0?void 0:n.timePointControllerText)||"\u5355\u4E00\u65F6\u95F4"),t.currentType=Pa.RANGE):(t.checkedIcon.show(),t.checkedText.attr("text",((r=t.controllerCfg)===null||r===void 0?void 0:r.timeRangeControllerText)||"\u65F6\u95F4\u8303\u56F4"),t.currentType=Pa.SINGLE),e.target.set("isChecked",!a),t.group.emit(Nt,{type:t.currentType,speed:t.currentSpeed})})},c.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},c}(),Bi=Hn,Ln=function(){return Ln=Object.assign||function(c){for(var t,e=1,r=arguments.length;eZ?(Oe.show(),He.show(),Z=at.minX+at.width+10):(Oe.hide(),He.hide()),Oe}),this.controllerBtnGroup=new Bi(Ln({group:this.group,x:this.x,y:this.y+n+25,width:r,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),o.move(this.x,this.y),this.bindEvents(),this.currentMode===Pa.SINGLE&&(this.minHandlerShape.hide(),this.foregroundShape.hide(),this.minTextShape.hide())},c.prototype.bindEvents=function(){var t=this,e=this.group.find(function(n){return n.get("name")==="minHandlerShape"});e&&(e.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),e.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var r=this.group.find(function(n){return n.get("name")==="maxHandlerShape"});r&&(r.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),r.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on("".concat(Lt,":click"),function(){t.isPlay=!t.isPlay,t.currentHandler=t.maxHandlerShape,t.changePlayStatus()}),this.group.on("".concat(_r,":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(.01),t.updateUI()}),this.group.on("".concat(Yr,":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(-.01),t.updateUI()}),this.group.on(Nt,function(n){var a=n.type,i=n.speed;t.currentSpeed=i,t.currentMode=a,a===Pa.SINGLE?(t.minHandlerShape.hide(),t.foregroundShape.hide(),t.minTextShape.hide()):a===Pa.RANGE&&(t.minHandlerShape.show(),t.foregroundShape.show(),t.minTextShape.show())})},c.prototype.adjustTickIndex=function(t){for(var e=0;e1&&(this.end=1);var e=this.x+this.start*this.width,r=this.x+this.end*this.width;this.foregroundShape.attr("x",e),this.foregroundShape.attr("width",r-e);var n=(0,m.get)(this.handlerStyle,"width",Ho);this.setText(this.minText,this.maxText);var a=this.dodgeText([e,r]),i=a[0],o=a[1];this.minHandlerShape.setX(e-n/2),(0,m.each)(i,function(s,l){return t.minTextShape.attr(l,s)}),this.maxHandlerShape.setX(r-n/2),(0,m.each)(o,function(s,l){return t.maxTextShape.attr(l,s)}),this.currentMode===Pa.RANGE?this.graph.emit(Tt,{value:[this.start,this.end].sort()}):this.currentMode===Pa.SINGLE&&this.graph.emit(Tt,{value:[this.end,this.end]})},c.prototype.dodgeText=function(t){var e,r,n=2,a=(0,m.get)(this.handlerStyle,"width",Ho),i=this.minTextShape,o=this.maxTextShape,s=t[0],l=t[1],h=!1;s>l&&(e=[l,s],s=e[0],l=e[1],r=[o,i],i=r[0],o=r[1],h=!0);var p=i.getBBox(),D=o.getBBox(),I=null,F=null;return this.timeBarType==="trend"?(I=s-p.widththis.x+this.width?{x:l-a/2-n,textAlign:"right"}:{x:l+a/2+n,textAlign:"left"}):this.timeBarType==="simple"&&(I=i.attr("x")>p.width?{x:s,textAlign:"center"}:{x:s,textAlign:"left"},F=o.attr("x")>this.width-D.width?{x:l,textAlign:"right"}:{x:l,textAlign:"center"}),h?[F,I]:[I,F]},c.prototype.startPlay=function(){var t=this;return typeof window!="undefined"?window.requestAnimationFrame(function(){var e=t,r=e.ticks,n=e.width,a=t.currentSpeed,i=n/r.length,o=i/((10-a)*1e3/60),s=t.adjustOffsetRange(o/t.width);t.updateStartEnd(s),t.updateUI(),t.isPlay&&(t.playHandler=t.startPlay())}):void 0},c.prototype.changePlayStatus=function(t){t===void 0&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(Mt,null)):this.playHandler&&(typeof window!="undefined"&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit(sr,null))},c.prototype.destory=function(){this.graph.off(Tt,function(){});var t=this.group,e=t.find(function(n){return n.get("name")==="minHandlerShape"});e&&(e.off("minHandlerShape-handler:mousedown"),e.off("minHandlerShape-handler:touchstart"),e.destroy());var r=t.find(function(n){return n.get("name")==="maxHandlerShape"});r&&(r.off("maxHandlerShape-handler:mousedown"),r.off("maxHandlerShape-handler:touchstart"),r.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),t.off("".concat(Lt,":click")),t.off("".concat(_r,":click")),t.off("".concat(Yr,":click")),t.off(Nt),t.destroy(),this.trendComponent&&this.trendComponent.destory()},c}(),aa=nn,$e={opacity:.5,fill:"#000"},Ge={opacity:.5,fill:"#000",r:5},mt={fill:"#fff",fontSize:12},Gt=function(){function c(t){var e=t.x,r=e===void 0?0:e,n=t.y,a=n===void 0?0:n,i=t.container,o=t.text,s=t.padding,l=s===void 0?[4,4,4,4]:s,h=t.className,p=h===void 0?"g6-component-timebar-tooltip":h,D=t.backgroundColor,I=D===void 0?"#000":D,F=t.textColor,Z=F===void 0?"#fff":F,ee=t.opacity,se=ee===void 0?.8:ee,oe=t.fontSize,ce=oe===void 0?12:oe;this.container=i,this.className=p,this.backgroundColor=I,this.textColor=Z,this.x=r,this.y=a,this.text=o,this.padding=l,this.opacity=se,this.fontSize=ce,this.render()}return c.prototype.render=function(){var t=this,e=t.className,r=t.x,n=t.y,a=t.backgroundColor,i=t.textColor,o=t.text,s=t.padding,l=t.opacity,h=t.fontSize,p=t.container,D=(0,Aa.Z)("
    '));(0,m.isString)(p)&&(p=document.getElementById(p)),p.appendChild(D),t.parentHeight=p.offsetHeight,t.parentWidth=p.offsetWidth,(0,Kn.Z)(D,{visibility:"hidden",top:0,left:0});var I=(0,Aa.Z)(`
    "));I.innerHTML=o,D.appendChild(I),t.backgroundDOM=I;var F=(0,Aa.Z)("
    "));D.appendChild(F),t.arrowDOM=F,t.container=D},c.prototype.show=function(t){var e=this,r=t.text,n=t.x,a=t.y,i=t.clientX,o=t.clientY;e.backgroundDOM.innerHTML=r;var s=e.backgroundDOM.offsetWidth,l=e.backgroundDOM.offsetHeight,h=e.arrowDOM.offsetWidth,p=e.arrowDOM.offsetHeight;(0,Kn.Z)(e.container,{top:"".concat(-l-p,"px"),left:"".concat(n,"px"),visibility:"visible"}),(0,Kn.Z)(e.backgroundDOM,{marginLeft:"".concat(-s/2,"px")}),(0,Kn.Z)(e.arrowDOM,{marginLeft:"".concat(-h/2,"px"),top:"".concat(l,"px")});var D=n-s/2,I=n+s/2;D<0?(0,Kn.Z)(e.backgroundDOM,{marginLeft:"".concat(-s/2-D,"px")}):I>e.parentWidth&&(0,Kn.Z)(e.backgroundDOM,{marginLeft:"".concat(-s/2-I+e.parentWidth+12,"px")})},c.prototype.hide=function(){(0,Kn.Z)(this.container,{top:0,left:0,visibility:"hidden"})},c}(),Ut=Gt,wt=function(){return wt=Object.assign||function(c){for(var t,e=1,r=arguments.length;e=He&&yr<=at,lr=fr?h:p,Kt=Re.addShape("rect",{attrs:wt({x:a+yr*(we+oe),y:a,width:we,height:se},lr),draggable:!0,name:"tick-rect-".concat(yr)}),jr=Re.addShape("rect",{attrs:{x:a+yr*we+oe*(2*yr-1)/2,y:a,width:yr===0||yr===ce-1?we+oe/2:we+oe,height:se,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(yr)});jr.toFront();var Xr=Kt.getBBox(),er=(Xr.minX+Xr.maxX)/2;Oe.push({rect:Kt,pickRect:jr,value:Ft.date,x:er,y:Xr.minY});var mr;if(l?(mr=l(Ft),!(0,m.isString)(mr)&&mr&&(mr=Ft.date)):yr%Math.round(ce/10)==0&&(mr=Ft.date),mr){Pe.push(mr);var kr=Xr.maxY+a*2;Re.addShape("line",{attrs:{stroke:"#BFBFBF",x1:er,y1:kr,x2:er,y2:kr+Z},name:"tick-line"});var Fr=kr+Z+a,Jr=Re.addShape("text",{attrs:wt({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:er,y:Fr,textAlign:"center",text:mr,textBaseline:"top",fontSize:10,fontFamily:t.fontFamily||"Arial, sans-serif"},D),capture:!1,name:"tick-label"}),fn=Jr.getBBox();if(fn.maxX>r?Jr.attr("textAlign","right"):fn.minX<0&&Jr.attr("textAlign","left"),(0,m.isNumber)(qe)&&Pe.length!==10){var Vn=xt([1,0,0,0,1,0,0,0,1],[["t",-er,-Fr],["r",qe],["t",er-5,Fr+2]]);Jr.attr({textAlign:"left",matrix:Vn})}Pe.length===1?Jr.attr({textAlign:"left"}):Pe.length===10&&Jr.attr({textAlign:"right"})}}),this.tickRects=Oe;var yt=this.group;this.currentSpeed=1,this.controllerBtnGroup=new Bi(wt({group:yt,x:this.x,y:this.y+n+5,width:r,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"},this.controllerCfg))},c.prototype.initEvent=function(){var t=this,e=this.sliceGroup;e.on("click",function(h){var p=h.target;if(!(p.get("type")!=="rect"||!p.get("name"))){var D=parseInt(p.get("name").split("-")[2],10);if(!isNaN(D)){var I=t.tickRects,F=t.unselectedTickStyle;I.forEach(function(oe){oe.rect.attr(F)});var Z=t.selectedTickStyle;I[D].rect.attr(Z),t.startTickRectId=D,t.endTickRectId=D;var ee=I.length,se=D/ee;t.graph.emit(Tt,{value:[se,se]})}}}),e.on("dragstart",function(h){var p=t.tickRects,D=t.unselectedTickStyle;p.forEach(function(oe){oe.rect.attr(D)});var I=h.target,F=parseInt(I.get("name").split("-")[2],10),Z=t.selectedTickStyle;p[F].rect.attr(Z),t.startTickRectId=F;var ee=p.length,se=F/ee;t.graph.emit(Tt,{value:[se,se]}),t.dragging=!0}),e.on("dragover",function(h){if(!!t.dragging&&h.target.get("type")==="rect"){for(var p=parseInt(h.target.get("name").split("-")[2],10),D=t.startTickRectId,I=t.tickRects,F=t.selectedTickStyle,Z=t.unselectedTickStyle,ee=0;ee=D&&ee<=p?F:Z;I[ee].rect.attr(se)}var oe=I.length;t.endTickRectId=p;var ce=D/oe,we=p/oe;t.graph.emit(Tt,{value:[ce,we]})}}),e.on("drop",function(h){if(!!t.dragging&&(t.dragging=!1,h.target.get("type")==="rect")){var p=t.startTickRectId,D=parseInt(h.target.get("name").split("-")[2],10);if(!(D0?e.endTickRectId++:(r[e.endTickRectId].rect.attr(a),e.endTickRectId--),o!==e.startTickRectId)e.endTickRectId
    ")),(0,Kn.Z)(l,{position:"relative"})),s.appendChild(l),this.set("timeBarContainer",l);var h,p=e.get("renderer");p==="SVG"?h=new Ps.Canvas({container:l,width:n,height:a}):h=new so.Canvas({container:l,width:n,height:a}),this.get("containerCSS")&&(0,Kn.Z)(l,this.get("containerCSS")),this.set("canvas",h)},t.prototype.init=function(){this.initContainer();var e=this.get("canvas"),r=e.addGroup({name:"timebar-group"});this.set("timeBarGroup",r),this.renderTrend(),this.initEvent();var n=typeof window!="undefined"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",n)},t.prototype.play=function(){this.togglePlay(!0)},t.prototype.pause=function(){this.togglePlay(!1)},t.prototype.togglePlay=function(e){var r=this.get("timebar");!r||(r.isPlay=!!e,r.changePlayStatus())},t.prototype.renderTrend=function(){var e=this,r=this._cfgs,n=r.width,a=r.x,i=r.y,o=r.padding,s=r.type,l=r.trend,h=r.slider,p=r.controllerCfg,D=r.textStyle,I=r.tick,F=r.backgroundStyle,Z=r.foregroundStyle,ee=l.data,se=vr(l,["data"]),oe=n-2*o,ce=s==="trend"?ur:gr,we=this.get("graph"),Re=this.get("timeBarGroup"),Oe=this.get("canvas"),Pe=null;if(s==="trend"||s==="simple"){var He=this.get("getValue");Pe=new aa(zt(zt({graph:we,canvas:Oe,group:Re,type:s,x:a+o,y:s==="trend"?i+o:i+o+15,width:oe,height:ce,padding:o,backgroundStyle:F,foregroundStyle:Z,trendCfg:zt(zt({},se),{data:ee.map(function(qe){return(He==null?void 0:He(qe))||qe.value})})},h),{tick:{ticks:ee,tickLabelFormatter:I.tickLabelFormatter,tickLabelStyle:I.tickLabelStyle,tickLineStyle:I.tickLineStyle},handlerStyle:zt(zt({},h.handlerStyle),{height:h.height||ce}),controllerCfg:p,textStyle:D}))}else s==="tick"&&(Pe=new Ve(zt({graph:we,canvas:Oe,group:Re,x:a+o,y:i+o,width:n,height:42,padding:2,controllerCfg:p},I)));var at=function qe(){var yt=e.get("timebar");yt.draggingHandler=!1,yt.isPlay&&(yt.isPlay=!1,yt.currentHandler=yt.maxHandlerShape,yt.changePlayStatus()),document.removeEventListener("mouseup",qe)};Oe.on("mousedown",function(qe){(qe.target.get("name")==="maxHandlerShape-handler"||qe.target.get("name")==="minHandlerShape-handler"||qe.target===Pe.foregroundShape)&&document.addEventListener("mouseup",at)}),this.set("timebar",Pe)},t.prototype.filterData=function(e){var r,n=e.value;if(!n){n=[];var a=this._cfgs.type;!a||a==="trend"||a==="simple"?(n[0]=this._cfgs.slider.start,n[1]=this._cfgs.slider.end):a==="tick"&&(n[0]=this._cfgs.tick.start,n[1]=this._cfgs.tick.end)}var i=null,o=this._cfgs.type;if(o==="trend"||o==="simple"?i=this._cfgs.trend.data:o==="tick"&&(i=this._cfgs.tick.data),!i||i.length===0){console.warn("\u8BF7\u914D\u7F6E TimeBar \u7EC4\u4EF6\u7684\u6570\u636E");return}var s=this.get("rangeChange"),l=this.get("graph"),h=Math.round(i.length*n[0]),p=Math.round(i.length*n[1]);p=p>=i.length?i.length-1:p,h=h>=i.length?i.length-1:h;var D=(r=this._cfgs.tick)===null||r===void 0?void 0:r.tickLabelFormatter,I=D?D(i[h]):i[h].date,F=D?D(i[p]):i[p].date;if(o!=="tick"){var Z=this.get("timebar");Z.setText(I,F)}if(s)s(l,I,F);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&this.cacheGraphData.nodes.length===0)&&(this.cacheGraphData=l.get("data"));var ee=this.get("filterItemTypes"),se=this.get("changeData"),oe=this.get("getDate"),ce=this.get("shouldIgnore"),we=i[h].date,Re=i[p].date;if(se||se===void 0){var Oe=this.cacheGraphData.nodes,Pe=this.cacheGraphData.edges,He={},at={};l.getNodes().forEach(function(qe){return He[qe.getID()]=!0}),l.getEdges().forEach(function(qe){return at[qe.getID()]=!0}),ee.includes("node")&&(Oe==null||Oe.forEach(function(qe){var yt=+((oe==null?void 0:oe(qe))||qe.date),Ft=yt>=we&&yt<=Re||(ce==null?void 0:ce("node",qe,{min:we,max:Re})),yr=He[qe.id];yr&&!Ft?(l.removeItem(qe.id),He[qe.id]=!1):!yr&&Ft&&(l.addItem("node",qe),He[qe.id]=!0)}),Pe==null||Pe.forEach(function(qe){var yt=He[qe.source]&&He[qe.target]||(ce==null?void 0:ce("edge",qe,{min:we,max:Re})),Ft=!!l.findById(qe.id);Ft&&!yt?(l.removeItem(qe.id),at[qe.id]=!1):!Ft&&yt?(l.addItem("edge",qe),at[qe.id]=!0):Ft||(at[qe.id]=!1)})),(this.get("filterEdge")||ee.includes("edge"))&&(Pe==null||Pe.filter(function(qe){var yt=+((oe==null?void 0:oe(qe))||qe.date),Ft=yt>=we&&yt<=Re||(ce==null?void 0:ce("edge",qe,{min:we,max:Re})),yr=He[qe.source]&&He[qe.target],fr=Ft&&yr,lr=at[qe.id];lr&&!fr?(at[qe.id]=!1,l.removeItem(qe.id)):!lr&&fr&&(at[qe.id]=!0,l.addItem("edge",qe))}))}else ee.includes("node")&&l.getNodes().forEach(function(qe){var yt=qe.getModel();if(!(ce==null?void 0:ce("node",yt,{min:we,max:Re}))){var Ft=+((oe==null?void 0:oe(yt))||yt.date);FtRe?l.hideItem(qe):l.showItem(qe)}}),(this.get("filterEdge")||ee.includes("edge"))&&l.getEdges().forEach(function(qe){var yt=qe.getModel();if(!(ce==null?void 0:ce("edge",yt,{min:i[h].date,max:i[p].date}))){var Ft=+((oe==null?void 0:oe(yt))||yt.date);if(Fti[p].date)l.hideItem(qe);else{var yr=qe.getSource().isVisible(),fr=qe.getTarget().isVisible();yr&&fr&&l.showItem(qe)}}})}},t.prototype.initEvent=function(){var e=this.get("graph");e.on("afterchangedata",this.changeData),e.on("afterrender",this.afterrenderListener),e.on(Tt,this.valueChangeListener)},t.prototype.destroy=function(){var e=this.get("graph");e.off("afterchangedata",this.changeData),e.off("afterrender",this.afterrenderListener),e.off(Tt,this.valueChangeListener);var r=this.get("timebar");r&&r.destory&&r.destory(),c.prototype.destroy.call(this);var n=this.get("timeBarContainer");if(n){var a=this.get("container");a||(a=this.get("graph").get("container")),(0,m.isString)(a)&&(a=document.getElementById(a)),a.removeChild(n)}},t}(Qi),yn=Lr,Zn=function(){var c=function(e,r){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},c(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),un=ki.applyMatrix;function Dn(c,t){var e,r;if(c.naturalWidth)e=c.naturalWidth,r=c.naturalHeight;else{var n=new Image;n.src=c.src,n.onload=function(){t&&t(n.width,n.height)}}return[e,r]}var jn=function(c){Zn(t,c);function t(e){return c.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},t.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},t.prototype.disableRefresh=function(){this.set("refresh",!1)},t.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},t.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},t.prototype.initViewport=function(){var e=this,r=this._cfgs,n=r.graph;if(!this.destroyed){var a=this.get("container");(0,m.isString)(a)&&(a=document.getElementById(a));var i=(0,Aa.Z)("
    oe||I>ce||(Z=n.getZoom(),F=e.get("ratio"),l=!0,o=ee.clientX,s=ee.clientY)}},!1),a.addEventListener("mousemove",function(ee){if(!(!l||(0,m.isNil)(ee.clientX)||(0,m.isNil)(ee.clientY))){var se=e.get("width"),oe=e.get("height"),ce=i.style;h=parseInt(ce.left,10),p=parseInt(ce.top,10),D=parseInt(ce.width,10),I=parseInt(ce.height,10);var we=o-ee.clientX,Re=s-ee.clientY;h-we<0?we=h:h-we+D>=se&&(we=0),p-Re<0?Re=p:p-Re+I>=oe&&(Re=0),h-=we,p-=Re,(0,Kn.Z)(i,{left:"".concat(h,"px"),top:"".concat(p,"px")}),n.translate(we*Z/F,Re*Z/F),o=ee.clientX,s=ee.clientY}},!1),a.addEventListener("mouseleave",function(){l=!1,r.refresh=!0},!1),a.addEventListener("mouseup",function(){l=!1,r.refresh=!0},!1),this.set("viewport",i),a.appendChild(i)}},t.prototype.updateViewport=function(){if(!this.destroyed){var e=this.get("ratio"),r=this.get("width"),n=this.get("height"),a=this.get("graph"),i=a.get("width"),o=a.get("height"),s=i/o,l=a.getGroup(),h=l.getCanvasBBox(),p=[(h.minX+h.maxX)/2,(h.minY+h.maxY)/2],D=[h.maxX-h.minX,h.maxY-h.minY],I={centerX:p[0],centerY:p[1],width:0,height:0,minX:0,minY:0};h[0]/h[1]>s?(I.width=D[0],I.height=I.width/s):(I.height=D[1],I.width=I.height*s),I.minX=p[0]-I.width/2,I.minY=p[1]-I.height/2;var F=l.getMatrix();F||(F=[1,0,0,0,1,0,0,0,1]);var Z=mi.invert([1,0,0,0,1,0,0,0,1],F),ee=un({x:I.minX,y:I.minY},Z),se=a.getCanvasByPoint(ee.x,ee.y),oe=this.get("viewport");oe||this.initViewport();var ce=i/I.width,we=ce*r,Re=ce*n,Oe=r*-se.x/I.width,Pe=n*-se.y/I.height,He=Oe+we,at=Pe+Re;Oe<0&&(we+=Oe,Oe=0),He>r&&(we=we-(He-r)),Pe<0&&(Re+=Pe,Pe=0),at>n&&(Re=Re-(at-n)),this.set("ratio",e);var qe="".concat(Oe,"px"),yt="".concat(Pe,"px");(0,Kn.Z)(oe,{left:qe,top:yt,width:"".concat(we,"px"),height:"".concat(Re,"px")})}},t.prototype.init=function(){this.initContainer()},t.prototype.initContainer=function(){var e=this,r=e.get("graph"),n=r.get("width"),a=r.get("height"),i=a/n,o=e.get("className"),s=e.get("container"),l=e.get("width"),h=e.get("height");!l&&!h&&(l=200),l?(h=i*l,e.set("height",h)):(l=1/i*h,e.set("width",l));var p=(0,Aa.Z)("
    "));(0,m.isString)(s)&&(s=document.getElementById(s)),s?s.appendChild(p):r.get("container").appendChild(p),e.set("container",p);var D=(0,Aa.Z)('
    ');p.appendChild(D);var I=(0,Aa.Z)('');D.appendChild(I),e.set("containerDOM",D),e.set("containerSpan",I);var F=(0,Aa.Z)(''));e.set("imgDOM",F),e.updateImgSize(),I.appendChild(F),e.updateCanvas()},t.prototype.updateImgSize=function(){var e=this,r=e.get("imgDOM"),n=e.get("width"),a=e.get("height");r.onload=function(){var i=Dn(r);i[0]>i[1]?r.width=n:r.height=a}},t.prototype.updateCanvas=function(){var e=this.get("refresh");if(!!e){var r=this.get("graph");if(!r.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var n=this.get("width"),a=r.get("canvas").getCanvasBBox(),i=a.width,o=n/i;this.set("ratio",o),this.updateViewport()}}},t.prototype.getViewport=function(){return this.get("viewport")},t.prototype.getContainer=function(){return this.get("container")},t.prototype.updateGraphImg=function(e){var r=this,n=r.get("imgDOM");n.remove(),r.set("graphImg",e);var a=(0,Aa.Z)(''));r.set("imgDOM",a),a.src=e,r.updateImgSize();var i=r.get("containerSpan");i.appendChild(a),r.updateCanvas()},t.prototype.destroy=function(){var e=this.get("container");e.parentNode.removeChild(e)},t}(Qi),Sa=jn,di=function(){var c=function(e,r){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},c(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),qi=function(){return qi=Object.assign||function(c){for(var t,e=1,r=arguments.length;e(l||n.get("height"))&&a>1||p<(h||n.get("height")*.05)&&a<1)&&(a=1),p*=a,r.set("r",p),r.filter(e)}},t.prototype.filter=function(e){var r=this,n=r.get("graph"),a=n.getNodes(),i={},o=r.get("r"),s=r.get("type"),l={x:e.x,y:e.y};r.updateDelegate(l,o);var h=r.get("shouldShow"),p=r.get("vShapes");p&&p.forEach(function(se){se.remove(),se.destroy()}),p=[],a.forEach(function(se){var oe=se.getModel(),ce=oe.x,we=oe.y;Cl({x:ce,y:we},l)
    `);o.appendChild(s),this.set("container",s);var l=this.render();(0,Kn.Z)(s,this.getContainerPos(l)),this.bindEvents()},t.prototype.getContainerPos=function(e){e===void 0&&(e=[0,0]);var r=this,n=r.get("graph"),a=this.get("offsetX"),i=this.get("offsetY"),o=this.get("margin"),s=this.get("position").split("-"),l={top:0,right:1,bottom:2,left:3},h=0,p=0,D={left:(n.getWidth()-e[0])/2+h,top:(n.getHeight()-e[1])/2+p};return s.forEach(function(I){var F=o[l[I]],Z=I;switch(I){case"top":F+=p;break;case"left":F+=h;break;case"bottom":F=n.getHeight()-e[1]-F+p,Z="top";break;default:F=n.getWidth()-e[0]-F+h,Z="left";break}D[Z]=F}),D.top+=i+n.getContainer().offsetTop,D.left+=a+n.getContainer().offsetLeft,Object.keys(D).forEach(function(I){D[I]="".concat(D[I],"px")}),D},t.prototype.bindEvents=function(){var e=this,r=e.get("filter");if(!(!r||!r.enable)){var n=r.trigger||"click";xh.includes(n)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),n="click");var a=e.get("legendCanvas");n==="mouseenter"?(a.on("node-container:mouseenter",function(i){return e.filterData(i)}),a.on("node-container:mouseleave",function(i){e.clearFilter(),e.clearActiveLegend()})):(a.on("node-container:click",function(i){return e.filterData(i)}),a.on("click",function(i){i.target&&i.target.isCanvas&&i.target.isCanvas()&&(e.clearFilter(),e.clearActiveLegend())}))}},t.prototype.changeData=function(e){this.set("data",e);var r=this.render();(0,Kn.Z)(this.get("container"),this.getContainerPos(r))},t.prototype.activateLegend=function(e){var r=this.get("filter"),n=r==null?void 0:r.multiple;n||this.clearActiveLegend();var a=e.get("parent");a.get("active")?(a.set("active",!1),this.findLegendItemsByState("active").length&&a.set("inactive",!0)):(a.set("inactive",!1),a.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach(function(p){p.set("inactive",!0)}):this.clearActiveLegend();var i=(r==null?void 0:r.legendStateStyles)||{},o=(i==null?void 0:i.inactive)||{opacity:.5,"text-shape":{opacity:.5}},s=o["text-shape"]||{};this.findLegendItemsByState("inactive").forEach(function(p){var D=p.get("children"),I=D[0],F=D[1];I.attr(wi(wi({},I.get("oriAttrs")),o)),F.attr(wi(wi({},F.get("oriAttrs")),s))});var l=(i==null?void 0:i.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},h=l["text-shape"]||{};this.findLegendItemsByState("active").forEach(function(p){var D=p.get("children"),I=D[0],F=D[1];I.attr(wi(wi({},I.get("oriAttrs")),l)),F.attr(wi(wi({},F.get("oriAttrs")),h))})},t.prototype.findLegendItemsByState=function(e,r,n){r===void 0&&(r="all"),n===void 0&&(n=!0);var a=this.get("legendCanvas").find(function(s){return s.get("name")==="root"}),i=a.find(function(s){return s.get("name")==="node-group"}),o=a.find(function(s){return s.get("name")==="edge-group"});return r==="node"?i.get("children").filter(function(s){return!!s.get(e)===n}):r==="edge"?o.get("children").filter(function(s){return!!s.get(e)===n}):i.get("children").filter(function(s){return!!s.get(e)===n}).concat(o.get("children").filter(function(s){return!!s.get(e)===n}))},t.prototype.clearActiveLegend=function(){var e=this.get("legendCanvas"),r=e.find(function(a){return a.get("name")==="root"}),n=[r.find(function(a){return a.get("name")==="node-group"}),r.find(function(a){return a.get("name")==="edge-group"})];n.forEach(function(a){a.get("children").forEach(function(i){i.set("active",!1),i.set("inactive",!1);var o=i.get("children"),s=o[0],l=o[1];s.attr(s.get("oriAttrs")),l.attr(l.get("oriAttrs"))})})},t.prototype.filterData=function(e){var r=this.get("filter"),n=r==null?void 0:r.filterFunctions;if(!(!r||!n)){var a=this.get("legendCanvas"),i=this.get("graph"),o=r.graphActiveState||"active",s=r.graphInactiveState||"inactive",l=r.multiple;this.clearFilter(),l||this.clearActiveLegend(),this.activateLegend(e.target);var h=a.find(function(se){return se.get("name")==="root"}),p=h.find(function(se){return se.get("name")==="node-group"}),D=h.find(function(se){return se.get("name")==="edge-group"}),I=p.get("children").filter(function(se){return se.get("active")}),F=D.get("children").filter(function(se){return se.get("active")}),Z=0,ee=["getNodes","getEdges"];ee.forEach(function(se){i[se]().forEach(function(oe){var ce=!1,we=se==="getNodes"?I:F;we.forEach(function(Re){var Oe=n[Re.get("id")];ce=ce||Oe(oe.getModel())}),ce?(i.setItemState(oe,s,!1),i.setItemState(oe,o,!0),Z++):(i.setItemState(oe,o,!1),i.setItemState(oe,s,!0))})}),Z||ee.forEach(function(se){i[se]().forEach(function(oe){i.clearItemStates(oe,[s])})})}},t.prototype.clearFilter=function(){var e=this.get("graph"),r=this.get("filter");if(!!r){var n=r.graphActiveState||"active",a=r.graphInactiveState||"inactive";e.getNodes().forEach(function(i){e.clearItemStates(i,[n,a])}),e.getEdges().forEach(function(i){e.clearItemStates(i,[n,a])})}},t.prototype.render=function(){var e=this;this.processData();var r=this.get("legendCanvas");r?r.clear():r=new so.Canvas({container:this.get("container"),width:200,height:200});var n=r.addGroup({name:"root"}),a=n.addGroup({name:"node-group"}),i=n.addGroup({name:"edge-group"});this.set("legendCanvas",r);var o=this.get("itemsData"),s=["nodes","edges"],l=[a,i];s.forEach(function(Kt,jr){o[Kt].forEach(function(Xr){var er,mr=l[jr].addGroup({id:Xr.id,name:"node-container"}),kr,Fr=Xr.type,Jr=e.getShapeSize(Xr),fn=Jr.width,Vn=Jr.height,Tn=Jr.r,wa=e.getStyle(Kt.substr(0,4),Xr);switch(Xr.type){case"circle":kr={r:Tn,x:0,y:0};break;case"rect":kr={width:fn,height:Vn,x:-fn/2,y:-Vn/2};break;case"ellipse":kr={rx:fn,ry:Vn,x:0,y:0},Fr="ellipse";break;case"line":kr={x1:-fn/2,y1:0,x2:fn/2,y2:0},Fr="line";break;case"quadratic":kr={path:[["M",-fn/2,0],["Q",0,fn/2,fn/2,0]]},Fr="path";break;case"cubic":kr={path:[["M",-fn/2,0],["C",-fn/6,fn/2,fn/6,-fn/2,fn/2,0]]},Fr="path";break;case"diamond":kr={path:[["M",0,-Vn],["L",fn,0],["L",0,Vn],["L",-fn,0],["Z"]]},Fr="path";break;case"triangle":kr={path:[["M",-fn,Vn],["L",0,-Vn],["L",fn,Vn],["Z"]]},Fr="path";break;case"star":kr={path:ki.getStarPath(Tn*3,Tn*1.2)},Fr="path";break;default:kr={r:Tn,x:0,y:0};break}var ua=mr.addShape(Fr,{attrs:wi(wi({},kr),wa),name:"".concat(Xr.type,"-node-keyShape"),oriAttrs:wi({opacity:1},wa)});if(Xr.label){var fa=ua.getBBox(),Ma=((er=Xr.labelCfg)===null||er===void 0?void 0:er.style)||{},ja=wi({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},Ma);mr.addShape("text",{attrs:wi({x:fa.maxX+4,y:0,text:Xr.label},ja),className:"legend-label",name:"".concat(Xr.type,"-node-text"),oriAttrs:ja})}})});var h=this.get("padding"),p,D=n.find(function(Kt){return Kt.get("name")==="title-container"}),I={height:0,maxY:0,width:0};if(this.get("title")){D||(D=n.addGroup({name:"title-container"}));var F={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:h[0]},Z=this.get("titleConfig")||{},ee=Object.assign(F,Z.style||{});p=D.addShape("text",{attrs:wi({text:this.get("title")},ee)}),I=D.getCanvasBBox(),D.setMatrix([1,0,0,0,1,0,Z.offsetX,Z.offsetY,1])}this.layoutItems();var se=n.getCanvasBBox(),oe=a.getCanvasBBox(),ce=oe.minX<0?Math.abs(oe.minX)+h[3]:h[3],we=I.maxYp.max&&(p.max=o[0]),yt>D&&(D=yt),we.setMatrix([1,0,0,0,1,0,Ft,yr,1])});var I=p.max-p.min,F={min:0,max:-Infinity},Z=l.getCanvasBBox();o[0]=0,o[1]=a==="vertical"?Z.maxX+r:Z.maxY+n,h.get("children").forEach(function(we,Re){Re===0&&(F.min=o[0]);var Oe=we.get("children")[0],Pe=we.getCanvasBBox(),He=Oe.getBBox(),at=He.width,qe=He.height,yt=0,Ft=0;a==="vertical"?(yt=o[1],Ft=o[0],o[0]=Ft+Pe.height+n,we.setMatrix([1,0,0,0,1,0,0,Ft+qe/2,1])):(yt=o[0],Ft=o[1],o[0]=yt+Pe.width+r,we.setMatrix([1,0,0,0,1,0,yt+at/2,0,1])),o[0]>F.max&&(F.max=o[0])});var ee=F.max-F.min;if(i&&i!==""&&i!=="left"){var se=I-ee,oe=i==="center"?Math.abs(se)/2:Math.abs(se),ce=se<0?l:h;ce.get("children").forEach(function(we){var Re=we.getMatrix()||[1,0,0,0,1,0,0,0,1];a==="vertical"?Re[7]+=oe:Re[6]+=oe,we.setMatrix(Re)})}},t.prototype.processData=function(){var e=this.get("data"),r={nodes:[],edges:[]};e.nodes&&(e.nodes.sort(function(n,a){return n.order-a.order}),e.nodes.forEach(function(n){var a,i,o,s,l,h=n.size||[((a=n.style)===null||a===void 0?void 0:a.width)||((i=n.style)===null||i===void 0?void 0:i.r)||8,((o=n.style)===null||o===void 0?void 0:o.height)||((s=n.style)===null||s===void 0?void 0:s.r)||8],p=((l=n.labelCfg)===null||l===void 0?void 0:l.style)||{};r.nodes.push({id:n.id||(0,m.uniqueId)(),type:n.type||"circle",style:wi({},n.style),order:n.order,label:n.label,itemType:"node",size:h,labelCfg:{position:"right",style:wi({fontFamily:"Arial"},p)}})})),e.edges&&(e.edges.sort(function(n,a){return n.order-a.order}),e.edges.forEach(function(n){var a,i,o=n.type||"line";n.type==="cubic-horizontal"&&(o="cubic");var s=((a=n.labelCfg)===null||a===void 0?void 0:a.style)||{},l=n.size||[((i=n.style)===null||i===void 0?void 0:i.width)||8,1];r.edges.push({id:n.id||(0,m.uniqueId)(),type:o,size:l,style:wi({lineWidth:(0,m.isArray)(l)?l[1]:1},n.style),order:n.order,label:n.label,itemType:"edge",labelCfg:{position:"right",style:wi({fontFamily:"Arial"},s)}})})),this.set("itemsData",r)},t.prototype.getContainer=function(){return this.get("container")},t.prototype.formatArray=function(e){var r=this.get(e);if((0,m.isNumber)(r))this.set(e,[r,r,r,r]);else if((0,m.isArray)(r))switch(r.length){case 0:this.set(e,[0,0,0,0]);break;case 1:this.set(e,[r[0],r[0],r[0],r[0]]);break;case 2:this.set(e,[r[0],r[1],r[0],r[1]]);break;case 3:this.set(e,[r[0],r[1],r[2],r[1]]);break;default:break}return this.get(e)},t.prototype.getShapeSize=function(e){var r,n,a;return e.size&&((0,m.isArray)(e.size)?(r=e.size[0],n=e.size[1]||e.size[0],a=e.size[0]/2):(0,m.isNumber)(e.size)&&(r=e.size,n=e.size,a=e.size/2)),e.style&&(e.style.width&&(r=e.style.width),e.style.height&&(n=e.style.height),e.style.r&&(a=e.style.r)),a||(a=5),r||(r=a),n||(n=a),{width:r,height:n,r:a}},t.prototype.getStyle=function(e,r){var n=e==="node"?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1};return wi(wi({},n),r.style||{})},t.prototype.destroy=function(){var e=this.get("legendCanvas");e==null||e.destroy();var r=this.get("graph"),n=r.get("container"),a=this.get("container");n.removeChild(a)},t}(Qi),Sh=wh,_h=function(){var c=function(e,r){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},c(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),xs=function(){return xs=Object.assign||function(c){for(var t,e=1,r=arguments.length;e+

    ":"

    -

    ",D=r?"":"

    ".concat(s,"

    "),I="

    x

    ",F=r?"".concat(h,"px"):"".concat(h,"px ").concat(h,"px 0 0");return'

    `).concat(i,`

    `).concat(p,` `).concat(I,`
    `).concat(D,`
    `)}},t.prototype.init=function(){var e=this;if(!e.destroyed){var r=e.get("graph"),n=r.getContainer(),a=e.get("container"),i=this.get("containerCfg");i?(a=this.createContainer(),n.appendChild(a)):a=n,this.set("container",a);var o=n.getBoundingClientRect(),s=new so.Canvas({container:n,width:o.right-o.left,height:o.bottom-o.top});(0,Kn.Z)(s.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",(0,m.debounce)(function(){return e.resizeCanvas(e)},100));var l=s.addGroup({id:"annotation-link-group"});e.set("linkGroup",l),e.set("canvas",s),e.get("getTitle")||e.set("getTitle",function(p){var D,I=((D=p==null?void 0:p.getModel)===null||D===void 0?void 0:D.call(p))||{},F=I.label,Z=I.id;return F||Z||"-"}),e.get("getContent")||e.set("getContent",function(p){var D,I;if(!p)return"-";var F=((D=p.getModel)===null||D===void 0?void 0:D.call(p))||{},Z=F.label,ee=F.id,se=(I=p.getType)===null||I===void 0?void 0:I.call(p),oe=se?"".concat(se,": "):"";return"".concat(oe).concat(Z||ee||"")});var h=e.get("defaultData");h&&this.readData(h)}},t.prototype.createContainer=function(){var e=this;if(!this.destroyed){var r=this.get("containerCfg"),n=this.get("graph"),a=n.getContainer(),i=a.getBoundingClientRect(),o=i.left,s=i.right,l=i.top,h=i.bottom,p=h-l,D=s-o,I=r.position,F=I===void 0?"top":I,Z=r.offsetX,ee=Z===void 0?0:Z,se=r.offsetY,oe=se===void 0?0:se,ce=vd(r,["position","offsetX","offsetY"]),we=r.height,Re=we===void 0?"fit-content":we,Oe=r.width,Pe=Oe===void 0?n.getWidth():Oe;Re==="100%"&&(Re=p),Pe==="100%"&&(Pe=D);var He="unset",at="unset",qe={};switch(F){case"right":He="".concat(p,"px"),qe={top:0,right:0},qe.right+=o+ee,qe.top+=l+oe;break;case"bottom":at="".concat(D,"px"),qe={bottom:0,left:0},qe.left+=o+ee,qe.bottom+=l+oe;break;case"top":at="".concat(D,"px");case"left":He="".concat(p,"px");default:qe={top:0,left:0},qe.left+=o+ee,qe.top+=l+oe;break}Object.keys(qe).forEach(function(Ft){qe[Ft]="".concat(qe[Ft],"px")});var yt=(0,Aa.Z)("
    "));return(0,Kn.Z)(yt,xs(xs({position:"absolute",display:F==="top"||F==="bottom"?"inline-flex":"unset",width:(0,m.isNumber)(Pe)?"".concat(Pe,"px"):Pe,height:(0,m.isNumber)(Re)?"".concat(Re,"px"):Re,maxHeight:He,maxWidth:at,overflow:"scroll"},qe),ce)),a.appendChild(yt),yt.addEventListener("scroll",function(Ft){e.updateLinks()}),yt}},t.prototype.resizeCanvas=function(e){clearTimeout(e.resizeTimer),e.resizeTimer=setTimeout(function(){if(!(!e||e.destroyed)){var r=e.get("container").getBoundingClientRect(),n=r.right-r.left,a=r.bottom-r.top;e.get("canvas").changeSize(n,a),e.updateOutsideCards(e)}},250)},t.prototype.updateOutsideCards=function(e){var r=e||this,n=r.get("cardInfoMap")||{},a=r.get("graph"),i=a.getPointByCanvas(0,0),o=a.getPointByCanvas(a.getWidth(),a.getHeight()),s=a.getClientByPoint(i.x,i.y),l=s.x,h=s.y,p=a.getClientByPoint(o.x,o.y),D=p.x,I=p.y;Object.values(n).forEach(function(F){var Z=F.card;if(!!Z){var ee=Z.style,se=oc(ee.left),oe=oc(ee.top),ce=Z.getBoundingClientRect(),we=ce.width,Re=ce.height,Oe=se,Pe=oe;se+we>D-l&&(Oe=D-l-we),se<0&&(Oe=0),oe+Re>I-h&&(Pe=I-h-Re),oe<0&&(Pe=0),(0,Kn.Z)(Z,{left:"".concat(Oe,"px"),top:"".concat(Pe,"px")})}}),r.updateLinks()},t.prototype.showAnnotation=function(e){if(!this.destroyed){var r=e.item;this.toggleAnnotation(r)}},t.prototype.hideCards=function(){var e=this;if(!e.destroyed){var r=e.get("cardInfoMap")||{};Object.keys(r).forEach(function(n){e.hideCard(n)})}},t.prototype.toggleAnnotation=function(e,r){var n,a;r===void 0&&(r={});var i=this;if(!i.destroyed){var o=i.get("cardInfoMap")||{},s=i.get("graph"),l=i.get("container"),h=i.get("containerCfg"),p=Object.assign({},i.get("cardCfg")||{},r),D=p.minHeight,I=p.minWidth,F=p.width,Z=p.height,ee=p.collapsed,se=ee===void 0?!1:ee,oe=p.x,ce=p.y,we=p.title,Re=p.content,Oe=p.maxTitleLength,Pe=p.defaultBegin,He=vd(p,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),at=i.get("linkGroup"),qe=this.get("rows")||[[]],yt=(n=e.isCanvas)===null||n===void 0?void 0:n.call(e),Ft=yt?gd:e.getID(),yr=o[Ft]||{},fr=yr.card,lr=yr.link,Kt=yr.x,jr=yr.y,Xr=yr.title,er=yr.content,mr=this.get("getTitle"),kr=this.get("getContent"),Fr=this.get("getContentPlaceholder")||function(){return""},Jr=this.get("getTitlePlaceHolder")||function(){return""},fn=Fr(e),Vn=Jr(e),Tn=(0,Aa.Z)(this.getDOMContent(xs({itemId:Ft,collapsed:se,title:((a=Xr||we||(mr==null?void 0:mr(e)))===null||a===void 0?void 0:a.substr(0,Oe))||Vn,content:er||Re||(kr==null?void 0:kr(e))||fn},He))),wa=(0,m.isNumber)(D)?"".concat(D,"px"):D;(0,Kn.Z)(Tn,{minHeight:se?"unset":wa,minWidth:(0,m.isNumber)(I)?"".concat(I,"px"):I,height:Z,width:F});var ua=!!fr;ua?(lr==null||lr.remove(!0),l.replaceChild(Tn,fr)):l.appendChild(Tn);var fa;if(!h){if(fa=l.getBoundingClientRect()||{},oe!==void 0&&ce!==void 0)Kt=oe,jr=ce;else if(!ua&&!yt){var Ma=fa.top,ja=Pe||{},Ra=ja.left,uo=ja.right,Da=uo===void 0?16:uo,fo=ja.top,Qa=fo===void 0?8:fo,Ja=ja.bottom,oi=Da,Si=Qa;isNaN(Ra)||(oi=l.scrollWidth-Ra),isNaN(Ja)||(Si=l.scrollHeight-Ja);var Ai=(0,m.isNumber)(I)?I:100;Kt=l.scrollWidth-Tn.scrollWidth-(qe.length-1)*Ai-oi;var la=qe[qe.length-1],Ca=(la[la.length-1]||{}).bbox;jr=(Ca==null?void 0:Ca.bottom)-Ma||Si}(0,Kn.Z)(Tn,{position:"absolute",left:"".concat(Kt,"px"),top:"".concat(jr,"px"),cusor:h?"unset":"move"})}this.bindListener(Tn,Ft);var Xn=Tn.getBoundingClientRect();if(!yt){var Ta=ql(e,Xn,s,this.get("canvas")),Na=this.get("linkStyle");lr=at.addShape("path",{attrs:xs({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:Ta},Na)})}if(o[Ft]=xs(xs({},o[Ft]||{}),{id:Ft,collapsed:se,card:Tn,link:lr,x:Kt,y:jr,cardBBox:Xn,content:er||Re,title:Xr||we,contentPlaceholder:fn,titlePlaceholder:Vn,isCanvas:yt}),i.set("cardInfoMap",o),h)this.updateCardPositionsInConatainer(),this.updateLinks();else{var cn=!isNaN(oe)&&!isNaN(ce);if(!ua&&!yt&&!cn){var pa=fa.bottom,ma=pa===void 0?0:pa,Ma=fa.top;qe[qe.length-1].push({id:Ft,bbox:Xn}),Xn.top>ma-Ma-Xn.height-16&&qe.push([]),this.set("rows",qe)}}this.updateCardSize(Ft);var Ua=this.get("onAnnotationChange");Ua==null||Ua(o[Ft],ua?"update":"create")}},t.prototype.updateCardPositionsInConatainer=function(){if(!this.destroyed){var e=this.get("cardInfoMap");if(!!e){var r=this.get("container"),n=this.get("containerCfg").position,a=r.getBoundingClientRect().width,i=getComputedStyle(r),o=oc(i.paddingLeft)+oc(i.paddingRight);a-=o,Object.values(e).forEach(function(s){var l=s.card,h=l.getBoundingClientRect().width;switch(n){case"right":(0,Kn.Z)(l,{marginLeft:a?"".concat(a-h,"px"):"0px"});break;case"top":case"bottom":(0,Kn.Z)(l,{marginLeft:"8px"});default:break}})}}},t.prototype.handleExpandCollapseCard=function(e){if(!this.destroyed){var r=this.get("graph"),n=this.get("cardInfoMap");if(!!n){var a=n[e].collapsed,i=r.findById(e);if(!!i){var o=this.get("cardCfg").collapseType;o==="hide"&&!a?this.hideCard(e):this.toggleAnnotation(i,{collapsed:!a}),n[e]=xs(xs({},n[e]),{collapsed:!a})}}}},t.prototype.hideCard=function(e){if(!this.destroyed){var r=this.get("cardInfoMap");if(!(!r||!r[e])){var n=r[e],a=n.card,i=n.link;(0,Kn.Z)(a,{display:"none"}),i==null||i.hide();var o=this.get("onAnnotationChange");o(r[e],"hide")}}},t.prototype.removeCard=function(e){if(!this.destroyed){var r=this.get("cardInfoMap");if(!!r){var n=r[e],a=n.card,i=n.link,o=this.get("container");o.removeChild(a),i==null||i.remove(!0),delete r[e];var s=this.get("onAnnotationChange");s(n,"remove")}}},t.prototype.bindListener=function(e,r){var n=this;if(!this.destroyed){e.addEventListener("mousemove",function(s){var l;if(s.target.className==="g6-annotation-collapse"?l="collapse":s.target.className==="g6-annotation-expand"?l="expand":s.target.className==="g6-annotation-close"&&(l="close"),l){var h=n.get("cardCfg").onMouseEnterIcon,p=h===void 0?function(){}:h;p(s,r,l)}}),e.addEventListener("mouseout",function(s){var l;if(s.target.className==="g6-annotation-collapse"?l="collapse":s.target.className==="g6-annotation-expand"?l="expand":s.target.className==="g6-annotation-close"&&(l="close"),l){var h=n.get("cardCfg").onMouseLeaveIcon,p=h===void 0?function(){}:h;p(s,r,l)}}),e.addEventListener("mouseenter",function(s){var l=n.get("cardInfoMap");if(!!l){var h=n.get("graph"),p=h.findById(r);if(p){var D=n.get("itemHighlightState");h.setItemState(p,D,!0)}var I=l[r].link;if(I){var F=n.get("linkHighlightStyle")||{};I.attr(F)}}}),e.addEventListener("mouseleave",function(s){var l=n.get("cardInfoMap");if(!!l){var h=n.get("graph"),p=h.findById(r);if(p){var D=n.get("itemHighlightState");h.setItemState(p,D,!1)}var I=l[r].link;if(I){var F=n.get("linkHighlightStyle")||{};Object.keys(F).forEach(function(ee){I.attr(ee,void 0),I.attr(ee,void 0)});var Z=n.get("linkStyle");I.attr(Z)}}}),e.addEventListener("click",function(s){var l=(n.get("cardCfg")||{}).onClickIcon;if(s.target.className==="g6-annotation-collapse"||s.target.className==="g6-annotation-expand"){var h=n.get("cardCfg").collapseType;h==="hide"?n.hideCard(r):n.handleExpandCollapseCard(r),l==null||l(s,r,s.target.className==="g6-annotation-collapse"?"collapse":"expand")}else if(s.target.className==="g6-annotation-close"){var p=n.get("cardCfg").closeType;p==="remove"?n.removeCard(r):n.hideCard(r),l==null||l(s,r,"close")}});var a=this.get("editable");a&&e.addEventListener("dblclick",function(s){var l=n.get("cardInfoMap"),h=(n.get("cardCfg")||{}).maxTitleLength,p=h===void 0?20:h;if(!!l){var D=s.target,I=D.className;if(!(I!=="g6-annotation-title"&&I!=="g6-annotation-content")){var F=I==="g6-annotation-title"?D.getBoundingClientRect():D.parentNode.getBoundingClientRect(),Z=F.width,ee=F.height,se=getComputedStyle(D),oe=I==="g6-annotation-title"?"input":"textarea",ce=(0,Aa.Z)("<".concat(oe,' class="').concat(I,'-input" type="textarea" style="width:').concat(Z,"px; height: ").concat(ee,'px; min-width: 16px;"/>')),we=(0,Aa.Z)('
    '));we.appendChild(ce),D.parentNode.replaceChild(we,D);var Re=l[r],Oe=Re.contentPlaceholder,Pe=Re.titlePlaceholder,He=Re.content,at=Re.title,qe=He;I==="g6-annotation-title"?(ce.name="title",ce.maxLength=p,qe=at):ce.name="content",qe?(ce.innerHTML=D.innerHTML,ce.value=D.innerHTML):ce.placeholder=I==="g6-annotation-title"?Pe:Oe,ce.focus(),ce.addEventListener("blur",function(yt){ce.value&&(D.innerHTML=ce.value,Re[ce.name||"title"]=ce.value),we.parentNode.replaceChild(D,we),n.updateCardSize(r);var Ft=n.get("onAnnotationChange");Ft==null||Ft(Re,"update")})}}});var i=["g6-annotation-title","g6-annotation-content","g6-annotation-title-input","g6-annotation-content-input"];e.draggable=!0,e.addEventListener("dragstart",function(s){var l=s.target.className;if(!i.includes(l)){var h=e.style;n.set("dragging",{card:e,x:s.clientX,y:s.clientY,left:oc(h.left),top:oc(h.top)})}}),e.addEventListener("drag",function(s){s.preventDefault();var l=n.get("cardInfoMap");if(!!l){var h=s.clientX,p=s.clientY,D=n.get("dragging");if(!(isNaN(h)||isNaN(p)||!D)){var I=D.x,F=D.y,Z=D.left,ee=D.top,se=D.card,oe=h-I,ce=p-F;Z+=oe,ee+=ce;var we=n.get("graph"),Re=we.getPointByCanvas(0,0),Oe=we.getPointByCanvas(we.getWidth(),we.getHeight()),Pe=we.getClientByPoint(Re.x,Re.y),He=Pe.x,at=Pe.y,qe=we.getClientByPoint(Oe.x,Oe.y),yt=qe.x,Ft=qe.y,yr=se.getBoundingClientRect(),fr=yr.right-yr.left,lr=yr.bottom-yr.top;(Z>yt-He-fr&&oe>0||Z<0&&oe<0)&&(Z-=oe),(ee>Ft-at-lr&&ce>0||ee<0&&ce<0)&&(ee-=ce),(0,Kn.Z)(se,{left:"".concat(Z,"px"),top:"".concat(ee,"px"),visibility:"hidden"}),I=h,F=p;var Kt=(l[r]||{}).link;if(Kt){var jr=we.findById(r);Kt.attr("path",ql(jr,yr,we,n.get("canvas")))}n.set("dragging",{x:I,y:F,left:Z,top:ee,card:se})}}});var o=function(l){var h=n.get("cardInfoMap");if(!!h){var p=n.get("dragging");if(p){var D=p.left,I=p.top,F=p.card;h[r].x=D,h[r].y=I,(0,Kn.Z)(F,{visibility:"visible"}),n.set("dragging",!1);var Z=n.get("rows");Z==null||Z.forEach(function(se){for(var oe=se.length-1;oe>=0;oe--)se[oe].id===r&&se.splice(oe,1)});var ee=n.get("onAnnotationChange");ee==null||ee(h[r],"update")}}};e.addEventListener("dragend",o)}},t.prototype.updateCardSize=function(e){var r=this.get("cardInfoMap");if(!!r){var n=r[e].card,a=n.getBoundingClientRect().width,i=n.getElementsByClassName("g6-annotation-title")[0];if(i){var o=getComputedStyle(i),s=oc(o.marginLeft),l=i.getBoundingClientRect().width;(0,Kn.Z)(i,{marginRight:"".concat(a-s-24-16-l,"px")})}}},t.prototype.updateLink=function(e){var r=e.item;if(!!r){var n=this.get("cardInfoMap");if(!!n){var a=this.get("canvas"),i=this.get("graph"),o=r.getID(),s=n[o]||{},l=s.link,h=s.card;if(l){var p=ql(r,h.getBoundingClientRect(),i,a);l.attr("path",p)}}}},t.prototype.updateLinks=function(){var e=this;if(!this.destroyed){var r=this.get("cardInfoMap");if(!!r){var n=this.get("graph");Object.values(r).forEach(function(a){var i=a.id,o=n.findById(i);e.updateLink({item:o})})}}},t.prototype.onGraphDataChange=function(){var e=this,r=this.get("cardInfoMap");if(!!r){var n=this.get("graph");Object.values(r).forEach(function(a){var i=a.id,o=a.card,s=a.isCanvas;if(!(!o||s||o.style.display==="none")){var l=n.findById(i);l&&l.isVisible()?e.toggleAnnotation(l):e.hideCard(i)}})}},t.prototype.onGraphItemVisibilityChange=function(e){var r=e.item,n=e.visible;if(!(!r||r.destroyed)){var a=this.get("cardInfoMap");if(!!a){var i=r.getID();!a[i]||n||this.hideCard(i)}}},t.prototype.saveData=function(e){e===void 0&&(e=!1);var r=this.get("cardInfoMap");if(!!r){var n=this.get("graph"),a=this.get("getTitle"),i=this.get("getContent"),o=[];return Object.values(r).forEach(function(s){var l=s.title,h=s.content,p=s.x,D=s.y,I=s.id,F=s.collapsed,Z=s.card;if(!(Z&&Z.style.display==="none"&&!e)){var ee=n.findById(I)||n.get("canvas");o.push({id:I,x:p,y:D,collapsed:F,title:l||(a==null?void 0:a(ee)),content:h||(i==null?void 0:i(ee)),visible:Z&&Z.style.display!=="none"})}}),o}},t.prototype.readData=function(e){var r=this,n=this.get("graph");e.forEach(function(a){var i=a.id,o=a.x,s=a.y,l=a.title,h=a.content,p=a.collapsed,D=a.visible,I=n.findById(i);if(!I&&i===gd&&(I=n.get("canvas")),!I){var F=r.get("cardInfoMap")||{};F[i]=a,r.set("cardInfoMap",F);return}r.toggleAnnotation(I,{x:o,y:s,title:l,content:h,collapsed:p}),D||r.hideCard(i)})},t.prototype.clear=function(){var e=this.get("cardInfoMap");if(!!e){var r=this.get("container");Object.values(e).forEach(function(n){var a=n.card,i=n.link;r.removeChild(a),i==null||i.remove(!0)}),this.set("cardInfoMap",{})}},t.prototype.destroy=function(){var e;this.clear(),(e=this.get("canvas"))===null||e===void 0||e.destroy();var r=this.get("graph");!r||r.destroyed||(this.get("containerCfg")&&r.getContainer().removeChild(this.get("container")),this.destroyed=!0)},t}(Qi),Ch=Mh,Th=function(t,e){var r,n,a,i=Infinity;Object.keys(t).forEach(function(l){var h=t[l];Object.keys(e).forEach(function(p){var D=e[p],I=h.x-D.x,F=h.y-D.y,Z=I*I+F*F;i>Z&&(i=Z,r=h,n=D,a=[l,p])})});var o=20,s=ki.getControlPoint(r,n,.5,o);return[["M",r.x,r.y],["Q",s.x,s.y,n.x,n.y]]},ql=function(t,e,r,n){var a,i,o=t.getType();if(o==="edge")i=[t.getKeyShape().getPoint(.5)];else{var s=(a=t.getKeyShape)===null||a===void 0?void 0:a.call(t).getBBox(),l=s.minX,h=s.minY,p=s.maxX,D=s.maxY,I=t.getModel(),F=I.x,Z=I.y;l+=F,h+=Z,p+=F,D+=Z,i={left:{x:l,y:(h+D)/2},right:{x:p,y:(h+D)/2},top:{x:(l+p)/2,y:h},bottom:{x:(l+p)/2,y:D}}}Object.keys(i).forEach(function(at){var qe=i[at],yt=qe.x,Ft=qe.y,yr=r.getClientByPoint(yt,Ft);i[at]=n.getPointByClient(yr.x,yr.y)});var ee=e.top,se=ee===void 0?0:ee,oe=e.left,ce=oe===void 0?0:oe,we=e.right,Re=we===void 0?0:we,Oe=e.bottom,Pe=Oe===void 0?0:Oe,He={left:n.getPointByClient(ce,(se+Pe)/2),right:n.getPointByClient(Re,(se+Pe)/2),top:n.getPointByClient((ce+Re)/2,se),bottom:n.getPointByClient((ce+Re)/2,Pe)};return Th(i,He)},oc=function(t){return Number(t.replace(/\s+|px/gi,""))||0},Ih={PluginBase:Qi,Menu:Es,Grid:jc,Minimap:bl,Bundling:Sl,ToolBar:ve,Tooltip:Zt,Fisheye:Zc,TimeBar:yn,ImageMinimap:Sa,EdgeFilterLens:kl,SnapLine:Eh,Legend:Sh,Annotation:Ch},Oh=Ih,Vi=Oh;To("circle",{options:{size:Kr.defaultNode.size,style:{x:0,y:0,stroke:Kr.defaultNode.style.stroke,fill:Kr.defaultNode.style.fill,lineWidth:Kr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Kr.nodeLabel.style.fill,fontSize:Kr.nodeLabel.style.fontSize,fontFamily:Kr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Kr.defaultNode.linkPoints.size,lineWidth:Kr.defaultNode.linkPoints.lineWidth,fill:Kr.defaultNode.linkPoints.fill,stroke:Kr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,b.__assign)({},Kr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=(0,m.deepMix)({},n,t.icon),o="".concat(this.type,"-keyShape"),s=e.addShape("circle",{attrs:a,className:o,name:o,draggable:!0});e.shapeMap[o]=s;var l=i.width,h=i.height,p=i.show,D=i.text;if(p){var I="".concat(this.type,"-icon");D?e.shapeMap[I]=e.addShape("text",{attrs:(0,b.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:I,name:I,draggable:!0}):e.shapeMap[I]=e.addShape("image",{attrs:(0,b.__assign)({x:-l/2,y:-h/2},i),className:I,name:I,draggable:!0})}return this.drawLinkPoints(t,e),s},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints;if(!!r){var n=r||{},a=n.top,i=n.left,o=n.right,s=n.bottom,l=n.size,h=n.r,p=(0,b.__rest)(n,["top","left","right","bottom","size","r"]),D=this.getSize(t),I=D[0]/2;if(i){var F="link-point-left";e.shapeMap[F]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:-I,y:0,r:l/2||h||5}),className:F,name:F,isAnchorPoint:!0})}if(o){var Z="link-point-right";e.shapeMap[Z]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:I,y:0,r:l/2||h||5}),className:Z,name:Z,isAnchorPoint:!0})}if(a){var ee="link-point-top";e.shapeMap[ee]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:-I,r:l/2||h||5}),className:ee,name:ee,isAnchorPoint:!0})}if(s){var se="link-point-bottom";e.shapeMap[se]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:I,r:l/2||h||5}),className:se,name:se,isAnchorPoint:!0})}}},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,m.deepMix)({},e,r),a=this.getSize(t),i=a[0]/2,o=(0,b.__assign)({x:0,y:0,r:i},n);return o},update:function(t,e,r){var n=e.getContainer(),a=this.getSize(t),i=(0,b.__assign)({},t.style);t.style.stroke===void 0&&t.color&&(i.stroke=t.color),t.style.r===void 0&&!isNaN(a[0])&&(i.r=a[0]/2),this.updateShape(t,e,i,!0,r),this.updateLinkPoints(t,n)}},"single-node"),To("rect",{options:{size:[100,30],style:{radius:0,stroke:Kr.defaultNode.style.stroke,fill:Kr.defaultNode.style.fill,lineWidth:Kr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Kr.nodeLabel.style.fill,fontSize:Kr.nodeLabel.style.fontSize,fontFamily:Kr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Kr.defaultNode.linkPoints.size,lineWidth:Kr.defaultNode.linkPoints.lineWidth,fill:Kr.defaultNode.linkPoints.fill,stroke:Kr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},anchorPoints:[[0,.5],[1,.5]],stateStyles:(0,b.__assign)({},Kr.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(t,e){var r=this.getShapeStyle(t),n=e.addShape("rect",{attrs:r,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return e.shapeMap["".concat(this.type,"-keyShape")]=n,this.drawLinkPoints(t,e),n},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,s=n.bottom,l=n.size,h=n.r,p=(0,b.__rest)(n,["top","left","right","bottom","size","r"]),D=this.getSize(t),I=D[0],F=D[1];i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:-I/2,y:0,r:l/2||h||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:I/2,y:0,r:l/2||h||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:-F/2,r:l/2||h||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:F/2,r:l/2||h||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,m.mix)({},e,r),a=this.getSize(t),i=n.width||a[0],o=n.height||a[1],s=(0,b.__assign)({x:-i/2,y:-o/2,width:i,height:o},n);return s},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getSize(t),o=e.get("keyShape");t.size||(i[0]=o.attr("width")||a.width,i[1]=o.attr("height")||a.height);var s={stroke:t.color,x:-i[0]/2,y:-i[1]/2,width:i[0],height:i[1]},l=(0,m.mix)({},a,o.attr(),s);l=(0,m.mix)(l,t.style),this.updateShape(t,e,l,!1,r),this.updateLinkPoints(t,n)}},"single-node"),To("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:Kr.defaultNode.style.stroke,fill:Kr.defaultNode.style.fill,lineWidth:Kr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Kr.nodeLabel.style.fill,fontSize:Kr.nodeLabel.style.fontSize,fontFamily:Kr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Kr.defaultNode.linkPoints.size,lineWidth:Kr.defaultNode.linkPoints.lineWidth,fill:Kr.defaultNode.linkPoints.fill,stroke:Kr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,b.__assign)({},Kr.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=e.addShape("ellipse",{attrs:a,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});e.shapeMap["ellipse-keyShape"]=i;var o=n.width,s=n.height,l=n.show,h=n.text;return l&&(h?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,b.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,b.__assign)({x:-o/2,y:-s/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,s=n.bottom,l=n.size,h=n.r,p=(0,b.__rest)(n,["top","left","right","bottom","size","r"]),D=this.getSize(t),I=D[0]/2,F=D[1]/2;i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:-I,y:0,r:l/2||h||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:I,y:0,r:l/2||h||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:-F,r:l/2||h||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:F,r:l/2||h||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,m.mix)({},e,r),a=this.getSize(t),i=a[0]/2,o=a[1]/2,s=(0,b.__assign)({x:0,y:0,rx:i,ry:o},n);return s},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getSize(t),o={stroke:t.color,rx:i[0]/2,ry:i[1]/2},s=e.get("keyShape"),l=(0,m.mix)({},a,s.attr(),o);l=(0,m.mix)(l,t.style),this.updateShape(t,e,l,!0,r),this.updateLinkPoints(t,n)}},"single-node"),To("diamond",{options:{size:[80,80],style:{stroke:Kr.defaultNode.style.stroke,fill:Kr.defaultNode.style.fill,lineWidth:Kr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Kr.nodeLabel.style.fill,fontSize:Kr.nodeLabel.style.fontSize,fontFamily:Kr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Kr.defaultNode.linkPoints.size,lineWidth:Kr.defaultNode.linkPoints.lineWidth,fill:Kr.defaultNode.linkPoints.fill,stroke:Kr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,b.__assign)({},Kr.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=i;var o=n.width,s=n.height,l=n.show,h=n.text;return l&&(h?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,b.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,b.__assign)({x:-o/2,y:-s/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,s=n.bottom,l=n.size,h=n.r,p=(0,b.__rest)(n,["top","left","right","bottom","size","r"]),D=this.getSize(t),I=D[0],F=D[1];i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:-I/2,y:0,r:l/2||h||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:I/2,y:0,r:l/2||h||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:-F/2,r:l/2||h||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:F/2,r:l/2||h||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(t){var e=this.getSize(t),r=e[0],n=e[1],a=[["M",0,-n/2],["L",r/2,0],["L",0,n/2],["L",-r/2,0],["Z"]];return a},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,m.mix)({},e,r),a=this.getPath(t),i=(0,b.__assign)({path:a},n);return i},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getPath(t),o={stroke:t.color,path:i},s=e.get("keyShape"),l=(0,m.mix)({},a,s.attr(),o);l=(0,m.mix)(l,t.style),this.updateShape(t,e,l,!0,r),this.updateLinkPoints(t,n)}},"single-node"),To("triangle",{options:{size:40,direction:"up",style:{stroke:Kr.defaultNode.style.stroke,fill:Kr.defaultNode.style.fill,lineWidth:Kr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Kr.nodeLabel.style.fill,fontSize:Kr.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Kr.defaultNode.linkPoints.size,lineWidth:Kr.defaultNode.linkPoints.lineWidth,fill:Kr.defaultNode.linkPoints.fill,stroke:Kr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20,offset:6},stateStyles:(0,b.__assign)({},Kr.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.icon,a=n===void 0?{}:n,i=r.direction,o=this.getShapeStyle(t),s=t.direction||i,l=e.addShape("path",{attrs:o,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=l;var h=a.width,p=a.height,D=a.show,I=a.offset,F=a.text;if(D)if(F)e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,b.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var Z=-h/2,ee=-p/2;(s==="up"||s==="down")&&(ee+=I),(s==="left"||s==="right")&&(Z+=I),e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,b.__assign)({x:Z,y:ee},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(t,e),l},drawLinkPoints:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.linkPoints,a=n===void 0?{}:n,i=r.direction,o=t.direction||i,s=a.top,l=a.left,h=a.right,p=a.bottom,D=a.size,I=a.r,F=(0,b.__rest)(a,["top","left","right","bottom","size","r"]),Z=this.getSize(t),ee=Z[0];if(l){var se=null,oe=ee*Math.sin(1/3*Math.PI),ce=ee*Math.sin(1/3*Math.PI);o==="up"?se=[-ce,oe]:o==="down"?se=[-ce,-oe]:o==="left"&&(se=[-ce,ce-oe]),se&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},F),{x:se[0],y:se[1],r:D/2||I||5}),className:"link-point-left",name:"link-point-left"}))}if(h){var we=null,oe=ee*Math.sin(1/3*Math.PI),ce=ee*Math.sin(1/3*Math.PI);o==="up"?we=[ce,oe]:o==="down"?we=[ce,-oe]:o==="right"&&(we=[ce,ce-oe]),we&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},F),{x:we[0],y:we[1],r:D/2||I||5}),className:"link-point-right",name:"link-point-right"}))}if(s){var Re=null,oe=ee*Math.sin(1/3*Math.PI),ce=ee*Math.sin(1/3*Math.PI);o==="up"?Re=[ce-oe,-oe]:o==="left"?Re=[ce,-oe]:o==="right"&&(Re=[-ce,-oe]),Re&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},F),{x:Re[0],y:Re[1],r:D/2||I||5}),className:"link-point-top",name:"link-point-top"}))}if(p){var Oe=null,oe=ee*Math.sin(1/3*Math.PI),ce=ee*Math.sin(1/3*Math.PI);o==="down"?Oe=[-ce+oe,oe]:o==="left"?Oe=[ce,oe]:o==="right"&&(Oe=[-ce,oe]),Oe&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},F),{x:Oe[0],y:Oe[1],r:D/2||I||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(t){var e=(this.mergeStyle||this.getOptions(t)).direction,r=t.direction||e,n=this.getSize(t),a=n[0],i=a*Math.sin(1/3*Math.PI),o=a*Math.sin(1/3*Math.PI),s=[["M",-o,i],["L",0,-i],["L",o,i],["Z"]];return r==="down"?s=[["M",-o,-i],["L",o,-i],["L",0,i],["Z"]]:r==="left"?s=[["M",-o,o-i],["L",o,-o],["L",o,o],["Z"]]:r==="right"&&(s=[["M",o,o-i],["L",-o,o],["L",-o,-o],["Z"]]),s},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,m.mix)({},e,r),a=this.getPath(t),i=(0,b.__assign)({path:a},n);return i},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getPath(t),o={stroke:t.color,path:i},s=e.get("keyShape"),l=(0,m.mix)({},a,s.attr(),o);l=(0,m.mix)(l,t.style),this.updateShape(t,e,l,!0,r),this.updateLinkPoints(t,n)},updateLinkPoints:function(t,e){var r=this.getOptions({}),n=r.linkPoints,a=r.direction,i=t.direction||a,o=e.shapeMap["link-point-left"]||e.find(function(Kt){return Kt.get("className")==="link-point-left"}),s=e.shapeMap["link-point-right"]||e.find(function(Kt){return Kt.get("className")==="link-point-right"}),l=e.shapeMap["link-point-top"]||e.find(function(Kt){return Kt.get("className")==="link-point-top"}),h=e.shapeMap["link-point-bottom"]||e.find(function(Kt){return Kt.get("className")==="link-point-bottom"}),p=n,D=o||s||l||h;D&&(p=D.attr());var I=(0,m.mix)({},p,t.linkPoints),F=I.fill,Z=I.stroke,ee=I.lineWidth,se=I.size/2;se||(se=I.r);var oe=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},ce=oe.left,we=oe.right,Re=oe.top,Oe=oe.bottom,Pe=this.getSize(t),He=Pe[0],at={r:se,fill:F,stroke:Z,lineWidth:ee},qe=null,yt=He*Math.sin(1/3*Math.PI),Ft=He*Math.sin(1/3*Math.PI);i==="up"?qe=[-Ft,yt]:i==="down"?qe=[-Ft,-yt]:i==="left"&&(qe=[-Ft,Ft-yt]),qe&&(o?!ce&&ce!==void 0?(o.remove(),delete e.shapeMap["link-point-left"]):o.attr((0,b.__assign)((0,b.__assign)({},at),{x:qe[0],y:qe[1]})):ce&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},at),{x:qe[0],y:qe[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var yr=null;i==="up"?yr=[Ft,yt]:i==="down"?yr=[Ft,-yt]:i==="right"&&(yr=[Ft,Ft-yt]),yr&&(s?!we&&we!==void 0?(s.remove(),delete e.shapeMap["link-point-right"]):s.attr((0,b.__assign)((0,b.__assign)({},at),{x:yr[0],y:yr[1]})):we&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},at),{x:yr[0],y:yr[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var fr=null;i==="up"?fr=[Ft-yt,-yt]:i==="left"?fr=[Ft,-yt]:i==="right"&&(fr=[-Ft,-yt]),fr&&(l?!Re&&Re!==void 0?(l.remove(),delete e.shapeMap["link-point-top"]):l.attr((0,b.__assign)((0,b.__assign)({},at),{x:fr[0],y:fr[1]})):Re&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},at),{x:fr[0],y:fr[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var lr=null;i==="down"?lr=[-Ft+yt,yt]:i==="left"?lr=[Ft,yt]:i==="right"&&(lr=[-Ft,yt]),lr&&(h?!Oe&&Oe!==void 0?(h.remove(),delete e.shapeMap["link-point-bottom"]):h.attr((0,b.__assign)((0,b.__assign)({},at),{x:lr[0],y:lr[1]})):Oe&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},at),{x:lr[0],y:lr[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node"),To("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:Kr.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:Kr.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:Kr.windowFontFamily},paddingTop:0},preRect:{show:!0,width:4,fill:"#40a9ff",radius:2},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:10,lineWidth:1,fill:"#72CC4A",stroke:"#72CC4A"},logoIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/4f81893c-1806-4de4-aff3-9a6b266bc8a2.svg",width:16,height:16,offset:0},stateIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/300a2523-67e0-4cbf-9d4a-67c077b40395.svg",width:16,height:16,offset:-5},anchorPoints:[[0,.5],[1,.5]]},shapeType:"modelRect",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).preRect,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=this.getSize(t),o=i[0],s=i[1],l=e.addShape("rect",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=l;var h=n.show,p=(0,b.__rest)(n,["show"]);return h&&(e.shapeMap["pre-rect"]=e.addShape("rect",{attrs:(0,b.__assign)({x:-o/2,y:-s/2,height:s},p),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(t,e),this.drawStateIcon(t,e),this.drawLinkPoints(t,e),l},drawLogoIcon:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).logoIcon,n=r===void 0?{}:r,a=this.getSize(t),i=a[0];if(n.show){var o=n.width,s=n.height,l=n.x,h=n.y,p=n.offset,D=n.text,I=(0,b.__rest)(n,["width","height","x","y","offset","text"]);D?e.shapeMap["rect-logo-icon"]=e.addShape("text",{attrs:(0,b.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},I),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):e.shapeMap["rect-logo-icon"]=e.addShape("image",{attrs:(0,b.__assign)((0,b.__assign)({},I),{x:l||-i/2+o+p,y:h||-s/2,width:o,height:s}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).stateIcon,n=r===void 0?{}:r,a=this.getSize(t),i=a[0];if(n.show){var o=n.width,s=n.height,l=n.x,h=n.y,p=n.offset,D=n.text,I=(0,b.__rest)(n,["width","height","x","y","offset","text"]);D?e.shapeMap["rect-state-icon"]=e.addShape("text",{attrs:(0,b.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},I),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):e.shapeMap["rect-state-icon"]=e.addShape("image",{attrs:(0,b.__assign)((0,b.__assign)({},I),{x:l||i/2-o+p,y:h||-s/2,width:o,height:s}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,s=n.bottom,l=n.size,h=n.r,p=(0,b.__rest)(n,["top","left","right","bottom","size","r"]),D=this.getSize(t),I=D[0],F=D[1];i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:-I/2,y:0,r:l/2||h||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:I/2,y:0,r:l/2||h||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:-F/2,r:l/2||h||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},p),{x:0,y:F/2,r:l/2||h||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(t,e){var r=this.getOptions(t),n=r.labelCfg,a=n===void 0?{}:n,i=r.logoIcon,o=i===void 0?{}:i,s=r.descriptionCfg,l=s===void 0?{}:s,h=this.getSize(t),p=h[0],D=null,I=o.show,F=o.width,Z=-p/2+a.offset;I&&(Z=-p/2+F+a.offset);var ee=a.style,se=l.style,oe=l.paddingTop;return(0,m.isString)(t.description)?(D=e.addShape("text",{attrs:(0,b.__assign)((0,b.__assign)({},ee),{x:Z,y:-5,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=D,e.shapeMap["rect-description"]=e.addShape("text",{attrs:(0,b.__assign)((0,b.__assign)({},se),{x:Z,y:17+(oe||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(D=e.addShape("text",{attrs:(0,b.__assign)((0,b.__assign)({},ee),{x:Z,y:7,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=D),D},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,m.mix)({},e,r),a=this.getSize(t),i=n.width||a[0],o=n.height||a[1],s=(0,b.__assign)({x:-i/2,y:-o/2,width:i,height:o},n);return s},update:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.style,a=n===void 0?{}:n,i=r.labelCfg,o=i===void 0?{}:i,s=r.descriptionCfg,l=s===void 0?{}:s,h=this.getSize(t),p=h[0],D=h[1],I=e.get("keyShape");I.attr((0,b.__assign)((0,b.__assign)({},a),{x:-p/2,y:-D/2,width:p,height:D}));var F=e.getContainer(),Z=F.shapeMap["rect-logo-icon"]||F.find(function(Tn){return Tn.get("className")==="rect-logo-icon"}),ee=Z?Z.attr():{},se=(0,m.mix)({},ee,t.logoIcon),oe=se.width;oe===void 0&&(oe=this.options.logoIcon.width);var ce=t.logoIcon?t.logoIcon.show:void 0,we=o.offset,Re=-p/2+oe+we;!ce&&ce!==void 0&&(Re=-p/2+we);var Oe=F.shapeMap["node-label"]||F.find(function(Tn){return Tn.get("className")==="node-label"}),Pe=F.shapeMap["rect-description"]||F.find(function(Tn){return Tn.get("className")==="rect-description"});if(t.label)if(!Oe)F.shapeMap["node-label"]=F.addShape("text",{attrs:(0,b.__assign)((0,b.__assign)({},o.style),{x:Re,y:t.description?-5:7,text:t.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var He=t.labelCfg?t.labelCfg.style:{},at=(0,m.mix)({},Oe.attr(),He);t.label&&(at.text=t.label),at.x=Re,(0,m.isString)(t.description)&&(at.y=-5),Pe&&(Pe.resetMatrix(),Pe.attr({x:Re})),Oe.resetMatrix(),Oe.attr(at)}if((0,m.isString)(t.description)){var qe=l.paddingTop;if(!Pe)F.shapeMap["rect-description"]=F.addShape("text",{attrs:(0,b.__assign)((0,b.__assign)({},l.style),{x:Re,y:17+(qe||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var He=t.descriptionCfg?t.descriptionCfg.style:{},yt=(0,m.mix)({},Pe.attr(),He);(0,m.isString)(t.description)&&(yt.text=t.description),yt.x=Re,Pe.resetMatrix(),Pe.attr((0,b.__assign)((0,b.__assign)({},yt),{y:17+(qe||0)}))}}var Ft=F.shapeMap["pre-rect"]||F.find(function(Tn){return Tn.get("className")==="pre-rect"});if(Ft&&!Ft.destroyed){var yr=(0,m.mix)({},Ft.attr(),t.preRect);Ft.attr((0,b.__assign)((0,b.__assign)({},yr),{x:-p/2,y:-D/2,height:D}))}if(Z&&!Z.destroyed)if(!ce&&ce!==void 0)Z.remove(),delete F.shapeMap["pre-rect"];else{var fr=se.width,lr=se.height,Kt=se.x,jr=se.y,Xr=se.offset,er=(0,b.__rest)(se,["width","height","x","y","offset"]);Z.attr((0,b.__assign)((0,b.__assign)({},er),{x:Kt||-p/2+fr+Xr,y:jr||-lr/2,width:fr,height:lr}))}else ce&&this.drawLogoIcon(t,F);var mr=F.shapeMap["rect-state-icon"]||F.find(function(Tn){return Tn.get("className")==="rect-state-icon"}),kr=mr?mr.attr():{},Fr=(0,m.mix)({},kr,t.stateIcon);if(mr){!Fr.show&&Fr.show!==void 0&&(mr.remove(),delete F.shapeMap["rect-state-icon"]);var Jr=Fr.width,lr=Fr.height,Kt=Fr.x,jr=Fr.y,fn=Fr.offset,Vn=(0,b.__rest)(Fr,["width","height","x","y","offset"]);mr.attr((0,b.__assign)((0,b.__assign)({},Vn),{x:Kt||p/2-Jr+fn,y:jr||-lr/2,width:Jr,height:lr}))}else Fr.show&&this.drawStateIcon(t,F);this.updateLinkPoints(t,F)},getOptions:function(t,e){return e==="move"?t:(0,m.deepMix)({},this.options,this.getCustomConfig(t)||{},t)}},"single-node"),To("star",{options:{size:60,style:{stroke:Kr.defaultNode.style.stroke,fill:Kr.defaultNode.style.fill,lineWidth:Kr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Kr.nodeLabel.style.fill,fontSize:Kr.nodeLabel.style.fontSize,fontFamily:Kr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Kr.defaultNode.linkPoints.size,lineWidth:Kr.defaultNode.linkPoints.lineWidth,fill:Kr.defaultNode.linkPoints.fill,stroke:Kr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,b.__assign)({},Kr.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=i;var o=n.width,s=n.height,l=n.show,h=n.text;return l&&(h?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,b.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,b.__assign)({x:-o/2,y:-s/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,s=n.leftBottom,l=n.rightBottom,h=n.size,p=n.r,D=(0,b.__rest)(n,["top","left","right","leftBottom","rightBottom","size","r"]),I=this.getSize(t),F=I[0];if(o){var Z=Math.cos((18+72*0)/180*Math.PI)*F,ee=Math.sin((18+72*0)/180*Math.PI)*F;e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},D),{x:Z,y:-ee,r:h/2||p||5}),className:"link-point-right",name:"link-point-right"})}if(a){var Z=Math.cos((18+72*1)/180*Math.PI)*F,ee=Math.sin((18+72*1)/180*Math.PI)*F;e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},D),{x:Z,y:-ee,r:h/2||p||5}),className:"link-point-top",name:"link-point-top"})}if(i){var Z=Math.cos((18+72*2)/180*Math.PI)*F,ee=Math.sin((18+72*2)/180*Math.PI)*F;e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},D),{x:Z,y:-ee,r:h/2||p||5}),className:"link-point-left",name:"link-point-left"})}if(s){var Z=Math.cos((18+72*3)/180*Math.PI)*F,ee=Math.sin((18+72*3)/180*Math.PI)*F;e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},D),{x:Z,y:-ee,r:h/2||p||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(l){var Z=Math.cos((18+72*4)/180*Math.PI)*F,ee=Math.sin((18+72*4)/180*Math.PI)*F;e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},D),{x:Z,y:-ee,r:h/2||p||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(t){var e=this.getSize(t),r=e[0],n=r*3/8,a=t.innerR||n;return ki.getStarPath(r,a)},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,m.mix)({},e,r),a=this.getPath(t),i=(0,b.__assign)({path:a},n);return i},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getPath(t),o={stroke:t.color,path:i},s=e.get("keyShape"),l=(0,m.mix)({},a,s.attr(),o);l=(0,m.mix)(l,t.style),this.updateShape(t,e,l,!0,r),this.updateLinkPoints(t,n)},updateLinkPoints:function(t,e){var r=this.getOptions({}).linkPoints,n=e.shapeMap["link-point-left"]||e.find(function(yt){return yt.get("className")==="link-point-left"}),a=e.shapeMap["link-point-right"]||e.find(function(yt){return yt.get("className")==="link-point-right"}),i=e.shapeMap["link-point-top"]||e.find(function(yt){return yt.get("className")==="link-point-top"}),o=e.shapeMap["link-point-left-bottom"]||e.find(function(yt){return yt.get("className")==="link-point-left-bottom"}),s=e.shapeMap["link-point-left-bottom"]||e.find(function(yt){return yt.get("className")==="link-point-right-bottom"}),l=r,h=n||a||i||o||s;h&&(l=h.attr());var p=(0,m.mix)({},l,t.linkPoints),D=p.fill,I=p.stroke,F=p.lineWidth,Z=p.size/2;Z||(Z=p.r);var ee=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},se=ee.left,oe=ee.right,ce=ee.top,we=ee.leftBottom,Re=ee.rightBottom,Oe=this.getSize(t),Pe=Oe[0],He={r:Z,fill:D,stroke:I,lineWidth:F},at=Math.cos((18+72*0)/180*Math.PI)*Pe,qe=Math.sin((18+72*0)/180*Math.PI)*Pe;a?!oe&&oe!==void 0?(a.remove(),delete e.shapeMap["link-point-right"]):a.attr((0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe})):oe&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),at=Math.cos((18+72*1)/180*Math.PI)*Pe,qe=Math.sin((18+72*1)/180*Math.PI)*Pe,i?!ce&&ce!==void 0?(i.remove(),delete e.shapeMap["link-point-top"]):i.attr((0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe})):ce&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),at=Math.cos((18+72*2)/180*Math.PI)*Pe,qe=Math.sin((18+72*2)/180*Math.PI)*Pe,n?!se&&se!==void 0?(n.remove(),delete e.shapeMap["link-point-left"]):n.attr((0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe})):se&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),at=Math.cos((18+72*3)/180*Math.PI)*Pe,qe=Math.sin((18+72*3)/180*Math.PI)*Pe,o?!we&&we!==void 0?(o.remove(),delete e.shapeMap["link-point-left-bottom"]):o.attr((0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe})):we&&(e.shapeMap["link-point-left-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),at=Math.cos((18+72*4)/180*Math.PI)*Pe,qe=Math.sin((18+72*4)/180*Math.PI)*Pe,s?!Re&&Re!==void 0?(s.remove(),delete e.shapeMap["link-point-right-bottom"]):s.attr((0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe})):Re&&(e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:(0,b.__assign)((0,b.__assign)({},He),{x:at,y:-qe}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var pd=ki.defaultSubjectColors,Il="fan-shape-";To("donut",{options:{size:Kr.defaultNode.size,style:{x:0,y:0,stroke:Kr.defaultNode.style.stroke,fill:Kr.defaultNode.style.fill,lineWidth:Kr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Kr.nodeLabel.style.fill,fontSize:Kr.nodeLabel.style.fontSize,fontFamily:Kr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Kr.defaultNode.linkPoints.size,lineWidth:Kr.defaultNode.linkPoints.lineWidth,fill:Kr.defaultNode.linkPoints.fill,stroke:Kr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,b.__assign)({},Kr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=(0,m.deepMix)({},n,t.icon),o=e.addShape("circle",{attrs:a,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});e.shapeMap["".concat(this.type,"-keyShape")]=o;var s=i.width,l=i.height,h=i.show,p=i.text;return h&&(p?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,b.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,b.__assign)({x:-s/2,y:-l/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),Ah(t,e,o),this.drawLinkPoints(t,e),o},updateShape:function(t,e,r,n,a){var i=e.get("keyShape");i.attr((0,b.__assign)({},r)),Lh(t,e,i),this.updateLabel(t,e,a),n&&this.updateIcon(t,e)}},"circle");var Ah=function(t,e,r){var n=t.donutAttrs,a=n===void 0?{}:n,i=t.donutColorMap,o=i===void 0?{}:i,s=Object.keys(a).length;if(a&&s>1){var l=yd(a,o),h=l.configs,p=l.totalValue;if(p){var D=md(r),I=D.lineWidth,F=D.arcR,Z=[F,0],ee=0;if(s===1){ed(e,{arcR:F,arcBegin:Z,beginAngle:ee,config:h[0],fanIndex:0,lineWidth:I,totalValue:p,drawWhole:!0});return}for(var se=0;se.999)Z=[r,1e-4],se=1;else{var oe=F*Math.PI*2;ee=a+oe,Z=[r*Math.cos(ee),-r*Math.sin(ee)],se=oe>Math.PI?1:0}var ce={path:[["M",n[0],n[1]],["A",r,r,0,se,0,Z[0],Z[1]],["L",Z[0],Z[1]]],stroke:i.color||(I==null?void 0:I.attr("stroke"))||pd[o%pd.length],lineWidth:s};return I?I.attr(ce):t.shapeMap["".concat(Il).concat(o)]=t.addShape("path",{attrs:ce,name:"".concat(Il).concat(o),draggable:!0}),{beginAngle:ee,arcBegin:Z,shape:t.shapeMap["".concat(Il).concat(o)],shouldEnd:p||F>.999}},Lh=function(t,e,r){var n=t.donutAttrs,a=t.donutColorMap,i=a===void 0?{}:a,o={},s=e.getContainer();if(n){var l=yd(n,i),h=l.configs,p=l.totalValue;if(p)for(var D=md(r),I=D.lineWidth,F=D.arcR,Z=[F,0],ee=0,se=0;se=0;a--){var i=t[a];i.id="".concat(i.x,"|||").concat(i.y),r[i.id]||(r[i.id]=i,e.push(i))}return e},Ed=function(t){return td(t)},Jg=function(t,e){return[t,{x:t.x,y:e.y},e]},Bl=function(t,e){return t.width||t.height?{centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}:t},Nh=function(t,e){var r=Math.abs(t.x-e.centerX),n=Math.abs(t.y-e.centerY);return r===0&&n===0?0:r/e.width>n/e.height},rd=function(t,e,r){var n=Nh(e,t);if(n===0){var a=t.centerX,i=t.centerY;return r.ye.x?a=t.maxX:r.xt.centerX?t.maxX:t.minX,y:e.y}:{x:e.x,y:e.y>t.centerY?t.maxY:t.minY}},bd=function(t,e){var r=Math.min(t.minX,e.minX),n=Math.min(t.minY,e.minY),a=Math.max(t.maxX,e.maxX),i=Math.max(t.maxY,e.maxY);return{centerX:(r+a)/2,centerY:(n+i)/2,minX:r,minY:n,maxX:a,maxY:i,height:i-n,width:a-r}},nd=function(t){return[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]},Fl=function(t,e){var r=t.x,n=t.y;return re.maxX||ne.maxY},Ph=function(t,e){return et.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]},kh=function(t,e){return et.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]},Rh=function(t,e){return Ph(t,e.x).concat(kh(t,e.y))},Ol=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},Bh=function(t,e){var r=-2,n=0;return e.forEach(function(a){a&&(t.x===a.x&&(n+=r),t.y===a.y&&(n+=r))}),n},xd=function(t,e,r,n,a){return Ol(t,e)+Ol(t,r)+Bh(t,[e,r,n,a])},Fh=function c(t,e,r,n,a){a===void 0&&(a=0),t.unshift(e[n]),r[n]&&r[n]!==n&&a<=100&&c(t,e,r,r[n],a+1)},qg=function(t,e){var r=t.indexOf(e);r>-1&&t.splice(r,1)},Gl=function(t,e,r,n){var a=r.x-t.x,i=r.y-t.y,o=n.x-t.x,s=n.y-t.y,l=r.x-e.x,h=r.y-e.y,p=n.x-e.x,D=n.y-e.y,I=a*s-i*o,F=l*D-h*p,Z=a*h-i*l,ee=o*D-s*p;return I*F<=0&&Z*ee<=0},ad=function(t,e,r){if(r.width||r.height){var n=nd(r),a=n[0],i=n[1],o=n[2],s=n[3];return Gl(t,e,a,i)||Gl(t,e,a,s)||Gl(t,e,i,o)||Gl(t,e,o,s)}return!1},Gh=function(t,e,r,n){var a=[];return t.forEach(function(i){if(i!==e&&(i.x===e.x||i.y===e.y)){if(ad(i,e,r)||ad(i,e,n))return;a.push(i)}}),td(a)},zh=function(t,e,r,n,a,i,o){var s,l=[],h=(s={},s[e.id]=e,s),p={},D={},I={};D[e.id]=0,I[e.id]=xd(e,r,e);var F=new _d;F.add({id:e.id,value:I[e.id]});var Z={};t.forEach(function(Re){Z[Re.id]=Re});for(var ee;Object.keys(h).length;){var se=F.minId(!1);if(se)ee=h[se];else break;if(ee===r){var oe=[];return Fh(oe,Z,p,r.id),oe}delete h[ee.id],F.remove(ee.id),l.push(ee);var ce=Gh(t,ee,n,a),we=function(Oe){Oe.forEach(function(Pe){if(l.indexOf(Pe)===-1){var He=Pe.id;h[He]||(h[He]=Pe);var at=I[ee.id]+Ol(ee,Pe);if(D[He]&&at>=D[He]){F.add({id:He,value:I[He]});return}p[He]=ee.id,D[He]=at,I[He]=D[He]+xd(Pe,r,e,i,o),F.add({id:He,value:I[He]})}})};we(ce)}return[e,r]},Uh=function(t,e,r){return!(t.x===e.x&&e.x===r.x||t.y===e.y&&e.y===r.y)},Wh=function(t,e,r,n){var a=Ol(t,e),i=Ol(r,e);a=0;i--){var o=t[i];if(o.x===r.x?n.push(o):(n=[o],r.x=o.x),o.y===r.y?a.push(o):(a=[o],r.y=o.y),n.length>2){var s=t.indexOf(n[1]);s>-1&&t.splice(s,1);continue}if(a.length>2){var s=t.indexOf(a[1]);s>-1&&t.splice(s,1)}}return t},_d=function(){function c(){this.arr=[],this.map={},this.arr=[],this.map={}}return c.prototype._innerAdd=function(t,e){for(var r=[0,e-1];r[1]-r[0]>1;){var n=Math.floor((r[0]+r[1])/2);if(this.arr[n].value>t.value)r[1]=n;else if(this.arr[n].value=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t},c.prototype._findFirstId=function(){for(;this.arr.length;){var t=this.arr.shift();if(this.map[t.id])return t.id}},c.prototype.minId=function(t){return t?this._clearAndGetMinId():this._findFirstId()},c}(),Xh=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},Vh=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},Yh=function(t,e){return[t,e]},Hh=function(t,e,r,n,a){return Ed(Sd(t,e,r,n,a.offset))},Zh={offset:20,maxAllowedDirectionChange:Math.PI/2,maximumLoops:2e3,gridSize:10,directions:[{stepX:1,stepY:0},{stepX:-1,stepY:0},{stepX:0,stepY:1},{stepX:0,stepY:-1}],get penalties(){return{0:0,45:this.gridSize/2,90:this.gridSize/2}},distFunc:Xh,fallbackRoute:Hh},ep={maxAllowedDirectionChange:Math.PI/4,directions:[{stepX:1,stepY:0},{stepX:1,stepY:1},{stepX:0,stepY:1},{stepX:-1,stepY:1},{stepX:-1,stepY:0},{stepX:-1,stepY:-1},{stepX:0,stepY:-1},{stepX:1,stepY:-1}],distFunc:Vh,fallbackRoute:Yh},Wu=function(t,e){var r=Math.round(Math.abs(t/e)),n=t<0?-1:1;return r<0?0:n*r},Kh=function(t,e,r){var n={};return t.forEach(function(a){if(!!a)for(var i=Bl(a.getBBox(),r),o=Wu(i.minX,e);o<=Wu(i.maxX,e);o+=1)for(var s=Wu(i.minY,e);s<=Wu(i.maxY,e);s+=1)n["".concat(o,"|||").concat(s)]=!0}),n},id=function(t,e){var r=e.x-t.x,n=e.y-t.y;return r||n?Math.atan2(n,r):0},Md=function(t,e){var r=Math.abs(t-e);return r>Math.PI?2*Math.PI-r:r},Cd=function(t,e,r){for(var n=Infinity,a=0,i=e.length;al.minX&&e.xl.minY&&e.y0&&Oe>0;){var lr=ce.minId((Oe+1)%30==0);if(lr)Pe=F[lr];else break;if(fr["".concat(Pe.x,"|||").concat(Pe.y)])return $h(Pe,ee,h,e,t,p,s);delete F[Pe.id],ce.remove(Pe.id),Z[Pe.id]=!0;for(var we=0;wei.maxAllowedDirectionChange)&&!l[Kt])){F[Kt]||(F[Kt]=at);var jr=o[Ft];qe=i.distFunc(Pe,at)+(isNaN(jr)?s:jr),yt=se[Pe.id]+qe;var Xr=se[Kt];Xr&&yt>=Xr||(ee[Kt]=Pe,se[Kt]=yt,oe[Kt]=yt+Cd(at,I,i.distFunc),ce.add({id:Kt,value:oe[Kt]}))}}Oe-=1}return i.fallbackRoute(t,e,r,n,i)};Sc("polyline",{options:{color:Kr.defaultEdge.color,size:Kr.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:Kr.defaultEdge.style.stroke,lineAppendWidth:Kr.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Kr.edgeLabel.style.fill,fontSize:Kr.edgeLabel.style.fontSize,fontFamily:Kr.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:(0,b.__assign)({},Kr.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(t,e){var r=this.getShapeStyle(t);r.radius===0&&delete r.radius;var n=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:r});return e.shapeMap["edge-shape"]=n,n},getShapeStyle:function(t){var e=this.options.style,r={stroke:t.color},n=(0,m.mix)({},e,r,t.style);t=this.getPathPoints(t),this.radius=n.radius,this.offset=n.offset;var a=t.startPoint,i=t.endPoint,o=this.getControlPoints(t),s=[a];o&&(s=s.concat(o)),s.push(i);var l=t.sourceNode,h=t.targetNode,p=n.radius,D=this.options.routeCfg,I=(0,m.mix)({},D,t.routeCfg);I.offset=n.offset;var F=this.getPath(s,l,h,p,I,!Boolean(o));((0,m.isArray)(F)&&F.length<=1||(0,m.isString)(F)&&F.indexOf("L")===-1)&&(F="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(i.x)||isNaN(i.y))&&(F="M0 0, L0 0");var Z=(0,m.mix)({},Kr.defaultEdge.style,n,{lineWidth:t.size,path:F});return Z},updateShapeStyle:function(t,e){var r=e.getContainer();if(!!e.isVisible()){var n={stroke:t.color},a=r.shapeMap["edge-shape"]||r.find(function(we){return we.get("className")==="edge-shape"})||e.getKeyShape(),i=t.size;t=this.getPathPoints(t);var o=t.startPoint,s=t.endPoint,l=this.getControlPoints(t),h=[o];l&&(h=h.concat(l)),h.push(s);var p=a.attr(),D=(0,m.mix)({},n,p,t.style),I=t.sourceNode,F=t.targetNode,Z=D.radius,ee=this.options.routeCfg,se=(0,m.mix)({},ee,t.routeCfg);se.offset=D.offset;var oe=this.getPath(h,I,F,Z,se,!Boolean(l));((0,m.isArray)(oe)&&oe.length<=1||(0,m.isString)(oe)&&oe.indexOf("L")===-1)&&(oe="M0 0, L0 0"),(isNaN(o.x)||isNaN(o.y)||isNaN(s.x)||isNaN(s.y))&&(oe="M0 0, L0 0"),p.endArrow&&D.endArrow===!1&&(t.style.endArrow={path:""}),p.startArrow&&D.startArrow===!1&&(t.style.startArrow={path:""});var ce=(0,m.mix)(n,a.attr(),{lineWidth:i,path:oe},t.style);a&&a.attr(ce)}},getPath:function(t,e,r,n,a,i){var o=a.offset,s=a.obstacles,l=a.simple;if(!o||t.length>2||i===!1){if(n)return wd(t,n);var h=[];return(0,m.each)(t,function(F,Z){Z===0?h.push(["M",F.x,F.y]):h.push(["L",F.x,F.y])}),h}l!==!1&&!(s==null?void 0:s.length)&&(l=!0);var p=l?Sd(t[t.length-1],t[0],r,e,o):Qh(t[0],t[t.length-1],e,r,a);if(!p||!p.length)return"M0 0, L0 0";if(n){var D=wd(p,n);return D}p=jh(p);var I=ki.pointsToPolygon(p);return I}},"single-edge");var Id=Vo.cloneEvent,Od=Vo.isNaN,Ad=Math.abs,Jh=10,qh=["shift","ctrl","alt","control"],ev={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{mousedown:"onMouseDown",drag:"onDragMove",dragend:"onMouseUp","canvas:click":"onMouseUp",keyup:"onKeyUp",focus:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onMouseUp"}},updateViewport:function(t){var e=this.origin,r=+t.clientX,n=+t.clientY;if(!(Od(r)||Od(n))){var a=r-e.x,i=n-e.y;this.get("direction")==="x"?i=0:this.get("direction")==="y"&&(a=0),this.origin={x:r,y:n};var o=this.graph.get("width"),s=this.graph.get("height"),l=this.graph.get("canvas").getCanvasBBox(),h=this.scalableRange,p=this.scalableRange;h<1&&h>-1&&(h=o*h,p=s*p),(l.minX<=o+h&&l.minX+a>o+h||l.maxX+h>=0&&l.maxX+h+a<0)&&(a=0),(l.minY<=s+p&&l.minY+i>s+p||l.maxY+p>=0&&l.maxY+p+i<0)&&(i=0),this.graph.translate(a,i)}},onTouchStart:function(t){var e=this,r=t.originalEvent.touches,n=r[0],a=r[1];n&&a||(t.preventDefault(),this.mousedown=!0,e.onDragStart(t))},onMouseDown:function(t){this.mousedown=!0},onDragMove:function(t){!this.mousedown||(this.dragstart?this.onDrag(t):(this.dragstart=!0,this.onDragStart(t)))},onDragStart:function(t){var e=this,r=t.originalEvent;if(!(r&&t.name!=="touchstart"&&r.button!==0)&&!(t.name!=="touchstart"&&typeof window!="undefined"&&window.event&&!window.event.buttons&&!window.event.button)&&!!this.shouldBegin(t,this)&&!e.keydown&&!!this.allowDrag(t)){if(e.origin={x:t.clientX,y:t.clientY},e.dragging=!1,this.enableOptimize){for(var n=this.graph,a=n.getEdges(),i=0,o=a.length;is)for(var I=n.getNodes(),F=0,Z=I.length;F-1?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(t){var e,r,n=t.target,a=n&&n.isCanvas&&n.isCanvas();if((0,m.isBoolean)(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if((0,m.isObject)(this.allowDragOnItem)){var i=this.allowDragOnItem,o=i.node,s=i.edge,l=i.combo,h=(r=(e=t.item)===null||e===void 0?void 0:e.getType)===null||r===void 0?void 0:r.call(e);if(!o&&h==="node"||!s&&h==="edge"||!l&&h==="combo")return!1}return!0}},tv={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:mousedown":"onMouseDown",drag:"onDragMove",dragend:"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd",afterchangedata:"onDragEnd"}},validationCombo:function(t){if(!this.origin||!t||t.destroyed)return!1;var e=t.getType();return e==="combo"},onTouchStart:function(t){if(!!t.item){var e=this;try{var r=t.originalEvent.touches,n=r[0],a=r[1];if(n&&a)return;t.preventDefault()}catch(i){console.warn("Touch original event not exist!")}this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},this.dragstart=!0,e.onDragStart(t)}},onTouchMove:function(t){var e=this;try{var r=t.originalEvent.touches,n=r[0],a=r[1];if(n&&a){e.onDragEnd(t);return}t.preventDefault()}catch(i){console.warn("Touch original event not exist!")}e.onDrag(t)},onMouseDown:function(t){this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},typeof window!="undefined"&&!this.windowEventBinded&&(this.windowEventBinded=!0,document.body.addEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.addEventListener("mouseup",this.onDragEnd.bind(this)))},onDragMove:function(t){var e,r;if(((r=(e=t.item)===null||e===void 0?void 0:e.getType)===null||r===void 0?void 0:r.call(e))!=="node"){this.onDragEnd();return}!this.mousedown||(this.dragstart?this.onDrag((0,b.__assign)((0,b.__assign)({},t),this.mousedown)):(this.dragstart=!0,this.onDragStart(t)))},onDragStart:function(t){var e=this;if(this.currentShouldEnd=!0,!!this.shouldBegin((0,b.__assign)((0,b.__assign)({},t),this.mousedown),this)){var r=this.mousedown,n=r.item,a=r.target;if(!(!n||n.destroyed||n.hasLocked())){var i=n.getContainer();if(i.set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(n),a){var o=a.get("isAnchorPoint");if(o)return}var s=this.graph;this.targets=[],this.targetCombo=null;var l=s.findAllByState("node",this.selectedState),h=n.get("id"),p=l.filter(function(I){var F=I.get("id");return h===F});if(p.length===0?this.targets.push(n):l.length>1?l.forEach(function(I){var F=I.hasLocked();F||e.targets.push(I)}):this.targets.push(n),this.graph.get("enabledStack")&&this.enableStack){var D=[];this.targets.forEach(function(I){var F=I.getModel(),Z=F.x,ee=F.y,se=F.id;D.push({x:Z,y:ee,id:se})}),this.set("beforeDragNodes",D)}this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(I){var F=I.getEdges();F.forEach(function(Z){!Z.isVisible()||(e.hidenEdge[Z.getID()]=!0,Z.hide())})}),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(t){var e=this;if(!(!this.mousedown||!this.origin)&&!!this.shouldUpdate(t,this))if(this.get("enableDelegate"))this.updateDelegate(t);else if(this.enableDebounce)this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos});else{var r={};this.targets.map(function(n){e.update(n,t);var a=n.getModel().comboId;a&&(r[a]=e.graph.findById(a))}),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(t){var e=this,r;if(this.mousedown=!1,this.dragstart=!1,typeof window!="undefined"&&this.windowEventBinded&&(this.windowEventBinded=!1,document.body.removeEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.removeEventListener("mouseup",this.onDragEnd.bind(this))),!!this.origin){(r=this.cachedCaptureItems)===null||r===void 0||r.forEach(function(i){var o=i.getContainer();o.set("capture",!0)}),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(i){var o=i.getEdges();o.forEach(function(s){e.hidenEdge[s.getID()]&&s.show(),s.refresh()})}),this.hidenEdge={};var n=this.graph;if(n.get("enabledStack")&&this.enableStack){var a={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(i){a.before.nodes.push(i)}),this.targets.forEach(function(i){var o=i.getModel(),s=o.x,l=o.y,h=o.id;a.after.nodes.push({x:s,y:l,id:h})}),n.pushStack("update",(0,m.clone)(a))}n.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(t){var e=t.item;if(this.currentShouldEnd=this.shouldEnd(t,e,this),this.updatePositions(t,!this.currentShouldEnd),!(!this.currentShouldEnd||!this.validationCombo(e))){var r=this.graph;if(this.comboActiveState&&r.setItemState(e,this.comboActiveState,!1),this.targetCombo=e,this.onlyChangeComboSize)r.updateCombos();else{var n=e.getModel();this.targets.map(function(a){var i=a.getModel();i.comboId!==n.id&&r.updateComboTree(a,n.id)}),r.updateCombo(e)}r.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(t){var e=this.graph;this.currentShouldEnd=this.shouldEnd(t,void 0,this),this.updatePositions(t,!this.currentShouldEnd),!(!this.targets||this.targets.length===0||!this.currentShouldEnd)&&(this.onlyChangeComboSize?this.updateParentCombos():this.targets.map(function(r){var n=r.getModel();n.comboId&&e.updateComboTree(r)}))},onDropNode:function(t){if(!(!this.targets||this.targets.length===0)){var e=this,r=t.item,n=e.graph,a=r.getModel().comboId,i=a?n.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(t,i,this),this.updatePositions(t,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(a){var o=n.findById(a);e.comboActiveState&&n.setItemState(o,e.comboActiveState,!1),this.targets.map(function(s){var l=s.getModel();a!==l.comboId&&n.updateComboTree(s,a)}),n.updateCombo(o)}else this.targets.map(function(s){var l=s.getModel();l.comboId&&n.updateComboTree(s)});n.emit("dragnodeend",{items:this.targets,targetItem:r})}}},onDragEnter:function(t){var e=t.item;if(!!this.validationCombo(e)){var r=this.graph;this.comboActiveState&&r.setItemState(e,this.comboActiveState,!0)}},onDragLeave:function(t){var e=t.item;if(!!this.validationCombo(e)){var r=this.graph;this.comboActiveState&&r.setItemState(e,this.comboActiveState,!1)}},updatePositions:function(t,e){var r=this;!this.targets||this.targets.length===0||(this.get("enableDelegate")?this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos}):e||this.targets.map(function(n){return r.update(n,t)}):this.targets.map(function(n){return r.update(n,t,e)}))},update:function(t,e,r){var n=this.origin,a=t.get("model"),i=t.get("id");this.point[i]||(this.point[i]={x:a.x||0,y:a.y||0});var o=e.x-n.x+this.point[i].x,s=e.y-n.y+this.point[i].y;r&&(o+=n.x-e.x,s+=n.y-e.y);var l={x:o,y:s};this.get("updateEdge")?this.graph.updateItem(t,l,!1):t.updatePosition(l)},debounceUpdate:(0,m.debounce)(function(c){var t=c.targets,e=c.graph,r=c.point,n=c.origin,a=c.evt,i=c.updateEdge,o=c.onlyChangeComboSize,s=c.updateParentCombos;t.map(function(l){var h=l.get("model"),p=l.get("id");r[p]||(r[p]={x:h.x||0,y:h.y||0});var D=a.x-n.x+r[p].x,I=a.y-n.y+r[p].y,F={x:D,y:I};i?e.updateItem(l,F,!1):l.updatePosition(F)}),o&&s(e,t)},50,!0),updateDelegate:function(t){var e=this.graph;if(this.delegateRect){var D=t.x-this.origin.x+this.originPoint.minX,I=t.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:D,y:I})}else{var r=e.get("group"),n=(0,m.deepMix)({},wo.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(t),i=a.x,o=a.y,s=a.width,l=a.height,h=a.minX,p=a.minY;this.originPoint={x:i,y:o,width:s,height:l,minX:h,minY:p},this.delegateRect=r.addShape("rect",{attrs:(0,b.__assign)({width:s,height:l,x:i,y:o},n),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(t){var e=this.targets;e.length===0&&e.push(t.item);for(var r=Infinity,n=-Infinity,a=Infinity,i=-Infinity,o=0;on&&(n=D),I>i&&(i=I)}var F=Math.floor(r),Z=Math.floor(a),ee=Math.ceil(n)-Math.floor(r),se=Math.ceil(i)-Math.floor(a);return{x:F,y:Z,width:ee,height:se,minX:r,minY:a}},updateParentCombos:function(t,e){var r=t||this.graph,n=e||this.targets,a={};n==null||n.forEach(function(i){var o=i.getModel().comboId;o&&(a[o]=r.findById(o))}),Object.values(a).forEach(function(i){i&&r.updateCombo(i)})}},rv={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return this.get("trigger")==="mouseenter"?{"node:mouseenter":"setAllItemStates","combo:mouseenter":"setAllItemStates","node:mouseleave":"clearActiveState","combo:mouseleave":"clearActiveState"}:{"node:click":"setAllItemStates","combo:click":"setAllItemStates","canvas:click":"clearActiveState","node:touchstart":"setOnTouchStart","combo:touchstart":"setOnTouchStart","canvas:touchstart":"clearOnTouchStart"}},setOnTouchStart:function(t){var e=this;try{var r=t.originalEvent.touches,n=r[0],a=r[1];if(n&&a)return;t.preventDefault()}catch(i){console.warn("Touch original event not exist!")}e.setAllItemStates(t)},clearOnTouchStart:function(t){var e=this;try{var r=t.originalEvent.touches,n=r[0],a=r[1];if(n&&a)return;t.preventDefault()}catch(i){console.warn("Touch original event not exist!")}e.clearActiveState(t)},setAllItemStates:function(t){clearTimeout(this.timer),this.throttleSetAllItemStates(t,this)},clearActiveState:function(t){var e=this;this.timer=setTimeout(function(){e.throttleClearActiveState(t,e)},50)},throttleSetAllItemStates:(0,m.throttle)(function(c,t){var e=c.item,r=t.graph;if(!(!r||r.destroyed)&&(t.item=e,!!t.shouldUpdate(c.item,{event:c,action:"activate"},t))){for(var n=t.activeState,a=t.inactiveState,i=r.getNodes(),o=r.getCombos(),s=r.getEdges(),l=r.get("vedges"),h=i.length,p=o.length,D=s.length,I=l.length,F=t.inactiveItems||{},Z=t.activeItems||{},ee=0;ee-1||(this.trigger=Nd,console.warn("Behavior brush-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),this.trigger==="drag"?{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates"}:{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates",keyup:"onKeyUp",keydown:"onKeyDown"}},onMouseDown:function(t){var e=t.item,r=this.brush;e||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates(),r||(r=this.createBrush()),this.originPoint={x:t.canvasX,y:t.canvasY},r.attr({width:0,height:0}),r.show(),this.dragging=!0)},onMouseMove:function(t){!this.dragging||this.trigger!=="drag"&&!this.keydown||this.updateBrush(t)},onMouseUp:function(t){var e=this.graph;!this.brush&&!this.dragging||this.trigger!=="drag"&&!this.keydown||(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(t),this.dragging=!1)},clearStates:function(){var t=this,e=t.graph,r=t.selectedState,n=e.findAllByState("node",r),a=e.findAllByState("edge",r),i=e.findAllByState("combo",r);n.forEach(function(o){return e.setItemState(o,r,!1)}),a.forEach(function(o){return e.setItemState(o,r,!1)}),i.forEach(function(o){return e.setItemState(o,r,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.selectedCombos=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges,this.selectedCombos),e.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},isBBoxCenterInRect:function(t,e,r,n,a){var i=t.getBBox();return i.centerX>=e&&i.centerX<=r&&i.centerY>=n&&i.centerY<=a},getSelectedNodes:function(t){var e=this,r=this,n=r.graph,a=r.originPoint,i=r.shouldUpdate,o=r.isBBoxCenterInRect,s=this.selectedState,l={x:t.x,y:t.y},h=n.getPointByCanvas(a.x,a.y),p=zl(l.x,h.x),D=Ld(l.x,h.x),I=zl(l.y,h.y),F=Ld(l.y,h.y),Z=[],ee=[];n.getNodes().forEach(function(ce){if(ce.isVisible()&&o(ce,p,D,I,F)&&i(ce,"select",e)){Z.push(ce);var we=ce.getModel();ee.push(we.id),n.setItemState(ce,s,!0)}});var se=[];this.includeEdges&&Z.forEach(function(ce){var we=ce.getOutEdges();we.forEach(function(Re){if(!!Re.isVisible()){var Oe=Re.getModel(),Pe=Oe.source,He=Oe.target;ee.includes(Pe)&&ee.includes(He)&&i(Re,"select",e)&&(se.push(Re),n.setItemState(Re,e.selectedState,!0))}})});var oe=[];this.includeCombos&&n.getCombos().forEach(function(ce){if(ce.isVisible()&&o(ce,p,D,I,F)&&i(ce,"select",e)){oe.push(ce);var we=ce.getModel();ee.push(we.id),n.setItemState(ce,s,!0)}}),this.selectedEdges=se,this.selectedNodes=Z,this.selectedCombos=oe,this.onSelect&&this.onSelect(Z,se,oe),n.emit("nodeselectchange",{selectedItems:{nodes:Z,edges:se,combos:oe},select:!0})},createBrush:function(){var t=this,e=t.graph.get("canvas").addShape("rect",{attrs:t.brushStyle,capture:!1,name:"brush-shape"});return this.brush=e,this.delegate=e,e},updateBrush:function(t){var e=this.originPoint;this.brush.attr({width:Dd(t.canvasX-e.x),height:Dd(t.canvasY-e.y),x:zl(t.canvasX,e.x),y:zl(t.canvasY,e.y)})},onKeyDown:function(t){var e=t.key;if(!!e){var r=this.trigger.toLowerCase(),n=e.toLowerCase();n===r||n==="control"&&r==="ctrl"||n==="ctrl"&&r==="control"?this.keydown=!0:this.keydown=!1}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}},Pd="shift",iv=["shift","ctrl","alt","control"],ov={getDefaultCfg:function(){return{multiple:!0,trigger:Pd,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var t=this;return iv.indexOf(t.trigger.toLowerCase())>-1||(t.trigger=Pd,console.warn("Behavior click-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),t.multiple?{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick",keyup:"onKeyUp",keydown:"onKeyDown"}:{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick"}},onClick:function(t){var e=this,r=t.item;if(!(!r||r.destroyed)){var n=r.getType(),a=e.graph,i=e.keydown,o=e.multiple,s=e.shouldUpdate,l=e.shouldBegin;if(!!l(t,e)){if(!i||!o){var h=a.findAllByState("node",e.selectedState).concat(a.findAllByState("edge",e.selectedState)).concat(a.findAllByState("combo",e.selectedState));(0,m.each)(h,function(Z){Z!==r&&a.setItemState(Z,e.selectedState,!1)})}var p=function(){switch(n){case"node":return e.selectNode;case"edge":return e.selectEdge;case"combo":return e.selectCombo;default:return!1}}();if(!p){var D=a.findAllByState("node",e.selectedState),I=a.findAllByState("edge",e.selectedState),F=a.findAllByState("combo",e.selectedState);a.emit("nodeselectchange",{selectedItems:{nodes:D,edges:I,combos:F},select:!1});return}if(r.hasState(e.selectedState)){s(t,e)&&a.setItemState(r,e.selectedState,!1);var D=a.findAllByState("node",e.selectedState),I=a.findAllByState("edge",e.selectedState),F=a.findAllByState("combo",e.selectedState);a.emit("nodeselectchange",{target:r,selectedItems:{nodes:D,edges:I,combos:F},select:!1})}else{s(t,e)&&a.setItemState(r,e.selectedState,!0);var D=a.findAllByState("node",e.selectedState),I=a.findAllByState("edge",e.selectedState),F=a.findAllByState("combo",e.selectedState);a.emit("nodeselectchange",{target:r,selectedItems:{nodes:D,edges:I,combos:F},select:!0})}}}},onCanvasClick:function(t){var e=this,r=this,n=r.graph,a=r.shouldBegin;if(!!a(t,this)){var i=n.findAllByState("node",this.selectedState);(0,m.each)(i,function(l){n.setItemState(l,e.selectedState,!1)});var o=n.findAllByState("edge",this.selectedState);(0,m.each)(o,function(l){n.setItemState(l,e.selectedState,!1)});var s=n.findAllByState("combo",this.selectedState);(0,m.each)(s,function(l){n.setItemState(l,e.selectedState,!1)}),n.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(t){var e=this,r=t.key;!r||(r.toLowerCase()===this.trigger.toLowerCase()||r.toLowerCase()==="control"?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){var t=this;t.keydown=!1}},sv=q.vs,kd=.05,uv={getDefaultCfg:function(){return{sensitivity:2,minZoom:void 0,maxZoom:void 0,enableOptimize:!1,optimizeZoom:.1,fixSelectedItems:{fixAll:!1,fixLineWidth:!1,fixLabel:!1,fixState:"selected"},animate:!1,animateCfg:{duration:500}}},getEvents:function(){var t=this.fixSelectedItems;return t.fixState||(t.fixState="selected"),t.fixAll&&(t.fixLineWidth=!0,t.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(t){var e=t.originalEvent.touches,r=e[0],n=e[1];t.preventDefault(),!!n&&(this.shouldBegin&&!this.shouldBegin(t,this)||(this.startPoint={pageX:r.pageX,pageY:r.pageY},this.moveable=!0,n&&(this.endPoint={pageX:n.pageX,pageY:n.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(t){if(!!this.moveable){t.preventDefault();var e=t.originalEvent.touches,r=e[0],n=e[1];if(!!n){this.endPoint||(this.endPoint={pageX:n.pageX,pageY:n.pageY});var a=function(Z,ee){return Math.hypot(ee.x-Z.x,ee.y-Z.y)},i=a({x:r.pageX,y:r.pageY},{x:n.pageX,y:n.pageY})/a({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),o=this.originScale*i;this.currentScale=o;var s=this.get("minZoom")||this.graph.get("minZoom"),l=this.get("maxZoom")||this.graph.get("maxZoom");if(!(o>l||oI?p=I:pn/2?h-=D.width:h+=this.offset,p>a/2?p-=D.height:p+=this.offset;var I="".concat(h,"px"),F="".concat(p,"px");(0,Kn.Z)(this.container,{left:I,top:F,visibility:"visible"})},createTooltip:function(t){var e=t.get("el");e.style.position="relative";var r=(0,Aa.Z)('
    '));return e.parentNode.appendChild(r),(0,Kn.Z)(r,{position:"absolute",visibility:"visible"}),this.width=t.get("width"),this.height=t.get("height"),this.container=r,this.graph.get("tooltips").push(r),r}},fv=(0,b.__assign)({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(e){return e.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},Rd),cv=(0,b.__assign)({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(e){return"source: ".concat(e.source," target: ").concat(e.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},Rd),Bd="click",lv=["click","dblclick"],dv={getDefaultCfg:function(){return{trigger:Bd,onChange:function(){}}},getEvents:function(){var t,e;return lv.includes(this.trigger)?e=this.trigger:(e=Bd,console.warn("Behavior collapse-expand \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click' \u6216 'dblclick'")),t={},t["node:".concat(e)]="onNodeClick",t.touchstart="onNodeClick",t},onNodeClick:function(t){var e=this;if(this.trigger==="click"){if(this.timer){clearTimeout(this.timer),this.timer=0;return}this.timer=setTimeout(function(){e.toggle(t),clearTimeout(e.timer),e.timer=0},200)}else this.toggle(t)},toggle:function(t){var e=t.item;if(!!e){var r=this.graph.findDataById(e.get("id"));if(!!r){var n=r.children;if(!(!n||n.length===0)){var a=!r.collapsed;!this.shouldBegin(t,a,this)||(r.collapsed=a,e.getModel().collapsed=a,this.graph.emit("itemcollapsed",{item:t.item,collapsed:a}),!!this.shouldUpdate(t,a,this)&&(this.onChange(e,a,this),this.graph.layout()))}}}}},hv=Vo.calculationItemsBBox,vv=function c(t,e){if(e(t)!==!1&&t){var r=t.get("combos");if(r.length===0)return!1;(0,m.each)(r,function(n){c(n,e)})}},gv={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected",enableStack:!0}},getEvents:function(){return{"combo:mousedown":"onMouseDown","combo:dragstart":"onDragStart","combo:drag":"onDrag","combo:dragend":"onDragEnd","combo:drop":"onDrop","node:drop":"onNodeDrop","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave"}},validationCombo:function(t){var e=t.item;if(!e||e.destroyed||!this.shouldUpdate(t,this))return!1;var r=e.getType();return r==="combo"},onMouseDown:function(t){this.origin={x:t.x,y:t.y}},onDragStart:function(t){var e=this,r=this.graph,n=t.item;if(this.currentShouldEnd=!0,!!this.validationCombo(t)){this.targets=[];var a=r.findAllByState("combo",this.selectedState),i=n.get("id"),o=a.filter(function(l){var h=l.get("id");return i===h});o.length===0?this.targets.push(n):this.targets=a;var s=[];this.targets.forEach(function(l){var h=l.getModel(),p=h.x,D=h.y,I=h.id;s.push({x:p,y:D,id:I})}),this.set("beforeDragItems",s),this.activeState&&this.targets.map(function(l){var h=l.getModel();if(h.parentId){var p=r.findById(h.parentId);p&&r.setItemState(p,e.activeState,!0)}}),this.point={},this.originPoint={},this.currentItemChildCombos=[],vv(n,function(l){if(l.destroyed)return!1;var h=l.getModel();return e.currentItemChildCombos.push(h.id),!0})}},onDrag:function(t){var e=this;if(!!this.origin&&!!this.validationCombo(t))if(this.enableDelegate)this.updateDelegate(t);else{if(this.activeState){var r=this.graph,n=t.item,a=n.getModel(),i=r.getCombos(),o=n.getBBox(),s=o.centerX,l=o.centerY,h=o.width,p=i.filter(function(D){var I=D.getModel();return a.parentId,I.id!==a.id&&!e.currentItemChildCombos.includes(I.id)});p.map(function(D){var I=D.getBBox(),F=I.centerX,Z=I.centerY,ee=I.width,se=s-F,oe=l-Z,ce=2*Math.sqrt(se*se+oe*oe);h+ee-ce>.8*h?r.setItemState(D,e.activeState,!0):r.setItemState(D,e.activeState,!1)})}(0,m.each)(this.targets,function(D){e.updateCombo(D,t)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(t,e){var r=this;(this.enableDelegate||e)&&(0,m.each)(this.targets,function(n){r.updateCombo(n,t,e)})},onDrop:function(t){var e=this,r=t.item;if(this.currentShouldEnd=this.shouldEnd(t,r,this),this.updatePositions(t,!this.currentShouldEnd),!(!this.currentShouldEnd||!r||!this.targets||r.destroyed)){var n=this.graph,a=r.getModel();this.targets.map(function(i){var o=i.getModel();o.parentId!==a.id?(e.activeState&&n.setItemState(r,e.activeState,!1),e.onlyChangeComboSize?n.updateCombo(i):n.updateComboTree(i,a.id,!1)):n.updateCombo(r)}),this.end(r,t),this.endComparison=!0}},onNodeDrop:function(t){var e=this;if(!(!this.targets||this.targets.length===0)){var r=this.graph,n=t.item,a=n.getModel().comboId,i=a?r.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(t,i,this),this.updatePositions(t,!this.currentShouldEnd),!!this.currentShouldEnd){var o;if(a){if(this.activeState){var s=r.findById(a);r.setItemState(s,this.activeState,!1)}this.targets.map(function(l){e.onlyChangeComboSize?r.updateCombo(l):a!==l.getID()&&(o=r.findById(a),a!==l.getModel().parentId&&r.updateComboTree(l,a,!1))})}else this.targets.map(function(l){if(e.onlyChangeComboSize)r.updateCombo(l);else{var h=l.getModel();h.comboId&&r.updateComboTree(l,void 0,!1)}});this.endComparison=!0,this.end(o,t)}}},onDragEnter:function(t){if(!!this.origin&&!!this.validationCombo(t)){var e=t.item,r=this.graph;this.activeState&&r.setItemState(e,this.activeState,!0)}},onDragLeave:function(t){if(!!this.origin&&!!this.validationCombo(t)){var e=t.item,r=this.graph;this.activeState&&r.setItemState(e,this.activeState,!1)}},onDragEnd:function(t){if(!(!this.targets||this.targets.length===0)){var e=t.item;this.currentShouldEnd&&this.updatePositions(t);var r=this.getParentCombo(e.getModel().parentId),n=this.graph;r&&this.activeState&&n.setItemState(r,this.activeState,!1),this.end(void 0,t)}},end:function(t,e){var r=this;if(!!this.origin){var n=this.graph;if(this.delegateShape){var a=n.get("delegateGroup");a.clear(),this.delegateShape=null}if(t&&this.activeState&&n.setItemState(t,this.activeState,!1),!t){var i=n.get("enabledStack")&&this.enableStack,o={before:{nodes:[],edges:[],combos:[].concat(this.get("beforeDragItems"))},after:{nodes:[],edges:[],combos:[]}};this.targets.map(function(s){if(!r.onlyChangeComboSize)n.updateComboTree(s,void 0,i);else{n.updateCombo(s);var l=s.getModel(),h=l.x,p=l.y,D=l.id;o.after.combos.push({x:h,y:p,id:D}),n.pushStack("update",o)}})}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(t,e,r){var n=this;if(r===void 0&&(r={}),e(t,r)!==!1&&t){var a=t.get("combos");(0,m.each)(a,function(o){n.traverse(o,e,r)});var i=t.get("nodes");(0,m.each)(i,function(o){n.traverse(o,e,r)})}},updateCombo:function(t,e,r){this.updateSingleItem(t,e,r);var n={};this.traverse(t,function(a,i){return a.destroyed?!1:(a.getEdges().forEach(function(o){return i[o.getID()]=o}),!0)},n),Object.values(n).forEach(function(a){return a.refresh()})},updateSingleItem:function(t,e,r){var n=this.origin,a=this.graph,i=t.getModel(),o=t.get("id");this.point[o]||(this.point[o]={x:i.x,y:i.y});var s=e.x-n.x+this.point[o].x,l=e.y-n.y+this.point[o].y;r&&(s+=n.x-e.x,l+=n.y-e.y),a.updateItem(t,{x:s,y:l},!1)},getParentCombo:function(t){var e=this.graph;if(!!t){var r=e.findById(t);if(!!r)return r}},updateDelegate:function(t){var e=this.graph;if(this.delegateShape){var D=t.x-this.origin.x+this.originPoint.minX,I=t.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:D,y:I})}else{var r=e.get("delegateGroup"),n=null;this.targets.length>1?n=hv(this.targets):n=this.targets[0].getBBox();var a=n.x,i=n.y,o=n.width,s=n.height,l=n.minX,h=n.minY;this.originPoint={x:a,y:i,width:o,height:s,minX:l,minY:h};var p=(0,b.__assign)((0,b.__assign)({},wo.delegateStyle),this.delegateStyle);this.delegateShape=r.addShape("rect",{attrs:(0,b.__assign)({width:n.width,height:n.height,x:n.x,y:n.y},p),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var t=this,e=t.graph,r=t.targets,n={};r==null||r.forEach(function(a){var i=a.getModel().parentId;i&&(n[i]=e.findById(i))}),Object.values(n).forEach(function(a){a&&e.updateCombo(a)})}},Fd="dblclick",pv=["click","dblclick"],yv={getDefaultCfg:function(){return{trigger:Fd,relayout:!0}},getEvents:function(){var t,e;return pv.includes(this.trigger)?e=this.trigger:(e=Fd,console.warn("Behavior collapse-expand-group \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click' \u6216 'dblclick'")),t={},t["combo:".concat(e)]="onComboClick",t},onComboClick:function(t){var e=t.item,r=this,n=r.graph,a=r.relayout;if(!(!e||e.destroyed||e.getType()!=="combo")){var i=e.getModel(),o=i.id;!o||(n.collapseExpandCombo(o),a&&n.get("layout")?n.layout():n.refreshPositions())}}},mv=Vo.isPolygonsIntersect,Ev=Vo.pathToPoints,Gd="shift",bv=["drag","shift","ctrl","alt","control"],xv=function(t,e){var r,n=t.getKeyShape();if(t.get("type")==="path")r=Ev(n.attr("path"));else{var a=n.getCanvasBBox();r=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]]}return mv(e,r)},wv={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:Gd,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return bv.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=Gd,console.warn("Behavior lasso-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),this.trigger==="drag"?{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd","canvas:click":"clearStates"}:{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd",keyup:"onKeyUp",keydown:"onKeyDown","canvas:click":"clearStates"}},onDragStart:function(t){var e=this.lasso,r=t.item;r||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates("dragstart"),e||(e=this.createLasso()),this.dragging=!0,this.originPoint={x:t.x,y:t.y},this.points.push(this.originPoint),e.show())},onDragMove:function(t){!this.dragging||this.trigger!=="drag"&&!this.keydown||(this.points.push({x:t.x,y:t.y}),this.updateLasso(t))},onDragEnd:function(t){!this.lasso&&!this.dragging||this.trigger!=="drag"&&!this.keydown||(this.points.push(this.originPoint),this.getSelectedItems(),this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1)},getLassoPath:function(){var t=this.points,e=[];return t.length&&(t.forEach(function(r,n){n===0?e.push(["M",r.x,r.y]):e.push(["L",r.x,r.y])}),e.push(["L",t[0].x,t[0].y])),e},clearStates:function(t){t===void 0&&(t="canvas:click");var e=this,r=e.graph,n=e.selectedState,a=e.shouldDeselect,i=r.findAllByState("node",n),o=r.findAllByState("edge",n);(!a||a({action:t,nodes:i,edges:o}))&&(i.forEach(function(s){return r.setItemState(s,n,!1)}),o.forEach(function(s){return r.setItemState(s,n,!1)})),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],r.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var t=this,e=this,r=e.graph,n=e.shouldUpdate,a=this.points.map(function(h){return[r.getCanvasByPoint(h.x,h.y).x,r.getCanvasByPoint(h.x,h.y).y]}),i=this.selectedState,o=[],s=[];r.getNodes().forEach(function(h){if(!!h.isVisible()&&xv(h,a)&&n(h,"select",t)){o.push(h);var p=h.getModel();s.push(p.id),r.setItemState(h,i,!0)}});var l=[];this.includeEdges&&o.forEach(function(h){var p=h.getOutEdges();p.forEach(function(D){if(!!D.isVisible()){var I=D.getModel(),F=I.source,Z=I.target;s.includes(F)&&s.includes(Z)&&n(D,"select",t)&&(l.push(D),r.setItemState(D,t.selectedState,!0))}})}),this.selectedEdges=l,this.selectedNodes=o,this.onSelect&&this.onSelect(o,l),r.emit("nodeselectchange",{selectedItems:{nodes:o,edges:l},select:!0})},createLasso:function(){var t=this,e=t.graph.get("delegateGroup").addShape("path",{attrs:(0,b.__assign)({path:[]},t.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=e,this.delegate=e,this.points=[],e},updateLasso:function(t){var e=this;this.lasso.attr({path:e.getLassoPath()})},onKeyDown:function(t){var e=t.key;!e||(e.toLowerCase()===this.trigger.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.lasso&&(this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1),this.keydown=!1}},zd="click",Sv=["click","drag"],Ud=void 0,_v=["shift","ctrl","control","alt","meta",void 0],Mv={getDefaultCfg:function(){return{trigger:zd,key:Ud,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var t=this;Sv.indexOf(t.trigger.toLowerCase())>-1||(t.trigger=zd,console.warn("Behavior create-edge \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click'\uFF0C'drag'")),t.key&&_v.indexOf(t.key.toLowerCase())===-1&&(t.trigger=Ud,console.warn("Behavior create-edge \u7684 key \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'shift'\uFF0C'ctrl'\uFF0C'alt'\uFF0C'control'\uFF0C\u6216 undefined"));var e;return t.trigger==="drag"?e={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:t.trigger==="click"&&(e={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),t.key&&(e.keydown="onKeyDown",e.keyup="onKeyUp"),e},onDragEnd:function(t){var e=this;if(!(e.key&&!e.keydown)){var r=t.item;(!r||r.getID()===e.source||r.getType()!=="node")&&e.cancelCreating({item:e.edge,x:t.x,y:t.y})}},onClick:function(t){var e=this;if(!(e.key&&!e.keydown)){var r=t.item,n=e.graph,a=r.getModel(),i=e.getEdgeConfig;if(e.addingEdge&&e.edge){if(!e.shouldEnd(t,e))return;var o=void 0;i&&(0,m.isFunction)(i)?o=i({source:e.source,target:a.id},e):o=e.edgeConfig;var s=(0,b.__assign)({target:a.id},o);if(e.source===a.id&&(s.type="loop"),n.emit("beforecreateedge",{}),n.updateItem(e.edge,s,!1),n.get("enabledStack")){var l=(0,b.__assign)((0,b.__assign)({},e.edge.getModel()),{itemType:"edge"}),h={};h.edges=[l],n.pushStack("add",{before:{},after:h})}n.emit("aftercreateedge",{edge:e.edge}),e.edge.getKeyShape().set("capture",!0),e.edge=null,e.addingEdge=!1}else{if(!e.shouldBegin(t,e))return;var o=void 0;i&&(0,m.isFunction)(i)?o=i({source:a.id,target:a.id},e):o=e.edgeConfig,e.edge=n.addItem("edge",(0,b.__assign)({source:a.id,target:a.id},o),!1),e.source=a.id,e.addingEdge=!0,e.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(t){var e=this;if(!(e.key&&!e.keydown)){e.edge&&e.edge.destroyed&&e.cancelCreating({item:e.edge});var r={x:t.x,y:t.y};if(!e.graph.findById(e.source)){e.addingEdge=!1;return}e.addingEdge&&e.edge&&e.graph.updateItem(e.edge,{target:r},!1)}},cancelCreating:function(t){var e,r,n=this;if(!(n.key&&!n.keydown)){var a=n.graph,i=t.item;if(n.addingEdge&&(n.edge===i||((r=(e=t.target)===null||e===void 0?void 0:e.isCanvas)===null||r===void 0?void 0:r.call(e)))){n.edge&&!n.edge.destroyed&&a.removeItem(n.edge,!1),n.edge=null,n.addingEdge=!1;return}}},onKeyDown:function(t){var e=this,r=t.key;!r||(r.toLowerCase()===e.key.toLowerCase()?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){var t=this;t.addingEdge&&t.edge&&(t.graph.removeItem(t.edge,!1),t.addingEdge=!1,t.edge=null),this.keydown=!1}},Wd="ctrl",Cv=["shift","ctrl","alt","control"],Tv="1",Iv={getDefaultCfg:function(){return{trigger:Wd,combinedKey:Tv,functionName:"fitView",functionParams:[]}},getEvents:function(){return Cv.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=Wd,console.warn("Behavior shortcuts-fit-view \u7684 trigger \u53C2\u6570 '".concat(this.trigger,"' \u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'"))),this.combinedKey===this.trigger&&(this.combinedKey=void 0),{keyup:"onKeyUp",keydown:"onKeyDown"}},onKeyDown:function(t){var e=t.key;if(!!e){var r=this.trigger.toLowerCase(),n=e.toLowerCase();this.triggerKeydown||(n===r||n==="control"&&r==="ctrl"||n==="ctrl"&&r==="control"?this.triggerKeydown=!0:this.triggerKeydown=!1);var a=this.graph;if(!a[this.functionName])return console.warn("Behavior shortcuts-fit-view \u7684 functionName \u53C2\u6570 '".concat(this.functionName,"' \u4E0D\u5408\u6CD5\uFF0C\u5B83\u4E0D\u662F Graph \u7684\u4E00\u4E2A\u51FD\u6570\u540D")),{};if(this.triggerKeydown&&!this.combinedKey){this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]();return}var i=this.combinedKey.toLowerCase();this.triggerKeydown&&(n===i||n==="control"&&i==="ctrl"||n==="ctrl"&&i==="control")&&(this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]())}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}},Ov=["shift","ctrl","alt","control","meta"],Av={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return(!this.zoomKey||Ov.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(t){var e=this;if(!!this.allowDrag(t)){var r=this.graph,n=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];n.includes("control")&&n.push("ctrl");var a=n.some(function(mr){return t["".concat(mr,"Key")]});if(a){var i=r.get("canvas"),o=i.getPointByClient(t.clientX,t.clientY),s=r.getZoom();t.wheelDelta>0?s=s+s*.05:s=s-s*.05,r.zoomTo(s,{x:o.x,y:o.y})}else{var l=t.deltaX||t.movementX,h=t.deltaY||t.movementY;!h&&navigator.userAgent.indexOf("Firefox")>-1&&(h=-t.wheelDelta*125/3);var p=this.graph.get("width"),D=this.graph.get("height"),I=this.graph.get("canvas").getCanvasBBox(),F=this.scalableRange,Z=this.scalableRange;F<1&&F>-1&&(F=p*F,Z=D*Z);var ee=I.minX,se=I.maxX,oe=I.minY,ce=I.maxY;l>0?se<-F?l=0:se-l<-F&&(l=se+F):l<0&&(ee>p+F?l=0:ee-l>p+F&&(l=ee-(p+F))),h>0?ce<-Z?h=0:ce-h<-Z&&(h=ce+Z):h<0&&(oe>D+Z?h=0:oe-h>D+Z&&(h=oe-(D+Z))),this.get("direction")==="x"?h=0:this.get("direction")==="y"&&(l=0),r.translate(-l,-h)}t.preventDefault();var we=this.get("enableOptimize");if(we){var Re=this.get("optimizeZoom"),Oe=this.get("optimized"),Pe=r.getNodes(),He=r.getEdges(),at=Pe.length,qe=He.length;if(!Oe){for(var yt=0;yt=2})}},Ul=function(){return Ul=Object.assign||function(c){for(var t,e=1,r=arguments.length;ea&&(a=n[o],i=o);return i},Jd=function(c,t,e){var r,n;return e&&e.current&&(r=e.current.offsetWidth,n=e.current.offsetHeight||500),!c&&!r||!t&&!n?(Al.warn("\u8BF7\u4E3A Graph \u6307\u5B9A width \u4E0E height\uFF01\u5426\u5219\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C 500 * 500"),[500,500]):[c||r||500,t||n||500]},Jv=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var t=Math.random()*16|0,e=c=="x"?t:t&3|8;return e.toString(16)})},qv=function(c,t){return c.current||(c.current="".concat(t,"-graph-").concat(Jv())),c.current},eg=function(c,t){var e=t!=null?t:{},r=e.nodeCfg,n=r===void 0?{}:r,a=e.edgeCfg,i=a===void 0?{}:a,o=n.nodeStateStyles,s=i.edgeStateStyles,l={},h=function(I,F,Z){c.updateItem(I,{style:{endArrow:!!F&&{fill:F},startArrow:!!Z&&{fill:Z}}})},p=function(I,F,Z){var ee,se,oe;Z?I.toFront():I.toBack();var ce=(ee=I.getModel().style)!==null&&ee!==void 0?ee:{},we=ce.endArrow,Re=ce.startArrow;if(we||Re){if(!l[I.getID()]){var Oe=(we!=null?we:{}).fill,Pe=(Re!=null?Re:{}).fill,He=(oe=(se=I.getModel().style)===null||se===void 0?void 0:se[F])===null||oe===void 0?void 0:oe.stroke;l[I.getID()]=[[He!=null?He:Oe,Oe],[He!=null?He:Pe,Pe]]}var at=l[I.getID()];h(I,we&&at[0][Z?0:1],Re&&at[1][Z?0:1])}c.setItemState(I,F,Z)},D=function(I,F,Z,ee){var se=ee==="node"?c.findAll("edge",function(ce){return ce.getSource()===I||ce.getTarget()===I}):c.findAll("node",function(ce){return I.getSource().get("id")===ce.get("id")||I.getTarget().get("id")===ce.get("id")}),oe=[I].concat(se);oe.forEach(function(ce){p(ce,F,Z)})};o&&(c.on("node:mouseenter",function(I){var F=I.item;D(F,"hover",!0,"node")}),c.on("node:mouseleave",function(I){var F=I.item;D(F,"hover",!1,"node")})),s&&(c.on("edge:mouseenter",function(I){var F=I.item;D(F,"hover",!0,"edge")}),c.on("edge:mouseleave",function(I){var F=I.item;D(F,"hover",!1,"edge")}))},Xl=function(){return Xl=Object.assign||function(c){for(var t,e=1,r=arguments.length;e0&&a[a.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]=18&&(Vl=Dl.createRoot)}catch(c){}function rh(c){var t=Dl.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;t&&typeof t=="object"&&(t.usingClientEntryPoint=c)}var Yl="__rc_react_root__";function sg(c,t){rh(!0);var e=t[Yl]||Vl(t);rh(!1),e.render(c),t[Yl]=e}function ug(c,t){ag(c,t)}function vp(c,t){}function nh(c,t){if(Vl){sg(c,t);return}ug(c,t)}function fg(c){return eh(this,void 0,void 0,function(){return th(this,function(t){return[2,Promise.resolve().then(function(){var e;(e=c[Yl])===null||e===void 0||e.unmount(),delete c[Yl]})]})})}function cg(c){ig(c)}function gp(c){}function pp(c){return eh(this,void 0,void 0,function(){return th(this,function(t){return Vl!==void 0?[2,fg(c)]:(cg(c),[2])})})}var ah=function(c,t){t===void 0&&(t={});var e=Object.keys(t);e.forEach(function(r){c.style[r]=t[r]})},cd=function(c,t,e){t===void 0&&(t={});var r=document.createElement("div");return Object.keys(t).forEach(function(n){r[n]=t[n]}),e&&ah(r,e),nh(c,r),r},Hl=function(){return Hl=Object.assign||function(c){for(var t,e=1,r=arguments.length;e0){var r=c.customContent,n=lg(c,["customContent"]),a=new sc.Tooltip(Hl(Hl({offsetX:10,offsetY:20,itemTypes:["node"]},n),{getContent:function(i){return(0,m.isFunction)(r)?cd(r(i.item.getModel()),{className:"g6-tooltip"}):""},name:"tooltip"}));t.addPlugin(a)}}},hg=function(){function c(t){this._cfgs=(0,m.deepMix)(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return c.prototype.getDefaultCfgs=function(){return{}},c.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var r=e.getEvents(),n={};(0,m.each)(r,function(a,i){var o=(0,m.wrapBehavior)(e,a);n[i]=o,t.on(i,o)}),this._events=n,this.init()},c.prototype.getEvents=function(){return{}},c.prototype.get=function(t){var e;return(e=this._cfgs)===null||e===void 0?void 0:e[t]},c.prototype.set=function(t,e){this._cfgs[t]=e},c.prototype.destroy=function(){},c.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;(0,m.each)(e,function(r,n){t.off(n,r)}),this._events=null,this._cfgs=null,this.destroyed=!0},c}(),vg=hg,gg=function(){var c=function(t,e){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},c(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");c(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();typeof document!="undefined"&&pi()(` .g6-component-contextmenu { border: 1px solid #e2e2e2; border-radius: 4px; font-size: 12px; color: #545454; background-color: rgba(255, 255, 255, 0.9); padding: 10px 8px; box-shadow: rgb(174, 174, 174) 0px 0px 10px; } .g6-contextmenu-ul { padding: 0; margin: 0; list-style: none; } `);var pg=function(c){gg(t,c);function t(e){return c.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,customContent:function(e){return`
    • \u83DC\u5355\u98791
    • \u83DC\u5355\u98792
    `},shouldBegin:function(e){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},t.prototype.getEvents=function(){return this.get("trigger")==="click"?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},t.prototype.init=function(){var e=this.get("className"),r=(0,Aa.Z)("
    "));(0,Kn.Z)(r,{top:"0px",position:"absolute",visibility:"hidden"});var n=this.get("container");n||(n=this.get("graph").get("container")),(0,m.isString)(n)&&(n=document.getElementById(n)),n.appendChild(r),this.set("menu",r)},t.prototype.onMenuShow=function(e){var r=this;e.preventDefault();var n=this.get("itemTypes");if(e.item){if(e.item&&e.item.getType&&n.indexOf(e.item.getType())===-1){r.onMenuHide();return}}else if(n.indexOf("canvas")===-1){r.onMenuHide();return}var a=this.get("shouldBegin");if(!!a(e)){var i=this.get("menu"),o=this.get("customContent"),s=this.get("graph"),l=o(e,s);nh(l,i),this.removeMenuEventListener();var h=this.get("handleMenuClick");if(h){var p=function(Pe){h(Pe.target,e.item,s)};this.set("handleMenuClickWrapper",p),i.addEventListener("click",p)}var D=s.get("width"),I=s.get("height"),F=i.getBoundingClientRect(),Z=this.get("offsetX")||0,ee=this.get("offsetY")||0,se=s.getContainer().offsetTop,oe=s.getContainer().offsetLeft,ce=e.canvasX+oe+Z,we=e.canvasY+se+ee;ce+F.width>D&&(ce=e.canvasX-F.width-Z+oe),we+F.height>I&&(we=e.canvasY-F.height-ee+se),(0,Kn.Z)(i,{top:"".concat(we,"px"),left:"".concat(ce,"px"),visibility:"visible"});var Re=this.get("trigger")==="click",Oe=function(Pe){if(Re){Re=!1;return}r.onMenuHide()};document.body.addEventListener("click",Oe),this.set("handler",Oe)}},t.prototype.removeMenuEventListener=function(){var e=this.get("handleMenuClickWrapper"),r=this.get("handler");if(e){var n=this.get("menu");n.removeEventListener("click",e),this.set("handleMenuClickWrapper",null)}r&&document.body.removeEventListener("click",r)},t.prototype.onMenuHide=function(){var e=this.get("menu");e&&(0,Kn.Z)(e,{visibility:"hidden"}),this.removeMenuEventListener()},t.prototype.destroy=function(){var e=this.get("menu");if(this.removeMenuEventListener(),e){var r=this.get("container");r||(r=this.get("graph").get("container")),(0,m.isString)(r)&&(r=document.getElementById(r)),r.removeChild(e)}},t}(vg),yg=pg,Zl=function(){return Zl=Object.assign||function(c){for(var t,e=1,r=arguments.length;e0&&a[a.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]0?(s.children=se,t.updateChild(s,s.id),t.updateItem(o,{collapsed:!1}),t.refreshItem(o),t.emit(oh,i,{type:"fetch",collapsed:!0})):(t.updateItem(o,{collapsed:!h}),t.layout(),t.emit(oh,i,{type:"collapse",collapsed:!!h})),we.label=3;case 3:return[2]}})})};t.on("node:click",function(i){a(i)}),t.on("node:touchstart",function(i){a(i)})},kg=function(c){if(typeof c=="number")return[c,c,c,c];var t=[];switch(c.length){case 1:t=[c[0],c[0],c[0],c[0]];break;case 2:t=[c[0],c[1],c[0],c[1]];break;case 3:t=[c[0],c[1],c[2],c[1]];break;case 4:t=c;break;default:break}return t},sh=function(c,t,e,r){return typeof c=="function"?c(t,e,r)||{}:c||{}},Pl=function(){return Pl=Object.assign||function(c){for(var t,e=1,r=arguments.length;e0&&m(te[0])}},H=0;H0;)b.push(E.pop());d.push(b)}}return d};U.detectConnectedComponents=j;var R=function(L){for(var y=L.nodes,x=y===void 0?[]:y,v=L.edges,g=v===void 0?[]:v,d=[],_={},E={},w={},T=[],k=0,b=function X(H){E[H.id]=k,w[H.id]=k,k+=1,d.push(H),_[H.id]=!0;for(var Q=(0,B.getNeighbors)(H.id,g,"target").filter(function(de){return x.map(function(Te){return Te.id}).indexOf(de)>-1}),q=function(Te){var Se=Q[Te];if(!E[Se]&&E[Se]!==0){var Ie=x.filter(function(be){return be.id===Se});Ie.length>0&&X(Ie[0]),w[H.id]=Math.min(w[H.id],w[Se])}else _[Se]&&(w[H.id]=Math.min(w[H.id],E[Se]))},J=0;J0;){var fe=d.pop();if(_[fe.id]=!1,te.push(fe),fe===H)break}te.length>0&&T.push(te)}},m=0,$=x;m<$.length;m++){var W=$[m];!E[W.id]&&E[W.id]!==0&&b(W)}return T};U.detectStrongConnectComponents=R;function A(N,L){return L?R(N):j(N)}},92935:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.secondReg=U.dateReg=void 0;var z=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;U.secondReg=z;var B=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;U.dateReg=B},82556:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.getOutDegree=U.getInDegree=U.default=void 0;var z=function(N){var L={},y=N.nodes,x=y===void 0?[]:y,v=N.edges,g=v===void 0?[]:v;return x.forEach(function(d){L[d.id]={degree:0,inDegree:0,outDegree:0}}),g.forEach(function(d){L[d.source].degree++,L[d.source].outDegree++,L[d.target].degree++,L[d.target].inDegree++}),L},B=z;U.default=B;var j=function(N,L){var y=z(N);return y[L]?z(N)[L].inDegree:0};U.getInDegree=j;var R=function(N,L){var y=z(N);return y[L]?z(N)[L].outDegree:0};U.getOutDegree=R},94282:function(or,U,z){"use strict";function B(E){return B=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},B(E)}Object.defineProperty(U,"__esModule",{value:!0}),U.detectAllUndirectedCycle=U.detectAllDirectedCycle=U.detectAllCycles=U.default=void 0;var j=y(z(45891)),R=L(z(59527)),A=z(70643);function N(E){if(typeof WeakMap!="function")return null;var w=new WeakMap,T=new WeakMap;return(N=function(b){return b?T:w})(E)}function L(E,w){if(!w&&E&&E.__esModule)return E;if(E===null||B(E)!=="object"&&typeof E!="function")return{default:E};var T=N(w);if(T&&T.has(E))return T.get(E);var k={},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var m in E)if(m!=="default"&&Object.prototype.hasOwnProperty.call(E,m)){var $=b?Object.getOwnPropertyDescriptor(E,m):null;$&&($.get||$.set)?Object.defineProperty(k,m,$):k[m]=E[m]}return k.default=E,T&&T.set(E,k),k}function y(E){return E&&E.__esModule?E:{default:E}}var x=function(w){var T=null,k=w.nodes,b=k===void 0?[]:k,m={},$={},W={},X={};b.forEach(function(q){$[q.id]=q});for(var H={enter:function(J){var te=J.current,fe=J.previous;if(W[te]){T={};for(var de=te,Te=fe;Te!==te;)T[de]=Te,de=Te,Te=m[Te];T[de]=Te}else W[te]=te,delete $[te],m[te]=fe},leave:function(J){var te=J.current;X[te]=te,delete W[te]},allowTraversal:function(J){var te=J.next;return T?!1:!X[te]}};Object.keys($).length;){var Q=Object.keys($)[0];(0,j.default)(w,Q,H)}return T},v=function(w,T,k){var b,m;k===void 0&&(k=!0);for(var $=[],W=(0,R.default)(w,!1),X=0,H=W;X0;)for(var Te=te.pop(),Se=Te.id,Ie=(0,A.getNeighbors)(Se,w.edges),be=function(De){var Ue,nt=Ie[De],Ze=w.nodes.find(function(St){return St.id===nt});if(nt===Se)$.push((Ue={},Ue[nt]=Te,Ue));else if(!(nt in de))fe[nt]=Te,te.push(Ze),de[nt]=new Set([Te]);else if(!de[Se].has(Ze)){for(var ht=!0,Rt=[Ze,Te],tr=fe[Se];de[nt].size&&!de[nt].has(tr)&&(Rt.push(tr),tr!==fe[tr.id]);)tr=fe[tr.id];if(Rt.push(tr),T&&k?(ht=!1,Rt.findIndex(function(St){return T.indexOf(St.id)>-1})>-1&&(ht=!0)):T&&!k&&Rt.findIndex(function(St){return T.indexOf(St.id)>-1})>-1&&(ht=!1),ht){for(var Qe={},lt=1;lt0;){var lt=Qe.pop();m.has(lt)&&(m.delete(lt),$[lt.id].forEach(function(St){Qe.push(St)}),$[lt.id].clear())}},q=function Rt(tr,Qe,lt){var St=!1;if(T&&k===!1&&T.indexOf(tr.id)>-1)return St;b.push(tr),m.add(tr);for(var Ct=lt[tr.id],_t=0;_t-1});Bt-1)?W.push((Qe={},Qe[ft.id]=ft,Qe)):Vt[ft.id].push(H[br])}}return{component:xr,adjList:Vt,minIdx:St}},be=0;be=be}),Me=(0,R.detectStrongConnectComponents)({nodes:pe,edges:w.edges}).filter(function(Rt){return Rt.length>1});if(Me.length===0)break;var De=Ie(Me),Ue=De.minIdx,nt=De.adjList,Ze=De.component;if(Ze.length>1){Ze.forEach(function(Rt){$[Rt.id]=new Set});var ht=X[Ue];if(T&&k&&T.indexOf(ht.id)===-1)return W;q(ht,ht,nt),be=Ue+1}else break}return W};U.detectAllDirectedCycle=g;var d=function(w,T,k,b){return b===void 0&&(b=!0),T?g(w,k,b):v(w,k,b)};U.detectAllCycles=d;var _=x;U.default=_},45891:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=A;var B=z(70643);function j(N){N===void 0&&(N={});var L=N,y=function(){},x=function(){var v={};return function(g){var d=g.next;return v[d]?!1:(v[d]=!0,!0)}}();return L.allowTraversal=N.allowTraversal||x,L.enter=N.enter||y,L.leave=N.leave||y,L}function R(N,L,y,x){x.enter({current:L,previous:y});var v=N.edges,g=v===void 0?[]:v;(0,B.getNeighbors)(L,g,"target").forEach(function(d){x.allowTraversal({previous:y,current:L,next:d})&&R(N,d,L,x)}),x.leave({current:L,previous:y})}function A(N,L,y){R(N,L,"",j(y))}},78089:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=void 0;var B=z(70655),j=z(49242),R=z(70643),A=function(v,g,d){for(var _=Infinity,E,w=0;w$[Te.id]+Ue?($[De]=$[Te.id]+Ue,W[De]=[Te.id]):$[De]===$[Te.id]+Ue&&W[De].push(Te.id)})},Q=0;Q0&&k.length>0;){var $=k[k.length-1];if($.length){var W=$.shift();W&&(w.push(W),T[W]=!0,m=g?(0,j.getNeighbors)(W,E,"target"):(0,j.getNeighbors)(W,E),k.push(m.filter(function(Q){return!T[Q]})))}else{var X=w.pop();T[X]=!1,k.pop();continue}if(w[w.length-1]===v){var H=w.map(function(q){return q});b.push(H);var X=w.pop();T[X]=!1,k.pop()}}return b};U.findAllPath=N},75033:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=void 0;var B=j(z(62238));function j(N){return N&&N.__esModule?N:{default:N}}var R=function(L,y){for(var x=(0,B.default)(L,y),v=[],g=x.length,d=0;dv[d][E]+v[E][_]&&(v[d][_]=v[d][E]+v[E][_]);return v},A=R;U.default=A},21146:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=void 0;var B=z(49242),j=z(68575),R=function(){function _(E,w,T,k,b){this.fromNode=E,this.toNode=w,this.nodeEdgeNodeLabel={nodeLabel1:T||j.VACANT_NODE_LABEL,edgeLabel:k||j.VACANT_EDGE_LABEL,nodeLabel2:b||j.VACANT_NODE_LABEL}}return _.prototype.equalTo=function(E){return this.fromNode===E.formNode&&this.toNode===E.toNode&&this.nodeEdgeNodeLabel===E.nodeEdgeNodeLabel},_.prototype.notEqualTo=function(E){return!this.equalTo(E)},_}(),A=function(){function _(){this.rmpath=[],this.dfsEdgeList=[]}return _.prototype.equalTo=function(E){var w=this.dfsEdgeList.length,T=E.length;if(w!==T)return!1;for(var k=0;k=0;T--){var k=this.dfsEdgeList[T],b=k.fromNode,m=k.toNode;bJ||k.hasNode(m[q.to])||(w.labelIe;pe--){var Me=be(pe);if(Me==="break")break}if(Te){var De=E.findMinLabel(de);m.dfsEdgeList.push(new R(fe,Se,j.VACANT_NODE_LABEL,De.edgeLabel,j.VACANT_NODE_LABEL));var Ue=m.dfsEdgeList.length-1;return E.dfsCode.dfsEdgeList[Ue]!==m.dfsEdgeList[Ue]?!1:Q(de[De.edgeLabel].projected)}var nt={};Te=!1;var Ze=0;q.forEach(function(St){var Ct=new N(St),_t=E.findForwardPureEdges(k,Ct.edges[J[0]],te,Ct);_t.length>0&&(Te=!0,Ze=fe,_t.forEach(function(pt){var rr="".concat(pt.label,"-").concat(b[pt.to].label);nt[rr]||(nt[rr]={projected:[],edgeLabel:pt.label,nodeLabel2:b[pt.to].label}),nt[rr].projected.push({graphId:k.id,edge:pt,preNode:St})}))});for(var ht=J.length,Rt=function(Ct){if(Te)return"break";var _t=J[Ct];q.forEach(function(pt){var rr=new N(pt),xr=E.findForwardRmpathEdges(k,rr.edges[_t],te,rr);xr.length>0&&(Te=!0,Ze=m.dfsEdgeList[_t].fromNode,xr.forEach(function(Vt){var ft="".concat(Vt.label,"-").concat(b[Vt.to].label);nt[ft]||(nt[ft]={projected:[],edgeLabel:Vt.label,nodeLabel2:b[Vt.to].label}),nt[ft].projected.push({graphId:k.id,edge:Vt,preNode:pt})}))})},pe=0;pe=0;te--){var fe=w.findBackwardEdge(Q,J.edges[b[te]],J.edges[b[0]],J);if(fe){var de="".concat(w.dfsCode.dfsEdgeList[b[te]].fromNode,"-").concat(fe.label);X[de]||(X[de]={projected:[],toNodeId:w.dfsCode.dfsEdgeList[b[te]].fromNode,edgeLabel:fe.label}),X[de].projected.push({graphId:H.graphId,edge:fe,preNode:H})}}if(!(k>=w.maxNodeNum)){var Te=w.findForwardPureEdges(Q,J.edges[b[0]],$,J);Te.forEach(function(Ie){var be="".concat(m,"-").concat(Ie.label,"-").concat(q[Ie.to].label);W[be]||(W[be]={projected:[],fromNodeId:m,edgeLabel:Ie.label,nodeLabel2:q[Ie.to].label}),W[be].projected.push({graphId:H.graphId,edge:Ie,preNode:H})});for(var Se=function(be){var pe=w.findForwardRmpathEdges(Q,J.edges[b[be]],$,J);pe.forEach(function(Me){var De="".concat(w.dfsCode.dfsEdgeList[b[be]].fromNode,"-").concat(Me.label,"-").concat(q[Me.to].label);W[De]||(W[De]={projected:[],fromNodeId:w.dfsCode.dfsEdgeList[b[be]].fromNode,edgeLabel:Me.label,nodeLabel2:q[Me.to].label}),W[De].projected.push({graphId:H.graphId,edge:Me,preNode:H})})},te=0;teIe){var be=Ie;Ie=Se,Se=be}var pe=Te.label,Me="".concat(X,"-").concat(Se,"-").concat(pe,"-").concat(Ie),De="".concat(Se,"-").concat(pe,"-").concat(Ie);if(!m[De]){var Ue=m[De]||0;Ue++,m[De]=Ue}W[Me]={graphId:X,nodeLabel1:Se,edgeLabel:pe,nodeLabel2:Ie}})})}),Object.keys(b).forEach(function(X){var H=b[X];if(!(H2*H)););if(Ue<2*H&&(fe["".concat(Se,"-").concat(De)]={start:Se,end:De,distance:J[Se][De]},Ie++,de++,de>=Q))return fe;if(be++,be>2*H)break}if(Iebe&&(de=be);var pe=Q[Ie.id].inDegree;Te>pe&&(Te=pe);var Me=Q[Ie.id].outDegree;Se>Me&&(Se=Me)}),X[H]={degree:de,inDegree:Te,outDegree:Se}),{minPatternNodeLabelDegree:de,minPatternNodeLabelInDegree:Te,minPatternNodeLabelOutDegree:Se}},m=function(X,H,Q,q,J,te,fe){var de;if(Q===void 0&&(Q=!1),te===void 0&&(te="cluster"),fe===void 0&&(fe="cluster"),!(!X||!X.nodes)){var Te=X.nodes.length;if(!!Te){var Se=(0,j.default)(X,Q),Ie=(0,j.default)(H,Q),be=T(X.nodes,Se,Q),pe=T(H.nodes,Ie,Q),Me=E(X.nodes,te),De=Me.nodeMap,Ue=Me.nodeLabelMap,nt=E(H.nodes,te),Ze=nt.nodeMap,ht=nt.nodeLabelMap;w(X.edges,fe,De);var Rt=w(H.edges,fe,Ze).edgeLabelMap,tr=[];Ie==null||Ie.forEach(function(Zr){tr=tr.concat(Zr)}),J||(J=Math.max.apply(Math,(0,B.__spreadArray)((0,B.__spreadArray)([],tr,!1),[2],!1))),q||(q=J);var Qe=y(X,Se,te,q),lt=y(H,Ie,te,q),St=Math.min(100,Te*(Te-1)/2),Ct=v(q,Te,St,Qe,Se),_t=g(Ct,Qe,X),pt=10,rr=1,xr=1,Vt=4,ft={graphs:_t,nodeLabelProp:te,edgeLabelProp:fe,minSupport:rr,minNodeNum:xr,maxNodeNum:Vt,directed:Q},Bt=(0,R.default)(ft).slice(0,pt),qt=Bt.length,br=[];Bt.forEach(function(Zr,Pn){br[Pn]={},Object.keys(_t).forEach(function(An){var ln=_t[An],va=d(ln,Zr,te,fe);br[Pn][An]=va})});var Ur=_(br,qt,Bt),Ae=Ur.structure,Hr=Ur.structureCountMap,Sr=H.nodes[0],qr=[],Gr=(de=H.nodes[0])===null||de===void 0?void 0:de[te],vn=-Infinity;H.nodes.forEach(function(Zr){var Pn=Zr[te],An=Ue[Pn];(An==null?void 0:An.length)>vn&&(vn=An.length,qr=An,Gr=Pn,Sr=Zr)});var Gn={},mn={},$r={},gn={},Rr={},ct={};Object.keys(ht).forEach(function(Zr,Pn){Rr[Zr]=[],Q&&(ct[Zr]=[]);var An=-Infinity,ln=ht[Zr],va={};ln.forEach(function(ae){var P=pe["".concat(Sr.id,"-").concat(ae.id)];if(P&&Rr[Zr].push(P),AnRr[Zr][Ee]){xe=!0;break}if(xe)return qr.splice(P,1),"continue";var Ne={};C.neighbors.forEach(function(Pt){var $t=be["".concat(S.id,"-").concat(Pt.id)];Ne["".concat(S.id,"-").concat(Pt.id)]={start:De[S.id].idx,end:De[Pt.id].idx,distance:$t}}),_t=g(Ne,Qe,X,_t);var Et=[];Object.keys(Ne).forEach(function(Pt){if(Hr[Pt]){Et.push(Hr[Pt]);return}var $t=_t[Pt];Hr[Pt]=d($t,Ae,te,fe),Et.push(Hr[Pt])}),Et=Et.sort(function(Pt,$t){return $t-Pt});for(var st=!1,Ee=0;Ee=0;ne--)rt(ne)});var Wt=[];qr==null||qr.forEach(function(Zr){for(var Pn=De[Zr.id].idx,An=x(X.nodes,Se[Pn],Pn,te,J),ln=An.neighbors,va=ln.length,K=!1,Dt=va-1;Dt>=0;Dt--){if(ln.length+1C){ln.splice(Dt,1);continue}if(Q){var V="".concat(rt.id,"-").concat(Zr.id),he=be[V];S=ct[ne].length-1;var xe=ct[ne][S];if(he>xe){ln.splice(Dt,1);continue}}var Ee=Hr[ae]?Hr[ae]:k(X,Zr,rt,De,P,Qe,Ae,te,fe,Hr,_t),Ne="".concat(Sr.id,"-").concat(ne),Et=gn[Ne][gn[Ne].length-1];if(Ee=0;P--){var xe=he(P);if(xe==="break")break}if(V)return Wt.splice(Pn,1),"continue";An.edges=Dt;var Ee=(0,A.default)(An,An.nodes[0].id,!1).length;if(Object.keys(Ee).reverse().forEach(function(bn){if(!(bn===An.nodes[0].id||V)){if(Ee[bn]===Infinity){var je=K[bn].node[te];if(va[je]--,va[je]Dr[Xe][Dr[Xe].length-1]){var je=K[bn].node[te];if(va[je]--,va[je]=0;$t--){var Ht=An.nodes[$t],Br=K[Ht.id].degree,hn=K[Ht.id].inDegree,Ot=K[Ht.id].outDegree,Qt=Ht[te],pr=b(Gn,Qt,Ze,ht),en=pr.minPatternNodeLabelDegree,Nr=pr.minPatternNodeLabelInDegree,ta=pr.minPatternNodeLabelOutDegree,kn=Q?Br=0;En--){var Rn=Dt[En];if(!K[Rn.source]||!K[Rn.target]){Dt.splice(En,1);var Yn=Rn[fe];if(rt[Yn]--,K[Rn.source]&&(K[Rn.source].degree--,K[Rn.source].outDegree--),K[Rn.target]&&(K[Rn.target].degree--,K[Rn.target].inDegree--),Rt[Yn]&&rt[Yn]=0;wn--){var Sn=pn(wn);if(Sn==="break")break}for(var In=Wt.length,$n=function(Pn){var An=Wt[Pn],ln={};An.edges.forEach(function(Dt){var rt="".concat(Dt.source,"-").concat(Dt.target,"-").concat(Dt.label);ln[rt]?ln[rt]++:ln[rt]=1});for(var va=function(rt){var ne=Wt[rt],ae={};ne.edges.forEach(function(S){var C="".concat(S.source,"-").concat(S.target,"-").concat(S.label);ae[C]?ae[C]++:ae[C]=1});var P=!0;Object.keys(ae).length!==Object.keys(ln).length?P=!1:Object.keys(ln).forEach(function(S){ae[S]!==ln[S]&&(P=!1)}),P&&Wt.splice(rt,1)},K=In-1;K>Pn;K--)va(K);In=Wt.length},wn=0;wn<=In-1;wn++)$n(wn);return Wt}}},$=m;U.default=$},5170:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=void 0;var B=R(z(62238)),j=z(70643);function R(L){return L&&L.__esModule?L:{default:L}}var A=function(y,x,v,g){x===void 0&&(x=!1),v===void 0&&(v="weight"),g===void 0&&(g=1e3);var d=y.nodes,_=d===void 0?[]:d,E=y.edges,w=E===void 0?[]:E,T={},k={};_.forEach(function(te,fe){var de=(0,j.uniqueId)();te.clusterId=de,T[de]={id:de,nodes:[te]},k[te.id]={node:te,idx:fe}});var b=(0,B.default)(y,x),m=[],$={};b.forEach(function(te,fe){var de=0,Te=_[fe].id;$[Te]={},te.forEach(function(Se,Ie){if(!!Se){de+=Se;var be=_[Ie].id;$[Te][be]=Se}}),m.push(de)});for(var W=0,X=function(){var fe=!1;if(_.forEach(function(de){var Te={};Object.keys($[de.id]).forEach(function(nt){var Ze=$[de.id][nt],ht=k[nt].node,Rt=ht.clusterId;Te[Rt]||(Te[Rt]=0),Te[Rt]+=Ze});var Se=-Infinity,Ie=[];if(Object.keys(Te).forEach(function(nt){Se=0&&Ie.splice(be,1),Ie&&Ie.length){fe=!0;var pe=T[de.clusterId],Me=pe.nodes.indexOf(de);pe.nodes.splice(Me,1);var De=Math.floor(Math.random()*Ie.length),Ue=T[Ie[De]];Ue.nodes.push(de),de.clusterId=Ue.id}}}),!fe)return"break";W++};W0&&De>Ue&&De-UeUe&&(Ze=H.map(function(_t){return{node:_t,clusterId:_t.clusterId}}),ht=(0,B.clone)(Te),Ue=De),Rt||nt>100)break;nt++,Object.keys(Te).forEach(function(_t){var pt=0;q.forEach(function(rr){var xr=rr.source,Vt=rr.target,ft=Se[xr].node.clusterId,Bt=Se[Vt].node.clusterId;(ft===_t&&Bt!==_t||Bt===_t&&ft!==_t)&&(pt=pt+(rr[w]||1))}),Te[_t].sumTot=pt}),H.forEach(function(_t,pt){var rr=Te[_t.clusterId],xr=0,Vt,ft=be[pt]/(2*Me),Bt=0,qt=rr.nodes;qt.forEach(function(mn){var $r=Se[mn.id].idx;Bt+=Ie[pt][$r]||0});var br=Bt-rr.sumTot*ft,Ur=qt.filter(function(mn){return mn.id!==_t.id}),Ae=[];Ur.forEach(function(mn,$r){Ae[$r]=J[mn.originIndex]});var Hr=x(Ur,J)*W,Sr=pe[_t.id];if(Object.keys(Sr).forEach(function(mn){var $r=Se[mn].node,gn=$r.clusterId;if(gn!==_t.clusterId){var Rr=Te[gn],ct=Rr.nodes;if(!(!ct||!ct.length)){var Wt=0;ct.forEach(function(Sn){var In=Se[Sn.id].idx;Wt+=Ie[pt][In]||0});var Er=Wt-Rr.sumTot*ft,Dr=ct.concat([_t]),Vr=[];Dr.forEach(function(Sn,In){Vr[In]=J[Sn.originIndex]});var pn=x(Dr,J)*W,wn=Er-br;k&&(wn=Er+pn-(br+Hr)),wn>xr&&(xr=wn,Vt=Rr)}}}),xr>0){Vt.nodes.push(_t);var qr=_t.clusterId;_t.clusterId=Vt.id;var Gr=rr.nodes.indexOf(_t);rr.nodes.splice(Gr,1);var vn=0,Gn=0;q.forEach(function(mn){var $r=mn.source,gn=mn.target,Rr=Se[$r].node.clusterId,ct=Se[gn].node.clusterId;(Rr===Vt.id&&ct!==Vt.id||ct===Vt.id&&Rr!==Vt.id)&&(vn=vn+(mn[w]||1)),(Rr===qr&&ct!==qr||ct===qr&&Rr!==qr)&&(Gn=Gn+(mn[w]||1))}),Vt.sumTot=vn,rr.sumTot=Gn}})}var tr={},Qe=0;Object.keys(ht).forEach(function(_t){var pt=ht[_t];if(!pt.nodes||!pt.nodes.length){delete ht[_t];return}var rr=String(Qe+1);rr!==_t&&(pt.id=rr,pt.nodes=pt.nodes.map(function(xr){return{id:xr.id,clusterId:rr}}),ht[rr]=pt,tr[_t]=rr,delete ht[_t],Qe++)}),Ze.forEach(function(_t){var pt=_t.node,rr=_t.clusterId;!pt||(pt.clusterId=rr,pt.clusterId&&tr[pt.clusterId]&&(pt.clusterId=tr[pt.clusterId]))});var lt=[],St={};q.forEach(function(_t){var pt=_t.source,rr=_t.target,xr=_t[w]||1,Vt=Se[pt].node.clusterId,ft=Se[rr].node.clusterId;if(!(!Vt||!ft)){var Bt="".concat(Vt,"---").concat(ft);if(St[Bt])St[Bt].weight+=xr,St[Bt].count++;else{var qt={source:Vt,target:ft,weight:xr,count:1};St[Bt]=qt,lt.push(qt)}}});var Ct=[];return Object.keys(ht).forEach(function(_t){Ct.push(ht[_t])}),{clusters:Ct,clusterEdges:lt}},g=v;U.default=g},89454:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=void 0;var B=A(z(38823)),j=A(z(57085)),R=z(70643);function A(v){return v&&v.__esModule?v:{default:v}}var N=function(g,d){var _=[],E=g.nodes,w=E===void 0?[]:E,T=g.edges,k=T===void 0?[]:T;if(w.length===0)return _;var b=w[0],m=new Set;m.add(b);var $=function(J,te){return d?J.weight-te.weight:0},W=new j.default($);for((0,R.getEdgesByNodeId)(b.id,k).forEach(function(q){W.insert(q)});!W.isEmpty();){var X=W.delMin(),H=X.source,Q=X.target;m.has(H)&&m.has(Q)||(_.push(X),m.has(H)||(m.add(H),(0,R.getEdgesByNodeId)(H,k).forEach(function(q){W.insert(q)})),m.has(Q)||(m.add(Q),(0,R.getEdgesByNodeId)(Q,k).forEach(function(q){W.insert(q)})))}return _},L=function(g,d){var _=[],E=g.nodes,w=E===void 0?[]:E,T=g.edges,k=T===void 0?[]:T;if(w.length===0)return _;var b=k.map(function(H){return H});d&&b.sort(function(H,Q){return H.weight-Q.weight});for(var m=new B.default(w.map(function(H){return H.id}));b.length>0;){var $=b.shift(),W=$.source,X=$.target;m.connected(W,X)||(_.push($),m.union(W,X))}return _},y=function(g,d,_){var E={prim:N,kruskal:L};return _?E[_](g,d):L(g,d)},x=y;U.default=x},74926:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=void 0;var B=R(z(82556)),j=z(70643);function R(L){return L&&L.__esModule?L:{default:L}}var A=function(y,x,v){typeof x!="number"&&(x=1e-6),typeof v!="number"&&(v=.85);for(var g=1,d=0,_=1e3,E=y.nodes,w=E===void 0?[]:E,T=y.edges,k=T===void 0?[]:T,b=w.length,m,$={},W={},X=0;X0&&g>x;){d=0;for(var X=0;X0&&(m+=W[fe]/de)}$[Q]=v*m,d+=$[Q]}}d=(1-d)/b,g=0;for(var X=0;X0&&(this.list[0]=N,this.moveDown(0)),A},R.prototype.insert=function(A){if(A!==null){this.list.push(A);var N=this.list.length-1;return this.moveUp(N),!0}return!1},R.prototype.moveUp=function(A){for(var N=this.getParent(A);A&&A>0&&this.compareFn(this.list[N],this.list[A])>0;){var L=this.list[N];this.list[N]=this.list[A],this.list[A]=L,A=N,N=this.getParent(A)}},R.prototype.moveDown=function(A){var N,L=A,y=this.getLeft(A),x=this.getRight(A),v=this.list.length;y!==null&&y0?L=y:x!==null&&x0&&(L=x),A!==L&&(N=[this.list[L],this.list[A]],this.list[A]=N[0],this.list[L]=N[1],this.moveDown(L))},R}(),j=B;U.default=j},88481:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=U.LinkedListNode=void 0;var z=function(N,L){return N===L},B=function(){function A(N,L){L===void 0&&(L=null),this.value=N,this.next=L}return A.prototype.toString=function(N){return N?N(this.value):"".concat(this.value)},A}();U.LinkedListNode=B;var j=function(){function A(N){N===void 0&&(N=z),this.head=null,this.tail=null,this.compare=N}return A.prototype.prepend=function(N){var L=new B(N,this.head);return this.head=L,this.tail||(this.tail=L),this},A.prototype.append=function(N){var L=new B(N);return this.head?(this.tail.next=L,this.tail=L,this):(this.head=L,this.tail=L,this)},A.prototype.delete=function(N){if(!this.head)return null;for(var L=null;this.head&&this.compare(this.head.value,N);)L=this.head,this.head=this.head.next;var y=this.head;if(y!==null)for(;y.next;)this.compare(y.next.value,N)?(L=y.next,y.next=y.next.next):y=y.next;return this.compare(this.tail.value,N)&&(this.tail=y),L},A.prototype.find=function(N){var L=N.value,y=L===void 0?void 0:L,x=N.callback,v=x===void 0?void 0:x;if(!this.head)return null;for(var g=this.head;g;){if(v&&v(g.value)||y!==void 0&&this.compare(g.value,y))return g;g=g.next}return null},A.prototype.deleteTail=function(){var N=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,N;for(var L=this.head;L.next;)L.next.next?L=L.next:L.next=null;return this.tail=L,N},A.prototype.deleteHead=function(){if(!this.head)return null;var N=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),N},A.prototype.fromArray=function(N){var L=this;return N.forEach(function(y){return L.append(y)}),this},A.prototype.toArray=function(){for(var N=[],L=this.head;L;)N.push(L),L=L.next;return N},A.prototype.reverse=function(){for(var N=this.head,L=null,y=null;N;)y=N.next,N.next=L,L=N,N=y;this.tail=this.head,this.head=L},A.prototype.toString=function(N){return N===void 0&&(N=void 0),this.toArray().map(function(L){return L.toString(N)}).toString()},A}(),R=j;U.default=R},93026:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=void 0;var B=j(z(88481));function j(N){return N&&N.__esModule?N:{default:N}}var R=function(){function N(){this.linkedList=new B.default}return N.prototype.isEmpty=function(){return!this.linkedList.head},N.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},N.prototype.enqueue=function(L){this.linkedList.append(L)},N.prototype.dequeue=function(){var L=this.linkedList.deleteHead();return L?L.value:null},N.prototype.toString=function(L){return this.linkedList.toString(L)},N}(),A=R;U.default=A},38823:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.default=void 0;var z=function(){function j(R){this.count=R.length,this.parent={};for(var A=0,N=R;A0&&C[0]!==void 0?C[0]:1,!this.dirty){he.next=6;break}return this.compiledBundle.context&&(P>1?this.compiledBundle.context.maxIteration=P:this.compiledBundle.context.maxIteration++),he.next=5,this.compile();case 5:this.dirty=!1;case 6:for(this.engine.beginFrame(),this.engine.clear({}),this.compiledBundle.context&&this.compiledBundle.context.uniforms.filter(function(xe){var Ee=xe.isReferer;return Ee}).forEach(function(xe){var Ee=xe.data,Ne=xe.name;ae.model.confirmInput(Ee.model,Ne)}),S=0;S16)throw new Error("invalid data type ".concat(Ee));ae[xe]=function(){return he.data}}});var P=this.getOuputDataTexture(),S=P.textureWidth,C=P.texelCount;ae.u_OutputTextureSize=[S,S],ae.u_OutputTexelCount=C,this.context.output.textureSize=[S,S];var V={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH precision highp float; #else precision mediump float; #endif `.concat(this.context.shader),uniforms:ae,vert:gn,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(V)}return(0,A.Z)(K,[{key:"run",value:function(){var rt=this;this.context.maxIteration>1&&this.context.needPingpong&&(this.compiledPingpong=!0),(this.compiledPingpong||this.dynamicPingpong)&&this.swap(),this.texFBO=this.reGl.framebuffer({color:this.getOuputDataTexture().texture}),this.texFBO.use(function(){rt.computeCommand()}),ct&&console.log("[".concat(this.entity,"]: output ").concat(this.getOuputDataTexture().id))}},{key:"readData",value:function(){var Dt=(0,B.Z)(_().mark(function ne(){var ae=this,P,S,C,V,he,xe,Ee,Ne;return _().wrap(function(st){for(;;)switch(st.prev=st.next){case 0:if(this.reGl({framebuffer:this.texFBO})(function(){P=ae.reGl.read()}),!P){st.next=6;break}if(S=this.getOuputDataTexture(),C=S.originalDataLength,V=S.elementsPerTexel,he=S.typedArrayConstructor,xe=he===void 0?Float32Array:he,Ee=[],V!==4)for(Ne=0;Ne2&&arguments[2]!==void 0?arguments[2]:0,P=this.context.uniforms.find(function(he){var xe=he.name;return xe===rt});if(P){var S=this.calcDataTexture(rt,P.type,ne),C=S.texture,V=S.data;this.textureCache[rt].data=V,this.textureCache[rt].texture=C}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var rt=this.context.output.name;this.textureCache[rt].id=this.getOuputDataTexture().id,this.textureCache[rt].texture=this.getOuputDataTexture().texture}var ne=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=ne,ct&&console.log("[".concat(this.entity,"]: after swap, output ").concat(this.getOuputDataTexture().id))}},{key:"getOuputDataTexture",value:function(){return this.textureCache[this.outputTextureName]}},{key:"createSwapOutputDataTexture",value:function(){var rt=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=rt}},{key:"cloneDataTexture",value:function(rt){var ne=rt.data,ae=rt.textureWidth;return $r($r({},rt),{},{id:Rr++,texture:this.reGl.texture({width:ae,height:ae,data:ne,type:"float"})})}},{key:"calcDataTexture",value:function(rt,ne,ae){var P=1;ne===X.Vector4FloatArray&&(P=4);for(var S=[],C=0;C0&&arguments[0]!==void 0?arguments[0]:{},ne=new K;return ne.setConfig(rt),ne.setEngine(new ln),ne}}]),K}()},67320:function(or,U,z){"use strict";var B=this&&this.__createBinding||(Object.create?function(A,N,L,y){y===void 0&&(y=L);var x=Object.getOwnPropertyDescriptor(N,L);(!x||("get"in x?!N.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return N[L]}}),Object.defineProperty(A,y,x)}:function(A,N,L,y){y===void 0&&(y=L),A[y]=N[L]}),j=this&&this.__exportStar||function(A,N){for(var L in A)L!=="default"&&!Object.prototype.hasOwnProperty.call(N,L)&&B(N,A,L)};Object.defineProperty(U,"__esModule",{value:!0}),U.getLayoutByName=U.unRegisterLayout=U.registerLayout=void 0;var R=z(39464);Object.defineProperty(U,"registerLayout",{enumerable:!0,get:function(){return R.registerLayout}}),Object.defineProperty(U,"unRegisterLayout",{enumerable:!0,get:function(){return R.unRegisterLayout}}),Object.defineProperty(U,"getLayoutByName",{enumerable:!0,get:function(){return R.getLayoutByName}}),j(z(64649),U)},46253:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.Base=void 0;var z=function(){function B(){this.nodes=[],this.edges=[],this.combos=[],this.comboEdges=[],this.hiddenNodes=[],this.hiddenEdges=[],this.hiddenCombos=[],this.vedges=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=function(){}}return B.prototype.layout=function(j){return this.init(j),this.execute(!0)},B.prototype.init=function(j){this.nodes=j.nodes||[],this.edges=j.edges||[],this.combos=j.combos||[],this.comboEdges=j.comboEdges||[],this.hiddenNodes=j.hiddenNodes||[],this.hiddenEdges=j.hiddenEdges||[],this.hiddenCombos=j.hiddenCombos||[],this.vedges=j.vedges||[]},B.prototype.execute=function(j){},B.prototype.executeWithWorker=function(){},B.prototype.getDefaultCfg=function(){return{}},B.prototype.updateCfg=function(j){j&&Object.assign(this,j)},B.prototype.getType=function(){return"base"},B.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},B}();U.Base=z},93959:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var x=function(v,g){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,_){d.__proto__=_}||function(d,_){for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&(d[E]=_[E])},x(v,g)};return function(v,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");x(v,g);function d(){this.constructor=v}v.prototype=g===null?Object.create(g):(d.prototype=g.prototype,new d)}}();Object.defineProperty(U,"__esModule",{value:!0}),U.CircularLayout=void 0;var j=z(46253),R=z(8273);function A(x,v,g,d){x.forEach(function(_,E){x[E].children=[],x[E].parent=[]}),d?v.forEach(function(_){var E=(0,R.getEdgeTerminal)(_,"source"),w=(0,R.getEdgeTerminal)(_,"target"),T=0;E&&(T=g[E]);var k=0;w&&(k=g[w]);var b=x[T].children,m=x[k].parent;b.push(x[k].id),m.push(x[T].id)}):v.forEach(function(_){var E=(0,R.getEdgeTerminal)(_,"source"),w=(0,R.getEdgeTerminal)(_,"target"),T=0;E&&(T=g[E]);var k=0;w&&(k=g[w]);var b=x[T].children,m=x[k].children;b.push(x[k].id),m.push(x[T].id)})}function N(x,v,g){for(var d=g.length,_=0;_d?1:0}var y=function(x){B(v,x);function v(g){var d=x.call(this)||this;return d.radius=null,d.nodeSize=void 0,d.startRadius=null,d.endRadius=null,d.startAngle=0,d.endAngle=2*Math.PI,d.clockwise=!0,d.divisions=1,d.ordering=null,d.angleRatio=1,d.nodes=[],d.edges=[],d.nodeMap={},d.degrees=[],d.width=300,d.height=300,d.updateCfg(g),d}return v.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},v.prototype.execute=function(){var g,d=this,_=d.nodes,E=d.edges,w=_.length;if(w===0){d.onLayoutEnd&&d.onLayoutEnd();return}!d.width&&typeof window!="undefined"&&(d.width=window.innerWidth),!d.height&&typeof window!="undefined"&&(d.height=window.innerHeight),d.center||(d.center=[d.width/2,d.height/2]);var T=d.center;if(w===1){_[0].x=T[0],_[0].y=T[1],d.onLayoutEnd&&d.onLayoutEnd();return}var k=d.radius,b=d.startRadius,m=d.endRadius,$=d.divisions,W=d.startAngle,X=d.endAngle,H=d.angleRatio,Q=d.ordering,q=d.clockwise,J=d.nodeSpacing,te=d.nodeSize,fe=(X-W)/w,de={};_.forEach(function(Rt,tr){de[Rt.id]=tr}),d.nodeMap=de;var Te=(0,R.getDegree)(_.length,de,E);if(d.degrees=Te,J){var Se=(0,R.getFuncByUnknownType)(10,J),Ie=(0,R.getFuncByUnknownType)(10,te),be=-Infinity;_.forEach(function(Rt){var tr=Ie(Rt);bed.width?d.width/2:d.height/2:!b&&m?b=m:b&&!m&&(m=b);var Me=fe*H,De=[];Q==="topology"?De=d.topologyOrdering():Q==="topology-directed"?De=d.topologyOrdering(!0):Q==="degree"?De=d.degreeOrdering():De=_;for(var Ue=Math.ceil(w/$),nt=0;nt=0;Ie--)Se(Ie);return{nodes:_,edges:E,combos:w,comboEdges:T}},v.prototype.getInnerGraphs=function(g){var d=this,_=d.comboTrees,E=d.nodeSize,w=d.edges,T=d.comboPadding,k=d.spacing,b={},m=this.innerLayout||new L.ConcentricLayout({sortBy:"id"});return m.center=[0,0],m.preventOverlap=!0,m.nodeSpacing=k,(_||[]).forEach(function($){(0,N.traverseTreeUp)($,function(W){var X,H=(T==null?void 0:T(W))||10;if((0,N.isArray)(H)&&(H=Math.max.apply(Math,H)),(X=W.children)===null||X===void 0?void 0:X.length){var q=W.children.map(function(De){if(De.itemType==="combo")return b[De.id];var Ue=g[De.id]||{};return j(j({},Ue),De)}),J=q.map(function(De){return De.id}),te={nodes:q,edges:w.filter(function(De){return J.includes(De.source)&&J.includes(De.target)})},fe=Infinity;q.forEach(function(De){var Ue;De.size||(De.size=((Ue=b[De.id])===null||Ue===void 0?void 0:Ue.size)||(E==null?void 0:E(De))||[30,30]),(0,N.isNumber)(De.size)&&(De.size=[De.size,De.size]),fe>De.size[0]&&(fe=De.size[0]),fe>De.size[1]&&(fe=De.size[1])}),m.layout(te);var de=(0,N.getLayoutBBox)(q),Te=de.minX,Se=de.minY,Ie=de.maxX,be=de.maxY,pe={x:(Ie+Te)/2,y:(be+Se)/2};te.nodes.forEach(function(De){De.x-=pe.x,De.y-=pe.y});var Me=Math.max(Ie-Te,be-Se,fe)+H*2;b[W.id]={id:W.id,nodes:q,size:[Me,Me]}}else if(W.itemType==="combo"){var Q=H?[H*2,H*2]:[30,30];b[W.id]={id:W.id,nodes:[],size:Q}}return!0})}),b},v.prototype.initVals=function(){var g=this,d=g.nodeSize,_=g.spacing,E,w;if((0,N.isNumber)(_)?w=function(){return _}:(0,N.isFunction)(_)?w=_:w=function(){return 0},this.spacing=w,!d)E=function(W){var X=w(W);if(W.size){if((0,N.isArray)(W.size)){var H=W.size[0]>W.size[1]?W.size[0]:W.size[1];return(H+X)/2}if((0,N.isObject)(W.size)){var H=W.size.width>W.size.height?W.size.width:W.size.height;return(H+X)/2}return(W.size+X)/2}return 10+X/2};else if((0,N.isFunction)(d))E=function(W){var X=d(W),H=w(W);if((0,N.isArray)(W.size)){var Q=W.size[0]>W.size[1]?W.size[0]:W.size[1];return(Q+H)/2}return((X||10)+H)/2};else if((0,N.isArray)(d)){var T=d[0]>d[1]?d[0]:d[1],k=T/2;E=function(W){return k+w(W)/2}}else{var b=d/2;E=function(W){return b+w(W)/2}}this.nodeSize=E;var m=g.comboPadding,$;(0,N.isNumber)(m)?$=function(){return m}:(0,N.isArray)(m)?$=function(){return Math.max.apply(null,m)}:(0,N.isFunction)(m)?$=m:$=function(){return 0},this.comboPadding=$},v.prototype.getType=function(){return"comboCombined"},v}(A.Base);U.ComboCombinedLayout=y},48133:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var N=function(L,y){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,v){x.__proto__=v}||function(x,v){for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(x[g]=v[g])},N(L,y)};return function(L,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");N(L,y);function x(){this.constructor=L}L.prototype=y===null?Object.create(y):(x.prototype=y.prototype,new x)}}();Object.defineProperty(U,"__esModule",{value:!0}),U.ComboForceLayout=void 0;var j=z(46253),R=z(8273),A=function(N){B(L,N);function L(y){var x=N.call(this)||this;return x.center=[0,0],x.maxIteration=100,x.gravity=10,x.comboGravity=10,x.linkDistance=10,x.alpha=1,x.alphaMin=.001,x.alphaDecay=1-Math.pow(x.alphaMin,1/300),x.alphaTarget=0,x.velocityDecay=.6,x.edgeStrength=.6,x.nodeStrength=30,x.preventOverlap=!1,x.preventNodeOverlap=!1,x.preventComboOverlap=!1,x.collideStrength=void 0,x.nodeCollideStrength=.5,x.comboCollideStrength=.5,x.comboSpacing=20,x.comboPadding=10,x.optimizeRangeFactor=1,x.onTick=function(){},x.onLayoutEnd=function(){},x.depthAttractiveForceScale=1,x.depthRepulsiveForceScale=2,x.nodes=[],x.edges=[],x.combos=[],x.comboTrees=[],x.width=300,x.height=300,x.bias=[],x.nodeMap={},x.oriComboMap={},x.indexMap={},x.comboMap={},x.previousLayouted=!1,x.updateCfg(y),x}return L.prototype.getDefaultCfg=function(){return{maxIteration:100,center:[0,0],gravity:10,speed:1,comboGravity:30,preventOverlap:!1,preventComboOverlap:!0,preventNodeOverlap:!0,nodeSpacing:void 0,collideStrength:void 0,nodeCollideStrength:.5,comboCollideStrength:.5,comboSpacing:20,comboPadding:10,edgeStrength:.6,nodeStrength:30,linkDistance:10}},L.prototype.execute=function(){var y=this,x=y.nodes,v=y.center;if(y.comboTree={id:"comboTreeRoot",depth:-1,children:y.comboTrees},!x||x.length===0){y.onLayoutEnd&&y.onLayoutEnd();return}if(x.length===1){x[0].x=v[0],x[0].y=v[1],y.onLayoutEnd&&y.onLayoutEnd();return}y.initVals(),y.run(),y.onLayoutEnd&&y.onLayoutEnd()},L.prototype.run=function(){var y=this,x=y.nodes,v=y.previousLayouted?y.maxIteration/5:y.maxIteration;!y.width&&typeof window!="undefined"&&(y.width=window.innerWidth),!y.height&&typeof window!="undefined"&&(y.height=window.innerHeight);var g=y.center,d=y.velocityDecay,_=y.comboMap;y.previousLayouted||y.initPos(_);for(var E=function(b){var m=[];x.forEach(function($,W){m[W]={x:0,y:0}}),y.applyCalculate(m),y.applyComboCenterForce(m),x.forEach(function($,W){!(0,R.isNumber)($.x)||!(0,R.isNumber)($.y)||($.x+=m[W].x*d,$.y+=m[W].y*d)}),y.alpha+=(y.alphaTarget-y.alpha)*y.alphaDecay,y.onTick()},w=0;wZe.size[1]?Ze.size[0]:Ze.size[1];return ht/2}if((0,R.isObject)(Ze.size)){var ht=Ze.size.width>Ze.size.height?Ze.size.width:Ze.size.height;return ht/2}return Ze.size/2}return 10};else if((0,R.isFunction)(X))Q=function(Ze){return X(Ze)};else if((0,R.isArray)(X)){var J=X[0]>X[1]?X[0]:X[1],te=J/2;Q=function(Ze){return te}}else{var fe=X/2;Q=function(Ze){return fe}}this.nodeSize=Q;var de=y.comboSpacing,Te;(0,R.isNumber)(de)?Te=function(){return de}:(0,R.isFunction)(de)?Te=de:Te=function(){return 0},this.comboSpacing=Te;var Se=y.comboPadding,Ie;(0,R.isNumber)(Se)?Ie=function(){return Se}:(0,R.isArray)(Se)?Ie=function(){return Math.max.apply(null,Se)}:(0,R.isFunction)(Se)?Ie=Se:Ie=function(){return 0},this.comboPadding=Ie;var be=this.linkDistance,pe;be||(be=10),(0,R.isNumber)(be)?pe=function(Ze){return be}:pe=be,this.linkDistance=pe;var Me=this.edgeStrength,De;Me||(Me=1),(0,R.isNumber)(Me)?De=function(Ze){return Me}:De=Me,this.edgeStrength=De;var Ue=this.nodeStrength,nt;Ue||(Ue=30),(0,R.isNumber)(Ue)?nt=function(Ze){return Ue}:nt=Ue,this.nodeStrength=nt},L.prototype.initPos=function(y){var x=this,v=x.nodes;v.forEach(function(g,d){var _=g.comboId,E=y[_];_&&E?(g.x=E.cx+100/(d+1),g.y=E.cy+100/(d+1)):(g.x=100/(d+1),g.y=100/(d+1))})},L.prototype.getComboMap=function(){var y=this,x=y.nodeMap,v=y.comboTrees,g=y.oriComboMap,d={};return(v||[]).forEach(function(_){var E=[];(0,R.traverseTreeUp)(_,function(w){if(w.itemType==="node"||!g[w.id])return!0;if(d[w.id]===void 0){var T={id:w.id,name:w.id,cx:0,cy:0,count:0,depth:y.oriComboMap[w.id].depth||0,children:[]};d[w.id]=T}var k=w.children;k&&k.forEach(function($){if(!d[$.id]&&!x[$.id])return!0;E.push($)});var b=d[w.id];if(b.cx=0,b.cy=0,E.length===0){b.empty=!0;var m=g[w.id];b.cx=m.x,b.cy=m.y}return E.forEach(function($){if(b.count++,$.itemType!=="node"){var W=d[$.id];(0,R.isNumber)(W.cx)&&(b.cx+=W.cx),(0,R.isNumber)(W.cy)&&(b.cy+=W.cy);return}var X=x[$.id];!X||((0,R.isNumber)(X.x)&&(b.cx+=X.x),(0,R.isNumber)(X.y)&&(b.cy+=X.y))}),b.cx/=b.count||1,b.cy/=b.count||1,b.children=E,!0})}),d},L.prototype.applyComboCenterForce=function(y){var x=this,v=x.gravity,g=x.comboGravity||v,d=this.alpha,_=x.comboTrees,E=x.indexMap,w=x.nodeMap,T=x.comboMap;(_||[]).forEach(function(k){(0,R.traverseTreeUp)(k,function(b){if(b.itemType==="node")return!0;var m=T[b.id];if(!m)return!0;var $=T[b.id],W=($.depth+1)/10*.5,X=$.cx,H=$.cy;return $.cx=0,$.cy=0,$.children.forEach(function(Q){if(Q.itemType!=="node"){var q=T[Q.id];q&&(0,R.isNumber)(q.cx)&&($.cx+=q.cx),q&&(0,R.isNumber)(q.cy)&&($.cy+=q.cy);return}var J=w[Q.id],te=J.x-X||.005,fe=J.y-H||.005,de=Math.sqrt(te*te+fe*fe),Te=E[J.id],Se=g*d/de*W;y[Te].x-=te*Se,y[Te].y-=fe*Se,(0,R.isNumber)(J.x)&&($.cx+=J.x),(0,R.isNumber)(J.y)&&($.cy+=J.y)}),$.cx/=$.count||1,$.cy/=$.count||1,!0})})},L.prototype.applyCalculate=function(y){var x=this,v=x.comboMap,g=x.nodes,d={};g.forEach(function(E,w){g.forEach(function(T,k){if(!(wq&&(b.minX=q),b.minY>J&&(b.minY=J),b.maxX1&&T.forEach(function(k,b){if(k.itemType==="node")return!1;var m=x[k.id];!m||T.forEach(function($,W){if(b<=W||$.itemType==="node")return!1;var X=x[$.id];if(!X)return!1;var H=m.cx-X.cx||.005,Q=m.cy-X.cy||.005,q=H*H+Q*Q,J=m.r||1,te=X.r||1,fe=J+te,de=te*te,Te=J*J;if(qd)){var Ie=x["".concat(W.id,"-").concat(te.id)],be=Ie.vx,pe=Ie.vy,Me=Math.log(Math.abs(te.depth-W.depth)/10)+1||1;Me=Me<1?1:Me,te.comboId!==W.comboId&&(Me+=1);var De=Me?Math.pow(m,Me):1,Ue=_(te)*E/Te*De;if(y[X].x+=be*Ue,y[X].y+=pe*Ue,X0){var De=Math.abs(Q[0][v.sortBy]-Me[v.sortBy]);v.maxLevelDiff&&De>=v.maxLevelDiff&&(Q=[],H.push(Q))}Q.push(Me)});var q=b+(m||v.minNodeSpacing);if(!v.preventOverlap){var J=H.length>0&&H[0].length>1,te=Math.min(v.width,v.height)/2-q,fe=te/(H.length+(J?1:0));q=Math.min(q,fe)}var de=0;if(H.forEach(function(Me){var De=v.sweep;De===void 0&&(De=2*Math.PI-2*Math.PI/Me.length);var Ue=Me.dTheta=De/Math.max(1,Me.length-1);if(Me.length>1&&v.preventOverlap){var nt=Math.cos(Ue)-Math.cos(0),Ze=Math.sin(Ue)-Math.sin(0),ht=Math.sqrt(q*q/(nt*nt+Ze*Ze));de=Math.max(ht,de)}Me.r=de,de+=q}),v.equidistant){for(var Te=0,Se=0,Ie=0;IeWt.x&&(Rt=Wt.x),tr>Wt.y&&(tr=Wt.y)}),de.edges().forEach(function(ct){var Wt,Er=de.edge(ct);(Wt=Er.points)===null||Wt===void 0||Wt.forEach(function(Dr){Rt>Dr.x&&(Rt=Dr.x),tr>Dr.y&&(tr=Dr.y)})}),ht[0]=X[0]-Rt,ht[1]=X[1]-tr}var Qe=$==="LR"||$==="RL";if(H){var lt=this,St=lt.focusNode,Ct=lt.ranksep,_t=lt.getRadialPos,pt=(0,A.isString)(St)?St:St==null?void 0:St.id,rr=pt?(T=de.node(pt))===null||T===void 0?void 0:T._rank:0,xr=[],Vt=Qe?"y":"x",ft=Qe?"height":"width",Bt=Infinity,qt=-Infinity;de.nodes().forEach(function(ct){var Wt=de.node(ct);if(!!k.nodeMap[ct]){var Er=Me(k.nodeMap[ct]);if(rr===0)xr[Wt._rank]||(xr[Wt._rank]={nodes:[],totalWidth:0,maxSize:-Infinity}),xr[Wt._rank].nodes.push(ct),xr[Wt._rank].totalWidth+=Er*2+Wt[ft],xr[Wt._rank].maxSizeqt&&(qt=wn)}});var br=Ct||50,Ur={},Ae=(qt-Bt)/.9,Hr=[(Bt+qt-Ae)*.5,(Bt+qt+Ae)*.5],Sr=function(ct,Wt,Er,Dr){Er===void 0&&(Er=-Infinity),Dr===void 0&&(Dr=[0,1]);var Vr=Er;return ct.forEach(function(pn){var wn=de.node(pn);Ur[pn]=Wt;var Sn=_t(wn[Vt],Hr,Ae,Wt,Dr),In=Sn.x,$n=Sn.y;if(!!k.nodeMap[pn]){k.nodeMap[pn].x=In+ht[0],k.nodeMap[pn].y=$n+ht[1],k.nodeMap[pn]._order=wn._order;var Zr=pe(k.nodeMap[pn]);Vr=Vr})}:function(ct,Wt,Er){var Dr=Math.max(Wt.x,Er.x),Vr=Math.min(Wt.x,Er.x);return ct.filter(function(pn){return pn.x<=Dr&&pn.x>=Vr})};de.edges().forEach(function(ct){var Wt,Er=de.edge(ct),Dr=fe.findIndex(function(wn){var Sn=(0,A.getEdgeTerminal)(wn,"source"),In=(0,A.getEdgeTerminal)(wn,"target");return Sn===ct.v&&In===ct.w});if(!(Dr<=-1)&&k.edgeLabelSpace&&k.controlPoints&&fe[Dr].type!=="loop"){(Wt=Er==null?void 0:Er.points)===null||Wt===void 0||Wt.forEach(function(wn){wn.x+=ht[0],wn.y+=ht[1]});var Vr=k.nodeMap[ct.v],pn=k.nodeMap[ct.w];fe[Dr].controlPoints=x(Er==null?void 0:Er.points,Vr,pn,$r,Qe,gn,Rr)}})}return k.onLayoutEnd&&k.onLayoutEnd(),{nodes:b,edges:fe}}},g.prototype.getRadialPos=function(d,_,E,w,T){T===void 0&&(T=[0,1]);var k=(d-_[0])/E;k=k*(T[1]-T[0])+T[0];var b=k*2*Math.PI;return{x:Math.cos(b)*w,y:Math.sin(b)*w}},g.prototype.getType=function(){return"dagre"},g}(N.Base);U.DagreLayout=y;var x=function(v,g,d,_,E,w,T){var k=(v==null?void 0:v.slice(1,v.length-1))||[];if(g&&d){var b=g.x,m=g.y,$=d.x,W=d.y;if(E&&(b=g.y,m=g.x,$=d.y,W=d.x),W!==m&&b!==$){var X=_.indexOf(m),H=_[X+1];if(H){var Q=k[0],q=E?{x:(m+H)/2,y:(Q==null?void 0:Q.y)||$}:{x:(Q==null?void 0:Q.x)||$,y:(m+H)/2};(!Q||w(Q,q))&&k.unshift(q)}var J=_.indexOf(W),te=Math.abs(J-X);if(te===1)k=T(k,g,d),k.length||k.push(E?{x:(m+W)/2,y:b}:{x:b,y:(m+W)/2});else if(te>1){var fe=_[J-1];if(fe){var de=k[k.length-1],Te=E?{x:(W+fe)/2,y:(de==null?void 0:de.y)||$}:{x:(de==null?void 0:de.x)||b,y:(W+fe)/2};(!de||w(de,Te))&&k.push(Te)}}}}return k}},77620:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var x=function(v,g){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,_){d.__proto__=_}||function(d,_){for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&(d[E]=_[E])},x(v,g)};return function(v,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");x(v,g);function d(){this.constructor=v}v.prototype=g===null?Object.create(g):(d.prototype=g.prototype,new d)}}(),j=this&&this.__assign||function(){return j=Object.assign||function(x){for(var v,g=1,d=arguments.length;gb.x&&(T=b.x),k>b.y&&(k=b.y)}),d.forEach(function(b){b.points.forEach(function(m){T>m.x&&(T=m.x),k>m.y&&(k=m.y)})}),w[0]=E[0]-T,w[1]=E[1]-k}return w},v.prototype.updateNodePosition=function(g,d){var _=this,E=_.combos,w=_.nodes,T=_.edges,k=_.anchorPoint,b=_.graphSettings,m=this.getBegin(g,d);g.forEach(function($){var W,X=$.x,H=$.y,Q=$.id,q=$.type,J=$.coreBox;if(q===N.HierarchyNodeType.META&&Q!==N.ROOT_NAME){var te=E.findIndex(function(Ie){return Ie.id===Q}),fe=(W=b==null?void 0:b.subScene)===null||W===void 0?void 0:W.meta;E[te].offsetX=X+m[0],E[te].offsetY=H+m[1],E[te].fixSize=[J.width,J.height],E[te].fixCollapseSize=[J.width,J.height],$.expanded?E[te].padding=[fe==null?void 0:fe.paddingTop,fe==null?void 0:fe.paddingRight,fe==null?void 0:fe.paddingBottom,fe==null?void 0:fe.paddingLeft]:E[te].padding=[0,0,0,0]}else if(q===N.HierarchyNodeType.OP){var te=w.findIndex(function(be){return be.id===Q});if(w[te].x=X+m[0],w[te].y=H+m[1],k){var de=[],Te=d.filter(function(be){return be.v===Q}),Se=d.filter(function(be){return be.w===Q});Te.length>0&&Te.forEach(function(be){var pe=be.points[0],Me=(pe.x-X)/$.width+.5,De=(pe.y-H)/$.height+.5;de.push([Me,De]),be.baseEdgeList.forEach(function(Ue){var nt=T.find(function(Ze){return Ze.source===Ue.v&&Ze.target===Ue.w});nt&&(nt.sourceAnchor=de.length-1)})}),Se.length>0&&Se.forEach(function(be){var pe=be.points[be.points.length-1],Me=(pe.x-X)/$.width+.5,De=(pe.y-H)/$.height+.5;de.push([Me,De]),be.baseEdgeList.forEach(function(Ue){var nt=T.find(function(Ze){return Ze.source===Ue.v&&Ze.target===Ue.w});nt&&(nt.targetAnchor=de.length-1)})}),w[te].anchorPoints=de.length>0?de:w[te].anchorPoints||[]}}})},v.prototype.updateEdgePosition=function(g,d){var _=this,E=_.combos,w=_.edges,T=_.controlPoints,k=this.getBegin(g,d);T&&(E.forEach(function(b){b.inEdges=[],b.outEdges=[]}),w.forEach(function(b){var m,$,W,X,H=g.find(function(Ie){return Ie.id===b.source}),Q=g.find(function(Ie){return Ie.id===b.target}),q=[],J=[];if(H&&Q)J=(0,N.getEdges)(H==null?void 0:H.id,Q==null?void 0:Q.id,g);else if(!H||!Q){var te=_.getNodePath(b.source),fe=_.getNodePath(b.target),de=te.reverse().slice(H?0:1).find(function(Ie){return g.find(function(be){return be.id===Ie})}),Te=fe.reverse().slice(Q?0:1).find(function(Ie){return g.find(function(be){return be.id===Ie})});H=g.find(function(Ie){return Ie.id===de}),Q=g.find(function(Ie){return Ie.id===Te}),J=(0,N.getEdges)(H==null?void 0:H.id,Q==null?void 0:Q.id,g,{v:b.source,w:b.target})}if(q=J.reduce(function(Ie,be){return R(R([],Ie,!0),be.points.map(function(pe){return j(j({},pe),{x:pe.x+k[0],y:pe.y+k[1]})}),!0)},[]),q=q.slice(1,-1),b.controlPoints=q,(Q==null?void 0:Q.type)===N.NodeType.META){var Se=E.findIndex(function(Ie){return Ie.id===(Q==null?void 0:Q.id)});if(!E[Se]||((m=E[Se].inEdges)===null||m===void 0?void 0:m.some(function(Ie){return Ie.source===H.id&&Ie.target===Q.id})))return;($=E[Se].inEdges)===null||$===void 0||$.push({source:H.id,target:Q.id,controlPoints:q})}if((H==null?void 0:H.type)===N.NodeType.META){var Se=E.findIndex(function(be){return be.id===(H==null?void 0:H.id)});if(!E[Se]||((W=E[Se].outEdges)===null||W===void 0?void 0:W.some(function(be){return be.source===H.id&&be.target===Q.id})))return;(X=E[Se].outEdges)===null||X===void 0||X.push({source:H.id,target:Q.id,controlPoints:q})}}))},v.prototype.getType=function(){return"dagreCompound"},v.prototype.getDataByOrder=function(g){return g.every(function(d){return d.layoutOrder!==void 0})||g.forEach(function(d,_){d.layoutOrder=_}),g.sort(function(d,_){return d.layoutOrder-_.layoutOrder})},v}(A.Base);U.DagreCompoundLayout=y},67858:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var A=function(N,L){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,x){y.__proto__=x}||function(y,x){for(var v in x)Object.prototype.hasOwnProperty.call(x,v)&&(y[v]=x[v])},A(N,L)};return function(N,L){if(typeof L!="function"&&L!==null)throw new TypeError("Class extends value "+String(L)+" is not a constructor or null");A(N,L);function y(){this.constructor=N}N.prototype=L===null?Object.create(L):(y.prototype=L.prototype,new y)}}();Object.defineProperty(U,"__esModule",{value:!0}),U.Graph=void 0;var j=z(69787),R=function(A){B(N,A);function N(){return A!==null&&A.apply(this,arguments)||this}return N}(j.Graph);U.Graph=R},53186:function(or,U,z){"use strict";var B=this&&this.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(U,"__esModule",{value:!0});var j=B(z(86282)),R=z(95869);U.default={layout:j.default,util:{time:R.time,notime:R.notime}}},65721:function(or,U,z){"use strict";var B=this&&this.__importDefault||function(L){return L&&L.__esModule?L:{default:L}};Object.defineProperty(U,"__esModule",{value:!0});var j=B(z(81628)),R=function(L){var y=function(v){return function(g){var d;return((d=v.edge(g))===null||d===void 0?void 0:d.weight)||1}},x=L.graph().acyclicer==="greedy"?(0,j.default)(L,y(L)):A(L);x==null||x.forEach(function(v){var g=L.edge(v);L.removeEdgeObj(v),g.forwardName=v.name,g.reversed=!0,L.setEdge(v.w,v.v,g,"rev-".concat(Math.random()))})},A=function(L){var y=[],x={},v={},g=function(d){var _;v[d]||(v[d]=!0,x[d]=!0,(_=L.outEdges(d))===null||_===void 0||_.forEach(function(E){x[E.w]?y.push(E):g(E.w)}),delete x[d])};return L.nodes().forEach(g),y},N=function(L){L.edges().forEach(function(y){var x=L.edge(y);if(x.reversed){L.removeEdgeObj(y);var v=x.forwardName;delete x.reversed,delete x.forwardName,L.setEdge(y.w,y.v,x,v)}})};U.default={run:R,undo:N}},88597:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0});var B=z(95869),j=function(A){var N,L=function(y){var x=A.children(y),v=A.node(y);if((x==null?void 0:x.length)&&x.forEach(function(_){return L(_)}),v.hasOwnProperty("minRank")){v.borderLeft=[],v.borderRight=[];for(var g=v.minRank,d=v.maxRank+1;g0;--W)if($=w[W].dequeue(),$){k=k.concat(g(E,w,T,$,!0));break}}}return k},g=function(E,w,T,k,b){var m,$,W=[];return(m=E.inEdges(k.v))===null||m===void 0||m.forEach(function(X){var H=E.edge(X),Q=E.node(X.v);b&&W.push({v:X.v,w:X.w,in:0,out:0}),Q.out===void 0&&(Q.out=0),Q.out-=H,_(w,T,Q)}),($=E.outEdges(k.v))===null||$===void 0||$.forEach(function(X){var H=E.edge(X),Q=X.w,q=E.node(Q);q.in===void 0&&(q.in=0),q.in-=H,_(w,T,q)}),E.removeNode(k.v),b?W:void 0},d=function(E,w){var T=new L,k=0,b=0;E.nodes().forEach(function(H){T.setNode(H,{v:H,in:0,out:0})}),E.edges().forEach(function(H){var Q=T.edge(H)||0,q=(w==null?void 0:w(H))||1,J=Q+q;T.setEdge(H.v,H.w,J),b=Math.max(b,T.node(H.v).out+=q),k=Math.max(k,T.node(H.w).in+=q)});for(var m=[],$=b+k+3,W=0;W<$;W++)m.push(new N);var X=k+1;return T.nodes().forEach(function(H){_(m,X,T.node(H))}),{buckets:m,zeroIdx:X,graph:T}},_=function(E,w,T){T.out?T.in?E[T.out-T.in+w].enqueue(T):E[E.length-1].enqueue(T):E[0].enqueue(T)};U.default=x},86282:function(or,U,z){"use strict";var B=this&&this.__assign||function(){return B=Object.assign||function(Qe){for(var lt,St=1,Ct=arguments.length;St0;)T%2&&(k+=_[T+1]),T=T-1>>1,_[T]+=w.weight;E+=w.weight*k}}),E},R=function(A,N){for(var L=0,y=1;y<(N==null?void 0:N.length);y+=1)L+=j(A,N[y-1],N[y]);return L};U.default=R},15113:function(or,U,z){"use strict";var B=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(U,"__esModule",{value:!0});var j=B(z(19722)),R=B(z(14842)),A=B(z(74798)),N=B(z(99388)),L=B(z(69563)),y=z(8273),x=z(67858),v=z(95869),g=function(w,T){for(var k=(0,v.maxRank)(w),b=[],m=[],$=1;$-1;$--)m.push($);var W=d(w,b,"inEdges"),X=d(w,m,"outEdges"),H=(0,j.default)(w);E(w,H);for(var Q=Number.POSITIVE_INFINITY,q,$=0,J=0;J<4;++$,++J){_($%2?W:X,$%4>=2,!1,T),H=(0,v.buildLayerMatrix)(w);var te=(0,R.default)(w,H);te=2,!0,T),H=(0,v.buildLayerMatrix)(w);var te=(0,R.default)(w,H);te=_.barycenter)&&j(_,E)}},x=function(_){return function(E){E.in.push(_),--E.indegree==0&&R.push(E)}},v=function(){var _=R.pop();L.push(_),(A=_.in.reverse())===null||A===void 0||A.forEach(function(E){return y(_)(E)}),(N=_.out)===null||N===void 0||N.forEach(function(E){return x(_)(E)})};R==null?void 0:R.length;)v();var g=L.filter(function(_){return!_.merged}),d=["vs","i","barycenter","weight"];return g.map(function(_){var E={};return d==null||d.forEach(function(w){_[w]!==void 0&&(E[w]=_[w])}),E})},j=function(R,A){var N,L=0,y=0;R.weight&&(L+=R.barycenter*R.weight,y+=R.weight),A.weight&&(L+=A.barycenter*A.weight,y+=A.weight),R.vs=(N=A.vs)===null||N===void 0?void 0:N.concat(R.vs),R.barycenter=L/y,R.weight=y,R.i=Math.min(A.i,R.i),A.merged=!0};U.default=z},69563:function(or,U,z){"use strict";var B=this&&this.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(U,"__esModule",{value:!0});var j=B(z(38937)),R=B(z(73792)),A=B(z(17457)),N=function(x,v,g,d,_,E){var w,T,k,b,m=x.children(v),$=x.node(v),W=$?$.borderLeft:void 0,X=$?$.borderRight:void 0,H={};W&&(m=m==null?void 0:m.filter(function(de){return de!==W&&de!==X}));var Q=(0,j.default)(x,m||[]);Q==null||Q.forEach(function(de){var Te;if((Te=x.children(de.v))===null||Te===void 0?void 0:Te.length){var Se=N(x,de.v,g,d,E);H[de.v]=Se,Se.hasOwnProperty("barycenter")&&y(de,Se)}});var q=(0,R.default)(Q,g);L(q,H),(w=q.filter(function(de){return de.vs.length>0}))===null||w===void 0||w.forEach(function(de){var Te=x.node(de.vs[0]);Te&&(de.fixorder=Te.fixorder,de.order=Te.order)});var J=(0,A.default)(q,d,_,E);if(W&&(J.vs=[W,J.vs,X].flat(),(T=x.predecessors(W))===null||T===void 0?void 0:T.length)){var te=x.node(((k=x.predecessors(W))===null||k===void 0?void 0:k[0])||""),fe=x.node(((b=x.predecessors(X))===null||b===void 0?void 0:b[0])||"");J.hasOwnProperty("barycenter")||(J.barycenter=0,J.weight=0),J.barycenter=(J.barycenter*J.weight+te.order+fe.order)/(J.weight+2),J.weight+=2}return J},L=function(x,v){x==null||x.forEach(function(g){var d,_=(d=g.vs)===null||d===void 0?void 0:d.map(function(E){return v[E]?v[E].vs:E});g.vs=_.flat()})},y=function(x,v){x.barycenter!==void 0?(x.barycenter=(x.barycenter*x.weight+v.barycenter*v.weight)/(x.weight+v.weight),x.weight+=v.weight):(x.barycenter=v.barycenter,x.weight=v.weight)};U.default=N},17457:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0});var B=z(95869),j=function(N,L,y,x){var v=(0,B.partition)(N,function(b){var m=b.hasOwnProperty("fixorder")&&!isNaN(b.fixorder);return x?!m&&b.hasOwnProperty("barycenter"):m||b.hasOwnProperty("barycenter")}),g=v.lhs,d=v.rhs.sort(function(b,m){return-b.i- -m.i}),_=[],E=0,w=0,T=0;g==null||g.sort(A(!!L,!!y)),T=R(_,d,T),g==null||g.forEach(function(b){var m;T+=(m=b.vs)===null||m===void 0?void 0:m.length,_.push(b.vs),E+=b.barycenter*b.weight,w+=b.weight,T=R(_,d,T)});var k={vs:_.flat()};return w&&(k.barycenter=E/w,k.weight=w),k},R=function(N,L,y){for(var x=y,v;L.length&&(v=L[L.length-1]).i<=x;)L.pop(),N==null||N.push(v.vs),x++;return x},A=function(N,L){return function(y,x){if(y.fixorder!==void 0&&x.fixorder!==void 0)return y.fixorder-x.fixorder;if(y.barycenterx.barycenter)return 1;if(L&&y.order!==void 0&&x.order!==void 0){if(y.orderx.order)return 1}return N?x.i-y.i:y.i-x.i}};U.default=j},99946:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0});var z=function(R){var A,N={},L=0,y=function(x){var v,g=L;(v=R.children(x))===null||v===void 0||v.forEach(y),N[x]={low:g,lim:L++}};return(A=R.children())===null||A===void 0||A.forEach(y),N},B=function(R,A,N,L){var y=[],x=[],v=Math.min(A[N].low,A[L].low),g=Math.max(A[N].lim,A[L].lim),d,_;d=N;do d=R.parent(d),y.push(d);while(d&&(A[d].low>v||g>A[d].lim));for(_=d,d=L;d&&d!==_;)x.push(d),d=R.parent(d);return{lca:_,path:y.concat(x.reverse())}},j=function(R){var A,N=z(R);(A=R.graph().dummyChains)===null||A===void 0||A.forEach(function(L){var y,x,v=L,g=R.node(v),d=g.edgeObj;if(!!d)for(var _=B(R,N,d.v,d.w),E=_.path,w=_.lca,T=0,k=E[T],b=!0;v!==d.w;){if(g=R.node(v),b){for(;k!==w&&((y=R.node(k))===null||y===void 0?void 0:y.maxRank)Se)&&(0,U.addConflict)(X,De,pe)}))}function Q(te){return JSON.stringify(te.slice(1))}function q(te,fe){var de=Q(te);fe.get(de)||(H.apply(void 0,te),fe.set(de,!0))}var J=function(te,fe){var de=-1,Te,Se=0,Ie=new Map;return fe==null||fe.forEach(function(be,pe){var Me;if(((Me=$.node(be))===null||Me===void 0?void 0:Me.dummy)==="border"){var De=$.predecessors(be)||[];De.length&&(Te=$.node(De[0]).order,q([fe,Se,pe,de,Te],Ie),Se=pe,de=Te)}q([fe,Se,fe.length,Te,te.length],Ie)}),fe};return(W==null?void 0:W.length)&&W.reduce(J),X};U.findType2Conflicts=L;var y=function($,W){var X,H;if((X=$.node(W))===null||X===void 0?void 0:X.dummy)return(H=$.predecessors(W))===null||H===void 0?void 0:H.find(function(Q){return $.node(Q).dummy})};U.findOtherInnerSegmentNode=y;var x=function($,W,X){var H=W,Q=X;if(H>Q){var q=H;H=Q,Q=q}var J=$[H];J||($[H]=J={}),J[Q]=!0};U.addConflict=x;var v=function($,W,X){var H=W,Q=X;if(H>Q){var q=W;H=Q,Q=q}return!!$[H]};U.hasConflict=v;var g=function($,W,X,H){var Q={},q={},J={};return W==null||W.forEach(function(te){te==null||te.forEach(function(fe,de){Q[fe]=fe,q[fe]=fe,J[fe]=de})}),W==null||W.forEach(function(te){var fe=-1;te==null||te.forEach(function(de){var Te=H(de);if(Te.length){Te=Te.sort(function(Me,De){return J[Me]-J[De]});for(var Se=(Te.length-1)/2,Ie=Math.floor(Se),be=Math.ceil(Se);Ie<=be;++Ie){var pe=Te[Ie];q[de]===de&&feJ.lim&&(te=J,fe=!0);var de=W.edges().filter(function(Te){return fe===m($,$.node(Te.v),te)&&fe!==m($,$.node(Te.w),te)});return(0,R.minBy)(de,function(Te){return(0,j.slack)(W,Te)})};U.enterEdge=w;var T=function($,W,X,H){var Q=X.v,q=X.w;$.removeEdge(Q,q),$.setEdge(H.v,H.w,{}),(0,U.initLowLimValues)($),(0,U.initCutValues)($,W),k($,W)};U.exchangeEdges=T;var k=function($,W){var X=$.nodes().find(function(Q){var q;return!((q=W.node(Q))===null||q===void 0?void 0:q.parent)}),H=N($,X);H=H==null?void 0:H.slice(1),H==null||H.forEach(function(Q){var q=$.node(Q).parent,J=W.edgeFromArgs(Q,q),te=!1;J||(J=W.edgeFromArgs(q,Q),te=!0),W.node(Q).rank=W.node(q).rank+(te?J.minlen:-J.minlen)})},b=function($,W,X){return $.hasEdge(W,X)},m=function($,W,X){return X.low<=W.lim&&W.lim<=X.lim};U.default=y},76783:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.slack=U.longestPathWithLayer=U.longestPath=void 0;var z=function(R){var A,N={},L=function(y){var x,v=R.node(y);if(!v)return 0;if(N[y])return v.rank;N[y]=!0;var g;return(x=R.outEdges(y))===null||x===void 0||x.forEach(function(d){var _=L(d.w),E=R.edge(d).minlen,w=_-E;w&&(g===void 0||wMath.abs(q)*fe?(J<0&&(fe=-fe),de=fe*q/J,Te=fe):(q<0&&(te=-te),de=te,Te=te*J/q),{x:H+de,y:Q+Te}};U.intersectRect=g;var d=function(W){for(var X=[],H=(0,U.maxRank)(W)+1,Q=0;QX)&&(X=q)}),X||(X=0),X};U.maxRank=T;var k=function(W,X){var H={lhs:[],rhs:[]};return W==null||W.forEach(function(Q){X(Q)?H.lhs.push(Q):H.rhs.push(Q)}),H};U.partition=k;var b=function(W,X){var H=Date.now();try{return X()}finally{console.log("".concat(W," time: ").concat(Date.now()-H,"ms"))}};U.time=b;var m=function(W,X){return X()};U.notime=m;var $=function(W,X){return W.reduce(function(H,Q){var q=X(H),J=X(Q);return q>J?Q:H})};U.minBy=$},29279:function(or,U,z){"use strict";var B=this&&this.__assign||function(){return B=Object.assign||function(d){for(var _,E=1,w=arguments.length;E1){var fe=B({},J);delete fe.size,b.push(fe)}});var m=[];w.forEach(function(J){var te=b.find(function(de){return de.id===J.source}),fe=b.find(function(de){return de.id===J.target});te&&fe&&m.push(J)});var $=new v.DagreLayout({type:"dagre",ranksep:_.nodeMinGap,nodesep:_.nodeMinGap}),W=$.layout({nodes:b,edges:m}).nodes;E.forEach(function(J){var te=(W||[]).find(function(fe){return fe.id===J.id});J.x=(te==null?void 0:te.x)||T/2,J.y=(te==null?void 0:te.y)||k/2});var X=JSON.parse(JSON.stringify(E)),H=JSON.parse(JSON.stringify(w)),Q=L.forceSimulation().nodes(X).force("link",L.forceLink(H).id(function(J){return J.id}).distance(function(J){var te=m.find(function(fe){return fe.source===J.source&&fe.target===J.target});return te?30:20})).force("charge",L.forceManyBody()).force("center",L.forceCenter(T/2,k/2)).force("x",L.forceX(T/2)).force("y",L.forceY(k/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),q=new Promise(function(J){Q.on("end",function(){E.forEach(function(be){var pe=X.find(function(Me){return Me.id===be.id});pe&&(be.x=pe.x,be.y=pe.y)});var te=Math.min.apply(Math,E.map(function(be){return be.x})),fe=Math.max.apply(Math,E.map(function(be){return be.x})),de=Math.min.apply(Math,E.map(function(be){return be.y})),Te=Math.max.apply(Math,E.map(function(be){return be.y})),Se=T/(fe-te),Ie=k/(Te-de);E.forEach(function(be){be.x!==void 0&&Se<1&&(be.x=(be.x-te)*Se),be.y!==void 0&&Ie<1&&(be.y=(be.y-de)*Ie)}),E.forEach(function(be){be.sizeTemp=be.size,be.size=[10,10]}),(0,x.default)(E,w),E.forEach(function(be){be.size=be.sizeTemp||[],delete be.sizeTemp}),(0,y.default)({nodes:E,edges:w},_),J()})});return q}U.default=g},28563:function(or,U,z){"use strict";var B=this&&this.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(U,"__esModule",{value:!0});var j=B(z(62120));function R(A,N){if(!A.nodes||A.nodes.length===0)return A;var L=N.width,y=N.height,x=N.nodeMinGap,v=1e4,g=1e4;A.nodes.forEach(function(H){var Q=H.size[0]||50,q=H.size[1]||50;v=Math.min(Q,v),g=Math.min(q,g)});var d=new j.default;d.init(L,y,{CELL_H:g,CELL_W:v}),A.nodes.forEach(function(H){var Q=d.occupyNearest(H);Q&&(Q.node={id:H.id,size:H.size},H.x=Q.x,H.y=Q.y,H.dx=Q.dx,H.dy=Q.dy)});for(var _=0;_v){for(var b=Math.ceil((E.size[0]+x)/v)-1,m=b,$=0;$-1;if(W&&!d.cells[T+$+1][k].node)m--;else break}d.insertColumn(T,m)}if(E.size[1]+x>g){for(var b=Math.ceil((E.size[1]+x)/g)-1,m=b,$=0;$-1;if(W&&!d.cells[T][k+$+1].node)m--;else break}d.insertRow(k,m)}}for(var _=0;_R;N--)for(var L=0;L=R&&(this.additionColumn[L]+=A);for(var N=0;NR;N--)this.cells[L][N+A]=z(z({},this.cells[L][N]),{dx:L,dy:N+A,x:L*this.CELL_W,y:(N+A)*this.CELL_H}),this.cells[L][N]={dx:L,dy:N,x:L*this.CELL_W,y:N*this.CELL_H,occupied:!1,node:null};for(var N=0;N=R&&(this.additionRow[N]+=A);for(var L=0;LN?(ht=J-Ie,Ze=de-te,Rt=parseFloat(ht?(ht/Math.cos(nt)).toFixed(2):Ze.toFixed(2)),tr=parseFloat(Ze?(Ze/Math.sin(nt)).toFixed(2):ht.toFixed(2))):0Ze?Rt=tr=parseFloat(ht?(ht/Math.cos(nt)).toFixed(2):Ze.toFixed(2)):Rt=tr=parseFloat(Ze?(Ze/Math.sin(nt)).toFixed(2):ht.toFixed(2))):nt<-N?(ht=J-Ie,Ze=-(Se-q),ht>Ze?Rt=tr=parseFloat(ht?(ht/Math.cos(nt)).toFixed(2):Ze.toFixed(2)):Rt=tr=parseFloat(Ze?(Ze/Math.sin(nt)).toFixed(2):ht.toFixed(2))):(ht=Te-fe,Math.abs(Ue)>(te-q)/2?Ze=q-Se:Ze=Ue,ht>Ze?Rt=tr=parseFloat(ht?(ht/Math.cos(nt)).toFixed(2):Ze.toFixed(2)):Rt=tr=parseFloat(Ze&&nt!==0?(Ze/Math.sin(nt)).toFixed(2):ht.toFixed(2)));var Qe=parseFloat(nt.toFixed(2)),lt=Q;return Q&&(lt=Lte?H:X,de=J>te?X:H,Te=fe.x-fe.size[0]/2,Se=fe.y-fe.size[1]/2,Ie=fe.x+fe.size[0]/2,be=fe.y+fe.size[1]/2,pe=de.x-de.size[0]/2,Me=de.y-de.size[1]/2,De=de.x+de.size[0]/2,Ue=de.y+de.size[1]/2,nt=fe.x,Ze=fe.y,ht=de.x,Rt=de.y,tr=Ie>=pe&&De>=Te&&be>=Me&&Ue>=Se,Qe=0,lt=0;if(tr){lt=Math.sqrt(Math.pow(ht-nt,2)+Math.pow(Rt-Ze,2));var St=Te>pe?Te:pe,Ct=Se>Me?Se:Me,_t=Iez||q.y>B)&&(H+=1e12);for(var J=Q+1;J150,Me=be<30||be>150,De=Ie>70&&Ie<110,Ue=be>70&&be<110;if(pe&&!Me||Ie*be<0){de=!1;break}else if(De&&!Ue||Ie*be<0){de=!1;break}else if((Se.x-X.x)*(Se.x-H.x)<0){de=!1;break}else if((Se.y-X.y)*(Se.y-H.y)<0){de=!1;break}}return de}function m(X,H){for(var Q=!1,q=1,J=v*q,te=g*q,fe=[J,-J,0,0],de=[0,0,te,-te],Te=0;Te_?(Ie=Me,Q=!0):(Se.x-=fe[be],Se.y-=de[be])}}return d>_&&(d*=E),Q?k(X):0}function $(X,H){var Q=0;(X.x<0||X.y<0||X.x+X.size[0]+20>z||X.y+X.size[1]+20>B)&&(Q+=1e12);for(var q=0;q0&&(de++,!(de>=fe));){var Te=m(X,H);Te!==0&&(te=Te),J=te-Q,Q=te,J===0?--q:q=20}return X.forEach(function(Se){Se.x=Se.x-Se.size[0]/2,Se.y=Se.y-Se.size[1]/2}),{nodes:X,edges:H}}U.default=W},26961:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.forceNBody=void 0;var B=z(71829),j=.81,R=.1;function A(x,v,g,d,_){var E=g/d,w=x.map(function(k,b){var m=v[k.id],$=m.data,W=m.x,X=m.y,H=m.size,Q=$.layout.force.nodeStrength;return{x:W,y:X,size:H,index:b,vx:0,vy:0,weight:E*Q}}),T=(0,B.quadtree)(w,function(k){return k.x},function(k){return k.y}).visitAfter(N);return w.forEach(function(k){y(k,T)}),w.map(function(k,b){var m=v[x[b].id],$=m.data.layout.force.mass,W=$===void 0?1:$;_[2*b]=k.vx/W,_[2*b+1]=k.vy/W}),_}U.forceNBody=A;function N(x){var v=0,g=0,d=0;if(x.length){for(var _=0;_<4;_++){var E=x[_];E&&E.weight&&(v+=E.weight,g+=E.x*E.weight,d+=E.y*E.weight)}x.x=g/v,x.y=d/v,x.weight=v}else{var E=x;x.x=E.data.x,x.y=E.data.y,x.weight=E.data.weight}}var L=function(x,v,g,d,_,E){var w=E.x-x.x||R,T=E.y-x.y||R,k=d-v,b=w*w+T*T,m=Math.sqrt(b)*b;if(k*k*j1&&(be=(0,A.getAvgNodePosition)(Me))}else be=void 0;return{x:be==null?void 0:be.x,y:be==null?void 0:be.y}}}}if(_){$||($=this.getSameTypeLeafMap());var X=Array.from(new Set(w.map(function(fe,de){return fe[E]}))).filter(function(fe){return fe!==void 0}),H={};X.forEach(function(fe){var de=w.filter(function(Te){return Te[E]===fe}).map(function(Te){return T[Te.id]});H[fe]=(0,A.getAvgNodePosition)(de)}),m={single:function(fe){return b(fe)},leaf:function(fe){return b(fe)},others:function(fe){return b(fe)},center:function(fe,de,Te){var Se=H[fe[E]];return{x:Se==null?void 0:Se.x,y:Se==null?void 0:Se.y}}}}this.centripetalOptions=j(j({},this.centripetalOptions),m);var Q=this.centripetalOptions,q=Q.leaf,J=Q.single,te=Q.others;q&&typeof q!="function"&&(this.centripetalOptions.leaf=function(){return q}),J&&typeof J!="function"&&(this.centripetalOptions.single=function(){return J}),te&&typeof te!="function"&&(this.centripetalOptions.others=function(){return te})},v.prototype.updateCfg=function(g){g&&Object.assign(this,g)},v.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},v.prototype.execute=function(){var g=this;g.stop();var d=g.nodes,_=g.edges,E=g.defSpringLen;if(g.judgingDistance=0,!d||d.length===0){g.onLayoutEnd([]);return}!g.width&&typeof window!="undefined"&&(g.width=window.innerWidth),!g.height&&typeof window!="undefined"&&(g.height=window.innerHeight),g.center||(g.center=[g.width/2,g.height/2]);var w=g.center;if(d.length===1){d[0].x=w[0],d[0].y=w[1],g.onLayoutEnd([j({},d[0])]);return}g.degreesMap=(0,A.getDegreeMap)(d,_),g.propsGetMass?g.getMass=g.propsGetMass:g.getMass=function(X){var H=1;(0,A.isNumber)(X.mass)&&(H=X.mass);var Q=g.degreesMap[X.id].all;return!Q||Q<5?H:Q*5*H};var T=g.nodeSize,k;if(g.preventOverlap){var b=g.nodeSpacing,m;(0,A.isNumber)(b)?m=function(){return b}:(0,A.isFunction)(b)?m=b:m=function(){return 0},T?(0,A.isArray)(T)?k=function(X){return Math.max(T[0],T[1])+m(X)}:k=function(X){return T+m(X)}:k=function(X){return X.size?(0,A.isArray)(X.size)?Math.max(X.size[0],X.size[1])+m(X):(0,A.isObject)(X.size)?Math.max(X.size.width,X.size.height)+m(X):X.size+m(X):10+m(X)}}g.nodeSize=k,g.linkDistance=L(g.linkDistance,1),g.nodeStrength=L(g.nodeStrength,1),g.edgeStrength=L(g.edgeStrength,1);var $={},W={};d.forEach(function(X,H){(0,A.isNumber)(X.x)||(X.x=Math.random()*g.width),(0,A.isNumber)(X.y)||(X.y=Math.random()*g.height);var Q=g.degreesMap[X.id];$[X.id]=j(j({},X),{data:j(j({},X.data),{size:g.nodeSize(X)||30,layout:{inDegree:Q.in,outDegree:Q.out,degree:Q.all,tDegree:Q.in,sDegree:Q.out,force:{mass:g.getMass(X),nodeStrength:g.nodeStrength(X)}}})}),W[X.id]=H}),g.nodeMap=$,g.nodeIdxMap=W,g.edgeInfos=[],_==null||_.forEach(function(X){var H=$[X.source],Q=$[X.target];!H||!Q?elf.edgeInfos.push({}):g.edgeInfos.push({edgeStrength:g.edgeStrength(X),linkDistance:E?E(j(j({},X),{source:H,target:Q}),H,Q):g.linkDistance(X,H,Q)||1+(T(H)+T(H)||0)/2})}),this.getCentripetalOptions(),g.onLayoutEnd=g.onLayoutEnd||function(){},g.run()},v.prototype.run=function(){var g=this,d=g.maxIteration,_=g.nodes,E=g.workerEnabled,w=g.minMovement,T=g.animate,k=g.nodeMap;if(!!_){var b=[];_.forEach(function(Q,q){b[2*q]=0,b[2*q+1]=0});var m=d,$=!T;if(E||$){for(var W=0,X=0;(g.judgingDistance>w||X<1)&&X=m||g.judgingDistancek){var H=k/X;$=H*$,W=H*W}d[2*m]=$,d[2*m+1]=W})},v.prototype.updatePosition=function(g,d){var _=this,E=_.nodes,w=_.distanceThresholdMode,T=_.nodeMap;if(!(E==null?void 0:E.length)){this.judgingDistance=0;return}var k=0;w==="max"?_.judgingDistance=-Infinity:w==="min"&&(_.judgingDistance=Infinity),E.forEach(function(b,m){var $=T[b.id];if((0,A.isNumber)(b.fx)&&(0,A.isNumber)(b.fy)){b.x=b.fx,b.y=b.fy,$.x=b.x,$.y=b.y;return}var W=g[2*m]*d,X=g[2*m+1]*d;b.x+=W,b.y+=X,$.x=b.x,$.y=b.y;var H=Math.sqrt(W*W+X*X);switch(w){case"max":_.judgingDistanceH&&(_.judgingDistance=H);break;default:k=k+H;break}}),(!w||w==="mean")&&(_.judgingDistance=k/E.length)},v.prototype.stop=function(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)},v.prototype.destroy=function(){var g=this;g.stop(),g.tick=null,g.nodes=null,g.edges=null,g.destroyed=!0},v.prototype.getType=function(){return"force2"},v.prototype.getSameTypeLeafMap=function(){var g=this,d=g.nodeClusterBy,_=g.nodes,E=g.edges,w=g.nodeMap,T=g.degreesMap;if(!!(_==null?void 0:_.length)){var k={};return _.forEach(function(b,m){var $=T[b.id].all;$===1&&(k[b.id]=(0,A.getCoreNodeAndRelativeLeafNodes)("leaf",b,E,d,T,w))}),k}},v}(R.Base);U.Force2Layout=y},20039:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0});var z=function(){function B(j){this.id=j.id||0,this.rx=j.rx,this.ry=j.ry,this.fx=0,this.fy=0,this.mass=j.mass,this.degree=j.degree,this.g=j.g||0}return B.prototype.distanceTo=function(j){var R=this.rx-j.rx,A=this.ry-j.ry;return Math.hypot(R,A)},B.prototype.setPos=function(j,R){this.rx=j,this.ry=R},B.prototype.resetForce=function(){this.fx=0,this.fy=0},B.prototype.addForce=function(j){var R=j.rx-this.rx,A=j.ry-this.ry,N=Math.hypot(R,A);N=N<1e-4?1e-4:N;var L=this.g*(this.degree+1)*(j.degree+1)/N;this.fx+=L*R/N,this.fy+=L*A/N},B.prototype.in=function(j){return j.contains(this.rx,this.ry)},B.prototype.add=function(j){var R=this.mass+j.mass,A=(this.rx*this.mass+j.rx*j.mass)/R,N=(this.ry*this.mass+j.ry*j.mass)/R,L=this.degree+j.degree,y={rx:A,ry:N,mass:R,degree:L};return new B(y)},B}();U.default=z},16919:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var v=function(g,d){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,E){_.__proto__=E}||function(_,E){for(var w in E)Object.prototype.hasOwnProperty.call(E,w)&&(_[w]=E[w])},v(g,d)};return function(g,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");v(g,d);function _(){this.constructor=g}g.prototype=d===null?Object.create(d):(_.prototype=d.prototype,new _)}}(),j=this&&this.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(U,"__esModule",{value:!0}),U.ForceAtlas2Layout=void 0;var R=z(46253),A=z(8273),N=j(z(20039)),L=j(z(78150)),y=j(z(58979)),x=function(v){B(g,v);function g(d){var _=v.call(this)||this;return _.center=[0,0],_.width=300,_.height=300,_.nodes=[],_.edges=[],_.kr=5,_.kg=1,_.mode="normal",_.preventOverlap=!1,_.dissuadeHubs=!1,_.barnesHut=void 0,_.maxIteration=0,_.ks=.1,_.ksmax=10,_.tao=.1,_.onLayoutEnd=function(){},_.prune=void 0,_.updateCfg(d),_}return g.prototype.getDefaultCfg=function(){return{}},g.prototype.execute=function(){var d=this,_=d.nodes,E=d.onLayoutEnd,w=d.prune,T=d.maxIteration;!d.width&&typeof window!="undefined"&&(d.width=window.innerWidth),!d.height&&typeof window!="undefined"&&(d.height=window.innerHeight);for(var k=[],b=_.length,m=0;m250&&(d.barnesHut=!0),d.prune===void 0&&b>100&&(d.prune=!0),this.maxIteration===0&&!d.prune?(T=250,b<=200&&b>100?T=1e3:b>200&&(T=1200),this.maxIteration=T):this.maxIteration===0&&w&&(T=100,b<=200&&b>100?T=500:b>200&&(T=950),this.maxIteration=T),d.kr||(d.kr=50,b>100&&b<=500?d.kr=20:b>500&&(d.kr=1)),d.kg||(d.kg=20,b>100&&b<=500?d.kg=10:b>500&&(d.kg=1)),this.nodes=d.updateNodesByForces(k),E()},g.prototype.updateNodesByForces=function(d){for(var _=this,E=_.edges,w=_.maxIteration,T=_.nodes,k=E.filter(function(be){var pe=(0,A.getEdgeTerminal)(be,"source"),Me=(0,A.getEdgeTerminal)(be,"target");return pe!==Me}),b=T.length,m=k.length,$=[],W={},X={},H=[],Q=0;Q0;){for(var Se=0;Sete||!W)?fe=this.getOptRepGraForces(fe,Te,T):fe=this.getRepGraForces(J,te,fe,q,k,T);var be=this.updatePos(fe,de,Q,T);m=be.nodes,Q=be.sg,J--,b.tick&&b.tick()}return m},g.prototype.getAttrForces=function(d,_,E,w,T,k,b,m){for(var $=this,W=$.nodes,X=$.preventOverlap,H=$.dissuadeHubs,Q=$.mode,q=$.prune,J=0;J0&&(be=Ie,pe=Ie),m[2*w[te.id]]+=be*Se[0],m[2*w[de.id]]-=pe*Se[0],m[2*w[te.id]+1]+=be*Se[1],m[2*w[de.id]+1]-=pe*Se[1]}}return m},g.prototype.getRepGraForces=function(d,_,E,w,T,k){for(var b=this,m=b.nodes,$=b.preventOverlap,W=b.kr,X=b.kg,H=b.center,Q=b.prune,q=m.length,J=0;J0&&(Te=W*(k[J]+1)*(k[te]+1)/de),E[2*J]-=Te*fe[0],E[2*te]+=Te*fe[0],E[2*J+1]-=Te*fe[1],E[2*te+1]+=Te*fe[1]}var Se=[m[J].x-H[0],m[J].y-H[1]],Ie=Math.hypot(Se[0],Se[1]);Se[0]=Se[0]/Ie,Se[1]=Se[1]/Ie;var be=X*(k[J]+1);E[2*J]-=be*Se[0],E[2*J+1]-=be*Se[1]}return E},g.prototype.getOptRepGraForces=function(d,_,E){for(var w=this,T=w.nodes,k=w.kg,b=w.center,m=w.prune,$=T.length,W=9e10,X=-9e10,H=9e10,Q=-9e10,q=0;q<$;q+=1)m&&E[q]<=1||(_[q].setPos(T[q].x,T[q].y),T[q].x>=X&&(X=T[q].x),T[q].x<=W&&(W=T[q].x),T[q].y>=Q&&(Q=T[q].y),T[q].y<=H&&(H=T[q].y));for(var J=Math.max(X-W,Q-H),te={xmid:(X+W)/2,ymid:(Q+H)/2,length:J,massCenter:b,mass:$},fe=new L.default(te),de=new y.default(fe),q=0;q<$;q+=1)m&&E[q]<=1||_[q].in(fe)&&de.insert(_[q]);for(var q=0;q<$;q+=1)if(!(m&&E[q]<=1)){_[q].resetForce(),de.updateForce(_[q]),d[2*q]-=_[q].fx,d[2*q+1]-=_[q].fy;var Te=[T[q].x-b[0],T[q].y-b[1]],Se=Math.hypot(Te[0],Te[1]);Se=Se<1e-4?1e-4:Se,Te[0]=Te[0]/Se,Te[1]=Te[1]/Se;var Ie=k*(E[q]+1);d[2*q]-=Ie*Te[0],d[2*q+1]-=Ie*Te[1]}return d},g.prototype.updatePos=function(d,_,E,w){for(var T=this,k=T.nodes,b=T.ks,m=T.tao,$=T.prune,W=T.ksmax,X=k.length,H=[],Q=[],q=0,J=0,te=0;te1.5*Ie?1.5*Ie:E);for(var te=0;teMe?Me:be;var De=be*d[2*te],Ue=be*d[2*te+1];k[te].x+=De,k[te].y+=Ue}return{nodes:k,sg:E}},g}(R.Base);U.ForceAtlas2Layout=x},78150:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0});var z=function(){function B(j){this.xmid=j.xmid,this.ymid=j.ymid,this.length=j.length,this.massCenter=j.massCenter||[0,0],this.mass=j.mass||1}return B.prototype.getLength=function(){return this.length},B.prototype.contains=function(j,R){var A=this.length/2;return j<=this.xmid+A&&j>=this.xmid-A&&R<=this.ymid+A&&R>=this.ymid-A},B.prototype.NW=function(){var j=this.xmid-this.length/4,R=this.ymid+this.length/4,A=this.length/2,N={xmid:j,ymid:R,length:A},L=new B(N);return L},B.prototype.NE=function(){var j=this.xmid+this.length/4,R=this.ymid+this.length/4,A=this.length/2,N={xmid:j,ymid:R,length:A},L=new B(N);return L},B.prototype.SW=function(){var j=this.xmid-this.length/4,R=this.ymid-this.length/4,A=this.length/2,N={xmid:j,ymid:R,length:A},L=new B(N);return L},B.prototype.SE=function(){var j=this.xmid+this.length/4,R=this.ymid-this.length/4,A=this.length/2,N={xmid:j,ymid:R,length:A},L=new B(N);return L},B}();U.default=z},58979:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0});var z=function(){function B(j){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,j!=null&&(this.quad=j)}return B.prototype.insert=function(j){if(this.body==null){this.body=j;return}this._isExternal()?(this.quad&&(this.NW=new B(this.quad.NW()),this.NE=new B(this.quad.NE()),this.SW=new B(this.quad.SW()),this.SE=new B(this.quad.SE())),this._putBody(this.body),this._putBody(j),this.body=this.body.add(j)):(this.body=this.body.add(j),this._putBody(j))},B.prototype._putBody=function(j){!this.quad||(j.in(this.quad.NW())&&this.NW?this.NW.insert(j):j.in(this.quad.NE())&&this.NE?this.NE.insert(j):j.in(this.quad.SW())&&this.SW?this.SW.insert(j):j.in(this.quad.SE())&&this.SE&&this.SE.insert(j))},B.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},B.prototype.updateForce=function(j){if(!(this.body==null||j===this.body))if(this._isExternal())j.addForce(this.body);else{var R=this.quad?this.quad.getLength():0,A=this.body.distanceTo(j);R/A-1||(W[H]=$[H])}),W}),b.ticking=!1},T.prototype.execute=function(k){var b=this,m=b.nodes,$=b.edges;if(!b.ticking){var W=b.forceSimulation,X=b.alphaMin,H=b.alphaDecay,Q=b.alpha;if(W){if(k){if(b.clustering&&b.clusterForce&&(b.clusterForce.nodes(m),b.clusterForce.links($)),W.nodes(m),$&&b.edgeForce)b.edgeForce.links($);else if($&&!b.edgeForce){var te=L.forceLink().id(function(Se){return Se.id}).links($);b.edgeStrength&&te.strength(b.edgeStrength),b.linkDistance&&te.distance(b.linkDistance),b.edgeForce=te,W.force("link",te)}}b.preventOverlap&&b.overlapProcess(W),W.alpha(Q).restart(),this.ticking=!0}else try{var q=L.forceManyBody();if(b.nodeStrength&&q.strength(b.nodeStrength),W=L.forceSimulation().nodes(m),b.clustering){var J=(0,y.default)();J.centerX(b.center[0]).centerY(b.center[1]).template("force").strength(b.clusterFociStrength),$&&J.links($),m&&J.nodes(m),J.forceLinkDistance(b.clusterEdgeDistance).forceLinkStrength(b.clusterEdgeStrength).forceCharge(b.clusterNodeStrength).forceNodeSize(b.clusterNodeSize),b.clusterForce=J,W.force("group",J)}if(W.force("center",L.forceCenter(b.center[0],b.center[1])).force("charge",q).alpha(Q).alphaDecay(H).alphaMin(X),b.preventOverlap&&b.overlapProcess(W),$){var te=L.forceLink().id(function(Te){return Te.id}).links($);b.edgeStrength&&te.strength(b.edgeStrength),b.linkDistance&&te.distance(b.linkDistance),b.edgeForce=te,W.force("link",te)}if(b.workerEnabled&&!E()&&(b.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),!b.workerEnabled)W.on("tick",function(){b.tick()}).on("end",function(){b.ticking=!1,b.onLayoutEnd&&b.onLayoutEnd()}),b.ticking=!0;else{W.stop();for(var fe=_(W),de=1;de<=fe;de++)W.tick(),postMessage({nodes:m,currentTick:de,totalTicks:fe,type:g.LAYOUT_MESSAGE.TICK},void 0);b.ticking=!1}b.forceSimulation=W,b.ticking=!0}catch(Te){b.ticking=!1,console.warn(Te)}}},T.prototype.overlapProcess=function(k){var b=this,m=b.nodeSize,$=b.nodeSpacing,W,X,H=b.collideStrength;if((0,x.isNumber)($)?X=function(){return $}:(0,x.isFunction)($)?X=$:X=function(){return 0},!m)W=function(te){if(te.size){if((0,x.isArray)(te.size)){var fe=te.size[0]>te.size[1]?te.size[0]:te.size[1];return fe/2+X(te)}if((0,x.isObject)(te.size)){var fe=te.size.width>te.size.height?te.size.width:te.size.height;return fe/2+X(te)}return te.size/2+X(te)}return 10+X(te)};else if((0,x.isFunction)(m))W=function(te){var fe=m(te);return fe+X(te)};else if((0,x.isArray)(m)){var Q=m[0]>m[1]?m[0]:m[1],q=Q/2;W=function(te){return q+X(te)}}else if((0,x.isNumber)(m)){var J=m/2;W=function(te){return J+X(te)}}else W=function(){return 10};k.force("collisionForce",L.forceCollide(W).strength(H))},T.prototype.updateCfg=function(k){var b=this;b.ticking&&(b.forceSimulation.stop(),b.ticking=!1),b.forceSimulation=null,Object.assign(b,k)},T.prototype.destroy=function(){var k=this;k.ticking&&(k.forceSimulation.stop(),k.ticking=!1),k.nodes=null,k.edges=null,k.destroyed=!0},T}(v.Base);U.ForceLayout=d;function _(w){var T=w.alphaMin(),k=w.alphaTarget(),b=w.alpha(),m=Math.log((T-k)/(b-k))/Math.log(1-w.alphaDecay()),$=Math.ceil(m);return $}function E(){return typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope}},64180:function(or,U,z){"use strict";var B=this&&this.__createBinding||(Object.create?function(R,A,N,L){L===void 0&&(L=N);var y=Object.getOwnPropertyDescriptor(A,N);(!y||("get"in y?!A.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:function(){return A[N]}}),Object.defineProperty(R,L,y)}:function(R,A,N,L){L===void 0&&(L=N),R[L]=A[N]}),j=this&&this.__exportStar||function(R,A){for(var N in R)N!=="default"&&!Object.prototype.hasOwnProperty.call(A,N)&&B(A,R,N)};Object.defineProperty(U,"__esModule",{value:!0}),j(z(68553),U)},23826:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var L=function(y,x){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,g){v.__proto__=g}||function(v,g){for(var d in g)Object.prototype.hasOwnProperty.call(g,d)&&(v[d]=g[d])},L(y,x)};return function(y,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");L(y,x);function v(){this.constructor=y}y.prototype=x===null?Object.create(x):(v.prototype=x.prototype,new v)}}();Object.defineProperty(U,"__esModule",{value:!0}),U.FruchtermanLayout=void 0;var j=z(46253),R=z(8273),A=800,N=function(L){B(y,L);function y(x){var v=L.call(this)||this;return v.maxIteration=1e3,v.workerEnabled=!1,v.gravity=10,v.speed=5,v.clustering=!1,v.clusterGravity=10,v.nodes=[],v.edges=[],v.width=300,v.height=300,v.nodeMap={},v.nodeIdxMap={},v.onLayoutEnd=function(){},v.tick=function(){},v.animate=!0,v.updateCfg(x),v}return y.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},y.prototype.execute=function(){var x=this,v,g,d=this,_=d.nodes;if(d.timeInterval!==void 0&&typeof window!="undefined"&&window.clearInterval(d.timeInterval),!_||_.length===0){(v=d.onLayoutEnd)===null||v===void 0||v.call(d);return}!d.width&&typeof window!="undefined"&&(d.width=window.innerWidth),!d.height&&typeof window!="undefined"&&(d.height=window.innerHeight),d.center||(d.center=[d.width/2,d.height/2]);var E=d.center;if(_.length===1){_[0].x=E[0],_[0].y=E[1],(g=d.onLayoutEnd)===null||g===void 0||g.call(d);return}var w={},T={};return _.forEach(function(k,b){(0,R.isNumber)(k.x)||(k.x=Math.random()*x.width),(0,R.isNumber)(k.y)||(k.y=Math.random()*x.height),w[k.id]=k,T[k.id]=b}),d.nodeMap=w,d.nodeIdxMap=T,d.run()},y.prototype.run=function(){var x,v=this,g=v.nodes;if(!!g){var d=v.edges,_=v.maxIteration,E=v.workerEnabled,w=v.clustering,T=v.animate,k={};if(w&&g.forEach(function($){k[$.cluster]===void 0&&(k[$.cluster]={name:$.cluster,cx:0,cy:0,count:0})}),E||!T){for(var b=0;b<_;b++)v.runOneStep(k);(x=v.onLayoutEnd)===null||x===void 0||x.call(v)}else{if(typeof window=="undefined")return;var m=0;this.timeInterval=window.setInterval(function(){var $;v.runOneStep(k),m++,m>=_&&(($=v.onLayoutEnd)===null||$===void 0||$.call(v),window.clearInterval(v.timeInterval))},0)}return{nodes:g,edges:d}}},y.prototype.runOneStep=function(x){var v,g=this,d=g.nodes;if(!!d){var _=g.edges,E=g.center,w=g.gravity,T=g.speed,k=g.clustering,b=g.height*g.width,m=Math.sqrt(b)/10,$=b/(d.length+1),W=Math.sqrt($),X=[];if(d.forEach(function(q,J){X[J]={x:0,y:0}}),g.applyCalculate(d,_,X,W,$),k){for(var H in x)x[H].cx=0,x[H].cy=0,x[H].count=0;d.forEach(function(q){var J=x[q.cluster];(0,R.isNumber)(q.x)&&(J.cx+=q.x),(0,R.isNumber)(q.y)&&(J.cy+=q.y),J.count++});for(var H in x)x[H].cx/=x[H].count,x[H].cy/=x[H].count;var Q=g.clusterGravity||w;d.forEach(function(q,J){if(!(!(0,R.isNumber)(q.x)||!(0,R.isNumber)(q.y))){var te=x[q.cluster],fe=Math.sqrt((q.x-te.cx)*(q.x-te.cx)+(q.y-te.cy)*(q.y-te.cy)),de=W*Q;X[J].x-=de*(q.x-te.cx)/fe,X[J].y-=de*(q.y-te.cy)/fe}})}d.forEach(function(q,J){if(!(!(0,R.isNumber)(q.x)||!(0,R.isNumber)(q.y))){var te=.01*W*w;X[J].x-=te*(q.x-E[0]),X[J].y-=te*(q.y-E[1])}}),d.forEach(function(q,J){if((0,R.isNumber)(q.fx)&&(0,R.isNumber)(q.fy)){q.x=q.fx,q.y=q.fy;return}if(!(!(0,R.isNumber)(q.x)||!(0,R.isNumber)(q.y))){var te=Math.sqrt(X[J].x*X[J].x+X[J].y*X[J].y);if(te>0){var fe=Math.min(m*(T/A),te);q.x+=X[J].x/te*fe,q.y+=X[J].y/te*fe}}}),(v=g.tick)===null||v===void 0||v.call(g)}},y.prototype.applyCalculate=function(x,v,g,d,_){var E=this;E.calRepulsive(x,g,_),v&&E.calAttractive(v,g,d)},y.prototype.calRepulsive=function(x,v,g){x.forEach(function(d,_){v[_]={x:0,y:0},x.forEach(function(E,w){if(_!==w&&!(!(0,R.isNumber)(d.x)||!(0,R.isNumber)(E.x)||!(0,R.isNumber)(d.y)||!(0,R.isNumber)(E.y))){var T=d.x-E.x,k=d.y-E.y,b=T*T+k*k;if(b===0){b=1;var m=_>w?1:-1;T=.01*m,k=.01*m}var $=g/b;v[_].x+=T*$,v[_].y+=k*$}})})},y.prototype.calAttractive=function(x,v,g){var d=this;x.forEach(function(_){var E=(0,R.getEdgeTerminal)(_,"source"),w=(0,R.getEdgeTerminal)(_,"target");if(!(!E||!w)){var T=d.nodeIdxMap[E],k=d.nodeIdxMap[w];if(T!==k){var b=d.nodeMap[E],m=d.nodeMap[w];if(!(!(0,R.isNumber)(m.x)||!(0,R.isNumber)(b.x)||!(0,R.isNumber)(m.y)||!(0,R.isNumber)(b.y))){var $=m.x-b.x,W=m.y-b.y,X=Math.sqrt($*$+W*W),H=X*X/g;v[k].x-=$/X*H,v[k].y-=W/X*H,v[T].x+=$/X*H,v[T].y+=W/X*H}}}})},y.prototype.stop=function(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)},y.prototype.destroy=function(){var x=this;x.stop(),x.tick=null,x.nodes=null,x.edges=null,x.destroyed=!0},y.prototype.getType=function(){return"fruchterman"},y}(j.Base);U.FruchtermanLayout=N},46260:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var L=function(y,x){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,g){v.__proto__=g}||function(v,g){for(var d in g)Object.prototype.hasOwnProperty.call(g,d)&&(v[d]=g[d])},L(y,x)};return function(y,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");L(y,x);function v(){this.constructor=y}y.prototype=x===null?Object.create(x):(v.prototype=x.prototype,new v)}}();Object.defineProperty(U,"__esModule",{value:!0}),U.GForceLayout=void 0;var j=z(46253),R=z(8273),A=function(L,y){var x;return L?(0,R.isNumber)(L)?x=function(v){return L}:x=L:x=function(v){return y||1},x},N=function(L){B(y,L);function y(x){var v=L.call(this)||this;return v.maxIteration=500,v.workerEnabled=!1,v.edgeStrength=200,v.nodeStrength=1e3,v.coulombDisScale=.005,v.damping=.9,v.maxSpeed=1e3,v.minMovement=.5,v.interval=.02,v.factor=1,v.linkDistance=1,v.gravity=10,v.preventOverlap=!0,v.collideStrength=1,v.tick=function(){},v.nodes=[],v.edges=[],v.width=300,v.height=300,v.nodeMap={},v.nodeIdxMap={},v.animate=!0,v.updateCfg(x),v}return y.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},y.prototype.execute=function(){var x,v,g=this,d=g.nodes;if(g.timeInterval!==void 0&&typeof window!="undefined"&&window.clearInterval(g.timeInterval),!d||d.length===0){(x=g.onLayoutEnd)===null||x===void 0||x.call(g);return}!g.width&&typeof window!="undefined"&&(g.width=window.innerWidth),!g.height&&typeof window!="undefined"&&(g.height=window.innerHeight),g.center||(g.center=[g.width/2,g.height/2]);var _=g.center;if(d.length===1){d[0].x=_[0],d[0].y=_[1],(v=g.onLayoutEnd)===null||v===void 0||v.call(g);return}var E={},w={};d.forEach(function(W,X){(0,R.isNumber)(W.x)||(W.x=Math.random()*g.width),(0,R.isNumber)(W.y)||(W.y=Math.random()*g.height),E[W.id]=W,w[W.id]=X}),g.nodeMap=E,g.nodeIdxMap=w,g.linkDistance=A(g.linkDistance,1),g.nodeStrength=A(g.nodeStrength,1),g.edgeStrength=A(g.edgeStrength,1);var T=g.nodeSize,k;if(g.preventOverlap){var b=g.nodeSpacing,m;(0,R.isNumber)(b)?m=function(){return b}:(0,R.isFunction)(b)?m=b:m=function(){return 0},T?(0,R.isArray)(T)?k=function(W){return Math.max(T[0],T[1])+m(W)}:k=function(W){return T+m(W)}:k=function(W){return W.size?(0,R.isArray)(W.size)?Math.max(W.size[0],W.size[1])+m(W):(0,R.isObject)(W.size)?Math.max(W.size.width,W.size.height)+m(W):W.size+m(W):10+m(W)}}g.nodeSize=k;var $=g.edges;g.degrees=(0,R.getDegree)(d.length,g.nodeIdxMap,$),g.getMass||(g.getMass=function(W){var X=W.mass||g.degrees[g.nodeIdxMap[W.id]].all||1;return X}),g.run()},y.prototype.run=function(){var x,v=this,g=v.maxIteration,d=v.nodes,_=v.workerEnabled,E=v.minMovement,w=v.animate;if(!!d)if(_||!w){for(var T=0;T=g&&(($=v.onLayoutEnd)===null||$===void 0||$.call(v),window.clearInterval(v.timeInterval))}},0)}},y.prototype.reachMoveThreshold=function(x,v,g){var d=0;return x.forEach(function(_,E){var w=_.x-v[E].x,T=_.y-v[E].y;d+=Math.sqrt(w*w+T*T)}),d/=x.length,d=Q)){var q=$.x-H.x,J=$.y-H.y;q===0&&J===0&&(q=Math.random()*.01,J=Math.random()*.01);var te=q*q+J*J,fe=Math.sqrt(te),de=(fe+.1)*E,Te=q/fe,Se=J/fe,Ie=(b($)+b(H))*.5*_/(de*de),be=d?d(H):1;if(x[2*W]+=Te*Ie,x[2*W+1]+=Se*Ie,x[2*Q]-=Te*Ie,x[2*Q+1]-=Se*Ie,w&&(m($)+m(H))/2>fe){var pe=k*(b($)+b(H))*.5/te;x[2*W]+=Te*pe/X,x[2*W+1]+=Se*pe/X,x[2*Q]-=Te*pe/be,x[2*Q+1]-=Se*pe/be}}})})},y.prototype.calAttractive=function(x,v){var g=this,d=g.nodeMap,_=g.nodeIdxMap,E=g.linkDistance,w=g.edgeStrength,T=g.nodeSize,k=g.getMass;v.forEach(function(b,m){var $=(0,R.getEdgeTerminal)(b,"source"),W=(0,R.getEdgeTerminal)(b,"target"),X=d[$],H=d[W],Q=H.x-X.x,q=H.y-X.y;Q===0&&q===0&&(Q=Math.random()*.01,q=Math.random()*.01);var J=Math.sqrt(Q*Q+q*q),te=Q/J,fe=q/J,de=E(b,X,H)||1+(T(X)+T(H)||0)/2,Te=de-J,Se=Te*w(b),Ie=_[$],be=_[W],pe=k?k(X):1,Me=k?k(H):1;x[2*Ie]-=te*Se/pe,x[2*Ie+1]-=fe*Se/pe,x[2*be]+=te*Se/Me,x[2*be+1]+=fe*Se/Me})},y.prototype.calGravity=function(x,v){for(var g=this,d=g.center,_=g.gravity,E=g.degrees,w=v.length,T=0;T_.maxSpeed){var $=_.maxSpeed/m;k=$*k,b=$*b}v[2*T]=k,v[2*T+1]=b})},y.prototype.updatePosition=function(x,v,g){g.forEach(function(d,_){if((0,R.isNumber)(d.fx)&&(0,R.isNumber)(d.fy)){d.x=d.fx,d.y=d.fy;return}var E=x[2*_]*v,w=x[2*_+1]*v;d.x+=E,d.y+=w})},y.prototype.stop=function(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)},y.prototype.destroy=function(){var x=this;x.stop(),x.tick=null,x.nodes=null,x.edges=null,x.destroyed=!0},y.prototype.getType=function(){return"gForce"},y}(j.Base);U.GForceLayout=N},81822:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var d=function(_,E){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,T){w.__proto__=T}||function(w,T){for(var k in T)Object.prototype.hasOwnProperty.call(T,k)&&(w[k]=T[k])},d(_,E)};return function(_,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");d(_,E);function w(){this.constructor=_}_.prototype=E===null?Object.create(E):(w.prototype=E.prototype,new w)}}(),j=this&&this.__awaiter||function(d,_,E,w){function T(k){return k instanceof E?k:new E(function(b){b(k)})}return new(E||(E=Promise))(function(k,b){function m(X){try{W(w.next(X))}catch(H){b(H)}}function $(X){try{W(w.throw(X))}catch(H){b(H)}}function W(X){X.done?k(X.value):T(X.value).then(m,$)}W((w=w.apply(d,_||[])).next())})},R=this&&this.__generator||function(d,_){var E={label:0,sent:function(){if(k[0]&1)throw k[1];return k[1]},trys:[],ops:[]},w,T,k,b;return b={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function m(W){return function(X){return $([W,X])}}function $(W){if(w)throw new TypeError("Generator is already executing.");for(;b&&(b=0,W[0]&&(E=0)),E;)try{if(w=1,T&&(k=W[0]&2?T.return:W[0]?T.throw||((k=T.return)&&k.call(T),0):T.next)&&!(k=k.call(T,W[1])).done)return k;switch(T=0,k&&(W=[W[0]&2,k.value]),W[0]){case 0:case 1:k=W;break;case 4:return E.label++,{value:W[1],done:!1};case 5:E.label++,T=W[1],W=[0];continue;case 7:W=E.ops.pop(),E.trys.pop();continue;default:if(k=E.trys,!(k=k.length>0&&k[k.length-1])&&(W[0]===6||W[0]===2)){E=0;continue}if(W[0]===3&&(!k||W[1]>k[0]&&W[1] 0.0) { dx += param * xDist; dy += param * yDist; if (xDist == 0 && yDist == 0) { const sign = i < j ? 1 : -1; dx += param * sign; dy += param * sign; } } } } return [dx, dy]; } calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { // let dx = 0, dy = 0; const vx = currentNode[0] - this.u_Center[0]; const vy = currentNode[1] - this.u_Center[1]; const gf = 0.01 * this.u_K * this.u_Gravity; dx = gf * vx; dy = gf * vy; if (this.u_Clustering == 1) { const clusterIdx = int(nodeAttributes[0]); const center = this.u_ClusterCenters[clusterIdx]; const cvx = currentNode[0] - center[0]; const cvy = currentNode[1] - center[1]; const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01; const parma = this.u_K * this.u_ClusterGravity / dist; dx += parma * cvx; dy += parma * cvy; } return [dx, dy]; } calcAttractive(i: int, currentNode: vec4): vec2 { let dx = 0, dy = 0; const arr_offset = int(floor(currentNode[2] + 0.5)); const length = int(floor(currentNode[3] + 0.5)); const node_buffer: vec4; for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) { if (p >= length) break; const arr_idx = arr_offset + p; // when arr_idx % 4 == 0 update currentNodedx_buffer const buf_offset = arr_idx - arr_idx / 4 * 4; if (p == 0 || buf_offset == 0) { node_buffer = this.u_Data[int(arr_idx / 4)]; } const float_j = buf_offset == 0 ? node_buffer[0] : buf_offset == 1 ? node_buffer[1] : buf_offset == 2 ? node_buffer[2] : node_buffer[3]; const nextNode = this.u_Data[int(float_j)]; const xDist = currentNode[0] - nextNode[0]; const yDist = currentNode[1] - nextNode[1]; const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01; let attractiveF = dist / this.u_K; if (dist > 0.0) { dx -= xDist * attractiveF; dy -= yDist * attractiveF; if (xDist == 0 && yDist == 0) { const sign = i < int(float_j) ? 1 : -1; dx -= sign * attractiveF; dy -= sign * attractiveF; } } } return [dx, dy]; } @main compute() { const i = globalInvocationID.x; const currentNode = this.u_Data[i]; let dx = 0, dy = 0; if (i >= VERTEX_COUNT) { this.u_Data[i] = currentNode; return; } // [gravity, fx, fy, 0] const nodeAttributes = this.u_AttributeArray[i]; if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) { // the node is fixed this.u_Data[i] = [ nodeAttributes[1], nodeAttributes[2], currentNode[2], currentNode[3] ]; return; } // repulsive const repulsive = this.calcRepulsive(i, currentNode); dx += repulsive[0]; dy += repulsive[1]; // attractive const attractive = this.calcAttractive(i, currentNode); dx += attractive[0]; dy += attractive[1]; // gravity const gravity = this.calcGravity(currentNode, nodeAttributes); dx -= gravity[0]; dy -= gravity[1]; // speed dx *= this.u_Speed; dy *= this.u_Speed; // move const distLength = sqrt(dx * dx + dy * dy); if (distLength > 0.0) { const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength); this.u_Data[i] = [ currentNode[0] + dx / distLength * limitedDist, currentNode[1] + dy / distLength * limitedDist, currentNode[2], currentNode[3] ]; } } } `,U.fruchtermanBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',U.clusterCode=` import { globalInvocationID } from 'g-webgpu'; const VERTEX_COUNT; const CLUSTER_COUNT; @numthreads(1, 1, 1) class CalcCenter { @in u_Data: vec4[]; @in u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...] @in @out u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...] @main compute() { const i = globalInvocationID.x; const center = this.u_ClusterCenters[i]; let sumx = 0; let sumy = 0; let count = 0; for (let j = 0; j < VERTEX_COUNT; j++) { const attributes = this.u_NodeAttributes[j]; const clusterIdx = int(attributes[0]); const vertex = this.u_Data[j]; if (clusterIdx == i) { sumx += vertex.x; sumy += vertex.y; count += 1; } } this.u_ClusterCenters[i] = [ sumx / count, sumy / count, count, i ]; } } `,U.clusterBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}'},86043:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var _=function(E,w){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,k){T.__proto__=k}||function(T,k){for(var b in k)Object.prototype.hasOwnProperty.call(k,b)&&(T[b]=k[b])},_(E,w)};return function(E,w){if(typeof w!="function"&&w!==null)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");_(E,w);function T(){this.constructor=E}E.prototype=w===null?Object.create(w):(T.prototype=w.prototype,new T)}}(),j=this&&this.__awaiter||function(_,E,w,T){function k(b){return b instanceof w?b:new w(function(m){m(b)})}return new(w||(w=Promise))(function(b,m){function $(H){try{X(T.next(H))}catch(Q){m(Q)}}function W(H){try{X(T.throw(H))}catch(Q){m(Q)}}function X(H){H.done?b(H.value):k(H.value).then($,W)}X((T=T.apply(_,E||[])).next())})},R=this&&this.__generator||function(_,E){var w={label:0,sent:function(){if(b[0]&1)throw b[1];return b[1]},trys:[],ops:[]},T,k,b,m;return m={next:$(0),throw:$(1),return:$(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function $(X){return function(H){return W([X,H])}}function W(X){if(T)throw new TypeError("Generator is already executing.");for(;m&&(m=0,X[0]&&(w=0)),w;)try{if(T=1,k&&(b=X[0]&2?k.return:X[0]?k.throw||((b=k.return)&&b.call(k),0):k.next)&&!(b=b.call(k,X[1])).done)return b;switch(k=0,b&&(X=[X[0]&2,b.value]),X[0]){case 0:case 1:b=X;break;case 4:return w.label++,{value:X[1],done:!1};case 5:w.label++,k=X[1],X=[0];continue;case 7:X=w.ops.pop(),w.trys.pop();continue;default:if(b=w.trys,!(b=b.length>0&&b[b.length-1])&&(X[0]===6||X[0]===2)){w=0;continue}if(X[0]===3&&(!b||X[1]>b[0]&&X[1]= length) break; const arr_idx = arr_offset + 4 * p; // i \u8282\u70B9\u7684\u7B2C p \u6761\u8FB9\u5F00\u59CB\u7684\u5C0F\u683C\u5B50\u4F4D\u7F6E const buf_offset = arr_idx - arr_idx / 4 * 4; if (p == 0 || buf_offset == 0) { node_buffer = this.u_Data[int(arr_idx / 4)]; // \u5927\u683C\u5B50\uFF0C\u5927\u683C\u5B50\u4F4D\u7F6E=\u5C0F\u4E2A\u5B50\u4F4D\u7F6E / 4\uFF0C } let float_j: float = node_buffer[0]; const nextNode = this.u_Data[int(float_j)]; const vx = nextNode[0] - currentNode[0]; const vy = nextNode[1] - currentNode[1]; const dist = sqrt(vx * vx + vy * vy) + 0.01; const direx = vx / dist; const direy = vy / dist; const edgeLength = node_buffer[1]; const edgeStrength = node_buffer[2]; const diff: float = edgeLength - dist;//edgeLength // const param = diff * this.u_stiffness / mass; // const param = diff * edgeStrength / mass; // ax -= direx * param; ay -= direy * param; } return [ax, ay]; } @main compute() { const i = globalInvocationID.x; const currentNode = this.u_Data[i]; const movement = u_AveMovement[0]; let ax = 0, ay = 0; if (i >= VERTEX_COUNT || movement.x < u_minMovement) { this.u_Data[i] = currentNode; return; } // \u6BCF\u4E2A\u8282\u70B9\u5C5E\u6027\u5360\u4E24\u4E2A\u6570\u7EC4\u4E2D\u5404\u4E00\u683C // [mass, degree, nodeStrength, fx] const nodeAttributes1 = this.u_NodeAttributeArray1[i]; // [centerX, centerY, centerGravity, fy] const nodeAttributes2 = this.u_NodeAttributeArray2[i]; // repulsive const repulsive = this.calcRepulsive(i, currentNode); ax += repulsive[0]; ay += repulsive[1]; // attractive const attractive = this.calcAttractive(i, currentNode, nodeAttributes1); ax += attractive[0]; ay += attractive[1]; // gravity const gravity = this.calcGravity(i, currentNode, nodeAttributes2); ax -= gravity[0]; ay -= gravity[1]; // speed const param = this.u_interval * this.u_damping; let vx = ax * param; let vy = ay * param; const vlength = sqrt(vx * vx + vy * vy) + 0.0001; if (vlength > this.u_maxSpeed) { const param2 = this.u_maxSpeed / vlength; vx = param2 * vx; vy = param2 * vy; } // move if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) { this.u_Data[i] = [ nodeAttributes1[3], nodeAttributes2[3], currentNode[2], 0 ]; } else { const distx = vx * this.u_interval; const disty = vy * this.u_interval; const distLength = sqrt(distx * distx + disty * disty); this.u_Data[i] = [ currentNode[0] + distx, currentNode[1] + disty, currentNode[2], distLength ]; } // the avarage move distance // need to share memory } } `,U.gForceBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {float distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\ngl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',U.aveMovementCode=` const VERTEX_COUNT; @numthreads(1, 1, 1) class CalcAveMovement { @in u_Data: vec4[]; @in u_iter: float; @in @out u_AveMovement: vec4[]; @main compute() { let movement = 0; for (let j: int = 0; j < VERTEX_COUNT; j++) { const vertex = this.u_Data[j]; movement += vertex[3]; } movement = movement / float(VERTEX_COUNT); this.u_AveMovement[0] = [movement, 0, 0, 0]; } } `,U.aveMovementBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}'},74294:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var N=function(L,y){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,v){x.__proto__=v}||function(x,v){for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(x[g]=v[g])},N(L,y)};return function(L,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");N(L,y);function x(){this.constructor=L}L.prototype=y===null?Object.create(y):(x.prototype=y.prototype,new x)}}();Object.defineProperty(U,"__esModule",{value:!0}),U.GridLayout=void 0;var j=z(8273),R=z(46253),A=function(N){B(L,N);function L(y){var x=N.call(this)||this;return x.begin=[0,0],x.preventOverlap=!0,x.preventOverlapPadding=10,x.condense=!1,x.sortBy="degree",x.nodes=[],x.edges=[],x.width=300,x.height=300,x.row=0,x.col=0,x.cellWidth=0,x.cellHeight=0,x.cellUsed={},x.id2manPos={},x.onLayoutEnd=function(){},x.updateCfg(y),x}return L.prototype.getDefaultCfg=function(){return{begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30}},L.prototype.execute=function(){var y=this,x=y.nodes,v=y.edges,g=y.begin,d=x.length;if(d===0)return y.onLayoutEnd&&y.onLayoutEnd(),{nodes:x,edges:v};if(d===1)return x[0].x=g[0],x[0].y=g[1],y.onLayoutEnd&&y.onLayoutEnd(),{nodes:x,edges:v};var _=y.sortBy,E=y.width,w=y.height,T=y.condense,k=y.preventOverlapPadding,b=y.preventOverlap,m=y.nodeSpacing,$=y.nodeSize,W=[];x.forEach(function(pe){W.push(pe)});var X={};if(W.forEach(function(pe,Me){X[pe.id]=Me}),(_==="degree"||!(0,j.isString)(_)||W[0][_]===void 0)&&(_="degree",(0,j.isNaN)(x[0].degree))){var H=(0,j.getDegree)(W.length,X,v);W.forEach(function(pe,Me){pe.degree=H[Me].all})}W.sort(function(pe,Me){return Me[_]-pe[_]}),!E&&typeof window!="undefined"&&(E=window.innerWidth),!w&&typeof window!="undefined"&&(w=window.innerHeight);var Q=y.rows,q=y.cols!=null?y.cols:y.columns;if(y.cells=d,Q!=null&&q!=null?(y.rows=Q,y.cols=q):Q!=null&&q==null?(y.rows=Q,y.cols=Math.ceil(y.cells/y.rows)):Q==null&&q!=null?(y.cols=q,y.rows=Math.ceil(y.cells/y.cols)):(y.splits=Math.sqrt(y.cells*y.height/y.width),y.rows=Math.round(y.splits),y.cols=Math.round(y.width/y.height*y.splits)),y.rows=Math.max(y.rows,1),y.cols=Math.max(y.cols,1),y.cols*y.rows>y.cells){var J=y.small(),te=y.large();(J-1)*te>=y.cells?y.small(J-1):(te-1)*J>=y.cells&&y.large(te-1)}else for(;y.cols*y.rows=y.cells?y.large(te+1):y.small(J+1)}if(y.cellWidth=E/y.cols,y.cellHeight=w/y.rows,T&&(y.cellWidth=0,y.cellHeight=0),b||m){var fe=(0,j.getFuncByUnknownType)(10,m),de=(0,j.getFuncByUnknownType)(30,$,!1);W.forEach(function(pe){(!pe.x||!pe.y)&&(pe.x=0,pe.y=0);var Me=de(pe)||30,De,Ue;(0,j.isArray)(Me)?(De=Me[0],Ue=Me[1]):(De=Me,Ue=Me);var nt=fe!==void 0?fe(pe):k,Ze=De+nt,ht=Ue+nt;y.cellWidth=Math.max(y.cellWidth,Ze),y.cellHeight=Math.max(y.cellHeight,ht)})}y.cellUsed={},y.row=0,y.col=0,y.id2manPos={};for(var Te=0;Te=x&&(y.col=0,y.row++)},L.prototype.getPos=function(y){var x=this,v=x.begin,g=x.cellWidth,d=x.cellHeight,_,E,w=x.id2manPos[y.id];if(w)_=w.col*g+g/2+v[0],E=w.row*d+d/2+v[1];else{for(;x.used(x.row,x.col);)x.moveToNextCell();_=x.col*g+g/2+v[0],E=x.row*d+d/2+v[1],x.use(x.row,x.col),x.moveToNextCell()}y.x=_,y.y=E},L.prototype.getType=function(){return"grid"},L}(R.Base);U.GridLayout=A},64649:function(or,U,z){"use strict";var B=this&&this.__createBinding||(Object.create?function(H,Q,q,J){J===void 0&&(J=q);var te=Object.getOwnPropertyDescriptor(Q,q);(!te||("get"in te?!Q.__esModule:te.writable||te.configurable))&&(te={enumerable:!0,get:function(){return Q[q]}}),Object.defineProperty(H,J,te)}:function(H,Q,q,J){J===void 0&&(J=q),H[J]=Q[q]}),j=this&&this.__exportStar||function(H,Q){for(var q in H)q!=="default"&&!Object.prototype.hasOwnProperty.call(Q,q)&&B(Q,H,q)};Object.defineProperty(U,"__esModule",{value:!0}),U.ERLayout=U.ForceAtlas2Layout=U.ComboCombinedLayout=U.ComboForceLayout=U.GForceGPULayout=U.FruchtermanGPULayout=U.FruchtermanLayout=U.MDSLayout=U.ConcentricLayout=U.RadialLayout=U.DagreCompoundLayout=U.DagreLayout=U.CircularLayout=U.ForceLayout=U.Force2Layout=U.GForceLayout=U.RandomLayout=U.GridLayout=U.Layouts=U.Layout=void 0;var R=z(74294);Object.defineProperty(U,"GridLayout",{enumerable:!0,get:function(){return R.GridLayout}});var A=z(26729);Object.defineProperty(U,"RandomLayout",{enumerable:!0,get:function(){return A.RandomLayout}});var N=z(46260);Object.defineProperty(U,"GForceLayout",{enumerable:!0,get:function(){return N.GForceLayout}});var L=z(38129);Object.defineProperty(U,"Force2Layout",{enumerable:!0,get:function(){return L.Force2Layout}});var y=z(64180);Object.defineProperty(U,"ForceLayout",{enumerable:!0,get:function(){return y.ForceLayout}});var x=z(93959);Object.defineProperty(U,"CircularLayout",{enumerable:!0,get:function(){return x.CircularLayout}});var v=z(2);Object.defineProperty(U,"DagreLayout",{enumerable:!0,get:function(){return v.DagreLayout}});var g=z(77620);Object.defineProperty(U,"DagreCompoundLayout",{enumerable:!0,get:function(){return g.DagreCompoundLayout}});var d=z(90106);Object.defineProperty(U,"RadialLayout",{enumerable:!0,get:function(){return d.RadialLayout}});var _=z(98162);Object.defineProperty(U,"ConcentricLayout",{enumerable:!0,get:function(){return _.ConcentricLayout}});var E=z(98204);Object.defineProperty(U,"MDSLayout",{enumerable:!0,get:function(){return E.MDSLayout}});var w=z(23826);Object.defineProperty(U,"FruchtermanLayout",{enumerable:!0,get:function(){return w.FruchtermanLayout}});var T=z(81822);Object.defineProperty(U,"FruchtermanGPULayout",{enumerable:!0,get:function(){return T.FruchtermanGPULayout}});var k=z(86043);Object.defineProperty(U,"GForceGPULayout",{enumerable:!0,get:function(){return k.GForceGPULayout}});var b=z(48133);Object.defineProperty(U,"ComboForceLayout",{enumerable:!0,get:function(){return b.ComboForceLayout}});var m=z(6412);Object.defineProperty(U,"ComboCombinedLayout",{enumerable:!0,get:function(){return m.ComboCombinedLayout}});var $=z(16919);Object.defineProperty(U,"ForceAtlas2Layout",{enumerable:!0,get:function(){return $.ForceAtlas2Layout}});var W=z(40311);Object.defineProperty(U,"ERLayout",{enumerable:!0,get:function(){return W.ERLayout}});var X=z(99745);Object.defineProperty(U,"Layout",{enumerable:!0,get:function(){return X.Layout}}),Object.defineProperty(U,"Layouts",{enumerable:!0,get:function(){return X.Layouts}}),j(z(2230),U)},99745:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.Layouts=U.Layout=void 0;var B=z(39464),j=z(74294),R=z(26729),A=z(38129),N=z(46260),L=z(64180),y=z(93959),x=z(2),v=z(90106),g=z(98162),d=z(98204),_=z(23826),E=z(81822),w=z(86043),T=z(48133),k=z(6412),b=z(16919),m=z(40311),$=z(77620),W=z(8273),X=function(){function H(Q){var q=(0,B.getLayoutByName)(Q.type);this.layoutInstance=new q(Q)}return H.prototype.layout=function(Q){return this.layoutInstance.layout(Q)},H.prototype.updateCfg=function(Q){this.layoutInstance.updateCfg(Q)},H.prototype.init=function(Q){this.correctLayers(Q.nodes),this.layoutInstance.init(Q)},H.prototype.correctLayers=function(Q){if(!!(Q==null?void 0:Q.length)){var q=Infinity,J=[];if(Q.forEach(function(fe){(0,W.isString)(fe.layer)&&(fe.layer=parseInt(fe.layer,10)),!(fe.layer===void 0||isNaN(fe.layer))&&(J.push(fe),fe.layerk[0]?k[0]:te-k[0],Te=fe-k[1]>k[1]?k[1]:fe-k[1];de===0&&(de=te/2),Te===0&&(Te=fe/2);var Se=Te>de?de:Te,Ie=Math.max.apply(Math,J),be=[];J.forEach(function(Ct,_t){E.unitRadius||(E.unitRadius=Se/Ie),be[_t]=Ct*E.unitRadius}),E.radii=be;var pe=E.eIdealDisMatrix();E.eIdealDistances=pe;var Me=y(pe);E.weights=Me;var De=new N.default({linkDistance:b,distances:pe}),Ue=De.layout();Ue.forEach(function(Ct){(0,R.isNaN)(Ct[0])&&(Ct[0]=Math.random()*b),(0,R.isNaN)(Ct[1])&&(Ct[1]=Math.random()*b)}),E.positions=Ue,Ue.forEach(function(Ct,_t){w[_t].x=Ct[0]+k[0],w[_t].y=Ct[1]+k[1]}),Ue.forEach(function(Ct){Ct[0]-=Ue[X][0],Ct[1]-=Ue[X][1]}),E.run();var nt=E.preventOverlap,Ze=E.nodeSize,ht,Rt=E.strictRadial;if(nt){var tr=E.nodeSpacing,Qe;(0,R.isNumber)(tr)?Qe=function(){return tr}:(0,R.isFunction)(tr)?Qe=tr:Qe=function(){return 0},Ze?(0,R.isArray)(Ze)?ht=function(Ct){var _t=Ze[0]>Ze[1]?Ze[0]:Ze[1];return _t+Qe(Ct)}:ht=function(Ct){return Ze+Qe(Ct)}:ht=function(Ct){if(Ct.size){if((0,R.isArray)(Ct.size)){var _t=Ct.size[0]>Ct.size[1]?Ct.size[0]:Ct.size[1];return _t+Qe(Ct)}if((0,R.isObject)(Ct.size)){var _t=Ct.size.width>Ct.size.height?Ct.size.width:Ct.size.height;return _t+Qe(Ct)}return Ct.size+Qe(Ct)}return 10+Qe(Ct)};var lt={nodes:w,nodeSizeFunc:ht,adjMatrix:H,positions:Ue,radii:be,height:fe,width:te,strictRadial:Rt,focusID:X,iterations:E.maxPreventOverlapIteration||200,k:Ue.length/4.5},St=new L.default(lt);Ue=St.layout()}return Ue.forEach(function(Ct,_t){w[_t].x=Ct[0]+k[0],w[_t].y=Ct[1]+k[1]}),E.onLayoutEnd&&E.onLayoutEnd(),{nodes:w,edges:T}},_.prototype.run=function(){for(var E=this,w=E.maxIteration,T=E.positions||[],k=E.weights||[],b=E.eIdealDistances||[],m=E.radii||[],$=0;$<=w;$++){var W=$/w;E.oneIteration(W,T,m,b,k)}},_.prototype.oneIteration=function(E,w,T,k,b){var m=this,$=1-E,W=m.focusIndex;w.forEach(function(X,H){var Q=v(X,[0,0]),q=Q===0?0:1/Q;if(H!==W){var J=0,te=0,fe=0;w.forEach(function(Te,Se){if(H!==Se){var Ie=v(X,Te),be=Ie===0?0:1/Ie,pe=k[Se][H];fe+=b[H][Se],J+=b[H][Se]*(Te[0]+pe*(X[0]-Te[0])*be),te+=b[H][Se]*(Te[1]+pe*(X[1]-Te[1])*be)}});var de=T[H]===0?0:1/T[H];fe*=$,fe+=E*de*de,J*=$,J+=E*de*X[0]*q,X[0]=J/fe,te*=$,te+=E*de*X[1]*q,X[1]=te/fe}})},_.prototype.eIdealDisMatrix=function(){var E=this,w=E.nodes;if(!w)return[];var T=E.distances,k=E.linkDistance,b=E.radii||[],m=E.unitRadius||50,$=[];return T&&T.forEach(function(W,X){var H=[];W.forEach(function(Q,q){if(X===q)H.push(0);else if(b[X]===b[q])if(E.sortBy==="data")H.push(Q*(Math.abs(X-q)*E.sortStrength)/(b[X]/m));else if(E.sortBy){var J=w[X][E.sortBy]||0,te=w[q][E.sortBy]||0;(0,R.isString)(J)&&(J=J.charCodeAt(0)),(0,R.isString)(te)&&(te=te.charCodeAt(0)),H.push(Q*(Math.abs(J-te)*E.sortStrength)/(b[X]/m))}else H.push(Q*k/(b[X]/m));else{var fe=(k+m)/2;H.push(Q*fe)}}),$.push(H)}),$},_.prototype.handleInfinity=function(E,w,T){for(var k=E.length,b=0;bT?E[w][k]:T);return T},_.prototype.getType=function(){return"radial"},_}(A.Base);U.RadialLayout=g},78614:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0});var z=800,B=function(){function j(R){this.disp=[],this.positions=R.positions,this.adjMatrix=R.adjMatrix,this.focusID=R.focusID,this.radii=R.radii,this.iterations=R.iterations||10,this.height=R.height||10,this.width=R.width||10,this.speed=R.speed||100,this.gravity=R.gravity||10,this.nodeSizeFunc=R.nodeSizeFunc,this.k=R.k||5,this.strictRadial=R.strictRadial,this.nodes=R.nodes}return j.prototype.layout=function(){var R=this,A=R.positions,N=[],L=R.iterations,y=R.width/10;R.maxDisplace=y,R.disp=N;for(var x=0;x_?1:-1;E=.01*k,w=.01*k}if(TMath.PI/2&&($-=Math.PI/2,k*=-1,b*=-1);var W=Math.cos($)*m;d.x=k*W,d.y=b*W});var g=R.radii;A.forEach(function(d,_){if(_!==x){var E=Math.sqrt(N[_].x*N[_].x+N[_].y*N[_].y);if(E>0&&_!==x){var w=Math.min(v*(L/z),E);if(d[0]+=N[_].x/E*w,d[1]+=N[_].y/E*w,y){var T=d[0]-A[x][0],k=d[1]-A[x][1],b=Math.sqrt(T*T+k*k);T=T/b*g[_],k=k/b*g[_],d[0]=A[x][0]+T,d[1]=A[x][1]+k}}}})},j}();U.default=B},26729:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var A=function(N,L){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,x){y.__proto__=x}||function(y,x){for(var v in x)Object.prototype.hasOwnProperty.call(x,v)&&(y[v]=x[v])},A(N,L)};return function(N,L){if(typeof L!="function"&&L!==null)throw new TypeError("Class extends value "+String(L)+" is not a constructor or null");A(N,L);function y(){this.constructor=N}N.prototype=L===null?Object.create(L):(y.prototype=L.prototype,new y)}}();Object.defineProperty(U,"__esModule",{value:!0}),U.RandomLayout=void 0;var j=z(46253),R=function(A){B(N,A);function N(L){var y=A.call(this)||this;return y.center=[0,0],y.width=300,y.height=300,y.nodes=[],y.edges=[],y.onLayoutEnd=function(){},y.updateCfg(L),y}return N.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},N.prototype.execute=function(){var L=this,y=L.nodes,x=.9,v=L.center;return!L.width&&typeof window!="undefined"&&(L.width=window.innerWidth),!L.height&&typeof window!="undefined"&&(L.height=window.innerHeight),y&&y.forEach(function(g){g.x=(Math.random()-.5)*x*L.width+v[0],g.y=(Math.random()-.5)*x*L.height+v[1]}),L.onLayoutEnd&&L.onLayoutEnd(),{nodes:y,edges:this.edges}},N.prototype.getType=function(){return"random"},N}(j.Base);U.RandomLayout=R},2230:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0})},39464:function(or,U,z){"use strict";var B=this&&this.__extends||function(){var x=function(v,g){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,_){d.__proto__=_}||function(d,_){for(var E in _)Object.prototype.hasOwnProperty.call(_,E)&&(d[E]=_[E])},x(v,g)};return function(v,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");x(v,g);function d(){this.constructor=v}v.prototype=g===null?Object.create(g):(d.prototype=g.prototype,new d)}}();Object.defineProperty(U,"__esModule",{value:!0}),U.getLayoutByName=U.unRegisterLayout=U.registerLayout=void 0;var j=z(46253),R=z(8273),A=new Map,N=function(x,v){if(A.get(x)&&console.warn("The layout with the name ".concat(x," exists already, it will be overridden")),(0,R.isObject)(v)){var g=function(d){B(_,d);function _(E){var w=this,T;w=d.call(this)||this;var k=w,b={},m=Object.assign({},k.getDefaultCfg(),((T=v.getDefaultCfg)===null||T===void 0?void 0:T.call(v))||{});return Object.assign(b,m,v,E),Object.keys(b).forEach(function($){var W=b[$];k[$]=W}),w}return _}(j.Base);A.set(x,g)}else A.set(x,v);return A.get(x)};U.registerLayout=N;var L=function(x){A.has(x)&&A.delete(x)};U.unRegisterLayout=L;var y=function(x){return A.has(x)?A.get(x):null};U.getLayoutByName=y},92272:function(or,U){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.isArray=void 0,U.isArray=Array.isArray},72612:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.getFuncByUnknownType=U.getFunc=U.isFunction=void 0;var B=z(8273),j=z(5049),R=function(L){return typeof L=="function"};U.isFunction=R;var A=function(L,y,x){var v;return x?v=x:(0,j.isNumber)(L)?v=function(){return L}:v=function(){return y},v};U.getFunc=A;var N=function(L,y,x){return x===void 0&&(x=!0),!y&&y!==0?function(v){return v.size?(0,B.isArray)(v.size)?v.size[0]>v.size[1]?v.size[0]:v.size[1]:(0,B.isObject)(v.size)?v.size.width>v.size.height?v.size.width:v.size.height:v.size:L}:(0,U.isFunction)(y)?y:(0,j.isNumber)(y)?function(){return y}:(0,B.isArray)(y)?function(){if(x){var v=Math.max.apply(Math,y);return isNaN(v)?L:v}return y}:(0,B.isObject)(y)?function(){if(x){var v=Math.max(y.width,y.height);return isNaN(v)?L:v}return[y.width,y.height]}:function(){return L}};U.getFuncByUnknownType=N},38342:function(or,U,z){"use strict";Object.defineProperty(U,"__esModule",{value:!0}),U.arrayToTextureData=U.attributesToTextureData=U.buildTextureDataWithTwoEdgeAttr=U.buildTextureData=U.proccessToFunc=void 0;var B=z(8273),j=z(64446),R=function(x,v){var g;return x?(0,B.isNumber)(x)?g=function(){return x}:g=x:g=function(){return v||1},g};U.proccessToFunc=R;var A=function(x,v){var g=[],d=[],_={},E=0;for(E=0;E$[X][Q]+$[Q][H]&&($[X][H]=$[X][Q]+$[Q][H]);return $};U.floydWarshall=y;var x=function(m,$){var W=m.nodes,X=m.edges,H=[],Q={};if(!W)throw new Error("invalid nodes data!");return W&&W.forEach(function(q,J){Q[q.id]=J;var te=[];H.push(te)}),X==null||X.forEach(function(q){var J=(0,U.getEdgeTerminal)(q,"source"),te=(0,U.getEdgeTerminal)(q,"target"),fe=Q[J],de=Q[te];fe===void 0||de===void 0||(H[fe][de]=1,$||(H[de][fe]=1))}),H};U.getAdjMatrix=x;var v=function(m,$){var W=[];return m.forEach(function(X){var H=[];X.forEach(function(Q){H.push(Q*$)}),W.push(H)}),W};U.scaleMatrix=v;var g=function(m,$){if(m&&m.children){for(var W=m.children.length-1;W>=0;W--)if(!g(m.children[W],$))return}return!!$(m)},d=function(m,$){typeof $=="function"&&g(m,$)};U.traverseTreeUp=d;var _=function(m){var $=Infinity,W=Infinity,X=-Infinity,H=-Infinity;return m.forEach(function(Q){var q=Q.size;(0,B.isArray)(q)?q.length===1&&(q=[q[0],q[0]]):(0,j.isNumber)(q)?q=[q,q]:(q===void 0||isNaN(q))&&(q=[30,30]);var J=[q[0]/2,q[1]/2],te=Q.x-J[0],fe=Q.x+J[0],de=Q.y-J[1],Te=Q.y+J[1];$>te&&($=te),W>de&&(W=de),X0?je.set(Ce,Xe):je.delete(Ce))}function x(je,Ce,Xe,ut){var ot=String(Ce),bt=String(Xe);if(!je&&ot>bt){var Xt=ot;ot=bt,bt=Xt}return ot+N.EDGE_KEY_DELIM+bt+N.EDGE_KEY_DELIM+(ut===void 0?N.DEFAULT_EDGE_NAME:ut)}function v(je,Ce,Xe,ut){var ot=String(Ce),bt=String(Xe),Xt={v:Ce,w:Xe};if(!je&&ot>bt){var wr=Xt.v;Xt.v=Xt.w,Xt.w=wr}return ut!==void 0&&(Xt.name=ut),Xt}function g(je,Ce){return x(je,Ce.v,Ce.w,Ce.name)}function d(je){return typeof je=="function"}var _=function(Ce){return Ce.nodes().map(function(Xe){var ut=Ce.node(Xe),ot=Ce.parent(Xe),bt={id:Xe,value:ut,parent:ot};return bt.value===void 0&&delete bt.value,bt.parent===void 0&&delete bt.parent,bt})},E=function(Ce){return Ce.edges().map(function(Xe){var ut=Ce.edge(Xe),ot={v:Xe.v,w:Xe.w,value:ut,name:Xe.name};return ot.name===void 0&&delete ot.name,ot.value===void 0&&delete ot.value,ot})},w=function(Ce){var Xe={options:{directed:Ce.isDirected(),multigraph:Ce.isMultigraph(),compound:Ce.isCompound()},nodes:_(Ce),edges:E(Ce),value:Ce.graph()};return Xe.value===void 0&&delete Xe.value,Xe},T=function(Ce){var Xe=new Q(Ce.options);return Ce.value!==void 0&&Xe.setGraph(Ce.value),Ce.nodes.forEach(function(ut){Xe.setNode(ut.id,ut.value),ut.parent&&Xe.setParent(ut.id,ut.parent)}),Ce.edges.forEach(function(ut){Xe.setEdge(ut.v,ut.w,ut.value,ut.name)}),Xe};function k(je,Ce){var Xe=Object.keys(je);if(Object.getOwnPropertySymbols){var ut=Object.getOwnPropertySymbols(je);Ce&&(ut=ut.filter(function(ot){return Object.getOwnPropertyDescriptor(je,ot).enumerable})),Xe.push.apply(Xe,ut)}return Xe}function b(je){for(var Ce=1;Ce0&&arguments[0]!==void 0?arguments[0]:{};$(this,je),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=N.GRAPH_NODE,this.label=void 0,this.nodeCountNum=0,this.edgeCountNum=0,this.defaultNodeLabelFn=function(){},this.defaultEdgeLabelFn=function(){},this.parentMap=void 0,this.childrenMap=void 0,this.nodesLabelMap=new Map,this.inEdgesMap=new Map,this.outEdgesMap=new Map,this.predecessorsMap=new Map,this.successorsMap=new Map,this.edgesMap=new Map,this.edgesLabelsMap=new Map,this.isDirected=function(){return Ce.directed},this.isMultigraph=function(){return Ce.multigraph},this.isCompound=function(){return Ce.compound},this.setGraph=function(ot){return Ce.label=ot,Ce},this.graph=function(){return Ce.label},this.setDefaultNodeLabel=function(ot){return d(ot)?Ce.defaultNodeLabelFn=ot:Ce.defaultNodeLabelFn=function(){return ot},Ce},this.nodeCount=function(){return Ce.nodeCountNum},this.node=function(ot){return Ce.nodesLabelMap.get(ot)},this.nodes=function(){return Array.from(Ce.nodesLabelMap.keys())},this.sources=function(){return Ce.nodes().filter(function(ot){var bt;return!((bt=Ce.inEdgesMap.get(ot))===null||bt===void 0?void 0:bt.size)})},this.sinks=function(){return Ce.nodes().filter(function(ot){var bt;return!((bt=Ce.outEdgesMap.get(ot))===null||bt===void 0?void 0:bt.size)})},this.setNodes=function(ot,bt){return ot.map(function(Xt){return Ce.setNode(Xt,bt)}),Ce},this.hasNode=function(ot){return Ce.nodesLabelMap.has(ot)},this.checkCompound=function(){if(!Ce.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(ot){if(Ce.isCompound()){var bt,Xt=(bt=Ce.parentMap)===null||bt===void 0?void 0:bt.get(ot);if(Xt!==Ce.GRAPH_NODE)return Xt}},this.removeFromParentsChildList=function(ot){var bt=Ce.parentMap.get(ot);Ce.childrenMap.get(bt).delete(ot)},this.setParent=function(ot,bt){var Xt,wr;Ce.checkCompound();for(var Wr=bt===void 0?Ce.GRAPH_NODE:bt,on=Ce.parent(Wr);on;){if(ot===on)throw new Error("Setting "+bt+" as parent of "+ot+" would create a cycle");on=Ce.parent(on)}bt&&Ce.setNode(bt),Ce.setNode(ot),Ce.removeFromParentsChildList(ot),(Xt=Ce.parentMap)===null||Xt===void 0||Xt.set(ot,Wr);var xn=Ce.childrenMap.get(Wr);return xn.set(ot,!0),(wr=Ce.childrenMap)===null||wr===void 0||wr.set(Wr,xn),Ce},this.children=function(ot){var bt=ot===void 0?Ce.GRAPH_NODE:ot;if(Ce.isCompound()){var Xt,wr=(Xt=Ce.childrenMap)===null||Xt===void 0?void 0:Xt.get(bt);return wr?Array.from(wr.keys()):void 0}if(bt===Ce.GRAPH_NODE)return Ce.nodes();if(ot&&Ce.hasNode(ot))return[]},this.predecessors=function(ot){var bt=Ce.predecessorsMap.get(ot);return bt?Array.from(bt.keys()):void 0},this.successors=function(ot){var bt=Ce.successorsMap.get(ot);return bt?Array.from(bt.keys()):void 0},this.neighbors=function(ot){var bt;if(!!Ce.hasNode(ot))return Array.from(new Set((bt=Ce.predecessors(ot))===null||bt===void 0?void 0:bt.concat(Ce.successors(ot))))},this.isLeaf=function(ot){var bt;if(Ce.isDirected()){var Xt;return!((Xt=Ce.successors(ot))===null||Xt===void 0?void 0:Xt.length)}return!((bt=Ce.neighbors(ot))===null||bt===void 0?void 0:bt.length)},this.filterNodes=function(ot){var bt=Ce.directed,Xt=Ce.multigraph,wr=Ce.compound,Wr=new je({directed:bt,multigraph:Xt,compound:wr});if(Wr.setGraph(Ce.graph()),Ce.nodes().forEach(function(xn){ot(xn)&&Wr.setNode(xn,Ce.node(xn))}),Ce.edges().forEach(function(xn){Wr.hasNode(xn.v)&&Wr.hasNode(xn.w)&&Wr.setEdgeObj(xn,Ce.edge(xn))}),wr){var on=function(zn){for(var Qn=Ce.parent(zn);Qn!==void 0&&!Wr.hasNode(Qn);)Qn=Ce.parent(Qn);return Qn};Wr.nodes().forEach(function(xn){Wr.setParent(xn,on(xn))})}return Wr},this.setDefaultEdgeLabel=function(ot){return d(ot)?Ce.defaultEdgeLabelFn=ot:Ce.defaultEdgeLabelFn=function(){return ot},Ce},this.edgeCount=function(){return Ce.edgeCountNum},this.setEdgeObj=function(ot,bt){return Ce.setEdge(ot.v,ot.w,bt,ot.name)},this.setPath=function(ot,bt){return ot.reduce(function(Xt,wr){return Ce.setEdge(Xt,wr,bt),wr}),Ce},this.edgeFromArgs=function(ot,bt,Xt){return Ce.edge({v:ot,w:bt,name:Xt})},this.edge=function(ot){return Ce.edgesLabelsMap.get(g(Ce.isDirected(),ot))},this.hasEdge=function(ot,bt,Xt){return Ce.edgesLabelsMap.has(g(Ce.isDirected(),{v:ot,w:bt,name:Xt}))},this.removeEdgeObj=function(ot){var bt=ot.v,Xt=ot.w,wr=ot.name;return Ce.removeEdge(bt,Xt,wr)},this.edges=function(){return Array.from(Ce.edgesMap.values())},this.inEdges=function(ot,bt){var Xt=Ce.inEdgesMap.get(ot);if(Xt)return Array.from(Xt.values()).filter(function(wr){return!bt||wr.v===bt})},this.outEdges=function(ot,bt){var Xt=Ce.outEdgesMap.get(ot);if(Xt)return Array.from(Xt.values()).filter(function(wr){return!bt||wr.w===bt})},this.nodeEdges=function(ot,bt){var Xt;if(!!Ce.hasNode(ot))return(Xt=Ce.inEdges(ot,bt))===null||Xt===void 0?void 0:Xt.concat(Ce.outEdges(ot,bt))},this.toJSON=function(){return w(Ce)},this.nodeInDegree=function(ot){var bt=Ce.inEdgesMap.get(ot);return bt?bt.size:0},this.nodeOutDegree=function(ot){var bt=Ce.outEdgesMap.get(ot);return bt?bt.size:0},this.nodeDegree=function(ot){return Ce.nodeInDegree(ot)+Ce.nodeOutDegree(ot)},this.source=function(ot){return ot.v},this.target=function(ot){return ot.w};var ut=b(b({},H),Xe);this.compound=ut.compound,this.directed=ut.directed,this.multigraph=ut.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return X(je,[{key:"setNode",value:function(Xe,ut){var ot=this.nodesLabelMap,bt=this.defaultNodeLabelFn,Xt=this.isCompound,wr=this.parentMap,Wr=this.childrenMap,on=this.inEdgesMap,xn=this.outEdgesMap,zn=this.predecessorsMap,Qn=this.successorsMap;if(ot.has(Xe))return ut!==void 0&&ot.set(Xe,ut),this;if(ot.set(Xe,ut||bt(Xe)),Xt()){var ia;wr==null||wr.set(Xe,this.GRAPH_NODE),Wr==null||Wr.set(Xe,new Map),(Wr==null?void 0:Wr.has(this.GRAPH_NODE))||Wr==null||Wr.set(this.GRAPH_NODE,new Map),Wr==null||(ia=Wr.get(this.GRAPH_NODE))===null||ia===void 0||ia.set(Xe,!0)}return[on,xn,zn,Qn].forEach(function(Wa){return Wa.set(Xe,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(Xe){var ut=this;if(this.hasNode(Xe)){var ot=function(Ba){ut.removeEdge(Ba.v,Ba.w,Ba.name)},bt=this.inEdgesMap,Xt=this.outEdgesMap,wr=this.predecessorsMap,Wr=this.successorsMap,on=this.nodesLabelMap;if(this.isCompound()){var xn,zn,Qn;this.removeFromParentsChildList(Xe),(xn=this.parentMap)===null||xn===void 0||xn.delete(Xe),(zn=this.children(Xe))===null||zn===void 0||zn.forEach(function(Ia){return ut.setParent(Ia)}),(Qn=this.childrenMap)===null||Qn===void 0||Qn.delete(Xe)}var ia=bt.get(Xe),Wa=Xt.get(Xe);Array.from(ia.values()).forEach(function(Ia){return ot(Ia)}),Array.from(Wa.values()).forEach(function(Ia){return ot(Ia)}),on.delete(Xe),bt.delete(Xe),Xt.delete(Xe),wr.delete(Xe),Wr.delete(Xe),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(Xe,ut,ot,bt){var Xt,wr,Wr=v(this.isDirected(),Xe,ut,bt),on=g(this.isDirected(),Wr),xn=Wr.v,zn=Wr.w;if(this.edgesLabelsMap.has(on))return this.edgesLabelsMap.set(on,ot),this;if(bt!==void 0&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(xn),this.setNode(zn),this.edgesLabelsMap.set(on,ot||this.defaultEdgeLabelFn(xn,zn,bt)),Object.freeze(Wr),this.edgesMap.set(on,Wr);var Qn=this.predecessorsMap.get(zn),ia=this.successorsMap.get(xn);return L(Qn,xn),L(ia,zn),(Xt=this.inEdgesMap.get(zn))===null||Xt===void 0||Xt.set(on,Wr),(wr=this.outEdgesMap.get(xn))===null||wr===void 0||wr.set(on,Wr),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(Xe,ut,ot){var bt=x(this.isDirected(),Xe,ut,ot),Xt=this.edgesMap.get(bt);if(Xt){var wr=v(this.isDirected(),Xe,ut,ot),Wr=wr.v,on=wr.w;this.edgesLabelsMap.delete(bt),this.edgesMap.delete(bt);var xn=this.predecessorsMap.get(on),zn=this.successorsMap.get(Wr);y(xn,Wr),y(zn,on),this.inEdgesMap.get(on).delete(bt),this.outEdgesMap.get(Wr).delete(bt),this.edgeCountNum-=1}return this}}]),je}();Q.fromJSON=T;function q(je){return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Ce){return typeof Ce}:function(Ce){return Ce&&typeof Symbol=="function"&&Ce.constructor===Symbol&&Ce!==Symbol.prototype?"symbol":typeof Ce},q(je)}function J(je,Ce){if(!(je instanceof Ce))throw new TypeError("Cannot call a class as a function")}function te(je,Ce){for(var Xe=0;Xe-1&&this.eventPool[ot].splice(Xt,1)}}},{key:"emitEvent",value:function(ot){for(var bt=arguments.length,Xt=new Array(bt>1?bt-1:0),wr=1;wr>1,((wr=ut[bt])===null||wr===void 0?void 0:wr.priority)Ce.arr[ot].priority)throw new Error("New priority is greater than current priority.Key: ".concat(Xe," Old: + ").concat(Ce.arr[ot].priority," New: ").concat(ut));Ce.arr[ot].priority=ut,Ce.innerDecrease(ot)}}),Qe=function(Ce,Xe){var ut=new Q,ot=new Map,bt=new tr,Xt;function wr(xn){var zn=xn.v===Xt?xn.w:xn.v,Qn=bt.priority(zn);if(Qn!==void 0){var ia=Xe(xn);ia0;){var on;if(Xt=bt.removeMin(),ot.has(Xt))ut.setEdge(Xt,ot.get(Xt));else{if(Wr)throw new Error("Input graph is not connected: "+Ce.graph());Wr=!0}(on=Ce.nodeEdges(Xt))===null||on===void 0||on.forEach(wr)}return ut},lt=Qe,St=function(Ce){var Xe=new Set,ut=[],ot=Ce.nodes();return ot.forEach(function(bt){for(var Xt=[],wr=[bt];wr.length>0;){var Wr=wr.pop();if(!Xe.has(Wr)){var on,xn;Xe.add(Wr),Xt.push(Wr),(on=Ce.successors(Wr))===null||on===void 0||on.forEach(function(zn){return wr.push(zn)}),(xn=Ce.predecessors(Wr))===null||xn===void 0||xn.forEach(function(zn){return wr.push(zn)})}}Xt.length&&ut.push(Xt)}),ut},Ct=St,_t=function je(Ce,Xe,ut,ot,bt,Xt){ot.includes(Xe)||(ot.push(Xe),ut||Xt.push(Xe),bt(Xe).forEach(function(wr){return je(Ce,wr,ut,ot,bt,Xt)}),ut&&Xt.push(Xe))},pt=function(Ce,Xe,ut){var ot=Array.isArray(Xe)?Xe:[Xe],bt=function(on){return Ce.isDirected()?Ce.successors(on):Ce.neighbors(on)},Xt=[],wr=[];return ot.forEach(function(Wr){if(Ce.hasNode(Wr))_t(Ce,Wr,ut==="post",wr,bt,Xt);else throw new Error("Graph does not have node: "+Wr)}),Xt},rr=pt;function xr(je,Ce){return br(je)||qt(je,Ce)||ft(je,Ce)||Vt()}function Vt(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ft(je,Ce){if(!!je){if(typeof je=="string")return Bt(je,Ce);var Xe=Object.prototype.toString.call(je).slice(8,-1);if(Xe==="Object"&&je.constructor&&(Xe=je.constructor.name),Xe==="Map"||Xe==="Set")return Array.from(je);if(Xe==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Xe))return Bt(je,Ce)}}function Bt(je,Ce){(Ce==null||Ce>je.length)&&(Ce=je.length);for(var Xe=0,ut=new Array(Ce);Xe0&&(wr=Xt.removeMin(),Wr=bt.get(wr),!(Wr&&Wr.distance===Number.POSITIVE_INFINITY));)ot(wr).forEach(on);var xn={};return Array.from(bt.entries()).forEach(function(zn){var Qn=xr(zn,2),ia=Qn[0],Wa=Qn[1];return xn[String(ia)]=Wa,xn}),xn},Sr=Ae,qr=function(Ce,Xe,ut){var ot={};return Ce.nodes().forEach(function(bt){return ot[String(bt)]=Sr(Ce,bt,Xe,ut),ot}),ot},Gr=qr,vn=function(Ce){var Xe=0,ut=[],ot=new Map,bt=[];function Xt(wr){var Wr,on={onStack:!0,lowlink:Xe,index:Xe};if(ot.set(wr,on),Xe+=1,ut.push(wr),(Wr=Ce.successors(wr))===null||Wr===void 0||Wr.forEach(function(ia){var Wa;if(ot.has(ia)){if((Wa=ot.get(ia))===null||Wa===void 0?void 0:Wa.onStack){var Ba=ot.get(ia);on.lowlink=Math.min(on.lowlink,Ba.index)}}else{Xt(ia);var Ia=ot.get(ia);on.lowlink=Math.min(on.lowlink,Ia.lowlink)}}),on.lowlink===on.index){var xn=[],zn;do{zn=ut.pop();var Qn=ot.get(zn);Qn.onStack=!1,xn.push(zn)}while(wr!==zn);bt.push(xn)}}return Ce.nodes().forEach(function(wr){ot.has(wr)||Xt(wr)}),bt},Gn=vn,mn=function(Ce){return Gn(Ce).filter(function(Xe){return Xe.length>1||Xe.length===1&&Ce.hasEdge(Xe[0],Xe[0])})},$r=mn;function gn(je){return gn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Ce){return typeof Ce}:function(Ce){return Ce&&typeof Symbol=="function"&&Ce.constructor===Symbol&&Ce!==Symbol.prototype?"symbol":typeof Ce},gn(je)}function Rr(je,Ce){for(var Xe=0;Xeje.length)&&(Ce=je.length);for(var Xe=0,ut=new Array(Ce);Xe-1:!1};z.a=R},function(U,z,B){"use strict";var j=function(R){return typeof R=="object"&&R!==null};z.a=j},function(U,z,B){"use strict";var j=B(8),R=B(2),A=Object.values?function(N){return Object.values(N)}:function(N){var L=[];return Object(j.a)(N,function(y,x){Object(R.a)(N)&&x==="prototype"||L.push(y)}),L};z.a=A},function(U,z,B){"use strict";z.a=R;function j(A,N){for(var L in N)N.hasOwnProperty(L)&&L!=="constructor"&&N[L]!==void 0&&(A[L]=N[L])}function R(A,N,L,y){return N&&j(A,N),L&&j(A,L),y&&j(A,y),A}},function(U,z,B){var j=B(35),R=["LR","RL","TB","BT","H","V"],A=["LR","RL","H"],N=function(x){return A.indexOf(x)>-1},L=R[0];U.exports=function(y,x,v){var g=x.direction||L;if(x.isHorizontal=N(g),g&&R.indexOf(g)===-1)throw new TypeError("Invalid direction: "+g);if(g===R[0])v(y,x);else if(g===R[1])v(y,x),y.right2left();else if(g===R[2])v(y,x);else if(g===R[3])v(y,x),y.bottom2top();else if(g===R[4]||g===R[5]){var d=j(y,x),_=d.left,E=d.right;v(_,x),v(E,x),x.isHorizontal?_.right2left():_.bottom2top(),E.translate(_.x-E.x,_.y-E.y),y.x=_.x,y.y=E.y;var w=y.getBoundingBox();x.isHorizontal?w.top<0&&y.translate(0,-w.top):w.left<0&&y.translate(-w.left,0)}var T=x.fixedRoot;return T===void 0&&(T=!0),T&&y.translate(-(y.x+y.width/2+y.hgap),-(y.y+y.height/2+y.vgap)),y}},function(U,z,B){var j=B(6),R=18,A=R*2,N=R,L={getId:function(g){return g.id||g.name},getPreH:function(g){return g.preH||0},getPreV:function(g){return g.preV||0},getHGap:function(g){return g.hgap||N},getVGap:function(g){return g.vgap||N},getChildren:function(g){return g.children},getHeight:function(g){return g.height||A},getWidth:function(g){var d=g.label||" ";return g.width||d.split("").length*R}};function y(v,g){var d=this;if(d.vgap=d.hgap=0,v instanceof y)return v;d.data=v;var _=g.getHGap(v),E=g.getVGap(v);return d.preH=g.getPreH(v),d.preV=g.getPreV(v),d.width=g.getWidth(v),d.height=g.getHeight(v),d.width+=d.preH,d.height+=d.preV,d.id=g.getId(v),d.x=d.y=0,d.depth=0,d.children||(d.children=[]),d.addGap(_,E),d}j.assign(y.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(g,d){var _=this;_.hgap+=g,_.vgap+=d,_.width+=2*g,_.height+=2*d},eachNode:function(g){for(var d=this,_=[d],E;E=_.shift();)g(E),_=E.children.concat(_)},DFTraverse:function(g){this.eachNode(g)},BFTraverse:function(g){for(var d=this,_=[d],E;E=_.shift();)g(E),_=_.concat(E.children)},getBoundingBox:function(){var g={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(d){g.left=Math.min(g.left,d.x),g.top=Math.min(g.top,d.y),g.width=Math.max(g.width,d.x+d.width),g.height=Math.max(g.height,d.y+d.height)}),g},translate:function(g,d){g===void 0&&(g=0),d===void 0&&(d=0),this.eachNode(function(_){_.x+=g,_.y+=d,_.x+=_.preH,_.y+=_.preV})},right2left:function(){var g=this,d=g.getBoundingBox();g.eachNode(function(_){_.x=_.x-(_.x-d.left)*2-_.width}),g.translate(d.width,0)},bottom2top:function(){var g=this,d=g.getBoundingBox();g.eachNode(function(_){_.y=_.y-(_.y-d.top)*2-_.height}),g.translate(0,d.height)}});function x(v,g,d){g===void 0&&(g={}),g=j.assign({},L,g);var _=new y(v,g),E=[_],w;if(!d&&!v.collapsed){for(;w=E.shift();)if(!w.data.collapsed){var T=g.getChildren(w.data),k=T?T.length:0;if(w.children=new Array(k),T&&k)for(var b=0;b-1;)R.call(L,d,1);return L};z.a=N},function(U,z,B){"use strict";var j=B(1),R=B(24),A=function(N,L){var y=[];if(!Object(j.a)(N))return y;for(var x=-1,v=[],g=N.length;++xd[E])return 1;if(g[E]N?N:R};z.a=j},function(U,z,B){"use strict";var j=function(R,A){var N=A.toString(),L=N.indexOf(".");if(L===-1)return Math.round(R);var y=N.substr(L+1).length;return y>20&&(y=20),parseFloat(R.toFixed(y))};z.a=j},function(U,z,B){"use strict";var j=B(5),R=function(A){return Object(j.a)(A)&&A%1!=0};z.a=R},function(U,z,B){"use strict";var j=B(5),R=function(A){return Object(j.a)(A)&&A%2==0};z.a=R},function(U,z,B){"use strict";var j=B(5),R=Number.isInteger?Number.isInteger:function(A){return Object(j.a)(A)&&A%1==0};z.a=R},function(U,z,B){"use strict";var j=B(5),R=function(A){return Object(j.a)(A)&&A<0};z.a=R},function(U,z,B){"use strict";z.a=R;var j=1e-5;function R(A,N,L){return L===void 0&&(L=j),Math.abs(A-N)0};z.a=R},function(U,z,B){"use strict";var j=B(0),R=B(2);z.a=function(A,N){if(!!Object(j.a)(A)){for(var L,y=-Infinity,x=0;xy&&(L=v,y=g)}return L}}},function(U,z,B){"use strict";var j=B(0),R=B(2);z.a=function(A,N){if(!!Object(j.a)(A)){for(var L,y=Infinity,x=0;xR?(N&&(clearTimeout(N),N=null),v=_,x=j.apply(L,y),N||(L=y=null)):!N&&A.trailing!==!1&&(N=setTimeout(g,E)),x};return d.cancel=function(){clearTimeout(N),v=0,N=L=y=null},d}},function(U,z,B){"use strict";var j=B(1);z.a=function(R){return Object(j.a)(R)?Array.prototype.slice.call(R):[]}},function(U,z,B){"use strict";var j={};z.a=function(R){return R=R||"g",j[R]?j[R]+=1:j[R]=1,R+j[R]}},function(U,z,B){"use strict";z.a=function(){}},function(U,z,B){"use strict";z.a=function(j){return j}},function(U,z,B){"use strict";z.a=A;var j=B(7),R=B(1);function A(N){return Object(j.a)(N)?0:Object(R.a)(N)?N.length:Object.keys(N).length}},function(U,z,B){"use strict";z.a=W;var j=function(pe,Me){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(De,Ue){De.__proto__=Ue}||function(De,Ue){for(var nt in Ue)Object.prototype.hasOwnProperty.call(Ue,nt)&&(De[nt]=Ue[nt])},j(pe,Me)};function R(pe,Me){if(typeof Me!="function"&&Me!==null)throw new TypeError("Class extends value "+String(Me)+" is not a constructor or null");j(pe,Me);function De(){this.constructor=pe}pe.prototype=Me===null?Object.create(Me):(De.prototype=Me.prototype,new De)}var A=function(){return A=Object.assign||function(Me){for(var De,Ue=1,nt=arguments.length;Ue=0;Rt--)(ht=pe[Rt])&&(Ze=(nt<3?ht(Ze):nt>3?ht(Me,De,Ze):ht(Me,De))||Ze);return nt>3&&Ze&&Object.defineProperty(Me,De,Ze),Ze}function y(pe,Me){return function(De,Ue){Me(De,Ue,pe)}}function x(pe,Me,De,Ue,nt,Ze){function ht(Vt){if(Vt!==void 0&&typeof Vt!="function")throw new TypeError("Function expected");return Vt}for(var Rt=Ue.kind,tr=Rt==="getter"?"get":Rt==="setter"?"set":"value",Qe=!Me&&pe?Ue.static?pe:pe.prototype:null,lt=Me||(Qe?Object.getOwnPropertyDescriptor(Qe,Ue.name):{}),St,Ct=!1,_t=De.length-1;_t>=0;_t--){var pt={};for(var rr in Ue)pt[rr]=rr==="access"?{}:Ue[rr];for(var rr in Ue.access)pt.access[rr]=Ue.access[rr];pt.addInitializer=function(Vt){if(Ct)throw new TypeError("Cannot add initializers after decoration has completed");Ze.push(ht(Vt||null))};var xr=(0,De[_t])(Rt==="accessor"?{get:lt.get,set:lt.set}:lt[tr],pt);if(Rt==="accessor"){if(xr===void 0)continue;if(xr===null||typeof xr!="object")throw new TypeError("Object expected");(St=ht(xr.get))&&(lt.get=St),(St=ht(xr.set))&&(lt.set=St),(St=ht(xr.init))&&nt.push(St)}else(St=ht(xr))&&(Rt==="field"?nt.push(St):lt[tr]=St)}Qe&&Object.defineProperty(Qe,Ue.name,lt),Ct=!0}function v(pe,Me,De){for(var Ue=arguments.length>2,nt=0;nt0&&Ze[Ze.length-1])&&(Qe[0]===6||Qe[0]===2)){De=0;continue}if(Qe[0]===3&&(!Ze||Qe[1]>Ze[0]&&Qe[1]=pe.length&&(pe=void 0),{value:pe&&pe[Ue++],done:!pe}}};throw new TypeError(Me?"Object is not iterable.":"Symbol.iterator is not defined.")}function m(pe,Me){var De=typeof Symbol=="function"&&pe[Symbol.iterator];if(!De)return pe;var Ue=De.call(pe),nt,Ze=[],ht;try{for(;(Me===void 0||Me-- >0)&&!(nt=Ue.next()).done;)Ze.push(nt.value)}catch(Rt){ht={error:Rt}}finally{try{nt&&!nt.done&&(De=Ue.return)&&De.call(Ue)}finally{if(ht)throw ht.error}}return Ze}function $(){for(var pe=[],Me=0;Me1||Rt(Ct,_t)})})}function Rt(Ct,_t){try{tr(Ue[Ct](_t))}catch(pt){St(Ze[0][3],pt)}}function tr(Ct){Ct.value instanceof H?Promise.resolve(Ct.value.v).then(Qe,lt):St(Ze[0][2],Ct)}function Qe(Ct){Rt("next",Ct)}function lt(Ct){Rt("throw",Ct)}function St(Ct,_t){Ct(_t),Ze.shift(),Ze.length&&Rt(Ze[0][0],Ze[0][1])}}function q(pe){var Me,De;return Me={},Ue("next"),Ue("throw",function(nt){throw nt}),Ue("return"),Me[Symbol.iterator]=function(){return this},Me;function Ue(nt,Ze){Me[nt]=pe[nt]?function(ht){return(De=!De)?{value:H(pe[nt](ht)),done:!1}:Ze?Ze(ht):ht}:Ze}}function J(pe){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var Me=pe[Symbol.asyncIterator],De;return Me?Me.call(pe):(pe=typeof b=="function"?b(pe):pe[Symbol.iterator](),De={},Ue("next"),Ue("throw"),Ue("return"),De[Symbol.asyncIterator]=function(){return this},De);function Ue(Ze){De[Ze]=pe[Ze]&&function(ht){return new Promise(function(Rt,tr){ht=pe[Ze](ht),nt(Rt,tr,ht.done,ht.value)})}}function nt(Ze,ht,Rt,tr){Promise.resolve(tr).then(function(Qe){Ze({value:Qe,done:Rt})},ht)}}function te(pe,Me){return Object.defineProperty?Object.defineProperty(pe,"raw",{value:Me}):pe.raw=Me,pe}var fe=Object.create?function(pe,Me){Object.defineProperty(pe,"default",{enumerable:!0,value:Me})}:function(pe,Me){pe.default=Me};function de(pe){if(pe&&pe.__esModule)return pe;var Me={};if(pe!=null)for(var De in pe)De!=="default"&&Object.prototype.hasOwnProperty.call(pe,De)&&T(Me,pe,De);return fe(Me,pe),Me}function Te(pe){return pe&&pe.__esModule?pe:{default:pe}}function Se(pe,Me,De,Ue){if(De==="a"&&!Ue)throw new TypeError("Private accessor was defined without a getter");if(typeof Me=="function"?pe!==Me||!Ue:!Me.has(pe))throw new TypeError("Cannot read private member from an object whose class did not declare it");return De==="m"?Ue:De==="a"?Ue.call(pe):Ue?Ue.value:Me.get(pe)}function Ie(pe,Me,De,Ue,nt){if(Ue==="m")throw new TypeError("Private method is not writable");if(Ue==="a"&&!nt)throw new TypeError("Private accessor was defined without a setter");if(typeof Me=="function"?pe!==Me||!nt:!Me.has(pe))throw new TypeError("Cannot write private member to an object whose class did not declare it");return Ue==="a"?nt.call(pe,De):nt?nt.value=De:Me.set(pe,De),De}function be(pe,Me){if(Me===null||typeof Me!="object"&&typeof Me!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof pe=="function"?Me===pe:pe.has(Me)}},function(U,z,B){"use strict";var j=B(4),R=B(9),A=B(34);z.a=function(N,L,y,x){x===void 0&&(x="...");var v=16,g=Object(A.a)(x,y),d=Object(j.a)(N)?N:Object(R.a)(N),_=L,E=[],w,T;if(Object(A.a)(N,y)<=L)return N;for(;w=d.substr(0,v),T=Object(A.a)(w,y),!(T+g>_&&T>_);)if(E.push(w),_-=T,d=d.substr(v),!d)return E.join("");for(;w=d.substr(0,1),T=Object(A.a)(w,y),!(T+g>_);)if(E.push(w),_-=T,d=d.substr(1),!d)return E.join("");return""+E.join("")+x}},function(U,z,B){"use strict";var j=function(){function R(){this.map={}}return R.prototype.has=function(A){return this.map[A]!==void 0},R.prototype.get=function(A,N){var L=this.map[A];return L===void 0?N:L},R.prototype.set=function(A,N){this.map[A]=N},R.prototype.clear=function(){this.map={}},R.prototype.delete=function(A){delete this.map[A]},R.prototype.size=function(){return Object.keys(this.map).length},R}();z.a=j},function(U,z){function B(y,x,v,g){g===void 0&&(g=[]);var d=this;d.w=y||0,d.h=x||0,d.y=v||0,d.x=0,d.c=g||[],d.cs=g.length,d.prelim=0,d.mod=0,d.shift=0,d.change=0,d.tl=null,d.tr=null,d.el=null,d.er=null,d.msel=0,d.mser=0}B.fromNode=function(y,x){if(!y)return null;var v=[];return y.children.forEach(function(g){v.push(B.fromNode(g,x))}),x?new B(y.height,y.width,y.x,v):new B(y.width,y.height,y.y,v)};function j(y,x,v){v?y.y+=x:y.x+=x,y.children.forEach(function(g){j(g,x,v)})}function R(y,x){var v=x?y.y:y.x;return y.children.forEach(function(g){v=Math.min(R(g,x),v)}),v}function A(y,x){var v=R(y,x);j(y,-v,x)}function N(y,x,v){v?x.y=y.x:x.x=y.x,y.c.forEach(function(g,d){N(g,x.children[d],v)})}function L(y,x,v){v===void 0&&(v=0),x?(y.x=v,v+=y.width):(y.y=v,v+=y.height),y.children.forEach(function(g){L(g,x,v)})}U.exports=function(y,x){x===void 0&&(x={});var v=x.isHorizontal;function g(J){if(J.cs===0){d(J);return}g(J.c[0]);for(var te=Q(k(J.c[0].el),0,null),fe=1;fefe.low&&(fe=fe.nxt);var be=Te+de.prelim+de.w-(Ie+Se.prelim);be>0&&(Ie+=be,E(J,te,fe.index,be));var pe=k(de),Me=k(Se);pe<=Me&&(de=T(de),de!==null&&(Te+=de.mod)),pe>=Me&&(Se=w(Se),Se!==null&&(Ie+=Se.mod))}!de&&!!Se?b(J,te,Se,Ie):!!de&&!Se&&m(J,te,de,Te)}function E(J,te,fe,de){J.c[te].mod+=de,J.c[te].msel+=de,J.c[te].mser+=de,X(J,te,fe,de)}function w(J){return J.cs===0?J.tl:J.c[0]}function T(J){return J.cs===0?J.tr:J.c[J.cs-1]}function k(J){return J.y+J.h}function b(J,te,fe,de){var Te=J.c[0].el;Te.tl=fe;var Se=de-fe.mod-J.c[0].msel;Te.mod+=Se,Te.prelim-=Se,J.c[0].el=J.c[te].el,J.c[0].msel=J.c[te].msel}function m(J,te,fe,de){var Te=J.c[te].er;Te.tr=fe;var Se=de-fe.mod-J.c[te].mser;Te.mod+=Se,Te.prelim-=Se,J.c[te].er=J.c[te-1].er,J.c[te].mser=J.c[te-1].mser}function $(J){J.prelim=(J.c[0].prelim+J.c[0].mod+J.c[J.cs-1].mod+J.c[J.cs-1].prelim+J.c[J.cs-1].w)/2-J.w/2}function W(J,te){te+=J.mod,J.x=J.prelim+te,H(J);for(var fe=0;fe=fe.low;)fe=fe.nxt;return{low:J,index:te,nxt:fe}}L(y,v);var q=B.fromNode(y,v);return g(q),W(q,0),N(q,y,v),A(y,v),y}},function(U,z,B){function j(d,_){d.prototype=Object.create(_.prototype),d.prototype.constructor=d,R(d,_)}function R(d,_){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(w,T){return w.__proto__=T,w},R(d,_)}var A=B(11),N=B(121),L=B(17),y=B(6),x=function(d){j(_,d);function _(){return d.apply(this,arguments)||this}var E=_.prototype;return E.execute=function(){var T=this;return T.rootNode.width=0,L(T.rootNode,T.options,N)},_}(A),v={};function g(d,_){return _=y.assign({},v,_),new x(d,_).execute()}U.exports=g},function(U,z,B){var j=B(6);function R(L,y){L===void 0&&(L=0),y===void 0&&(y=[]);var x=this;x.x=x.y=0,x.leftChild=x.rightChild=null,x.height=0,x.children=y}var A={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function N(L,y,x){x?(y.x=L.x,y.y=L.y):(y.x=L.y,y.y=L.x),L.children.forEach(function(v,g){N(v,y.children[g],x)})}U.exports=function(L,y){y===void 0&&(y={}),y=j.assign({},A,y);var x=0;function v(w){if(!w)return null;w.width=0,w.depth&&w.depth>x&&(x=w.depth);var T=w.children,k=T.length,b=new R(w.height,[]);return T.forEach(function(m,$){var W=v(m);b.children.push(W),$===0&&(b.leftChild=W),$===k-1&&(b.rightChild=W)}),b.originNode=w,b.isLeaf=w.isLeaf(),b}function g(w){if(w.isLeaf||w.children.length===0)w.drawingDepth=x;else{var T=w.children.map(function(b){return g(b)}),k=Math.min.apply(null,T);w.drawingDepth=k-1}return w.drawingDepth}var d;function _(w){w.x=w.drawingDepth*y.rankSep,w.isLeaf?(w.y=0,d&&(w.y=d.y+d.height+y.nodeSep,w.originNode.parent!==d.originNode.parent&&(w.y+=y.subTreeSep)),d=w):(w.children.forEach(function(T){_(T)}),w.y=(w.leftChild.y+w.rightChild.y)/2)}var E=v(L);return g(E),_(E),N(E,L,y.isHorizontal),L}},function(U,z,B){function j(E,w){E.prototype=Object.create(w.prototype),E.prototype.constructor=E,R(E,w)}function R(E,w){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(k,b){return k.__proto__=b,k},R(E,w)}var A=B(11),N=B(123),L=B(35),y=B(6),x=["LR","RL","H"],v=x[0],g=function(E){j(w,E);function w(){return E.apply(this,arguments)||this}var T=w.prototype;return T.execute=function(){var b=this,m=b.options,$=b.rootNode;m.isHorizontal=!0;var W=m.indent,X=W===void 0?20:W,H=m.dropCap,Q=H===void 0?!0:H,q=m.direction,J=q===void 0?v:q,te=m.align;if(J&&x.indexOf(J)===-1)throw new TypeError("Invalid direction: "+J);if(J===x[0])N($,X,Q,te);else if(J===x[1])N($,X,Q,te),$.right2left();else if(J===x[2]){var fe=L($,m),de=fe.left,Te=fe.right;N(de,X,Q,te),de.right2left(),N(Te,X,Q,te);var Se=de.getBoundingBox();Te.translate(Se.width,0),$.x=Te.x-$.width/2}return $},w}(A),d={};function _(E,w){return w=y.assign({},d,w),new g(E,w).execute()}U.exports=_},function(U,z,B){var j=B(6);function R(A,N,L,y,x){var v=typeof L=="function"?L(A):L*A.depth;if(!y)try{if(A.id===A.parent.children[0].id){A.x+=v,A.y=N?N.y:0;return}}catch(_){}if(A.x+=v,N){if(A.y=N.y+j.getHeight(N,A,x),N.parent&&A.parent.id!==N.parent.id){var g=N.parent,d=g.y+j.getHeight(g,A,x);A.y=d>A.y?d:A.y}}else A.y=0}U.exports=function(A,N,L,y){var x=null;A.eachNode(function(v){R(v,x,N,L,y),x=v})}},function(U,z,B){function j(d,_){d.prototype=Object.create(_.prototype),d.prototype.constructor=d,R(d,_)}function R(d,_){return R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(w,T){return w.__proto__=T,w},R(d,_)}var A=B(11),N=B(125),L=B(17),y=B(6),x=function(d){j(_,d);function _(){return d.apply(this,arguments)||this}var E=_.prototype;return E.execute=function(){var T=this;return L(T.rootNode,T.options,N)},_}(A),v={};function g(d,_){return _=y.assign({},v,_),new x(d,_).execute()}U.exports=g},function(U,z,B){var j=B(6);function R(L,y){var x=0;return L.children.length?L.children.forEach(function(v){x+=R(v,y)}):x=L.height,L._subTreeSep=y.getSubTreeSep(L.data),L.totalHeight=Math.max(L.height,x)+2*L._subTreeSep,L.totalHeight}function A(L){var y=L.children,x=y.length;if(x){y.forEach(function(w){A(w)});var v=y[0],g=y[x-1],d=g.y-v.y+g.height,_=0;if(y.forEach(function(w){_+=w.totalHeight}),d>L.height)L.y=v.y+d/2-L.height/2;else if(y.length!==1||L.height>_){var E=L.y+(L.height-d)/2-v.y;y.forEach(function(w){w.translate(0,E)})}else L.y=(v.y+v.height/2+g.y+g.height/2)/2-L.height/2}}var N={getSubTreeSep:function(){return 0}};U.exports=function(L,y){y===void 0&&(y={}),y=j.assign({},N,y),L.parent={x:0,width:0,height:0,y:0},L.BFTraverse(function(x){x.x=x.parent.x+x.parent.width}),L.parent=null,R(L,y),L.startY=0,L.y=L.totalHeight/2-L.height/2,L.eachNode(function(x){var v=x.children,g=v.length;if(g){var d=v[0];if(d.startY=x.startY+x._subTreeSep,g===1)d.y=x.y+x.height/2-d.height/2;else{d.y=d.startY+d.totalHeight/2-d.height/2;for(var _=1;_=0;return E?T?Math.PI*2-w:w:T?w:Math.PI*2-w}B=v;function g(d,_,E){return E?(d[0]=_[1],d[1]=-1*_[0]):(d[0]=-1*_[1],d[1]=_[0]),d}B=g},59591:function(or,U,z){var B=z(50008).default;function j(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */or.exports=j=function(){return R},or.exports.__esModule=!0,or.exports.default=or.exports;var R={},A=Object.prototype,N=A.hasOwnProperty,L=Object.defineProperty||function(Ie,be,pe){Ie[be]=pe.value},y=typeof Symbol=="function"?Symbol:{},x=y.iterator||"@@iterator",v=y.asyncIterator||"@@asyncIterator",g=y.toStringTag||"@@toStringTag";function d(Ie,be,pe){return Object.defineProperty(Ie,be,{value:pe,enumerable:!0,configurable:!0,writable:!0}),Ie[be]}try{d({},"")}catch(Ie){d=function(pe,Me,De){return pe[Me]=De}}function _(Ie,be,pe,Me){var De=be&&be.prototype instanceof T?be:T,Ue=Object.create(De.prototype),nt=new de(Me||[]);return L(Ue,"_invoke",{value:q(Ie,pe,nt)}),Ue}function E(Ie,be,pe){try{return{type:"normal",arg:Ie.call(be,pe)}}catch(Me){return{type:"throw",arg:Me}}}R.wrap=_;var w={};function T(){}function k(){}function b(){}var m={};d(m,x,function(){return this});var $=Object.getPrototypeOf,W=$&&$($(Te([])));W&&W!==A&&N.call(W,x)&&(m=W);var X=b.prototype=T.prototype=Object.create(m);function H(Ie){["next","throw","return"].forEach(function(be){d(Ie,be,function(pe){return this._invoke(be,pe)})})}function Q(Ie,be){function pe(De,Ue,nt,Ze){var ht=E(Ie[De],Ie,Ue);if(ht.type!=="throw"){var Rt=ht.arg,tr=Rt.value;return tr&&B(tr)=="object"&&N.call(tr,"__await")?be.resolve(tr.__await).then(function(Qe){pe("next",Qe,nt,Ze)},function(Qe){pe("throw",Qe,nt,Ze)}):be.resolve(tr).then(function(Qe){Rt.value=Qe,nt(Rt)},function(Qe){return pe("throw",Qe,nt,Ze)})}Ze(ht.arg)}var Me;L(this,"_invoke",{value:function(Ue,nt){function Ze(){return new be(function(ht,Rt){pe(Ue,nt,ht,Rt)})}return Me=Me?Me.then(Ze,Ze):Ze()}})}function q(Ie,be,pe){var Me="suspendedStart";return function(De,Ue){if(Me==="executing")throw new Error("Generator is already running");if(Me==="completed"){if(De==="throw")throw Ue;return Se()}for(pe.method=De,pe.arg=Ue;;){var nt=pe.delegate;if(nt){var Ze=J(nt,pe);if(Ze){if(Ze===w)continue;return Ze}}if(pe.method==="next")pe.sent=pe._sent=pe.arg;else if(pe.method==="throw"){if(Me==="suspendedStart")throw Me="completed",pe.arg;pe.dispatchException(pe.arg)}else pe.method==="return"&&pe.abrupt("return",pe.arg);Me="executing";var ht=E(Ie,be,pe);if(ht.type==="normal"){if(Me=pe.done?"completed":"suspendedYield",ht.arg===w)continue;return{value:ht.arg,done:pe.done}}ht.type==="throw"&&(Me="completed",pe.method="throw",pe.arg=ht.arg)}}}function J(Ie,be){var pe=be.method,Me=Ie.iterator[pe];if(Me===void 0)return be.delegate=null,pe==="throw"&&Ie.iterator.return&&(be.method="return",be.arg=void 0,J(Ie,be),be.method==="throw")||pe!=="return"&&(be.method="throw",be.arg=new TypeError("The iterator does not provide a '"+pe+"' method")),w;var De=E(Me,Ie.iterator,be.arg);if(De.type==="throw")return be.method="throw",be.arg=De.arg,be.delegate=null,w;var Ue=De.arg;return Ue?Ue.done?(be[Ie.resultName]=Ue.value,be.next=Ie.nextLoc,be.method!=="return"&&(be.method="next",be.arg=void 0),be.delegate=null,w):Ue:(be.method="throw",be.arg=new TypeError("iterator result is not an object"),be.delegate=null,w)}function te(Ie){var be={tryLoc:Ie[0]};1 in Ie&&(be.catchLoc=Ie[1]),2 in Ie&&(be.finallyLoc=Ie[2],be.afterLoc=Ie[3]),this.tryEntries.push(be)}function fe(Ie){var be=Ie.completion||{};be.type="normal",delete be.arg,Ie.completion=be}function de(Ie){this.tryEntries=[{tryLoc:"root"}],Ie.forEach(te,this),this.reset(!0)}function Te(Ie){if(Ie){var be=Ie[x];if(be)return be.call(Ie);if(typeof Ie.next=="function")return Ie;if(!isNaN(Ie.length)){var pe=-1,Me=function De(){for(;++pe=0;--De){var Ue=this.tryEntries[De],nt=Ue.completion;if(Ue.tryLoc==="root")return Me("end");if(Ue.tryLoc<=this.prev){var Ze=N.call(Ue,"catchLoc"),ht=N.call(Ue,"finallyLoc");if(Ze&&ht){if(this.prev=0;--Me){var De=this.tryEntries[Me];if(De.tryLoc<=this.prev&&N.call(De,"finallyLoc")&&this.prev=0;--pe){var Me=this.tryEntries[pe];if(Me.finallyLoc===be)return this.complete(Me.completion,Me.afterLoc),fe(Me),w}},catch:function(be){for(var pe=this.tryEntries.length-1;pe>=0;--pe){var Me=this.tryEntries[pe];if(Me.tryLoc===be){var De=Me.completion;if(De.type==="throw"){var Ue=De.arg;fe(Me)}return Ue}}throw new Error("illegal catch attempt")},delegateYield:function(be,pe,Me){return this.delegate={iterator:Te(be),resultName:pe,nextLoc:Me},this.method==="next"&&(this.arg=void 0),w}},R}or.exports=j,or.exports.__esModule=!0,or.exports.default=or.exports},87757:function(or,U,z){var B=z(59591)();or.exports=B;try{regeneratorRuntime=B}catch(j){typeof globalThis=="object"?globalThis.regeneratorRuntime=B:Function("r","regeneratorRuntime = r")(B)}},41685:function(or,U,z){"use strict";z.r(U),z.d(U,{forceCenter:function(){return B},forceCollide:function(){return y},forceLink:function(){return g},forceManyBody:function(){return pt},forceRadial:function(){return rr},forceSimulation:function(){return _t},forceX:function(){return xr},forceY:function(){return Vt}});function B(ft,Bt){var qt,br=1;ft==null&&(ft=0),Bt==null&&(Bt=0);function Ur(){var Ae,Hr=qt.length,Sr,qr=0,Gr=0;for(Ae=0;Aemn.index){var Pn=$r-In.x-In.vx,An=gn-In.y-In.vy,ln=Pn*Pn+An*An;ln$r+Zr||wn<$r-Zr||pn>gn+Zr||SnGr.r&&(Gr.r=Gr[vn].r)}function qr(){if(!!Bt){var Gr,vn=Bt.length,Gn;for(qt=new Array(vn),Gr=0;Gr=0&&(br=qt.slice(Ur+1),qt=qt.slice(0,Ur)),qt&&!Bt.hasOwnProperty(qt))throw new Error("unknown type: "+qt);return{type:qt,name:br}})}E.prototype=_.prototype={constructor:E,on:function(Bt,qt){var br=this._,Ur=w(Bt+"",br),Ae,Hr=-1,Sr=Ur.length;if(arguments.length<2){for(;++Hr0)for(var br=new Array(Ae),Ur=0,Ae,Hr;Ur=0&&ft._call.call(null,Bt),ft=ft._next;--m}function Me(){J=(q=fe.now())+te,m=$=0;try{pe()}finally{m=0,Ue(),J=0}}function De(){var ft=fe.now(),Bt=ft-q;Bt>X&&(te-=Bt,q=ft)}function Ue(){for(var ft,Bt=H,qt,br=Infinity;Bt;)Bt._call?(br>Bt._time&&(br=Bt._time),ft=Bt,Bt=Bt._next):(qt=Bt._next,Bt._next=null,Bt=ft?ft._next=qt:H=qt);Q=ft,nt(br)}function nt(ft){if(!m){$&&($=clearTimeout($));var Bt=ft-J;Bt>24?(ft1?(Wt==null?Sr.delete(ct):Sr.set(ct,gn(Wt)),Bt):Sr.get(ct)},find:function(ct,Wt,Er){var Dr=0,Vr=ft.length,pn,wn,Sn,In,$n;for(Er==null?Er=Infinity:Er*=Er,Dr=0;Dr1?(Gr.on(ct,Wt),Bt):Gr.on(ct)}}}function pt(){var ft,Bt,qt,br,Ur=R(-30),Ae,Hr=1,Sr=Infinity,qr=.81;function Gr($r){var gn,Rr=ft.length,ct=(0,j.Z)(ft,Qe,lt).visitAfter(Gn);for(br=$r,gn=0;gn=Sr)return;($r.data!==Bt||$r.next)&&(Wt===0&&(Wt=A(qt),Vr+=Wt*Wt),Er===0&&(Er=A(qt),Vr+=Er*Er),Vr1&&arguments[1]!==void 0?arguments[1]:{};if(!y(ne))throw new TypeError("input must be an array");if(ne.length===0)throw new TypeError("input must not be empty");var P=ae.fromIndex,S=P===void 0?0:P,C=ae.toIndex,V=C===void 0?ne.length:C;if(S<0||S>=ne.length||!Number.isInteger(S))throw new Error("fromIndex must be a positive integer smaller than length");if(V<=S||V>ne.length||!Number.isInteger(V))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var he=ne[S],xe=S+1;xehe&&(he=ne[xe]);return he}function v(ne){var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!y(ne))throw new TypeError("input must be an array");if(ne.length===0)throw new TypeError("input must not be empty");var P=ae.fromIndex,S=P===void 0?0:P,C=ae.toIndex,V=C===void 0?ne.length:C;if(S<0||S>=ne.length||!Number.isInteger(S))throw new Error("fromIndex must be a positive integer smaller than length");if(V<=S||V>ne.length||!Number.isInteger(V))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var he=ne[S],xe=S+1;xe1&&arguments[1]!==void 0?arguments[1]:{};if(y(ne)){if(ne.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var P;if(ae.output!==void 0){if(!y(ae.output))throw new TypeError("output option must be an array if specified");P=ae.output}else P=new Array(ne.length);var S=v(ne),C=x(ne);if(S===C)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var V=ae.min,he=V===void 0?ae.autoMinMax?S:0:V,xe=ae.max,Ee=xe===void 0?ae.autoMinMax?C:1:xe;if(he>=Ee)throw new RangeError("min option must be smaller than max option");for(var Ne=(Ee-he)/(C-S),Et=0;Et1&&arguments[1]!==void 0?arguments[1]:{},P=ae.maxRows,S=P===void 0?15:P,C=ae.maxColumns,V=C===void 0?10:C,he=ae.maxNumSize,xe=he===void 0?8:he,Ee=ae.padMinus,Ne=Ee===void 0?"auto":Ee;return"".concat(ne.constructor.name,` { `).concat(d,`[ `).concat(_).concat(T(ne,S,V,xe,Ne),` `).concat(d,`] `).concat(d,"rows: ").concat(ne.rows,` `).concat(d,"columns: ").concat(ne.columns,` }`)}function T(ne,ae,P,S,C){var V=ne.rows,he=ne.columns,xe=Math.min(V,ae),Ee=Math.min(he,P),Ne=[];if(C==="auto"){C=!1;e:for(var Et=0;Et=0&&P?" ".concat(b(ne,ae-1)):b(ne,ae)).padEnd(ae)}function b(ne,ae){var P=ne.toString();if(P.length<=ae)return P;var S=ne.toFixed(ae);if(S.length>ae&&(S=ne.toFixed(Math.max(0,ae-(S.length-ae)))),S.length<=ae&&!S.startsWith("0.000")&&!S.startsWith("-0.000"))return S;var C=ne.toExponential(ae);return C.length>ae&&(C=ne.toExponential(Math.max(0,ae-(C.length-ae)))),C.slice(0)}function m(ne,ae){ne.prototype.add=function(S){return typeof S=="number"?this.addS(S):this.addM(S)},ne.prototype.addS=function(S){for(var C=0;C>S);return this},ne.prototype.signPropagatingRightShiftM=function(S){if(S=ae.checkMatrix(S),this.rows!==S.rows||this.columns!==S.columns)throw new RangeError("Matrices dimensions must be equal");for(var C=0;C>S.get(C,V));return this},ne.signPropagatingRightShift=function(S,C){var V=new ae(S);return V.signPropagatingRightShift(C)},ne.prototype.rightShift=function(S){return typeof S=="number"?this.rightShiftS(S):this.rightShiftM(S)},ne.prototype.rightShiftS=function(S){for(var C=0;C>>S);return this},ne.prototype.rightShiftM=function(S){if(S=ae.checkMatrix(S),this.rows!==S.rows||this.columns!==S.columns)throw new RangeError("Matrices dimensions must be equal");for(var C=0;C>>S.get(C,V));return this},ne.rightShift=function(S,C){var V=new ae(S);return V.rightShift(C)},ne.prototype.zeroFillRightShift=ne.prototype.rightShift,ne.prototype.zeroFillRightShiftS=ne.prototype.rightShiftS,ne.prototype.zeroFillRightShiftM=ne.prototype.rightShiftM,ne.zeroFillRightShift=ne.rightShift,ne.prototype.not=function(){for(var S=0;SS)throw new RangeError("Row index out of range")}function W(ne,ae,P){var S=P?ne.columns:ne.columns-1;if(ae<0||ae>S)throw new RangeError("Column index out of range")}function X(ne,ae){if(ae.to1DArray&&(ae=ae.to1DArray()),ae.length!==ne.columns)throw new RangeError("vector size must be the same as the number of columns");return ae}function H(ne,ae){if(ae.to1DArray&&(ae=ae.to1DArray()),ae.length!==ne.rows)throw new RangeError("vector size must be the same as the number of rows");return ae}function Q(ne,ae){if(!y(ae))throw new TypeError("row indices must be an array");for(var P=0;P=ne.rows)throw new RangeError("row indices are out of range")}function q(ne,ae){if(!y(ae))throw new TypeError("column indices must be an array");for(var P=0;P=ne.columns)throw new RangeError("column indices are out of range")}function J(ne,ae,P,S,C){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(fe("startRow",ae),fe("endRow",P),fe("startColumn",S),fe("endColumn",C),ae>P||S>C||ae<0||ae>=ne.rows||P<0||P>=ne.rows||S<0||S>=ne.columns||C<0||C>=ne.columns)throw new RangeError("Submatrix indices are out of range")}function te(ne){for(var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,P=[],S=0;SC?(he=!0,C=S):(V=!1,he=!0);P++}return V}},{key:"isReducedEchelonForm",value:function(){for(var P=0,S=0,C=-1,V=!0,he=!1;PC?(he=!0,C=S):(V=!1,he=!0);for(var xe=S+1;xeP.get(V,C)&&(V=he);if(P.get(V,C)===0)C++;else{P.swapRows(S,V);for(var xe=P.get(S,C),Ee=C;Ee=0;)if(P.maxRow(V)===0)V--;else{for(var he=0,xe=!1;he0&&arguments[0]!==void 0?arguments[0]:{};if(typeof P!="object")throw new TypeError("options must be an object");var S=P.rows,C=S===void 0?1:S,V=P.columns,he=V===void 0?1:V;if(!Number.isInteger(C)||C<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(he)||he<=0)throw new TypeError("columns must be a positive integer");for(var xe=new Vt(this.rows*C,this.columns*he),Ee=0;EeS[C]&&(S[C]=this.get(C,V));return S}case"column":{for(var he=new Array(this.columns).fill(Number.NEGATIVE_INFINITY),xe=0;xehe[Ee]&&(he[Ee]=this.get(xe,Ee));return he}case void 0:{for(var Ne=this.get(0,0),Et=0;EtNe&&(Ne=this.get(Et,st));return Ne}default:throw new Error("invalid option: ".concat(P))}}},{key:"maxIndex",value:function(){de(this);for(var P=this.get(0,0),S=[0,0],C=0;CP&&(P=this.get(C,V),S[0]=C,S[1]=V);return S}},{key:"min",value:function(P){if(this.isEmpty())return NaN;switch(P){case"row":{for(var S=new Array(this.rows).fill(Number.POSITIVE_INFINITY),C=0;CS&&(S=this.get(P,C));return S}},{key:"maxRowIndex",value:function(P){$(this,P),de(this);for(var S=this.get(P,0),C=[P,0],V=1;VS&&(S=this.get(P,V),C[1]=V);return C}},{key:"minRow",value:function(P){if($(this,P),this.isEmpty())return NaN;for(var S=this.get(P,0),C=1;CS&&(S=this.get(C,P));return S}},{key:"maxColumnIndex",value:function(P){W(this,P),de(this);for(var S=this.get(0,P),C=[0,P],V=1;VS&&(S=this.get(V,P),C[0]=V);return C}},{key:"minColumn",value:function(P){if(W(this,P),this.isEmpty())return NaN;for(var S=this.get(0,P),C=1;C0&&arguments[0]!==void 0?arguments[0]:"frobenius",S=0;if(P==="max")return this.max();if(P==="frobenius"){for(var C=0;C0&&arguments[0]!==void 0?arguments[0]:{};if(typeof P!="object")throw new TypeError("options must be an object");var S=P.min,C=S===void 0?0:S,V=P.max,he=V===void 0?1:V;if(!Number.isFinite(C))throw new TypeError("min must be a number");if(!Number.isFinite(he))throw new TypeError("max must be a number");if(C>=he)throw new RangeError("min must be smaller than max");for(var xe=new Vt(this.rows,this.columns),Ee=0;Ee0&&g(Ne,{min:C,max:he,output:Ne}),xe.setRow(Ee,Ne)}return xe}},{key:"scaleColumns",value:function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(typeof P!="object")throw new TypeError("options must be an object");var S=P.min,C=S===void 0?0:S,V=P.max,he=V===void 0?1:V;if(!Number.isFinite(C))throw new TypeError("min must be a number");if(!Number.isFinite(he))throw new TypeError("max must be a number");if(C>=he)throw new RangeError("min must be smaller than max");for(var xe=new Vt(this.rows,this.columns),Ee=0;Ee0&&arguments[0]!==void 0?arguments[0]:rr,S=0;S0&&arguments[0]!==void 0?arguments[0]:rr,S=0;SC||S<0||S>=this.columns||C<0||C>=this.columns)throw new RangeError("Argument out of range");for(var V=new Vt(P.length,C-S+1),he=0;he=this.rows)throw new RangeError("Row index out of range: ".concat(P[he]));V.set(he,xe-S,this.get(P[he],xe))}return V}},{key:"subMatrixColumn",value:function(P,S,C){if(S===void 0&&(S=0),C===void 0&&(C=this.rows-1),S>C||S<0||S>=this.rows||C<0||C>=this.rows)throw new RangeError("Argument out of range");for(var V=new Vt(C-S+1,P.length),he=0;he=this.columns)throw new RangeError("Column index out of range: ".concat(P[he]));V.set(xe-S,he,this.get(xe,P[he]))}return V}},{key:"setSubMatrix",value:function(P,S,C){if(P=Vt.checkMatrix(P),P.isEmpty())return this;var V=S+P.rows-1,he=C+P.columns-1;J(this,S,V,C,he);for(var xe=0;xe1&&arguments[1]!==void 0?arguments[1]:{};if(typeof P=="object"&&(S=P,P=void 0),typeof S!="object")throw new TypeError("options must be an object");var C=S,V=C.unbiased,he=V===void 0?!0:V,xe=C.mean,Ee=xe===void 0?this.mean(P):xe;if(typeof he!="boolean")throw new TypeError("unbiased must be a boolean");switch(P){case"row":{if(!y(Ee))throw new TypeError("mean must be an array");return De(this,he,Ee)}case"column":{if(!y(Ee))throw new TypeError("mean must be an array");return Ue(this,he,Ee)}case void 0:{if(typeof Ee!="number")throw new TypeError("mean must be a number");return nt(this,he,Ee)}default:throw new Error("invalid option: ".concat(P))}}},{key:"standardDeviation",value:function(P,S){typeof P=="object"&&(S=P,P=void 0);var C=this.variance(P,S);if(P===void 0)return Math.sqrt(C);for(var V=0;V1&&arguments[1]!==void 0?arguments[1]:{};if(typeof P=="object"&&(S=P,P=void 0),typeof S!="object")throw new TypeError("options must be an object");var C=S,V=C.center,he=V===void 0?this.mean(P):V;switch(P){case"row":{if(!y(he))throw new TypeError("center must be an array");return Ze(this,he),this}case"column":{if(!y(he))throw new TypeError("center must be an array");return ht(this,he),this}case void 0:{if(typeof he!="number")throw new TypeError("center must be a number");return Rt(this,he),this}default:throw new Error("invalid option: ".concat(P))}}},{key:"scale",value:function(P){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof P=="object"&&(S=P,P=void 0),typeof S!="object")throw new TypeError("options must be an object");var C=S.scale;switch(P){case"row":{if(C===void 0)C=tr(this);else if(!y(C))throw new TypeError("scale must be an array");return Qe(this,C),this}case"column":{if(C===void 0)C=lt(this);else if(!y(C))throw new TypeError("scale must be an array");return St(this,C),this}case void 0:{if(C===void 0)C=Ct(this);else if(typeof C!="number")throw new TypeError("scale must be a number");return _t(this,C),this}default:throw new Error("invalid option: ".concat(P))}}},{key:"toString",value:function(P){return w(this,P)}}],[{key:"from1DArray",value:function(P,S,C){var V=P*S;if(V!==C.length)throw new RangeError("data length does not match given dimensions");for(var he=new Vt(P,S),xe=0;xe2&&arguments[2]!==void 0?arguments[2]:{};if(typeof C!="object")throw new TypeError("options must be an object");for(var V=C.random,he=V===void 0?Math.random:V,xe=new Vt(P,S),Ee=0;Ee2&&arguments[2]!==void 0?arguments[2]:{};if(typeof C!="object")throw new TypeError("options must be an object");var V=C.min,he=V===void 0?0:V,xe=C.max,Ee=xe===void 0?1e3:xe,Ne=C.random,Et=Ne===void 0?Math.random:Ne;if(!Number.isInteger(he))throw new TypeError("min must be an integer");if(!Number.isInteger(Ee))throw new TypeError("max must be an integer");if(he>=Ee)throw new RangeError("min must be smaller than max");for(var st=Ee-he,Pt=new Vt(P,S),$t=0;$t=0)if(V.data=[],Number.isInteger(C)&&C>=0)for(var he=0;he1&&arguments[1]!==void 0?arguments[1]:{};(0,A.Z)(this,P);var he=V.rows,xe=he===void 0?1:he;if(S.length%xe!=0)throw new Error("the data length is not divisible by the number of rows");return C=ae.call(this),C.rows=xe,C.columns=S.length/xe,C.data=S,C}return(0,N.Z)(P,[{key:"set",value:function(C,V,he){var xe=this._calculateIndex(C,V);return this.data[xe]=he,this}},{key:"get",value:function(C,V){var he=this._calculateIndex(C,V);return this.data[he]}},{key:"_calculateIndex",value:function(C,V){return C*this.columns+V}}]),P}(pt),Gn=function(ne){(0,j.Z)(P,ne);var ae=(0,R.Z)(P);function P(S){var C;return(0,A.Z)(this,P),C=ae.call(this),C.data=S,C.rows=S.length,C.columns=S[0].length,C}return(0,N.Z)(P,[{key:"set",value:function(C,V,he){return this.data[C][V]=he,this}},{key:"get",value:function(C,V){return this.data[C][V]}}]),P}(pt);function mn(ne,ae){if(y(ne))return ne[0]&&y(ne[0])?new Gn(ne):new vn(ne,ae);throw new Error("the argument is not an array")}var $r=function(){function ne(ae){(0,A.Z)(this,ne),ae=Gn.checkMatrix(ae);var P=ae.clone(),S=P.rows,C=P.columns,V=new Float64Array(S),he=1,xe,Ee,Ne,Et,st,Pt,$t,Ht,Br;for(xe=0;xeMath.abs(Ht[Et])&&(Et=xe);if(Et!==Ee){for(Ne=0;Ne=0;Et--){for(Ne=0;Nexe?V.set(he,xe,P.get(he,xe)):he===xe?V.set(he,xe,1):V.set(he,xe,0);return V}},{key:"upperTriangularMatrix",get:function(){for(var P=this.LU,S=P.rows,C=P.columns,V=new Vt(S,C),he=0;heMath.abs(ae)?(P=ae/ne,Math.abs(ne)*Math.sqrt(1+P*P)):ae!==0?(P=ne/ae,Math.abs(ae)*Math.sqrt(1+P*P)):0}var Rr=function(){function ne(ae){(0,A.Z)(this,ne),ae=Gn.checkMatrix(ae);var P=ae.clone(),S=ae.rows,C=ae.columns,V=new Float64Array(C),he,xe,Ee,Ne;for(Ee=0;Ee=0;Et--){for(Ne=0;Ne=0;Ee--){for(he=0;he1&&arguments[1]!==void 0?arguments[1]:{};if((0,A.Z)(this,ne),ae=Gn.checkMatrix(ae),ae.isEmpty())throw new Error("Matrix must be non-empty");var S=ae.rows,C=ae.columns,V=P.computeLeftSingularVectors,he=V===void 0?!0:V,xe=P.computeRightSingularVectors,Ee=xe===void 0?!0:xe,Ne=P.autoTranspose,Et=Ne===void 0?!1:Ne,st=Boolean(he),Pt=Boolean(Ee),$t=!1,Ht;if(S=0;_a--)if(Qt[_a]!==0){for(var So=_a+1;So=0;mi--){if(mi0;){var _n=void 0,Fo=void 0;for(_n=Ea-2;_n>=-1&&_n!==-1;_n--){var Go=Number.MIN_VALUE+Hi*Math.abs(Qt[_n]+Math.abs(Qt[_n+1]));if(Math.abs(Nr[_n])<=Go||Number.isNaN(Nr[_n])){Nr[_n]=0;break}}if(_n===Ea-2)Fo=4;else{var Va=void 0;for(Va=Ea-1;Va>=_n&&Va!==_n;Va--){var Ms=(Va!==Ea?Math.abs(Nr[Va]):0)+(Va!==_n+1?Math.abs(Nr[Va-1]):0);if(Math.abs(Qt[Va])<=Hi*Ms){Qt[Va]=0;break}}Va===_n?Fo=3:Va===Ea-1?Fo=1:(Fo=2,_n=Va)}switch(_n++,Fo){case 1:{var Ko=Nr[Ea-2];Nr[Ea-2]=0;for(var Li=Ea-2;Li>=_n;Li--){var Mo=gn(Qt[Li],Ko),ho=Qt[Li]/Mo,Gi=Ko/Mo;if(Qt[Li]=Mo,Li!==_n&&(Ko=-Gi*Nr[Li-1],Nr[Li-1]=ho*Nr[Li-1]),Pt)for(var Di=0;Di=Qt[_n+1]);){var po=Qt[_n];if(Qt[_n]=Qt[_n+1],Qt[_n+1]=po,Pt&&_nS&&he.set(xe,Ee,P.get(xe,Ee)/this.s[Ee]);for(var Ne=this.U,Et=Ne.rows,st=Ne.columns,Pt=new Vt(C,Et),$t=0;$tP&&S++;return S}},{key:"diagonal",get:function(){return Array.from(this.s)}},{key:"threshold",get:function(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}},{key:"leftSingularVectors",get:function(){return this.U}},{key:"rightSingularVectors",get:function(){return this.V}},{key:"diagonalMatrix",get:function(){return Vt.diag(this.s)}}]),ne}();function Wt(ne){var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return ne=Gn.checkMatrix(ne),ae?new ct(ne).inverse():Er(ne,Vt.eye(ne.rows))}function Er(ne,ae){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return ne=Gn.checkMatrix(ne),ae=Gn.checkMatrix(ae),P?new ct(ne).solve(ae):ne.isSquare()?new $r(ne).solve(ae):new Rr(ne).solve(ae)}function Dr(ne){if(ne=Vt.checkMatrix(ne),ne.isSquare()){if(ne.columns===0)return 1;var ae,P,S,C;if(ne.columns===2)return ae=ne.get(0,0),P=ne.get(0,1),S=ne.get(1,0),C=ne.get(1,1),ae*C-P*S;if(ne.columns===3){var V,he,xe;return V=new Sr(ne,[1,2],[1,2]),he=new Sr(ne,[1,2],[0,2]),xe=new Sr(ne,[1,2],[0,1]),ae=ne.get(0,0),P=ne.get(0,1),S=ne.get(0,2),ae*Dr(V)-P*Dr(he)+S*Dr(xe)}else return new $r(ne).determinant}else throw Error("determinant can only be calculated for a square matrix")}function Vr(ne,ae){for(var P=[],S=0;S3&&arguments[3]!==void 0?arguments[3]:1e-9,C=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1e-9;if(ne>C)return new Array(ae.rows+1).fill(0);for(var V=ae.addRow(P,[0]),he=0;he1&&arguments[1]!==void 0?arguments[1]:{},P=ae.thresholdValue,S=P===void 0?1e-9:P,C=ae.thresholdError,V=C===void 0?1e-9:C;ne=Vt.checkMatrix(ne);for(var he=ne.rows,xe=new Vt(he,he),Ee=0;Ee1&&arguments[1]!==void 0?arguments[1]:Number.EPSILON;if(ne=Vt.checkMatrix(ne),ne.isEmpty())return ne.transpose();for(var P=new ct(ne,{autoTranspose:!0}),S=P.leftSingularVectors,C=P.rightSingularVectors,V=P.diagonal,he=0;heae?V[he]=1/V[he]:V[he]=0;return C.mmul(Vt.diag(V).mmul(S.transpose()))}function In(ne){var ae=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ne,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ne=new Vt(ne);var S=!1;if(typeof ae=="object"&&!Vt.isMatrix(ae)&&!y(ae)?(P=ae,ae=ne,S=!0):ae=new Vt(ae),ne.rows!==ae.rows)throw new TypeError("Both matrices must have the same number of rows");var C=P,V=C.center,he=V===void 0?!0:V;he&&(ne=ne.center("column"),S||(ae=ae.center("column")));for(var xe=ne.transpose().mmul(ae),Ee=0;Ee1&&arguments[1]!==void 0?arguments[1]:ne,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ne=new Vt(ne);var S=!1;if(typeof ae=="object"&&!Vt.isMatrix(ae)&&!y(ae)?(P=ae,ae=ne,S=!0):ae=new Vt(ae),ne.rows!==ae.rows)throw new TypeError("Both matrices must have the same number of rows");var C=P,V=C.center,he=V===void 0?!0:V,xe=C.scale,Ee=xe===void 0?!0:xe;he&&(ne.center("column"),S||ae.center("column")),Ee&&(ne.scale("column"),S||ae.scale("column"));for(var Ne=ne.standardDeviation("column",{unbiased:!0}),Et=S?Ne:ae.standardDeviation("column",{unbiased:!0}),st=ne.transpose().mmul(ae),Pt=0;Pt1&&arguments[1]!==void 0?arguments[1]:{};(0,A.Z)(this,ne);var S=P.assumeSymmetric,C=S===void 0?!1:S;if(ae=Gn.checkMatrix(ae),!ae.isSquare())throw new Error("Matrix is not a square matrix");if(ae.isEmpty())throw new Error("Matrix must be non-empty");var V=ae.columns,he=new Vt(V,V),xe=new Float64Array(V),Ee=new Float64Array(V),Ne=ae,Et,st,Pt=!1;if(C?Pt=!0:Pt=ae.isSymmetric(),Pt){for(Et=0;Et0?V.set(he,he+1,S[he]):S[he]<0&&V.set(he,he-1,S[he])}return V}}]),ne}();function Pn(ne,ae,P,S){var C,V,he,xe,Ee,Ne,Et,st;for(Ee=0;Ee0;xe--){for(st=0,he=0,Ne=0;Ne0&&(V=-V),ae[xe]=st*V,he=he-C*V,P[xe-1]=C-V,Ee=0;EeNe){en=0;do{for(en=en+1,C=P[Ne],st=(P[Ne+1]-C)/(2*ae[Ne]),Pt=gn(st,1),st<0&&(Pt=-Pt),P[Ne]=ae[Ne]/(st+Pt),P[Ne+1]=ae[Ne]*(st+Pt),$t=P[Ne+1],V=C-P[Ne],he=Ne+2;he=Ne;he--)for(hn=Br,Br=Ht,pr=Qt,C=Ht*ae[he],V=Ht*st,Pt=gn(st,ae[he]),ae[he+1]=Qt*Pt,Qt=ae[he]/Pt,Ht=st/Pt,st=Ht*P[he]-Qt*C,P[he+1]=V+Qt*(Ht*C+Qt*P[he]),Ee=0;Eekn*ta)}P[Ne]=P[Ne]+Nr,ae[Ne]=0}for(he=0;he=st;Ne--)P[Ne]=ae.get(Ne,st-1)/Pt,Ee+=P[Ne]*P[Ne];for(xe=Math.sqrt(Ee),P[st]>0&&(xe=-xe),Ee=Ee-P[st]*xe,P[st]=P[st]-xe,Et=st;Et=st;Ne--)he+=P[Ne]*ae.get(Ne,Et);for(he=he/Ee,Ne=st;Ne<=V;Ne++)ae.set(Ne,Et,ae.get(Ne,Et)-he*P[Ne])}for(Ne=0;Ne<=V;Ne++){for(he=0,Et=V;Et>=st;Et--)he+=P[Et]*ae.get(Ne,Et);for(he=he/Ee,Et=st;Et<=V;Et++)ae.set(Ne,Et,ae.get(Ne,Et)-he*P[Et])}P[st]=Pt*P[st],ae.set(st,st-1,Pt*xe)}}for(Ne=0;Ne=C+1;st--)if(ae.get(st,st-1)!==0){for(Ne=st+1;Ne<=V;Ne++)P[Ne]=ae.get(Ne,st-1);for(Et=st;Et<=V;Et++){for(xe=0,Ne=st;Ne<=V;Ne++)xe+=P[Ne]*S.get(Ne,Et);for(xe=xe/P[st]/ae.get(st,st-1),Ne=st;Ne<=V;Ne++)S.set(Ne,Et,S.get(Ne,Et)+xe*P[Ne])}}}function va(ne,ae,P,S,C){var V=ne-1,he=0,xe=ne-1,Ee=Number.EPSILON,Ne=0,Et=0,st=0,Pt=0,$t=0,Ht=0,Br=0,hn=0,Ot,Qt,pr,en,Nr,ta,kn,En,Rn,Yn,bn,je,Ce,Xe,ut;for(Ot=0;Otxe)&&(P[Ot]=C.get(Ot,Ot),ae[Ot]=0),Qt=Math.max(Ot-1,0);Qt=he;){for(en=V;en>he&&(Ht=Math.abs(C.get(en-1,en-1))+Math.abs(C.get(en,en)),Ht===0&&(Ht=Et),!(Math.abs(C.get(en,en-1))=0){for(Br=st>=0?st+Br:st-Br,P[V-1]=En+Br,P[V]=P[V-1],Br!==0&&(P[V]=En-kn/Br),ae[V-1]=0,ae[V]=0,En=C.get(V,V-1),Ht=Math.abs(En)+Math.abs(Br),st=En/Ht,Pt=Br/Ht,$t=Math.sqrt(st*st+Pt*Pt),st=st/$t,Pt=Pt/$t,Qt=V-1;Qt0)){for(Ht=Math.sqrt(Ht),Rn=en&&(Br=C.get(Nr,Nr),$t=En-Br,Ht=Rn-Br,st=($t*Ht-kn)/C.get(Nr+1,Nr)+C.get(Nr,Nr+1),Pt=C.get(Nr+1,Nr+1)-Br-$t-Ht,$t=C.get(Nr+2,Nr+1),Ht=Math.abs(st)+Math.abs(Pt)+Math.abs($t),st=st/Ht,Pt=Pt/Ht,$t=$t/Ht,!(Nr===en||Math.abs(C.get(Nr,Nr-1))*(Math.abs(Pt)+Math.abs($t))Nr+2&&C.set(Ot,Ot-3,0);for(pr=Nr;pr<=V-1&&(Xe=pr!==V-1,pr!==Nr&&(st=C.get(pr,pr-1),Pt=C.get(pr+1,pr-1),$t=Xe?C.get(pr+2,pr-1):0,En=Math.abs(st)+Math.abs(Pt)+Math.abs($t),En!==0&&(st=st/En,Pt=Pt/En,$t=$t/En)),En!==0);pr++)if(Ht=Math.sqrt(st*st+Pt*Pt+$t*$t),st<0&&(Ht=-Ht),Ht!==0){for(pr!==Nr?C.set(pr,pr-1,-Ht*En):en!==Nr&&C.set(pr,pr-1,-C.get(pr,pr-1)),st=st+Ht,En=st/Ht,Rn=Pt/Ht,Br=$t/Ht,Pt=Pt/st,$t=$t/st,Qt=pr;Qt=0;V--)if(st=P[V],Pt=ae[V],Pt===0)for(en=V,C.set(V,V,1),Ot=V-1;Ot>=0;Ot--){for(kn=C.get(Ot,Ot)-st,$t=0,Qt=en;Qt<=V;Qt++)$t=$t+C.get(Ot,Qt)*C.get(Qt,V);if(ae[Ot]<0)Br=kn,Ht=$t;else if(en=Ot,ae[Ot]===0?C.set(Ot,V,kn!==0?-$t/kn:-$t/(Ee*Et)):(En=C.get(Ot,Ot+1),Rn=C.get(Ot+1,Ot),Pt=(P[Ot]-st)*(P[Ot]-st)+ae[Ot]*ae[Ot],ta=(En*Ht-Br*$t)/Pt,C.set(Ot,V,ta),C.set(Ot+1,V,Math.abs(En)>Math.abs(Br)?(-$t-kn*ta)/En:(-Ht-Rn*ta)/Br)),ta=Math.abs(C.get(Ot,V)),Ee*ta*ta>1)for(Qt=Ot;Qt<=V;Qt++)C.set(Qt,V,C.get(Qt,V)/ta)}else if(Pt<0)for(en=V-1,Math.abs(C.get(V,V-1))>Math.abs(C.get(V-1,V))?(C.set(V-1,V-1,Pt/C.get(V,V-1)),C.set(V-1,V,-(C.get(V,V)-st)/C.get(V,V-1))):(ut=K(0,-C.get(V-1,V),C.get(V-1,V-1)-st,Pt),C.set(V-1,V-1,ut[0]),C.set(V-1,V,ut[1])),C.set(V,V-1,0),C.set(V,V,1),Ot=V-2;Ot>=0;Ot--){for(Yn=0,bn=0,Qt=en;Qt<=V;Qt++)Yn=Yn+C.get(Ot,Qt)*C.get(Qt,V-1),bn=bn+C.get(Ot,Qt)*C.get(Qt,V);if(kn=C.get(Ot,Ot)-st,ae[Ot]<0)Br=kn,$t=Yn,Ht=bn;else if(en=Ot,ae[Ot]===0?(ut=K(-Yn,-bn,kn,Pt),C.set(Ot,V-1,ut[0]),C.set(Ot,V,ut[1])):(En=C.get(Ot,Ot+1),Rn=C.get(Ot+1,Ot),je=(P[Ot]-st)*(P[Ot]-st)+ae[Ot]*ae[Ot]-Pt*Pt,Ce=(P[Ot]-st)*2*Pt,je===0&&Ce===0&&(je=Ee*Et*(Math.abs(kn)+Math.abs(Pt)+Math.abs(En)+Math.abs(Rn)+Math.abs(Br))),ut=K(En*$t-Br*Yn+Pt*bn,En*Ht-Br*bn-Pt*Yn,je,Ce),C.set(Ot,V-1,ut[0]),C.set(Ot,V,ut[1]),Math.abs(En)>Math.abs(Br)+Math.abs(Pt)?(C.set(Ot+1,V-1,(-Yn-kn*C.get(Ot,V-1)+Pt*C.get(Ot,V))/En),C.set(Ot+1,V,(-bn-kn*C.get(Ot,V)-Pt*C.get(Ot,V-1))/En)):(ut=K(-$t-Rn*C.get(Ot,V-1),-Ht-Rn*C.get(Ot,V),Br,Pt),C.set(Ot+1,V-1,ut[0]),C.set(Ot+1,V,ut[1]))),ta=Math.max(Math.abs(C.get(Ot,V-1)),Math.abs(C.get(Ot,V))),Ee*ta*ta>1)for(Qt=Ot;Qt<=V;Qt++)C.set(Qt,V-1,C.get(Qt,V-1)/ta),C.set(Qt,V,C.get(Qt,V)/ta)}for(Ot=0;Otxe)for(Qt=Ot;Qt=he;Qt--)for(Ot=he;Ot<=xe;Ot++){for(Br=0,pr=he;pr<=Math.min(Qt,xe);pr++)Br=Br+S.get(Ot,pr)*C.get(pr,Qt);S.set(Ot,Qt,Br)}}}function K(ne,ae,P,S){var C,V;return Math.abs(P)>Math.abs(S)?(C=S/P,V=P+C*S,[(ne+C*ae)/V,(ae-C*ne)/V]):(C=P/S,V=S+C*P,[(C*ne+ae)/V,(C*ae-ne)/V])}var Dt=function(){function ne(ae){if((0,A.Z)(this,ne),ae=Gn.checkMatrix(ae),!ae.isSymmetric())throw new Error("Matrix is not symmetric");var P=ae,S=P.rows,C=new Vt(S,S),V=!0,he,xe,Ee;for(xe=0;xe0,C.set(xe,xe,Math.sqrt(Math.max(Ne,0))),Ee=xe+1;Ee=0;Ne--)for(Ee=0;Ee1&&arguments[1]!==void 0?arguments[1]:{};(0,A.Z)(this,ne),ae=Gn.checkMatrix(ae);var S=P.Y,C=P.scaleScores,V=C===void 0?!1:C,he=P.maxIterations,xe=he===void 0?1e3:he,Ee=P.terminationCriteria,Ne=Ee===void 0?1e-10:Ee,Et;if(S){if(y(S)&&typeof S[0]=="number"?S=Vt.columnVector(S):S=Gn.checkMatrix(S),S.rows!==ae.rows)throw new Error("Y should have the same number of rows as X");Et=S.getColumnVector(0)}else Et=ae.getColumnVector(0);for(var st=1,Pt,$t,Ht,Br,hn=0;hnNe;hn++)Ht=ae.transpose().mmul(Et).div(Et.transpose().mmul(Et).get(0,0)),Ht=Ht.div(Ht.norm()),Pt=ae.mmul(Ht).div(Ht.transpose().mmul(Ht).get(0,0)),hn>0&&(st=Pt.clone().sub(Br).pow(2).sum()),Br=Pt.clone(),S?($t=S.transpose().mmul(Pt).div(Pt.transpose().mmul(Pt).get(0,0)),$t=$t.div($t.norm()),Et=S.mmul($t).div($t.transpose().mmul($t).get(0,0))):Et=Pt;if(S){var Ot=ae.transpose().mmul(Pt).div(Pt.transpose().mmul(Pt).get(0,0));Ot=Ot.div(Ot.norm());var Qt=ae.clone().sub(Pt.clone().mmul(Ot.transpose())),pr=Et.transpose().mmul(Pt).div(Pt.transpose().mmul(Pt).get(0,0)),en=S.clone().sub(Pt.clone().mulS(pr.get(0,0)).mmul($t.transpose()));this.t=Pt,this.p=Ot.transpose(),this.w=Ht.transpose(),this.q=$t,this.u=Et,this.s=Pt.transpose().mmul(Pt),this.xResidual=Qt,this.yResidual=en,this.betas=pr}else this.w=Ht.transpose(),this.s=Pt.transpose().mmul(Pt).sqrt(),V?this.t=Pt.clone().div(this.s.get(0,0)):this.t=Pt,this.xResidual=ae.sub(Pt.mmul(Ht.transpose()))})},48168:function(or,U,z){var B=z(39092),j={};for(var R in B)B.hasOwnProperty(R)&&(j[B[R]]=R);var A=or.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var N in A)if(A.hasOwnProperty(N)){if(!("channels"in A[N]))throw new Error("missing channels property: "+N);if(!("labels"in A[N]))throw new Error("missing channel labels property: "+N);if(A[N].labels.length!==A[N].channels)throw new Error("channel and label counts mismatch: "+N);var L=A[N].channels,y=A[N].labels;delete A[N].channels,delete A[N].labels,Object.defineProperty(A[N],"channels",{value:L}),Object.defineProperty(A[N],"labels",{value:y})}A.rgb.hsl=function(v){var g=v[0]/255,d=v[1]/255,_=v[2]/255,E=Math.min(g,d,_),w=Math.max(g,d,_),T=w-E,k,b,m;return w===E?k=0:g===w?k=(d-_)/T:d===w?k=2+(_-g)/T:_===w&&(k=4+(g-d)/T),k=Math.min(k*60,360),k<0&&(k+=360),m=(E+w)/2,w===E?b=0:m<=.5?b=T/(w+E):b=T/(2-w-E),[k,b*100,m*100]},A.rgb.hsv=function(v){var g,d,_,E,w,T=v[0]/255,k=v[1]/255,b=v[2]/255,m=Math.max(T,k,b),$=m-Math.min(T,k,b),W=function(X){return(m-X)/6/$+1/2};return $===0?E=w=0:(w=$/m,g=W(T),d=W(k),_=W(b),T===m?E=_-d:k===m?E=1/3+g-_:b===m&&(E=2/3+d-g),E<0?E+=1:E>1&&(E-=1)),[E*360,w*100,m*100]},A.rgb.hwb=function(v){var g=v[0],d=v[1],_=v[2],E=A.rgb.hsl(v)[0],w=1/255*Math.min(g,Math.min(d,_));return _=1-1/255*Math.max(g,Math.max(d,_)),[E,w*100,_*100]},A.rgb.cmyk=function(v){var g=v[0]/255,d=v[1]/255,_=v[2]/255,E,w,T,k;return k=Math.min(1-g,1-d,1-_),E=(1-g-k)/(1-k)||0,w=(1-d-k)/(1-k)||0,T=(1-_-k)/(1-k)||0,[E*100,w*100,T*100,k*100]};function x(v,g){return Math.pow(v[0]-g[0],2)+Math.pow(v[1]-g[1],2)+Math.pow(v[2]-g[2],2)}A.rgb.keyword=function(v){var g=j[v];if(g)return g;var d=Infinity,_;for(var E in B)if(B.hasOwnProperty(E)){var w=B[E],T=x(v,w);T.04045?Math.pow((g+.055)/1.055,2.4):g/12.92,d=d>.04045?Math.pow((d+.055)/1.055,2.4):d/12.92,_=_>.04045?Math.pow((_+.055)/1.055,2.4):_/12.92;var E=g*.4124+d*.3576+_*.1805,w=g*.2126+d*.7152+_*.0722,T=g*.0193+d*.1192+_*.9505;return[E*100,w*100,T*100]},A.rgb.lab=function(v){var g=A.rgb.xyz(v),d=g[0],_=g[1],E=g[2],w,T,k;return d/=95.047,_/=100,E/=108.883,d=d>.008856?Math.pow(d,1/3):7.787*d+16/116,_=_>.008856?Math.pow(_,1/3):7.787*_+16/116,E=E>.008856?Math.pow(E,1/3):7.787*E+16/116,w=116*_-16,T=500*(d-_),k=200*(_-E),[w,T,k]},A.hsl.rgb=function(v){var g=v[0]/360,d=v[1]/100,_=v[2]/100,E,w,T,k,b;if(d===0)return b=_*255,[b,b,b];_<.5?w=_*(1+d):w=_+d-_*d,E=2*_-w,k=[0,0,0];for(var m=0;m<3;m++)T=g+1/3*-(m-1),T<0&&T++,T>1&&T--,6*T<1?b=E+(w-E)*6*T:2*T<1?b=w:3*T<2?b=E+(w-E)*(2/3-T)*6:b=E,k[m]=b*255;return k},A.hsl.hsv=function(v){var g=v[0],d=v[1]/100,_=v[2]/100,E=d,w=Math.max(_,.01),T,k;return _*=2,d*=_<=1?_:2-_,E*=w<=1?w:2-w,k=(_+d)/2,T=_===0?2*E/(w+E):2*d/(_+d),[g,T*100,k*100]},A.hsv.rgb=function(v){var g=v[0]/60,d=v[1]/100,_=v[2]/100,E=Math.floor(g)%6,w=g-Math.floor(g),T=255*_*(1-d),k=255*_*(1-d*w),b=255*_*(1-d*(1-w));switch(_*=255,E){case 0:return[_,b,T];case 1:return[k,_,T];case 2:return[T,_,b];case 3:return[T,k,_];case 4:return[b,T,_];case 5:return[_,T,k]}},A.hsv.hsl=function(v){var g=v[0],d=v[1]/100,_=v[2]/100,E=Math.max(_,.01),w,T,k;return k=(2-d)*_,w=(2-d)*E,T=d*E,T/=w<=1?w:2-w,T=T||0,k/=2,[g,T*100,k*100]},A.hwb.rgb=function(v){var g=v[0]/360,d=v[1]/100,_=v[2]/100,E=d+_,w,T,k,b;E>1&&(d/=E,_/=E),w=Math.floor(6*g),T=1-_,k=6*g-w,(w&1)!=0&&(k=1-k),b=d+k*(T-d);var m,$,W;switch(w){default:case 6:case 0:m=T,$=b,W=d;break;case 1:m=b,$=T,W=d;break;case 2:m=d,$=T,W=b;break;case 3:m=d,$=b,W=T;break;case 4:m=b,$=d,W=T;break;case 5:m=T,$=d,W=b;break}return[m*255,$*255,W*255]},A.cmyk.rgb=function(v){var g=v[0]/100,d=v[1]/100,_=v[2]/100,E=v[3]/100,w,T,k;return w=1-Math.min(1,g*(1-E)+E),T=1-Math.min(1,d*(1-E)+E),k=1-Math.min(1,_*(1-E)+E),[w*255,T*255,k*255]},A.xyz.rgb=function(v){var g=v[0]/100,d=v[1]/100,_=v[2]/100,E,w,T;return E=g*3.2406+d*-1.5372+_*-.4986,w=g*-.9689+d*1.8758+_*.0415,T=g*.0557+d*-.204+_*1.057,E=E>.0031308?1.055*Math.pow(E,1/2.4)-.055:E*12.92,w=w>.0031308?1.055*Math.pow(w,1/2.4)-.055:w*12.92,T=T>.0031308?1.055*Math.pow(T,1/2.4)-.055:T*12.92,E=Math.min(Math.max(0,E),1),w=Math.min(Math.max(0,w),1),T=Math.min(Math.max(0,T),1),[E*255,w*255,T*255]},A.xyz.lab=function(v){var g=v[0],d=v[1],_=v[2],E,w,T;return g/=95.047,d/=100,_/=108.883,g=g>.008856?Math.pow(g,1/3):7.787*g+16/116,d=d>.008856?Math.pow(d,1/3):7.787*d+16/116,_=_>.008856?Math.pow(_,1/3):7.787*_+16/116,E=116*d-16,w=500*(g-d),T=200*(d-_),[E,w,T]},A.lab.xyz=function(v){var g=v[0],d=v[1],_=v[2],E,w,T;w=(g+16)/116,E=d/500+w,T=w-_/200;var k=Math.pow(w,3),b=Math.pow(E,3),m=Math.pow(T,3);return w=k>.008856?k:(w-16/116)/7.787,E=b>.008856?b:(E-16/116)/7.787,T=m>.008856?m:(T-16/116)/7.787,E*=95.047,w*=100,T*=108.883,[E,w,T]},A.lab.lch=function(v){var g=v[0],d=v[1],_=v[2],E,w,T;return E=Math.atan2(_,d),w=E*360/2/Math.PI,w<0&&(w+=360),T=Math.sqrt(d*d+_*_),[g,T,w]},A.lch.lab=function(v){var g=v[0],d=v[1],_=v[2],E,w,T;return T=_/360*2*Math.PI,E=d*Math.cos(T),w=d*Math.sin(T),[g,E,w]},A.rgb.ansi16=function(v){var g=v[0],d=v[1],_=v[2],E=1 in arguments?arguments[1]:A.rgb.hsv(v)[2];if(E=Math.round(E/50),E===0)return 30;var w=30+(Math.round(_/255)<<2|Math.round(d/255)<<1|Math.round(g/255));return E===2&&(w+=60),w},A.hsv.ansi16=function(v){return A.rgb.ansi16(A.hsv.rgb(v),v[2])},A.rgb.ansi256=function(v){var g=v[0],d=v[1],_=v[2];if(g===d&&d===_)return g<8?16:g>248?231:Math.round((g-8)/247*24)+232;var E=16+36*Math.round(g/255*5)+6*Math.round(d/255*5)+Math.round(_/255*5);return E},A.ansi16.rgb=function(v){var g=v%10;if(g===0||g===7)return v>50&&(g+=3.5),g=g/10.5*255,[g,g,g];var d=(~~(v>50)+1)*.5,_=(g&1)*d*255,E=(g>>1&1)*d*255,w=(g>>2&1)*d*255;return[_,E,w]},A.ansi256.rgb=function(v){if(v>=232){var g=(v-232)*10+8;return[g,g,g]}v-=16;var d,_=Math.floor(v/36)/5*255,E=Math.floor((d=v%36)/6)/5*255,w=d%6/5*255;return[_,E,w]},A.rgb.hex=function(v){var g=((Math.round(v[0])&255)<<16)+((Math.round(v[1])&255)<<8)+(Math.round(v[2])&255),d=g.toString(16).toUpperCase();return"000000".substring(d.length)+d},A.hex.rgb=function(v){var g=v.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!g)return[0,0,0];var d=g[0];g[0].length===3&&(d=d.split("").map(function(k){return k+k}).join(""));var _=parseInt(d,16),E=_>>16&255,w=_>>8&255,T=_&255;return[E,w,T]},A.rgb.hcg=function(v){var g=v[0]/255,d=v[1]/255,_=v[2]/255,E=Math.max(Math.max(g,d),_),w=Math.min(Math.min(g,d),_),T=E-w,k,b;return T<1?k=w/(1-T):k=0,T<=0?b=0:E===g?b=(d-_)/T%6:E===d?b=2+(_-g)/T:b=4+(g-d)/T+4,b/=6,b%=1,[b*360,T*100,k*100]},A.hsl.hcg=function(v){var g=v[1]/100,d=v[2]/100,_=1,E=0;return d<.5?_=2*g*d:_=2*g*(1-d),_<1&&(E=(d-.5*_)/(1-_)),[v[0],_*100,E*100]},A.hsv.hcg=function(v){var g=v[1]/100,d=v[2]/100,_=g*d,E=0;return _<1&&(E=(d-_)/(1-_)),[v[0],_*100,E*100]},A.hcg.rgb=function(v){var g=v[0]/360,d=v[1]/100,_=v[2]/100;if(d===0)return[_*255,_*255,_*255];var E=[0,0,0],w=g%1*6,T=w%1,k=1-T,b=0;switch(Math.floor(w)){case 0:E[0]=1,E[1]=T,E[2]=0;break;case 1:E[0]=k,E[1]=1,E[2]=0;break;case 2:E[0]=0,E[1]=1,E[2]=T;break;case 3:E[0]=0,E[1]=k,E[2]=1;break;case 4:E[0]=T,E[1]=0,E[2]=1;break;default:E[0]=1,E[1]=0,E[2]=k}return b=(1-d)*_,[(d*E[0]+b)*255,(d*E[1]+b)*255,(d*E[2]+b)*255]},A.hcg.hsv=function(v){var g=v[1]/100,d=v[2]/100,_=g+d*(1-g),E=0;return _>0&&(E=g/_),[v[0],E*100,_*100]},A.hcg.hsl=function(v){var g=v[1]/100,d=v[2]/100,_=d*(1-g)+.5*g,E=0;return _>0&&_<.5?E=g/(2*_):_>=.5&&_<1&&(E=g/(2*(1-_))),[v[0],E*100,_*100]},A.hcg.hwb=function(v){var g=v[1]/100,d=v[2]/100,_=g+d*(1-g);return[v[0],(_-g)*100,(1-_)*100]},A.hwb.hcg=function(v){var g=v[1]/100,d=v[2]/100,_=1-d,E=_-g,w=0;return E<1&&(w=(_-E)/(1-E)),[v[0],E*100,w*100]},A.apple.rgb=function(v){return[v[0]/65535*255,v[1]/65535*255,v[2]/65535*255]},A.rgb.apple=function(v){return[v[0]/255*65535,v[1]/255*65535,v[2]/255*65535]},A.gray.rgb=function(v){return[v[0]/100*255,v[0]/100*255,v[0]/100*255]},A.gray.hsl=A.gray.hsv=function(v){return[0,0,v[0]]},A.gray.hwb=function(v){return[0,100,v[0]]},A.gray.cmyk=function(v){return[0,0,0,v[0]]},A.gray.lab=function(v){return[v[0],0,0]},A.gray.hex=function(v){var g=Math.round(v[0]/100*255)&255,d=(g<<16)+(g<<8)+g,_=d.toString(16).toUpperCase();return"000000".substring(_.length)+_},A.rgb.gray=function(v){var g=(v[0]+v[1]+v[2])/3;return[g/255*100]}},12085:function(or,U,z){var B=z(48168),j=z(4111),R={},A=Object.keys(B);function N(y){var x=function(v){return v==null?v:(arguments.length>1&&(v=Array.prototype.slice.call(arguments)),y(v))};return"conversion"in y&&(x.conversion=y.conversion),x}function L(y){var x=function(v){if(v==null)return v;arguments.length>1&&(v=Array.prototype.slice.call(arguments));var g=y(v);if(typeof g=="object")for(var d=g.length,_=0;_=4&&v[3]!==1&&(g=", "+v[3]),"hwb("+v[0]+", "+v[1]+"%, "+v[2]+"%"+g+")"},L.to.keyword=function(v){return A[v.slice(0,3)]};function y(v,g,d){return Math.min(Math.max(g,v),d)}function x(v){var g=Math.round(v).toString(16).toUpperCase();return g.length<2?"0"+g:g}},6767:function(or,U,z){"use strict";var B=z(19818),j=z(12085),R=[].slice,A=["keyword","gray","hex"],N={};Object.keys(j).forEach(function(w){N[R.call(j[w].labels).sort().join("")]=w});var L={};function y(w,T){if(!(this instanceof y))return new y(w,T);if(T&&T in A&&(T=null),T&&!(T in j))throw new Error("Unknown model: "+T);var k,b;if(w==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(w instanceof y)this.model=w.model,this.color=w.color.slice(),this.valpha=w.valpha;else if(typeof w=="string"){var m=B.get(w);if(m===null)throw new Error("Unable to parse color from string: "+w);this.model=m.model,b=j[this.model].channels,this.color=m.value.slice(0,b),this.valpha=typeof m.value[b]=="number"?m.value[b]:1}else if(w.length){this.model=T||"rgb",b=j[this.model].channels;var $=R.call(w,0,b);this.color=E($,b),this.valpha=typeof w[b]=="number"?w[b]:1}else if(typeof w=="number")w&=16777215,this.model="rgb",this.color=[w>>16&255,w>>8&255,w&255],this.valpha=1;else{this.valpha=1;var W=Object.keys(w);"alpha"in w&&(W.splice(W.indexOf("alpha"),1),this.valpha=typeof w.alpha=="number"?w.alpha:0);var X=W.sort().join("");if(!(X in N))throw new Error("Unable to parse color from object: "+JSON.stringify(w));this.model=N[X];var H=j[this.model].labels,Q=[];for(k=0;kk?(T+.05)/(k+.05):(k+.05)/(T+.05)},level:function(w){var T=this.contrast(w);return T>=7.1?"AAA":T>=4.5?"AA":""},isDark:function(){var w=this.rgb().color,T=(w[0]*299+w[1]*587+w[2]*114)/1e3;return T<128},isLight:function(){return!this.isDark()},negate:function(){for(var w=this.rgb(),T=0;T<3;T++)w.color[T]=255-w.color[T];return w},lighten:function(w){var T=this.hsl();return T.color[2]+=T.color[2]*w,T},darken:function(w){var T=this.hsl();return T.color[2]-=T.color[2]*w,T},saturate:function(w){var T=this.hsl();return T.color[1]+=T.color[1]*w,T},desaturate:function(w){var T=this.hsl();return T.color[1]-=T.color[1]*w,T},whiten:function(w){var T=this.hwb();return T.color[1]+=T.color[1]*w,T},blacken:function(w){var T=this.hwb();return T.color[2]+=T.color[2]*w,T},grayscale:function(){var w=this.rgb().color,T=w[0]*.3+w[1]*.59+w[2]*.11;return y.rgb(T,T,T)},fade:function(w){return this.alpha(this.valpha-this.valpha*w)},opaquer:function(w){return this.alpha(this.valpha+this.valpha*w)},rotate:function(w){var T=this.hsl(),k=T.color[0];return k=(k+w)%360,k=k<0?360+k:k,T.color[0]=k,T},mix:function(w,T){if(!w||!w.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof w);var k=w.rgb(),b=this.rgb(),m=T===void 0?.5:T,$=2*m-1,W=k.alpha()-b.alpha(),X=(($*W==-1?$:($+W)/(1+$*W))+1)/2,H=1-X;return y.rgb(X*k.red()+H*b.red(),X*k.green()+H*b.green(),X*k.blue()+H*b.blue(),k.alpha()*m+b.alpha()*(1-m))}},Object.keys(j).forEach(function(w){if(A.indexOf(w)===-1){var T=j[w].channels;y.prototype[w]=function(){if(this.model===w)return new y(this);if(arguments.length)return new y(arguments,w);var k=typeof arguments[T]=="number"?T:this.valpha;return new y(_(j[this.model][w].raw(this.color)).concat(k),w)},y[w]=function(k){return typeof k=="number"&&(k=E(R.call(arguments),T)),new y(k,w)}}});function x(w,T){return Number(w.toFixed(T))}function v(w){return function(T){return x(T,w)}}function g(w,T,k){return w=Array.isArray(w)?w:[w],w.forEach(function(b){(L[b]||(L[b]=[]))[T]=k}),w=w[0],function(b){var m;return arguments.length?(k&&(b=k(b)),m=this[w](),m.color[T]=b,m):(m=this[w]().color[T],k&&(m=k(m)),m)}}function d(w){return function(T){return Math.max(0,Math.min(w,T))}}function _(w){return Array.isArray(w)?w:[w]}function E(w,T){for(var k=0;k=(Me=(Se+be)/2))?Se=Me:be=Me,(ht=J>=(De=(Ie+pe)/2))?Ie=De:pe=De,fe=de,!(de=de[Rt=ht<<1|Ze]))return fe[Rt]=Te,Q;if(Ue=+Q._x.call(null,de.data),nt=+Q._y.call(null,de.data),q===Ue&&J===nt)return Te.next=de,fe?fe[Rt]=Te:Q._root=Te,Q;do fe=fe?fe[Rt]=new Array(4):Q._root=new Array(4),(Ze=q>=(Me=(Se+be)/2))?Se=Me:be=Me,(ht=J>=(De=(Ie+pe)/2))?Ie=De:pe=De;while((Rt=ht<<1|Ze)==(tr=(nt>=De)<<1|Ue>=Me));return fe[tr]=de,fe[Rt]=Te,Q}function R(Q){var q,J,te=Q.length,fe,de,Te=new Array(te),Se=new Array(te),Ie=Infinity,be=Infinity,pe=-Infinity,Me=-Infinity;for(J=0;Jpe&&(pe=fe),deMe&&(Me=de));if(Ie>pe||be>Me)return this;for(this.cover(Ie,be).cover(pe,Me),J=0;JQ||Q>=fe||te>q||q>=de;)switch(be=(qpe||(Se=nt.y0)>Me||(Ie=nt.x1)=Rt)<<1|Q>=ht)&&(nt=De[De.length-1],De[De.length-1]=De[De.length-1-Ze],De[De.length-1-Ze]=nt)}else{var tr=Q-+this._x.call(null,Ue.data),Qe=q-+this._y.call(null,Ue.data),lt=tr*tr+Qe*Qe;if(lt=(De=(Te+Ie)/2))?Te=De:Ie=De,(Ze=Me>=(Ue=(Se+be)/2))?Se=Ue:be=Ue,q=J,!(J=J[ht=Ze<<1|nt]))return this;if(!J.length)break;(q[ht+1&3]||q[ht+2&3]||q[ht+3&3])&&(te=q,Rt=ht)}for(;J.data!==Q;)if(fe=J,!(J=J.next))return this;return(de=J.next)&&delete J.next,fe?(de?fe.next=de:delete fe.next,this):q?(de?q[ht]=de:delete q[ht],(J=q[0]||q[1]||q[2]||q[3])&&J===(q[3]||q[2]||q[1]||q[0])&&!J.length&&(te?te[Rt]=J:this._root=J),this):(this._root=de,this)}function g(Q){for(var q=0,J=Q.length;q-1},$=function(f,M){var G=this.__data__,Y=w(G,f);return Y<0?(++this.size,G.push([f,M])):G[Y][1]=M,this};function W(f){var M=-1,G=f==null?0:f.length;for(this.clear();++M-1&&f%1==0&&f-1&&f%1==0&&f<=9007199254740991},$t={};$t["[object Float32Array]"]=$t["[object Float64Array]"]=$t["[object Int8Array]"]=$t["[object Int16Array]"]=$t["[object Int32Array]"]=$t["[object Uint8Array]"]=$t["[object Uint8ClampedArray]"]=$t["[object Uint16Array]"]=$t["[object Uint32Array]"]=!0,$t["[object Arguments]"]=$t["[object Array]"]=$t["[object ArrayBuffer]"]=$t["[object Boolean]"]=$t["[object DataView]"]=$t["[object Date]"]=$t["[object Error]"]=$t["[object Function]"]=$t["[object Map]"]=$t["[object Number]"]=$t["[object Object]"]=$t["[object RegExp]"]=$t["[object Set]"]=$t["[object String]"]=$t["[object WeakMap]"]=!1;var Ht=function(f){return ae(f)&&Pt(f.length)&&!!$t[Ze(f)]},Br=function(f){return function(M){return f(M)}},hn=d(function(f,M){var G=M&&!M.nodeType&&M,Y=G&&f&&!f.nodeType&&f,re=Y&&Y.exports===G&&te.process,ie=function(){try{var le=Y&&Y.require&&Y.require("util").types;return le||re&&re.binding&&re.binding("util")}catch(ge){}}();f.exports=ie}),Ot=hn&&hn.isTypedArray,Qt=Ot?Br(Ot):Ht,pr=Object.prototype.hasOwnProperty,en=function(f,M){var G=xe(f),Y=!G&&he(f),re=!G&&!Y&&Ne(f),ie=!G&&!Y&&!re&&Qt(f),le=G||Y||re||ie,ge=le?ne(f.length,String):[],me=ge.length;for(var Le in f)!M&&!pr.call(f,Le)||le&&(Le=="length"||re&&(Le=="offset"||Le=="parent")||ie&&(Le=="buffer"||Le=="byteLength"||Le=="byteOffset")||st(Le,me))||ge.push(Le);return ge},Nr=Object.prototype,ta=function(f){var M=f&&f.constructor;return f===(typeof M=="function"&&M.prototype||Nr)},kn=function(f,M){return function(G){return f(M(G))}},En=kn(Object.keys,Object),Rn=Object.prototype.hasOwnProperty,Yn=function(f){if(!ta(f))return En(f);var M=[];for(var G in Object(f))Rn.call(f,G)&&G!="constructor"&&M.push(G);return M},bn=function(f){return f!=null&&Pt(f.length)&&!tr(f)},je=function(f){return bn(f)?en(f):Yn(f)},Ce=function(f,M){return f&&rt(M,je(M),f)},Xe=function(f){var M=[];if(f!=null)for(var G in Object(f))M.push(G);return M},ut=Object.prototype.hasOwnProperty,ot=function(f){if(!ht(f))return Xe(f);var M=ta(f),G=[];for(var Y in f)(Y!="constructor"||!M&&ut.call(f,Y))&&G.push(Y);return G},bt=function(f){return bn(f)?en(f,!0):ot(f)},Xt=function(f,M){return f&&rt(M,bt(M),f)},wr=d(function(f,M){var G=M&&!M.nodeType&&M,Y=G&&f&&!f.nodeType&&f,re=Y&&Y.exports===G?de.Buffer:void 0,ie=re?re.allocUnsafe:void 0;f.exports=function(le,ge){if(ge)return le.slice();var me=le.length,Le=ie?ie(me):new le.constructor(me);return le.copy(Le),Le}}),Wr=function(f,M){var G=-1,Y=f.length;for(M||(M=Array(Y));++Gge))return!1;var Le=ie.get(f),ze=ie.get(M);if(Le&&ze)return Le==M&&ze==f;var Fe=-1,tt=!0,Mt=2&G?new Wi:void 0;for(ie.set(f,M),ie.set(M,f);++Fe0&&Y(me)?G>1?f(me,G-1,Y,re,ie):Ia(ie,me):re||(ie[ie.length]=me)}return ie},fi=function(f,M,G){switch(G.length){case 0:return f.call(M);case 1:return f.call(M,G[0]);case 2:return f.call(M,G[0],G[1]);case 3:return f.call(M,G[0],G[1],G[2])}return f.apply(M,G)},bi=Math.max,ha=function(f,M,G){return M=bi(M===void 0?f.length-1:M,0),function(){for(var Y=arguments,re=-1,ie=bi(Y.length-M,0),le=Array(ie);++re0){if(++M>=800)return arguments[0]}else M=0;return f.apply(void 0,arguments)}}(Oa),oo=function(f,M){return Wo(ha(f,M,Zi),f+"")},Qs=function(f,M,G,Y){for(var re=f.length,ie=G+(Y?1:-1);Y?ie--:++ie-1},yu=function(f,M,G){for(var Y=-1,re=f==null?0:f.length;++Y=200){var Le=M?null:Of(f);if(Le)return ji(Le);le=!1,re=go,me=new Wi}else me=M?[]:ge;e:for(;++Yie){var le=re;re=ie,ie=le}return re+""+ie+""+(Qr.isUndefined(Y)?"\0":Y)}function Df(f,M,G,Y){var re=""+M,ie=""+G;if(!f&&re>ie){var le=re;re=ie,ie=le}var ge={v:re,w:ie};return Y&&(ge.name=Y),ge}function bu(f,M){return ls(f,M.v,M.w,M.name)}ca.prototype._nodeCount=0,ca.prototype._edgeCount=0,ca.prototype.isDirected=function(){return this._isDirected},ca.prototype.isMultigraph=function(){return this._isMultigraph},ca.prototype.isCompound=function(){return this._isCompound},ca.prototype.setGraph=function(f){return this._label=f,this},ca.prototype.graph=function(){return this._label},ca.prototype.setDefaultNodeLabel=function(f){return Qr.isFunction(f)||(f=Qr.constant(f)),this._defaultNodeLabelFn=f,this},ca.prototype.nodeCount=function(){return this._nodeCount},ca.prototype.nodes=function(){return Qr.keys(this._nodes)},ca.prototype.sources=function(){var f=this;return Qr.filter(this.nodes(),function(M){return Qr.isEmpty(f._in[M])})},ca.prototype.sinks=function(){var f=this;return Qr.filter(this.nodes(),function(M){return Qr.isEmpty(f._out[M])})},ca.prototype.setNodes=function(f,M){var G=arguments,Y=this;return Qr.each(f,function(re){G.length>1?Y.setNode(re,M):Y.setNode(re)}),this},ca.prototype.setNode=function(f,M){return Qr.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=M),this):(this._nodes[f]=arguments.length>1?M:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]="\0",this._children[f]={},this._children["\0"][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},ca.prototype.node=function(f){return this._nodes[f]},ca.prototype.hasNode=function(f){return Qr.has(this._nodes,f)},ca.prototype.removeNode=function(f){var M=this;if(Qr.has(this._nodes,f)){var G=function(Y){M.removeEdge(M._edgeObjs[Y])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],Qr.each(this.children(f),function(Y){M.setParent(Y)}),delete this._children[f]),Qr.each(Qr.keys(this._in[f]),G),delete this._in[f],delete this._preds[f],Qr.each(Qr.keys(this._out[f]),G),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},ca.prototype.setParent=function(f,M){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Qr.isUndefined(M))M="\0";else{for(var G=M+="";!Qr.isUndefined(G);G=this.parent(G))if(G===f)throw new Error("Setting "+M+" as parent of "+f+" would create a cycle");this.setNode(M)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=M,this._children[M][f]=!0,this},ca.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},ca.prototype.parent=function(f){if(this._isCompound){var M=this._parent[f];if(M!=="\0")return M}},ca.prototype.children=function(f){if(Qr.isUndefined(f)&&(f="\0"),this._isCompound){var M=this._children[f];if(M)return Qr.keys(M)}else{if(f==="\0")return this.nodes();if(this.hasNode(f))return[]}},ca.prototype.predecessors=function(f){var M=this._preds[f];if(M)return Qr.keys(M)},ca.prototype.successors=function(f){var M=this._sucs[f];if(M)return Qr.keys(M)},ca.prototype.neighbors=function(f){var M=this.predecessors(f);if(M)return Qr.union(M,this.successors(f))},ca.prototype.isLeaf=function(f){return(this.isDirected()?this.successors(f):this.neighbors(f)).length===0},ca.prototype.filterNodes=function(f){var M=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});M.setGraph(this.graph());var G=this;Qr.each(this._nodes,function(ie,le){f(le)&&M.setNode(le,ie)}),Qr.each(this._edgeObjs,function(ie){M.hasNode(ie.v)&&M.hasNode(ie.w)&&M.setEdge(ie,G.edge(ie))});var Y={};function re(ie){var le=G.parent(ie);return le===void 0||M.hasNode(le)?(Y[ie]=le,le):le in Y?Y[le]:re(le)}return this._isCompound&&Qr.each(M.nodes(),function(ie){M.setParent(ie,re(ie))}),M},ca.prototype.setDefaultEdgeLabel=function(f){return Qr.isFunction(f)||(f=Qr.constant(f)),this._defaultEdgeLabelFn=f,this},ca.prototype.edgeCount=function(){return this._edgeCount},ca.prototype.edges=function(){return Qr.values(this._edgeObjs)},ca.prototype.setPath=function(f,M){var G=this,Y=arguments;return Qr.reduce(f,function(re,ie){return Y.length>1?G.setEdge(re,ie,M):G.setEdge(re,ie),ie}),this},ca.prototype.setEdge=function(){var f,M,G,Y,re=!1,ie=arguments[0];typeof ie=="object"&&ie!==null&&"v"in ie?(f=ie.v,M=ie.w,G=ie.name,arguments.length===2&&(Y=arguments[1],re=!0)):(f=ie,M=arguments[1],G=arguments[3],arguments.length>2&&(Y=arguments[2],re=!0)),f=""+f,M=""+M,Qr.isUndefined(G)||(G=""+G);var le=ls(this._isDirected,f,M,G);if(Qr.has(this._edgeLabels,le))return re&&(this._edgeLabels[le]=Y),this;if(!Qr.isUndefined(G)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(M),this._edgeLabels[le]=re?Y:this._defaultEdgeLabelFn(f,M,G);var ge=Df(this._isDirected,f,M,G);return f=ge.v,M=ge.w,Object.freeze(ge),this._edgeObjs[le]=ge,Lf(this._preds[M],f),Lf(this._sucs[f],M),this._in[M][le]=ge,this._out[f][le]=ge,this._edgeCount++,this},ca.prototype.edge=function(f,M,G){var Y=arguments.length===1?bu(this._isDirected,arguments[0]):ls(this._isDirected,f,M,G);return this._edgeLabels[Y]},ca.prototype.hasEdge=function(f,M,G){var Y=arguments.length===1?bu(this._isDirected,arguments[0]):ls(this._isDirected,f,M,G);return Qr.has(this._edgeLabels,Y)},ca.prototype.removeEdge=function(f,M,G){var Y=arguments.length===1?bu(this._isDirected,arguments[0]):ls(this._isDirected,f,M,G),re=this._edgeObjs[Y];return re&&(f=re.v,M=re.w,delete this._edgeLabels[Y],delete this._edgeObjs[Y],Eu(this._preds[M],f),Eu(this._sucs[f],M),delete this._in[M][Y],delete this._out[f][Y],this._edgeCount--),this},ca.prototype.inEdges=function(f,M){var G=this._in[f];if(G){var Y=Qr.values(G);return M?Qr.filter(Y,function(re){return re.v===M}):Y}},ca.prototype.outEdges=function(f,M){var G=this._out[f];if(G){var Y=Qr.values(G);return M?Qr.filter(Y,function(re){return re.w===M}):Y}},ca.prototype.nodeEdges=function(f,M){var G=this.inEdges(f,M);if(G)return G.concat(this.outEdges(f,M))};var qu={Graph:Os,version:"2.1.8"},ef={write:function(f){var M={options:{directed:f.isDirected(),multigraph:f.isMultigraph(),compound:f.isCompound()},nodes:Nf(f),edges:Lo(f)};return Qr.isUndefined(f.graph())||(M.value=Qr.clone(f.graph())),M},read:function(f){var M=new Os(f.options).setGraph(f.value);return Qr.each(f.nodes,function(G){M.setNode(G.v,G.value),G.parent&&M.setParent(G.v,G.parent)}),Qr.each(f.edges,function(G){M.setEdge({v:G.v,w:G.w,name:G.name},G.value)}),M}};function Nf(f){return Qr.map(f.nodes(),function(M){var G=f.node(M),Y=f.parent(M),re={v:M};return Qr.isUndefined(G)||(re.value=G),Qr.isUndefined(Y)||(re.parent=Y),re})}function Lo(f){return Qr.map(f.edges(),function(M){var G=f.edge(M),Y={v:M.v,w:M.w};return Qr.isUndefined(M.name)||(Y.name=M.name),Qr.isUndefined(G)||(Y.value=G),Y})}var Pf=function(f){var M,G={},Y=[];function re(ie){Qr.has(G,ie)||(G[ie]=!0,M.push(ie),Qr.each(f.successors(ie),re),Qr.each(f.predecessors(ie),re))}return Qr.each(f.nodes(),function(ie){M=[],re(ie),M.length&&Y.push(M)}),Y},kf=xi;function xi(){this._arr=[],this._keyIndices={}}xi.prototype.size=function(){return this._arr.length},xi.prototype.keys=function(){return this._arr.map(function(f){return f.key})},xi.prototype.has=function(f){return Qr.has(this._keyIndices,f)},xi.prototype.priority=function(f){var M=this._keyIndices[f];if(M!==void 0)return this._arr[M].priority},xi.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},xi.prototype.add=function(f,M){var G=this._keyIndices;if(f=String(f),!Qr.has(G,f)){var Y=this._arr,re=Y.length;return G[f]=re,Y.push({key:f,priority:M}),this._decrease(re),!0}return!1},xi.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var f=this._arr.pop();return delete this._keyIndices[f.key],this._heapify(0),f.key},xi.prototype.decrease=function(f,M){var G=this._keyIndices[f];if(M>this._arr[G].priority)throw new Error("New priority is greater than current priority. Key: "+f+" Old: "+this._arr[G].priority+" New: "+M);this._arr[G].priority=M,this._decrease(G)},xi.prototype._heapify=function(f){var M=this._arr,G=2*f,Y=G+1,re=f;G>1].priority0&&(me=Fe.removeMin(),(Le=ze[me]).distance!==Number.POSITIVE_INFINITY);)ge(me).forEach(tt);return ze}(f,String(M),G||As,Y||function(re){return f.outEdges(re)})},As=Qr.constant(1),rf=function(f,M,G){return Qr.transform(f.nodes(),function(Y,re){Y[re]=tf(f,re,M,G)},{})},nf=function(f){var M=0,G=[],Y={},re=[];function ie(le){var ge=Y[le]={onStack:!0,lowlink:M,index:M++};if(G.push(le),f.successors(le).forEach(function(ze){Qr.has(Y,ze)?Y[ze].onStack&&(ge.lowlink=Math.min(ge.lowlink,Y[ze].index)):(ie(ze),ge.lowlink=Math.min(ge.lowlink,Y[ze].lowlink))}),ge.lowlink===ge.index){var me,Le=[];do me=G.pop(),Y[me].onStack=!1,Le.push(me);while(le!==me);re.push(Le)}}return f.nodes().forEach(function(le){Qr.has(Y,le)||ie(le)}),re},dc=function(f){return Qr.filter(nf(f),function(M){return M.length>1||M.length===1&&f.hasEdge(M[0],M[0])})},hc=function(f,M,G){return function(Y,re,ie){var le={},ge=Y.nodes();return ge.forEach(function(me){le[me]={},le[me][me]={distance:0},ge.forEach(function(Le){me!==Le&&(le[me][Le]={distance:Number.POSITIVE_INFINITY})}),ie(me).forEach(function(Le){var ze=Le.v===me?Le.w:Le.v,Fe=re(Le);le[me][ze]={distance:Fe,predecessor:me}})}),ge.forEach(function(me){var Le=le[me];ge.forEach(function(ze){var Fe=le[ze];ge.forEach(function(tt){var Mt=Fe[me],sr=Le[tt],Tt=Fe[tt],Nt=Mt.distance+sr.distance;Nt0;){if(G=ie.removeMin(),Qr.has(re,G))Y.setEdge(G,re[G]);else{if(ge)throw new Error("Input graph is not connected: "+f);ge=!0}f.nodeEdges(G).forEach(le)}return Y},tarjan:nf,topsort:af},version:qu.version};try{ds=tl}catch(f){}ds||(ds=window.graphlib);var Do=ds,Bf=function(f){return vo(f,5)},hs=function(f,M,G){if(!ht(G))return!1;var Y=typeof M;return!!(Y=="number"?bn(G)&&st(M,G.length):Y=="string"&&M in G)&&E(G[M],f)},Ls=Object.prototype,yc=Ls.hasOwnProperty,wu=oo(function(f,M){f=Object(f);var G=-1,Y=M.length,re=Y>2?M[2]:void 0;for(re&&hs(M[0],M[1],re)&&(Y=1);++G-1?re[ie?M[le]:le]:void 0}},mc=/^\s+|\s+$/g,rl=/^[-+]0x[0-9a-f]+$/i,of=/^0b[01]+$/i,Ff=/^0o[0-7]+$/i,Gf=parseInt,Ec=function(f){if(typeof f=="number")return f;if(Eo(f))return NaN;if(ht(f)){var M=typeof f.valueOf=="function"?f.valueOf():f;f=ht(M)?M+"":M}if(typeof f!="string")return f===0?f:+f;f=f.replace(mc,"");var G=of.test(f);return G||Ff.test(f)?Gf(f.slice(2),G?2:8):rl.test(f)?NaN:+f},sf=function(f){return f?(f=Ec(f))===Infinity||f===-Infinity?17976931348623157e292*(f<0?-1:1):f==f?f:0:f===0?f:0},uf=function(f){var M=sf(f),G=M%1;return M==M?G?M-G:M:0},nl=Math.max,al=Ds(function(f,M,G){var Y=f==null?0:f.length;if(!Y)return-1;var re=G==null?0:uf(G);return re<0&&(re=nl(Y+re,0)),Qs(f,$i(M),re)}),bc=function(f){return(f==null?0:f.length)?Ha(f,1):[]},Js=function(f,M){return f==null?f:Ao(f,_i(M),bt)},il=function(f){var M=f==null?0:f.length;return M?f[M-1]:void 0},xc=function(f,M){var G={};return M=$i(M),as(f,function(Y,re,ie){va(G,re,M(Y,re,ie))}),G},Su=function(f,M,G){for(var Y=-1,re=f.length;++YM},ol=function(f){return f&&f.length?Su(f,Zi,jo):void 0},_u=function(f,M,G){(G!==void 0&&!E(f[M],G)||G===void 0&&!(M in f))&&va(f,M,G)},sl=Function.prototype,ul=Object.prototype,ki=sl.toString,fl=ul.hasOwnProperty,wc=ki.call(Object),Mu=function(f){if(!ae(f)||Ze(f)!="[object Object]")return!1;var M=Ba(f);if(M===null)return!0;var G=fl.call(M,"constructor")&&M.constructor;return typeof G=="function"&&G instanceof G&&ki.call(G)==wc},ff=function(f,M){if((M!=="constructor"||typeof f[M]!="function")&&M!="__proto__")return f[M]},To=function(f){return rt(f,bt(f))},Sc=function(f,M,G,Y,re,ie,le){var ge=ff(f,G),me=ff(M,G),Le=le.get(me);if(Le)_u(f,G,Le);else{var ze=ie?ie(ge,me,G+"",f,M,le):void 0,Fe=ze===void 0;if(Fe){var tt=xe(me),Mt=!tt&&Ne(me),sr=!tt&&!Mt&&Qt(me);ze=me,tt||Mt||sr?xe(ge)?ze=ge:Af(ge)?ze=Wr(ge):Mt?(Fe=!1,ze=wr(me,!0)):sr?(Fe=!1,ze=Li(me,!0)):ze=[]:Mu(me)||he(me)?(ze=ge,he(ge)?ze=To(ge):ht(ge)&&!tr(ge)||(ze=Di(me))):Fe=!1}Fe&&(le.set(me,ze),re(ze,me,Y,ie,le),le.delete(me)),_u(f,G,ze)}},qs=function f(M,G,Y,re,ie){M!==G&&Ao(G,function(le,ge){if(ie||(ie=new Pn),ht(le))Sc(M,G,ge,Y,f,re,ie);else{var me=re?re(ff(M,ge),le,ge+"",M,G,ie):void 0;me===void 0&&(me=le),_u(M,ge,me)}},bt)},Ns=function(f){return oo(function(M,G){var Y=-1,re=G.length,ie=re>1?G[re-1]:void 0,le=re>2?G[2]:void 0;for(ie=f.length>3&&typeof ie=="function"?(re--,ie):void 0,le&&hs(G[0],G[1],le)&&(ie=re<3?void 0:ie,re=1),M=Object(M);++YM||ie&&le&&me&&!ge&&!Le||Y&&le&&me||!G&&me||!re)return 1;if(!Y&&!ie&&!Le&&f=ge?me:me*(G[Y]=="desc"?-1:1)}return f.index-M.index},jf=function(f,M,G){M=M.length?io(M,function(ie){return xe(ie)?function(le){return fs(le,ie.length===1?ie[0]:ie)}:ie}):[Zi];var Y=-1;M=io(M,Br($i));var re=ue(f,function(ie,le,ge){return{criteria:io(M,function(me){return me(ie)}),index:++Y,value:ie}});return Tc(re,function(ie,le){return Wf(ie,le,G)})},cf=oo(function(f,M){if(f==null)return[];var G=M.length;return G>1&&hs(f,M[0],M[1])?M=[]:G>2&&hs(M[0],M[1],M[2])&&(M=[M[0]]),jf(f,Ha(M,1),[])}),Xf=0,Vf=function(f){var M=++Xf;return $s(f)+M},Iu=function(f,M,G){for(var Y=-1,re=f.length,ie=M.length,le={};++Y0;--Fe)if(ge=ie[Fe].dequeue()){me=me.concat(lf(re,ie,le,ge,!0));break}}}return me}(G.graph,G.buckets,G.zeroIdx);return gt.flatten(gt.map(Y,function(re){return f.outEdges(re.v,re.w)}),!0)},hl=gt.constant(1);function lf(f,M,G,Y,re){var ie=re?[]:void 0;return gt.forEach(f.inEdges(Y.v),function(le){var ge=f.edge(le),me=f.node(le.v);re&&ie.push({v:le.v,w:le.w}),me.out-=ge,Hf(M,G,me)}),gt.forEach(f.outEdges(Y.v),function(le){var ge=f.edge(le),me=le.w,Le=f.node(me);Le.in-=ge,Hf(M,G,Le)}),f.removeNode(Y.v),ie}function Hf(f,M,G){G.out?G.in?f[G.out-G.in+M].enqueue(G):f[f.length-1].enqueue(G):f[0].enqueue(G)}var Oc={run:function(f){var M=f.graph().acyclicer==="greedy"?dl(f,function(G){return function(Y){return G.edge(Y).weight}}(f)):function(G){var Y=[],re={},ie={};function le(ge){gt.has(ie,ge)||(ie[ge]=!0,re[ge]=!0,gt.forEach(G.outEdges(ge),function(me){gt.has(re,me.w)?Y.push(me):le(me.w)}),delete re[ge])}return gt.forEach(G.nodes(),le),Y}(f);gt.forEach(M,function(G){var Y=f.edge(G);f.removeEdge(G),Y.forwardName=G.name,Y.reversed=!0,f.setEdge(G.w,G.v,Y,gt.uniqueId("rev"))})},undo:function(f){gt.forEach(f.edges(),function(M){var G=f.edge(M);if(G.reversed){f.removeEdge(M);var Y=G.forwardName;delete G.reversed,delete G.forwardName,f.setEdge(M.w,M.v,G,Y)}})}},Zf=Do.Graph,Mi={addDummyNode:Au,simplify:function(f){var M=new Zf().setGraph(f.graph());return gt.forEach(f.nodes(),function(G){M.setNode(G,f.node(G))}),gt.forEach(f.edges(),function(G){var Y=M.edge(G.v,G.w)||{weight:0,minlen:1},re=f.edge(G);M.setEdge(G.v,G.w,{weight:Y.weight+re.weight,minlen:Math.max(Y.minlen,re.minlen)})}),M},asNonCompoundGraph:function(f){var M=new Zf({multigraph:f.isMultigraph()}).setGraph(f.graph());return gt.forEach(f.nodes(),function(G){f.children(G).length||M.setNode(G,f.node(G))}),gt.forEach(f.edges(),function(G){M.setEdge(G,f.edge(G))}),M},successorWeights:function(f){var M=gt.map(f.nodes(),function(G){var Y={};return gt.forEach(f.outEdges(G),function(re){Y[re.w]=(Y[re.w]||0)+f.edge(re).weight}),Y});return gt.zipObject(f.nodes(),M)},predecessorWeights:function(f){var M=gt.map(f.nodes(),function(G){var Y={};return gt.forEach(f.inEdges(G),function(re){Y[re.v]=(Y[re.v]||0)+f.edge(re).weight}),Y});return gt.zipObject(f.nodes(),M)},intersectRect:function(f,M){var G,Y,re=f.x,ie=f.y,le=M.x-re,ge=M.y-ie,me=f.width/2,Le=f.height/2;if(!le&&!ge)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(ge)*me>Math.abs(le)*Le?(ge<0&&(Le=-Le),G=Le*le/ge,Y=Le):(le<0&&(me=-me),G=me,Y=me*ge/le),{x:re+G,y:ie+Y}},buildLayerMatrix:function(f){var M=gt.map(gt.range(gi(f)+1),function(){return[]});return gt.forEach(f.nodes(),function(G){var Y=f.node(G),re=Y.rank;gt.isUndefined(re)||(M[re][Y.order]=G)}),M},normalizeRanks:function(f){var M=gt.min(gt.map(f.nodes(),function(G){return f.node(G).rank}));gt.forEach(f.nodes(),function(G){var Y=f.node(G);gt.has(Y,"rank")&&(Y.rank-=M)})},removeEmptyRanks:function(f){var M=gt.min(gt.map(f.nodes(),function(ie){return f.node(ie).rank})),G=[];gt.forEach(f.nodes(),function(ie){var le=f.node(ie).rank-M;G[le]||(G[le]=[]),G[le].push(ie)});var Y=0,re=f.graph().nodeRankFactor;gt.forEach(G,function(ie,le){gt.isUndefined(ie)&&le%re!=0?--Y:Y&>.forEach(ie,function(ge){f.node(ge).rank+=Y})})},addBorderNode:function(f,M,G,Y){var re={width:0,height:0};return arguments.length>=4&&(re.rank=G,re.order=Y),Au(f,"border",re,M)},maxRank:gi,partition:function(f,M){var G={lhs:[],rhs:[]};return gt.forEach(f,function(Y){M(Y)?G.lhs.push(Y):G.rhs.push(Y)}),G},time:function(f,M){var G=gt.now();try{return M()}finally{console.log(f+" time: "+(gt.now()-G)+"ms")}},notime:function(f,M){return M()}};function Au(f,M,G,Y){var re;do re=gt.uniqueId(Y);while(f.hasNode(re));return G.dummy=M,f.setNode(re,G),re}function gi(f){return gt.max(gt.map(f.nodes(),function(M){var G=f.node(M).rank;if(!gt.isUndefined(G))return G}))}var Lu={run:function(f){f.graph().dummyChains=[],gt.forEach(f.edges(),function(M){(function(G,Y){var re,ie,le,ge=Y.v,me=G.node(ge).rank,Le=Y.w,ze=G.node(Le).rank,Fe=Y.name,tt=G.edge(Y),Mt=tt.labelRank;if(ze!==me+1){for(G.removeEdge(Y),le=0,++me;mele.lim&&(ge=le,me=!0);var Le=gt.filter(M.edges(),function(ze){return me===Lc(f,f.node(ze.v),ge)&&me!==Lc(f,f.node(ze.w),ge)});return gt.minBy(Le,function(ze){return Fs(M,ze)})}function Gs(f,M,G,Y){var re=G.v,ie=G.w;f.removeEdge(re,ie),f.setEdge(Y.v,Y.w,{}),hf(f),nu(f,M),function(le,ge){var me=gt.find(le.nodes(),function(ze){return!ge.node(ze).parent}),Le=Du(le,me);Le=Le.slice(1),gt.forEach(Le,function(ze){var Fe=le.node(ze).parent,tt=ge.edge(ze,Fe),Mt=!1;tt||(tt=ge.edge(Fe,ze),Mt=!0),ge.node(ze).rank=ge.node(Fe).rank+(Mt?tt.minlen:-tt.minlen)})}(f,M)}function Lc(f,M,G){return G.low<=M.lim&&M.lim<=G.lim}Io.initLowLimValues=hf,Io.initCutValues=nu,Io.calcCutValue=Qf,Io.leaveEdge=qf,Io.enterEdge=Ac,Io.exchangeEdges=Gs;var Dc=Xo,Nc=function(f){switch(f.graph().ranker){case"network-simplex":Vo(f);break;case"tight-tree":(function(M){Dc(M),ru(M)})(f);break;case"longest-path":Pc(f);break;default:Vo(f)}},Pc=Dc;function Vo(f){ea(f)}var vl=function(f){var M=function(G){var Y={},re=0;function ie(le){var ge=re;gt.forEach(G.children(le),ie),Y[le]={low:ge,lim:re++}}return gt.forEach(G.children(),ie),Y}(f);gt.forEach(f.graph().dummyChains,function(G){for(var Y=f.node(G),re=Y.edgeObj,ie=function(Fe,tt,Mt,sr){var Tt,Nt,Lt=[],_r=[],Yr=Math.min(tt[Mt].low,tt[sr].low),Pr=Math.max(tt[Mt].lim,tt[sr].lim);Tt=Mt;do Tt=Fe.parent(Tt),Lt.push(Tt);while(Tt&&(tt[Tt].low>Yr||Pr>tt[Tt].lim));for(Nt=Tt,Tt=sr;(Tt=Fe.parent(Tt))!==Nt;)_r.push(Tt);return{path:Lt.concat(_r.reverse()),lca:Nt}}(f,M,re.v,re.w),le=ie.path,ge=ie.lca,me=0,Le=le[me],ze=!0;G!==re.w;){if(Y=f.node(G),ze){for(;(Le=le[me])!==ge&&f.node(Le).maxRank0;)ze%2&&(Fe+=ge[ze+1]),ge[ze=ze-1>>1]+=Le.weight;me+=Le.weight*Fe})),me}var ec=function(f,M){return gt.map(M,function(G){var Y=f.inEdges(G);if(Y.length){var re=gt.reduce(Y,function(ie,le){var ge=f.edge(le),me=f.node(le.v);return{sum:ie.sum+ge.weight*me.order,weight:ie.weight+ge.weight}},{sum:0,weight:0});return{v:G,barycenter:re.sum/re.weight,weight:re.weight}}return{v:G}})},gf=function(f,M){var G={};return gt.forEach(f,function(Y,re){var ie=G[Y.v]={indegree:0,in:[],out:[],vs:[Y.v],i:re};gt.isUndefined(Y.barycenter)||(ie.barycenter=Y.barycenter,ie.weight=Y.weight)}),gt.forEach(M.edges(),function(Y){var re=G[Y.v],ie=G[Y.w];gt.isUndefined(re)||gt.isUndefined(ie)||(ie.indegree++,re.out.push(G[Y.w]))}),function(Y){var re=[];function ie(me){return function(Le){Le.merged||(gt.isUndefined(Le.barycenter)||gt.isUndefined(me.barycenter)||Le.barycenter>=me.barycenter)&&function(ze,Fe){var tt=0,Mt=0;ze.weight&&(tt+=ze.barycenter*ze.weight,Mt+=ze.weight),Fe.weight&&(tt+=Fe.barycenter*Fe.weight,Mt+=Fe.weight),ze.vs=Fe.vs.concat(ze.vs),ze.barycenter=tt/Mt,ze.weight=Mt,ze.i=Math.min(Fe.i,ze.i),Fe.merged=!0}(me,Le)}}function le(me){return function(Le){Le.in.push(me),--Le.indegree==0&&Y.push(Le)}}for(;Y.length;){var ge=Y.pop();re.push(ge),gt.forEach(ge.in.reverse(),ie(ge)),gt.forEach(ge.out,le(ge))}return gt.map(gt.filter(re,function(me){return!me.merged}),function(me){return gt.pick(me,["vs","i","barycenter","weight"])})}(gt.filter(G,function(Y){return!Y.indegree}))},pf=function(f,M){var G=Mi.partition(f,function(Fe){return gt.has(Fe,"barycenter")}),Y=G.lhs,re=gt.sortBy(G.rhs,function(Fe){return-Fe.i}),ie=[],le=0,ge=0,me=0;Y.sort((Le=!!M,function(Fe,tt){return Fe.barycentertt.barycenter?1:Le?tt.i-Fe.i:Fe.i-tt.i})),me=Ws(ie,re,me),gt.forEach(Y,function(Fe){me+=Fe.vs.length,ie.push(Fe.vs),le+=Fe.barycenter*Fe.weight,ge+=Fe.weight,me=Ws(ie,re,me)});var Le,ze={vs:gt.flatten(ie,!0)};return ge&&(ze.barycenter=le/ge,ze.weight=ge),ze};function Ws(f,M,G){for(var Y;M.length&&(Y=gt.last(M)).i<=G;)M.pop(),f.push(Y.vs),G++;return G}var tc=function f(M,G,Y,re){var ie=M.children(G),le=M.node(G),ge=le?le.borderLeft:void 0,me=le?le.borderRight:void 0,Le={};ge&&(ie=gt.filter(ie,function(Tt){return Tt!==ge&&Tt!==me}));var ze=ec(M,ie);gt.forEach(ze,function(Tt){if(M.children(Tt.v).length){var Nt=f(M,Tt.v,Y,re);Le[Tt.v]=Nt,gt.has(Nt,"barycenter")&&(Lt=Tt,_r=Nt,gt.isUndefined(Lt.barycenter)?(Lt.barycenter=_r.barycenter,Lt.weight=_r.weight):(Lt.barycenter=(Lt.barycenter*Lt.weight+_r.barycenter*_r.weight)/(Lt.weight+_r.weight),Lt.weight+=_r.weight))}var Lt,_r});var Fe=gf(ze,Y);(function(Tt,Nt){gt.forEach(Tt,function(Lt){Lt.vs=gt.flatten(Lt.vs.map(function(_r){return Nt[_r]?Nt[_r].vs:_r}),!0)})})(Fe,Le);var tt=pf(Fe,re);if(ge&&(tt.vs=gt.flatten([ge,tt.vs,me],!0),M.predecessors(ge).length)){var Mt=M.node(M.predecessors(ge)[0]),sr=M.node(M.predecessors(me)[0]);gt.has(tt,"barycenter")||(tt.barycenter=0,tt.weight=0),tt.barycenter=(tt.barycenter*tt.weight+Mt.order+sr.order)/(tt.weight+2),tt.weight+=2}return tt},yf=Do.Graph,mf=function(f,M,G){var Y=function(ie){for(var le;ie.hasNode(le=gt.uniqueId("_root")););return le}(f),re=new yf({compound:!0}).setGraph({root:Y}).setDefaultNodeLabel(function(ie){return f.node(ie)});return gt.forEach(f.nodes(),function(ie){var le=f.node(ie),ge=f.parent(ie);(le.rank===M||le.minRank<=M&&M<=le.maxRank)&&(re.setNode(ie),re.setParent(ie,ge||Y),gt.forEach(f[G](ie),function(me){var Le=me.v===ie?me.w:me.v,ze=re.edge(Le,ie),Fe=gt.isUndefined(ze)?0:ze.weight;re.setEdge(Le,ie,{weight:f.edge(me).weight+Fe})}),gt.has(le,"minRank")&&re.setNode(ie,{borderLeft:le.borderLeft[M],borderRight:le.borderRight[M]}))}),re},ku=function(f,M,G){var Y,re={};gt.forEach(G,function(ie){for(var le,ge,me=f.parent(ie);me;){if((le=f.parent(me))?(ge=re[le],re[le]=me):(ge=Y,Y=me),ge&&ge!==me)return void M.setEdge(ge,me);me=le}})},iu=Do.Graph,Aa=function(f){var M=Mi.maxRank(f),G=ou(f,gt.range(1,M+1),"inEdges"),Y=ou(f,gt.range(M-1,-1,-1),"outEdges"),re=Pu(f);js(f,re);for(var ie,le=Number.POSITIVE_INFINITY,ge=0,me=0;me<4;++ge,++me){Ru(ge%2?G:Y,ge%4>=2),re=Mi.buildLayerMatrix(f);var Le=Us(f,re);Leme)&&su(G,Fe,Le)})})}return gt.reduce(M,function(re,ie){var le,ge=-1,me=0;return gt.forEach(ie,function(Le,ze){if(f.node(Le).dummy==="border"){var Fe=f.predecessors(Le);Fe.length&&(le=f.node(Fe[0]).order,Y(ie,me,ze,ge,le),me=ze,ge=le)}Y(ie,me,ie.length,le,re.length)}),ie}),G}function su(f,M,G){if(M>G){var Y=M;M=G,G=Y}var re=f[M];re||(f[M]=re={}),re[G]=!0}function pl(f,M,G){if(M>G){var Y=M;M=G,G=Y}return gt.has(f[M],G)}function yl(f,M,G,Y){var re={},ie={},le={};return gt.forEach(M,function(ge){gt.forEach(ge,function(me,Le){re[me]=me,ie[me]=me,le[me]=Le})}),gt.forEach(M,function(ge){var me=-1;gt.forEach(ge,function(Le){var ze=Y(Le);if(ze.length)for(var Fe=((ze=gt.sortBy(ze,function(Tt){return le[Tt]})).length-1)/2,tt=Math.floor(Fe),Mt=Math.ceil(Fe);tt<=Mt;++tt){var sr=ze[tt];ie[Le]===Le&&menew nc(G)).forEach(G=>{M.nodes[G.name]=G,G.inputs.forEach(Y=>{(function(re,ie,le){le.name!==ie.name&&re.edges.push(Object.assign(Object.assign({},le.attr),{v:le.name,w:ie.name}))})(M,G,Y)})}),M}class _l{constructor(M,G={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=y.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=L.META,this.path=[],this.name=M,this.metaGraph=xf(M,x.META,G)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map(M=>this.metaGraph.node(M))}leaves(){let M,G=[],Y=[this];for(;Y.length;){let re=Y.shift();re.isGroupNode?(M=re.metaGraph,M.nodes().forEach(ie=>Y.push(M.node(ie)))):G.push(re.name)}return G}}class ac{constructor(M,G){this.v=M,this.w=G,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(M,G){this.baseEdgeList.push(M)}}function zu(f,M={}){return new _l(f,M)}function bf(f,M){return new ac(f,M)}function xf(f,M,G){const Y=G||{},re=new Yo.Graph(Y);return re.setGraph({name:f,rankdir:Y.rankdir,type:M,align:Y.align}),re}class Zc{constructor(M={}){this.graphOptions=M,this.index={},this.graphOptions.compound=!0,this.root=zu(A,this.graphOptions),this.index[A]=this.root}getNodeMap(){return this.index}node(M){return this.index[M]}setNode(M,G){this.index[M]=G}getBridgeGraph(M){const G=this.index[M];if(!G)throw Error("Could not find node in hierarchy: "+M);if(!("metaGraph"in G))return null;const Y=G;if(Y.bridgeGraph)return Y.bridgeGraph;const re=xf(N,x.BRIDGE,this.graphOptions);if(Y.bridgeGraph=re,!G.parentNode||!("metaGraph"in G.parentNode))return re;const ie=G.parentNode;return[ie.metaGraph,this.getBridgeGraph(ie.name)].forEach(le=>{le.edges().filter(ge=>ge.v===M||ge.w===M).forEach(ge=>{const me=ge.w===M;le.edge(ge).baseEdgeList.forEach(Le=>{const[ze,Fe]=me?[Le.w,ge.v]:[Le.v,ge.w],tt=this.getChildName(M,ze),Mt={v:me?Fe:tt,w:me?tt:Fe};let sr=re.edge(Mt);sr||(sr=bf(Mt.v,Mt.w),sr.inbound=me,re.setEdge(Mt.v,Mt.w,sr)),sr.addBaseEdge(Le,this)})})}),re}getChildName(M,G){let Y=this.index[G];for(;Y;){if(Y.parentNode&&Y.parentNode.name===M)return Y.name;Y=Y.parentNode}throw Error("Could not find immediate child for descendant: "+G)}getPredecessors(M){const G=this.index[M];if(!G)throw Error("Could not find node with name: "+M);return this.getOneWayEdges(G,!0)}getSuccessors(M){const G=this.index[M];if(!G)throw Error("Could not find node with name: "+M);return this.getOneWayEdges(G,!1)}getOneWayEdges(M,G){const Y=[];if(!M.parentNode||!M.parentNode.isGroupNode)return Y;const re=M.parentNode,ie=re.metaGraph,le=this.getBridgeGraph(re.name);return ic(ie,M,G,Y),ic(le,M,G,Y),Y}}function Ml(f,M){const{rankDirection:G,align:Y}=M,re=new Zc({rankdir:G,align:Y});return function(ie,le){Object.keys(le.nodes).forEach(ge=>{const me=le.nodes[ge],Le=me.path;let ze=ie.root;ze.depth=Math.max(Le.length,ze.depth);for(let Fe=0;Fe{let Mt=0;for(;Fe;)tt[Mt++]=Fe.name,Fe=Fe.parentNode;return Mt-1};le.edges.forEach(Fe=>{me=[],Le=[];let tt=ze(le.nodes[Fe.v],me),Mt=ze(le.nodes[Fe.w],Le);for(;me[tt]===Le[Mt];)if(tt--,Mt--,tt<0||Mt<0)throw Error("No difference found between ancestor paths.");const sr=ge[me[tt+1]],Tt=me[tt],Nt=Le[Mt];let Lt=sr.metaGraph.edge(Tt,Nt);Lt||(Lt=bf(Tt,Nt),sr.metaGraph.setEdge(Tt,Nt,Lt)),Lt.addBaseEdge(Fe,ie)})}(re,f),re}function ic(f,M,G,Y){(G?f.inEdges(M.name):f.outEdges(M.name)).forEach(re=>{const ie=f.edge(re);Y.push(ie)})}class Kc{constructor(M){this.hierarchy=M,this.index={},this.hasSubHierarchy={},this.root=new We(this.hierarchy.root,this.hierarchy.graphOptions),this.index[M.root.name]=this.root,this.buildSubHierarchy(M.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(M){if(M in this.hasSubHierarchy)return;this.hasSubHierarchy[M]=!0;const G=this.index[M];if(G.node.type!==L.META)return;const Y=G,re=Y.node.metaGraph,ie=Y.coreGraph;re.nodes().forEach(ze=>{const Fe=this.getOrCreateRenderNodeByName(ze);ie.setNode(ze,Fe)}),re.edges().forEach(ze=>{const Fe=re.edge(ze),tt=new ve(Fe);ie.setEdge(ze.v,ze.w,tt)});const le=Y.node.parentNode;if(!le)return;const ge=this.getRenderNodeByName(le.name),me=(ze,...Fe)=>Fe.concat([ze?"IN":"OUT"]).join("~~"),Le=this.hierarchy.getBridgeGraph(M);Le.edges().forEach(ze=>{const Fe=Le.edge(ze),tt=!!re.node(ze.w),[Mt,sr]=tt?[ze.w,ze.v]:[ze.v,ze.w],Tt=dn=>{const sn=tt?{v:dn,w:M}:{v:M,w:dn};return ge.coreGraph.edge(sn)};let Nt=Tt(sr);Nt||(Nt=Tt(me(tt,sr,le.name)));const Lt=me(tt,M),_r=me(tt,sr,M);let Yr=ie.node(_r);if(!Yr){let dn=ie.node(Lt);if(!dn){const tn={name:Lt,type:L.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:y.UNSPECIFIED,inbound:tt,attr:{}};dn=new wf(tn),this.index[Lt]=dn,ie.setNode(Lt,dn)}const sn={name:_r,type:L.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:y.UNSPECIFIED,inbound:tt,attr:{}};Yr=new wf(sn),this.index[_r]=Yr,ie.setNode(_r,Yr),ie.setParent(_r,Lt),dn.node.cardinality++}const Pr=new ve(Fe);Pr.adjoiningMetaEdge=Nt,tt?ie.setEdge(_r,Mt,Pr):ie.setEdge(Mt,_r,Pr)})}getOrCreateRenderNodeByName(M){if(!M)return null;if(M in this.index)return this.index[M];const G=this.getNodeByName(M);return G?(this.index[M]=G.isGroupNode?new We(G,this.hierarchy.graphOptions):new wf(G),this.index[M]):null}getRenderNodeByName(M){return this.index[M]}getNodeByName(M){return this.hierarchy.node(M)}}class wf{constructor(M){this.node=M,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=M.width||0,this.height=M.height||0,this.displayName=M.name,this.attr=M.attr}}class ve{constructor(M){this.metaEdge=M,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class We extends wf{constructor(M,G){super(M);const Y=M.metaGraph.graph();G.compound=!0,this.coreGraph=xf(Y.name,x.CORE,G)}}function it(f,M){f.node.isGroupNode&&function(G,Y){const re=j(Y);G.coreGraph.nodes().map(ie=>G.coreGraph.node(ie)).forEach(ie=>{var le,ge,me,Le,ze,Fe;const{height:tt,width:Mt}=ie;switch(ie.node.type){case L.NODE:Object.assign(ie,re.nodeSize.node),ie.height=tt||re.nodeSize.node.height,ie.width=Mt||re.nodeSize.node.width;break;case L.BRIDGE:Object.assign(ie,re.nodeSize.bridge);break;case L.META:ie.expanded?it(ie,Y):(Object.assign(ie,re.nodeSize.meta),ie.height=re.nodeSize.meta.height,ie.width=re.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+ie.node.type)}if(!ie.expanded){const sr=ie.attr;(function(Tt,Nt=!1){if(Tt.coreBox.width=Tt.width,Tt.coreBox.height=Tt.height,!Nt){const Lt=`${Tt.displayName}`.length,_r=3;Tt.width=Math.max(Tt.coreBox.width,Lt*_r)}})(ie,Y&&(ie.node.type===0&&!!((ge=(le=Y==null?void 0:Y.nodeSize)===null||le===void 0?void 0:le.meta)===null||ge===void 0?void 0:ge.width)||ie.node.type===1&&(!!((Le=(me=Y==null?void 0:Y.nodeSize)===null||me===void 0?void 0:me.node)===null||Le===void 0?void 0:Le.width)||!!sr.width)||ie.node.type===2&&!!((Fe=(ze=Y==null?void 0:Y.nodeSize)===null||ze===void 0?void 0:ze.bridge)===null||Fe===void 0?void 0:Fe.width)))}})}(f,M),f.node.type===L.META&&function(G,Y){const re=j(Y),ie=re.subScene.meta;Object.assign(G,ie);const{nodeSep:le,rankSep:ge,edgeSep:me,align:Le}=re.graph.meta,ze={nodesep:le,ranksep:ge,edgesep:me,align:Le};Object.assign(G.coreBox,function(Mt,sr){const{ranksep:Tt,nodesep:Nt,edgesep:Lt,align:_r}=sr;Object.assign(Mt.graph(),{ranksep:Tt,nodesep:Nt,edgesep:Lt,align:_r});const Yr=[];if(Mt.nodes().forEach(Bn=>{Mt.node(Bn).node.type!==L.BRIDGE&&Yr.push(Bn)}),!Yr.length)return{width:0,height:0};xl(Mt);let Pr=1/0,dn=1/0,sn=-1/0,tn=-1/0;return Yr.forEach(Bn=>{const Fn=Mt.node(Bn),za=.5*Fn.width,Wn=Fn.x-za,ti=Fn.x+za;Pr=Wnsn?ti:sn;const La=.5*Fn.height,oa=Fn.y-La,Za=Fn.y+La;dn=oatn?Za:tn}),Mt.edges().forEach(Bn=>{const Fn=Mt.edge(Bn),za=Mt.node(Fn.metaEdge.v),Wn=Mt.node(Fn.metaEdge.w);if(Fn.points.length===3&&function(oa){let Za=Zt(oa[0],oa[1]);for(let ri=1;ri1)return!1;Za=li}return!0}(Fn.points)){if(za!=null){const oa=za.expanded?za.x:dr(za);Fn.points[0].x=oa}if(Wn!=null){const oa=Wn.expanded?Wn.x:dr(Wn);Fn.points[2].x=oa}Fn.points=[Fn.points[0],Fn.points[1]]}const ti=Fn.points[Fn.points.length-2];Wn!=null&&(Fn.points[Fn.points.length-1]=Yt(ti,Wn));const La=Fn.points[1];za!=null&&(Fn.points[0]=Yt(La,za)),Fn.points.forEach(oa=>{Pr=oa.xsn?oa.x:sn,dn=oa.ytn?oa.y:tn})}),Mt.nodes().forEach(Bn=>{const Fn=Mt.node(Bn);Fn.x-=Pr,Fn.y-=dn}),Mt.edges().forEach(Bn=>{Mt.edge(Bn).points.forEach(Fn=>{Fn.x-=Pr,Fn.y-=dn})}),{width:sn-Pr,height:tn-dn}}(G.coreGraph,ze));let Fe=0;G.coreGraph.nodeCount()>0&&Fe++;const tt=Fe<=1?0:Fe;G.coreBox.width+=tt+tt,G.coreBox.height=ie.labelHeight+G.coreBox.height,G.width=G.coreBox.width+ie.paddingLeft+ie.paddingRight,G.height=G.paddingTop+G.coreBox.height+G.paddingBottom}(f,M)}function Zt(f,M){const G=M.x-f.x,Y=M.y-f.y;return 180*Math.atan(Y/G)/Math.PI}function dr(f){return f.expanded?f.x:f.x-f.width/2+0+f.coreBox.width/2}function Yt(f,M){const G=M.expanded?M.x:dr(M),Y=M.y,re=f.x-G,ie=f.y-Y;let le,ge,me=M.expanded?M.width:M.coreBox.width,Le=M.expanded?M.height:M.coreBox.height;return Math.abs(ie)*me/2>Math.abs(re)*Le/2?(ie<0&&(Le=-Le),le=ie===0?0:Le/2*re/ie,ge=Le/2):(re<0&&(me=-me),le=me/2,ge=re===0?0:me/2*ie/re),{x:G+le,y:Y+ge}}function ar(f,M,G){var Y,re,ie,le;const ge=f.nodes.filter((Fe,tt,Mt)=>Mt.findIndex(sr=>sr.id===Fe.id)!==tt).map(Fe=>Fe.id);if(ge.length)throw new Error(`Duplicated ids found: ${ge.join(", ")}`);const me=function(Fe){const tt={nodes:[]},Mt=Fe.compound,sr=Object.keys(Mt||{}),Tt=new Map,Nt=(_r,Yr=[])=>{if(Tt.has(_r))return Tt.get(_r);for(let Pr=0;PrFe.edges.filter(Yr=>Yr.w===_r).map(Yr=>({name:Yr.v}));return Fe.nodes.forEach(_r=>{const Yr=_r.id,Pr=[...Nt(Yr),Yr];let dn=Lt(Yr);tt.nodes.push({name:Yr,path:Pr,inputs:dn,width:_r.width,height:_r.height,attr:Object.assign({},_r)})}),tt}(f),Le=function(Fe,tt){const Mt=(Tt,Nt)=>{for(let Lt of Nt.values())if(Lt.includes(Tt))return!0;return!1},sr=(Tt,Nt=[])=>{if(Object.keys(Tt).length===0)return[...new Set(Nt)];const Lt=new Map(Object.keys(Tt).map(Yr=>[Yr,Tt[Yr]])),_r={};for(let[Yr,Pr]of Lt)Mt(Yr,Lt)?_r[Yr]=Pr:Nt=Nt.concat(Yr,Pr);return sr(_r,Nt)};return sr(Fe).filter(Tt=>tt.includes(Tt))}(f.compound||{},(M==null?void 0:M.expanded)||[]),ze=function(Fe,tt){return function(Mt){return new Kc(Mt)}(Ml(Sl(Fe),tt))}(me,{rankDirection:((re=(Y=G==null?void 0:G.graph)===null||Y===void 0?void 0:Y.meta)===null||re===void 0?void 0:re.rankDir)||(M==null?void 0:M.rankDirection)||B.graph.meta.rankDir,align:((le=(ie=G==null?void 0:G.graph)===null||ie===void 0?void 0:ie.meta)===null||le===void 0?void 0:le.align)||B.graph.meta.align});return function(Fe,tt){tt.forEach(Mt=>{const sr=Fe.getRenderInfoNodes().find(Lt=>Lt.displayName===Mt);let Tt=sr&&sr.node&&sr.node.name||"";const Nt=Fe.getRenderNodeByName(Tt);if(!Nt)throw new Error(`No nodes found: ${Tt}`);Nt.expanded=!0,Fe.buildSubHierarchy(Tt)})}(ze,Le),it(ze.root,G),Ar(ze.root)}function Mr(f,M=!1){const G=JSON.parse(JSON.stringify(f)),Y={nodes:[G],edges:[...G.edges]};return G.nodes.forEach(function re(ie){(ie.type===0||ie.type===1)&&Y.nodes.push(ie),ie.type===0&&(Y.edges=Y.edges.concat(ie.edges)),Array.isArray(ie.nodes)&&ie.nodes.forEach(re)}),M&&Y.nodes.forEach(re=>{const ie=Y.nodes.find(le=>le.id===re.parentNodeName);if(ie){const le=ie.x-ie.width/2+ie.paddingLeft,ge=ie.y-ie.height/2+ie.labelHeight+ie.paddingTop;ie.id!==A&&(re.x+=le,re.y+=ge),re.type===0&&re.edges.forEach(me=>{me.points.forEach(Le=>{Le.x+=re.x-re.width/2+re.paddingLeft,Le.y+=re.y-re.height/2+re.labelHeight+re.paddingTop})})}}),Y}function Ir(f,M,G,Y){var re,ie;let le=[];const ge=((re=G.find(Fe=>Fe.id===f))===null||re===void 0?void 0:re.path)||[],me=((ie=G.find(Fe=>Fe.id===M))===null||ie===void 0?void 0:ie.path)||[],Le=[A,...ge].slice(0,ge.length).reverse(),ze=[A,...me].slice(0,me.length);return Le.forEach(Fe=>{const tt=G.find(Mt=>Mt.id===Fe);le=le.concat(tt.edges.filter(Mt=>Mt.baseEdgeList.some(sr=>sr.v===((Y==null?void 0:Y.v)||f)&&sr.w===((Y==null?void 0:Y.w)||M))))}),ze.filter(Fe=>!Le.includes(Fe)).forEach(Fe=>{const tt=G.find(Mt=>Mt.id===Fe);le=le.concat(tt.edges.filter(Mt=>Mt.baseEdgeList.some(sr=>sr.v===((Y==null?void 0:Y.v)||f)&&sr.w===((Y==null?void 0:Y.w)||M))))}),le}function Ar(f){const M=f.coreGraph.nodes().map(Y=>f.coreGraph.node(Y));return Object.assign(Object.assign({},Tr(f)),{expanded:f.expanded,nodes:f.expanded?(G=M,G.map(Y=>Y.node.type===L.META?Ar(Y):Tr(Y))):[],edges:f.expanded?zr(f):[]});var G}function Tr(f){return{id:f.node.name,name:f.node.name,type:f.node.type,cardinality:f.node.cardinality,attr:f.attr,parentNodeName:f.node.parentNode?f.node.parentNode.name:null,coreBox:Object.assign({},f.coreBox),x:f.x,y:f.y,width:f.width,height:f.height,radius:f.radius,labelHeight:f.labelHeight,labelOffset:f.labelOffset,outboxWidth:f.outboxWidth,paddingLeft:f.paddingLeft,paddingTop:f.paddingTop,paddingRight:f.paddingRight,paddingBottom:f.paddingBottom,path:f.node.path}}function zr(f){return f.coreGraph.edges().map(M=>({renderInfoEdge:f.coreGraph.edge(M),edge:M})).filter(({renderInfoEdge:M})=>M.metaEdge).map(({edge:M,renderInfoEdge:G})=>{const Y=function(re,ie){const le=ie.points.map(ge=>Object.assign({},ge));if(ie.adjoiningMetaEdge){const ge=ie.adjoiningMetaEdge.points,me=ie.metaEdge.inbound,Le=me?ge[ge.length-1]:ge[0],ze=le[me?0:le.length-1],Fe=re.x-re.width/2,tt=re.y-re.height/2,Mt=Le.x-Fe,sr=Le.y-tt,Tt=-re.paddingLeft,Nt=-(re.paddingTop+re.labelHeight);ze.x=Mt+Tt,ze.y=sr+Nt}return le}(f,G);return{adjoiningEdge:G.adjoiningMetaEdge?{w:G.adjoiningMetaEdge.metaEdge.w,v:G.adjoiningMetaEdge.metaEdge.v}:null,inbound:G.metaEdge.inbound,w:M.w,v:M.v,points:Y,weight:G.weight,baseEdgeList:G.metaEdge.baseEdgeList,parentNodeName:f.node.name}})}},64530:function(or,U,z){"use strict";z.r(U),z.d(U,{glMatrix:function(){return y},mat2:function(){return B},mat2d:function(){return j},mat3:function(){return qr},mat4:function(){return R},quat:function(){return N},quat2:function(){return L},vec2:function(){return Cf},vec3:function(){return Yn},vec4:function(){return A}});var B={};z.r(B),z.d(B,{LDU:function(){return J},add:function(){return te},adjoint:function(){return k},clone:function(){return v},copy:function(){return g},create:function(){return x},determinant:function(){return b},equals:function(){return Te},exactEquals:function(){return de},frob:function(){return q},fromRotation:function(){return X},fromScaling:function(){return H},fromValues:function(){return _},identity:function(){return d},invert:function(){return T},mul:function(){return be},multiply:function(){return m},multiplyScalar:function(){return Se},multiplyScalarAndAdd:function(){return Ie},rotate:function(){return $},scale:function(){return W},set:function(){return E},str:function(){return Q},sub:function(){return pe},subtract:function(){return fe},transpose:function(){return w}});var j={};z.r(j),z.d(j,{add:function(){return ft},clone:function(){return De},copy:function(){return Ue},create:function(){return Me},determinant:function(){return tr},equals:function(){return Ae},exactEquals:function(){return Ur},frob:function(){return Vt},fromRotation:function(){return _t},fromScaling:function(){return pt},fromTranslation:function(){return rr},fromValues:function(){return Ze},identity:function(){return nt},invert:function(){return Rt},mul:function(){return Hr},multiply:function(){return Qe},multiplyScalar:function(){return qt},multiplyScalarAndAdd:function(){return br},rotate:function(){return lt},scale:function(){return St},set:function(){return ht},str:function(){return xr},sub:function(){return Sr},subtract:function(){return Bt},translate:function(){return Ct}});var R={};z.r(R),z.d(R,{add:function(){return Qt},adjoint:function(){return Wt},clone:function(){return vn},copy:function(){return Gn},create:function(){return Gr},determinant:function(){return Er},equals:function(){return kn},exactEquals:function(){return ta},frob:function(){return Ot},fromQuat:function(){return V},fromQuat2:function(){return rt},fromRotation:function(){return An},fromRotationTranslation:function(){return Dt},fromRotationTranslationScale:function(){return S},fromRotationTranslationScaleOrigin:function(){return C},fromScaling:function(){return Pn},fromTranslation:function(){return Zr},fromValues:function(){return mn},fromXRotation:function(){return ln},fromYRotation:function(){return va},fromZRotation:function(){return K},frustum:function(){return he},getRotation:function(){return P},getScaling:function(){return ae},getTranslation:function(){return ne},identity:function(){return gn},invert:function(){return ct},lookAt:function(){return Ht},mul:function(){return En},multiply:function(){return Dr},multiplyScalar:function(){return en},multiplyScalarAndAdd:function(){return Nr},ortho:function(){return Pt},orthoNO:function(){return st},orthoZO:function(){return $t},perspective:function(){return Ee},perspectiveFromFieldOfView:function(){return Et},perspectiveNO:function(){return xe},perspectiveZO:function(){return Ne},rotate:function(){return wn},rotateX:function(){return Sn},rotateY:function(){return In},rotateZ:function(){return $n},scale:function(){return pn},set:function(){return $r},str:function(){return hn},sub:function(){return Rn},subtract:function(){return pr},targetTo:function(){return Br},translate:function(){return Vr},transpose:function(){return Rr}});var A={};z.r(A),z.d(A,{add:function(){return ot},ceil:function(){return Wr},clone:function(){return je},copy:function(){return Xe},create:function(){return bn},cross:function(){return co},dist:function(){return Oo},distance:function(){return Ia},div:function(){return _s},divide:function(){return wr},dot:function(){return to},equals:function(){return Yi},exactEquals:function(){return _o},floor:function(){return on},forEach:function(){return Go},fromValues:function(){return Ce},inverse:function(){return _a},len:function(){return _n},length:function(){return Ea},lerp:function(){return ni},max:function(){return zn},min:function(){return xn},mul:function(){return Bo},multiply:function(){return Xt},negate:function(){return si},normalize:function(){return So},random:function(){return lo},round:function(){return Qn},scale:function(){return ia},scaleAndAdd:function(){return Wa},set:function(){return ut},sqrDist:function(){return Hi},sqrLen:function(){return Fo},squaredDistance:function(){return Ba},squaredLength:function(){return qa},str:function(){return ya},sub:function(){return Fi},subtract:function(){return bt},transformMat4:function(){return Ss},transformQuat:function(){return Ro},zero:function(){return mi}});var N={};z.r(N),z.d(N,{add:function(){return Ui},calculateW:function(){return Ni},clone:function(){return vi},conjugate:function(){return Vs},copy:function(){return _i},create:function(){return Va},dot:function(){return Ya},equals:function(){return ka},exactEquals:function(){return ji},exp:function(){return ro},fromEuler:function(){return Ao},fromMat3:function(){return Pi},fromValues:function(){return Zi},getAngle:function(){return Mo},getAxisAngle:function(){return Li},identity:function(){return Ms},invert:function(){return vo},len:function(){return ao},length:function(){return Wi},lerp:function(){return Ii},ln:function(){return Qo},mul:function(){return da},multiply:function(){return ho},normalize:function(){return yo},pow:function(){return ns},random:function(){return ga},rotateX:function(){return Gi},rotateY:function(){return Di},rotateZ:function(){return $o},rotationTo:function(){return Ys},scale:function(){return Fa},set:function(){return no},setAxes:function(){return mo},setAxisAngle:function(){return Ko},slerp:function(){return zi},sqlerp:function(){return _f},sqrLen:function(){return po},squaredLength:function(){return go},str:function(){return as}});var L={};z.r(L),z.d(L,{add:function(){return Uo},clone:function(){return na},conjugate:function(){return Ku},copy:function(){return ai},create:function(){return lu},dot:function(){return vu},equals:function(){return Ts},exactEquals:function(){return Mf},fromMat4:function(){return ui},fromRotation:function(){return is},fromRotationTranslation:function(){return Xi},fromRotationTranslationValues:function(){return Hs},fromTranslation:function(){return zo},fromValues:function(){return an},getDual:function(){return du},getReal:function(){return Hu},getTranslation:function(){return Ki},identity:function(){return Eo},invert:function(){return pu},len:function(){return Cs},length:function(){return Co},lerp:function(){return gu},mul:function(){return fs},multiply:function(){return bo},normalize:function(){return xo},rotateAroundAxis:function(){return $s},rotateByQuatAppend:function(){return ss},rotateByQuatPrepend:function(){return us},rotateX:function(){return Ks},rotateY:function(){return io},rotateZ:function(){return os},scale:function(){return Zu},set:function(){return Yu},setDual:function(){return Ei},setReal:function(){return hu},sqrLen:function(){return $i},squaredLength:function(){return cs},str:function(){return $u},translate:function(){return Zs}});var y=z(49685);function x(){var u=new y.ARRAY_TYPE(4);return y.ARRAY_TYPE!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}function v(u){var O=new y.ARRAY_TYPE(4);return O[0]=u[0],O[1]=u[1],O[2]=u[2],O[3]=u[3],O}function g(u,O){return u[0]=O[0],u[1]=O[1],u[2]=O[2],u[3]=O[3],u}function d(u){return u[0]=1,u[1]=0,u[2]=0,u[3]=1,u}function _(u,O,ue,ye){var _e=new y.ARRAY_TYPE(4);return _e[0]=u,_e[1]=O,_e[2]=ue,_e[3]=ye,_e}function E(u,O,ue,ye,_e){return u[0]=O,u[1]=ue,u[2]=ye,u[3]=_e,u}function w(u,O){if(u===O){var ue=O[1];u[1]=O[2],u[2]=ue}else u[0]=O[0],u[1]=O[2],u[2]=O[1],u[3]=O[3];return u}function T(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[3],Be=ue*ke-_e*ye;return Be?(Be=1/Be,u[0]=ke*Be,u[1]=-ye*Be,u[2]=-_e*Be,u[3]=ue*Be,u):null}function k(u,O){var ue=O[0];return u[0]=O[3],u[1]=-O[1],u[2]=-O[2],u[3]=ue,u}function b(u){return u[0]*u[3]-u[2]*u[1]}function m(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=ue[0],Je=ue[1],dt=ue[2],It=ue[3];return u[0]=ye*Ye+ke*Je,u[1]=_e*Ye+Be*Je,u[2]=ye*dt+ke*It,u[3]=_e*dt+Be*It,u}function $(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=Math.sin(ue),Je=Math.cos(ue);return u[0]=ye*Je+ke*Ye,u[1]=_e*Je+Be*Ye,u[2]=ye*-Ye+ke*Je,u[3]=_e*-Ye+Be*Je,u}function W(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=ue[0],Je=ue[1];return u[0]=ye*Ye,u[1]=_e*Ye,u[2]=ke*Je,u[3]=Be*Je,u}function X(u,O){var ue=Math.sin(O),ye=Math.cos(O);return u[0]=ye,u[1]=ue,u[2]=-ue,u[3]=ye,u}function H(u,O){return u[0]=O[0],u[1]=0,u[2]=0,u[3]=O[1],u}function Q(u){return"mat2("+u[0]+", "+u[1]+", "+u[2]+", "+u[3]+")"}function q(u){return Math.hypot(u[0],u[1],u[2],u[3])}function J(u,O,ue,ye){return u[2]=ye[2]/ye[0],ue[0]=ye[0],ue[1]=ye[1],ue[3]=ye[3]-u[2]*ue[1],[u,O,ue]}function te(u,O,ue){return u[0]=O[0]+ue[0],u[1]=O[1]+ue[1],u[2]=O[2]+ue[2],u[3]=O[3]+ue[3],u}function fe(u,O,ue){return u[0]=O[0]-ue[0],u[1]=O[1]-ue[1],u[2]=O[2]-ue[2],u[3]=O[3]-ue[3],u}function de(u,O){return u[0]===O[0]&&u[1]===O[1]&&u[2]===O[2]&&u[3]===O[3]}function Te(u,O){var ue=u[0],ye=u[1],_e=u[2],ke=u[3],Be=O[0],Ye=O[1],Je=O[2],dt=O[3];return Math.abs(ue-Be)<=y.EPSILON*Math.max(1,Math.abs(ue),Math.abs(Be))&&Math.abs(ye-Ye)<=y.EPSILON*Math.max(1,Math.abs(ye),Math.abs(Ye))&&Math.abs(_e-Je)<=y.EPSILON*Math.max(1,Math.abs(_e),Math.abs(Je))&&Math.abs(ke-dt)<=y.EPSILON*Math.max(1,Math.abs(ke),Math.abs(dt))}function Se(u,O,ue){return u[0]=O[0]*ue,u[1]=O[1]*ue,u[2]=O[2]*ue,u[3]=O[3]*ue,u}function Ie(u,O,ue,ye){return u[0]=O[0]+ue[0]*ye,u[1]=O[1]+ue[1]*ye,u[2]=O[2]+ue[2]*ye,u[3]=O[3]+ue[3]*ye,u}var be=m,pe=fe;function Me(){var u=new y.ARRAY_TYPE(6);return y.ARRAY_TYPE!=Float32Array&&(u[1]=0,u[2]=0,u[4]=0,u[5]=0),u[0]=1,u[3]=1,u}function De(u){var O=new y.ARRAY_TYPE(6);return O[0]=u[0],O[1]=u[1],O[2]=u[2],O[3]=u[3],O[4]=u[4],O[5]=u[5],O}function Ue(u,O){return u[0]=O[0],u[1]=O[1],u[2]=O[2],u[3]=O[3],u[4]=O[4],u[5]=O[5],u}function nt(u){return u[0]=1,u[1]=0,u[2]=0,u[3]=1,u[4]=0,u[5]=0,u}function Ze(u,O,ue,ye,_e,ke){var Be=new y.ARRAY_TYPE(6);return Be[0]=u,Be[1]=O,Be[2]=ue,Be[3]=ye,Be[4]=_e,Be[5]=ke,Be}function ht(u,O,ue,ye,_e,ke,Be){return u[0]=O,u[1]=ue,u[2]=ye,u[3]=_e,u[4]=ke,u[5]=Be,u}function Rt(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[3],Be=O[4],Ye=O[5],Je=ue*ke-ye*_e;return Je?(Je=1/Je,u[0]=ke*Je,u[1]=-ye*Je,u[2]=-_e*Je,u[3]=ue*Je,u[4]=(_e*Ye-ke*Be)*Je,u[5]=(ye*Be-ue*Ye)*Je,u):null}function tr(u){return u[0]*u[3]-u[1]*u[2]}function Qe(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=O[4],Je=O[5],dt=ue[0],It=ue[1],ir=ue[2],cr=ue[3],nr=ue[4],Or=ue[5];return u[0]=ye*dt+ke*It,u[1]=_e*dt+Be*It,u[2]=ye*ir+ke*cr,u[3]=_e*ir+Be*cr,u[4]=ye*nr+ke*Or+Ye,u[5]=_e*nr+Be*Or+Je,u}function lt(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=O[4],Je=O[5],dt=Math.sin(ue),It=Math.cos(ue);return u[0]=ye*It+ke*dt,u[1]=_e*It+Be*dt,u[2]=ye*-dt+ke*It,u[3]=_e*-dt+Be*It,u[4]=Ye,u[5]=Je,u}function St(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=O[4],Je=O[5],dt=ue[0],It=ue[1];return u[0]=ye*dt,u[1]=_e*dt,u[2]=ke*It,u[3]=Be*It,u[4]=Ye,u[5]=Je,u}function Ct(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=O[4],Je=O[5],dt=ue[0],It=ue[1];return u[0]=ye,u[1]=_e,u[2]=ke,u[3]=Be,u[4]=ye*dt+ke*It+Ye,u[5]=_e*dt+Be*It+Je,u}function _t(u,O){var ue=Math.sin(O),ye=Math.cos(O);return u[0]=ye,u[1]=ue,u[2]=-ue,u[3]=ye,u[4]=0,u[5]=0,u}function pt(u,O){return u[0]=O[0],u[1]=0,u[2]=0,u[3]=O[1],u[4]=0,u[5]=0,u}function rr(u,O){return u[0]=1,u[1]=0,u[2]=0,u[3]=1,u[4]=O[0],u[5]=O[1],u}function xr(u){return"mat2d("+u[0]+", "+u[1]+", "+u[2]+", "+u[3]+", "+u[4]+", "+u[5]+")"}function Vt(u){return Math.hypot(u[0],u[1],u[2],u[3],u[4],u[5],1)}function ft(u,O,ue){return u[0]=O[0]+ue[0],u[1]=O[1]+ue[1],u[2]=O[2]+ue[2],u[3]=O[3]+ue[3],u[4]=O[4]+ue[4],u[5]=O[5]+ue[5],u}function Bt(u,O,ue){return u[0]=O[0]-ue[0],u[1]=O[1]-ue[1],u[2]=O[2]-ue[2],u[3]=O[3]-ue[3],u[4]=O[4]-ue[4],u[5]=O[5]-ue[5],u}function qt(u,O,ue){return u[0]=O[0]*ue,u[1]=O[1]*ue,u[2]=O[2]*ue,u[3]=O[3]*ue,u[4]=O[4]*ue,u[5]=O[5]*ue,u}function br(u,O,ue,ye){return u[0]=O[0]+ue[0]*ye,u[1]=O[1]+ue[1]*ye,u[2]=O[2]+ue[2]*ye,u[3]=O[3]+ue[3]*ye,u[4]=O[4]+ue[4]*ye,u[5]=O[5]+ue[5]*ye,u}function Ur(u,O){return u[0]===O[0]&&u[1]===O[1]&&u[2]===O[2]&&u[3]===O[3]&&u[4]===O[4]&&u[5]===O[5]}function Ae(u,O){var ue=u[0],ye=u[1],_e=u[2],ke=u[3],Be=u[4],Ye=u[5],Je=O[0],dt=O[1],It=O[2],ir=O[3],cr=O[4],nr=O[5];return Math.abs(ue-Je)<=y.EPSILON*Math.max(1,Math.abs(ue),Math.abs(Je))&&Math.abs(ye-dt)<=y.EPSILON*Math.max(1,Math.abs(ye),Math.abs(dt))&&Math.abs(_e-It)<=y.EPSILON*Math.max(1,Math.abs(_e),Math.abs(It))&&Math.abs(ke-ir)<=y.EPSILON*Math.max(1,Math.abs(ke),Math.abs(ir))&&Math.abs(Be-cr)<=y.EPSILON*Math.max(1,Math.abs(Be),Math.abs(cr))&&Math.abs(Ye-nr)<=y.EPSILON*Math.max(1,Math.abs(Ye),Math.abs(nr))}var Hr=Qe,Sr=Bt,qr=z(35600);function Gr(){var u=new y.ARRAY_TYPE(16);return y.ARRAY_TYPE!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=0,u[12]=0,u[13]=0,u[14]=0),u[0]=1,u[5]=1,u[10]=1,u[15]=1,u}function vn(u){var O=new y.ARRAY_TYPE(16);return O[0]=u[0],O[1]=u[1],O[2]=u[2],O[3]=u[3],O[4]=u[4],O[5]=u[5],O[6]=u[6],O[7]=u[7],O[8]=u[8],O[9]=u[9],O[10]=u[10],O[11]=u[11],O[12]=u[12],O[13]=u[13],O[14]=u[14],O[15]=u[15],O}function Gn(u,O){return u[0]=O[0],u[1]=O[1],u[2]=O[2],u[3]=O[3],u[4]=O[4],u[5]=O[5],u[6]=O[6],u[7]=O[7],u[8]=O[8],u[9]=O[9],u[10]=O[10],u[11]=O[11],u[12]=O[12],u[13]=O[13],u[14]=O[14],u[15]=O[15],u}function mn(u,O,ue,ye,_e,ke,Be,Ye,Je,dt,It,ir,cr,nr,Or,Cr){var hr=new y.ARRAY_TYPE(16);return hr[0]=u,hr[1]=O,hr[2]=ue,hr[3]=ye,hr[4]=_e,hr[5]=ke,hr[6]=Be,hr[7]=Ye,hr[8]=Je,hr[9]=dt,hr[10]=It,hr[11]=ir,hr[12]=cr,hr[13]=nr,hr[14]=Or,hr[15]=Cr,hr}function $r(u,O,ue,ye,_e,ke,Be,Ye,Je,dt,It,ir,cr,nr,Or,Cr,hr){return u[0]=O,u[1]=ue,u[2]=ye,u[3]=_e,u[4]=ke,u[5]=Be,u[6]=Ye,u[7]=Je,u[8]=dt,u[9]=It,u[10]=ir,u[11]=cr,u[12]=nr,u[13]=Or,u[14]=Cr,u[15]=hr,u}function gn(u){return u[0]=1,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=1,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=1,u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u}function Rr(u,O){if(u===O){var ue=O[1],ye=O[2],_e=O[3],ke=O[6],Be=O[7],Ye=O[11];u[1]=O[4],u[2]=O[8],u[3]=O[12],u[4]=ue,u[6]=O[9],u[7]=O[13],u[8]=ye,u[9]=ke,u[11]=O[14],u[12]=_e,u[13]=Be,u[14]=Ye}else u[0]=O[0],u[1]=O[4],u[2]=O[8],u[3]=O[12],u[4]=O[1],u[5]=O[5],u[6]=O[9],u[7]=O[13],u[8]=O[2],u[9]=O[6],u[10]=O[10],u[11]=O[14],u[12]=O[3],u[13]=O[7],u[14]=O[11],u[15]=O[15];return u}function ct(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[3],Be=O[4],Ye=O[5],Je=O[6],dt=O[7],It=O[8],ir=O[9],cr=O[10],nr=O[11],Or=O[12],Cr=O[13],hr=O[14],rn=O[15],Jn=ue*Ye-ye*Be,qn=ue*Je-_e*Be,Un=ue*dt-ke*Be,Mn=ye*Je-_e*Ye,Cn=ye*dt-ke*Ye,Ga=_e*dt-ke*Je,ei=It*Cr-ir*Or,Ka=It*hr-cr*Or,$a=It*rn-nr*Or,Ha=ir*hr-cr*Cr,fi=ir*rn-nr*Cr,bi=cr*rn-nr*hr,ha=Jn*bi-qn*fi+Un*Ha+Mn*$a-Cn*Ka+Ga*ei;return ha?(ha=1/ha,u[0]=(Ye*bi-Je*fi+dt*Ha)*ha,u[1]=(_e*fi-ye*bi-ke*Ha)*ha,u[2]=(Cr*Ga-hr*Cn+rn*Mn)*ha,u[3]=(cr*Cn-ir*Ga-nr*Mn)*ha,u[4]=(Je*$a-Be*bi-dt*Ka)*ha,u[5]=(ue*bi-_e*$a+ke*Ka)*ha,u[6]=(hr*Un-Or*Ga-rn*qn)*ha,u[7]=(It*Ga-cr*Un+nr*qn)*ha,u[8]=(Be*fi-Ye*$a+dt*ei)*ha,u[9]=(ye*$a-ue*fi-ke*ei)*ha,u[10]=(Or*Cn-Cr*Un+rn*Jn)*ha,u[11]=(ir*Un-It*Cn-nr*Jn)*ha,u[12]=(Ye*Ka-Be*Ha-Je*ei)*ha,u[13]=(ue*Ha-ye*Ka+_e*ei)*ha,u[14]=(Cr*qn-Or*Mn-hr*Jn)*ha,u[15]=(It*Mn-ir*qn+cr*Jn)*ha,u):null}function Wt(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[3],Be=O[4],Ye=O[5],Je=O[6],dt=O[7],It=O[8],ir=O[9],cr=O[10],nr=O[11],Or=O[12],Cr=O[13],hr=O[14],rn=O[15];return u[0]=Ye*(cr*rn-nr*hr)-ir*(Je*rn-dt*hr)+Cr*(Je*nr-dt*cr),u[1]=-(ye*(cr*rn-nr*hr)-ir*(_e*rn-ke*hr)+Cr*(_e*nr-ke*cr)),u[2]=ye*(Je*rn-dt*hr)-Ye*(_e*rn-ke*hr)+Cr*(_e*dt-ke*Je),u[3]=-(ye*(Je*nr-dt*cr)-Ye*(_e*nr-ke*cr)+ir*(_e*dt-ke*Je)),u[4]=-(Be*(cr*rn-nr*hr)-It*(Je*rn-dt*hr)+Or*(Je*nr-dt*cr)),u[5]=ue*(cr*rn-nr*hr)-It*(_e*rn-ke*hr)+Or*(_e*nr-ke*cr),u[6]=-(ue*(Je*rn-dt*hr)-Be*(_e*rn-ke*hr)+Or*(_e*dt-ke*Je)),u[7]=ue*(Je*nr-dt*cr)-Be*(_e*nr-ke*cr)+It*(_e*dt-ke*Je),u[8]=Be*(ir*rn-nr*Cr)-It*(Ye*rn-dt*Cr)+Or*(Ye*nr-dt*ir),u[9]=-(ue*(ir*rn-nr*Cr)-It*(ye*rn-ke*Cr)+Or*(ye*nr-ke*ir)),u[10]=ue*(Ye*rn-dt*Cr)-Be*(ye*rn-ke*Cr)+Or*(ye*dt-ke*Ye),u[11]=-(ue*(Ye*nr-dt*ir)-Be*(ye*nr-ke*ir)+It*(ye*dt-ke*Ye)),u[12]=-(Be*(ir*hr-cr*Cr)-It*(Ye*hr-Je*Cr)+Or*(Ye*cr-Je*ir)),u[13]=ue*(ir*hr-cr*Cr)-It*(ye*hr-_e*Cr)+Or*(ye*cr-_e*ir),u[14]=-(ue*(Ye*hr-Je*Cr)-Be*(ye*hr-_e*Cr)+Or*(ye*Je-_e*Ye)),u[15]=ue*(Ye*cr-Je*ir)-Be*(ye*cr-_e*ir)+It*(ye*Je-_e*Ye),u}function Er(u){var O=u[0],ue=u[1],ye=u[2],_e=u[3],ke=u[4],Be=u[5],Ye=u[6],Je=u[7],dt=u[8],It=u[9],ir=u[10],cr=u[11],nr=u[12],Or=u[13],Cr=u[14],hr=u[15],rn=O*Be-ue*ke,Jn=O*Ye-ye*ke,qn=O*Je-_e*ke,Un=ue*Ye-ye*Be,Mn=ue*Je-_e*Be,Cn=ye*Je-_e*Ye,Ga=dt*Or-It*nr,ei=dt*Cr-ir*nr,Ka=dt*hr-cr*nr,$a=It*Cr-ir*Or,Ha=It*hr-cr*Or,fi=ir*hr-cr*Cr;return rn*fi-Jn*Ha+qn*$a+Un*Ka-Mn*ei+Cn*Ga}function Dr(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=O[4],Je=O[5],dt=O[6],It=O[7],ir=O[8],cr=O[9],nr=O[10],Or=O[11],Cr=O[12],hr=O[13],rn=O[14],Jn=O[15],qn=ue[0],Un=ue[1],Mn=ue[2],Cn=ue[3];return u[0]=qn*ye+Un*Ye+Mn*ir+Cn*Cr,u[1]=qn*_e+Un*Je+Mn*cr+Cn*hr,u[2]=qn*ke+Un*dt+Mn*nr+Cn*rn,u[3]=qn*Be+Un*It+Mn*Or+Cn*Jn,qn=ue[4],Un=ue[5],Mn=ue[6],Cn=ue[7],u[4]=qn*ye+Un*Ye+Mn*ir+Cn*Cr,u[5]=qn*_e+Un*Je+Mn*cr+Cn*hr,u[6]=qn*ke+Un*dt+Mn*nr+Cn*rn,u[7]=qn*Be+Un*It+Mn*Or+Cn*Jn,qn=ue[8],Un=ue[9],Mn=ue[10],Cn=ue[11],u[8]=qn*ye+Un*Ye+Mn*ir+Cn*Cr,u[9]=qn*_e+Un*Je+Mn*cr+Cn*hr,u[10]=qn*ke+Un*dt+Mn*nr+Cn*rn,u[11]=qn*Be+Un*It+Mn*Or+Cn*Jn,qn=ue[12],Un=ue[13],Mn=ue[14],Cn=ue[15],u[12]=qn*ye+Un*Ye+Mn*ir+Cn*Cr,u[13]=qn*_e+Un*Je+Mn*cr+Cn*hr,u[14]=qn*ke+Un*dt+Mn*nr+Cn*rn,u[15]=qn*Be+Un*It+Mn*Or+Cn*Jn,u}function Vr(u,O,ue){var ye=ue[0],_e=ue[1],ke=ue[2],Be,Ye,Je,dt,It,ir,cr,nr,Or,Cr,hr,rn;return O===u?(u[12]=O[0]*ye+O[4]*_e+O[8]*ke+O[12],u[13]=O[1]*ye+O[5]*_e+O[9]*ke+O[13],u[14]=O[2]*ye+O[6]*_e+O[10]*ke+O[14],u[15]=O[3]*ye+O[7]*_e+O[11]*ke+O[15]):(Be=O[0],Ye=O[1],Je=O[2],dt=O[3],It=O[4],ir=O[5],cr=O[6],nr=O[7],Or=O[8],Cr=O[9],hr=O[10],rn=O[11],u[0]=Be,u[1]=Ye,u[2]=Je,u[3]=dt,u[4]=It,u[5]=ir,u[6]=cr,u[7]=nr,u[8]=Or,u[9]=Cr,u[10]=hr,u[11]=rn,u[12]=Be*ye+It*_e+Or*ke+O[12],u[13]=Ye*ye+ir*_e+Cr*ke+O[13],u[14]=Je*ye+cr*_e+hr*ke+O[14],u[15]=dt*ye+nr*_e+rn*ke+O[15]),u}function pn(u,O,ue){var ye=ue[0],_e=ue[1],ke=ue[2];return u[0]=O[0]*ye,u[1]=O[1]*ye,u[2]=O[2]*ye,u[3]=O[3]*ye,u[4]=O[4]*_e,u[5]=O[5]*_e,u[6]=O[6]*_e,u[7]=O[7]*_e,u[8]=O[8]*ke,u[9]=O[9]*ke,u[10]=O[10]*ke,u[11]=O[11]*ke,u[12]=O[12],u[13]=O[13],u[14]=O[14],u[15]=O[15],u}function wn(u,O,ue,ye){var _e=ye[0],ke=ye[1],Be=ye[2],Ye=Math.hypot(_e,ke,Be),Je,dt,It,ir,cr,nr,Or,Cr,hr,rn,Jn,qn,Un,Mn,Cn,Ga,ei,Ka,$a,Ha,fi,bi,ha,Oa;return Ye0?(ue[0]=(Ye*Be+It*ye+Je*ke-dt*_e)*2/ir,ue[1]=(Je*Be+It*_e+dt*ye-Ye*ke)*2/ir,ue[2]=(dt*Be+It*ke+Ye*_e-Je*ye)*2/ir):(ue[0]=(Ye*Be+It*ye+Je*ke-dt*_e)*2,ue[1]=(Je*Be+It*_e+dt*ye-Ye*ke)*2,ue[2]=(dt*Be+It*ke+Ye*_e-Je*ye)*2),Dt(u,O,ue),u}function ne(u,O){return u[0]=O[12],u[1]=O[13],u[2]=O[14],u}function ae(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[4],Be=O[5],Ye=O[6],Je=O[8],dt=O[9],It=O[10];return u[0]=Math.hypot(ue,ye,_e),u[1]=Math.hypot(ke,Be,Ye),u[2]=Math.hypot(Je,dt,It),u}function P(u,O){var ue=new y.ARRAY_TYPE(3);ae(ue,O);var ye=1/ue[0],_e=1/ue[1],ke=1/ue[2],Be=O[0]*ye,Ye=O[1]*_e,Je=O[2]*ke,dt=O[4]*ye,It=O[5]*_e,ir=O[6]*ke,cr=O[8]*ye,nr=O[9]*_e,Or=O[10]*ke,Cr=Be+It+Or,hr=0;return Cr>0?(hr=Math.sqrt(Cr+1)*2,u[3]=.25*hr,u[0]=(ir-nr)/hr,u[1]=(cr-Je)/hr,u[2]=(Ye-dt)/hr):Be>It&&Be>Or?(hr=Math.sqrt(1+Be-It-Or)*2,u[3]=(ir-nr)/hr,u[0]=.25*hr,u[1]=(Ye+dt)/hr,u[2]=(cr+Je)/hr):It>Or?(hr=Math.sqrt(1+It-Be-Or)*2,u[3]=(cr-Je)/hr,u[0]=(Ye+dt)/hr,u[1]=.25*hr,u[2]=(ir+nr)/hr):(hr=Math.sqrt(1+Or-Be-It)*2,u[3]=(Ye-dt)/hr,u[0]=(cr+Je)/hr,u[1]=(ir+nr)/hr,u[2]=.25*hr),u}function S(u,O,ue,ye){var _e=O[0],ke=O[1],Be=O[2],Ye=O[3],Je=_e+_e,dt=ke+ke,It=Be+Be,ir=_e*Je,cr=_e*dt,nr=_e*It,Or=ke*dt,Cr=ke*It,hr=Be*It,rn=Ye*Je,Jn=Ye*dt,qn=Ye*It,Un=ye[0],Mn=ye[1],Cn=ye[2];return u[0]=(1-(Or+hr))*Un,u[1]=(cr+qn)*Un,u[2]=(nr-Jn)*Un,u[3]=0,u[4]=(cr-qn)*Mn,u[5]=(1-(ir+hr))*Mn,u[6]=(Cr+rn)*Mn,u[7]=0,u[8]=(nr+Jn)*Cn,u[9]=(Cr-rn)*Cn,u[10]=(1-(ir+Or))*Cn,u[11]=0,u[12]=ue[0],u[13]=ue[1],u[14]=ue[2],u[15]=1,u}function C(u,O,ue,ye,_e){var ke=O[0],Be=O[1],Ye=O[2],Je=O[3],dt=ke+ke,It=Be+Be,ir=Ye+Ye,cr=ke*dt,nr=ke*It,Or=ke*ir,Cr=Be*It,hr=Be*ir,rn=Ye*ir,Jn=Je*dt,qn=Je*It,Un=Je*ir,Mn=ye[0],Cn=ye[1],Ga=ye[2],ei=_e[0],Ka=_e[1],$a=_e[2],Ha=(1-(Cr+rn))*Mn,fi=(nr+Un)*Mn,bi=(Or-qn)*Mn,ha=(nr-Un)*Cn,Oa=(1-(cr+rn))*Cn,Jo=(hr+Jn)*Cn,Wo=(Or+qn)*Ga,oo=(hr-Jn)*Ga,Qs=(1-(cr+Cr))*Ga;return u[0]=Ha,u[1]=fi,u[2]=bi,u[3]=0,u[4]=ha,u[5]=Oa,u[6]=Jo,u[7]=0,u[8]=Wo,u[9]=oo,u[10]=Qs,u[11]=0,u[12]=ue[0]+ei-(Ha*ei+ha*Ka+Wo*$a),u[13]=ue[1]+Ka-(fi*ei+Oa*Ka+oo*$a),u[14]=ue[2]+$a-(bi*ei+Jo*Ka+Qs*$a),u[15]=1,u}function V(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[3],Be=ue+ue,Ye=ye+ye,Je=_e+_e,dt=ue*Be,It=ye*Be,ir=ye*Ye,cr=_e*Be,nr=_e*Ye,Or=_e*Je,Cr=ke*Be,hr=ke*Ye,rn=ke*Je;return u[0]=1-ir-Or,u[1]=It+rn,u[2]=cr-hr,u[3]=0,u[4]=It-rn,u[5]=1-dt-Or,u[6]=nr+Cr,u[7]=0,u[8]=cr+hr,u[9]=nr-Cr,u[10]=1-dt-ir,u[11]=0,u[12]=0,u[13]=0,u[14]=0,u[15]=1,u}function he(u,O,ue,ye,_e,ke,Be){var Ye=1/(ue-O),Je=1/(_e-ye),dt=1/(ke-Be);return u[0]=ke*2*Ye,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=ke*2*Je,u[6]=0,u[7]=0,u[8]=(ue+O)*Ye,u[9]=(_e+ye)*Je,u[10]=(Be+ke)*dt,u[11]=-1,u[12]=0,u[13]=0,u[14]=Be*ke*2*dt,u[15]=0,u}function xe(u,O,ue,ye,_e){var ke=1/Math.tan(O/2),Be;return u[0]=ke/ue,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=ke,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=-1,u[12]=0,u[13]=0,u[15]=0,_e!=null&&_e!==Infinity?(Be=1/(ye-_e),u[10]=(_e+ye)*Be,u[14]=2*_e*ye*Be):(u[10]=-1,u[14]=-2*ye),u}var Ee=xe;function Ne(u,O,ue,ye,_e){var ke=1/Math.tan(O/2),Be;return u[0]=ke/ue,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=ke,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[11]=-1,u[12]=0,u[13]=0,u[15]=0,_e!=null&&_e!==Infinity?(Be=1/(ye-_e),u[10]=_e*Be,u[14]=_e*ye*Be):(u[10]=-1,u[14]=-ye),u}function Et(u,O,ue,ye){var _e=Math.tan(O.upDegrees*Math.PI/180),ke=Math.tan(O.downDegrees*Math.PI/180),Be=Math.tan(O.leftDegrees*Math.PI/180),Ye=Math.tan(O.rightDegrees*Math.PI/180),Je=2/(Be+Ye),dt=2/(_e+ke);return u[0]=Je,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=dt,u[6]=0,u[7]=0,u[8]=-((Be-Ye)*Je*.5),u[9]=(_e-ke)*dt*.5,u[10]=ye/(ue-ye),u[11]=-1,u[12]=0,u[13]=0,u[14]=ye*ue/(ue-ye),u[15]=0,u}function st(u,O,ue,ye,_e,ke,Be){var Ye=1/(O-ue),Je=1/(ye-_e),dt=1/(ke-Be);return u[0]=-2*Ye,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=-2*Je,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=2*dt,u[11]=0,u[12]=(O+ue)*Ye,u[13]=(_e+ye)*Je,u[14]=(Be+ke)*dt,u[15]=1,u}var Pt=st;function $t(u,O,ue,ye,_e,ke,Be){var Ye=1/(O-ue),Je=1/(ye-_e),dt=1/(ke-Be);return u[0]=-2*Ye,u[1]=0,u[2]=0,u[3]=0,u[4]=0,u[5]=-2*Je,u[6]=0,u[7]=0,u[8]=0,u[9]=0,u[10]=dt,u[11]=0,u[12]=(O+ue)*Ye,u[13]=(_e+ye)*Je,u[14]=ke*dt,u[15]=1,u}function Ht(u,O,ue,ye){var _e,ke,Be,Ye,Je,dt,It,ir,cr,nr,Or=O[0],Cr=O[1],hr=O[2],rn=ye[0],Jn=ye[1],qn=ye[2],Un=ue[0],Mn=ue[1],Cn=ue[2];return Math.abs(Or-Un)0&&(nr=1/Math.sqrt(nr),It*=nr,ir*=nr,cr*=nr);var Or=Je*cr-dt*ir,Cr=dt*It-Ye*cr,hr=Ye*ir-Je*It;return nr=Or*Or+Cr*Cr+hr*hr,nr>0&&(nr=1/Math.sqrt(nr),Or*=nr,Cr*=nr,hr*=nr),u[0]=Or,u[1]=Cr,u[2]=hr,u[3]=0,u[4]=ir*hr-cr*Cr,u[5]=cr*Or-It*hr,u[6]=It*Cr-ir*Or,u[7]=0,u[8]=It,u[9]=ir,u[10]=cr,u[11]=0,u[12]=_e,u[13]=ke,u[14]=Be,u[15]=1,u}function hn(u){return"mat4("+u[0]+", "+u[1]+", "+u[2]+", "+u[3]+", "+u[4]+", "+u[5]+", "+u[6]+", "+u[7]+", "+u[8]+", "+u[9]+", "+u[10]+", "+u[11]+", "+u[12]+", "+u[13]+", "+u[14]+", "+u[15]+")"}function Ot(u){return Math.hypot(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15])}function Qt(u,O,ue){return u[0]=O[0]+ue[0],u[1]=O[1]+ue[1],u[2]=O[2]+ue[2],u[3]=O[3]+ue[3],u[4]=O[4]+ue[4],u[5]=O[5]+ue[5],u[6]=O[6]+ue[6],u[7]=O[7]+ue[7],u[8]=O[8]+ue[8],u[9]=O[9]+ue[9],u[10]=O[10]+ue[10],u[11]=O[11]+ue[11],u[12]=O[12]+ue[12],u[13]=O[13]+ue[13],u[14]=O[14]+ue[14],u[15]=O[15]+ue[15],u}function pr(u,O,ue){return u[0]=O[0]-ue[0],u[1]=O[1]-ue[1],u[2]=O[2]-ue[2],u[3]=O[3]-ue[3],u[4]=O[4]-ue[4],u[5]=O[5]-ue[5],u[6]=O[6]-ue[6],u[7]=O[7]-ue[7],u[8]=O[8]-ue[8],u[9]=O[9]-ue[9],u[10]=O[10]-ue[10],u[11]=O[11]-ue[11],u[12]=O[12]-ue[12],u[13]=O[13]-ue[13],u[14]=O[14]-ue[14],u[15]=O[15]-ue[15],u}function en(u,O,ue){return u[0]=O[0]*ue,u[1]=O[1]*ue,u[2]=O[2]*ue,u[3]=O[3]*ue,u[4]=O[4]*ue,u[5]=O[5]*ue,u[6]=O[6]*ue,u[7]=O[7]*ue,u[8]=O[8]*ue,u[9]=O[9]*ue,u[10]=O[10]*ue,u[11]=O[11]*ue,u[12]=O[12]*ue,u[13]=O[13]*ue,u[14]=O[14]*ue,u[15]=O[15]*ue,u}function Nr(u,O,ue,ye){return u[0]=O[0]+ue[0]*ye,u[1]=O[1]+ue[1]*ye,u[2]=O[2]+ue[2]*ye,u[3]=O[3]+ue[3]*ye,u[4]=O[4]+ue[4]*ye,u[5]=O[5]+ue[5]*ye,u[6]=O[6]+ue[6]*ye,u[7]=O[7]+ue[7]*ye,u[8]=O[8]+ue[8]*ye,u[9]=O[9]+ue[9]*ye,u[10]=O[10]+ue[10]*ye,u[11]=O[11]+ue[11]*ye,u[12]=O[12]+ue[12]*ye,u[13]=O[13]+ue[13]*ye,u[14]=O[14]+ue[14]*ye,u[15]=O[15]+ue[15]*ye,u}function ta(u,O){return u[0]===O[0]&&u[1]===O[1]&&u[2]===O[2]&&u[3]===O[3]&&u[4]===O[4]&&u[5]===O[5]&&u[6]===O[6]&&u[7]===O[7]&&u[8]===O[8]&&u[9]===O[9]&&u[10]===O[10]&&u[11]===O[11]&&u[12]===O[12]&&u[13]===O[13]&&u[14]===O[14]&&u[15]===O[15]}function kn(u,O){var ue=u[0],ye=u[1],_e=u[2],ke=u[3],Be=u[4],Ye=u[5],Je=u[6],dt=u[7],It=u[8],ir=u[9],cr=u[10],nr=u[11],Or=u[12],Cr=u[13],hr=u[14],rn=u[15],Jn=O[0],qn=O[1],Un=O[2],Mn=O[3],Cn=O[4],Ga=O[5],ei=O[6],Ka=O[7],$a=O[8],Ha=O[9],fi=O[10],bi=O[11],ha=O[12],Oa=O[13],Jo=O[14],Wo=O[15];return Math.abs(ue-Jn)<=y.EPSILON*Math.max(1,Math.abs(ue),Math.abs(Jn))&&Math.abs(ye-qn)<=y.EPSILON*Math.max(1,Math.abs(ye),Math.abs(qn))&&Math.abs(_e-Un)<=y.EPSILON*Math.max(1,Math.abs(_e),Math.abs(Un))&&Math.abs(ke-Mn)<=y.EPSILON*Math.max(1,Math.abs(ke),Math.abs(Mn))&&Math.abs(Be-Cn)<=y.EPSILON*Math.max(1,Math.abs(Be),Math.abs(Cn))&&Math.abs(Ye-Ga)<=y.EPSILON*Math.max(1,Math.abs(Ye),Math.abs(Ga))&&Math.abs(Je-ei)<=y.EPSILON*Math.max(1,Math.abs(Je),Math.abs(ei))&&Math.abs(dt-Ka)<=y.EPSILON*Math.max(1,Math.abs(dt),Math.abs(Ka))&&Math.abs(It-$a)<=y.EPSILON*Math.max(1,Math.abs(It),Math.abs($a))&&Math.abs(ir-Ha)<=y.EPSILON*Math.max(1,Math.abs(ir),Math.abs(Ha))&&Math.abs(cr-fi)<=y.EPSILON*Math.max(1,Math.abs(cr),Math.abs(fi))&&Math.abs(nr-bi)<=y.EPSILON*Math.max(1,Math.abs(nr),Math.abs(bi))&&Math.abs(Or-ha)<=y.EPSILON*Math.max(1,Math.abs(Or),Math.abs(ha))&&Math.abs(Cr-Oa)<=y.EPSILON*Math.max(1,Math.abs(Cr),Math.abs(Oa))&&Math.abs(hr-Jo)<=y.EPSILON*Math.max(1,Math.abs(hr),Math.abs(Jo))&&Math.abs(rn-Wo)<=y.EPSILON*Math.max(1,Math.abs(rn),Math.abs(Wo))}var En=Dr,Rn=pr,Yn=z(77160);function bn(){var u=new y.ARRAY_TYPE(4);return y.ARRAY_TYPE!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0,u[3]=0),u}function je(u){var O=new y.ARRAY_TYPE(4);return O[0]=u[0],O[1]=u[1],O[2]=u[2],O[3]=u[3],O}function Ce(u,O,ue,ye){var _e=new y.ARRAY_TYPE(4);return _e[0]=u,_e[1]=O,_e[2]=ue,_e[3]=ye,_e}function Xe(u,O){return u[0]=O[0],u[1]=O[1],u[2]=O[2],u[3]=O[3],u}function ut(u,O,ue,ye,_e){return u[0]=O,u[1]=ue,u[2]=ye,u[3]=_e,u}function ot(u,O,ue){return u[0]=O[0]+ue[0],u[1]=O[1]+ue[1],u[2]=O[2]+ue[2],u[3]=O[3]+ue[3],u}function bt(u,O,ue){return u[0]=O[0]-ue[0],u[1]=O[1]-ue[1],u[2]=O[2]-ue[2],u[3]=O[3]-ue[3],u}function Xt(u,O,ue){return u[0]=O[0]*ue[0],u[1]=O[1]*ue[1],u[2]=O[2]*ue[2],u[3]=O[3]*ue[3],u}function wr(u,O,ue){return u[0]=O[0]/ue[0],u[1]=O[1]/ue[1],u[2]=O[2]/ue[2],u[3]=O[3]/ue[3],u}function Wr(u,O){return u[0]=Math.ceil(O[0]),u[1]=Math.ceil(O[1]),u[2]=Math.ceil(O[2]),u[3]=Math.ceil(O[3]),u}function on(u,O){return u[0]=Math.floor(O[0]),u[1]=Math.floor(O[1]),u[2]=Math.floor(O[2]),u[3]=Math.floor(O[3]),u}function xn(u,O,ue){return u[0]=Math.min(O[0],ue[0]),u[1]=Math.min(O[1],ue[1]),u[2]=Math.min(O[2],ue[2]),u[3]=Math.min(O[3],ue[3]),u}function zn(u,O,ue){return u[0]=Math.max(O[0],ue[0]),u[1]=Math.max(O[1],ue[1]),u[2]=Math.max(O[2],ue[2]),u[3]=Math.max(O[3],ue[3]),u}function Qn(u,O){return u[0]=Math.round(O[0]),u[1]=Math.round(O[1]),u[2]=Math.round(O[2]),u[3]=Math.round(O[3]),u}function ia(u,O,ue){return u[0]=O[0]*ue,u[1]=O[1]*ue,u[2]=O[2]*ue,u[3]=O[3]*ue,u}function Wa(u,O,ue,ye){return u[0]=O[0]+ue[0]*ye,u[1]=O[1]+ue[1]*ye,u[2]=O[2]+ue[2]*ye,u[3]=O[3]+ue[3]*ye,u}function Ia(u,O){var ue=O[0]-u[0],ye=O[1]-u[1],_e=O[2]-u[2],ke=O[3]-u[3];return Math.hypot(ue,ye,_e,ke)}function Ba(u,O){var ue=O[0]-u[0],ye=O[1]-u[1],_e=O[2]-u[2],ke=O[3]-u[3];return ue*ue+ye*ye+_e*_e+ke*ke}function Ea(u){var O=u[0],ue=u[1],ye=u[2],_e=u[3];return Math.hypot(O,ue,ye,_e)}function qa(u){var O=u[0],ue=u[1],ye=u[2],_e=u[3];return O*O+ue*ue+ye*ye+_e*_e}function si(u,O){return u[0]=-O[0],u[1]=-O[1],u[2]=-O[2],u[3]=-O[3],u}function _a(u,O){return u[0]=1/O[0],u[1]=1/O[1],u[2]=1/O[2],u[3]=1/O[3],u}function So(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[3],Be=ue*ue+ye*ye+_e*_e+ke*ke;return Be>0&&(Be=1/Math.sqrt(Be)),u[0]=ue*Be,u[1]=ye*Be,u[2]=_e*Be,u[3]=ke*Be,u}function to(u,O){return u[0]*O[0]+u[1]*O[1]+u[2]*O[2]+u[3]*O[3]}function co(u,O,ue,ye){var _e=ue[0]*ye[1]-ue[1]*ye[0],ke=ue[0]*ye[2]-ue[2]*ye[0],Be=ue[0]*ye[3]-ue[3]*ye[0],Ye=ue[1]*ye[2]-ue[2]*ye[1],Je=ue[1]*ye[3]-ue[3]*ye[1],dt=ue[2]*ye[3]-ue[3]*ye[2],It=O[0],ir=O[1],cr=O[2],nr=O[3];return u[0]=ir*dt-cr*Je+nr*Ye,u[1]=-(It*dt)+cr*Be-nr*ke,u[2]=It*Je-ir*Be+nr*_e,u[3]=-(It*Ye)+ir*ke-cr*_e,u}function ni(u,O,ue,ye){var _e=O[0],ke=O[1],Be=O[2],Ye=O[3];return u[0]=_e+ye*(ue[0]-_e),u[1]=ke+ye*(ue[1]-ke),u[2]=Be+ye*(ue[2]-Be),u[3]=Ye+ye*(ue[3]-Ye),u}function lo(u,O){O=O||1;var ue,ye,_e,ke,Be,Ye;do ue=y.RANDOM()*2-1,ye=y.RANDOM()*2-1,Be=ue*ue+ye*ye;while(Be>=1);do _e=y.RANDOM()*2-1,ke=y.RANDOM()*2-1,Ye=_e*_e+ke*ke;while(Ye>=1);var Je=Math.sqrt((1-Be)/Ye);return u[0]=O*ue,u[1]=O*ye,u[2]=O*_e*Je,u[3]=O*ke*Je,u}function Ss(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3];return u[0]=ue[0]*ye+ue[4]*_e+ue[8]*ke+ue[12]*Be,u[1]=ue[1]*ye+ue[5]*_e+ue[9]*ke+ue[13]*Be,u[2]=ue[2]*ye+ue[6]*_e+ue[10]*ke+ue[14]*Be,u[3]=ue[3]*ye+ue[7]*_e+ue[11]*ke+ue[15]*Be,u}function Ro(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=ue[0],Ye=ue[1],Je=ue[2],dt=ue[3],It=dt*ye+Ye*ke-Je*_e,ir=dt*_e+Je*ye-Be*ke,cr=dt*ke+Be*_e-Ye*ye,nr=-Be*ye-Ye*_e-Je*ke;return u[0]=It*dt+nr*-Be+ir*-Je-cr*-Ye,u[1]=ir*dt+nr*-Ye+cr*-Be-It*-Je,u[2]=cr*dt+nr*-Je+It*-Ye-ir*-Be,u[3]=O[3],u}function mi(u){return u[0]=0,u[1]=0,u[2]=0,u[3]=0,u}function ya(u){return"vec4("+u[0]+", "+u[1]+", "+u[2]+", "+u[3]+")"}function _o(u,O){return u[0]===O[0]&&u[1]===O[1]&&u[2]===O[2]&&u[3]===O[3]}function Yi(u,O){var ue=u[0],ye=u[1],_e=u[2],ke=u[3],Be=O[0],Ye=O[1],Je=O[2],dt=O[3];return Math.abs(ue-Be)<=y.EPSILON*Math.max(1,Math.abs(ue),Math.abs(Be))&&Math.abs(ye-Ye)<=y.EPSILON*Math.max(1,Math.abs(ye),Math.abs(Ye))&&Math.abs(_e-Je)<=y.EPSILON*Math.max(1,Math.abs(_e),Math.abs(Je))&&Math.abs(ke-dt)<=y.EPSILON*Math.max(1,Math.abs(ke),Math.abs(dt))}var Fi=bt,Bo=Xt,_s=wr,Oo=Ia,Hi=Ba,_n=Ea,Fo=qa,Go=function(){var u=bn();return function(O,ue,ye,_e,ke,Be){var Ye,Je;for(ue||(ue=4),ye||(ye=0),_e?Je=Math.min(_e*ue+ye,O.length):Je=O.length,Ye=ye;Yey.EPSILON?(u[0]=O[0]/ye,u[1]=O[1]/ye,u[2]=O[2]/ye):(u[0]=1,u[1]=0,u[2]=0),ue}function Mo(u,O){var ue=Ya(u,O);return Math.acos(2*ue*ue-1)}function ho(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=ue[0],Je=ue[1],dt=ue[2],It=ue[3];return u[0]=ye*It+Be*Ye+_e*dt-ke*Je,u[1]=_e*It+Be*Je+ke*Ye-ye*dt,u[2]=ke*It+Be*dt+ye*Je-_e*Ye,u[3]=Be*It-ye*Ye-_e*Je-ke*dt,u}function Gi(u,O,ue){ue*=.5;var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=Math.sin(ue),Je=Math.cos(ue);return u[0]=ye*Je+Be*Ye,u[1]=_e*Je+ke*Ye,u[2]=ke*Je-_e*Ye,u[3]=Be*Je-ye*Ye,u}function Di(u,O,ue){ue*=.5;var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=Math.sin(ue),Je=Math.cos(ue);return u[0]=ye*Je-ke*Ye,u[1]=_e*Je+Be*Ye,u[2]=ke*Je+ye*Ye,u[3]=Be*Je-_e*Ye,u}function $o(u,O,ue){ue*=.5;var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=Math.sin(ue),Je=Math.cos(ue);return u[0]=ye*Je+_e*Ye,u[1]=_e*Je-ye*Ye,u[2]=ke*Je+Be*Ye,u[3]=Be*Je-ke*Ye,u}function Ni(u,O){var ue=O[0],ye=O[1],_e=O[2];return u[0]=ue,u[1]=ye,u[2]=_e,u[3]=Math.sqrt(Math.abs(1-ue*ue-ye*ye-_e*_e)),u}function ro(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[3],Be=Math.sqrt(ue*ue+ye*ye+_e*_e),Ye=Math.exp(ke),Je=Be>0?Ye*Math.sin(Be)/Be:0;return u[0]=ue*Je,u[1]=ye*Je,u[2]=_e*Je,u[3]=Ye*Math.cos(Be),u}function Qo(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[3],Be=Math.sqrt(ue*ue+ye*ye+_e*_e),Ye=Be>0?Math.atan2(Be,ke)/Be:0;return u[0]=ue*Ye,u[1]=ye*Ye,u[2]=_e*Ye,u[3]=.5*Math.log(ue*ue+ye*ye+_e*_e+ke*ke),u}function ns(u,O,ue){return Qo(u,O),Fa(u,u,ue),ro(u,u),u}function zi(u,O,ue,ye){var _e=O[0],ke=O[1],Be=O[2],Ye=O[3],Je=ue[0],dt=ue[1],It=ue[2],ir=ue[3],cr,nr,Or,Cr,hr;return nr=_e*Je+ke*dt+Be*It+Ye*ir,nr<0&&(nr=-nr,Je=-Je,dt=-dt,It=-It,ir=-ir),1-nr>y.EPSILON?(cr=Math.acos(nr),Or=Math.sin(cr),Cr=Math.sin((1-ye)*cr)/Or,hr=Math.sin(ye*cr)/Or):(Cr=1-ye,hr=ye),u[0]=Cr*_e+hr*Je,u[1]=Cr*ke+hr*dt,u[2]=Cr*Be+hr*It,u[3]=Cr*Ye+hr*ir,u}function ga(u){var O=y.RANDOM(),ue=y.RANDOM(),ye=y.RANDOM(),_e=Math.sqrt(1-O),ke=Math.sqrt(O);return u[0]=_e*Math.sin(2*Math.PI*ue),u[1]=_e*Math.cos(2*Math.PI*ue),u[2]=ke*Math.sin(2*Math.PI*ye),u[3]=ke*Math.cos(2*Math.PI*ye),u}function vo(u,O){var ue=O[0],ye=O[1],_e=O[2],ke=O[3],Be=ue*ue+ye*ye+_e*_e+ke*ke,Ye=Be?1/Be:0;return u[0]=-ue*Ye,u[1]=-ye*Ye,u[2]=-_e*Ye,u[3]=ke*Ye,u}function Vs(u,O){return u[0]=-O[0],u[1]=-O[1],u[2]=-O[2],u[3]=O[3],u}function Pi(u,O){var ue=O[0]+O[4]+O[8],ye;if(ue>0)ye=Math.sqrt(ue+1),u[3]=.5*ye,ye=.5/ye,u[0]=(O[5]-O[7])*ye,u[1]=(O[6]-O[2])*ye,u[2]=(O[1]-O[3])*ye;else{var _e=0;O[4]>O[0]&&(_e=1),O[8]>O[_e*3+_e]&&(_e=2);var ke=(_e+1)%3,Be=(_e+2)%3;ye=Math.sqrt(O[_e*3+_e]-O[ke*3+ke]-O[Be*3+Be]+1),u[_e]=.5*ye,ye=.5/ye,u[3]=(O[ke*3+Be]-O[Be*3+ke])*ye,u[ke]=(O[ke*3+_e]+O[_e*3+ke])*ye,u[Be]=(O[Be*3+_e]+O[_e*3+Be])*ye}return u}function Ao(u,O,ue,ye){var _e=.5*Math.PI/180;O*=_e,ue*=_e,ye*=_e;var ke=Math.sin(O),Be=Math.cos(O),Ye=Math.sin(ue),Je=Math.cos(ue),dt=Math.sin(ye),It=Math.cos(ye);return u[0]=ke*Je*It-Be*Ye*dt,u[1]=Be*Ye*It+ke*Je*dt,u[2]=Be*Je*dt-ke*Ye*It,u[3]=Be*Je*It+ke*Ye*dt,u}function as(u){return"quat("+u[0]+", "+u[1]+", "+u[2]+", "+u[3]+")"}var vi=je,Zi=Ce,_i=Xe,no=ut,Ui=ot,da=ho,Fa=ia,Ya=to,Ii=ni,Wi=Ea,ao=Wi,go=qa,po=go,yo=So,ji=_o,ka=Yi,Ys=function(){var u=Yn.create(),O=Yn.fromValues(1,0,0),ue=Yn.fromValues(0,1,0);return function(ye,_e,ke){var Be=Yn.dot(_e,ke);return Be<-.999999?(Yn.cross(u,O,_e),Yn.len(u)<1e-6&&Yn.cross(u,ue,_e),Yn.normalize(u,u),Ko(ye,u,Math.PI),ye):Be>.999999?(ye[0]=0,ye[1]=0,ye[2]=0,ye[3]=1,ye):(Yn.cross(u,_e,ke),ye[0]=u[0],ye[1]=u[1],ye[2]=u[2],ye[3]=1+Be,yo(ye,ye))}}(),_f=function(){var u=Va(),O=Va();return function(ue,ye,_e,ke,Be,Ye){return zi(u,ye,Be,Ye),zi(O,_e,ke,Ye),zi(ue,u,O,2*Ye*(1-Ye)),ue}}(),mo=function(){var u=qr.create();return function(O,ue,ye,_e){return u[0]=ye[0],u[3]=ye[1],u[6]=ye[2],u[1]=_e[0],u[4]=_e[1],u[7]=_e[2],u[2]=-ue[0],u[5]=-ue[1],u[8]=-ue[2],yo(O,Pi(O,u))}}();function lu(){var u=new y.ARRAY_TYPE(8);return y.ARRAY_TYPE!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0,u[4]=0,u[5]=0,u[6]=0,u[7]=0),u[3]=1,u}function na(u){var O=new y.ARRAY_TYPE(8);return O[0]=u[0],O[1]=u[1],O[2]=u[2],O[3]=u[3],O[4]=u[4],O[5]=u[5],O[6]=u[6],O[7]=u[7],O}function an(u,O,ue,ye,_e,ke,Be,Ye){var Je=new y.ARRAY_TYPE(8);return Je[0]=u,Je[1]=O,Je[2]=ue,Je[3]=ye,Je[4]=_e,Je[5]=ke,Je[6]=Be,Je[7]=Ye,Je}function Hs(u,O,ue,ye,_e,ke,Be){var Ye=new y.ARRAY_TYPE(8);Ye[0]=u,Ye[1]=O,Ye[2]=ue,Ye[3]=ye;var Je=_e*.5,dt=ke*.5,It=Be*.5;return Ye[4]=Je*ye+dt*ue-It*O,Ye[5]=dt*ye+It*u-Je*ue,Ye[6]=It*ye+Je*O-dt*u,Ye[7]=-Je*u-dt*O-It*ue,Ye}function Xi(u,O,ue){var ye=ue[0]*.5,_e=ue[1]*.5,ke=ue[2]*.5,Be=O[0],Ye=O[1],Je=O[2],dt=O[3];return u[0]=Be,u[1]=Ye,u[2]=Je,u[3]=dt,u[4]=ye*dt+_e*Je-ke*Ye,u[5]=_e*dt+ke*Be-ye*Je,u[6]=ke*dt+ye*Ye-_e*Be,u[7]=-ye*Be-_e*Ye-ke*Je,u}function zo(u,O){return u[0]=0,u[1]=0,u[2]=0,u[3]=1,u[4]=O[0]*.5,u[5]=O[1]*.5,u[6]=O[2]*.5,u[7]=0,u}function is(u,O){return u[0]=O[0],u[1]=O[1],u[2]=O[2],u[3]=O[3],u[4]=0,u[5]=0,u[6]=0,u[7]=0,u}function ui(u,O){var ue=Va();P(ue,O);var ye=new y.ARRAY_TYPE(3);return ne(ye,O),Xi(u,ue,ye),u}function ai(u,O){return u[0]=O[0],u[1]=O[1],u[2]=O[2],u[3]=O[3],u[4]=O[4],u[5]=O[5],u[6]=O[6],u[7]=O[7],u}function Eo(u){return u[0]=0,u[1]=0,u[2]=0,u[3]=1,u[4]=0,u[5]=0,u[6]=0,u[7]=0,u}function Yu(u,O,ue,ye,_e,ke,Be,Ye,Je){return u[0]=O,u[1]=ue,u[2]=ye,u[3]=_e,u[4]=ke,u[5]=Be,u[6]=Ye,u[7]=Je,u}var Hu=_i;function du(u,O){return u[0]=O[4],u[1]=O[5],u[2]=O[6],u[3]=O[7],u}var hu=_i;function Ei(u,O){return u[4]=O[0],u[5]=O[1],u[6]=O[2],u[7]=O[3],u}function Ki(u,O){var ue=O[4],ye=O[5],_e=O[6],ke=O[7],Be=-O[0],Ye=-O[1],Je=-O[2],dt=O[3];return u[0]=(ue*dt+ke*Be+ye*Je-_e*Ye)*2,u[1]=(ye*dt+ke*Ye+_e*Be-ue*Je)*2,u[2]=(_e*dt+ke*Je+ue*Ye-ye*Be)*2,u}function Zs(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=ue[0]*.5,Je=ue[1]*.5,dt=ue[2]*.5,It=O[4],ir=O[5],cr=O[6],nr=O[7];return u[0]=ye,u[1]=_e,u[2]=ke,u[3]=Be,u[4]=Be*Ye+_e*dt-ke*Je+It,u[5]=Be*Je+ke*Ye-ye*dt+ir,u[6]=Be*dt+ye*Je-_e*Ye+cr,u[7]=-ye*Ye-_e*Je-ke*dt+nr,u}function Ks(u,O,ue){var ye=-O[0],_e=-O[1],ke=-O[2],Be=O[3],Ye=O[4],Je=O[5],dt=O[6],It=O[7],ir=Ye*Be+It*ye+Je*ke-dt*_e,cr=Je*Be+It*_e+dt*ye-Ye*ke,nr=dt*Be+It*ke+Ye*_e-Je*ye,Or=It*Be-Ye*ye-Je*_e-dt*ke;return Gi(u,O,ue),ye=u[0],_e=u[1],ke=u[2],Be=u[3],u[4]=ir*Be+Or*ye+cr*ke-nr*_e,u[5]=cr*Be+Or*_e+nr*ye-ir*ke,u[6]=nr*Be+Or*ke+ir*_e-cr*ye,u[7]=Or*Be-ir*ye-cr*_e-nr*ke,u}function io(u,O,ue){var ye=-O[0],_e=-O[1],ke=-O[2],Be=O[3],Ye=O[4],Je=O[5],dt=O[6],It=O[7],ir=Ye*Be+It*ye+Je*ke-dt*_e,cr=Je*Be+It*_e+dt*ye-Ye*ke,nr=dt*Be+It*ke+Ye*_e-Je*ye,Or=It*Be-Ye*ye-Je*_e-dt*ke;return Di(u,O,ue),ye=u[0],_e=u[1],ke=u[2],Be=u[3],u[4]=ir*Be+Or*ye+cr*ke-nr*_e,u[5]=cr*Be+Or*_e+nr*ye-ir*ke,u[6]=nr*Be+Or*ke+ir*_e-cr*ye,u[7]=Or*Be-ir*ye-cr*_e-nr*ke,u}function os(u,O,ue){var ye=-O[0],_e=-O[1],ke=-O[2],Be=O[3],Ye=O[4],Je=O[5],dt=O[6],It=O[7],ir=Ye*Be+It*ye+Je*ke-dt*_e,cr=Je*Be+It*_e+dt*ye-Ye*ke,nr=dt*Be+It*ke+Ye*_e-Je*ye,Or=It*Be-Ye*ye-Je*_e-dt*ke;return $o(u,O,ue),ye=u[0],_e=u[1],ke=u[2],Be=u[3],u[4]=ir*Be+Or*ye+cr*ke-nr*_e,u[5]=cr*Be+Or*_e+nr*ye-ir*ke,u[6]=nr*Be+Or*ke+ir*_e-cr*ye,u[7]=Or*Be-ir*ye-cr*_e-nr*ke,u}function ss(u,O,ue){var ye=ue[0],_e=ue[1],ke=ue[2],Be=ue[3],Ye=O[0],Je=O[1],dt=O[2],It=O[3];return u[0]=Ye*Be+It*ye+Je*ke-dt*_e,u[1]=Je*Be+It*_e+dt*ye-Ye*ke,u[2]=dt*Be+It*ke+Ye*_e-Je*ye,u[3]=It*Be-Ye*ye-Je*_e-dt*ke,Ye=O[4],Je=O[5],dt=O[6],It=O[7],u[4]=Ye*Be+It*ye+Je*ke-dt*_e,u[5]=Je*Be+It*_e+dt*ye-Ye*ke,u[6]=dt*Be+It*ke+Ye*_e-Je*ye,u[7]=It*Be-Ye*ye-Je*_e-dt*ke,u}function us(u,O,ue){var ye=O[0],_e=O[1],ke=O[2],Be=O[3],Ye=ue[0],Je=ue[1],dt=ue[2],It=ue[3];return u[0]=ye*It+Be*Ye+_e*dt-ke*Je,u[1]=_e*It+Be*Je+ke*Ye-ye*dt,u[2]=ke*It+Be*dt+ye*Je-_e*Ye,u[3]=Be*It-ye*Ye-_e*Je-ke*dt,Ye=ue[4],Je=ue[5],dt=ue[6],It=ue[7],u[4]=ye*It+Be*Ye+_e*dt-ke*Je,u[5]=_e*It+Be*Je+ke*Ye-ye*dt,u[6]=ke*It+Be*dt+ye*Je-_e*Ye,u[7]=Be*It-ye*Ye-_e*Je-ke*dt,u}function $s(u,O,ue,ye){if(Math.abs(ye)0){ue=Math.sqrt(ue);var ye=O[0]/ue,_e=O[1]/ue,ke=O[2]/ue,Be=O[3]/ue,Ye=O[4],Je=O[5],dt=O[6],It=O[7],ir=ye*Ye+_e*Je+ke*dt+Be*It;u[0]=ye,u[1]=_e,u[2]=ke,u[3]=Be,u[4]=(Ye-ye*ir)/ue,u[5]=(Je-_e*ir)/ue,u[6]=(dt-ke*ir)/ue,u[7]=(It-Be*ir)/ue}return u}function $u(u){return"quat2("+u[0]+", "+u[1]+", "+u[2]+", "+u[3]+", "+u[4]+", "+u[5]+", "+u[6]+", "+u[7]+")"}function Mf(u,O){return u[0]===O[0]&&u[1]===O[1]&&u[2]===O[2]&&u[3]===O[3]&&u[4]===O[4]&&u[5]===O[5]&&u[6]===O[6]&&u[7]===O[7]}function Ts(u,O){var ue=u[0],ye=u[1],_e=u[2],ke=u[3],Be=u[4],Ye=u[5],Je=u[6],dt=u[7],It=O[0],ir=O[1],cr=O[2],nr=O[3],Or=O[4],Cr=O[5],hr=O[6],rn=O[7];return Math.abs(ue-It)<=y.EPSILON*Math.max(1,Math.abs(ue),Math.abs(It))&&Math.abs(ye-ir)<=y.EPSILON*Math.max(1,Math.abs(ye),Math.abs(ir))&&Math.abs(_e-cr)<=y.EPSILON*Math.max(1,Math.abs(_e),Math.abs(cr))&&Math.abs(ke-nr)<=y.EPSILON*Math.max(1,Math.abs(ke),Math.abs(nr))&&Math.abs(Be-Or)<=y.EPSILON*Math.max(1,Math.abs(Be),Math.abs(Or))&&Math.abs(Ye-Cr)<=y.EPSILON*Math.max(1,Math.abs(Ye),Math.abs(Cr))&&Math.abs(Je-hr)<=y.EPSILON*Math.max(1,Math.abs(Je),Math.abs(hr))&&Math.abs(dt-rn)<=y.EPSILON*Math.max(1,Math.abs(dt),Math.abs(rn))}var Cf=z(31437)},38186:function(or){var U=[],z=[],B="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function j(A,N){if(N=N||{},A===void 0)throw new Error(B);var L=N.prepend===!0?"prepend":"append",y=N.container!==void 0?N.container:document.querySelector("head"),x=U.indexOf(y);x===-1&&(x=U.push(y)-1,z[x]={});var v;return z[x]!==void 0&&z[x][L]!==void 0?v=z[x][L]:(v=z[x][L]=R(),L==="prepend"?y.insertBefore(v,y.childNodes[0]):y.appendChild(v)),A.charCodeAt(0)===65279&&(A=A.substr(1,A.length)),v.styleSheet?v.styleSheet.cssText+=A:v.textContent+=A,v}function R(){var A=document.createElement("style");return A.setAttribute("type","text/css"),A}or.exports=j,or.exports.insertCss=j},81763:function(or,U,z){var B=z(44239),j=z(37005),R="[object Number]";function A(N){return typeof N=="number"||j(N)&&B(N)==R}or.exports=A},51496:function(or,U,z){"use strict";z.d(U,{x0:function(){return A}});let B=N=>crypto.getRandomValues(new Uint8Array(N)),j=(N,L,y)=>{let x=(2<{let d="";for(;;){let _=y(v),E=v;for(;E--;)if(d+=N[_[E]&x]||"",d.length===g)return d}}},R=(N,L=21)=>j(N,L,B),A=(N=21)=>crypto.getRandomValues(new Uint8Array(N)).reduce((L,y)=>(y&=63,y<36?L+=y.toString(36):y<62?L+=(y-26).toString(36).toUpperCase():y>62?L+="-":L+="_",L),"")},81550:function(or){(function(U,z){or.exports=z()})(this,function(){"use strict";var U=function(ve){return ve instanceof Uint8Array||ve instanceof Uint16Array||ve instanceof Uint32Array||ve instanceof Int8Array||ve instanceof Int16Array||ve instanceof Int32Array||ve instanceof Float32Array||ve instanceof Float64Array||ve instanceof Uint8ClampedArray},z=function(ve,We){for(var it=Object.keys(We),Zt=0;Zt=0&&(ve|0)===ve||R("invalid parameter type, ("+ve+")"+N(We)+". must be a nonnegative integer")}function d(ve,We,it){We.indexOf(ve)<0&&R("invalid value"+N(it)+". must be one of: "+We)}var _=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function E(ve){Object.keys(ve).forEach(function(We){_.indexOf(We)<0&&R('invalid regl constructor argument "'+We+'". must be one of '+_)})}function w(ve,We){for(ve=ve+"";ve.length0&&We.push(new b("unknown",0,it))}}),We}function H(ve,We){We.forEach(function(it){var Zt=ve[it.file];if(Zt){var dr=Zt.index[it.line];if(dr){dr.errors.push(it),Zt.hasErrors=!0;return}}ve.unknown.hasErrors=!0,ve.unknown.lines[0].errors.push(it)})}function Q(ve,We,it,Zt,dr){if(!ve.getShaderParameter(We,ve.COMPILE_STATUS)){var Yt=ve.getShaderInfoLog(We),ar=Zt===ve.FRAGMENT_SHADER?"fragment":"vertex";Se(it,"string",ar+" shader source must be a string",dr);var Mr=W(it,dr),Ir=X(Yt);H(Mr,Ir),Object.keys(Mr).forEach(function(Ar){var Tr=Mr[Ar];if(!Tr.hasErrors)return;var zr=[""],f=[""];function M(G,Y){zr.push(G),f.push(Y||"")}M("file number "+Ar+": "+Tr.name+` `,"color:red;text-decoration:underline;font-weight:bold"),Tr.lines.forEach(function(G){if(G.errors.length>0){M(w(G.number,4)+"| ","background-color:yellow; font-weight:bold"),M(G.line+B,"color:red; background-color:yellow; font-weight:bold");var Y=0;G.errors.forEach(function(re){var ie=re.message,le=/^\s*'(.*)'\s*:\s*(.*)$/.exec(ie);if(le){var ge=le[1];switch(ie=le[2],ge){case"assign":ge="=";break}Y=Math.max(G.line.indexOf(ge,Y),0)}else Y=0;M(w("| ",6)),M(w("^^^",Y+3)+B,"font-weight:bold"),M(w("| ",6)),M(ie+B,"font-weight:bold")}),M(w("| ",6)+B)}else M(w(G.number,4)+"| "),M(G.line+B,"color:red")}),typeof document!="undefined"&&!window.chrome?(f[0]=zr.join("%c"),console.log.apply(console,f)):console.log(zr.join(""))}),A.raise("Error compiling "+ar+" shader, "+Mr[0].name)}}function q(ve,We,it,Zt,dr){if(!ve.getProgramParameter(We,ve.LINK_STATUS)){var Yt=ve.getProgramInfoLog(We),ar=W(it,dr),Mr=W(Zt,dr),Ir='Error linking program with vertex shader, "'+Mr[0].name+'", and fragment shader "'+ar[0].name+'"';typeof document!="undefined"?console.log("%c"+Ir+B+"%c"+Yt,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Ir+B+Yt),A.raise(Ir)}}function J(ve){ve._commandRef=m()}function te(ve,We,it,Zt){J(ve);function dr(Ir){return Ir?Zt.id(Ir):0}ve._fragId=dr(ve.static.frag),ve._vertId=dr(ve.static.vert);function Yt(Ir,Ar){Object.keys(Ar).forEach(function(Tr){Ir[Zt.id(Tr)]=!0})}var ar=ve._uniformSet={};Yt(ar,We.static),Yt(ar,We.dynamic);var Mr=ve._attributeSet={};Yt(Mr,it.static),Yt(Mr,it.dynamic),ve._hasCount="count"in ve.static||"count"in ve.dynamic||"elements"in ve.static||"elements"in ve.dynamic}function fe(ve,We){var it=$();R(ve+" in command "+(We||m())+(it==="unknown"?"":" called from "+it))}function de(ve,We,it){ve||fe(We,it||m())}function Te(ve,We,it,Zt){ve in We||fe("unknown parameter ("+ve+")"+N(it)+". possible values: "+Object.keys(We).join(),Zt||m())}function Se(ve,We,it,Zt){x(ve,We)||fe("invalid parameter type"+N(it)+". expected "+We+", got "+typeof ve,Zt||m())}function Ie(ve){ve()}function be(ve,We,it){ve.texture?d(ve.texture._texture.internalformat,We,"unsupported texture format for attachment"):d(ve.renderbuffer._renderbuffer.format,it,"unsupported renderbuffer format for attachment")}var pe=33071,Me=9728,De=9984,Ue=9985,nt=9986,Ze=9987,ht=5120,Rt=5121,tr=5122,Qe=5123,lt=5124,St=5125,Ct=5126,_t=32819,pt=32820,rr=33635,xr=34042,Vt=36193,ft={};ft[ht]=ft[Rt]=1,ft[tr]=ft[Qe]=ft[Vt]=ft[rr]=ft[_t]=ft[pt]=2,ft[lt]=ft[St]=ft[Ct]=ft[xr]=4;function Bt(ve,We){return ve===pt||ve===_t||ve===rr?2:ve===xr?4:ft[ve]*We}function qt(ve){return!(ve&ve-1)&&!!ve}function br(ve,We,it){var Zt,dr=We.width,Yt=We.height,ar=We.channels;A(dr>0&&dr<=it.maxTextureSize&&Yt>0&&Yt<=it.maxTextureSize,"invalid texture shape"),(ve.wrapS!==pe||ve.wrapT!==pe)&&A(qt(dr)&&qt(Yt),"incompatible wrap mode for texture, both width and height must be power of 2"),We.mipmask===1?dr!==1&&Yt!==1&&A(ve.minFilter!==De&&ve.minFilter!==nt&&ve.minFilter!==Ue&&ve.minFilter!==Ze,"min filter requires mipmap"):(A(qt(dr)&&qt(Yt),"texture must be a square power of 2 to support mipmapping"),A(We.mipmask===(dr<<1)-1,"missing or incomplete mipmap data")),We.type===Ct&&(it.extensions.indexOf("oes_texture_float_linear")<0&&A(ve.minFilter===Me&&ve.magFilter===Me,"filter not supported, must enable oes_texture_float_linear"),A(!ve.genMipmaps,"mipmap generation not supported with float textures"));var Mr=We.images;for(Zt=0;Zt<16;++Zt)if(Mr[Zt]){var Ir=dr>>Zt,Ar=Yt>>Zt;A(We.mipmask&1<0&&dr<=Zt.maxTextureSize&&Yt>0&&Yt<=Zt.maxTextureSize,"invalid texture shape"),A(dr===Yt,"cube map must be square"),A(We.wrapS===pe&&We.wrapT===pe,"wrap mode not supported by cube map");for(var Mr=0;Mr>Tr,M=Yt>>Tr;A(Ir.mipmask&1<1&&We===it&&(We==='"'||We==="'"))return['"'+Gn(ve.substr(1,ve.length-2))+'"'];var Zt=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(ve);if(Zt)return mn(ve.substr(0,Zt.index)).concat(mn(Zt[1])).concat(mn(ve.substr(Zt.index+Zt[0].length)));var dr=ve.split(".");if(dr.length===1)return['"'+Gn(ve)+'"'];for(var Yt=[],ar=0;arct(it,We+"["+Zt+"]")));if(ve instanceof vn)return ve;Ae(!1,"invalid option type in uniform "+We)}var Wt={DynamicVariable:vn,define:gn,isDynamic:Rr,unbox:ct,accessor:$r},Er={next:typeof requestAnimationFrame=="function"?function(ve){return requestAnimationFrame(ve)}:function(ve){return setTimeout(ve,16)},cancel:typeof cancelAnimationFrame=="function"?function(ve){return cancelAnimationFrame(ve)}:clearTimeout},Dr=typeof performance!="undefined"&&performance.now?function(){return performance.now()}:function(){return+new Date};function Vr(){var ve={"":0},We=[""];return{id:function(it){var Zt=ve[it];return Zt||(Zt=ve[it]=We.length,We.push(it),Zt)},str:function(it){return We[it]}}}function pn(ve,We,it){var Zt=document.createElement("canvas");z(Zt.style,{border:0,margin:0,padding:0,top:0,left:0}),ve.appendChild(Zt),ve===document.body&&(Zt.style.position="absolute",z(ve.style,{margin:0,padding:0}));function dr(){var Mr=window.innerWidth,Ir=window.innerHeight;if(ve!==document.body){var Ar=ve.getBoundingClientRect();Mr=Ar.right-Ar.left,Ir=Ar.bottom-Ar.top}Zt.width=it*Mr,Zt.height=it*Ir,z(Zt.style,{width:Mr+"px",height:Ir+"px"})}var Yt;ve!==document.body&&typeof ResizeObserver=="function"?(Yt=new ResizeObserver(function(){setTimeout(dr)}),Yt.observe(ve)):window.addEventListener("resize",dr,!1);function ar(){Yt?Yt.disconnect():window.removeEventListener("resize",dr),ve.removeChild(Zt)}return dr(),{canvas:Zt,onDestroy:ar}}function wn(ve,We){function it(Zt){try{return ve.getContext(Zt,We)}catch(dr){return null}}return it("webgl")||it("experimental-webgl")||it("webgl-experimental")}function Sn(ve){return typeof ve.nodeName=="string"&&typeof ve.appendChild=="function"&&typeof ve.getBoundingClientRect=="function"}function In(ve){return typeof ve.drawArrays=="function"||typeof ve.drawElements=="function"}function $n(ve){return typeof ve=="string"?ve.split():(Ae(Array.isArray(ve),"invalid extension array"),ve)}function Zr(ve){return typeof ve=="string"?(Ae(typeof document!="undefined","not supported outside of DOM"),document.querySelector(ve)):ve}function Pn(ve){var We=ve||{},it,Zt,dr,Yt,ar={},Mr=[],Ir=[],Ar=typeof window=="undefined"?1:window.devicePixelRatio,Tr=!1,zr=function(G){G&&Ae.raise(G)},f=function(){};if(typeof We=="string"?(Ae(typeof document!="undefined","selector queries only supported in DOM enviroments"),it=document.querySelector(We),Ae(it,"invalid query string for element")):typeof We=="object"?Sn(We)?it=We:In(We)?(Yt=We,dr=Yt.canvas):(Ae.constructor(We),"gl"in We?Yt=We.gl:"canvas"in We?dr=Zr(We.canvas):"container"in We&&(Zt=Zr(We.container)),"attributes"in We&&(ar=We.attributes,Ae.type(ar,"object","invalid context attributes")),"extensions"in We&&(Mr=$n(We.extensions)),"optionalExtensions"in We&&(Ir=$n(We.optionalExtensions)),"onDone"in We&&(Ae.type(We.onDone,"function","invalid or missing onDone callback"),zr=We.onDone),"profile"in We&&(Tr=!!We.profile),"pixelRatio"in We&&(Ar=+We.pixelRatio,Ae(Ar>0,"invalid pixel ratio"))):Ae.raise("invalid arguments to regl"),it&&(it.nodeName.toLowerCase()==="canvas"?dr=it:Zt=it),!Yt){if(!dr){Ae(typeof document!="undefined","must manually specify webgl context outside of DOM environments");var M=pn(Zt||document.body,zr,Ar);if(!M)return null;dr=M.canvas,f=M.onDestroy}ar.premultipliedAlpha===void 0&&(ar.premultipliedAlpha=!0),Yt=wn(dr,ar)}return Yt?{gl:Yt,canvas:dr,container:Zt,extensions:Mr,optionalExtensions:Ir,pixelRatio:Ar,profile:Tr,onDone:zr,onDestroy:f}:(f(),zr("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function An(ve,We){var it={};function Zt(ar){Ae.type(ar,"string","extension name must be string");var Mr=ar.toLowerCase(),Ir;try{Ir=it[Mr]=ve.getExtension(Mr)}catch(Ar){}return!!Ir}for(var dr=0;dr65535)<<4,ve>>>=We,it=(ve>255)<<3,ve>>>=it,We|=it,it=(ve>15)<<2,ve>>>=it,We|=it,it=(ve>3)<<1,ve>>>=it,We|=it,We|ve>>1}function V(){var ve=ln(8,function(){return[]});function We(Yt){var ar=S(Yt),Mr=ve[C(ar)>>2];return Mr.length>0?Mr.pop():new ArrayBuffer(ar)}function it(Yt){ve[C(Yt.byteLength)>>2].push(Yt)}function Zt(Yt,ar){var Mr=null;switch(Yt){case va:Mr=new Int8Array(We(ar),0,ar);break;case K:Mr=new Uint8Array(We(ar),0,ar);break;case Dt:Mr=new Int16Array(We(2*ar),0,ar);break;case rt:Mr=new Uint16Array(We(2*ar),0,ar);break;case ne:Mr=new Int32Array(We(4*ar),0,ar);break;case ae:Mr=new Uint32Array(We(4*ar),0,ar);break;case P:Mr=new Float32Array(We(4*ar),0,ar);break;default:return null}return Mr.length!==ar?Mr.subarray(0,ar):Mr}function dr(Yt){it(Yt.buffer)}return{alloc:We,free:it,allocType:Zt,freeType:dr}}var he=V();he.zero=V();var xe=3408,Ee=3410,Ne=3411,Et=3412,st=3413,Pt=3414,$t=3415,Ht=33901,Br=33902,hn=3379,Ot=3386,Qt=34921,pr=36347,en=36348,Nr=35661,ta=35660,kn=34930,En=36349,Rn=34076,Yn=34024,bn=7936,je=7937,Ce=7938,Xe=35724,ut=34047,ot=36063,bt=34852,Xt=3553,wr=34067,Wr=34069,on=33984,xn=6408,zn=5126,Qn=5121,ia=36160,Wa=36053,Ia=36064,Ba=16384,Ea=function(ve,We){var it=1;We.ext_texture_filter_anisotropic&&(it=ve.getParameter(ut));var Zt=1,dr=1;We.webgl_draw_buffers&&(Zt=ve.getParameter(bt),dr=ve.getParameter(ot));var Yt=!!We.oes_texture_float;if(Yt){var ar=ve.createTexture();ve.bindTexture(Xt,ar),ve.texImage2D(Xt,0,xn,1,1,0,xn,zn,null);var Mr=ve.createFramebuffer();if(ve.bindFramebuffer(ia,Mr),ve.framebufferTexture2D(ia,Ia,Xt,ar,0),ve.bindTexture(Xt,null),ve.checkFramebufferStatus(ia)!==Wa)Yt=!1;else{ve.viewport(0,0,1,1),ve.clearColor(1,0,0,1),ve.clear(Ba);var Ir=he.allocType(zn,4);ve.readPixels(0,0,1,1,xn,zn,Ir),ve.getError()?Yt=!1:(ve.deleteFramebuffer(Mr),ve.deleteTexture(ar),Yt=Ir[0]===1),he.freeType(Ir)}}var Ar=typeof navigator!="undefined"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),Tr=!0;if(!Ar){var zr=ve.createTexture(),f=he.allocType(Qn,36);ve.activeTexture(on),ve.bindTexture(wr,zr),ve.texImage2D(Wr,0,xn,3,3,0,xn,Qn,f),he.freeType(f),ve.bindTexture(wr,null),ve.deleteTexture(zr),Tr=!ve.getError()}return{colorBits:[ve.getParameter(Ee),ve.getParameter(Ne),ve.getParameter(Et),ve.getParameter(st)],depthBits:ve.getParameter(Pt),stencilBits:ve.getParameter($t),subpixelBits:ve.getParameter(xe),extensions:Object.keys(We).filter(function(M){return!!We[M]}),maxAnisotropic:it,maxDrawbuffers:Zt,maxColorAttachments:dr,pointSizeDims:ve.getParameter(Ht),lineWidthDims:ve.getParameter(Br),maxViewportDims:ve.getParameter(Ot),maxCombinedTextureUnits:ve.getParameter(Nr),maxCubeMapSize:ve.getParameter(Rn),maxRenderbufferSize:ve.getParameter(Yn),maxTextureUnits:ve.getParameter(kn),maxTextureSize:ve.getParameter(hn),maxAttributes:ve.getParameter(Qt),maxVertexUniforms:ve.getParameter(pr),maxVertexTextureUnits:ve.getParameter(ta),maxVaryingVectors:ve.getParameter(en),maxFragmentUniforms:ve.getParameter(En),glsl:ve.getParameter(Xe),renderer:ve.getParameter(je),vendor:ve.getParameter(bn),version:ve.getParameter(Ce),readFloat:Yt,npotTextureCube:Tr}};function qa(ve){return!!ve&&typeof ve=="object"&&Array.isArray(ve.shape)&&Array.isArray(ve.stride)&&typeof ve.offset=="number"&&ve.shape.length===ve.stride.length&&(Array.isArray(ve.data)||U(ve.data))}var si=function(ve){return Object.keys(ve).map(function(We){return ve[We]})},_a={shape:Ss,flatten:lo};function So(ve,We,it){for(var Zt=0;Zt0){var ze;if(Array.isArray(re[0])){Le=Ms(re);for(var Fe=1,tt=1;tt0)if(typeof Fe[0]=="number"){var Tt=he.allocType(ge.dtype,Fe.length);$o(Tt,Fe),Le(Tt,Mt),he.freeType(Tt)}else if(Array.isArray(Fe[0])||U(Fe[0])){sr=Ms(Fe);var Nt=Va(Fe,sr,ge.dtype);Le(Nt,Mt),he.freeType(Nt)}else Ae.raise("invalid buffer data")}else if(qa(Fe)){sr=Fe.shape;var Lt=Fe.stride,_r=0,Yr=0,Pr=0,dn=0;sr.length===1?(_r=sr[0],Yr=1,Pr=Lt[0],dn=0):sr.length===2?(_r=sr[0],Yr=sr[1],Pr=Lt[0],dn=Lt[1]):Ae.raise("invalid shape");var sn=Array.isArray(Fe.data)?ge.dtype:Di(Fe.data),tn=he.allocType(sn,_r*Yr);Ni(tn,Fe.data,_r,Yr,Pr,dn,Fe.offset),Le(tn,Mt),he.freeType(tn)}else Ae.raise("invalid data for buffer subdata");return me}return ie||me(Y),me._reglType="buffer",me._buffer=ge,me.subdata=ze,it.profile&&(me.stats=ge.stats),me.destroy=function(){f(ge)},me}function G(){si(Yt).forEach(function(Y){Y.buffer=ve.createBuffer(),ve.bindBuffer(Y.type,Y.buffer),ve.bufferData(Y.type,Y.persistentData||Y.byteLength,Y.usage)})}return it.profile&&(We.getTotalBufferSize=function(){var Y=0;return Object.keys(Yt).forEach(function(re){Y+=Yt[re].stats.size}),Y}),{create:M,createStream:Ir,destroyStream:Ar,clear:function(){si(Yt).forEach(f),Mr.forEach(f)},getBuffer:function(Y){return Y&&Y._buffer instanceof ar?Y._buffer:null},restore:G,_initBuffer:zr}}var Qo=0,ns=0,zi=1,ga=1,vo=4,Vs=4,Pi={points:Qo,point:ns,lines:zi,line:ga,triangles:vo,triangle:Vs,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Ao=0,as=1,vi=4,Zi=5120,_i=5121,no=5122,Ui=5123,da=5124,Fa=5125,Ya=34963,Ii=35040,Wi=35044;function ao(ve,We,it,Zt){var dr={},Yt=0,ar={uint8:_i,uint16:Ui};We.oes_element_index_uint&&(ar.uint32=Fa);function Mr(G){this.id=Yt++,dr[this.id]=this,this.buffer=G,this.primType=vi,this.vertCount=0,this.type=0}Mr.prototype.bind=function(){this.buffer.bind()};var Ir=[];function Ar(G){var Y=Ir.pop();return Y||(Y=new Mr(it.create(null,Ya,!0,!1)._buffer)),zr(Y,G,Ii,-1,-1,0,0),Y}function Tr(G){Ir.push(G)}function zr(G,Y,re,ie,le,ge,me){G.buffer.bind();var Le;if(Y){var ze=me;!me&&(!U(Y)||qa(Y)&&!U(Y.data))&&(ze=We.oes_element_index_uint?Fa:Ui),it._initBuffer(G.buffer,Y,re,ze,3)}else ve.bufferData(Ya,ge,re),G.buffer.dtype=Le||_i,G.buffer.usage=re,G.buffer.dimension=3,G.buffer.byteLength=ge;if(Le=me,!me){switch(G.buffer.dtype){case _i:case Zi:Le=_i;break;case Ui:case no:Le=Ui;break;case Fa:case da:Le=Fa;break;default:Ae.raise("unsupported type for element array")}G.buffer.dtype=Le}G.type=Le,Ae(Le!==Fa||!!We.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Fe=le;Fe<0&&(Fe=G.buffer.byteLength,Le===Ui?Fe>>=1:Le===Fa&&(Fe>>=2)),G.vertCount=Fe;var tt=ie;if(ie<0){tt=vi;var Mt=G.buffer.dimension;Mt===1&&(tt=Ao),Mt===2&&(tt=as),Mt===3&&(tt=vi)}G.primType=tt}function f(G){Zt.elementsCount--,Ae(G.buffer!==null,"must not double destroy elements"),delete dr[G.id],G.buffer.destroy(),G.buffer=null}function M(G,Y){var re=it.create(null,Ya,!0),ie=new Mr(re._buffer);Zt.elementsCount++;function le(ge){if(!ge)re(),ie.primType=vi,ie.vertCount=0,ie.type=_i;else if(typeof ge=="number")re(ge),ie.primType=vi,ie.vertCount=ge|0,ie.type=_i;else{var me=null,Le=Wi,ze=-1,Fe=-1,tt=0,Mt=0;Array.isArray(ge)||U(ge)||qa(ge)?me=ge:(Ae.type(ge,"object","invalid arguments for elements"),"data"in ge&&(me=ge.data,Ae(Array.isArray(me)||U(me)||qa(me),"invalid data for element buffer")),"usage"in ge&&(Ae.parameter(ge.usage,Go,"invalid element buffer usage"),Le=Go[ge.usage]),"primitive"in ge&&(Ae.parameter(ge.primitive,Pi,"invalid element buffer primitive"),ze=Pi[ge.primitive]),"count"in ge&&(Ae(typeof ge.count=="number"&&ge.count>=0,"invalid vertex count for elements"),Fe=ge.count|0),"type"in ge&&(Ae.parameter(ge.type,ar,"invalid buffer type"),Mt=ar[ge.type]),"length"in ge?tt=ge.length|0:(tt=Fe,Mt===Ui||Mt===no?tt*=2:(Mt===Fa||Mt===da)&&(tt*=4))),zr(ie,me,Le,ze,Fe,tt,Mt)}return le}return le(G),le._reglType="elements",le._elements=ie,le.subdata=function(ge,me){return re.subdata(ge,me),le},le.destroy=function(){f(ie)},le}return{create:M,createStream:Ar,destroyStream:Tr,getElements:function(G){return typeof G=="function"&&G._elements instanceof Mr?G._elements:null},clear:function(){si(dr).forEach(f)}}}var go=new Float32Array(1),po=new Uint32Array(go.buffer),yo=5123;function ji(ve){for(var We=he.allocType(yo,ve.length),it=0;it>>31<<15,Yt=(Zt<<1>>>24)-127,ar=Zt>>13&(1<<10)-1;if(Yt<-24)We[it]=dr;else if(Yt<-14){var Mr=-14-Yt;We[it]=dr+(ar+(1<<10)>>Mr)}else Yt>15?We[it]=dr+31744:We[it]=dr+(Yt+15<<10)+ar}return We}function ka(ve){return Array.isArray(ve)||U(ve)}var Ys=function(ve){return!(ve&ve-1)&&!!ve},_f=34467,mo=3553,lu=34067,na=34069,an=6408,Hs=6406,Xi=6407,zo=6409,is=6410,ui=32854,ai=32855,Eo=36194,Yu=32819,Hu=32820,du=33635,hu=34042,Ei=6402,Ki=34041,Zs=35904,Ks=35906,io=36193,os=33776,ss=33777,us=33778,$s=33779,Uo=35986,bo=35987,fs=34798,Zu=35840,vu=35841,gu=35842,pu=35843,Ku=36196,Co=5121,Cs=5123,cs=5125,$i=5126,xo=10242,$u=10243,Mf=10497,Ts=33071,Cf=33648,u=10240,O=10241,ue=9728,ye=9729,_e=9984,ke=9985,Be=9986,Ye=9987,Je=33170,dt=4352,It=4353,ir=4354,cr=34046,nr=3317,Or=37440,Cr=37441,hr=37443,rn=37444,Jn=33984,qn=[_e,Be,ke,Ye],Un=[0,zo,is,Xi,an],Mn={};Mn[zo]=Mn[Hs]=Mn[Ei]=1,Mn[Ki]=Mn[is]=2,Mn[Xi]=Mn[Zs]=3,Mn[an]=Mn[Ks]=4;function Cn(ve){return"[object "+ve+"]"}var Ga=Cn("HTMLCanvasElement"),ei=Cn("OffscreenCanvas"),Ka=Cn("CanvasRenderingContext2D"),$a=Cn("ImageBitmap"),Ha=Cn("HTMLImageElement"),fi=Cn("HTMLVideoElement"),bi=Object.keys(Ro).concat([Ga,ei,Ka,$a,Ha,fi]),ha=[];ha[Co]=1,ha[$i]=4,ha[io]=2,ha[Cs]=2,ha[cs]=4;var Oa=[];Oa[ui]=2,Oa[ai]=2,Oa[Eo]=2,Oa[Ki]=4,Oa[os]=.5,Oa[ss]=.5,Oa[us]=1,Oa[$s]=1,Oa[Uo]=.5,Oa[bo]=1,Oa[fs]=1,Oa[Zu]=.5,Oa[vu]=.25,Oa[gu]=.5,Oa[pu]=.25,Oa[Ku]=.5;function Jo(ve){return Array.isArray(ve)&&(ve.length===0||typeof ve[0]=="number")}function Wo(ve){if(!Array.isArray(ve))return!1;var We=ve.length;return!(We===0||!ka(ve[0]))}function oo(ve){return Object.prototype.toString.call(ve)}function Qs(ve){return oo(ve)===Ga}function Tf(ve){return oo(ve)===ei}function Qu(ve){return oo(ve)===Ka}function Ju(ve){return oo(ve)===$a}function cc(ve){return oo(ve)===Ha}function yu(ve){return oo(ve)===fi}function If(ve){if(!ve)return!1;var We=oo(ve);return bi.indexOf(We)>=0?!0:Jo(ve)||Wo(ve)||qa(ve)}function Of(ve){return Ro[Object.prototype.toString.call(ve)]|0}function qo(ve,We){var it=We.length;switch(ve.type){case Co:case Cs:case cs:case $i:var Zt=he.allocType(ve.type,it);Zt.set(We),ve.data=Zt;break;case io:ve.data=ji(We);break;default:Ae.raise("unsupported texture type, must specify a typed array")}}function Af(ve,We){return he.allocType(ve.type===io?$i:ve.type,We)}function lc(ve,We){ve.type===io?(ve.data=ji(We),he.freeType(We)):ve.data=We}function el(ve,We,it,Zt,dr,Yt){for(var ar=ve.width,Mr=ve.height,Ir=ve.channels,Ar=ar*Mr*Ir,Tr=Af(ve,Ar),zr=0,f=0;f=1;)Mr+=ar*Ir*Ir,Ir/=2;return Mr}else return ar*it*Zt}function mu(ve,We,it,Zt,dr,Yt,ar){var Mr={"don't care":dt,"dont care":dt,nice:ir,fast:It},Ir={repeat:Mf,clamp:Ts,mirror:Cf},Ar={nearest:ue,linear:ye},Tr=z({mipmap:Ye,"nearest mipmap nearest":_e,"linear mipmap nearest":ke,"nearest mipmap linear":Be,"linear mipmap linear":Ye},Ar),zr={none:0,browser:rn},f={uint8:Co,rgba4:Yu,rgb565:du,"rgb5 a1":Hu},M={alpha:Hs,luminance:zo,"luminance alpha":is,rgb:Xi,rgba:an,rgba4:ui,"rgb5 a1":ai,rgb565:Eo},G={};We.ext_srgb&&(M.srgb=Zs,M.srgba=Ks),We.oes_texture_float&&(f.float32=f.float=$i),We.oes_texture_half_float&&(f.float16=f["half float"]=io),We.webgl_depth_texture&&(z(M,{depth:Ei,"depth stencil":Ki}),z(f,{uint16:Cs,uint32:cs,"depth stencil":hu})),We.webgl_compressed_texture_s3tc&&z(G,{"rgb s3tc dxt1":os,"rgba s3tc dxt1":ss,"rgba s3tc dxt3":us,"rgba s3tc dxt5":$s}),We.webgl_compressed_texture_atc&&z(G,{"rgb atc":Uo,"rgba atc explicit alpha":bo,"rgba atc interpolated alpha":fs}),We.webgl_compressed_texture_pvrtc&&z(G,{"rgb pvrtc 4bppv1":Zu,"rgb pvrtc 2bppv1":vu,"rgba pvrtc 4bppv1":gu,"rgba pvrtc 2bppv1":pu}),We.webgl_compressed_texture_etc1&&(G["rgb etc1"]=Ku);var Y=Array.prototype.slice.call(ve.getParameter(_f));Object.keys(G).forEach(function(et){var Jt=G[et];Y.indexOf(Jt)>=0&&(M[et]=Jt)});var re=Object.keys(M);it.textureFormats=re;var ie=[];Object.keys(M).forEach(function(et){var Jt=M[et];ie[Jt]=et});var le=[];Object.keys(f).forEach(function(et){var Jt=f[et];le[Jt]=et});var ge=[];Object.keys(Ar).forEach(function(et){var Jt=Ar[et];ge[Jt]=et});var me=[];Object.keys(Tr).forEach(function(et){var Jt=Tr[et];me[Jt]=et});var Le=[];Object.keys(Ir).forEach(function(et){var Jt=Ir[et];Le[Jt]=et});var ze=re.reduce(function(et,Jt){var jt=M[Jt];return jt===zo||jt===Hs||jt===zo||jt===is||jt===Ei||jt===Ki||We.ext_srgb&&(jt===Zs||jt===Ks)?et[jt]=jt:jt===ai||Jt.indexOf("rgba")>=0?et[jt]=an:et[jt]=Xi,et},{});function Fe(){this.internalformat=an,this.format=an,this.type=Co,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=rn,this.width=0,this.height=0,this.channels=0}function tt(et,Jt){et.internalformat=Jt.internalformat,et.format=Jt.format,et.type=Jt.type,et.compressed=Jt.compressed,et.premultiplyAlpha=Jt.premultiplyAlpha,et.flipY=Jt.flipY,et.unpackAlignment=Jt.unpackAlignment,et.colorSpace=Jt.colorSpace,et.width=Jt.width,et.height=Jt.height,et.channels=Jt.channels}function Mt(et,Jt){if(!(typeof Jt!="object"||!Jt)){if("premultiplyAlpha"in Jt&&(Ae.type(Jt.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),et.premultiplyAlpha=Jt.premultiplyAlpha),"flipY"in Jt&&(Ae.type(Jt.flipY,"boolean","invalid texture flip"),et.flipY=Jt.flipY),"alignment"in Jt&&(Ae.oneOf(Jt.alignment,[1,2,4,8],"invalid texture unpack alignment"),et.unpackAlignment=Jt.alignment),"colorSpace"in Jt&&(Ae.parameter(Jt.colorSpace,zr,"invalid colorSpace"),et.colorSpace=zr[Jt.colorSpace]),"type"in Jt){var jt=Jt.type;Ae(We.oes_texture_float||!(jt==="float"||jt==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),Ae(We.oes_texture_half_float||!(jt==="half float"||jt==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),Ae(We.webgl_depth_texture||!(jt==="uint16"||jt==="uint32"||jt==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Ae.parameter(jt,f,"invalid texture type"),et.type=f[jt]}var nn=et.width,aa=et.height,$e=et.channels,Ge=!1;"shape"in Jt?(Ae(Array.isArray(Jt.shape)&&Jt.shape.length>=2,"shape must be an array"),nn=Jt.shape[0],aa=Jt.shape[1],Jt.shape.length===3&&($e=Jt.shape[2],Ae($e>0&&$e<=4,"invalid number of channels"),Ge=!0),Ae(nn>=0&&nn<=it.maxTextureSize,"invalid width"),Ae(aa>=0&&aa<=it.maxTextureSize,"invalid height")):("radius"in Jt&&(nn=aa=Jt.radius,Ae(nn>=0&&nn<=it.maxTextureSize,"invalid radius")),"width"in Jt&&(nn=Jt.width,Ae(nn>=0&&nn<=it.maxTextureSize,"invalid width")),"height"in Jt&&(aa=Jt.height,Ae(aa>=0&&aa<=it.maxTextureSize,"invalid height")),"channels"in Jt&&($e=Jt.channels,Ae($e>0&&$e<=4,"invalid number of channels"),Ge=!0)),et.width=nn|0,et.height=aa|0,et.channels=$e|0;var mt=!1;if("format"in Jt){var Gt=Jt.format;Ae(We.webgl_depth_texture||!(Gt==="depth"||Gt==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Ae.parameter(Gt,M,"invalid texture format");var Ut=et.internalformat=M[Gt];et.format=ze[Ut],Gt in f&&("type"in Jt||(et.type=f[Gt])),Gt in G&&(et.compressed=!0),mt=!0}!Ge&&mt?et.channels=Mn[et.format]:Ge&&!mt?et.channels!==Un[et.format]&&(et.format=et.internalformat=Un[et.channels]):mt&&Ge&&Ae(et.channels===Mn[et.format],"number of channels inconsistent with specified format")}}function sr(et){ve.pixelStorei(Or,et.flipY),ve.pixelStorei(Cr,et.premultiplyAlpha),ve.pixelStorei(hr,et.colorSpace),ve.pixelStorei(nr,et.unpackAlignment)}function Tt(){Fe.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function Nt(et,Jt){var jt=null;if(If(Jt)?jt=Jt:Jt&&(Ae.type(Jt,"object","invalid pixel data type"),Mt(et,Jt),"x"in Jt&&(et.xOffset=Jt.x|0),"y"in Jt&&(et.yOffset=Jt.y|0),If(Jt.data)&&(jt=Jt.data)),Ae(!et.compressed||jt instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),Jt.copy){Ae(!jt,"can not specify copy and data field for the same texture");var nn=dr.viewportWidth,aa=dr.viewportHeight;et.width=et.width||nn-et.xOffset,et.height=et.height||aa-et.yOffset,et.needsCopy=!0,Ae(et.xOffset>=0&&et.xOffset=0&&et.yOffset0&&et.width<=nn&&et.height>0&&et.height<=aa,"copy texture read out of bounds")}else if(!jt)et.width=et.width||1,et.height=et.height||1,et.channels=et.channels||4;else if(U(jt))et.channels=et.channels||4,et.data=jt,!("type"in Jt)&&et.type===Co&&(et.type=Of(jt));else if(Jo(jt))et.channels=et.channels||4,qo(et,jt),et.alignment=1,et.needsFree=!0;else if(qa(jt)){var $e=jt.data;!Array.isArray($e)&&et.type===Co&&(et.type=Of($e));var Ge=jt.shape,mt=jt.stride,Gt,Ut,wt,xt,At,Ke;Ge.length===3?(wt=Ge[2],Ke=mt[2]):(Ae(Ge.length===2,"invalid ndarray pixel data, must be 2 or 3D"),wt=1,Ke=1),Gt=Ge[0],Ut=Ge[1],xt=mt[0],At=mt[1],et.alignment=1,et.width=Gt,et.height=Ut,et.channels=wt,et.format=et.internalformat=Un[wt],et.needsFree=!0,el(et,$e,xt,At,Ke,jt.offset)}else if(Qs(jt)||Tf(jt)||Qu(jt))Qs(jt)||Tf(jt)?et.element=jt:et.element=jt.canvas,et.width=et.element.width,et.height=et.element.height,et.channels=4;else if(Ju(jt))et.element=jt,et.width=jt.width,et.height=jt.height,et.channels=4;else if(cc(jt))et.element=jt,et.width=jt.naturalWidth,et.height=jt.naturalHeight,et.channels=4;else if(yu(jt))et.element=jt,et.width=jt.videoWidth,et.height=jt.videoHeight,et.channels=4;else if(Wo(jt)){var vt=et.width||jt[0].length,Ve=et.height||jt.length,kt=et.channels;ka(jt[0][0])?kt=kt||jt[0][0].length:kt=kt||1;for(var zt=_a.shape(jt),vr=1,gr=0;gr=0,"oes_texture_float extension not enabled"):et.type===io&&Ae(it.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function Lt(et,Jt,jt){var nn=et.element,aa=et.data,$e=et.internalformat,Ge=et.format,mt=et.type,Gt=et.width,Ut=et.height;sr(et),nn?ve.texImage2D(Jt,jt,Ge,Ge,mt,nn):et.compressed?ve.compressedTexImage2D(Jt,jt,$e,Gt,Ut,0,aa):et.needsCopy?(Zt(),ve.copyTexImage2D(Jt,jt,Ge,et.xOffset,et.yOffset,Gt,Ut,0)):ve.texImage2D(Jt,jt,Ge,Gt,Ut,0,Ge,mt,aa||null)}function _r(et,Jt,jt,nn,aa){var $e=et.element,Ge=et.data,mt=et.internalformat,Gt=et.format,Ut=et.type,wt=et.width,xt=et.height;sr(et),$e?ve.texSubImage2D(Jt,aa,jt,nn,Gt,Ut,$e):et.compressed?ve.compressedTexSubImage2D(Jt,aa,jt,nn,mt,wt,xt,Ge):et.needsCopy?(Zt(),ve.copyTexSubImage2D(Jt,aa,jt,nn,et.xOffset,et.yOffset,wt,xt)):ve.texSubImage2D(Jt,aa,jt,nn,wt,xt,Gt,Ut,Ge)}var Yr=[];function Pr(){return Yr.pop()||new Tt}function dn(et){et.needsFree&&he.freeType(et.data),Tt.call(et),Yr.push(et)}function sn(){Fe.call(this),this.genMipmaps=!1,this.mipmapHint=dt,this.mipmask=0,this.images=Array(16)}function tn(et,Jt,jt){var nn=et.images[0]=Pr();et.mipmask=1,nn.width=et.width=Jt,nn.height=et.height=jt,nn.channels=et.channels=4}function Bn(et,Jt){var jt=null;if(If(Jt))jt=et.images[0]=Pr(),tt(jt,et),Nt(jt,Jt),et.mipmask=1;else if(Mt(et,Jt),Array.isArray(Jt.mipmap))for(var nn=Jt.mipmap,aa=0;aa>=aa,jt.height>>=aa,Nt(jt,nn[aa]),et.mipmask|=1<=0&&!("faces"in Jt)&&(et.genMipmaps=!0)}if("mag"in Jt){var nn=Jt.mag;Ae.parameter(nn,Ar),et.magFilter=Ar[nn]}var aa=et.wrapS,$e=et.wrapT;if("wrap"in Jt){var Ge=Jt.wrap;typeof Ge=="string"?(Ae.parameter(Ge,Ir),aa=$e=Ir[Ge]):Array.isArray(Ge)&&(Ae.parameter(Ge[0],Ir),Ae.parameter(Ge[1],Ir),aa=Ir[Ge[0]],$e=Ir[Ge[1]])}else{if("wrapS"in Jt){var mt=Jt.wrapS;Ae.parameter(mt,Ir),aa=Ir[mt]}if("wrapT"in Jt){var Gt=Jt.wrapT;Ae.parameter(Gt,Ir),$e=Ir[Gt]}}if(et.wrapS=aa,et.wrapT=$e,"anisotropic"in Jt){var Ut=Jt.anisotropic;Ae(typeof Ut=="number"&&Ut>=1&&Ut<=it.maxAnisotropic,"aniso samples must be between 1 and "),et.anisotropic=Jt.anisotropic}if("mipmap"in Jt){var wt=!1;switch(typeof Jt.mipmap){case"string":Ae.parameter(Jt.mipmap,Mr,"invalid mipmap hint"),et.mipmapHint=Mr[Jt.mipmap],et.genMipmaps=!0,wt=!0;break;case"boolean":wt=et.genMipmaps=Jt.mipmap;break;case"object":Ae(Array.isArray(Jt.mipmap),"invalid mipmap type"),et.genMipmaps=!1,wt=!0;break;default:Ae.raise("invalid mipmap type")}wt&&!("min"in Jt)&&(et.minFilter=_e)}}function Za(et,Jt){ve.texParameteri(Jt,O,et.minFilter),ve.texParameteri(Jt,u,et.magFilter),ve.texParameteri(Jt,xo,et.wrapS),ve.texParameteri(Jt,$u,et.wrapT),We.ext_texture_filter_anisotropic&&ve.texParameteri(Jt,cr,et.anisotropic),et.genMipmaps&&(ve.hint(Je,et.mipmapHint),ve.generateMipmap(Jt))}var ri=0,li={},ii=it.maxTextureUnits,Pa=Array(ii).map(function(){return null});function Hn(et){Fe.call(this),this.mipmask=0,this.internalformat=an,this.id=ri++,this.refCount=1,this.target=et,this.texture=ve.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new La,ar.profile&&(this.stats={size:0})}function Bi(et){ve.activeTexture(Jn),ve.bindTexture(et.target,et.texture)}function Ln(){var et=Pa[0];et?ve.bindTexture(et.target,et.texture):ve.bindTexture(mo,null)}function On(et){var Jt=et.texture;Ae(Jt,"must not double destroy texture");var jt=et.unit,nn=et.target;jt>=0&&(ve.activeTexture(Jn+jt),ve.bindTexture(nn,null),Pa[jt]=null),ve.deleteTexture(Jt),et.texture=null,et.params=null,et.pixels=null,et.refCount=0,delete li[et.id],Yt.textureCount--}z(Hn.prototype,{bind:function(){var et=this;et.bindCount+=1;var Jt=et.unit;if(Jt<0){for(var jt=0;jt0)continue;nn.unit=-1}Pa[jt]=et,Jt=jt;break}Jt>=ii&&Ae.raise("insufficient number of texture units"),ar.profile&&Yt.maxTextureUnits>At)-wt,Ke.height=Ke.height||(jt.height>>At)-xt,Ae(jt.type===Ke.type&&jt.format===Ke.format&&jt.internalformat===Ke.internalformat,"incompatible format for texture.subimage"),Ae(wt>=0&&xt>=0&&wt+Ke.width<=jt.width&&xt+Ke.height<=jt.height,"texture.subimage write out of bounds"),Ae(jt.mipmask&1<>wt;++wt){var xt=Gt>>wt,At=Ut>>wt;if(!xt||!At)break;ve.texImage2D(mo,wt,jt.format,xt,At,0,jt.format,jt.type,null)}return Ln(),ar.profile&&(jt.stats.size=Is(jt.internalformat,jt.type,Gt,Ut,!1,!1)),nn}return nn(et,Jt),nn.subimage=aa,nn.resize=$e,nn._reglType="texture2d",nn._texture=jt,ar.profile&&(nn.stats=jt.stats),nn.destroy=function(){jt.decRef()},nn}function ba(et,Jt,jt,nn,aa,$e){var Ge=new Hn(lu);li[Ge.id]=Ge,Yt.cubeCount++;var mt=new Array(6);function Gt(xt,At,Ke,vt,Ve,kt){var zt,vr=Ge.texInfo;for(La.call(vr),zt=0;zt<6;++zt)mt[zt]=Wn();if(typeof xt=="number"||!xt){var gr=xt|0||1;for(zt=0;zt<6;++zt)tn(mt[zt],gr,gr)}else if(typeof xt=="object")if(At)Bn(mt[0],xt),Bn(mt[1],At),Bn(mt[2],Ke),Bn(mt[3],vt),Bn(mt[4],Ve),Bn(mt[5],kt);else if(oa(vr,xt),Mt(Ge,xt),"faces"in xt){var ur=xt.faces;for(Ae(Array.isArray(ur)&&ur.length===6,"cube faces must be a length 6 array"),zt=0;zt<6;++zt)Ae(typeof ur[zt]=="object"&&!!ur[zt],"invalid input for cube map face"),tt(mt[zt],Ge),Bn(mt[zt],ur[zt])}else for(zt=0;zt<6;++zt)Bn(mt[zt],xt);else Ae.raise("invalid arguments to cube map");for(tt(Ge,mt[0]),it.npotTextureCube||Ae(Ys(Ge.width)&&Ys(Ge.height),"your browser does not support non power or two texture dimensions"),vr.genMipmaps?Ge.mipmask=(mt[0].width<<1)-1:Ge.mipmask=mt[0].mipmask,Ae.textureCube(Ge,vr,mt,it),Ge.internalformat=mt[0].internalformat,Gt.width=mt[0].width,Gt.height=mt[0].height,Bi(Ge),zt=0;zt<6;++zt)Fn(mt[zt],na+zt);for(Za(vr,lu),Ln(),ar.profile&&(Ge.stats.size=Is(Ge.internalformat,Ge.type,Gt.width,Gt.height,vr.genMipmaps,!0)),Gt.format=ie[Ge.internalformat],Gt.type=le[Ge.type],Gt.mag=ge[vr.magFilter],Gt.min=me[vr.minFilter],Gt.wrapS=Le[vr.wrapS],Gt.wrapT=Le[vr.wrapT],zt=0;zt<6;++zt)ti(mt[zt]);return Gt}function Ut(xt,At,Ke,vt,Ve){Ae(!!At,"must specify image data"),Ae(typeof xt=="number"&&xt===(xt|0)&&xt>=0&&xt<6,"invalid face");var kt=Ke|0,zt=vt|0,vr=Ve|0,gr=Pr();return tt(gr,Ge),gr.width=0,gr.height=0,Nt(gr,At),gr.width=gr.width||(Ge.width>>vr)-kt,gr.height=gr.height||(Ge.height>>vr)-zt,Ae(Ge.type===gr.type&&Ge.format===gr.format&&Ge.internalformat===gr.internalformat,"incompatible format for texture.subimage"),Ae(kt>=0&&zt>=0&&kt+gr.width<=Ge.width&&zt+gr.height<=Ge.height,"texture.subimage write out of bounds"),Ae(Ge.mipmask&1<>vt;++vt)ve.texImage2D(na+Ke,vt,Ge.format,At>>vt,At>>vt,0,Ge.format,Ge.type,null);return Ln(),ar.profile&&(Ge.stats.size=Is(Ge.internalformat,Ge.type,Gt.width,Gt.height,!1,!0)),Gt}}return Gt(et,Jt,jt,nn,aa,$e),Gt.subimage=Ut,Gt.resize=wt,Gt._reglType="textureCube",Gt._texture=Ge,ar.profile&&(Gt.stats=Ge.stats),Gt.destroy=function(){Ge.decRef()},Gt}function yi(){for(var et=0;et>nn,jt.height>>nn,0,jt.internalformat,jt.type,null);else for(var aa=0;aa<6;++aa)ve.texImage2D(na+aa,nn,jt.internalformat,jt.width>>nn,jt.height>>nn,0,jt.internalformat,jt.type,null);Za(jt.texInfo,jt.target)})}function Uu(){for(var et=0;et=2,"invalid renderbuffer shape"),me=tt[0]|0,Le=tt[1]|0}else"radius"in Fe&&(me=Le=Fe.radius|0),"width"in Fe&&(me=Fe.width|0),"height"in Fe&&(Le=Fe.height|0);"format"in Fe&&(Ae.parameter(Fe.format,Yt,"invalid renderbuffer format"),ze=Yt[Fe.format])}else typeof le=="number"?(me=le|0,typeof ge=="number"?Le=ge|0:Le=me):le?Ae.raise("invalid arguments to renderbuffer constructor"):me=Le=1;if(Ae(me>0&&Le>0&&me<=it.maxRenderbufferSize&&Le<=it.maxRenderbufferSize,"invalid renderbuffer size"),!(me===Y.width&&Le===Y.height&&ze===Y.format))return re.width=Y.width=me,re.height=Y.height=Le,Y.format=ze,ve.bindRenderbuffer(Qr,Y.renderbuffer),ve.renderbufferStorage(Qr,ze,me,Le),Ae(ve.getError()===0,"invalid render buffer format"),dr.profile&&(Y.stats.size=Pf(Y.format,Y.width,Y.height)),re.format=ar[Y.format],re}function ie(le,ge){var me=le|0,Le=ge|0||me;return me===Y.width&&Le===Y.height||(Ae(me>0&&Le>0&&me<=it.maxRenderbufferSize&&Le<=it.maxRenderbufferSize,"invalid renderbuffer size"),re.width=Y.width=me,re.height=Y.height=Le,ve.bindRenderbuffer(Qr,Y.renderbuffer),ve.renderbufferStorage(Qr,Y.format,me,Le),Ae(ve.getError()===0,"invalid render buffer format"),dr.profile&&(Y.stats.size=Pf(Y.format,Y.width,Y.height))),re}return re(M,G),re.resize=ie,re._reglType="renderbuffer",re._renderbuffer=Y,dr.profile&&(re.stats=Y.stats),re.destroy=function(){Y.decRef()},re}dr.profile&&(Zt.getTotalRenderbufferSize=function(){var M=0;return Object.keys(Ir).forEach(function(G){M+=Ir[G].stats.size}),M});function f(){si(Ir).forEach(function(M){M.renderbuffer=ve.createRenderbuffer(),ve.bindRenderbuffer(Qr,M.renderbuffer),ve.renderbufferStorage(Qr,M.format,M.width,M.height)}),ve.bindRenderbuffer(Qr,null)}return{create:zr,clear:function(){si(Ir).forEach(Tr)},restore:f}},xi=36160,tf=36161,As=3553,rf=34069,nf=36064,dc=36096,hc=36128,vc=33306,af=36053,gc=36054,xu=36055,pc=36057,Rf=36061,ds=36193,tl=5121,Do=5126,Bf=6407,hs=6408,Ls=6402,yc=[Bf,hs],wu=[];wu[hs]=4,wu[Bf]=3;var Ds=[];Ds[tl]=1,Ds[Do]=4,Ds[ds]=2;var mc=32854,rl=32855,of=36194,Ff=33189,Gf=36168,Ec=34041,sf=35907,uf=34836,nl=34842,al=34843,bc=[mc,rl,of,sf,nl,al,uf],Js={};Js[af]="complete",Js[gc]="incomplete attachment",Js[pc]="incomplete dimensions",Js[xu]="incomplete, missing attachment",Js[Rf]="unsupported";function il(ve,We,it,Zt,dr,Yt){var ar={cur:null,next:null,dirty:!1,setFBO:null},Mr=["rgba"],Ir=["rgba4","rgb565","rgb5 a1"];We.ext_srgb&&Ir.push("srgba"),We.ext_color_buffer_half_float&&Ir.push("rgba16f","rgb16f"),We.webgl_color_buffer_float&&Ir.push("rgba32f");var Ar=["uint8"];We.oes_texture_half_float&&Ar.push("half float","float16"),We.oes_texture_float&&Ar.push("float","float32");function Tr(Tt,Nt,Lt){this.target=Tt,this.texture=Nt,this.renderbuffer=Lt;var _r=0,Yr=0;Nt?(_r=Nt.width,Yr=Nt.height):Lt&&(_r=Lt.width,Yr=Lt.height),this.width=_r,this.height=Yr}function zr(Tt){Tt&&(Tt.texture&&Tt.texture._texture.decRef(),Tt.renderbuffer&&Tt.renderbuffer._renderbuffer.decRef())}function f(Tt,Nt,Lt){if(!!Tt)if(Tt.texture){var _r=Tt.texture._texture,Yr=Math.max(1,_r.width),Pr=Math.max(1,_r.height);Ae(Yr===Nt&&Pr===Lt,"inconsistent width/height for supplied texture"),_r.refCount+=1}else{var dn=Tt.renderbuffer._renderbuffer;Ae(dn.width===Nt&&dn.height===Lt,"inconsistent width/height for renderbuffer"),dn.refCount+=1}}function M(Tt,Nt){Nt&&(Nt.texture?ve.framebufferTexture2D(xi,Tt,Nt.target,Nt.texture._texture.texture,0):ve.framebufferRenderbuffer(xi,Tt,tf,Nt.renderbuffer._renderbuffer.renderbuffer))}function G(Tt){var Nt=As,Lt=null,_r=null,Yr=Tt;typeof Tt=="object"&&(Yr=Tt.data,"target"in Tt&&(Nt=Tt.target|0)),Ae.type(Yr,"function","invalid attachment data");var Pr=Yr._reglType;return Pr==="texture2d"?(Lt=Yr,Ae(Nt===As)):Pr==="textureCube"?(Lt=Yr,Ae(Nt>=rf&&Nt=2,"invalid shape for framebuffer"),tn=Bi[0],Bn=Bi[1]}else"radius"in Hn&&(tn=Bn=Hn.radius),"width"in Hn&&(tn=Hn.width),"height"in Hn&&(Bn=Hn.height);("color"in Hn||"colors"in Hn)&&(Wn=Hn.color||Hn.colors,Array.isArray(Wn)&&Ae(Wn.length===1||We.webgl_draw_buffers,"multiple render targets not supported")),Wn||("colorCount"in Hn&&(Za=Hn.colorCount|0,Ae(Za>0,"invalid color buffer count")),"colorTexture"in Hn&&(ti=!!Hn.colorTexture,La="rgba4"),"colorType"in Hn&&(oa=Hn.colorType,ti?(Ae(We.oes_texture_float||!(oa==="float"||oa==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),Ae(We.oes_texture_half_float||!(oa==="half float"||oa==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):oa==="half float"||oa==="float16"?(Ae(We.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),La="rgba16f"):(oa==="float"||oa==="float32")&&(Ae(We.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),La="rgba32f"),Ae.oneOf(oa,Ar,"invalid color type")),"colorFormat"in Hn&&(La=Hn.colorFormat,Mr.indexOf(La)>=0?ti=!0:Ir.indexOf(La)>=0?ti=!1:ti?Ae.oneOf(Hn.colorFormat,Mr,"invalid color format for texture"):Ae.oneOf(Hn.colorFormat,Ir,"invalid color format for renderbuffer"))),("depthTexture"in Hn||"depthStencilTexture"in Hn)&&(Pa=!!(Hn.depthTexture||Hn.depthStencilTexture),Ae(!Pa||We.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in Hn&&(typeof Hn.depth=="boolean"?Fn=Hn.depth:(ri=Hn.depth,za=!1)),"stencil"in Hn&&(typeof Hn.stencil=="boolean"?za=Hn.stencil:(li=Hn.stencil,Fn=!1)),"depthStencil"in Hn&&(typeof Hn.depthStencil=="boolean"?Fn=za=Hn.depthStencil:(ii=Hn.depthStencil,Fn=!1,za=!1))}var Ln=null,On=null,sa=null,ba=null;if(Array.isArray(Wn))Ln=Wn.map(G);else if(Wn)Ln=[G(Wn)];else for(Ln=new Array(Za),sn=0;sn=0||Ln[sn].renderbuffer&&bc.indexOf(Ln[sn].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+sn+" is invalid"),Ln[sn]&&Ln[sn].texture){var Ho=wu[Ln[sn].texture._texture.format]*Ds[Ln[sn].texture._texture.type];yi===null?yi=Ho:Ae(yi===Ho,"all color attachments much have the same number of bits per pixel.")}return f(On,tn,Bn),Ae(!On||On.texture&&On.texture._texture.format===Ls||On.renderbuffer&&On.renderbuffer._renderbuffer.format===Ff,"invalid depth attachment for framebuffer object"),f(sa,tn,Bn),Ae(!sa||sa.renderbuffer&&sa.renderbuffer._renderbuffer.format===Gf,"invalid stencil attachment for framebuffer object"),f(ba,tn,Bn),Ae(!ba||ba.texture&&ba.texture._texture.format===Ec||ba.renderbuffer&&ba.renderbuffer._renderbuffer.format===Ec,"invalid depth-stencil attachment for framebuffer object"),Le(Lt),Lt.width=tn,Lt.height=Bn,Lt.colorAttachments=Ln,Lt.depthAttachment=On,Lt.stencilAttachment=sa,Lt.depthStencilAttachment=ba,_r.color=Ln.map(re),_r.depth=re(On),_r.stencil=re(sa),_r.depthStencil=re(ba),_r.width=Lt.width,_r.height=Lt.height,Fe(Lt),_r}function Yr(Pr,dn){Ae(ar.next!==Lt,"can not resize a framebuffer which is currently in use");var sn=Math.max(Pr|0,1),tn=Math.max(dn|0||sn,1);if(sn===Lt.width&&tn===Lt.height)return _r;for(var Bn=Lt.colorAttachments,Fn=0;Fn=2,"invalid shape for framebuffer"),Ae(ti[0]===ti[1],"cube framebuffer must be square"),sn=ti[0]}else"radius"in Wn&&(sn=Wn.radius|0),"width"in Wn?(sn=Wn.width|0,"height"in Wn&&Ae(Wn.height===sn,"must be square")):"height"in Wn&&(sn=Wn.height|0);("color"in Wn||"colors"in Wn)&&(tn=Wn.color||Wn.colors,Array.isArray(tn)&&Ae(tn.length===1||We.webgl_draw_buffers,"multiple render targets not supported")),tn||("colorCount"in Wn&&(za=Wn.colorCount|0,Ae(za>0,"invalid color buffer count")),"colorType"in Wn&&(Ae.oneOf(Wn.colorType,Ar,"invalid color type"),Fn=Wn.colorType),"colorFormat"in Wn&&(Bn=Wn.colorFormat,Ae.oneOf(Wn.colorFormat,Mr,"invalid color format for texture"))),"depth"in Wn&&(dn.depth=Wn.depth),"stencil"in Wn&&(dn.stencil=Wn.stencil),"depthStencil"in Wn&&(dn.depthStencil=Wn.depthStencil)}var La;if(tn)if(Array.isArray(tn))for(La=[],Pr=0;Pr0&&(dn.depth=Nt[0].depth,dn.stencil=Nt[0].stencil,dn.depthStencil=Nt[0].depthStencil),Nt[Pr]?Nt[Pr](dn):Nt[Pr]=tt(dn)}return z(Lt,{width:sn,height:sn,color:La})}function _r(Yr){var Pr,dn=Yr|0;if(Ae(dn>0&&dn<=it.maxCubeMapSize,"invalid radius for cube fbo"),dn===Lt.width)return Lt;var sn=Lt.color;for(Pr=0;Pr0,"must specify at least one attribute");var Mt={},sr=ze.attributes;sr.length=tt.length;for(var Tt=0;Tt=_r.byteLength?Yr.subdata(_r):(Yr.destroy(),ze.buffers[Tt]=null)),ze.buffers[Tt]||(Yr=ze.buffers[Tt]=dr.create(Nt,Su,!1,!0)),Lt.buffer=dr.getBuffer(Yr),Lt.size=Lt.buffer.dimension|0,Lt.normalized=!1,Lt.type=Lt.buffer.dtype,Lt.offset=0,Lt.stride=0,Lt.divisor=0,Lt.state=1,Mt[Tt]=1}else dr.getBuffer(Nt)?(Lt.buffer=dr.getBuffer(Nt),Lt.size=Lt.buffer.dimension|0,Lt.normalized=!1,Lt.type=Lt.buffer.dtype,Lt.offset=0,Lt.stride=0,Lt.divisor=0,Lt.state=1):dr.getBuffer(Nt.buffer)?(Lt.buffer=dr.getBuffer(Nt.buffer),Lt.size=(+Nt.size||Lt.buffer.dimension)|0,Lt.normalized=!!Nt.normalized||!1,"type"in Nt?(Ae.parameter(Nt.type,Hi,"invalid buffer type"),Lt.type=Hi[Nt.type]):Lt.type=Lt.buffer.dtype,Lt.offset=(Nt.offset||0)|0,Lt.stride=(Nt.stride||0)|0,Lt.divisor=(Nt.divisor||0)|0,Lt.state=1,Ae(Lt.size>=1&&Lt.size<=4,"size must be between 1 and 4"),Ae(Lt.offset>=0,"invalid offset"),Ae(Lt.stride>=0&&Lt.stride<=255,"stride must be between 0 and 255"),Ae(Lt.divisor>=0,"divisor must be positive"),Ae(!Lt.divisor||!!We.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in Nt?(Ae(Tt>0,"first attribute must not be a constant"),Lt.x=+Nt.x||0,Lt.y=+Nt.y||0,Lt.z=+Nt.z||0,Lt.w=+Nt.w||0,Lt.state=2):Ae(!1,"invalid attribute spec for location "+Tt)}for(var Pr=0;Pr1)for(var sr=0;srY&&(Y=re.stats.uniformsCount)}),Y},it.getMaxAttributesCount=function(){var Y=0;return Tr.forEach(function(re){re.stats.attributesCount>Y&&(Y=re.stats.attributesCount)}),Y});function G(){dr={},Yt={};for(var Y=0;Y=0,"missing vertex shader",ie),Ae.command(re>=0,"missing fragment shader",ie);var ge=Ar[re];ge||(ge=Ar[re]={});var me=ge[Y];if(me&&(me.refCount++,!le))return me;var Le=new f(re,Y);return it.shaderCount++,M(Le,ie,le),me||(ge[Y]=Le),Tr.push(Le),z(Le,{destroy:function(){if(Le.refCount--,Le.refCount<=0){ve.deleteProgram(Le.program);var ze=Tr.indexOf(Le);Tr.splice(ze,1),it.shaderCount--}ge[Le.vertId].refCount<=0&&(ve.deleteShader(Yt[Le.vertId]),delete Yt[Le.vertId],delete Ar[Le.fragId][Le.vertId]),Object.keys(Ar[Le.fragId]).length||(ve.deleteShader(dr[Le.fragId]),delete dr[Le.fragId],delete Ar[Le.fragId])}})},restore:G,shader:Ir,frag:-1,vert:-1}}var wc=6408,Mu=5121,ff=3333,To=5126;function Sc(ve,We,it,Zt,dr,Yt,ar){function Mr(Tr){var zr;We.next===null?(Ae(dr.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),zr=Mu):(Ae(We.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),zr=We.next.colorAttachments[0].texture._texture.type,Yt.oes_texture_float?(Ae(zr===Mu||zr===To,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),zr===To&&Ae(ar.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):Ae(zr===Mu,"Reading from a framebuffer is only allowed for the type 'uint8'"));var f=0,M=0,G=Zt.framebufferWidth,Y=Zt.framebufferHeight,re=null;U(Tr)?re=Tr:Tr&&(Ae.type(Tr,"object","invalid arguments to regl.read()"),f=Tr.x|0,M=Tr.y|0,Ae(f>=0&&f=0&&M0&&G+f<=Zt.framebufferWidth,"invalid width for read pixels"),Ae(Y>0&&Y+M<=Zt.framebufferHeight,"invalid height for read pixels"),it();var ie=G*Y*4;return re||(zr===Mu?re=new Uint8Array(ie):zr===To&&(re=re||new Float32Array(ie))),Ae.isTypedArray(re,"data buffer for regl.read() must be a typedarray"),Ae(re.byteLength>=ie,"data buffer for regl.read() too small"),ve.pixelStorei(ff,4),ve.readPixels(f,M,G,Y,wc,zr,re),re}function Ir(Tr){var zr;return We.setFBO({framebuffer:Tr.framebuffer},function(){zr=Mr(Tr)}),zr}function Ar(Tr){return!Tr||!("framebuffer"in Tr)?Mr(Tr):Ir(Tr)}return Ar}function qs(ve){return Array.prototype.slice.call(ve)}function Ns(ve){return qs(ve).join("")}function Kr(){var ve=0,We=[],it=[];function Zt(zr){for(var f=0;f0&&(zr.push(Y,"="),zr.push.apply(zr,qs(arguments)),zr.push(";")),Y}return z(f,{def:G,toString:function(){return Ns([M.length>0?"var "+M.join(",")+";":"",Ns(zr)])}})}function Yt(){var zr=dr(),f=dr(),M=zr.toString,G=f.toString;function Y(re,ie){f(re,ie,"=",zr.def(re,ie),";")}return z(function(){zr.apply(zr,qs(arguments))},{def:zr.def,entry:zr,exit:f,save:Y,set:function(re,ie,le){Y(re,ie),zr(re,ie,"=",le,";")},toString:function(){return M()+G()}})}function ar(){var zr=Ns(arguments),f=Yt(),M=Yt(),G=f.toString,Y=M.toString;return z(f,{then:function(){return f.apply(f,qs(arguments)),this},else:function(){return M.apply(M,qs(arguments)),this},toString:function(){var re=Y();return re&&(re="else{"+re+"}"),Ns(["if(",zr,"){",G(),"}",re])}})}var Mr=dr(),Ir={};function Ar(zr,f){var M=[];function G(){var ge="a"+M.length;return M.push(ge),ge}f=f||0;for(var Y=0;Y":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Es={"0":0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Vc={frag:Dc,vert:Nc},Fu={cw:Uc,ccw:su};function Gu(ve){return Array.isArray(ve)||U(ve)||qa(ve)}function Yc(ve){return ve.sort(function(We,it){return We===Xo?-1:it===Xo?1:We=1,Zt>=2,We)}else if(it===Tu){var dr=ve.data;return new Ji(dr.thisDep,dr.contextDep,dr.propDep,We)}else{if(it===Mc)return new Ji(!1,!1,!1,We);if(it===Cc){for(var Yt=!1,ar=!1,Mr=!1,Ir=0;Ir=1&&(ar=!0),Tr>=2&&(Mr=!0)}else Ar.type===Tu&&(Yt=Yt||Ar.data.thisDep,ar=ar||Ar.data.contextDep,Mr=Mr||Ar.data.propDep)}return new Ji(Yt,ar,Mr,We)}else return new Ji(it===tu,it===eu,it===ks,We)}}var Ef=new Ji(!1,!1,!1,function(){});function bl(ve,We,it,Zt,dr,Yt,ar,Mr,Ir,Ar,Tr,zr,f,M,G){var Y=Ar.Record,re={add:32774,subtract:32778,"reverse subtract":32779};it.ext_blend_minmax&&(re.min=pl,re.max=yl);var ie=it.angle_instanced_arrays,le=it.webgl_draw_buffers,ge={dirty:!0,profile:G.profile},me={},Le=[],ze={},Fe={};function tt($e){return $e.replace(".","_")}function Mt($e,Ge,mt){var Gt=tt($e);Le.push($e),me[Gt]=ge[Gt]=!!mt,ze[Gt]=Ge}function sr($e,Ge,mt){var Gt=tt($e);Le.push($e),Array.isArray(mt)?(ge[Gt]=mt.slice(),me[Gt]=mt.slice()):ge[Gt]=me[Gt]=mt,Fe[Gt]=Ge}Mt(Tc,Rc),Mt(Uf,kc),sr(Wf,"blendColor",[0,0,0,0]),sr(jf,"blendEquationSeparate",[rc,rc]),sr(cf,"blendFuncSeparate",[Wc,Qi,Wc,Qi]),Mt(Xf,Bc,!0),sr(Vf,"depthFunc",ml),sr(Iu,"depthRange",[0,1]),sr(Rs,"depthMask",!0),sr(Oi,Oi,[!0,!0,!0,!0]),Mt(gt,vl),sr(cl,"cullFace",ys),sr(Ou,Ou,su),sr(Yf,Yf,1),Mt(ll,Gc),sr(Ic,"polygonOffset",[0,0]),Mt(dl,zs),Mt(hl,Nu),sr(lf,"sampleCoverage",[1,!1]),Mt(Hf,gl),sr(Oc,"stencilMask",-1),sr(Zf,"stencilFunc",[Kn,0,-1]),sr(Mi,"stencilOpSeparate",[Bu,ms,ms,ms]),sr(Au,"stencilOpSeparate",[ys,ms,ms,ms]),Mt(gi,Fc),sr(Lu,"scissor",[0,0,ve.drawingBufferWidth,ve.drawingBufferHeight]),sr(Xo,Xo,[0,0,ve.drawingBufferWidth,ve.drawingBufferHeight]);var Tt={gl:ve,context:f,strings:We,next:me,current:ge,draw:zr,elements:Yt,buffer:dr,shader:Tr,attributes:Ar.state,vao:Ar,uniforms:Ir,framebuffer:Mr,extensions:it,timer:M,isBufferArgs:Gu},Nt={primTypes:Pi,compareFuncs:uu,blendFuncs:pi,blendEquations:re,stencilOps:Es,glTypes:Hi,orientationType:Fu};Ae.optional(function(){Tt.isArrayLike=ka}),le&&(Nt.backBuffer=[ys],Nt.drawBuffer=ln(Zt.maxDrawbuffers,function($e){return $e===0?[0]:ln($e,function(Ge){return El+Ge})}));var Lt=0;function _r(){var $e=Kr(),Ge=$e.link,mt=$e.global;$e.id=Lt++,$e.batchId="0";var Gt=Ge(Tt),Ut=$e.shared={props:"a0"};Object.keys(Tt).forEach(function(vt){Ut[vt]=mt.def(Gt,".",vt)}),Ae.optional(function(){$e.CHECK=Ge(Ae),$e.commandStr=Ae.guessCommand(),$e.command=Ge($e.commandStr),$e.assert=function(vt,Ve,kt){vt("if(!(",Ve,"))",this.CHECK,".commandRaise(",Ge(kt),",",this.command,");")},Nt.invalidBlendCombinations=Xc});var wt=$e.next={},xt=$e.current={};Object.keys(Fe).forEach(function(vt){Array.isArray(ge[vt])&&(wt[vt]=mt.def(Ut.next,".",vt),xt[vt]=mt.def(Ut.current,".",vt))});var At=$e.constants={};Object.keys(Nt).forEach(function(vt){At[vt]=mt.def(JSON.stringify(Nt[vt]))}),$e.invoke=function(vt,Ve){switch(Ve.type){case zf:var kt=["this",Ut.context,Ut.props,$e.batchId];return vt.def(Ge(Ve.data),".call(",kt.slice(0,Math.max(Ve.data.length+1,4)),")");case ks:return vt.def(Ut.props,Ve.data);case eu:return vt.def(Ut.context,Ve.data);case tu:return vt.def("this",Ve.data);case Tu:return Ve.data.append($e,vt),Ve.data.ref;case Mc:return Ve.data.toString();case Cc:return Ve.data.map(function(zt){return $e.invoke(vt,zt)})}},$e.attribCache={};var Ke={};return $e.scopeAttrib=function(vt){var Ve=We.id(vt);if(Ve in Ke)return Ke[Ve];var kt=Ar.scope[Ve];kt||(kt=Ar.scope[Ve]=new Y);var zt=Ke[Ve]=Ge(kt);return zt},$e}function Yr($e){var Ge=$e.static,mt=$e.dynamic,Gt;if(vs in Ge){var Ut=!!Ge[vs];Gt=ci(function(xt,At){return Ut}),Gt.enable=Ut}else if(vs in mt){var wt=mt[vs];Gt=Ri(wt,function(xt,At){return xt.invoke(At,wt)})}return Gt}function Pr($e,Ge){var mt=$e.static,Gt=$e.dynamic;if(Bs in mt){var Ut=mt[Bs];return Ut?(Ut=Mr.getFramebuffer(Ut),Ae.command(Ut,"invalid framebuffer object"),ci(function(xt,At){var Ke=xt.link(Ut),vt=xt.shared;At.set(vt.framebuffer,".next",Ke);var Ve=vt.context;return At.set(Ve,"."+ea,Ke+".width"),At.set(Ve,"."+Io,Ke+".height"),Ke})):ci(function(xt,At){var Ke=xt.shared;At.set(Ke.framebuffer,".next","null");var vt=Ke.context;return At.set(vt,"."+ea,vt+"."+Jf),At.set(vt,"."+Io,vt+"."+qf),"null"})}else if(Bs in Gt){var wt=Gt[Bs];return Ri(wt,function(xt,At){var Ke=xt.invoke(At,wt),vt=xt.shared,Ve=vt.framebuffer,kt=At.def(Ve,".getFramebuffer(",Ke,")");Ae.optional(function(){xt.assert(At,"!"+Ke+"||"+kt,"invalid framebuffer object")}),At.set(Ve,".next",kt);var zt=vt.context;return At.set(zt,"."+ea,kt+"?"+kt+".width:"+zt+"."+Jf),At.set(zt,"."+Io,kt+"?"+kt+".height:"+zt+"."+qf),kt})}else return null}function dn($e,Ge,mt){var Gt=$e.static,Ut=$e.dynamic;function wt(Ke){if(Ke in Gt){var vt=Gt[Ke];Ae.commandType(vt,"object","invalid "+Ke,mt.commandStr);var Ve=!0,kt=vt.x|0,zt=vt.y|0,vr,gr;return"width"in vt?(vr=vt.width|0,Ae.command(vr>=0,"invalid "+Ke,mt.commandStr)):Ve=!1,"height"in vt?(gr=vt.height|0,Ae.command(gr>=0,"invalid "+Ke,mt.commandStr)):Ve=!1,new Ji(!Ve&&Ge&&Ge.thisDep,!Ve&&Ge&&Ge.contextDep,!Ve&&Ge&&Ge.propDep,function(yn,Zn){var un=yn.shared.context,Dn=vr;"width"in vt||(Dn=Zn.def(un,".",ea,"-",kt));var jn=gr;return"height"in vt||(jn=Zn.def(un,".",Io,"-",zt)),[kt,zt,Dn,jn]})}else if(Ke in Ut){var ur=Ut[Ke],Lr=Ri(ur,function(yn,Zn){var un=yn.invoke(Zn,ur);Ae.optional(function(){yn.assert(Zn,un+"&&typeof "+un+'==="object"',"invalid "+Ke)});var Dn=yn.shared.context,jn=Zn.def(un,".x|0"),Sa=Zn.def(un,".y|0"),di=Zn.def('"width" in ',un,"?",un,".width|0:","(",Dn,".",ea,"-",jn,")"),qi=Zn.def('"height" in ',un,"?",un,".height|0:","(",Dn,".",Io,"-",Sa,")");return Ae.optional(function(){yn.assert(Zn,di+">=0&&"+qi+">=0","invalid "+Ke)}),[jn,Sa,di,qi]});return Ge&&(Lr.thisDep=Lr.thisDep||Ge.thisDep,Lr.contextDep=Lr.contextDep||Ge.contextDep,Lr.propDep=Lr.propDep||Ge.propDep),Lr}else return Ge?new Ji(Ge.thisDep,Ge.contextDep,Ge.propDep,function(yn,Zn){var un=yn.shared.context;return[0,0,Zn.def(un,".",ea),Zn.def(un,".",Io)]}):null}var xt=wt(Xo);if(xt){var At=xt;xt=new Ji(xt.thisDep,xt.contextDep,xt.propDep,function(Ke,vt){var Ve=At.append(Ke,vt),kt=Ke.shared.context;return vt.set(kt,"."+nu,Ve[2]),vt.set(kt,"."+Qf,Ve[3]),Ve})}return{viewport:xt,scissor_box:wt(Lu)}}function sn($e,Ge){var mt=$e.static,Gt=typeof mt[ru]=="string"&&typeof mt[gs]=="string";if(Gt){if(Object.keys(Ge.dynamic).length>0)return null;var Ut=Ge.static,wt=Object.keys(Ut);if(wt.length>0&&typeof Ut[wt[0]]=="number"){for(var xt=[],At=0;At=0,"invalid "+Ve,Ge.commandStr),ci(function(gr,ur){return kt&&(gr.OFFSET=zt),zt})}else if(Ve in Gt){var vr=Gt[Ve];return Ri(vr,function(gr,ur){var Lr=gr.invoke(ur,vr);return kt&&(gr.OFFSET=Lr,Ae.optional(function(){gr.assert(ur,Lr+">=0","invalid "+Ve)})),Lr})}else if(kt&&wt)return ci(function(gr,ur){return gr.OFFSET="0",0});return null}var Ke=At(Fs,!0);function vt(){if(wo in mt){var Ve=mt[wo]|0;return Ae.command(typeof Ve=="number"&&Ve>=0,"invalid vertex count",Ge.commandStr),ci(function(){return Ve})}else if(wo in Gt){var kt=Gt[wo];return Ri(kt,function(gr,ur){var Lr=gr.invoke(ur,kt);return Ae.optional(function(){gr.assert(ur,"typeof "+Lr+'==="number"&&'+Lr+">=0&&"+Lr+"===("+Lr+"|0)","invalid vertex count")}),Lr})}else if(wt)if(bs(wt)){if(wt)return Ke?new Ji(Ke.thisDep,Ke.contextDep,Ke.propDep,function(gr,ur){var Lr=ur.def(gr.ELEMENTS,".vertCount-",gr.OFFSET);return Ae.optional(function(){gr.assert(ur,Lr+">=0","invalid vertex offset/element buffer too small")}),Lr}):ci(function(gr,ur){return ur.def(gr.ELEMENTS,".vertCount")});var zt=ci(function(){return-1});return Ae.optional(function(){zt.MISSING=!0}),zt}else{var vr=new Ji(wt.thisDep||Ke.thisDep,wt.contextDep||Ke.contextDep,wt.propDep||Ke.propDep,function(gr,ur){var Lr=gr.ELEMENTS;return gr.OFFSET?ur.def(Lr,"?",Lr,".vertCount-",gr.OFFSET,":-1"):ur.def(Lr,"?",Lr,".vertCount:-1")});return Ae.optional(function(){vr.DYNAMIC=!0}),vr}return null}return{elements:wt,primitive:xt(),count:vt(),instances:At(df,!1),offset:Ke}}function Fn($e,Ge){var mt=$e.static,Gt=$e.dynamic,Ut={};return Le.forEach(function(wt){var xt=tt(wt);function At(Ke,vt){if(wt in mt){var Ve=Ke(mt[wt]);Ut[xt]=ci(function(){return Ve})}else if(wt in Gt){var kt=Gt[wt];Ut[xt]=Ri(kt,function(zt,vr){return vt(zt,vr,zt.invoke(vr,kt))})}}switch(wt){case gt:case Uf:case Tc:case Hf:case Xf:case gi:case ll:case dl:case hl:case Rs:return At(function(Ke){return Ae.commandType(Ke,"boolean",wt,Ge.commandStr),Ke},function(Ke,vt,Ve){return Ae.optional(function(){Ke.assert(vt,"typeof "+Ve+'==="boolean"',"invalid flag "+wt,Ke.commandStr)}),Ve});case Vf:return At(function(Ke){return Ae.commandParameter(Ke,uu,"invalid "+wt,Ge.commandStr),uu[Ke]},function(Ke,vt,Ve){var kt=Ke.constants.compareFuncs;return Ae.optional(function(){Ke.assert(vt,Ve+" in "+kt,"invalid "+wt+", must be one of "+Object.keys(uu))}),vt.def(kt,"[",Ve,"]")});case Iu:return At(function(Ke){return Ae.command(ka(Ke)&&Ke.length===2&&typeof Ke[0]=="number"&&typeof Ke[1]=="number"&&Ke[0]<=Ke[1],"depth range is 2d array",Ge.commandStr),Ke},function(Ke,vt,Ve){Ae.optional(function(){Ke.assert(vt,Ke.shared.isArrayLike+"("+Ve+")&&"+Ve+".length===2&&typeof "+Ve+'[0]==="number"&&typeof '+Ve+'[1]==="number"&&'+Ve+"[0]<="+Ve+"[1]","depth range must be a 2d array")});var kt=vt.def("+",Ve,"[0]"),zt=vt.def("+",Ve,"[1]");return[kt,zt]});case cf:return At(function(Ke){Ae.commandType(Ke,"object","blend.func",Ge.commandStr);var vt="srcRGB"in Ke?Ke.srcRGB:Ke.src,Ve="srcAlpha"in Ke?Ke.srcAlpha:Ke.src,kt="dstRGB"in Ke?Ke.dstRGB:Ke.dst,zt="dstAlpha"in Ke?Ke.dstAlpha:Ke.dst;return Ae.commandParameter(vt,pi,xt+".srcRGB",Ge.commandStr),Ae.commandParameter(Ve,pi,xt+".srcAlpha",Ge.commandStr),Ae.commandParameter(kt,pi,xt+".dstRGB",Ge.commandStr),Ae.commandParameter(zt,pi,xt+".dstAlpha",Ge.commandStr),Ae.command(Xc.indexOf(vt+", "+kt)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+vt+", "+kt+")",Ge.commandStr),[pi[vt],pi[kt],pi[Ve],pi[zt]]},function(Ke,vt,Ve){var kt=Ke.constants.blendFuncs;Ae.optional(function(){Ke.assert(vt,Ve+"&&typeof "+Ve+'==="object"',"invalid blend func, must be an object")});function zt(un,Dn){var jn=vt.def('"',un,Dn,'" in ',Ve,"?",Ve,".",un,Dn,":",Ve,".",un);return Ae.optional(function(){Ke.assert(vt,jn+" in "+kt,"invalid "+wt+"."+un+Dn+", must be one of "+Object.keys(pi))}),jn}var vr=zt("src","RGB"),gr=zt("dst","RGB");Ae.optional(function(){var un=Ke.constants.invalidBlendCombinations;Ke.assert(vt,un+".indexOf("+vr+'+", "+'+gr+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var ur=vt.def(kt,"[",vr,"]"),Lr=vt.def(kt,"[",zt("src","Alpha"),"]"),yn=vt.def(kt,"[",gr,"]"),Zn=vt.def(kt,"[",zt("dst","Alpha"),"]");return[ur,yn,Lr,Zn]});case jf:return At(function(Ke){if(typeof Ke=="string")return Ae.commandParameter(Ke,re,"invalid "+wt,Ge.commandStr),[re[Ke],re[Ke]];if(typeof Ke=="object")return Ae.commandParameter(Ke.rgb,re,wt+".rgb",Ge.commandStr),Ae.commandParameter(Ke.alpha,re,wt+".alpha",Ge.commandStr),[re[Ke.rgb],re[Ke.alpha]];Ae.commandRaise("invalid blend.equation",Ge.commandStr)},function(Ke,vt,Ve){var kt=Ke.constants.blendEquations,zt=vt.def(),vr=vt.def(),gr=Ke.cond("typeof ",Ve,'==="string"');return Ae.optional(function(){function ur(Lr,yn,Zn){Ke.assert(Lr,Zn+" in "+kt,"invalid "+yn+", must be one of "+Object.keys(re))}ur(gr.then,wt,Ve),Ke.assert(gr.else,Ve+"&&typeof "+Ve+'==="object"',"invalid "+wt),ur(gr.else,wt+".rgb",Ve+".rgb"),ur(gr.else,wt+".alpha",Ve+".alpha")}),gr.then(zt,"=",vr,"=",kt,"[",Ve,"];"),gr.else(zt,"=",kt,"[",Ve,".rgb];",vr,"=",kt,"[",Ve,".alpha];"),vt(gr),[zt,vr]});case Wf:return At(function(Ke){return Ae.command(ka(Ke)&&Ke.length===4,"blend.color must be a 4d array",Ge.commandStr),ln(4,function(vt){return+Ke[vt]})},function(Ke,vt,Ve){return Ae.optional(function(){Ke.assert(vt,Ke.shared.isArrayLike+"("+Ve+")&&"+Ve+".length===4","blend.color must be a 4d array")}),ln(4,function(kt){return vt.def("+",Ve,"[",kt,"]")})});case Oc:return At(function(Ke){return Ae.commandType(Ke,"number",xt,Ge.commandStr),Ke|0},function(Ke,vt,Ve){return Ae.optional(function(){Ke.assert(vt,"typeof "+Ve+'==="number"',"invalid stencil.mask")}),vt.def(Ve,"|0")});case Zf:return At(function(Ke){Ae.commandType(Ke,"object",xt,Ge.commandStr);var vt=Ke.cmp||"keep",Ve=Ke.ref||0,kt="mask"in Ke?Ke.mask:-1;return Ae.commandParameter(vt,uu,wt+".cmp",Ge.commandStr),Ae.commandType(Ve,"number",wt+".ref",Ge.commandStr),Ae.commandType(kt,"number",wt+".mask",Ge.commandStr),[uu[vt],Ve,kt]},function(Ke,vt,Ve){var kt=Ke.constants.compareFuncs;Ae.optional(function(){function ur(){Ke.assert(vt,Array.prototype.join.call(arguments,""),"invalid stencil.func")}ur(Ve+"&&typeof ",Ve,'==="object"'),ur('!("cmp" in ',Ve,")||(",Ve,".cmp in ",kt,")")});var zt=vt.def('"cmp" in ',Ve,"?",kt,"[",Ve,".cmp]",":",ms),vr=vt.def(Ve,".ref|0"),gr=vt.def('"mask" in ',Ve,"?",Ve,".mask|0:-1");return[zt,vr,gr]});case Mi:case Au:return At(function(Ke){Ae.commandType(Ke,"object",xt,Ge.commandStr);var vt=Ke.fail||"keep",Ve=Ke.zfail||"keep",kt=Ke.zpass||"keep";return Ae.commandParameter(vt,Es,wt+".fail",Ge.commandStr),Ae.commandParameter(Ve,Es,wt+".zfail",Ge.commandStr),Ae.commandParameter(kt,Es,wt+".zpass",Ge.commandStr),[wt===Au?ys:Bu,Es[vt],Es[Ve],Es[kt]]},function(Ke,vt,Ve){var kt=Ke.constants.stencilOps;Ae.optional(function(){Ke.assert(vt,Ve+"&&typeof "+Ve+'==="object"',"invalid "+wt)});function zt(vr){return Ae.optional(function(){Ke.assert(vt,'!("'+vr+'" in '+Ve+")||("+Ve+"."+vr+" in "+kt+")","invalid "+wt+"."+vr+", must be one of "+Object.keys(Es))}),vt.def('"',vr,'" in ',Ve,"?",kt,"[",Ve,".",vr,"]:",ms)}return[wt===Au?ys:Bu,zt("fail"),zt("zfail"),zt("zpass")]});case Ic:return At(function(Ke){Ae.commandType(Ke,"object",xt,Ge.commandStr);var vt=Ke.factor|0,Ve=Ke.units|0;return Ae.commandType(vt,"number",xt+".factor",Ge.commandStr),Ae.commandType(Ve,"number",xt+".units",Ge.commandStr),[vt,Ve]},function(Ke,vt,Ve){Ae.optional(function(){Ke.assert(vt,Ve+"&&typeof "+Ve+'==="object"',"invalid "+wt)});var kt=vt.def(Ve,".factor|0"),zt=vt.def(Ve,".units|0");return[kt,zt]});case cl:return At(function(Ke){var vt=0;return Ke==="front"?vt=Bu:Ke==="back"&&(vt=ys),Ae.command(!!vt,xt,Ge.commandStr),vt},function(Ke,vt,Ve){return Ae.optional(function(){Ke.assert(vt,Ve+'==="front"||'+Ve+'==="back"',"invalid cull.face")}),vt.def(Ve,'==="front"?',Bu,":",ys)});case Yf:return At(function(Ke){return Ae.command(typeof Ke=="number"&&Ke>=Zt.lineWidthDims[0]&&Ke<=Zt.lineWidthDims[1],"invalid line width, must be a positive number between "+Zt.lineWidthDims[0]+" and "+Zt.lineWidthDims[1],Ge.commandStr),Ke},function(Ke,vt,Ve){return Ae.optional(function(){Ke.assert(vt,"typeof "+Ve+'==="number"&&'+Ve+">="+Zt.lineWidthDims[0]+"&&"+Ve+"<="+Zt.lineWidthDims[1],"invalid line width")}),Ve});case Ou:return At(function(Ke){return Ae.commandParameter(Ke,Fu,xt,Ge.commandStr),Fu[Ke]},function(Ke,vt,Ve){return Ae.optional(function(){Ke.assert(vt,Ve+'==="cw"||'+Ve+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),vt.def(Ve+'==="cw"?'+Uc+":"+su)});case Oi:return At(function(Ke){return Ae.command(ka(Ke)&&Ke.length===4,"color.mask must be length 4 array",Ge.commandStr),Ke.map(function(vt){return!!vt})},function(Ke,vt,Ve){return Ae.optional(function(){Ke.assert(vt,Ke.shared.isArrayLike+"("+Ve+")&&"+Ve+".length===4","invalid color.mask")}),ln(4,function(kt){return"!!"+Ve+"["+kt+"]"})});case lf:return At(function(Ke){Ae.command(typeof Ke=="object"&&Ke,xt,Ge.commandStr);var vt="value"in Ke?Ke.value:1,Ve=!!Ke.invert;return Ae.command(typeof vt=="number"&&vt>=0&&vt<=1,"sample.coverage.value must be a number between 0 and 1",Ge.commandStr),[vt,Ve]},function(Ke,vt,Ve){Ae.optional(function(){Ke.assert(vt,Ve+"&&typeof "+Ve+'==="object"',"invalid sample.coverage")});var kt=vt.def('"value" in ',Ve,"?+",Ve,".value:1"),zt=vt.def("!!",Ve,".invert");return[kt,zt]})}}),Ut}function za($e,Ge){var mt=$e.static,Gt=$e.dynamic,Ut={};return Object.keys(mt).forEach(function(wt){var xt=mt[wt],At;if(typeof xt=="number"||typeof xt=="boolean")At=ci(function(){return xt});else if(typeof xt=="function"){var Ke=xt._reglType;Ke==="texture2d"||Ke==="textureCube"?At=ci(function(vt){return vt.link(xt)}):Ke==="framebuffer"||Ke==="framebufferCube"?(Ae.command(xt.color.length>0,'missing color attachment for framebuffer sent to uniform "'+wt+'"',Ge.commandStr),At=ci(function(vt){return vt.link(xt.color[0])})):Ae.commandRaise('invalid data for uniform "'+wt+'"',Ge.commandStr)}else ka(xt)?At=ci(function(vt){var Ve=vt.global.def("[",ln(xt.length,function(kt){return Ae.command(typeof xt[kt]=="number"||typeof xt[kt]=="boolean","invalid uniform "+wt,vt.commandStr),xt[kt]}),"]");return Ve}):Ae.commandRaise('invalid or missing data for uniform "'+wt+'"',Ge.commandStr);At.value=xt,Ut[wt]=At}),Object.keys(Gt).forEach(function(wt){var xt=Gt[wt];Ut[wt]=Ri(xt,function(At,Ke){return At.invoke(Ke,xt)})}),Ut}function Wn($e,Ge){var mt=$e.static,Gt=$e.dynamic,Ut={};return Object.keys(mt).forEach(function(wt){var xt=mt[wt],At=We.id(wt),Ke=new Y;if(Gu(xt))Ke.state=so,Ke.buffer=dr.getBuffer(dr.create(xt,Gs,!1,!0)),Ke.type=0;else{var vt=dr.getBuffer(xt);if(vt)Ke.state=so,Ke.buffer=vt,Ke.type=0;else if(Ae.command(typeof xt=="object"&&xt,"invalid data for attribute "+wt,Ge.commandStr),"constant"in xt){var Ve=xt.constant;Ke.buffer="null",Ke.state=Ps,typeof Ve=="number"?Ke.x=Ve:(Ae.command(ka(Ve)&&Ve.length>0&&Ve.length<=4,"invalid constant for attribute "+wt,Ge.commandStr),Cu.forEach(function(yn,Zn){Zn=0,'invalid offset for attribute "'+wt+'"',Ge.commandStr);var zt=xt.stride|0;Ae.command(zt>=0&&zt<256,'invalid stride for attribute "'+wt+'", must be integer betweeen [0, 255]',Ge.commandStr);var vr=xt.size|0;Ae.command(!("size"in xt)||vr>0&&vr<=4,'invalid size for attribute "'+wt+'", must be 1,2,3,4',Ge.commandStr);var gr=!!xt.normalized,ur=0;"type"in xt&&(Ae.commandParameter(xt.type,Hi,"invalid type for attribute "+wt,Ge.commandStr),ur=Hi[xt.type]);var Lr=xt.divisor|0;"divisor"in xt&&(Ae.command(Lr===0||ie,'cannot specify divisor for attribute "'+wt+'", instancing not supported',Ge.commandStr),Ae.command(Lr>=0,'invalid divisor for attribute "'+wt+'"',Ge.commandStr)),Ae.optional(function(){var yn=Ge.commandStr,Zn=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(xt).forEach(function(un){Ae.command(Zn.indexOf(un)>=0,'unknown parameter "'+un+'" for attribute pointer "'+wt+'" (valid parameters are '+Zn+")",yn)})}),Ke.buffer=vt,Ke.state=so,Ke.size=vr,Ke.normalized=gr,Ke.type=ur||vt.dtype,Ke.offset=kt,Ke.stride=zt,Ke.divisor=Lr}}Ut[wt]=ci(function(yn,Zn){var un=yn.attribCache;if(At in un)return un[At];var Dn={isStream:!1};return Object.keys(Ke).forEach(function(jn){Dn[jn]=Ke[jn]}),Ke.buffer&&(Dn.buffer=yn.link(Ke.buffer),Dn.type=Dn.type||Dn.buffer+".dtype"),un[At]=Dn,Dn})}),Object.keys(Gt).forEach(function(wt){var xt=Gt[wt];function At(Ke,vt){var Ve=Ke.invoke(vt,xt),kt=Ke.shared,zt=Ke.constants,vr=kt.isBufferArgs,gr=kt.buffer;Ae.optional(function(){Ke.assert(vt,Ve+"&&(typeof "+Ve+'==="object"||typeof '+Ve+'==="function")&&('+vr+"("+Ve+")||"+gr+".getBuffer("+Ve+")||"+gr+".getBuffer("+Ve+".buffer)||"+vr+"("+Ve+'.buffer)||("constant" in '+Ve+"&&(typeof "+Ve+'.constant==="number"||'+kt.isArrayLike+"("+Ve+".constant))))",'invalid dynamic attribute "'+wt+'"')});var ur={isStream:vt.def(!1)},Lr=new Y;Lr.state=so,Object.keys(Lr).forEach(function(Dn){ur[Dn]=vt.def(""+Lr[Dn])});var yn=ur.buffer,Zn=ur.type;vt("if(",vr,"(",Ve,")){",ur.isStream,"=true;",yn,"=",gr,".createStream(",Gs,",",Ve,");",Zn,"=",yn,".dtype;","}else{",yn,"=",gr,".getBuffer(",Ve,");","if(",yn,"){",Zn,"=",yn,".dtype;",'}else if("constant" in ',Ve,"){",ur.state,"=",Ps,";","if(typeof "+Ve+'.constant === "number"){',ur[Cu[0]],"=",Ve,".constant;",Cu.slice(1).map(function(Dn){return ur[Dn]}).join("="),"=0;","}else{",Cu.map(function(Dn,jn){return ur[Dn]+"="+Ve+".constant.length>"+jn+"?"+Ve+".constant["+jn+"]:0;"}).join(""),"}}else{","if(",vr,"(",Ve,".buffer)){",yn,"=",gr,".createStream(",Gs,",",Ve,".buffer);","}else{",yn,"=",gr,".getBuffer(",Ve,".buffer);","}",Zn,'="type" in ',Ve,"?",zt.glTypes,"[",Ve,".type]:",yn,".dtype;",ur.normalized,"=!!",Ve,".normalized;");function un(Dn){vt(ur[Dn],"=",Ve,".",Dn,"|0;")}return un("size"),un("offset"),un("stride"),un("divisor"),vt("}}"),vt.exit("if(",ur.isStream,"){",gr,".destroyStream(",yn,");","}"),ur}Ut[wt]=Ri(xt,At)}),Ut}function ti($e,Ge){var mt=$e.static,Gt=$e.dynamic;if(Du in mt){var Ut=mt[Du];return Ut!==null&&Ar.getVAO(Ut)===null&&(Ut=Ar.createVAO(Ut)),ci(function(xt){return xt.link(Ar.getVAO(Ut))})}else if(Du in Gt){var wt=Gt[Du];return Ri(wt,function(xt,At){var Ke=xt.invoke(At,wt);return At.def(xt.shared.vao+".getVAO("+Ke+")")})}return null}function La($e){var Ge=$e.static,mt=$e.dynamic,Gt={};return Object.keys(Ge).forEach(function(Ut){var wt=Ge[Ut];Gt[Ut]=ci(function(xt,At){return typeof wt=="number"||typeof wt=="boolean"?""+wt:xt.link(wt)})}),Object.keys(mt).forEach(function(Ut){var wt=mt[Ut];Gt[Ut]=Ri(wt,function(xt,At){return xt.invoke(At,wt)})}),Gt}function oa($e,Ge,mt,Gt,Ut){var wt=$e.static,xt=$e.dynamic;Ae.optional(function(){var un=[Bs,gs,ru,ps,ra,Fs,wo,df,vs,Du].concat(Le);function Dn(jn){Object.keys(jn).forEach(function(Sa){Ae.command(un.indexOf(Sa)>=0,'unknown parameter "'+Sa+'"',Ut.commandStr)})}Dn(wt),Dn(xt)});var At=sn($e,Ge),Ke=Pr($e,Ut),vt=dn($e,Ke,Ut),Ve=Bn($e,Ut),kt=Fn($e,Ut),zt=tn($e,Ut,At);function vr(un){var Dn=vt[un];Dn&&(kt[un]=Dn)}vr(Xo),vr(tt(Lu));var gr=Object.keys(kt).length>0,ur={framebuffer:Ke,draw:Ve,shader:zt,state:kt,dirty:gr,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(ur.profile=Yr($e,Ut),ur.uniforms=za(mt,Ut),ur.drawVAO=ur.scopeVAO=ti($e,Ut),!ur.drawVAO&&zt.program&&!At&&it.angle_instanced_arrays){var Lr=!0,yn=zt.program.attributes.map(function(un){var Dn=Ge.static[un];return Lr=Lr&&!!Dn,Dn});if(Lr&&yn.length>0){var Zn=Ar.getVAO(Ar.createVAO(yn));ur.drawVAO=new Ji(null,null,null,function(un,Dn){return un.link(Zn)}),ur.useVAO=!0}}return At?ur.useVAO=!0:ur.attributes=Wn(Ge,Ut),ur.context=La(Gt,Ut),ur}function Za($e,Ge,mt){var Gt=$e.shared,Ut=Gt.context,wt=$e.scope();Object.keys(mt).forEach(function(xt){Ge.save(Ut,"."+xt);var At=mt[xt],Ke=At.append($e,Ge);Array.isArray(Ke)?wt(Ut,".",xt,"=[",Ke.join(),"];"):wt(Ut,".",xt,"=",Ke,";")}),Ge(wt)}function ri($e,Ge,mt,Gt){var Ut=$e.shared,wt=Ut.gl,xt=Ut.framebuffer,At;le&&(At=Ge.def(Ut.extensions,".webgl_draw_buffers"));var Ke=$e.constants,vt=Ke.drawBuffer,Ve=Ke.backBuffer,kt;mt?kt=mt.append($e,Ge):kt=Ge.def(xt,".next"),Gt||Ge("if(",kt,"!==",xt,".cur){"),Ge("if(",kt,"){",wt,".bindFramebuffer(",jc,",",kt,".framebuffer);"),le&&Ge(At,".drawBuffersWEBGL(",vt,"[",kt,".colorAttachments.length]);"),Ge("}else{",wt,".bindFramebuffer(",jc,",null);"),le&&Ge(At,".drawBuffersWEBGL(",Ve,");"),Ge("}",xt,".cur=",kt,";"),Gt||Ge("}")}function li($e,Ge,mt){var Gt=$e.shared,Ut=Gt.gl,wt=$e.current,xt=$e.next,At=Gt.current,Ke=Gt.next,vt=$e.cond(At,".dirty");Le.forEach(function(Ve){var kt=tt(Ve);if(!(kt in mt.state)){var zt,vr;if(kt in xt){zt=xt[kt],vr=wt[kt];var gr=ln(ge[kt].length,function(Lr){return vt.def(zt,"[",Lr,"]")});vt($e.cond(gr.map(function(Lr,yn){return Lr+"!=="+vr+"["+yn+"]"}).join("||")).then(Ut,".",Fe[kt],"(",gr,");",gr.map(function(Lr,yn){return vr+"["+yn+"]="+Lr}).join(";"),";"))}else{zt=vt.def(Ke,".",kt);var ur=$e.cond(zt,"!==",At,".",kt);vt(ur),kt in ze?ur($e.cond(zt).then(Ut,".enable(",ze[kt],");").else(Ut,".disable(",ze[kt],");"),At,".",kt,"=",zt,";"):ur(Ut,".",Fe[kt],"(",zt,");",At,".",kt,"=",zt,";")}}}),Object.keys(mt.state).length===0&&vt(At,".dirty=false;"),Ge(vt)}function ii($e,Ge,mt,Gt){var Ut=$e.shared,wt=$e.current,xt=Ut.current,At=Ut.gl;Yc(Object.keys(mt)).forEach(function(Ke){var vt=mt[Ke];if(!(Gt&&!Gt(vt))){var Ve=vt.append($e,Ge);if(ze[Ke]){var kt=ze[Ke];bs(vt)?Ve?Ge(At,".enable(",kt,");"):Ge(At,".disable(",kt,");"):Ge($e.cond(Ve).then(At,".enable(",kt,");").else(At,".disable(",kt,");")),Ge(xt,".",Ke,"=",Ve,";")}else if(ka(Ve)){var zt=wt[Ke];Ge(At,".",Fe[Ke],"(",Ve,");",Ve.map(function(vr,gr){return zt+"["+gr+"]="+vr}).join(";"),";")}else Ge(At,".",Fe[Ke],"(",Ve,");",xt,".",Ke,"=",Ve,";")}})}function Pa($e,Ge){ie&&($e.instancing=Ge.def($e.shared.extensions,".angle_instanced_arrays"))}function Hn($e,Ge,mt,Gt,Ut){var wt=$e.shared,xt=$e.stats,At=wt.current,Ke=wt.timer,vt=mt.profile;function Ve(){return typeof performance=="undefined"?"Date.now()":"performance.now()"}var kt,zt;function vr(un){kt=Ge.def(),un(kt,"=",Ve(),";"),typeof Ut=="string"?un(xt,".count+=",Ut,";"):un(xt,".count++;"),M&&(Gt?(zt=Ge.def(),un(zt,"=",Ke,".getNumPendingQueries();")):un(Ke,".beginQuery(",xt,");"))}function gr(un){un(xt,".cpuTime+=",Ve(),"-",kt,";"),M&&(Gt?un(Ke,".pushScopeStats(",zt,",",Ke,".getNumPendingQueries(),",xt,");"):un(Ke,".endQuery();"))}function ur(un){var Dn=Ge.def(At,".profile");Ge(At,".profile=",un,";"),Ge.exit(At,".profile=",Dn,";")}var Lr;if(vt){if(bs(vt)){vt.enable?(vr(Ge),gr(Ge.exit),ur("true")):ur("false");return}Lr=vt.append($e,Ge),ur(Lr)}else Lr=Ge.def(At,".profile");var yn=$e.block();vr(yn),Ge("if(",Lr,"){",yn,"}");var Zn=$e.block();gr(Zn),Ge.exit("if(",Lr,"){",Zn,"}")}function Bi($e,Ge,mt,Gt,Ut){var wt=$e.shared;function xt(Ke){switch(Ke){case Pu:case gf:case yf:return 2;case Us:case pf:case mf:return 3;case vf:case Ws:case ku:return 4;default:return 1}}function At(Ke,vt,Ve){var kt=wt.gl,zt=Ge.def(Ke,".location"),vr=Ge.def(wt.attributes,"[",zt,"]"),gr=Ve.state,ur=Ve.buffer,Lr=[Ve.x,Ve.y,Ve.z,Ve.w],yn=["buffer","normalized","offset","stride"];function Zn(){Ge("if(!",vr,".buffer){",kt,".enableVertexAttribArray(",zt,");}");var Dn=Ve.type,jn;if(Ve.size?jn=Ge.def(Ve.size,"||",vt):jn=vt,Ge("if(",vr,".type!==",Dn,"||",vr,".size!==",jn,"||",yn.map(function(di){return vr+"."+di+"!=="+Ve[di]}).join("||"),"){",kt,".bindBuffer(",Gs,",",ur,".buffer);",kt,".vertexAttribPointer(",[zt,jn,Dn,Ve.normalized,Ve.stride,Ve.offset],");",vr,".type=",Dn,";",vr,".size=",jn,";",yn.map(function(di){return vr+"."+di+"="+Ve[di]+";"}).join(""),"}"),ie){var Sa=Ve.divisor;Ge("if(",vr,".divisor!==",Sa,"){",$e.instancing,".vertexAttribDivisorANGLE(",[zt,Sa],");",vr,".divisor=",Sa,";}")}}function un(){Ge("if(",vr,".buffer){",kt,".disableVertexAttribArray(",zt,");",vr,".buffer=null;","}if(",Cu.map(function(Dn,jn){return vr+"."+Dn+"!=="+Lr[jn]}).join("||"),"){",kt,".vertexAttrib4f(",zt,",",Lr,");",Cu.map(function(Dn,jn){return vr+"."+Dn+"="+Lr[jn]+";"}).join(""),"}")}gr===so?Zn():gr===Ps?un():(Ge("if(",gr,"===",so,"){"),Zn(),Ge("}else{"),un(),Ge("}"))}Gt.forEach(function(Ke){var vt=Ke.name,Ve=mt.attributes[vt],kt;if(Ve){if(!Ut(Ve))return;kt=Ve.append($e,Ge)}else{if(!Ut(Ef))return;var zt=$e.scopeAttrib(vt);Ae.optional(function(){$e.assert(Ge,zt+".state","missing attribute "+vt)}),kt={},Object.keys(new Y).forEach(function(vr){kt[vr]=Ge.def(zt,".",vr)})}At($e.link(Ke),xt(Ke.info.type),kt)})}function Ln($e,Ge,mt,Gt,Ut){for(var wt=$e.shared,xt=wt.gl,At,Ke=0;Ke1?Ge(ln(Dn,function(qi){return Array.isArray(ur)?ur[qi]:ur+"["+qi+"]"})):(Ae(!Array.isArray(ur),"uniform value must not be an array"),Ge(ur));Ge(");")}}function On($e,Ge,mt,Gt){var Ut=$e.shared,wt=Ut.gl,xt=Ut.draw,At=Gt.draw;function Ke(){var jn=At.elements,Sa,di=Ge;return jn?((jn.contextDep&&Gt.contextDynamic||jn.propDep)&&(di=mt),Sa=jn.append($e,di)):Sa=di.def(xt,".",ps),Sa&&di("if("+Sa+")"+wt+".bindBuffer("+Lc+","+Sa+".buffer.buffer);"),Sa}function vt(){var jn=At.count,Sa,di=Ge;return jn?((jn.contextDep&&Gt.contextDynamic||jn.propDep)&&(di=mt),Sa=jn.append($e,di),Ae.optional(function(){jn.MISSING&&$e.assert(Ge,"false","missing vertex count"),jn.DYNAMIC&&$e.assert(di,Sa+">=0","missing vertex count")})):(Sa=di.def(xt,".",wo),Ae.optional(function(){$e.assert(di,Sa+">=0","missing vertex count")})),Sa}var Ve=Ke();function kt(jn){var Sa=At[jn];return Sa?Sa.contextDep&&Gt.contextDynamic||Sa.propDep?Sa.append($e,mt):Sa.append($e,Ge):Ge.def(xt,".",jn)}var zt=kt(ra),vr=kt(Fs),gr=vt();if(typeof gr=="number"){if(gr===0)return}else mt("if(",gr,"){"),mt.exit("}");var ur,Lr;ie&&(ur=kt(df),Lr=$e.instancing);var yn=Ve+".type",Zn=At.elements&&bs(At.elements);function un(){function jn(){mt(Lr,".drawElementsInstancedANGLE(",[zt,gr,yn,vr+"<<(("+yn+"-"+_c+")>>1)",ur],");")}function Sa(){mt(Lr,".drawArraysInstancedANGLE(",[zt,vr,gr,ur],");")}Ve?Zn?jn():(mt("if(",Ve,"){"),jn(),mt("}else{"),Sa(),mt("}")):Sa()}function Dn(){function jn(){mt(wt+".drawElements("+[zt,gr,yn,vr+"<<(("+yn+"-"+_c+")>>1)"]+");")}function Sa(){mt(wt+".drawArrays("+[zt,vr,gr]+");")}Ve?Zn?jn():(mt("if(",Ve,"){"),jn(),mt("}else{"),Sa(),mt("}")):Sa()}ie&&(typeof ur!="number"||ur>=0)?typeof ur=="string"?(mt("if(",ur,">0){"),un(),mt("}else if(",ur,"<0){"),Dn(),mt("}")):un():Dn()}function sa($e,Ge,mt,Gt,Ut){var wt=_r(),xt=wt.proc("body",Ut);return Ae.optional(function(){wt.commandStr=Ge.commandStr,wt.command=wt.link(Ge.commandStr)}),ie&&(wt.instancing=xt.def(wt.shared.extensions,".angle_instanced_arrays")),$e(wt,xt,mt,Gt),wt.compile().body}function ba($e,Ge,mt,Gt){Pa($e,Ge),mt.useVAO?mt.drawVAO?Ge($e.shared.vao,".setVAO(",mt.drawVAO.append($e,Ge),");"):Ge($e.shared.vao,".setVAO(",$e.shared.vao,".targetVAO);"):(Ge($e.shared.vao,".setVAO(null);"),Bi($e,Ge,mt,Gt.attributes,function(){return!0})),Ln($e,Ge,mt,Gt.uniforms,function(){return!0}),On($e,Ge,Ge,mt)}function yi($e,Ge){var mt=$e.proc("draw",1);Pa($e,mt),Za($e,mt,Ge.context),ri($e,mt,Ge.framebuffer),li($e,mt,Ge),ii($e,mt,Ge.state),Hn($e,mt,Ge,!1,!0);var Gt=Ge.shader.progVar.append($e,mt);if(mt($e.shared.gl,".useProgram(",Gt,".program);"),Ge.shader.program)ba($e,mt,Ge,Ge.shader.program);else{mt($e.shared.vao,".setVAO(null);");var Ut=$e.global.def("{}"),wt=mt.def(Gt,".id"),xt=mt.def(Ut,"[",wt,"]");mt($e.cond(xt).then(xt,".call(this,a0);").else(xt,"=",Ut,"[",wt,"]=",$e.link(function(At){return sa(ba,$e,Ge,At,1)}),"(",Gt,");",xt,".call(this,a0);"))}Object.keys(Ge.state).length>0&&mt($e.shared.current,".dirty=true;")}function Ho($e,Ge,mt,Gt){$e.batchId="a1",Pa($e,Ge);function Ut(){return!0}Bi($e,Ge,mt,Gt.attributes,Ut),Ln($e,Ge,mt,Gt.uniforms,Ut),On($e,Ge,Ge,mt)}function Uu($e,Ge,mt,Gt){Pa($e,Ge);var Ut=mt.contextDep,wt=Ge.def(),xt="a0",At="a1",Ke=Ge.def();$e.shared.props=Ke,$e.batchId=wt;var vt=$e.scope(),Ve=$e.scope();Ge(vt.entry,"for(",wt,"=0;",wt,"<",At,";++",wt,"){",Ke,"=",xt,"[",wt,"];",Ve,"}",vt.exit);function kt(yn){return yn.contextDep&&Ut||yn.propDep}function zt(yn){return!kt(yn)}if(mt.needsContext&&Za($e,Ve,mt.context),mt.needsFramebuffer&&ri($e,Ve,mt.framebuffer),ii($e,Ve,mt.state,kt),mt.profile&&kt(mt.profile)&&Hn($e,Ve,mt,!1,!0),Gt)mt.useVAO?mt.drawVAO?kt(mt.drawVAO)?Ve($e.shared.vao,".setVAO(",mt.drawVAO.append($e,Ve),");"):vt($e.shared.vao,".setVAO(",mt.drawVAO.append($e,vt),");"):vt($e.shared.vao,".setVAO(",$e.shared.vao,".targetVAO);"):(vt($e.shared.vao,".setVAO(null);"),Bi($e,vt,mt,Gt.attributes,zt),Bi($e,Ve,mt,Gt.attributes,kt)),Ln($e,vt,mt,Gt.uniforms,zt),Ln($e,Ve,mt,Gt.uniforms,kt),On($e,vt,Ve,mt);else{var vr=$e.global.def("{}"),gr=mt.shader.progVar.append($e,Ve),ur=Ve.def(gr,".id"),Lr=Ve.def(vr,"[",ur,"]");Ve($e.shared.gl,".useProgram(",gr,".program);","if(!",Lr,"){",Lr,"=",vr,"[",ur,"]=",$e.link(function(yn){return sa(Ho,$e,mt,yn,2)}),"(",gr,");}",Lr,".call(this,a0[",wt,"],",wt,");")}}function et($e,Ge){var mt=$e.proc("batch",2);$e.batchId="0",Pa($e,mt);var Gt=!1,Ut=!0;Object.keys(Ge.context).forEach(function(vr){Gt=Gt||Ge.context[vr].propDep}),Gt||(Za($e,mt,Ge.context),Ut=!1);var wt=Ge.framebuffer,xt=!1;wt?(wt.propDep?Gt=xt=!0:wt.contextDep&&Gt&&(xt=!0),xt||ri($e,mt,wt)):ri($e,mt,null),Ge.state.viewport&&Ge.state.viewport.propDep&&(Gt=!0);function At(vr){return vr.contextDep&&Gt||vr.propDep}li($e,mt,Ge),ii($e,mt,Ge.state,function(vr){return!At(vr)}),(!Ge.profile||!At(Ge.profile))&&Hn($e,mt,Ge,!1,"a1"),Ge.contextDep=Gt,Ge.needsContext=Ut,Ge.needsFramebuffer=xt;var Ke=Ge.shader.progVar;if(Ke.contextDep&&Gt||Ke.propDep)Uu($e,mt,Ge,null);else{var vt=Ke.append($e,mt);if(mt($e.shared.gl,".useProgram(",vt,".program);"),Ge.shader.program)Uu($e,mt,Ge,Ge.shader.program);else{mt($e.shared.vao,".setVAO(null);");var Ve=$e.global.def("{}"),kt=mt.def(vt,".id"),zt=mt.def(Ve,"[",kt,"]");mt($e.cond(zt).then(zt,".call(this,a0,a1);").else(zt,"=",Ve,"[",kt,"]=",$e.link(function(vr){return sa(Uu,$e,Ge,vr,2)}),"(",vt,");",zt,".call(this,a0,a1);"))}}Object.keys(Ge.state).length>0&&mt($e.shared.current,".dirty=true;")}function Jt($e,Ge){var mt=$e.proc("scope",3);$e.batchId="a2";var Gt=$e.shared,Ut=Gt.current;Za($e,mt,Ge.context),Ge.framebuffer&&Ge.framebuffer.append($e,mt),Yc(Object.keys(Ge.state)).forEach(function(xt){var At=Ge.state[xt],Ke=At.append($e,mt);ka(Ke)?Ke.forEach(function(vt,Ve){mt.set($e.next[xt],"["+Ve+"]",vt)}):mt.set(Gt.next,"."+xt,Ke)}),Hn($e,mt,Ge,!0,!0),[ps,Fs,wo,df,ra].forEach(function(xt){var At=Ge.draw[xt];!At||mt.set(Gt.draw,"."+xt,""+At.append($e,mt))}),Object.keys(Ge.uniforms).forEach(function(xt){var At=Ge.uniforms[xt].append($e,mt);Array.isArray(At)&&(At="["+At.join()+"]"),mt.set(Gt.uniforms,"["+We.id(xt)+"]",At)}),Object.keys(Ge.attributes).forEach(function(xt){var At=Ge.attributes[xt].append($e,mt),Ke=$e.scopeAttrib(xt);Object.keys(new Y).forEach(function(vt){mt.set(Ke,"."+vt,At[vt])})}),Ge.scopeVAO&&mt.set(Gt.vao,".targetVAO",Ge.scopeVAO.append($e,mt));function wt(xt){var At=Ge.shader[xt];At&&mt.set(Gt.shader,"."+xt,At.append($e,mt))}wt(gs),wt(ru),Object.keys(Ge.state).length>0&&(mt(Ut,".dirty=true;"),mt.exit(Ut,".dirty=true;")),mt("a1(",$e.shared.context,",a0,",$e.batchId,");")}function jt($e){if(!(typeof $e!="object"||ka($e))){for(var Ge=Object.keys($e),mt=0;mt=0;--On){var sa=Lt[On];sa&&sa(M,null,0)}it.flush(),Ar&&Ar.update()}function tn(){!dn&&Lt.length>0&&(dn=Er.next(sn))}function Bn(){dn&&(Er.cancel(sn),dn=null)}function Fn(On){On.preventDefault(),dr=!0,Bn(),_r.forEach(function(sa){sa()})}function za(On){it.getError(),dr=!1,Yt.restore(),Le.restore(),ie.restore(),ze.restore(),Fe.restore(),tt.restore(),le.restore(),Ar&&Ar.restore(),Mt.procs.refresh(),tn(),Yr.forEach(function(sa){sa()})}Nt&&(Nt.addEventListener(bf,Fn,!1),Nt.addEventListener(xf,za,!1));function Wn(){Lt.length=0,Bn(),Nt&&(Nt.removeEventListener(bf,Fn),Nt.removeEventListener(xf,za)),Le.clear(),tt.clear(),Fe.clear(),ze.clear(),me.clear(),ie.clear(),le.clear(),Ar&&Ar.clear(),Pr.forEach(function(On){On()})}function ti(On){Ae(!!On,"invalid args to regl({...})"),Ae.type(On,"object","invalid args to regl({...})");function sa(Ut){var wt=z({},Ut);delete wt.uniforms,delete wt.attributes,delete wt.context,delete wt.vao,"stencil"in wt&&wt.stencil.op&&(wt.stencil.opBack=wt.stencil.opFront=wt.stencil.op,delete wt.stencil.op);function xt(At){if(At in wt){var Ke=wt[At];delete wt[At],Object.keys(Ke).forEach(function(vt){wt[At+"."+vt]=Ke[vt]})}}return xt("blend"),xt("depth"),xt("cull"),xt("stencil"),xt("polygonOffset"),xt("scissor"),xt("sample"),"vao"in Ut&&(wt.vao=Ut.vao),wt}function ba(Ut,wt){var xt={},At={};return Object.keys(Ut).forEach(function(Ke){var vt=Ut[Ke];if(Wt.isDynamic(vt)){At[Ke]=Wt.unbox(vt,Ke);return}else if(wt&&Array.isArray(vt)){for(var Ve=0;Ve0)return aa.call(this,mt(Ut|0),Ut|0)}else if(Array.isArray(Ut)){if(Ut.length)return aa.call(this,Ut,Ut.length)}else return nn.call(this,Ut)}return z(Gt,{stats:Jt,destroy:function(){jt.destroy()}})}var La=tt.setFBO=ti({framebuffer:Wt.define.call(null,Zc,"framebuffer")});function oa(On,sa){var ba=0;Mt.procs.poll();var yi=sa.color;yi&&(it.clearColor(+yi[0]||0,+yi[1]||0,+yi[2]||0,+yi[3]||0),ba|=Sl),"depth"in sa&&(it.clearDepth(+sa.depth),ba|=_l),"stencil"in sa&&(it.clearStencil(sa.stencil|0),ba|=ac),Ae(!!ba,"called regl.clear with no buffer specified"),it.clear(ba)}function Za(On){if(Ae(typeof On=="object"&&On,"regl.clear() takes an object as input"),"framebuffer"in On)if(On.framebuffer&&On.framebuffer_reglType==="framebufferCube")for(var sa=0;sa<6;++sa)La(z({framebuffer:On.framebuffer.faces[sa]},On),oa);else La(On,oa);else oa(null,On)}function ri(On){Ae.type(On,"function","regl.frame() callback must be a function"),Lt.push(On);function sa(){var ba=Kc(Lt,On);Ae(ba>=0,"cannot cancel a frame twice");function yi(){var Ho=Kc(Lt,yi);Lt[Ho]=Lt[Lt.length-1],Lt.length-=1,Lt.length<=0&&Bn()}Lt[ba]=yi}return tn(),{cancel:sa}}function li(){var On=Tt.viewport,sa=Tt.scissor_box;On[0]=On[1]=sa[0]=sa[1]=0,M.viewportWidth=M.framebufferWidth=M.drawingBufferWidth=On[2]=sa[2]=it.drawingBufferWidth,M.viewportHeight=M.framebufferHeight=M.drawingBufferHeight=On[3]=sa[3]=it.drawingBufferHeight}function ii(){M.tick+=1,M.time=Hn(),li(),Mt.procs.poll()}function Pa(){ze.refresh(),li(),Mt.procs.refresh(),Ar&&Ar.update()}function Hn(){return(Dr()-Tr)/1e3}Pa();function Bi(On,sa){Ae.type(sa,"function","listener callback must be a function");var ba;switch(On){case"frame":return ri(sa);case"lost":ba=_r;break;case"restore":ba=Yr;break;case"destroy":ba=Pr;break;default:Ae.raise("invalid event, must be one of frame,lost,restore,destroy")}return ba.push(sa),{cancel:function(){for(var yi=0;yi=0},read:sr,destroy:Wn,_gl:it,_refresh:Pa,poll:function(){ii(),Ar&&Ar.update()},now:Hn,stats:Mr});return We.onDone(null,Ln),Ln}return wf})},86851:function(or,U,z){"use strict";var B=z(89594),j=Array.prototype.concat,R=Array.prototype.slice,A=or.exports=function(L){for(var y=[],x=0,v=L.length;x=0&&(z.splice instanceof Function||Object.getOwnPropertyDescriptor(z,z.length-1)&&z.constructor.name!=="String")}}}]);