25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1157 lines
1.5 MiB

  1. (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[6349],{20474:function(dt,x,M){"use strict";M.d(x,{Z:function(){return dp}});var S={};M.r(S),M.d(S,{GADDI:function(){return Co},Stack:function(){return Ea},breadthFirstSearch:function(){return Vt},connectedComponent:function(){return ke},cosineSimilarity:function(){return Ne},default:function(){return _u},depthFirstSearch:function(){return Mt},detectAllCycles:function(){return U},detectAllDirectedCycle:function(){return ut},detectAllUndirectedCycle:function(){return Ge},detectCycle:function(){return he},detectDirectedCycle:function(){return gs},dijkstra:function(){return ct},findAllPath:function(){return Lt},findShortestPath:function(){return jt},floydWarshall:function(){return vr},getAdjMatrix:function(){return re},getDegree:function(){return we},getInDegree:function(){return Be},getNeighbors:function(){return Ve},getOutDegree:function(){return We},iLouvain:function(){return be},kCore:function(){return j},kMeans:function(){return te},labelPropagation:function(){return at},louvain:function(){return bt},minimumSpanningTree:function(){return ye},nodesCosineSimilarity:function(){return Ke},pageRank:function(){return Ct}});var B={};M.r(B),M.d(B,{Line:function(){return pi},applyMatrix:function(){return Do},compare:function(){return vo},distance:function(){return Jo},floydWarshall:function(){return Za},fractionToLine:function(){return au},getAdjMatrix:function(){return ms},getBBoxBoundLine:function(){return Fs},getCircleCenterByPoints:function(){return ua},getCircleIntersectByPoint:function(){return ys},getDegree:function(){return eo},getEllipseIntersectByPoint:function(){return Nn},getLineIntersect:function(){return Bs},getPointsCenter:function(){return po},getRectIntersectByPoint:function(){return ru},intersectBBox:function(){return nu},invertMatrix:function(){return Qu},isPointInPolygon:function(){return ts},isPointsOverlap:function(){return Ra},isPolygonsIntersect:function(){return Es},itemIntersectByLine:function(){return Ha},lerp:function(){return fa},lerpArray:function(){return na},move:function(){return xa},pointLineDistance:function(){return li},pointLineSquareDist:function(){return to},pointRectSquareDist:function(){return Ao},rotate:function(){return qo},scale:function(){return Pa},scaleMatrix:function(){return Gs},squareDist:function(){return ca},translate:function(){return bs}});var N={};M.r(N),M.d(N,{cloneBesidesImg:function(){return Ss},getAnimateCfgWithCallback:function(){return Bo},getBBox:function(){return Ro},getComboBBox:function(){return ko},getLabelPosition:function(){return fl},getLetterWidth:function(){return ec},getLoopCfgs:function(){return cl},getTextSize:function(){return tc},plainCombosToTrees:function(){return su},reconstructTree:function(){return uu},shouldRefreshEdge:function(){return rc},traverseTree:function(){return Fa},traverseTreeUp:function(){return ao},truncateLabelByLength:function(){return bo}});var E={};M.r(E),M.d(E,{calculationItemsBBox:function(){return wu},cloneEvent:function(){return Dc},formatPadding:function(){return Su},isNaN:function(){return is},isViewportChanged:function(){return oo},processParallelEdges:function(){return hl},uniqueId:function(){return ns}});var I={};M.r(I),M.d(I,{getClosedSpline:function(){return Of},getControlPoint:function(){return fc},getSpline:function(){return gi},paddedHull:function(){return Fo},pathToPoints:function(){return lu},pointsToPolygon:function(){return Sl},roundedHull:function(){return Nf}});var A={};M.r(A),M.d(A,{defaultSubjectColors:function(){return id}});var v={};M.r(v),M.d(v,{getColorSetsBySubjectColors:function(){return Vs},getColorsWithSubjectColor:function(){return As},mixColor:function(){return ia}});var p={};M.r(p),M.d(p,{arrayToTextureData:function(){return Fl},attributesToTextureData:function(){return yu},buildTextureData:function(){return ef},buildTextureDataWithOneEdgeAttr:function(){return Xo},buildTextureDataWithTwoEdgeAttr:function(){return Gl},proccessToFunc:function(){return gu},radialLayout:function(){return ds}});var c={};M.r(c),M.d(c,{gpuDetector:function(){return Uu}});var f=M(67294),l=M(24561),T=function(h){var t=h.loadingTemplate,e=function(){return t||f.createElement(l.ZP,{viewBox:"0 0 400 180",width:200,height:90,speed:1},f.createElement("rect",{x:"20",y:"5",rx:"0",ry:"0",width:"1",height:"170"}),f.createElement("rect",{x:"20",y:"175",rx:"0",ry:"0",width:"360",height:"1"}),f.createElement("rect",{x:"40",y:"75",rx:"0",ry:"0",width:"35",height:"100"}),f.createElement("rect",{x:"80",y:"125",rx:"0",ry:"0",width:"35",height:"50"}),f.createElement("rect",{x:"120",y:"105",rx:"0",ry:"0",width:"35",height:"70"}),f.createElement("rect",{x:"160",y:"35",rx:"0",ry:"0",width:"35",height:"140"}),f.createElement("rect",{x:"200",y:"55",rx:"0",ry:"0",width:"35",height:"120"}),f.createElement("rect",{x:"240",y:"15",rx:"0",ry:"0",width:"35",height:"160"}),f.createElement("rect",{x:"280",y:"135",rx:"0",ry:"0",width:"35",height:"40"}),f.createElement("rect",{x:"320",y:"85",rx:"0",ry:"0",width:"35",height:"90"}))};return f.createElement("div",{style:{position:"absolute",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",left:0,top:0,zIndex:99,backgroundColor:"#fff"}},e())},m=T,w=function(){var h=function(t,e){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),O=function(h){w(t,h);function t(){var e=h!==null&&h.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||f.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):f.createElement(f.Fragment,null,this.props.children)},t}(f.Component),D=O,g=M(70655),_=M(49242),Y={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,_.each)(r,function(n,i){t.on(i,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,_.each)(e,function(n,i){t.off(i,n)}),t.get("canvas").set("draggable",r)},get:function(t){return this[t]},set:function(t,e){return this[t]=e,this}},V=function(){function h(){}return h.registerBehavior=function(t,e){if(!e)throw new Error("please specify handler for this behavior: ".concat(t));var r=(0,_.clone)(Y);Object.assign(r,e);var n=function(a){var o=this;Object.assign(this,this.getDefaultCfg(),a);var s=this.getEvents();this.events=null;var d={};s&&((0,_.each)(s,function(y,C){d[C]=(0,_.wrapBehavior)(o,y)}),this.events=d)};n.prototype=r,h.types[t]=n},h.hasBehavior=function(t){return!!h.types[t]},h.getBehavior=function(t){return h.types[t]},h.types={},h}(),z=V,Z=z,J=M(90494),ee=M(31506),Q=function(t,e){var r=t.nodes,n=t.edges,i=[],a={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(function(o,s){a[o.id]=s;var d=[];i.push(d)}),n&&n.forEach(function(o){var s=o.source,d=o.target,y=a[s],C=a[d];!y&&y!==0||!C&&C!==0||(i[y][C]=1,e||(i[C][y]=1))}),i},re=Q,fe=function(t,e){return t===e},me=function(){function h(t,e){e===void 0&&(e=null),this.value=t,this.next=e}return h.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},h}(),ae=function(){function h(t){t===void 0&&(t=fe),this.head=null,this.tail=null,this.compare=t}return h.prototype.prepend=function(t){var e=new me(t,this.head);return this.head=e,this.tail||(this.tail=e),this},h.prototype.append=function(t){var e=new me(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},h.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},h.prototype.find=function(t){var e=t.value,r=e===void 0?void 0:e,n=t.callback,i=n===void 0?void 0:n;if(!this.head)return null;for(var a=this.head;a;){if(i&&i(a.value)||r!==void 0&&this.compare(a.value,r))return a;a=a.next}return null},h.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},h.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},h.prototype.fromArray=function(t){var e=this;return t.forEach(function(r){return e.append(r)}),this},h.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},h.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},h.prototype.toString=function(t){return t===void 0&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},h}(),Ee=ae,Le=function(){function h(){this.linkedList=new Ee}return h.prototype.isEmpty=function(){return!this.linkedList.head},h.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},h.prototype.enqueue=function(t){this.linkedList.append(t)},h.prototype.dequeue=function(){var t=this.linkedList.deleteHead();return t?t.value:null},h.prototype.toString=function(t){return this.linkedList.toString(t)},h}(),De=Le,Ve=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 i=function(d){return d.source===t};return n.filter(i).map(function(s){return s.target})}if(r==="source"){var a=function(d){return d.target===t};return n.filter(a).map(function(s){return s.source})}var o=function(d){return d.source===t?d.target:d.source};return n.map(o)},et=function(t,e){return e.filter(function(r){return r.source===t})},It=function(t,e){return e.filter(function(r){return r.source===t||r.target===t})},er=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 nr(h){h===void 0&&(h={});var t=h,e=function(){},r=function(){var n={};return function(i){var a=i.next,o=a;return n[o]?!1:(n[o]=!0,!0)}}();return t.allowTraversal=h.allowTraversal||r,t.enter=h.enter||e,t.leave=h.leave||e,t}var Fe=function(t,e,r,n){n===void 0&&(n=!0);var i=nr(r),a=new De,o=t.edges,s=o===void 0?[]:o;a.enqueue(e);for(var d="",y=function(){var F=a.dequeue();i.enter({current:F,previous:d}),Ve(F,s,n?"target":void 0).forEach(function(G){i.allowTraversal({previous:d,current:F,next:G})&&a.enqueue(G)}),i.leave({current:F,previous:d}),d=F};!a.isEmpty();)y()},Vt=Fe,$t=function(t){for(var e=t.nodes,r=e===void 0?[]:e,n=t.edges,i=n===void 0?[]:n,a=[],o={},s=[],d=function G(H){s.push(H),o[H.id]=!0;for(var ie=Ve(H.id,i),se=function(xe){var Ie=ie[xe];if(!o[Ie]){var qe=r.filter(function(ze){return ze.id===Ie});qe.length>0&&G(qe[0])}},ce=0;ce<ie.length;++ce)se(ce)},y=0;y<r.length;y++){var C=r[y];if(!o[C.id]){d(C);for(var F=[];s.length>0;)F.push(s.pop());a.push(F)}}return a},Ar=function(t){for(var e=t.nodes,r=e===void 0?[]:e,n=t.edges,i=n===void 0?[]:n,a=[],o={},s={},d={},y=[],C=0,F=function se(ce){s[ce.id]=C,d[ce.id]=C,C+=1,a.push(ce),o[ce.id]=!0;for(var de=Ve(ce.id,i,"target").filter(function($e){return r.map(function(mt){return mt.id}).indexOf($e)>-1}),xe=function(mt){var xt=de[mt];if(!s[xt]&&s[xt]!==0){var wt=r.filter(function(Yt){return Yt.id===xt});wt.length>0&&se(wt[0]),d[ce.id]=Math.min(d[ce.id],d[xt])}else o[xt]&&(d[ce.id]=Math.min(d[ce.id],s[xt]))},Ie=0;Ie<de.length;Ie++)xe(Ie);if(d[ce.id]===s[ce.id]){for(var qe=[];a.length>0;){var ze=a.pop();if(o[ze.id]=!1,qe.push(ze),ze===ce)break}qe.length>0&&y.push(qe)}},G=0,H=r;G<H.length;G++){var ie=H[G];!s[ie.id]&&s[ie.id]!==0&&F(ie)}return y};function ke(h,t){return t?Ar(h):$t(h)}var Oe=function(t){var e={},r=t.nodes,n=r===void 0?[]:r,i=t.edges,a=i===void 0?[]:i;return n.forEach(function(o){e[o.id]={degree:0,inDegree:0,outDegree:0}}),a.forEach(function(o){e[o.source].degree++,e[o.source].outDegree++,e[o.target].degree++,e[o.target].inDegree++}),e},we=Oe,Be=function(t,e){var r=Oe(t);return r[e]?Oe(t)[e].inDegree:0},We=function(t,e){var r=Oe(t);return r[e]?Oe(t)[e].outDegree:0};function He(h){h===void 0&&(h={});var t=h,e=function(){},r=function(){var n={};return function(i){var a=i.next;return n[a]?!1:(n[a]=!0,!0)}}();return t.allowTraversal=h.allowTraversal||r,t.enter=h.enter||e,t.leave=h.leave||e,t}function St(h,t,e,r){r.enter({current:t,previous:e});var n=h.edges,i=n===void 0?[]:n;Ve(t,i,"target").forEach(function(a){r.allowTraversal({previous:e,current:t,next:a})&&St(h,a,t,r)}),r.leave({current:t,previous:e})}function Mt(h,t,e){St(h,t,"",He(e))}var sr=function(t){var e=null,r=t.nodes,n=r===void 0?[]:r,i={},a={},o={},s={};n.forEach(function(C){a[C.id]=C});for(var d={enter:function(F){var G=F.current,H=F.previous;if(o[G]){e={};for(var ie=G,se=H;se!==G;)e[ie]=se,ie=se,se=i[se];e[ie]=se}else o[G]=G,delete a[G],i[G]=H},leave:function(F){var G=F.current;s[G]=G,delete o[G]},allowTraversal:function(F){var G=F.next;return e?!1:!s[G]}};Object.keys(a).length;){var y=Object.keys(a)[0];Mt(t,y,d)}return e},Ge=function(t,e,r){var n,i;r===void 0&&(r=!0);for(var a=[],o=ke(t,!1),s=0,d=o;s<d.length;s++){var y=d[s];if(!!y.length)for(var C=y[0],F=C.id,G=[C],H=(n={},n[F]=C,n),ie=(i={},i[F]=new Set,i);G.length>0;)for(var se=G.pop(),ce=se.id,de=Ve(ce,t.edges),xe=function(ze){var $e,mt=de[ze],xt=t.nodes.find(function(Ur){return Ur.id===mt});if(mt===ce)a.push(($e={},$e[mt]=se,$e));else if(!(mt in ie))H[mt]=se,G.push(xt),ie[mt]=new Set([se]);else if(!ie[ce].has(xt)){for(var wt=!0,Yt=[xt,se],Zt=H[ce];ie[mt].size&&!ie[mt].has(Zt)&&(Yt.push(Zt),Zt!==H[Zt.id]);)Zt=H[Zt.id];if(Yt.push(Zt),e&&r?(wt=!1,Yt.findIndex(function(Ur){return e.indexOf(Ur.id)>-1})>-1&&(wt=!0)):e&&!r&&Yt.findIndex(function(Ur){return e.indexOf(Ur.id)>-1})>-1&&(wt=!1),wt){for(var Er={},Fr=1;Fr<Yt.length;Fr+=1)Er[Yt[Fr-1].id]=Yt[Fr];Yt.length&&(Er[Yt[Yt.length-1].id]=Yt[0]),a.push(Er)}ie[mt].add(se)}},Ie=0;Ie<de.length;Ie+=1)xe(Ie)}return a},ut=function(t,e,r){r===void 0&&(r=!0);for(var n=[],i=new Set,a=[],o=[],s={},d={},y=function(Zt){for(var Er=[Zt];Er.length>0;){var Fr=Er.pop();i.has(Fr)&&(i.delete(Fr),a[Fr.id].forEach(function(Ur){Er.push(Ur)}),a[Fr.id].clear())}},C=function Yt(Zt,Er,Fr){var Ur=!1;if(e&&r===!1&&e.indexOf(Zt.id)>-1)return Ur;n.push(Zt),i.add(Zt);for(var Or=Fr[Zt.id],hn=0;hn<Or.length;hn+=1){var sn=s[Or[hn]];if(sn===Er){for(var Ir={},en=1;en<n.length;en+=1)Ir[n[en-1].id]=n[en];n.length&&(Ir[n[n.length-1].id]=n[0]),o.push(Ir),Ur=!0}else i.has(sn)||Yt(sn,Er,Fr)&&(Ur=!0)}if(Ur)y(Zt);else for(var hn=0;hn<Or.length;hn+=1){var sn=s[Or[hn]];a[sn.id].has(Zt)||a[sn.id].add(Zt)}return n.pop(),Ur},F=t.nodes,G=F===void 0?[]:F,H=0;H<G.length;H+=1){var ie=G[H],se=ie.id;d[se]=H,s[H]=ie}if(e&&r)for(var ce=function(Zt){var Er=e[Zt];d[G[Zt].id]=d[Er],d[Er]=0,s[0]=G.find(function(Fr){return Fr.id===Er}),s[d[G[Zt].id]]=G[Zt]},H=0;H<e.length;H++)ce(H);for(var de=function(Zt){for(var Er,Fr,Ur=Infinity,Or=0;Or<Zt.length;Or+=1)for(var hn=Zt[Or],sn=0;sn<hn.length;sn++){var Ir=d[hn[sn].id];Ir<Ur&&(Ur=Ir,Fr=Or)}for(var en=Zt[Fr],un=[],Or=0;Or<en.length;Or+=1){var fn=en[Or];un[fn.id]=[];for(var pn=0,Tn=Ve(fn.id,t.edges,"target").filter(function(xi){return en.map(function(ui){return ui.id}).indexOf(xi)>-1});pn<Tn.length;pn++){var Zn=Tn[pn];Zn===fn.id&&!(r===!1&&e.indexOf(fn.id)>-1)?o.push((Er={},Er[fn.id]=fn,Er)):un[fn.id].push(d[Zn])}}return{component:en,adjList:un,minIdx:Ur}},xe=0;xe<G.length;){var Ie=G.filter(function(Yt){return d[Yt.id]>=xe}),qe=Ar({nodes:Ie,edges:t.edges}).filter(function(Yt){return Yt.length>1});if(qe.length===0)break;var ze=de(qe),$e=ze.minIdx,mt=ze.adjList,xt=ze.component;if(xt.length>1){xt.forEach(function(Yt){a[Yt.id]=new Set});var wt=s[$e];if(e&&r&&e.indexOf(wt.id)===-1)return o;C(wt,wt,mt),xe=$e+1}else break}return o},U=function(t,e,r,n){return n===void 0&&(n=!0),e?ut(t,r,n):Ge(t,r,n)},he=sr,Qe=function(t,e,r){for(var n=Infinity,i,a=0;a<e.length;a++){var o=e[a].id;!r[o]&&t[o]<=n&&(n=t[o],i=e[a])}return i},le=function(t,e,r,n){var i=t.nodes,a=i===void 0?[]:i,o=t.edges,s=o===void 0?[]:o,d=[],y={},C={},F={};a.forEach(function(xe,Ie){var qe=xe.id;d.push(qe),C[qe]=Infinity,qe===e&&(C[qe]=0)});for(var G=a.length,H=function(Ie){var qe=Qe(C,a,y),ze=qe.id;if(y[ze]=!0,C[ze]===Infinity)return"continue";var $e=[];r?$e=et(ze,s):$e=It(ze,s),$e.forEach(function(mt){var xt=mt.target,wt=mt.source,Yt=xt===ze?wt:xt,Zt=n&&mt[n]?mt[n]:1;C[Yt]>C[qe.id]+Zt?(C[Yt]=C[qe.id]+Zt,F[Yt]=[qe.id]):C[Yt]===C[qe.id]+Zt&&F[Yt].push(qe.id)})},ie=0;ie<G;ie++)H(ie);F[e]=[e];var se={};for(var ce in C)C[ce]!==Infinity&&ft(e,ce,F,se);var de={};for(var ce in se)de[ce]=se[ce][0];return{length:C,path:de,allPath:se}},ct=le;function ft(h,t,e,r){if(h===t)return[h];if(r[t])return r[t];for(var n=[],i=0,a=e[t];i<a.length;i++){var o=a[i],s=ft(h,o,e,r);if(!s)return;for(var d=0,y=s;d<y.length;d++){var C=y[d];(0,_.isArray)(C)?n.push((0,g.__spreadArray)((0,g.__spreadArray)([],C,!0),[t],!1)):n.push([C,t])}}return r[t]=n,r[t]}var jt=function(t,e,r,n,i){var a=ct(t,e,n,i),o=a.length,s=a.path,d=a.allPath;return{length:o[r],path:s[r],allPath:d[r]}},Lt=function(t,e,r,n){var i;if(e===r)return[[e]];var a=t.edges,o=a===void 0?[]:a,s=[e],d=(i={},i[e]=!0,i),y=[],C=[],F=n?Ve(e,o,"target"):Ve(e,o);for(y.push(F);s.length>0&&y.length>0;){var G=y[y.length-1];if(G.length){var H=G.shift();H&&(s.push(H),d[H]=!0,F=n?Ve(H,o,"target"):Ve(H,o),y.push(F.filter(function(ce){return!d[ce]})))}else{var ie=s.pop();d[ie]=!1,y.pop();continue}if(s[s.length-1]===r){var se=s.map(function(de){return de});C.push(se);var ie=s.pop();d[ie]=!1,y.pop()}}return C},Ht=function(t,e){for(var r=re(t,e),n=[],i=r.length,a=0;a<i;a+=1){n[a]=[];for(var o=0;o<i;o+=1)a===o?n[a][o]=0:r[a][o]===0||!r[a][o]?n[a][o]=Infinity:n[a][o]=r[a][o]}for(var s=0;s<i;s+=1)for(var a=0;a<i;a+=1)for(var o=0;o<i;o+=1)n[a][o]>n[a][s]+n[s][o]&&(n[a][o]=n[a][s]+n[s][o]);return n},vr=Ht,rt=function(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r="weight"),n===void 0&&(n=1e3);var i=t.nodes,a=i===void 0?[]:i,o=t.edges,s=o===void 0?[]:o,d={},y={};a.forEach(function(Ie,qe){var ze=er();Ie.clusterId=ze,d[ze]={id:ze,nodes:[Ie]},y[Ie.id]={node:Ie,idx:qe}});var C=re(t,e),F=[],G={};C.forEach(function(Ie,qe){var ze=0,$e=a[qe].id;G[$e]={},Ie.forEach(function(mt,xt){if(!!mt){ze+=mt;var wt=a[xt].id;G[$e][wt]=mt}}),F.push(ze)});for(var H=0,ie=function(){var qe=!1;if(a.forEach(function(ze){var $e={};Object.keys(G[ze.id]).forEach(function(Ur){var Or=G[ze.id][Ur],hn=y[Ur].node,sn=hn.clusterId;$e[sn]||($e[sn]=0),$e[sn]+=Or});var mt=-Infinity,xt=[];if(Object.keys($e).forEach(function(Ur){mt<$e[Ur]?(mt=$e[Ur],xt=[Ur]):mt===$e[Ur]&&xt.push(Ur)}),!(xt.length===1&&xt[0]===ze.clusterId)){var wt=xt.indexOf(ze.clusterId);if(wt>=0&&xt.splice(wt,1),xt&&xt.length){qe=!0;var Yt=d[ze.clusterId],Zt=Yt.nodes.indexOf(ze);Yt.nodes.splice(Zt,1);var Er=Math.floor(Math.random()*xt.length),Fr=d[xt[Er]];Fr.nodes.push(ze),ze.clusterId=Fr.id}}}),!qe)return"break";H++};H<n;){var se=ie();if(se==="break")break}Object.keys(d).forEach(function(Ie){var qe=d[Ie];(!qe.nodes||!qe.nodes.length)&&delete d[Ie]});var ce=[],de={};s.forEach(function(Ie){var qe=Ie.source,ze=Ie.target,$e=Ie[r]||1,mt=y[qe].node.clusterId,xt=y[ze].node.clusterId,wt="".concat(mt,"---").concat(xt);if(de[wt])de[wt].weight+=$e,de[wt].count++;else{var Yt={source:mt,target:xt,weight:$e,count:1};de[wt]=Yt,ce.push(Yt)}});var xe=[];return Object.keys(d).forEach(function(Ie){xe.push(d[Ie])}),{clusters:xe,clusterEdges:ce}},at=rt,Pt=function(){function h(t){this.arr=t}return h.prototype.getArr=function(){return this.arr||[]},h.prototype.add=function(t){var e,r=t.arr;if(!((e=this.arr)===null||e===void 0?void 0:e.length))return new h(r);if(!(r==null?void 0:r.length))return new h(this.arr);if(this.arr.length===r.length){var n=[];for(var i in this.arr)n[i]=this.arr[i]+r[i];return new h(n)}},h.prototype.subtract=function(t){var e,r=t.arr;if(!((e=this.arr)===null||e===void 0?void 0:e.length))return new h(r);if(!(r==null?void 0:r.length))return new h(this.arr);if(this.arr.length===r.length){var n=[];for(var i in this.arr)n[i]=this.arr[i]-r[i];return new h(n)}},h.prototype.avg=function(t){var e=[];if(t!==0)for(var r in this.arr)e[r]=this.arr[r]/t;return new h(e)},h.prototype.negate=function(){var t=[];for(var e in this.arr)t[e]=-this.arr[e];return new h(t)},h.prototype.squareEuclideanDistance=function(t){var e,r=t.arr;if(!((e=this.arr)===null||e===void 0?void 0:e.length)||!(r==null?void 0:r.length))return 0;if(this.arr.length===r.length){var n=0;for(var i in this.arr)n+=Math.pow(this.arr[i]-t.arr[i],2);return n}},h.prototype.euclideanDistance=function(t){var e,r=t.arr;if(!((e=this.arr)===null||e===void 0?void 0:e.length)||!(r==null?void 0:r.length))return 0;if(this.arr.length===r.length){var n=0;for(var i in this.arr)n+=Math.pow(this.arr[i]-t.arr[i],2);return Math.sqrt(n)}else console.error("The two vectors are unequal in length.")},h.prototype.normalize=function(){var t=[],e=(0,_.clone)(this.arr);e.sort(function(a,o){return a-o});var r=e[e.length-1],n=e[0];for(var i in this.arr)t[i]=(this.arr[i]-n)/(r-n);return new h(t)},h.prototype.norm2=function(){var t;if(!((t=this.arr)===null||t===void 0?void 0:t.length))return 0;var e=0;for(var r in this.arr)e+=Math.pow(this.arr[r],2);return Math.sqrt(e)},h.prototype.dot=function(t){var e,r=t.arr;if(!((e=this.arr)===null||e===void 0?void 0:e.length)||!(r==null?void 0:r.length))return 0;if(this.arr.length===r.length){var n=0;for(var i in this.arr)n+=this.arr[i]*t.arr[i];return n}else console.error("The two vectors are unequal in length.")},h.prototype.equal=function(t){var e,r=t.arr;if(((e=this.arr)===null||e===void 0?void 0:e.length)!==(r==null?void 0:r.length))return!1;for(var n in this.arr)if(this.arr[n]!==r[n])return!1;return!0},h}(),gt=Pt,Dt=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/,ir=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/,At=function(t,e){t===void 0&&(t=[]),e===void 0&&(e=100);var r={};t.forEach(function(i){!i.properties||Object.keys(i.properties).forEach(function(a){if(a==="id"||!"".concat(i.properties[a]).match(Dt)&&!"".concat(i.properties[a]).match(ir)&&isNaN(Number(i.properties[a]))){r.hasOwnProperty(a)&&delete r[a];return}r.hasOwnProperty(a)?r[a]+=1:r[a]=1})});var n=Object.keys(r).sort(function(i,a){return r[a]-r[i]});return n.length<e?n:n.slice(0,e)},xr=function(t,e){return e.map(function(r){return t.hasOwnProperty(r)?t[r]:0})},Pr=function(t){for(var e=At(t),r=[],n=0;n<t.length;n++)r[n]=xr(t[n].properties,e);return r},Qr=function(t,e){e===void 0&&(e=void 0);var r=[];return t.forEach(function(n){e===void 0&&r.push(n),n[e]!==void 0&&r.push(n[e])}),r},Vr={getAllSortProperties:At,getPropertyWeight:Pr,getAllProperties:Qr},nn;(function(h){h.EuclideanDistance="euclideanDistance"})(nn||(nn={}));var dn=function(t,e,r){var n=[];(e==null?void 0:e.length)?n=e:(t.forEach(function(a){n=n.concat(Object.keys(a))}),n=(0,_.uniq)(n));var i={};return n.forEach(function(a){var o=[];t.forEach(function(s){s[a]!==void 0&&s[a]!==""&&o.push(s[a])}),o.length&&!(r==null?void 0:r.includes(a))&&(i[a]=(0,_.uniq)(o))}),i},Vn=function(t,e,r){var n=dn(t,e,r),i=[];if(!Object.keys(n).length)return i;var a=Object.values(n),o=a.every(function(s){return s.every(function(d){return typeof d=="number"})});return t.forEach(function(s,d){var y=[];Object.keys(n).forEach(function(C){var F=s[C],G=n[C],H=G.findIndex(function(ce){return F===ce}),ie=[];if(o)ie.push(F);else for(var se=0;se<G.length;se++)se===H?ie.push(1):ie.push(0);y=y.concat(ie)}),i[d]=y}),i},cn=function(t,e,r,n){r===void 0&&(r=nn.EuclideanDistance);var i=0;switch(r){case nn.EuclideanDistance:i=new gt(t).euclideanDistance(new gt(e));break;default:break}return i},wn={getAllKeyValueMap:dn,oneHot:Vn,getDistance:cn},xn=function(t,e,r,n){for(var i=e.length,a=2*n,o=0,s=0;s<i;s++)for(var d=t[s].clusterId,y=0;y<i;y++){var C=t[y].clusterId;if(d===C){var F=e[s][y]||0,G=r[s]||0,H=r[y]||0;o+=F-G*H/a}}return o*=1/a,o},gn=function(t,e){t===void 0&&(t=[]);for(var r=t.length,n=new gt([]),i=0;i<r;i++)n=n.add(new gt(e[i]));var a=n.avg(r);a.normalize();for(var o=0,i=0;i<r;i++){var s=new gt(e[i]),d=s.squareEuclideanDistance(a);o+=d}var y=[];t.forEach(function(){y.push([])});for(var i=0;i<r;i++){var s=new gt(e[i]);t[i].clusterInertial=0;for(var C=0;C<r;C++){if(i===C){y[i][C]=0;continue}var F=new gt(e[C]);y[i][C]=s.squareEuclideanDistance(F),t[i].clusterInertial+=y[i][C]}}for(var G=0,H=2*r*o,i=0;i<r;i++)for(var ie=t[i].clusterId,C=0;C<r;C++){var se=t[C].clusterId;if(!(i===C||ie!==se)){var ce=t[i].clusterInertial*t[C].clusterInertial/Math.pow(H,2)-y[i][C]/H;G+=ce}}return Number(G.toFixed(4))},Un=function(t,e,r,n,i,a,o,s,d){e===void 0&&(e=!1),r===void 0&&(r="weight"),n===void 0&&(n=1e-4),i===void 0&&(i=!1),a===void 0&&(a=void 0),o===void 0&&(o=[]),s===void 0&&(s=["id"]),d===void 0&&(d=1);var y=t.nodes,C=y===void 0?[]:y,F=t.edges,G=F===void 0?[]:F,H=[];if(i){C.forEach(function(Ir,en){Ir.properties=Ir.properties||{},Ir.originIndex=en});var ie=[];C.every(function(Ir){return Ir.hasOwnProperty("nodeType")})&&(ie=Array.from(new Set(C.map(function(Ir){return Ir.nodeType}))),C.forEach(function(Ir){Ir.properties.nodeType=ie.findIndex(function(en){return en===Ir.nodeType})}));var se=Qr(C,a);H=Vn(se,o,s)}var ce=1,de={},xe={};C.forEach(function(Ir,en){var un=String(ce++);Ir.clusterId=un,de[un]={id:un,nodes:[Ir]},xe[Ir.id]={node:Ir,idx:en}});var Ie=re(t,e),qe=[],ze={},$e=0;Ie.forEach(function(Ir,en){var un=0,fn=C[en].id;ze[fn]={},Ir.forEach(function(pn,Tn){if(!!pn){un+=pn;var Zn=C[Tn].id;ze[fn][Zn]=pn,$e+=pn}}),qe.push(un)}),$e/=2;for(var mt=Infinity,xt=Infinity,wt=0,Yt=[],Zt={};;){i&&C.every(function(Ir){return Ir.hasOwnProperty("properties")})?mt=xn(C,Ie,qe,$e)+gn(C,H)*d:mt=xn(C,Ie,qe,$e),wt===0&&(xt=mt,Yt=C,Zt=de);var Er=mt>0&&mt>xt&&mt-xt<n;if(mt>xt&&(Yt=C.map(function(Ir){return{node:Ir,clusterId:Ir.clusterId}}),Zt=(0,_.clone)(de),xt=mt),Er||wt>100)break;wt++,Object.keys(de).forEach(function(Ir){var en=0;G.forEach(function(un){var fn=un.source,pn=un.target,Tn=xe[fn].node.clusterId,Zn=xe[pn].node.clusterId;(Tn===Ir&&Zn!==Ir||Zn===Ir&&Tn!==Ir)&&(en=en+(un[r]||1))}),de[Ir].sumTot=en}),C.forEach(function(Ir,en){var un=de[Ir.clusterId],fn=0,pn,Tn=qe[en]/(2*$e),Zn=0,ii=un.nodes;ii.forEach(function(Qi){var Ui=xe[Qi.id].idx;Zn+=Ie[en][Ui]||0});var xi=Zn-un.sumTot*Tn,ui=ii.filter(function(Qi){return Qi.id!==Ir.id}),ji=[];ui.forEach(function(Qi,Ui){ji[Ui]=H[Qi.originIndex]});var Gi=gn(ui,H)*d,Ta=ze[Ir.id];if(Object.keys(Ta).forEach(function(Qi){var Ui=xe[Qi].node,ja=Ui.clusterId;if(ja!==Ir.clusterId){var Va=de[ja],Ko=Va.nodes;if(!(!Ko||!Ko.length)){var bi=0;Ko.forEach(function(Pi){var wi=xe[Pi.id].idx;bi+=Ie[en][wi]||0});var Si=bi-Va.sumTot*Tn,Ci=Ko.concat([Ir]),Ni=[];Ci.forEach(function(Pi,wi){Ni[wi]=H[Pi.originIndex]});var ta=gn(Ci,H)*d,Wn=Si-xi;i&&(Wn=Si+ta-(xi+Gi)),Wn>fn&&(fn=Wn,pn=Va)}}}),fn>0){pn.nodes.push(Ir);var Fi=Ir.clusterId;Ir.clusterId=pn.id;var ya=un.nodes.indexOf(Ir);un.nodes.splice(ya,1);var ma=0,So=0;G.forEach(function(Qi){var Ui=Qi.source,ja=Qi.target,Va=xe[Ui].node.clusterId,Ko=xe[ja].node.clusterId;(Va===pn.id&&Ko!==pn.id||Ko===pn.id&&Va!==pn.id)&&(ma=ma+(Qi[r]||1)),(Va===Fi&&Ko!==Fi||Ko===Fi&&Va!==Fi)&&(So=So+(Qi[r]||1))}),pn.sumTot=ma,un.sumTot=So}})}var Fr={},Ur=0;Object.keys(Zt).forEach(function(Ir){var en=Zt[Ir];if(!en.nodes||!en.nodes.length){delete Zt[Ir];return}var un=String(Ur+1);un!==Ir&&(en.id=un,en.nodes=en.nodes.map(function(fn){return{id:fn.id,clusterId:un}}),Zt[un]=en,Fr[Ir]=un,delete Zt[Ir],Ur++)}),Yt.forEach(function(Ir){var en=Ir.node,un=Ir.clusterId;!en||(en.clusterId=un,en.clusterId&&Fr[en.clusterId]&&(en.clusterId=Fr[en.clusterId]))});var Or=[],hn={};G.forEach(function(Ir){var en=Ir.source,un=Ir.target,fn=Ir[r]||1,pn=xe[en].node.clusterId,Tn=xe[un].node.clusterId;if(!(!pn||!Tn)){var Zn="".concat(pn,"---").concat(Tn);if(hn[Zn])hn[Zn].weight+=fn,hn[Zn].count++;else{var ii={source:pn,target:Tn,weight:fn,count:1};hn[Zn]=ii,Or.push(ii)}}});var sn=[];return Object.keys(Zt).forEach(function(Ir){sn.push(Zt[Ir])}),{clusters:sn,clusterEdges:Or}},bt=Un,Mn=function(t,e,r,n,i,a,o,s){return e===void 0&&(e=!1),r===void 0&&(r="weight"),n===void 0&&(n=1e-4),i===void 0&&(i=void 0),a===void 0&&(a=[]),o===void 0&&(o=["id"]),s===void 0&&(s=1),bt(t,e,r,n,!0,i,a,o,s)},be=Mn,Se=function(t,e){var r;e===void 0&&(e=1);for(var n=(0,_.clone)(t),i=n.nodes,a=i===void 0?[]:i,o=n.edges,s=o===void 0?[]:o,d=function(){var F=we({nodes:a,edges:s}),G=Object.keys(F);G.sort(function(se,ce){var de,xe;return((de=F[se])===null||de===void 0?void 0:de.degree)-((xe=F[ce])===null||xe===void 0?void 0:xe.degree)});var H=G[0];if(!a.length||((r=F[H])===null||r===void 0?void 0:r.degree)>=e)return"break";var ie=a.findIndex(function(se){return se.id===H});a.splice(ie,1),s=s.filter(function(se){return!(se.source===H||se.target===H)})};;){var y=d();if(y==="break")break}return{nodes:a,edges:s}},j=Se,R=function(t,e,r){var n=[];switch(t){case nn.EuclideanDistance:n=e[r];break;default:n=[];break}return n},k=function(t,e,r,n,i,a){e===void 0&&(e=3),r===void 0&&(r=void 0),n===void 0&&(n=[]),i===void 0&&(i=["id"]),a===void 0&&(a=nn.EuclideanDistance);var o=t.nodes,s=o===void 0?[]:o,d=t.edges,y=d===void 0?[]:d,C={clusters:[{id:"0",nodes:s}],clusterEdges:[]};if(a===nn.EuclideanDistance&&!s.every(function(un){return un.hasOwnProperty(r)}))return C;var F=[],G=[];if(a===nn.EuclideanDistance&&(F=Qr(s,r),G=Vn(F,n,i)),!G.length)return C;for(var H=(0,_.uniq)(G.map(function(un){return un.join("")})),ie=Math.min(e,s.length,H.length),se=0;se<s.length;se++)s[se].originIndex=se;for(var ce=[],de=[],xe=[],se=0;se<ie;se++)if(se===0){var Ie=Math.floor(Math.random()*s.length);switch(a){case nn.EuclideanDistance:ce[se]=G[Ie];break;default:ce[se]=[];break}de.push(Ie),xe[se]=[s[Ie]],s[Ie].clusterId=String(se)}else{for(var qe=-Infinity,ze=0,$e=function(pn){if(!de.includes(pn)){for(var Tn=0,Zn=0;Zn<ce.length;Zn++){var ii=0;switch(a){case nn.EuclideanDistance:ii=cn(G[s[pn].originIndex],ce[Zn],a);break;default:break}Tn+=ii}var xi=Tn/ce.length;xi>qe&&!ce.find(function(ui){return(0,_.isEqual)(ui,R(a,G,s[pn].originIndex))})&&(qe=xi,ze=pn)}},mt=0;mt<s.length;mt++)$e(mt);ce[se]=R(a,G,ze),de.push(ze),xe[se]=[s[ze]],s[ze].clusterId=String(se)}for(var xt=0;;){for(var se=0;se<s.length;se++){var wt=0,Yt=Infinity;if(!(xt===0&&de.includes(se))){for(var Zt=0;Zt<ce.length;Zt++){var Er=0;switch(a){case nn.EuclideanDistance:Er=cn(G[se],ce[Zt],a);break;default:break}Er<Yt&&(Yt=Er,wt=Zt)}if(s[se].clusterId!==void 0)for(var Fr=xe[Number(s[se].clusterId)].length-1;Fr>=0;Fr--)xe[Number(s[se].clusterId)][Fr].id===s[se].id&&xe[Number(s[se].clusterId)].splice(Fr,1);s[se].clusterId=String(wt),xe[wt].push(s[se])}}for(var Ur=!1,se=0;se<xe.length;se++){for(var Or=xe[se],hn=new gt([]),Zt=0;Zt<Or.length;Zt++)hn=hn.add(new gt(G[Or[Zt].originIndex]));var sn=hn.avg(Or.length);sn.equal(new gt(ce[se]))||(Ur=!0,ce[se]=sn.getArr())}if(xt++,s.every(function(un){return un.clusterId!==void 0})&&Ur||xt>=1e3)break}var Ir=[],en={};return y.forEach(function(un){var fn,pn,Tn=un.source,Zn=un.target,ii=(fn=s.find(function(Gi){return Gi.id===Tn}))===null||fn===void 0?void 0:fn.clusterId,xi=(pn=s.find(function(Gi){return Gi.id===Zn}))===null||pn===void 0?void 0:pn.clusterId,ui="".concat(ii,"---").concat(xi);if(en[ui])en[ui].count++;else{var ji={source:ii,target:xi,count:1};en[ui]=ji,Ir.push(ji)}}),{clusters:xe,clusterEdges:Ir}},te=k,Me=function(t,e){var r=new gt(e),n=r.norm2(),i=new gt(t),a=i.norm2(),o=r.dot(i),s=n*a,d=s?o/s:0;return d},Ne=Me,Pe=function(t,e,r,n,i){t===void 0&&(t=[]),r===void 0&&(r=void 0),n===void 0&&(n=[]),i===void 0&&(i=[]);var a=(0,_.clone)(t.filter(function(F){return F.id!==e.id})),o=t.findIndex(function(F){return F.id===e.id}),s=Qr(t,r),d=Vn(s,n,i),y=d[o],C=[];return a.forEach(function(F,G){if(F.id!==e.id){var H=d[G],ie=Ne(H,y);C.push(ie),F.cosineSimilarity=ie}}),a.sort(function(F,G){return G.cosineSimilarity-F.cosineSimilarity}),{allCosineSimilarity:C,similarNodes:a}},Ke=Pe,Ut=function(){function h(t){this.count=t.length,this.parent={};for(var e=0,r=t;e<r.length;e++){var n=r[e];this.parent[n]=n}}return h.prototype.find=function(t){for(;this.parent[t]!==t;)t=this.parent[t];return t},h.prototype.union=function(t,e){var r=this.find(t),n=this.find(e);r!==n&&(r<n?(this.parent[e]!==e&&this.union(this.parent[e],t),this.parent[e]=this.parent[t]):(this.parent[t]!==t&&this.union(this.parent[t],e),this.parent[t]=this.parent[e]))},h.prototype.connected=function(t,e){return this.find(t)===this.find(e)},h}(),Rt=Ut,fr=function(t,e){return t-e},kr=function(){function h(t){t===void 0&&(t=fr),this.compareFn=t,this.list=[]}return h.prototype.getLeft=function(t){return 2*t+1},h.prototype.getRight=function(t){return 2*t+2},h.prototype.getParent=function(t){return t===0?null:Math.floor((t-1)/2)},h.prototype.isEmpty=function(){return this.list.length<=0},h.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},h.prototype.delMin=function(){var t=this.top(),e=this.list.pop();return this.list.length>0&&(this.list[0]=e,this.moveDown(0)),t},h.prototype.insert=function(t){if(t!==null){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},h.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)}},h.prototype.moveDown=function(t){var e,r=t,n=this.getLeft(t),i=this.getRight(t),a=this.list.length;n!==null&&n<a&&this.compareFn(this.list[r],this.list[n])>0?r=n:i!==null&&i<a&&this.compareFn(this.list[r],this.list[i])>0&&(r=i),t!==r&&(e=[this.list[r],this.list[t]],this.list[t]=e[0],this.list[r]=e[1],this.moveDown(r))},h}(),ur=kr,rn=function(t,e){var r=[],n=t.nodes,i=n===void 0?[]:n,a=t.edges,o=a===void 0?[]:a;if(i.length===0)return r;var s=i[0],d=new Set;d.add(s);var y=function(se,ce){return e?se.weight-ce.weight:0},C=new ur(y);for(It(s.id,o).forEach(function(ie){C.insert(ie)});!C.isEmpty();){var F=C.delMin(),G=F.source,H=F.target;d.has(G)&&d.has(H)||(r.push(F),d.has(G)||(d.add(G),It(G,o).forEach(function(ie){C.insert(ie)})),d.has(H)||(d.add(H),It(H,o).forEach(function(ie){C.insert(ie)})))}return r},On=function(t,e){var r=[],n=t.nodes,i=n===void 0?[]:n,a=t.edges,o=a===void 0?[]:a;if(i.length===0)return r;var s=o.map(function(G){return G});e&&s.sort(function(G,H){return G.weight-H.weight});for(var d=new Rt(i.map(function(G){return G.id}));s.length>0;){var y=s.shift(),C=y.source,F=y.target;d.connected(C,F)||(r.push(y),d.union(C,F))}return r},ne=function(t,e,r){var n={prim:rn,kruskal:On};return r?n[r](t,e):On(t,e)},ye=ne,Je=function(t,e,r){typeof e!="number"&&(e=1e-6),typeof r!="number"&&(r=.85);for(var n=1,i=0,a=1e3,o=t.nodes,s=o===void 0?[]:o,d=t.edges,y=d===void 0?[]:d,C=s.length,F,G={},H={},ie=0;ie<C;++ie){var se=s[ie],ce=se.id;G[ce]=1/C,H[ce]=1/C}for(var de=we(t);a>0&&n>e;){i=0;for(var ie=0;ie<C;++ie){var se=s[ie],ce=se.id;if(F=0,de[se.id].inDegree===0)G[ce]=0;else{for(var xe=Ve(ce,y,"source"),Ie=0;Ie<xe.length;++Ie){var qe=xe[Ie],ze=de[qe].outDegree;ze>0&&(F+=H[qe]/ze)}G[ce]=r*F,i+=G[ce]}}i=(1-i)/C,n=0;for(var ie=0;ie<C;++ie){var se=s[ie],ce=se.id;F=G[ce]+i,n+=Math.abs(F-H[ce]),H[ce]=F}a-=1}return H},Ct=Je,Nt=-1,mr=-1,lr="-1",dr="-1",yr=-1,Gr="-1",Jr=function(){function h(t,e,r,n){t===void 0&&(t=Nt),e===void 0&&(e=mr),r===void 0&&(r=mr),n===void 0&&(n=lr),this.id=t,this.from=e,this.to=r,this.label=n}return h}(),Sr=function(){function h(t,e){t===void 0&&(t=mr),e===void 0&&(e=dr),this.id=t,this.label=e,this.edges=[],this.edgeMap={}}return h.prototype.addEdge=function(t){this.edges.push(t),this.edgeMap[t.id]=t},h}(),lt=function(){function h(t,e,r){t===void 0&&(t=mr),e===void 0&&(e=!0),r===void 0&&(r=!1),this.id=t,this.edgeIdAutoIncrease=e,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=r}return h.prototype.getNodeNum=function(){return this.nodes.length},h.prototype.addNode=function(t,e){if(!this.nodeMap[t]){var r=new Sr(t,e);this.nodes.push(r),this.nodeMap[t]=r,this.nodeLabelMap[e]||(this.nodeLabelMap[e]=[]),this.nodeLabelMap[e].push(t)}},h.prototype.addEdge=function(t,e,r,n){if((this.edgeIdAutoIncrease||t===void 0)&&(t=this.counter++),!(this.nodeMap[e]&&this.nodeMap[r]&&this.nodeMap[r].edgeMap[t])){var i=new Jr(t,e,r,n);if(this.edges.push(i),this.edgeMap[t]=i,this.nodeMap[e].addEdge(i),this.edgeLabelMap[n]||(this.edgeLabelMap[n]=[]),this.edgeLabelMap[n].push(i),!this.directed){var a=new Jr(t,r,e,n);this.nodeMap[r].addEdge(a),this.edgeLabelMap[n].push(a)}}},h}(),Ae=function(){function h(t,e,r,n,i){this.fromNode=t,this.toNode=e,this.nodeEdgeNodeLabel={nodeLabel1:r||dr,edgeLabel:n||lr,nodeLabel2:i||dr}}return h.prototype.equalTo=function(t){return this.fromNode===t.formNode&&this.toNode===t.toNode&&this.nodeEdgeNodeLabel===t.nodeEdgeNodeLabel},h.prototype.notEqualTo=function(t){return!this.equalTo(t)},h}(),Ye=function(){function h(){this.rmpath=[],this.dfsEdgeList=[]}return h.prototype.equalTo=function(t){var e=this.dfsEdgeList.length,r=t.length;if(e!==r)return!1;for(var n=0;n<e;n++)if(this.dfsEdgeList[n]!==t[n])return!1;return!0},h.prototype.notEqualTo=function(t){return!this.equalTo(t)},h.prototype.pushBack=function(t,e,r,n,i){return this.dfsEdgeList.push(new Ae(t,e,r,n,i)),this.dfsEdgeList},h.prototype.toGraph=function(t,e){t===void 0&&(t=yr),e===void 0&&(e=!1);var r=new lt(t,!0,e);return this.dfsEdgeList.forEach(function(n){var i=n.fromNode,a=n.toNode,o=n.nodeEdgeNodeLabel,s=o.nodeLabel1,d=o.edgeLabel,y=o.nodeLabel2;s!==dr&&r.addNode(i,s),y!==dr&&r.addNode(a,y),s!==dr&&y!==s&&r.addEdge(void 0,i,a,d)}),r},h.prototype.buildRmpath=function(){this.rmpath=[];for(var t=void 0,e=this.dfsEdgeList.length,r=e-1;r>=0;r--){var n=this.dfsEdgeList[r],i=n.fromNode,a=n.toNode;i<a&&(t===void 0||a===t)&&(this.rmpath.push(r),t=i)}return this.rmpath},h.prototype.getNodeNum=function(){var t={};return this.dfsEdgeList.forEach(function(e){t[e.fromNode]||(t[e.fromNode]=!0),t[e.toNode]||(t[e.toNode]=!0)}),Object.keys(t).length},h}(),Tt=function(){function h(t){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!t){for(;t;){var e=t.edge;this.edges.push(e),this.nodesUsed[e.from]=1,this.nodesUsed[e.to]=1,this.edgesUsed[e.id]=1,t=t.preNode}this.edges=this.edges.reverse()}}return h.prototype.hasNode=function(t){return this.nodesUsed[t.id]===1},h.prototype.hasEdge=function(t){return this.edgesUsed[t.id]===1},h}(),pt=function(){function h(t){var e=t.graphs,r=t.minSupport,n=r===void 0?2:r,i=t.minNodeNum,a=i===void 0?1:i,o=t.maxNodeNum,s=o===void 0?4:o,d=t.top,y=d===void 0?10:d,C=t.directed,F=C===void 0?!1:C,G=t.verbose,H=G===void 0?!1:G;this.graphs=e,this.dfsCode=new Ye,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=n,this.top=y,this.directed=F,this.counter=0,this.maxNodeNum=s,this.minNodeNum=a,this.verbose=H,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return h.prototype.findForwardRootEdges=function(t,e){var r=this,n=[],i=t.nodeMap;return e.edges.forEach(function(a){(r.directed||e.label<=i[a.to].label)&&n.push(a)}),n},h.prototype.findBackwardEdge=function(t,e,r,n){if(!this.directed&&e===r)return null;for(var i=t.nodeMap,a=i[r.to],o=a.edges,s=o.length,d=0;d<s;d++){var y=o[d];if(!(n.hasEdge(y)||y.to!==e.from)){if(this.directed){if(i[e.from].label<i[r.to].label||i[e.from].label===i[r.to].label&&e.label<=y.label)return y}else if(e.label<y.label||e.label===y.label&&i[e.to].label<=i[r.to].label)return y}}return null},h.prototype.findForwardPureEdges=function(t,e,r,n){for(var i=[],a=e.to,o=t.nodeMap[a].edges,s=o.length,d=0;d<s;d++){var y=o[d],C=t.nodeMap[y.to];r<=C.label&&!n.hasNode(C)&&i.push(y)}return i},h.prototype.findForwardRmpathEdges=function(t,e,r,n){for(var i=[],a=t.nodeMap,o=a[e.to].label,s=a[e.from],d=s.edges,y=d.length,C=0;C<y;C++){var F=d[C],G=a[F.to].label;e.to===F.to||r>G||n.hasNode(a[F.to])||(e.label<F.label||e.label===F.label&&o<=G)&&i.push(F)}return i},h.prototype.getSupport=function(t){var e={};return t.forEach(function(r){e[r.graphId]||(e[r.graphId]=!0)}),Object.keys(e).length},h.prototype.findMinLabel=function(t){var e=void 0;return Object.keys(t).forEach(function(r){var n=t[r],i=n.nodeLabel1,a=n.edgeLabel,o=n.nodeLabel2;if(!e){e={nodeLabel1:i,edgeLabel:a,nodeLabel2:o};return}(i<e.nodeLabel1||i===e.nodeLabel1&&a<e.edgeLabel||i===e.nodeLabel1&&a===e.edgeLabel&&o<e.nodeLabel2)&&(e={nodeLabel1:i,edgeLabel:a,nodeLabel2:o})}),e},h.prototype.isMin=function(){var t=this,e=this.dfsCode;if(this.verbose&&console.log("isMin checking",e),e.dfsEdgeList.length===1)return!0;var r=this.directed,n=e.toGraph(yr,r),i=n.nodeMap,a=new Ye,o={};n.nodes.forEach(function(C){var F=t.findForwardRootEdges(n,C);F.forEach(function(G){var H=i[G.to],ie="".concat(C.label,"-").concat(G.label,"-").concat(H.label);o[ie]||(o[ie]={projected:[],nodeLabel1:C.label,edgeLabel:G.label,nodeLabel2:H.label});var se={graphId:n.id,edge:G,preNode:null};o[ie].projected.push(se)})});var s=this.findMinLabel(o);if(!!s){a.dfsEdgeList.push(new Ae(0,1,s.nodeLabel1,s.edgeLabel,s.nodeLabel2));var d=function C(F){for(var G=a.buildRmpath(),H=a.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,ie=a.dfsEdgeList[G[0]].toNode,se={},ce=!1,de=0,xe=r?-1:0,Ie=function(hn){if(ce)return"break";F.forEach(function(sn){var Ir=new Tt(sn),en=t.findBackwardEdge(n,Ir.edges[G[hn]],Ir.edges[G[0]],Ir);en&&(se[en.label]||(se[en.label]={projected:[],edgeLabel:en.label}),se[en.label].projected.push({graphId:n.id,edge:se,preNode:sn}),de=a.dfsEdgeList[G[hn]].fromNode,ce=!0)})},qe=G.length-1;qe>xe;qe--){var ze=Ie(qe);if(ze==="break")break}if(ce){var $e=t.findMinLabel(se);a.dfsEdgeList.push(new Ae(ie,de,dr,$e.edgeLabel,dr));var mt=a.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[mt]!==a.dfsEdgeList[mt]?!1:C(se[$e.edgeLabel].projected)}var xt={};ce=!1;var wt=0;F.forEach(function(Or){var hn=new Tt(Or),sn=t.findForwardPureEdges(n,hn.edges[G[0]],H,hn);sn.length>0&&(ce=!0,wt=ie,sn.forEach(function(Ir){var en="".concat(Ir.label,"-").concat(i[Ir.to].label);xt[en]||(xt[en]={projected:[],edgeLabel:Ir.label,nodeLabel2:i[Ir.to].label}),xt[en].projected.push({graphId:n.id,edge:Ir,preNode:Or})}))});for(var Yt=G.length,Zt=function(hn){if(ce)return"break";var sn=G[hn];F.forEach(function(Ir){var en=new Tt(Ir),un=t.findForwardRmpathEdges(n,en.edges[sn],H,en);un.length>0&&(ce=!0,wt=a.dfsEdgeList[sn].fromNode,un.forEach(function(fn){var pn="".concat(fn.label,"-").concat(i[fn.to].label);xt[pn]||(xt[pn]={projected:[],edgeLabel:fn.label,nodeLabel2:i[fn.to].label}),xt[pn].projected.push({graphId:n.id,edge:fn,preNode:Ir})}))})},qe=0;qe<Yt;qe++){var Er=Zt(qe);if(Er==="break")break}if(!ce)return!0;var Fr=t.findMinLabel(xt);a.dfsEdgeList.push(new Ae(wt,ie+1,dr,Fr.edgeLabel,Fr.nodeLabel2));var Ur=a.dfsEdgeList.length-1;return e.dfsEdgeList[Ur]!==a.dfsEdgeList[Ur]?!1:C(xt["".concat(Fr.edgeLabel,"-").concat(Fr.nodeLabel2)].projected)},y="".concat(s.nodeLabel1,"-").concat(s.edgeLabel,"-").concat(s.nodeLabel2);return d(o[y].projected)}},h.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var t=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push((0,_.clone)(t))}},h.prototype.subGraphMining=function(t){var e=this,r=this.getSupport(t);if(!(r<this.minSupport)&&!!this.isMin()){this.report();var n=this.dfsCode.getNodeNum(),i=this.dfsCode.buildRmpath(),a=this.dfsCode.dfsEdgeList[i[0]].toNode,o=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,s={},d={};t.forEach(function(y){for(var C=e.graphs[y.graphId],F=C.nodeMap,G=new Tt(y),H=i.length-1;H>=0;H--){var ie=e.findBackwardEdge(C,G.edges[i[H]],G.edges[i[0]],G);if(ie){var se="".concat(e.dfsCode.dfsEdgeList[i[H]].fromNode,"-").concat(ie.label);d[se]||(d[se]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[i[H]].fromNode,edgeLabel:ie.label}),d[se].projected.push({graphId:y.graphId,edge:ie,preNode:y})}}if(!(n>=e.maxNodeNum)){var ce=e.findForwardPureEdges(C,G.edges[i[0]],o,G);ce.forEach(function(xe){var Ie="".concat(a,"-").concat(xe.label,"-").concat(F[xe.to].label);s[Ie]||(s[Ie]={projected:[],fromNodeId:a,edgeLabel:xe.label,nodeLabel2:F[xe.to].label}),s[Ie].projected.push({graphId:y.graphId,edge:xe,preNode:y})});for(var de=function(Ie){var qe=e.findForwardRmpathEdges(C,G.edges[i[Ie]],o,G);qe.forEach(function(ze){var $e="".concat(e.dfsCode.dfsEdgeList[i[Ie]].fromNode,"-").concat(ze.label,"-").concat(F[ze.to].label);s[$e]||(s[$e]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[i[Ie]].fromNode,edgeLabel:ze.label,nodeLabel2:F[ze.to].label}),s[$e].projected.push({graphId:y.graphId,edge:ze,preNode:y})})},H=0;H<i.length;H++)de(H)}}),Object.keys(d).forEach(function(y){var C=d[y],F=C.toNodeId,G=C.edgeLabel;e.dfsCode.dfsEdgeList.push(new Ae(a,F,"-1",G,"-1")),e.subGraphMining(d[y].projected),e.dfsCode.dfsEdgeList.pop()}),Object.keys(s).forEach(function(y){var C=s[y],F=C.fromNodeId,G=C.edgeLabel,H=C.nodeLabel2;e.dfsCode.dfsEdgeList.push(new Ae(F,a+1,dr,G,H)),e.subGraphMining(s[y].projected),e.dfsCode.dfsEdgeList.pop()})}},h.prototype.generate1EdgeFrequentSubGraphs=function(){var t=this.graphs,e=this.directed,r=this.minSupport,n=this.frequentSize1Subgraphs,i={},a={},o={},s={};return Object.keys(t).forEach(function(d){var y=t[d],C=y.nodeMap;y.nodes.forEach(function(F,G){var H=F.label,ie="".concat(d,"-").concat(H);if(!o[ie]){var se=i[H]||0;se++,i[H]=se}o[ie]={graphKey:d,label:H},F.edges.forEach(function(ce){var de=H,xe=C[ce.to].label;if(!e&&de>xe){var Ie=xe;xe=de,de=Ie}var qe=ce.label,ze="".concat(d,"-").concat(de,"-").concat(qe,"-").concat(xe),$e="".concat(de,"-").concat(qe,"-").concat(xe);if(!a[$e]){var mt=a[$e]||0;mt++,a[$e]=mt}s[ze]={graphId:d,nodeLabel1:de,edgeLabel:qe,nodeLabel2:xe}})})}),Object.keys(i).forEach(function(d){var y=i[d];if(!(y<r)){var C={nodes:[],edges:[]};C.nodes.push({id:"0",label:d}),n.push(C)}}),n},h.prototype.run=function(){var t=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var e=this.graphs,r=this.directed,n={};Object.keys(e).forEach(function(i){var a=e[i],o=a.nodeMap;a.nodes.forEach(function(s){var d=t.findForwardRootEdges(a,s);d.forEach(function(y){var C=o[y.to],F="".concat(s.label,"-").concat(y.label,"-").concat(C.label);n[F]||(n[F]={projected:[],nodeLabel1:s.label,edgeLabel:y.label,nodeLabel2:C.label});var G={graphId:i,edge:y,preNode:null};n[F].projected.push(G)})})}),Object.keys(n).forEach(function(i){var a=n[i],o=a.projected,s=a.nodeLabel1,d=a.edgeLabel,y=a.nodeLabel2;t.dfsCode.dfsEdgeList.push(new Ae(0,1,s,d,y)),t.subGraphMining(o),t.dfsCode.dfsEdgeList.pop()})}},h}(),kt=function(t,e,r,n){var i={};return Object.keys(t).forEach(function(a,o){var s=t[a],d=new lt(o,!0,e),y={};s.nodes.forEach(function(C,F){d.addNode(F,C[r]),y[C.id]=F}),s.edges.forEach(function(C,F){var G=y[C.source],H=y[C.target];d.addEdge(-1,G,H,C[n])}),d&&d.getNodeNum()&&(i[d.id]=d)}),i},ar=function(t,e,r){var n=[];return t.forEach(function(i){var a={nodes:[],edges:[]};i.nodes.forEach(function(o){var s;a.nodes.push((s={id:"".concat(o.id)},s[e]=o.label,s))}),i.edges.forEach(function(o){var s;a.edges.push((s={source:"".concat(o.from),target:"".concat(o.to)},s[r]=o.label,s))}),n.push(a)}),n},jr="cluster",tn=function(t){var e=t.graphs,r=t.directed,n=r===void 0?!1:r,i=t.nodeLabelProp,a=i===void 0?jr:i,o=t.edgeLabelProp,s=o===void 0?jr:o,d=kt(e,n,a,s),y=t.minSupport,C=t.maxNodeNum,F=t.minNodeNum,G=t.verbose,H=t.top,ie={graphs:d,minSupport:y,maxNodeNum:C,minNodeNum:F,top:H,verbose:G,directed:n},se=new pt(ie);se.run();var ce=ar(se.frequentSubgraphs,a,s);return ce},Ln=tn,Dn=function(t,e,r,n){r===void 0&&(r="cluster"),n===void 0&&(n=2);var i=[],a=t.nodes;return e.forEach(function(o,s){i.push($n(a,o,s,r,n))}),i},$n=function(t,e,r,n,i){var a=[r],o=[],s={};return e.forEach(function(d,y){if(d<=i&&r!==y){a.push(y),o.push(t[y]);var C=t[y][n];s[C]?(s[C].count++,s[C].dists.push(d)):s[C]={count:1,dists:[d]}}}),Object.keys(s).forEach(function(d){s[d].dists=s[d].dists.sort(function(y,C){return y-C})}),{nodeIdx:r,nodeId:t[r].id,nodeIdxs:a,neighbors:o,neighborNum:a.length-1,nodeLabelCountMap:s}},ci=function(t,e,r,n,i){var a=Math.ceil(r/e),o={},s=0;return n.forEach(function(d,y){for(var C=0,F=0,G=d.nodeIdxs,H=d.neighborNum-1;C<a;){for(var ie=G[1+Math.floor(Math.random()*H)],se=0;(o["".concat(y,"-").concat(ie)]||o["".concat(ie,"-").concat(y)])&&(ie=Math.floor(Math.random()*e),se++,!(se>2*e)););if(se<2*e&&(o["".concat(y,"-").concat(ie)]={start:y,end:ie,distance:i[y][ie]},C++,s++,s>=r))return o;if(F++,F>2*e)break}if(C<a){var ce=a-C;a=(a+ce)/(e-y-1)}}),o},Ii=function(t,e,r,n){var i=r.nodes;return n||(n={}),Object.keys(t).forEach(function(a){var o,s;if(!(n&&n[a])){n[a]={nodes:[],edges:[]};var d=t[a],y=(o=e[d.start])===null||o===void 0?void 0:o.nodeIdxs,C=(s=e[d.end])===null||s===void 0?void 0:s.nodeIdxs;if(!(!y||!C)){var F=new Set(C),G=y.filter(function(de){return F.has(de)});if(!(!G||!G.length)){for(var H={},ie=G.length,se=0;se<ie;se++){var ce=i[G[se]];n[a].nodes.push(ce),H[ce.id]=!0}r.edges.forEach(function(de){H[de.source]&&H[de.target]&&n[a].edges.push(de)})}}}}),n},ki=function(t,e,r,n){var i,a,o={};t.nodes.forEach(function(d){o[d.id]=d});var s=0;return!((i=e==null?void 0:e.edges)===null||i===void 0?void 0:i.length)||((a=e==null?void 0:e.nodes)===null||a===void 0?void 0:a.length)<2?0:(t.edges.forEach(function(d){var y=o[d.source][r],C=o[d.target][r],F=e==null?void 0:e.nodes[0][r],G=e==null?void 0:e.nodes[1][r],H=e==null?void 0:e.edges[0][n];d[n]===H&&(y===F&&C===G||y===G&&C===F)&&s++}),s)},zi=function(t,e,r){for(var n=Infinity,i=0,a=function(d){var y=t[d],C=Object.keys(y).sort(function(de,xe){return y[de]-y[xe]}),F=10,G=[];C.forEach(function(de,xe){G[xe%F]||(G[xe%F]={graphs:[],totalCount:0,aveCount:0}),G[xe%F].graphs.push(de),G[xe%F].totalCount+=y[de]});var H=0,ie=[];G.forEach(function(de){var xe=de.totalCount/de.graphs.length;de.aveCount=xe,ie.push(xe);var Ie=0,qe=de.length;de.graphs.forEach(function(ze,$e){var mt=y[ze];de.graphs.forEach(function(xt,wt){$e!==wt&&(Ie+=Math.abs(mt-y[xt]))})}),Ie/=qe*(qe-1)/2,H+=Ie}),H/=G.length;var se=0;ie.forEach(function(de,xe){ie.forEach(function(Ie,qe){xe!==qe&&(se+=Math.abs(de-Ie))}),se/=ie.length*(ie.length-1)/2});var ce=se-H;n<ce&&(n=ce,i=d)},o=0;o<e;o++)a(o);return{structure:r[i],structureCountMap:t[i]}},Hn=function(t,e){var r={},n={};return t.forEach(function(i,a){r[i.id]={idx:a,node:i,degree:0,inDegree:0,outDegree:0};var o=i[e];n[o]||(n[o]=[]),n[o].push(i)}),{nodeMap:r,nodeLabelMap:n}},Mo=function(t,e,r){var n={},i={};return t.forEach(function(a,o){n["".concat(er)]={idx:o,edge:a};var s=a[e];i[s]||(i[s]=[]),i[s].push(a);var d=r[a.source];d&&(d.degree++,d.outDegree++);var y=r[a.target];y&&(y.degree++,y.inDegree++)}),{edgeMap:n,edgeLabelMap:i}},Ia=function(t,e,r){var n=e.length,i={};return e.forEach(function(a,o){for(var s=r?0:o+1,d=t[o].id,y=s;y<n;y++)if(o!==y){var C=t[y].id,F=a[y];i["".concat(d,"-").concat(C)]=F,r||(i["".concat(C,"-").concat(d)]=F)}}),i},vi=function(t,e,r,n,i,a,o,s,d,y,C){var F,G="".concat(e.id,"-").concat(r.id);if(y&&y[G])return y[G];var H=C?C[G]:void 0;if(!H){var ie=(F={},F[G]={start:n[e.id].idx,end:n[r.id].idx,distance:i},F);C=Ii(ie,a,t,C),H=C[G]}return ki(H,o,s,d)},Ya=function(t,e,r,n){var i,a,o,s=(i=t[e])===null||i===void 0?void 0:i.degree,d=(a=t[e])===null||a===void 0?void 0:a.inDegree,y=(o=t[e])===null||o===void 0?void 0:o.outDegree;return t[e]===void 0&&(s=Infinity,d=Infinity,y=Infinity,n[e].forEach(function(C){var F=r[C.id].degree;s>F&&(s=F);var G=r[C.id].inDegree;d>G&&(d=G);var H=r[C.id].outDegree;y>H&&(y=H)}),t[e]={degree:s,inDegree:d,outDegree:y}),{minPatternNodeLabelDegree:s,minPatternNodeLabelInDegree:d,minPatternNodeLabelOutDegree:y}},no=function(t,e,r,n,i,a,o){var s;if(r===void 0&&(r=!1),a===void 0&&(a="cluster"),o===void 0&&(o="cluster"),!(!t||!t.nodes)){var d=t.nodes.length;if(!!d){var y=vr(t,r),C=vr(e,r),F=Ia(t.nodes,y,r),G=Ia(e.nodes,C,r),H=Hn(t.nodes,a),ie=H.nodeMap,se=H.nodeLabelMap,ce=Hn(e.nodes,a),de=ce.nodeMap,xe=ce.nodeLabelMap;Mo(t.edges,o,ie);var Ie=Mo(e.edges,o,de).edgeLabelMap,qe=[];C==null||C.forEach(function(bi){qe=qe.concat(bi)}),i||(i=Math.max.apply(Math,(0,g.__spreadArray)((0,g.__spreadArray)([],qe,!1),[2],!1))),n||(n=i);var ze=Dn(t,y,a,n),$e=Dn(e,C,a,n),mt=Math.min(100,d*(d-1)/2),xt=ci(n,d,mt,ze,y),wt=Ii(xt,ze,t),Yt=10,Zt=1,Er=1,Fr=4,Ur={graphs:wt,nodeLabelProp:a,edgeLabelProp:o,minSupport:Zt,minNodeNum:Er,maxNodeNum:Fr,directed:r},Or=Ln(Ur).slice(0,Yt),hn=Or.length,sn=[];Or.forEach(function(bi,Si){sn[Si]={},Object.keys(wt).forEach(function(Ci){var Ni=wt[Ci],ta=ki(Ni,bi,a,o);sn[Si][Ci]=ta})});var Ir=zi(sn,hn,Or),en=Ir.structure,un=Ir.structureCountMap,fn=e.nodes[0],pn=[],Tn=(s=e.nodes[0])===null||s===void 0?void 0:s[a],Zn=-Infinity;e.nodes.forEach(function(bi){var Si=bi[a],Ci=se[Si];(Ci==null?void 0:Ci.length)>Zn&&(Zn=Ci.length,pn=Ci,Tn=Si,fn=bi)});var ii={},xi={},ui={},ji={},Gi={},Ta={};Object.keys(xe).forEach(function(bi,Si){Gi[bi]=[],r&&(Ta[bi]=[]);var Ci=-Infinity,Ni=xe[bi],ta={};Ni.forEach(function(Ai){var Li=G["".concat(fn.id,"-").concat(Ai.id)];if(Li&&Gi[bi].push(Li),Ci<Li&&(Ci=Li),ta["".concat(fn.id,"-").concat(Ai.id)]={start:0,end:de[Ai.id].idx,distance:Li},r){var ba=G["".concat(Ai.id,"-").concat(fn.id)];ba&&Ta[bi].push(ba)}}),Gi[bi]=Gi[bi].sort(function(Ai,Li){return Ai-Li}),r&&(Ta[bi]=Ta[bi].sort(function(Ai,Li){return Ai-Li})),xi=Ii(ta,$e,e,xi);var Wn=[];if(Object.keys(ta).forEach(function(Ai){if(ui[Ai]){Wn.push(ui[Ai]);return}var Li=xi[Ai];ui[Ai]=ki(Li,en,a,o),Wn.push(ui[Ai])}),Wn=Wn.sort(function(Ai,Li){return Li-Ai}),ji["".concat(fn.id,"-").concat(bi)]=Wn,bi!==Tn)for(var Pi=(pn==null?void 0:pn.length)||0,wi=function(Li){var ba=pn[Li],Rs=ze[ie[ba.id].idx],Xa=Rs.nodeLabelCountMap[bi],Vi=xe[bi].length;if(!Xa||Xa.count<Vi)return pn.splice(Li,1),"continue";for(var $u=!1,La=0;La<Vi;La++)if(Xa.dists[La]>Gi[bi][La]){$u=!0;break}if($u)return pn.splice(Li,1),"continue";var tu={};Rs.neighbors.forEach(function(ks){var Ic=F["".concat(ba.id,"-").concat(ks.id)];tu["".concat(ba.id,"-").concat(ks.id)]={start:ie[ba.id].idx,end:ie[ks.id].idx,distance:Ic}}),wt=Ii(tu,ze,t,wt);var gf=[];Object.keys(tu).forEach(function(ks){if(un[ks]){gf.push(un[ks]);return}var Ic=wt[ks];un[ks]=ki(Ic,en,a,o),gf.push(un[ks])}),gf=gf.sort(function(ks,Ic){return Ic-ks});for(var td=!1,La=0;La<Vi;La++)if(gf[La]<Wn[La]){td=!0;break}if(td)return pn.splice(Li,1),"continue"},Ei=Pi-1;Ei>=0;Ei--)wi(Ei)});var Fi=[];pn==null||pn.forEach(function(bi){for(var Si=ie[bi.id].idx,Ci=$n(t.nodes,y[Si],Si,a,i),Ni=Ci.neighbors,ta=Ni.length,Wn=!1,Pi=ta-1;Pi>=0;Pi--){if(Ni.length+1<e.nodes.length){Wn=!0;return}var wi=Ni[Pi],Ei=wi[a];if(!xe[Ei]||!xe[Ei].length){Ni.splice(Pi,1);continue}if(!Gi[Ei]||!Gi[Ei].length){Ni.splice(Pi,1);continue}var Ai="".concat(bi.id,"-").concat(wi.id),Li=F[Ai],ba=Gi[Ei].length-1,Rs=Gi[Ei][ba];if(Li>Rs){Ni.splice(Pi,1);continue}if(r){var Xa="".concat(wi.id,"-").concat(bi.id),Vi=F[Xa];ba=Ta[Ei].length-1;var $u=Ta[Ei][ba];if(Vi>$u){Ni.splice(Pi,1);continue}}var La=un[Ai]?un[Ai]:vi(t,bi,wi,ie,Li,ze,en,a,o,un,wt),tu="".concat(fn.id,"-").concat(Ei),gf=ji[tu][ji[tu].length-1];if(La<gf){Ni.splice(Pi,1);continue}var td=Ya(ii,Ei,de,xe),ks=td.minPatternNodeLabelDegree,Ic=td.minPatternNodeLabelInDegree,sl=td.minPatternNodeLabelOutDegree;if(ie[wi.id].degree<ks){Ni.splice(Pi,1);continue}}Wn||Fi.push({nodes:[bi].concat(Ni)})});var ya=ct(e,fn.id,!1).length,ma={};r?(Object.keys(ya).forEach(function(bi){var Si=de[bi].node[a];ma[Si]?ma[Si].push(ya[bi]):ma[Si]=[ya[bi]]}),Object.keys(ma).forEach(function(bi){ma[bi].sort(function(Si,Ci){return Si-Ci})})):ma=Gi;for(var So=Fi.length,Qi=function(Si){var Ci=Fi[Si],Ni=Ci.nodes[0],ta={},Wn={};Ci.nodes.forEach(function(Aa,Eu){Wn[Aa.id]={idx:Eu,node:Aa,degree:0,inDegree:0,outDegree:0};var wo=Aa[a];ta[wo]?ta[wo]++:ta[wo]=1});var Pi=[],wi={};t.edges.forEach(function(Aa){Wn[Aa.source]&&Wn[Aa.target]&&(Pi.push(Aa),wi[Aa[o]]?wi[Aa[o]]++:wi[Aa[o]]=1,Wn[Aa.source].degree++,Wn[Aa.target].degree++,Wn[Aa.source].outDegree++,Wn[Aa.target].inDegree++)});for(var Ei=Object.keys(Ie).length,Ai=!1,Li=0;Li<Ei;Li++){var ba=Object.keys(Ie)[Li];if(!wi[ba]||wi[ba]<Ie[ba].length){Ai=!0;break}}if(Ai)return Fi.splice(Si,1),"continue";var Rs=Pi.length;if(Rs<e.edges.length)return Fi.splice(Si,1),"break";for(var Xa=!1,Vi=function(Eu){var wo=Pi[Eu],yf=wo[o],_d=Ie[yf];if(!_d||!_d.length)return wi[yf]--,_d&&wi[yf]<_d.length?(Xa=!0,"break"):(Pi.splice(Eu,1),Wn[wo.source].degree--,Wn[wo.target].degree--,Wn[wo.source].outDegree--,Wn[wo.target].inDegree--,"continue");var Lv=Wn[wo.source].node[a],Rv=Wn[wo.target].node[a],_v=!1;if(_d.forEach(function(kv){var Bv=de[kv.source].node,Gv=de[kv.target].node;Bv[a]===Lv&&Gv[a]===Rv&&(_v=!0),!r&&Bv[a]===Rv&&Gv[a]===Lv&&(_v=!0)}),!_v)return wi[yf]--,_d&&wi[yf]<_d.length?(Xa=!0,"break"):(Pi.splice(Eu,1),Wn[wo.source].degree--,Wn[wo.target].degree--,Wn[wo.source].outDegree--,Wn[wo.target].inDegree--,"continue")},Li=Rs-1;Li>=0;Li--){var $u=Vi(Li);if($u==="break")break}if(Xa)return Fi.splice(Si,1),"continue";Ci.edges=Pi;var La=ct(Ci,Ci.nodes[0].id,!1).length;if(Object.keys(La).reverse().forEach(function(Aa){if(!(Aa===Ci.nodes[0].id||Xa)){if(La[Aa]===Infinity){var Eu=Wn[Aa].node[a];if(ta[Eu]--,ta[Eu]<xe[Eu].length){Xa=!0;return}var wo=Ci.nodes.indexOf(Wn[Aa].node);Ci.nodes.splice(wo,1),Wn[Aa]=void 0;return}var yf=ie[Aa].node[a];if(!ma[yf]||!ma[yf].length||La[Aa]>ma[yf][ma[yf].length-1]){var Eu=Wn[Aa].node[a];if(ta[Eu]--,ta[Eu]<xe[Eu].length){Xa=!0;return}var wo=Ci.nodes.indexOf(Wn[Aa].node);Ci.nodes.splice(wo,1),Wn[Aa]=void 0}}}),Xa)return Fi.splice(Si,1),"continue";for(var tu=!0,gf=0;tu&&!Xa;){tu=!1;var td=r?Wn[Ni.id].degree<de[fn.id].degree||Wn[Ni.id].inDegree<de[fn.id].inDegree||Wn[Ni.id].outDegree<de[fn.id].outDegree:Wn[Ni.id].degree<de[fn.id].degree;if(td){Xa=!0;break}if(ta[Ni[a]]<xe[Ni[a]].length){Xa=!0;break}for(var ks=Ci.nodes.length,Ic=ks-1;Ic>=0;Ic--){var sl=Ci.nodes[Ic],Dv=Wn[sl.id].degree,hp=Wn[sl.id].inDegree,vp=Wn[sl.id].outDegree,pp=sl[a],Ev=Ya(ii,pp,de,xe),Nv=Ev.minPatternNodeLabelDegree,gp=Ev.minPatternNodeLabelInDegree,yp=Ev.minPatternNodeLabelOutDegree,mp=r?Dv<Nv||hp<gp||vp<yp:Dv<Nv;if(mp){if(ta[sl[a]]--,ta[sl[a]]<xe[sl[a]].length){Xa=!0;break}Ci.nodes.splice(Ic,1),Wn[sl.id]=void 0,tu=!0}}if(Xa||!tu&&gf!==0)break;Rs=Pi.length;for(var Kh=Rs-1;Kh>=0;Kh--){var ul=Pi[Kh];if(!Wn[ul.source]||!Wn[ul.target]){Pi.splice(Kh,1);var $h=ul[o];if(wi[$h]--,Wn[ul.source]&&(Wn[ul.source].degree--,Wn[ul.source].outDegree--),Wn[ul.target]&&(Wn[ul.target].degree--,Wn[ul.target].inDegree--),Ie[$h]&&wi[$h]<Ie[$h].length){Xa=!0;break}tu=!0}}gf++}if(Xa||Xa||Ci.nodes.length<e.nodes.length||Pi.length<e.edges.length)return Fi.splice(Si,1),"continue"},Ui=So-1;Ui>=0;Ui--){var ja=Qi(Ui);if(ja==="break")break}for(var Va=Fi.length,Ko=function(Si){var Ci=Fi[Si],Ni={};Ci.edges.forEach(function(Pi){var wi="".concat(Pi.source,"-").concat(Pi.target,"-").concat(Pi.label);Ni[wi]?Ni[wi]++:Ni[wi]=1});for(var ta=function(wi){var Ei=Fi[wi],Ai={};Ei.edges.forEach(function(ba){var Rs="".concat(ba.source,"-").concat(ba.target,"-").concat(ba.label);Ai[Rs]?Ai[Rs]++:Ai[Rs]=1});var Li=!0;Object.keys(Ai).length!==Object.keys(Ni).length?Li=!1:Object.keys(Ni).forEach(function(ba){Ai[ba]!==Ni[ba]&&(Li=!1)}),Li&&Fi.splice(wi,1)},Wn=Va-1;Wn>Si;Wn--)ta(Wn);Va=Fi.length},Ui=0;Ui<=Va-1;Ui++)Ko(Ui);return Fi}}},Co=no,ho=function(){function h(t){t===void 0&&(t=10),this.linkedList=new Ee,this.maxStep=t}return Object.defineProperty(h.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),h.prototype.isEmpty=function(){return!this.linkedList.head},h.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},h.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},h.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},h.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},h.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},h.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},h}(),Ea=ho,gs=he,_u={getAdjMatrix:re,breadthFirstSearch:Vt,connectedComponent:ke,getDegree:we,getInDegree:Be,getOutDegree:We,detectCycle:he,detectDirectedCycle:gs,detectAllCycles:U,detectAllDirectedCycle:ut,detectAllUndirectedCycle:Ge,depthFirstSearch:Mt,dijkstra:ct,findAllPath:Lt,findShortestPath:jt,floydWarshall:vr,labelPropagation:at,louvain:bt,iLouvain:be,kCore:j,kMeans:te,cosineSimilarity:Ne,nodesCosineSimilarity:Ke,minimumSpanningTree:ye,pageRank:Ct,getNeighbors:Ve,Stack:Ea,GADDI:Co},_a=M(77160),$o=M(35600),Ti=M(31437),Qo=ee.vs,vo=function(t){return function(e,r){return e[t]-r[t]}},In=function(t,e,r){return t>=e&&t<=r},Bs=function(t,e,r,n){var i=1e-4,a={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},d=o.x*s.y-o.y*s.x,y=d*d,C=1/d,F=o.x*o.x+o.y*o.y,G=s.x*s.x+s.y*s.y;if(y>i*F*G){var H=(a.x*s.y-a.y*s.x)*C,ie=(a.x*o.y-a.y*o.x)*C;return!In(H,0,1)||!In(ie,0,1)?null:{x:t.x+H*o.x,y:t.y+H*o.y}}return null},ru=function(t,e){var r=t.x,n=t.y,i=t.width,a=t.height,o=r+i/2,s=n+a/2,d=[],y={x:o,y:s};d.push({x:r,y:n}),d.push({x:r+i,y:n}),d.push({x:r+i,y:n+a}),d.push({x:r,y:n+a}),d.push({x:r,y:n});for(var C=null,F=1;F<d.length&&(C=Bs(d[F-1],d[F],y,e),!C);F++);return C},ys=function(t,e){var r=t.x,n=t.y,i=t.r,a=e.x,o=e.y,s=a-r,d=o-n;if(s*s+d*d<i*i)return null;var y=Math.atan(d/s);return{x:r+Math.abs(i*Math.cos(y))*Math.sign(s),y:n+Math.abs(i*Math.sin(y))*Math.sign(d)}},Nn=function(t,e){var r=t.rx,n=t.ry,i=t.x,a=t.y,o=e.x-i,s=e.y-a,d=Math.atan2(s/n,o/r);return d<0&&(d+=2*Math.PI),{x:i+r*Math.cos(d),y:a+n*Math.sin(d)}},Do=function(t,e,r){r===void 0&&(r=1);var n=[t.x,t.y,r];return(!e||isNaN(e[0]))&&(e=[1,0,0,0,1,0,0,0,1]),_a.transformMat3(n,n,e),{x:n[0],y:n[1]}},Qu=function(t,e,r){r===void 0&&(r=1),(!e||isNaN(e[0]))&&(e=[1,0,0,0,1,0,0,0,1]);var n=$o.invert([1,0,0,0,1,0,0,0,1],e);n||(n=[1,0,0,0,1,0,0,0,1]);var i=[t.x,t.y,r];return _a.transformMat3(i,i,n),{x:i[0],y:i[1]}},ua=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,a=t.x-r.x,o=t.y-r.y,s=(t.x*t.x-e.x*e.x-e.y*e.y+t.y*t.y)/2,d=(t.x*t.x-r.x*r.x-r.y*r.y+t.y*t.y)/2,y=i*a-n*o;return{x:-(o*s-i*d)/y,y:-(n*d-a*s)/y}},Jo=function(t,e){var r=t.x-e.x,n=t.y-e.y;return Math.sqrt(r*r+n*n)},Gs=function(t,e){var r=[];return t.forEach(function(n){var i=[];n.forEach(function(a){i.push(a*e)}),r.push(i)}),r},Za=function(t){for(var e=[],r=t.length,n=0;n<r;n+=1){e[n]=[];for(var i=0;i<r;i+=1)n===i?e[n][i]=0:t[n][i]===0||!t[n][i]?e[n][i]=Infinity:e[n][i]=t[n][i]}for(var a=0;a<r;a+=1)for(var n=0;n<r;n+=1)for(var i=0;i<r;i+=1)e[n][i]>e[n][a]+e[a][i]&&(e[n][i]=e[n][a]+e[a][i]);return e},ms=function(t,e){var r=t.nodes,n=t.edges,i=[],a={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(function(o,s){a[o.id]=s;var d=[];i.push(d)}),n&&n.forEach(function(o){var s=o.source,d=o.target,y=a[s],C=a[d];i[y][C]=1,e||(i[C][y]=1)}),i},bs=function(t,e){t.translate(e.x,e.y)},xa=function(t,e,r,n){n===void 0&&(n={duration:500});var i=t.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var a=t.getCanvasBBox(),o=e.x-a.minX,s=e.y-a.minY;if(r){var d=o*i[0],y=s*i[4],C=0,F=0,G=0,H=0;t.animate(function(se){return G=d*se,H=y*se,i=Qo(i,[["t",G-C,H-F]]),C=G,F=H,{matrix:i}},n)}else{var ie=Qo(i,[["t",o,s]]);t.setMatrix(ie)}},Pa=function(t,e){var r=t.getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]);var n=e;(0,_.isArray)(e)||(n=[e,e]),(0,_.isArray)(e)&&e.length===1&&(n=[e[0],e[0]]),r=Qo(r,[["s",n[0],n[1]]]),t.setMatrix(r)},qo=function(t,e){var r=t.getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]),r=Qo(r,[["r",e]]),t.setMatrix(r)},eo=function(t,e,r){for(var n=[],i=0;i<t;i++)n[i]=0;return r.forEach(function(a){a.source&&(n[e[a.source]]+=1),a.target&&(n[e[a.target]]+=1)}),n};function es(h,t,e){return(e[0]-h[0])*(t[1]-h[1])==(t[0]-h[0])*(e[1]-h[1])&&Math.min(h[0],t[0])<=e[0]&&e[0]<=Math.max(h[0],t[0])&&Math.min(h[1],t[1])<=e[1]&&e[1]<=Math.max(h[1],t[1])}var ts=function(t,e,r){var n=!1,i=t.length,a=1e-6;function o(C){return Math.abs(C)<a?0:C<0?-1:1}if(i<=2)return!1;for(var s=0;s<i;s++){var d=t[s],y=t[(s+1)%i];if(es(d,y,[e,r]))return!0;o(d[1]-r)>0!=o(y[1]-r)>0&&o(e-(r-d[1])*(d[0]-y[0])/(d[1]-y[1])-d[0])<0&&(n=!n)}return n},nu=function(t,e){return!(e.minX>t.maxX||e.maxX<t.minX||e.minY>t.maxY||e.maxY<t.minY)},To=function(t,e){var r=!1;return(0,_.each)(t,function(n){if(Bs(n.from,n.to,e.from,e.to))return r=!0,!1}),r},Es=function(t,e){var r=function(F){var G=F.map(function(ie){return ie[0]}),H=F.map(function(ie){return ie[1]});return{minX:Math.min.apply(null,G),maxX:Math.max.apply(null,G),minY:Math.min.apply(null,H),maxY:Math.max.apply(null,H)}},n=function(F){for(var G=[],H=F.length,ie=0;ie<H-1;ie++){var se=F[ie],ce=F[ie+1];G.push({from:{x:se[0],y:se[1]},to:{x:ce[0],y:ce[1]}})}if(G.length>1){var de=F[0],xe=F[H-1];G.push({from:{x:xe[0],y:xe[1]},to:{x:de[0],y:de[1]}})}return G};if(t.length<2||e.length<2)return!1;var i=r(t),a=r(e);if(!nu(i,a))return!1;var o=!1;if((0,_.each)(e,function(C){if(ts(t,C[0],C[1]))return o=!0,!1}),o||((0,_.each)(t,function(C){if(ts(e,C[0],C[1]))return o=!0,!1}),o))return!0;var s=n(t),d=n(e),y=!1;return(0,_.each)(d,function(C){if(To(s,C))return y=!0,!1}),y},pi=function(){function h(t,e,r,n){this.x1=t,this.y1=e,this.x2=r,this.y2=n}return h.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),i={x:t,y:e,minX:t,minY:e,maxX:r,maxY:n,width:r-t,height:n-e};return i},h}(),Fs=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]},iu=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),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){var a=r/i,o=n/i;if(a>=0&&a<=1&&o>=0&&o<=1)return a}return Number.POSITIVE_INFINITY},Ha=function(t,e){for(var r=["top","left","bottom","right"],n=t.getBBox(),i=0,a=[],o=0;o<4;o++){var s=Fs(n,r[o]),d=s[0],y=s[1],C=s[2],F=s[3];a[o]=Bs({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:d,y},{x:C,y:F}),a[o]&&(i+=1)}return[a,i]},au=function(t,e){for(var r=["top","left","bottom","right"],n=t.getBBox(),i=Number.POSITIVE_INFINITY,a=0,o=0;o<4;o++){var s=Fs(n,r[o]),d=s[0],y=s[1],C=s[2],F=s[3],G=iu(e,new pi(d,y,C,F));G=Math.abs(G-.5),G>=0&&G<=1&&(a+=1,i=G<i?G:i)}return a===0?-1:i},po=function(t){var e=0,r=0;if(t.length>0){for(var n=0,i=t;n<i.length;n++){var a=i[n];e+=a.x,r+=a.y}e/=t.length,r/=t.length}return{x:e,y:r}},ca=function(t,e){return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)},to=function(t,e){var r=e.x1,n=e.y1,i=e.x2-r,a=e.y2-n,o=t.x-r,s=t.y-n,d=o*i+s*a,y;d<=0?y=0:(o=i-o,s=a-s,d=o*i+s*a,d<=0?y=0:y=d*d/(i*i+a*a));var C=o*o+s*s-y;return C<0&&(C=0),C},Ra=function(t,e,r){return r===void 0&&(r=.001),Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)<Math.pow(r,2)},Ao=function(t,e){var r=t.x<e.x,n=t.x>e.x+e.width,i=t.y>e.y+e.height,a=t.y<e.y,o=r||n||i||a;if(!o)return 0;if(i&&!r&&!n)return Math.pow(e.y+e.height-t.y,2);if(a&&!r&&!n)return Math.pow(t.y-e.y,2);if(r&&!i&&!a)return Math.pow(e.x-t.x,2);if(n&&!i&&!a)return Math.pow(e.x+e.width-t.x,2);var s=Math.min(Math.abs(e.x-t.x),Math.abs(e.x+e.width-t.x)),d=Math.min(Math.abs(e.y-t.y),Math.abs(e.y+e.height-t.y));return s*s+d*d},li=function(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],o=e.x,s=e.y,d=[i-r,a-n];if(Ti.exactEquals(d,[0,0]))return NaN;var y=[-d[1],d[0]];Ti.normalize(y,y);var C=[o-r,s-n];return Math.abs(Ti.dot(C,y))},fa=function(t,e,r){return t+(e-t)*r},na=function(t,e,r){for(var n=Math.min(t.length,e.length),i=new Array(n),a=0;a<n;a++)i[a]=fa(t[a],e[a],r);return i},Xi="rgb(95, 149, 255)",io="rgb(255, 255, 255)",go="rgb(0, 0, 0)",_s="rgb(247, 250, 255)",No="rgb(239, 244, 255)",yo="rgb(253, 253, 253)",rs="rgb(250, 250, 250)",Lo="rgb(224, 224, 224)",Hi="rgb(234, 234, 234)",Ju="rgb(245, 245, 245)",mf="rgb(191, 213, 255)",mo="#4572d9",Pc="rgb(223, 234, 255)",di={mainStroke:Xi,mainFill:No,activeStroke:Xi,activeFill:_s,inactiveStroke:mf,inactiveFill:_s,selectedStroke:Xi,selectedFill:io,highlightStroke:mo,highlightFill:Pc,disableStroke:Lo,disableFill:rs,edgeMainStroke:Lo,edgeActiveStroke:Xi,edgeInactiveStroke:Hi,edgeSelectedStroke:Xi,edgeHighlightStroke:Xi,edgeDisableStroke:Ju,comboMainStroke:Lo,comboMainFill:yo,comboActiveStroke:Xi,comboActiveFill:_s,comboInactiveStroke:Lo,comboInactiveFill:yo,comboSelectedStroke:Xi,comboSelectedFill:yo,comboHighlightStroke:mo,comboHighlightFill:yo,comboDisableStroke:Hi,comboDisableFill:rs},bn={version:"0.7.4",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:di.mainStroke,fill:No},size:20,color:di.mainStroke,linkPoints:{size:8,lineWidth:1,fill:di.activeFill,stroke:di.activeStroke}},nodeStateStyles:{active:{fill:di.activeFill,stroke:di.activeStroke,lineWidth:2,shadowColor:di.mainStroke,shadowBlur:10},selected:{fill:di.selectedFill,stroke:di.selectedStroke,lineWidth:4,shadowColor:di.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:di.highlightFill,stroke:di.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:di.inactiveFill,stroke:di.inactiveStroke,lineWidth:1},disable:{fill:di.disableFill,stroke:di.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:go,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:di.edgeMainStroke,lineAppendWidth:2},color:di.edgeMainStroke},edgeStateStyles:{active:{stroke:di.edgeActiveStroke,lineWidth:1},selected:{stroke:di.edgeSelectedStroke,lineWidth:2,shadowColor:di.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:di.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:di.edgeInactiveStroke,lineWidth:1},disable:{stroke:di.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:go,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:di.comboMainFill,lineWidth:1,stroke:di.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:di.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:di.comboActiveStroke,lineWidth:1,fill:di.comboActiveFill},selected:{stroke:di.comboSelectedStroke,lineWidth:2,fill:di.comboSelectedFill,shadowColor:di.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:di.comboHighlightStroke,lineWidth:2,fill:di.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:di.comboInactiveStroke,fill:di.comboInactiveFill,lineWidth:1},disable:{stroke:di.comboDisableStroke,fill:di.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},windowFontFamily:typeof window!="undefined"&&window.getComputedStyle&&document.body&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},qu={" ":.3329986572265625,a:.5589996337890625,A:.6569992065429687,b:.58599853515625,B:.6769989013671875,c:.5469985961914062,C:.7279998779296875,d:.58599853515625,D:.705999755859375,e:.554998779296875,E:.63699951171875,f:.37299957275390627,F:.5769989013671875,g:.5909988403320312,G:.7479995727539063,h:.555999755859375,H:.7199996948242188,i:.255999755859375,I:.23699951171875,j:.26699981689453123,J:.5169998168945312,k:.5289993286132812,K:.6899993896484375,l:.23499908447265624,L:.5879989624023437,m:.854998779296875,M:.8819992065429687,n:.5589996337890625,N:.7189987182617188,o:.58599853515625,O:.7669998168945312,p:.58599853515625,P:.6419998168945312,q:.58599853515625,Q:.7669998168945312,r:.3649993896484375,R:.6759994506835938,s:.504998779296875,S:.6319992065429687,t:.354998779296875,T:.6189987182617187,u:.5599990844726562,U:.7139999389648437,v:.48199920654296874,V:.6389999389648438,w:.754998779296875,W:.929998779296875,x:.5089996337890625,X:.63699951171875,y:.4959991455078125,Y:.66199951171875,z:.48699951171875,Z:.6239990234375,"0":.6,"1":.40099945068359377,"2":.6,"3":.6,"4":.6,"5":.6,"6":.6,"7":.5469985961914062,"8":.6,"9":.6,"[":.3329986572265625,"]":.3329986572265625,",":.26399993896484375,".":.26399993896484375,";":.26399993896484375,":":.26399993896484375,"{":.3329986572265625,"}":.3329986572265625,"\\":.5,"|":.19499969482421875,"=":.604998779296875,"+":.604998779296875,"-":.604998779296875,_:.5,"`":.3329986572265625," ~":.8329986572265625,"!":.3329986572265625,"@":.8579986572265625,"#":.6,$:.6,"%":.9699996948242188,"^":.517999267578125,"&":.7259994506835937,"*":.505999755859375,"(":.3329986572265625,")":.3329986572265625,"<":.604998779296875,">":.604998779296875,"/":.5,"?":.53699951171875},Ka=Math.PI,xs=Math.sin,ou=Math.cos,la=xs(Ka/8),da=ou(Ka/8),Ro=function(t,e){var r=t.getBBox(),n={x:r.minX,y:r.minY},i={x:r.maxX,y:r.maxY};if(e){var a=e.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]),n=Do(n,a),i=Do(i,a)}var o=n.x,s=n.y,d=i.x,y=i.y;return{x:o,y:s,minX:o,minY:s,maxX:d,maxY:y,width:d-o,height:y-s}},cl=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 i=e.getKeyShape(),a=i.getBBox(),o=t.loopCfg||{},s=o.dist||Math.max(a.width,a.height)*2,d=o.position||bn.defaultLoopPosition,y=[n[6],n[7]],C=[t.startPoint.x,t.startPoint.y],F=[t.endPoint.x,t.endPoint.y],G=a.height/2,H=a.height/2,ie=G*la,se=G*da,ce=H*la,de=H*da;if(C[0]===F[0]&&C[1]===F[1]){switch(d){case"top":C=[y[0]-ie,y[1]-se],F=[y[0]+ce,y[1]-de];break;case"top-right":G=a.height/2,H=a.width/2,ie=G*la,se=G*da,ce=H*la,de=H*da,C=[y[0]+ie,y[1]-se],F=[y[0]+de,y[1]-ce];break;case"right":G=a.width/2,H=a.width/2,ie=G*la,se=G*da,ce=H*la,de=H*da,C=[y[0]+se,y[1]-ie],F=[y[0]+de,y[1]+ce];break;case"bottom-right":G=a.width/2,H=a.height/2,ie=G*la,se=G*da,ce=H*la,de=H*da,C=[y[0]+se,y[1]+ie],F=[y[0]+ce,y[1]+de];break;case"bottom":G=a.height/2,H=a.height/2,ie=G*la,se=G*da,ce=H*la,de=H*da,C=[y[0]+ie,y[1]+se],F=[y[0]-ce,y[1]+de];break;case"bottom-left":G=a.height/2,H=a.width/2,ie=G*la,se=G*da,ce=H*la,de=H*da,C=[y[0]-ie,y[1]+se],F=[y[0]-de,y[1]+ce];break;case"left":G=a.width/2,H=a.width/2,ie=G*la,se=G*da,ce=H*la,de=H*da,C=[y[0]-se,y[1]+ie],F=[y[0]-de,y[1]-ce];break;case"top-left":G=a.width/2,H=a.height/2,ie=G*la,se=G*da,ce=H*la,de=H*da,C=[y[0]-se,y[1]-ie],F=[y[0]-ce,y[1]-de];break;default:G=a.width/2,H=a.width/2,ie=G*la,se=G*da,ce=H*la,de=H*da,C=[y[0]-ie,y[1]-se],F=[y[0]+ce,y[1]-de]}if(o.clockwise===!1){var xe=[C[0],C[1]];C=[F[0],F[1]],F=[xe[0],xe[1]]}}var Ie=[C[0]-y[0],C[1]-y[1]],qe=(G+s)/G,ze=(H+s)/H;o.clockwise===!1&&(qe=(H+s)/H,ze=(G+s)/G);var $e=Ti.scale([0,0],Ie,qe),mt=[y[0]+$e[0],y[1]+$e[1]],xt=[F[0]-y[0],F[1]-y[1]],wt=Ti.scale([0,0],xt,ze),Yt=[y[0]+wt[0],y[1]+wt[1]];return t.startPoint={x:C[0],y:C[1]},t.endPoint={x:F[0],y:F[1]},t.controlPoints=[{x:mt[0],y:mt[1]},{x:Yt[0],y:Yt[1]}],t},fl=function(t,e,r,n,i){var a=1e-4,o=[],s=t==null?void 0:t.getPoint(e);if(!s)return{x:0,y:0,angle:0};if(e<a)o=t.getStartTangent().reverse();else if(e>1-a)o=t.getEndTangent();else{var d=t==null?void 0:t.getPoint(e+a);o.push([s.x,s.y]),o.push([d.x,d.y])}var y=Math.atan2(o[1][1]-o[0][1],o[1][0]-o[0][0]);if(y<0&&(y+=Ka*2),r&&(s.x+=ou(y)*r,s.y+=xs(y)*r),n){var C=y-Ka/2;y>1/2*Ka&&y<3*1/2*Ka&&(C-=Ka),s.x+=ou(C)*n,s.y+=xs(C)*n}var F={x:s.x,y:s.y,angle:y};return i?(y>.5*Ka&&y<1.5*Ka&&(y-=Ka),(0,g.__assign)({rotate:y},F)):F},Oc=function h(t,e){if(e(t)===!1)return!1;if(t&&t.children){for(var r=t.children.length-1;r>=0;r--)if(!h(t.children[r],e))return!1}return!0},xu=function h(t,e){if(t&&t.children){for(var r=t.children.length-1;r>=0;r--)if(!h(t.children[r],e))return}return e(t)!==!1},Fa=function(t,e){typeof e=="function"&&Oc(t,e)},ao=function(t,e){typeof e=="function"&&xu(t,e)},ec=function(t,e){return e*(qu[t]||1)},tc=function(t,e){var r=0,n=new RegExp("[\u4E00-\u9FA5]+");return t.split("").forEach(function(i){n.test(i)?r+=e:r+=ec(i,e)}),[r,e]},bo=function(t,e){return typeof e!="number"||e<=0||e>=t.length?t:t.substring(0,e)+"..."},su=function(t,e){var r=[],n={},i={};t.forEach(function(s){i[s.id]=s}),t.forEach(function(s,d){var y=(0,_.clone)(s);y.itemType="combo",y.children=void 0,y.parentId===y.id?(console.warn("The parentId for combo ".concat(y.id," can not be the same as the combo's id")),delete y.parentId):y.parentId&&!i[y.parentId]&&(console.warn("The parent combo for combo ".concat(y.id," does not exist!")),delete y.parentId);var C=n[y.id];if(C){if(y.children=C.children,n[y.id]=y,C=y,!C.parentId){r.push(C);return}var F=n[C.parentId];if(F)F.children?F.children.push(y):F.children=[y];else{var G={id:C.parentId,children:[C]};n[C.parentId]=G,n[y.id]=y}return}if((0,_.isString)(s.parentId)){var H=n[s.parentId];if(H)H.children?H.children.push(y):H.children=[y],n[y.id]=y;else{var ie={id:s.parentId,children:[y]};n[ie.id]=ie,n[y.id]=y}}else r.push(y),n[y.id]=y});var a={};(e||[]).forEach(function(s){a[s.id]=s;var d=n[s.comboId];if(d){var y={id:s.id,comboId:s.comboId};d.children?d.children.push(y):d.children=[y],y.itemType="node",n[s.id]=y}});var o=0;return r.forEach(function(s){s.depth=o+10,Oc(s,function(d){var y,C=n[d.id].itemType;C==="node"?y=n[d.comboId]:y=n[d.parentId],y&&C==="node"?d.depth=o+1:d.depth=o+10,o<d.depth&&(o=d.depth);var F=a[d.id];return F&&(F.depth=d.depth),!0})}),r},uu=function(t,e,r){var n,i=t,a,o={root:{children:t}},s=!1,d="root";(t||[]).forEach(function(H){if(!s){if(H.id===e){a=H,H.itemType==="combo"?a.parentId=r:a.comboId=r,s=!0;return}Fa(H,function(ie){var se;return o[ie.id]={children:(ie==null?void 0:ie.children)||[]},i=(se=o[ie.parentId||ie.comboId||"root"])===null||se===void 0?void 0:se.children,ie&&(ie.removed||e===ie.id)&&i?(d=ie.parentId||ie.comboId||"root",a=ie,ie.itemType==="combo"?a.parentId=r:a.comboId=r,s=!0,!1):!0})}}),i=(n=o[d])===null||n===void 0?void 0:n.children;var y=i?i.indexOf(a):-1;if(y>-1&&i.splice(y,1),s||(a={id:e,itemType:"node",comboId:r},o[e]={children:void 0}),e){var C=!1;if(r){var F=0;(t||[]).forEach(function(H){C||Fa(H,function(ie){return r===ie.id?(C=!0,ie.children?ie.children.push(a):ie.children=[a],F=ie.depth,a.itemType==="node"?a.depth=F+2:a.depth=F+1,!1):!0})})}else(!r||!C)&&a.itemType!=="node"&&t.push(a);var G=a.depth;Fa(a,function(H){return H.itemType==="node"?G+=2:G+=1,H.depth=G,!0})}return t},ko=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 i=r==null?void 0:r.getModel(),a=i||{},o=a.x,s=a.y;return{minX:o,minY:s,maxX:o,maxY:s,x:o,y:s,width:void 0,height:void 0}}return t.forEach(function(d){var y=e.findById(d.id);if(!(!y||!y.isVisible())){y.set("bboxCanvasCache",void 0);var C=y.getCanvasBBox();C.x&&n.minX>C.minX&&(n.minX=C.minX),C.y&&n.minY>C.minY&&(n.minY=C.minY),C.x&&n.maxX<C.maxX&&(n.maxX=C.maxX),C.y&&n.maxY<C.maxY&&(n.maxY=C.maxY)}}),n.x=(n.minX+n.maxX)/2,n.y=(n.minY+n.maxY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2,Object.keys(n).forEach(function(d){(n[d]===Infinity||n[d]===-Infinity)&&(n[d]=void 0)}),n},rc=function(t){var e=(0,_.isNumber)(t.x)||(0,_.isNumber)(t.y)||t.type||t.anchorPoints||t.size;return t.style&&(e=e||(0,_.isNumber)(t.style.r)||(0,_.isNumber)(t.style.width)||(0,_.isNumber)(t.style.height)||(0,_.isNumber)(t.style.rx)||(0,_.isNumber)(t.style.ry)),e},Ss=function(t){var e={};return Object.keys(t).forEach(function(r){var n=t[r];if((0,_.isObject)(n)&&!(0,_.isArray)(n)){var i={};Object.keys(n).forEach(function(a){var o=n[a];a==="img"&&!(0,_.isString)(o)||(i[a]=(0,_.clone)(o))}),e[r]=i}else e[r]=(0,_.clone)(n)}),e},Bo=function(t){var e=t.animateCfg,r=t.callback,n;if(!e)n={duration:500,callback:r};else if(n=(0,_.clone)(e),e.callback){var i=e.callback;n.callback=function(){r(),i()}}else n.callback=r;return n},cu=function(t){if(!t)return console.error("G6 Error Tips: the data must be defined"),!1;var e=t.nodes,r=t.edges,n=t.combos,i=n===void 0?[]:n;if(!e&&!r){var a=!0;return Fa(t,function(F){return(0,_.isString)(F.id)?!0:(a=!1,!1)}),a}var o=(e||[]).find(function(F){return!(0,_.isString)(F.id)});if(o)return console.warn("G6 Warning Tips: missing 'id' property, or %c".concat(o.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1;var s=(e||[]).map(function(F){return F.id}),d=i==null?void 0:i.map(function(F){return F.id}),y=(0,g.__spreadArray)((0,g.__spreadArray)([],s,!0),d,!0),C=(r||[]).find(function(F){return!y.includes(F.source)||!y.includes(F.target)});return C?(console.warn("G6 Warning Tips: The source %c".concat(C.source,"%c or the target %c").concat(C.target,"%c of the edge do not exist in the nodes or combos."),"font-size: 20px; color: red;","","font-size: 20px; color: red;",""),!1):!0},bf=function(t,e){if(t==="node"||t==="combo"){if(e.id&&!(0,_.isString)(e.id))return console.warn("G6 Warning Tips: missing 'id' property, or the 'id' %c".concat(e.id,"%c is not a string."),"font-size: 20px; color: red;",""),!1}else if(t==="edge"&&(!e.source||!e.target))return console.warn("G6 Warning Tips: missing 'source' or 'target' for the edge."),!1;return!0},ll=function(){function h(t){this.graph=t,this.destroyed=!1,this.modes=t.get("modes")||{default:[]},this.formatModes(),this.mode=t.get("defaultMode")||"default",this.currentBehaves=[],this.setMode(this.mode)}return h.prototype.formatModes=function(){var t=this.modes;(0,_.each)(t,function(e){(0,_.each)(e,function(r,n){(0,_.isString)(r)&&(e[n]={type:r})})})},h.prototype.setBehaviors=function(t){var e=this.graph,r=this.modes[t],n=[],i;(0,_.each)(r||[],function(a){var o=z.getBehavior(a.type||a);!o||(i=new o(a),i&&(i.bind(e),n.push(i)))}),this.currentBehaves=n},h.mergeBehaviors=function(t,e){return(0,_.each)(e,function(r){t.indexOf(r)<0&&((0,_.isString)(r)&&(r={type:r}),t.push(r))}),t},h.filterBehaviors=function(t,e){var r=[];return t.forEach(function(n){var i="";(0,_.isString)(n)?i=n:i=n.type,e.indexOf(i)<0&&r.push(n)}),r},h.prototype.setMode=function(t){var e=this,r=e.modes,n=e.graph,i=t,a=r[i];!a||(n.emit("beforemodechange",{mode:t}),(0,_.each)(this.currentBehaves,function(o){o.delegate&&o.delegate.remove(),o.unbind(n)}),this.setBehaviors(i),n.emit("aftermodechange",{mode:t}),this.mode=t)},h.prototype.getMode=function(){return this.mode},h.prototype.manipulateBehaviors=function(t,e,r){var n=this,i;if((0,_.isArray)(t)?i=t:i=[t],(0,_.isArray)(e))return(0,_.each)(e,function(o){n.modes[o]?r?n.modes[o]=h.mergeBehaviors(n.modes[o]||[],i):n.modes[o]=h.filterBehaviors(n.modes[o]||[],i):r&&(n.modes[o]=i)}),this;var a=e;return e||(a=this.mode),this.modes[a]||r&&(this.modes[a]=i),r?this.modes[a]=h.mergeBehaviors(this.modes[a]||[],i):this.modes[a]=h.filterBehaviors(this.modes[a]||[],i),this.formatModes(),this.setMode(this.mode),this},h.prototype.updateBehavior=function(t,e,r){(0,_.isString)(t)&&(t={type:t});var n=[];if(!r||r===this.mode||r==="default"){if(n=this.currentBehaves,!n||!n.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var i=n.length,a=0;a<i;a++){var o=n[a];if(o.type===t.type)return o.updateCfg(e),this;a===i-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}else{if(n=this.modes[r],!n||!n.length)return console.warn("Update behavior failed! There is no behaviors in this mode on the graph."),this;for(var s=n.length,a=0;a<s;a++){var o=n[a];if(o.type===t.type||o===t.type)return o===t.type&&(o={type:o}),Object.assign(o,e),n[a]=o,this;a===s-1&&console.warn("Update behavior failed! There is no such behavior in the mode")}}return this},h.prototype.destroy=function(){this.graph=null,this.modes=null,this.currentBehaves=null,this.destroyed=!0},h}(),Ef=ll,_f=M(3232),dl=function(h){(0,g.__extends)(t,h);function t(e,r){var n=h.call(this,e,r)||this;return n.item=r.item,n.canvasX=r.canvasX,n.canvasY=r.canvasY,n.wheelDelta=r.wheelDelta,n.detail=r.detail,n}return t}(_f.ju),ns=function(t){return"".concat(t,"-").concat(Math.random()).concat(Date.now())},Su=function(t){if((0,_.isArray)(t))switch(t.length){case 4:return t;case 3:return t.push(t[1]),t;case 2:return t.concat(t);case 1:return[t[0],t[0],t[0],t[0]];default:return[0,0,0,0]}if((0,_.isNumber)(t))return[t,t,t,t];if((0,_.isString)(t)){var e=parseInt(t,10);return[e,e,e,e]}return[0,0,0,0]},Dc=function(t){var e=new dl(t.type,t);return e.clientX=t.clientX,e.clientY=t.clientY,e.x=t.x,e.y=t.y,e.target=t.target,e.currentTarget=t.currentTarget,e.bubbles=!0,e.item=t.item,e},oo=function(t){if(!t)return!1;for(var e=9,r=[1,0,0,0,1,0,0,0,1],n=0;n<e;n++)if(t[n]!==r[n])return!0;return!1},is=function(t){return Number.isNaN(Number(t))},wu=function(t){for(var e=Infinity,r=-Infinity,n=Infinity,i=-Infinity,a=0;a<t.length;a++){var o=t[a],s=o.getBBox(),d=s.minX,y=s.minY,C=s.maxX,F=s.maxY;d<e&&(e=d),y<n&&(n=y),C>r&&(r=C),F>i&&(i=F)}var G=Math.floor(e),H=Math.floor(n),ie=Math.ceil(r)-Math.floor(e),se=Math.ceil(i)-Math.floor(n);return{x:G,y:H,width:ie,height:se,minX:e,minY:n,maxX:r,maxY:i}},hl=function(t,e,r,n,i){e===void 0&&(e=15),r===void 0&&(r="quadratic"),n===void 0&&(n=void 0),i===void 0&&(i=void 0);for(var a=t.length,o=e*2,s=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],d={},y=[],C={},F=0;F<a;F++){var G=t[F],H=G.source,ie=G.target,se="".concat(H,"-").concat(ie);if(!y[F]){d[se]||(d[se]=[]),y[F]=!0,d[se].push(G);for(var ce=0;ce<a;ce++)if(F!==ce){var de=t[ce],xe=de.source,Ie=de.target;y[ce]||(H===Ie&&ie===xe?(d[se].push(de),y[ce]=!0,C["".concat(xe,"|").concat(Ie,"|").concat(d[se].length-1)]=!0):H===xe&&ie===Ie&&(d[se].push(de),y[ce]=!0))}}}for(var qe in d)for(var ze=d[qe],$e=ze.length,mt=0;mt<$e;mt++){var xt=ze[mt];if(xt.source===xt.target){i&&(xt.type=i),xt.loopCfg={position:s[mt%8],dist:Math.floor(mt/8)*20+50};continue}if($e===1&&n&&xt.source!==xt.target){xt.type=n;continue}xt.type=r;var wt=(mt%2==0?1:-1)*(C["".concat(xt.source,"|").concat(xt.target,"|").concat(mt)]?-1:1);$e%2==1?xt.curveOffset=wt*Math.ceil(mt/2)*o:xt.curveOffset=wt*(Math.floor(mt/2)*o+e)}return t},Mu=M(31278),vl=function(){function h(t){this.destroyed=!1,this.graph=t,this.destroyed=!1}return h.prototype.getViewCenter=function(){var t=this.getFormatPadding(),e=this.graph,r=this.graph.get("width"),n=e.get("height");return{x:(r-t[1]-t[3])/2+t[3],y:(n-t[0]-t[2])/2+t[0]}},h.prototype.fitCenter=function(t,e){var r=this.graph,n=r.get("group");n.resetMatrix();var i=n.getCanvasBBox();if(!(i.width===0||i.height===0)){var a=this.getViewCenter(),o={x:i.x+i.width/2,y:i.y+i.height/2};r.translate(a.x-o.x,a.y-o.y,t,e)}},h.prototype.animatedFitView=function(t,e,r,n,i,a,o,s){var d=this.graph;r=r||{duration:500,easing:"easeCubic"};var y=[1,0,0,0,1,0,0,0,1],C=n.x+i.x-a.x-n.minX,F=n.y+i.y-a.y-n.minY;if(!(is(C)||is(F))){var G=(0,Mu.vs)(y,[["t",C,F]]);if(!s){var H=Bo({animateCfg:r,callback:function(){d.emit("viewportchange",{action:"translate",matrix:G})}});t.animate(function(Ie){return{matrix:na(e,G,Ie)}},H);return}var ie=d.get("minZoom"),se=d.get("maxZoom"),ce=o;ie&&o<ie?(ce=ie,console.warn("fitview failed, ratio out of range, ratio: %f",o,"graph minzoom has been used instead")):se&&o>se&&(ce=se,console.warn("fitview failed, ratio out of range, ratio: %f",o,"graph maxzoom has been used instead"));var de=(0,Mu.vs)(G,[["t",-i.x,-i.y],["s",ce,ce],["t",i.x,i.y]]),xe=Bo({animateCfg:r,callback:function(){t.setMatrix(de),d.emit("viewportchange",{action:"translate",matrix:G}),d.emit("viewportchange",{action:"zoom",matrix:de})}});t.stopAnimate(),t.setMatrix(e),t.animate(function(Ie){return{matrix:na(e,de,Ie)}},xe)}},h.prototype.fitView=function(t,e){var r=this.graph,n=this.getFormatPadding(),i=r.get("width"),a=r.get("height"),o=r.get("group"),s=o.getMatrix()||[1,0,0,0,1,0,0,0,1];o.resetMatrix();var d=o.getCanvasBBox();if(!(d.width===0||d.height===0)){var y=this.getViewCenter(),C={x:d.x+d.width/2,y:d.y+d.height/2},F=(i-n[1]-n[3])/d.width,G=(a-n[0]-n[2])/d.height,H=F;if(F>G&&(H=G),t)this.animatedFitView(o,s,e,d,y,C,H,!0);else{var ie=y.x-C.x,se=y.y-C.y;if(is(ie)||is(se))return;r.translate(ie,se),r.zoom(H,y)||console.warn("zoom failed, ratio out of range, ratio: %f",H)}}},h.prototype.fitViewByRules=function(t,e,r){var n=t.onlyOutOfViewPort,i=n===void 0?!1:n,a=t.direction,o=a===void 0?"both":a,s=t.ratioRule,d=s===void 0?"min":s,y=this.graph,C=this.getFormatPadding(),F=y.get("width"),G=y.get("height"),H=y.get("group"),ie=H.getMatrix()||[1,0,0,0,1,0,0,0,1];H.resetMatrix();var se=H.getCanvasBBox();if(!(se.width===0||se.height===0)){var ce=this.getViewCenter(),de={x:se.x+se.width/2,y:se.y+se.height/2},xe=(F-C[1]-C[3])/se.width,Ie=(G-C[0]-C[2])/se.height,qe;if(o==="x"?qe=xe:o==="y"?qe=Ie:qe=d==="max"?Math.max(xe,Ie):Math.min(xe,Ie),i&&(qe=qe<1?qe:1),e)this.animatedFitView(H,ie,r,se,ce,de,qe,!0);else{var ze=y.getZoom(),$e=ze*qe,mt=y.get("minZoom");$e<mt&&($e=mt,console.warn("fitview failed, ratio out of range, ratio: %f",qe,"graph minzoom has been used instead")),y.translate(ce.x-de.x,ce.y-de.y),y.zoomTo($e,ce)}}},h.prototype.getFormatPadding=function(){var t=this.graph.get("fitViewPadding");return Su(t)},h.prototype.focusPoint=function(t,e,r){var n=this,i=this.getViewCenter(),a=this.getPointByCanvas(i.x,i.y),o=this.graph.get("group").getMatrix();if(o||(o=[1,0,0,0,1,0,0,0,1]),e){var s=(a.x-t.x)*o[0],d=(a.y-t.y)*o[4],y=0,C=0,F=0,G=0;this.graph.get("canvas").animate(function(H){F=s*H,G=d*H,n.graph.translate(F-y,G-C),y=F,C=G},(0,g.__assign)({},r))}else this.graph.translate((a.x-t.x)*o[0],(a.y-t.y)*o[4])},h.prototype.getPointByCanvas=function(t,e){var r=this.graph.get("group").getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]);var n=Qu({x:t,y:e},r);return n},h.prototype.getPointByClient=function(t,e){var r=this.graph.get("canvas"),n=r.getPointByClient(t,e);return this.getPointByCanvas(n.x,n.y)},h.prototype.getClientByPoint=function(t,e){var r=this.graph.get("canvas"),n=this.getCanvasByPoint(t,e),i=r.getClientByPoint(n.x,n.y);return{x:i.x,y:i.y}},h.prototype.getCanvasByPoint=function(t,e){var r=this.graph.get("group").getMatrix();return r||(r=[1,0,0,0,1,0,0,0,1]),Do({x:t,y:e},r)},h.prototype.focus=function(t,e,r){if((0,_.isString)(t)&&(t=this.graph.findById(t)),t){var n=0,i=0;if(t.getType&&t.getType()==="edge"){var a=t.getSource().get("group").getMatrix(),o=t.getTarget().get("group").getMatrix();a&&o?(n=(a[6]+o[6])/2,i=(a[7]+o[7])/2):(a||o)&&(n=a?a[6]:o[6],i=a?a[7]:o[7])}else{var s=t.get("group"),d=s.getMatrix();d||(d=[1,0,0,0,1,0,0,0,1]),n=d[6],i=d[7]}this.focusPoint({x:n,y:i},e,r)}},h.prototype.focusItems=function(t,e,r,n){if(!!t.length){var i=this.graph,a=this.getFormatPadding(),o=i.get("width"),s=i.get("height"),d=i.get("group"),y=d.getMatrix()||[1,0,0,0,1,0,0,0,1];d.resetMatrix();for(var C={x:0,y:0,minX:Number.MAX_SAFE_INTEGER,minY:Number.MAX_SAFE_INTEGER,maxX:Number.MIN_SAFE_INTEGER,maxY:Number.MIN_SAFE_INTEGER,width:0,height:0},F=0,G=t;F<G.length;F++){var H=G[F],ie=H.getBBox();ie.minX<C.minX&&(C.minX=ie.minX),ie.minY<C.minY&&(C.minY=ie.minY),ie.maxX>C.maxX&&(C.maxX=ie.maxX),ie.maxY>C.maxY&&(C.maxY=ie.maxY)}if(C.x=C.minX,C.y=C.minY,C.width=C.maxX-C.minX,C.height=C.maxY-C.minY,!(C.width===0||C.height===0)){var se=this.getViewCenter(),ce={x:C.x+C.width/2,y:C.y+C.height/2},de=(o-a[1]-a[3])/C.width,xe=(s-a[0]-a[2])/C.height,Ie=de;de>xe&&(Ie=xe),r?this.animatedFitView(d,y,n,C,se,ce,Ie,e):(i.translate(se.x-ce.x,se.y-ce.y),e&&!i.zoom(Ie,se)&&console.warn("zoom failed, ratio out of range, ratio: %f",Ie))}}},h.prototype.changeSize=function(t,e){var r=this.graph;if(!(0,_.isNumber)(t)||!(0,_.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 i=r.get("plugins");i.forEach(function(a){a.get("gridContainer")&&a.positionInit()})},h.prototype.destroy=function(){this.graph=null,this.destroyed=!1},h}(),pl=vl;function Nc(h){return Nc=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},Nc(h)}function zn(h){if(typeof h!="string")return h;var t=function($e){if(typeof $e!="string")return $e;try{return JSON.parse($e.trim())}catch(mt){return $e.trim()}},e=t(h);if(typeof e!="string")return e;for(var r=function($e){return $e[$e.length-1]},n=h.trim(),i=[],a=[],o=function(){for(var $e=[],mt=0;mt<arguments.length;mt++)$e[mt]=arguments[mt];return $e.some(function(xt){return r(a)===xt})},s=function(){return r(i)},d=null,y=0,C="";y<n.length;){var F=n[y],G=o('"',"'");if(!G&&!F.trim()){y+=1;continue}var H=n[y-1]==="\\",ie=o("}"),se=o("]"),ce=o(","),de=s();if(G)if(r(a)===F&&!H){a.pop();var xe=t(C);de.push(xe),d=xe,C=""}else C+=F;else if(se&&F===",")C&&(de.push(t(C)),C="");else if(ie&&F===":")a.push(","),C&&(de.push(C),C="");else if(ce&&F===",")C&&(de.push(t(C)),C=""),a.pop();else if(F==="}"&&(ie||ce)){C&&(de.push(t(C)),C=""),ce&&a.pop();for(var Ie={},qe=1;qe<de.length;qe+=2)Ie[de[qe-1]]=de[qe];i.pop(),i.length&&r(i).push(Ie),a.pop(),d=Ie}else F==="]"&&se?(C&&(de.push(t(C)),C=""),i.pop(),i.length&&r(i).push(de),a.pop(),d=de):F==="{"?(i.push([]),a.push("}")):F==="["?(i.push([]),a.push("]")):F==='"'?a.push('"'):F==="'"?a.push("'"):C+=F;y+=1}return d||C}var gl=function(t){return t.split("-").reduce(function(e,r){return e+r.charAt(0).toUpperCase()+r.slice(1)})},xf=function(t){return function(e){for(var r=t.length,n=[],i=0,a="";i<r;)if(t[i]==="{"&&t[i+1]==="{")n.push(a),a="",i+=2;else if(t[i]==="}"&&t[i+1]==="}"){if(n.length){var o=n.pop();a=(0,_.get)(e,a,o.endsWith("=")?'"{'.concat(a,'}"'):a),n.push(o+a)}i+=2,a=""}else a+=t[i],i+=1;return n.push(a),n.map(function(s,d){return n[d-1]&&n[d-1].endsWith("=")?'"{'.concat(s,'}"'):s}).join("")}};function Lc(h,t){var e={},r=h.getAttributeNames&&h.getAttributeNames()||[],n=h.children&&Array.from(h.children).map(function(o){return Lc(o,t)}),i={},a=h.tagName?h.tagName.toLowerCase():"group";return a==="text"&&(e.text=h.innerText),i.type=a,a==="img"&&(i.type="image"),Array.from(r).forEach(function(o){var s=gl(o),d=h.getAttribute(o);try{if(s==="style"||s==="attrs"){var y=zn(d);e=(0,g.__assign)((0,g.__assign)({},e),y)}else i[s]=zn(d)}catch(C){if(s==="style")throw C;i[s]=d}}),i.attrs=e,t&&t.style&&i.name&&Nc(t.style[i.name])==="object"&&(i.attrs=(0,g.__assign)((0,g.__assign)({},i.attrs),t.style[i.name])),t&&t.style&&i.keyshape&&(i.attrs=(0,g.__assign)((0,g.__assign)({},i.attrs),t.style)),n.length&&(i.children=n),i}function Sf(h,t,e){var r=h.attrs,n=r===void 0?{}:r,i={x:t.x||0,y:t.y||0,width:e.width||0,height:e.height||0},a,o;switch(h.type){case"maker":case"circle":n.r&&(o=2*n.r,a=2*n.r);break;case"text":n.text&&(o=tc(n.text,n.fontSize||12)[0],a=16,i.y+=a,i.height=a,i.width=o,h.attrs=(0,g.__assign)({fontSize:12,fill:"#000"},n));break;default:n.width&&(o=n.width),n.height&&(a=n.height)}return a>=0&&(i.height=a),o>=0&&(i.width=o),n.marginTop&&(i.y+=n.marginTop),n.marginLeft&&(i.x+=n.marginLeft),i}function nc(h,t){var e;t===void 0&&(t={x:0,y:0});var r=(0,g.__assign)({x:0,y:0,width:0,height:0},t);if((e=h.children)===null||e===void 0?void 0:e.length){var n=h.attrs,i=n===void 0?{}:n,a=i.marginTop,o=(0,g.__assign)({},t);a&&(o.y+=a);for(var s=0;s<h.children.length;s++){h.children[s].attrs.key="".concat(i.key||"root"," -").concat(s," ");var d=nc(h.children[s],o);if(d.bbox){var y=d.bbox;d.attrs.next==="inline"?o.x+=d.bbox.width:o.y+=d.bbox.height,y.width+y.x>r.width&&(r.width=y.width+y.x),y.height+y.y>r.height&&(r.height=y.height+y.y)}}}return h.bbox=Sf(h,t,r),h.attrs=(0,g.__assign)((0,g.__assign)({},h.attrs),h.bbox),h}function wf(h,t){var e,r,n,i,a=(h||{}).type,o=((t==null?void 0:t.attrs)||{}).key;if(o&&h&&(h.attrs.key=o),!h&&t)return{action:"delete",val:t,type:a,key:o};if(h&&!t)return{action:"add",val:h,type:a};if(!h&&!t)return{action:"same",type:a};var s=[];if(((e=h.children)===null||e===void 0?void 0:e.length)>0||((r=t.children)===null||r===void 0?void 0:r.length)>0)for(var d=Math.max((n=h.children)===null||n===void 0?void 0:n.length,(i=t.children)===null||i===void 0?void 0:i.length),y=t.children||[],C=h.children||[],F=0;F<d;F+=1)s.push(wf(C[F],y[F]));var G=Object.keys(t.attrs),H=Object.keys(h.attrs);return t.type!==h.type?{action:"restructure",nowTarget:h,formerTarget:t,key:o,children:s}:G.filter(function(ie){return ie!=="children"}).some(function(ie){return h.attrs[ie]!==t.attrs[ie]||!H.includes(ie)})?{action:"change",val:h,children:s,type:a,key:o}:{action:"same",children:s,type:a,key:o}}function Cu(h){var t={},e=function(n){var i=typeof h=="function"?h(n):h,a=xf(i)(n),o=document.createElement("div");o.innerHTML=a;var s=o.children[0],d=nc(Lc(s,n));return o.remove(),d};return{draw:function(n,i){var a=e(n),o=i,s=function d(y){var C=y.attrs,F=C===void 0?{}:C,G=y.bbox,H=y.type,ie=y.children,se=(0,g.__rest)(y,["attrs","bbox","type","children"]);if(y.type!=="group"){var ce=i.addShape(y.type,(0,g.__assign)({attrs:F,origin:{bbox:G,type:H,children:ie}},se));y.keyshape&&(o=ce)}y.children&&y.children.forEach(function(de){return d(de)})};return s(a),t[n.id]=[a],o},update:function(n,i){t[n.id]||(t[n.id]=[]);var a=i.getContainer(),o=a.get("children"),s=e(n),d=t[n.id].pop(),y=wf(s,d),C=function H(ie){var se;ie.type!=="group"&&a.addShape(ie.type,{attrs:ie.attrs}),((se=ie.children)===null||se===void 0?void 0:se.length)&&ie.children.map(function(ce){return H(ce)})},F=function H(ie){var se,ce=o.find(function(de){return de.attrs.key===ie.attrs.key});ce&&a.removeChild(ce),((se=ie.children)===null||se===void 0?void 0:se.length)&&ie.children.map(function(de){return H(de)})},G=function H(ie){var se=ie.key;if(ie.type!=="group"){var ce=o.find(function(xe){return xe.attrs.key===se});switch(ie.action){case"change":if(ce){var de=ie.val.keyshape?i.getOriginStyle():{};ce.attr((0,g.__assign)((0,g.__assign)({},de),ie.val.attrs))}break;case"add":C(ie.val);break;case"delete":F(ie.val);break;case"restructure":F(ie.formerTarget),C(ie.nowTarget);break;default:break}}ie.children&&ie.children.forEach(function(xe){return H(xe)})};G(y),t[n.id].push(s)},getAnchorPoints:function(){return[[0,.5],[1,.5],[.5,1],[.5,0]]}}}var ic={};function Mf(h){return ic[h]||(ic[h]=(0,_.upperFirst)(h)),ic[h]}var Rc={defaultShapeType:"defaultType",className:null,getShape:function(t){var e=this,r=e[t]||e[e.defaultShapeType]||e["simple-circle"];return r},draw:function(t,e,r){var n=this.getShape(t);r.shapeMap={};var i=n.draw(e,r);return n.afterDraw&&n.afterDraw(e,r,i),i},baseUpdate:function(t,e,r,n){var i,a,o=this.getShape(t);o.update&&(o.mergeStyle=(i=o.getOptions)===null||i===void 0?void 0:i.call(o,e,n),(a=o.update)===null||a===void 0||a.call(o,e,r,n)),o.afterUpdate&&o.afterUpdate(e,r)},setState:function(t,e,r,n){var i=this.getShape(t);i.setState(e,r,n)},shouldUpdate:function(t){var e=this.getShape(t);return!!e.update},getControlPoints:function(t,e){var r=this.getShape(t);return r.getControlPoints(e)},getAnchorPoints:function(t,e){var r=this.getShape(t);return r.getAnchorPoints(e)}},ac={options:{},draw:function(t,e){return this.drawShape(t,e)},drawShape:function(){},afterDraw:function(){},afterUpdate:function(){},setState:function(){},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e=this.options.anchorPoints,r=t.anchorPoints||e;return r}},oc=function(){function h(){}return h.registerFactory=function(t,e){var r=Mf(t),n=Rc,i=(0,g.__assign)((0,g.__assign)({},n),e);return h[r]=i,i.className=r,i},h.getFactory=function(t){var e=Mf(t);return h[e]},h.registerNode=function(t,e,r){var n=h.Node,i;if(typeof e=="string"||typeof e=="function"){var a=Cu(e);i=(0,g.__assign)((0,g.__assign)({},n.getShape("single-node")),a)}else if(e.jsx){var o=e.jsx,a=Cu(o);i=(0,g.__assign)((0,g.__assign)((0,g.__assign)({},n.getShape("single-node")),a),e)}else{n.getShape(r);var s=r?n.getShape(r):ac;i=(0,g.__assign)((0,g.__assign)({},s),e)}return i.type=t,i.itemType="node",n[t]=i,i},h.registerEdge=function(t,e,r){var n=h.Edge,i=r?n.getShape(r):ac,a=(0,g.__assign)((0,g.__assign)({},i),e);return a.type=t,a.itemType="edge",n[t]=a,a},h.registerCombo=function(t,e,r){var n=h.Combo,i=r?n.getShape(r):ac,a=(0,g.__assign)((0,g.__assign)({},i),e);return a.type=t,a.itemType="combo",n[t]=a,a},h}(),Oa=oc;oc.registerFactory("node",{defaultShapeType:"circle"}),oc.registerFactory("edge",{defaultShapeType:"line"}),oc.registerFactory("combo",{defaultShapeType:"circle"});var kc="bboxCache",Tu="bboxCanvasCache",sc=null,yl=function(){function h(t){this._cfg={},this.destroyed=!1;var e={id:void 0,type:"item",model:{},group:void 0,animate:!1,visible:!0,locked:!1,event:!0,keyShape:void 0,states:[]};this._cfg=Object.assign(e,this.getDefaultCfg(),t);var r=this.get("model"),n=r.id,i=this.get("type");typeof n=="undefined"?n=ns(i):typeof n!="string"&&(n=String(n)),this.get("model").id=n,this.set("id",n);var a=t.group;a&&(a.set("item",this),a.set("id",n)),this.init(),this.draw();var o=r.shape||r.type||(i==="edge"?"line":"circle"),s=this.get("shapeFactory");if(s&&s[o]){var d=s[o].options;if(d&&d.stateStyles){var y=this.get("styles")||r.stateStyles;y=(0,_.deepMix)({},d.stateStyles,y),this.set("styles",y)}}}return h.prototype.calculateBBox=function(){var t=this.get("keyShape"),e=this.get("group"),r=Ro(t,e);return r.x=r.minX,r.y=r.minY,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY,r.centerX=(r.minX+r.maxX)/2,r.centerY=(r.minY+r.maxY)/2,r},h.prototype.calculateCanvasBBox=function(){var t=this.get("keyShape"),e=this.get("group"),r=Ro(t,e);return r.x=r.minX,r.y=r.minY,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY,r.centerX=(r.minX+r.maxX)/2,r.centerY=(r.minY+r.maxY)/2,r},h.prototype.drawInner=function(){var t=this,e=t.get("shapeFactory"),r=t.get("group"),n=t.get("model");r.clear();var i=n.visible;if(i!==void 0&&!i&&t.changeVisibility(i),!!e){t.updatePosition(n);var a=t.getShapeCfg(n),o=a.type,s=e.draw(o,a,r);s&&(t.set("keyShape",s),s.set("isKeyShape",!0),s.set("draggable",!0)),this.setOriginStyle(),this.set("currentShape",o),this.restoreStates(e,o)}},h.prototype.setOriginStyle=function(){var t=this.get("group"),e=t.get("children"),r=this.getKeyShape(),n=this,i=r.get("name");if(this.get("originStyle")){var G=this.get("originStyle");i&&!G[i]&&(G[i]={});for(var H=this.getCurrentStatesStyle(),ie=function(ce){var de=e[ce],xe=de.get("name"),Ie=de.attr();if(xe&&xe!==i){var qe=H[xe];G[xe]||(G[xe]={}),qe?Object.keys(Ie).forEach(function(mt){var xt=Ie[mt];xt!==qe[mt]&&(G[xe][mt]=xt)}):G[xe]=de.get("type")!=="image"?(0,_.clone)(Ie):n.getShapeStyleByName(xe)}else{var ze=de.attr(),$e={};Object.keys(H).forEach(function(mt){var xt=H[mt];(mt===i||!(0,_.isPlainObject)(xt))&&($e[mt]=xt)}),Object.keys(ze).forEach(function(mt){var xt=ze[mt];$e[mt]!==xt&&(i?G[i][mt]=xt:G[mt]=xt)})}},o=0;o<e.length;o++)ie(o);delete G.path,delete G.matrix,delete G.x,delete G.y,G[i]&&(delete G[i].x,delete G[i].y,delete G[i].matrix,delete G[i].path),n.set("originStyle",G)}else{for(var a={},o=0;o<e.length;o++){var s=e[o],d=s.get("type"),y=s.get("name");if(y&&y!==i)a[y]=d!=="image"?(0,_.clone)(s.attr()):n.getShapeStyleByName(y),d==="text"&&a[y]&&(delete a[y].x,delete a[y].y,delete a[y].matrix);else{var C=n.getShapeStyleByName();if(delete C.path,delete C.matrix,!i)Object.assign(a,C);else if(y)a[i]=C;else{var F=ns("shape");s.set("name",F),t.shapeMap[F]=s,a[F]=d!=="image"?(0,_.clone)(s.attr()):n.getShapeStyleByName(y)}}}n.set("originStyle",a)}},h.prototype.restoreStates=function(t,e){var r=this,n=r.get("states");(0,_.each)(n,function(i){t.setState(e,i,!0,r)})},h.prototype.init=function(){var t=Oa.getFactory(this.get("type"));this.set("shapeFactory",t)},h.prototype.get=function(t){return this._cfg[t]},h.prototype.set=function(t,e){(0,_.isPlainObject)(t)?this._cfg=(0,g.__assign)((0,g.__assign)({},this._cfg),t):this._cfg[t]=e},h.prototype.getDefaultCfg=function(){return{}},h.prototype.clearCache=function(){this.set(kc,null),this.set(Tu,null)},h.prototype.beforeDraw=function(){},h.prototype.afterDraw=function(){},h.prototype.afterUpdate=function(){},h.prototype.draw=function(){this.beforeDraw(),this.drawInner(),this.afterDraw()},h.prototype.getShapeStyleByName=function(t){var e=this.get("group"),r;if(t?r=e.shapeMap[t]:r=this.getKeyShape(),r){var n={};return(0,_.each)(r.attr(),function(i,a){(a!=="img"||(0,_.isString)(i))&&(n[a]=i)}),n}return{}},h.prototype.getShapeCfg=function(t,e){var r=this.get("styles");if(r){var n=t;return n.style=(0,g.__assign)((0,g.__assign)({},r),t.style),n}return t},h.prototype.getStateStyle=function(t){var e=this.get("styles"),r=e&&e[t];return r},h.prototype.getOriginStyle=function(){return this.get("originStyle")},h.prototype.getCurrentStatesStyle=function(){var t=this,e={},r=t.getStates();return!r||!r.length?this.get("originStyle"):((0,_.each)(t.getStates(),function(n){e=Object.assign(e,t.getStateStyle(n))}),e)},h.prototype.setState=function(t,e){var r=this.get("states"),n=this.get("shapeFactory"),i=t,a=t;(0,_.isString)(e)&&(i="".concat(t,":").concat(e),a="".concat(t,":"));var o=r;if((0,_.isBoolean)(e)){var s=r.indexOf(a);if(e){if(s>-1)return;r.push(i)}else s>-1&&r.splice(s,1)}else if((0,_.isString)(e)){var d=r.filter(function(F){return F.includes(a)});d.length>0&&this.clearStates(d),o=o.filter(function(F){return!F.includes(a)}),o.push(i),this.set("states",o)}if(n){var y=this.get("model"),C=y.type;n.setState(C,t,e,this)}},h.prototype.clearStates=function(t){var e=this,r=e.getStates(),n=e.get("shapeFactory"),i=e.get("model"),a=i.type;t||(t=r),(0,_.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(a,s,!1,e)})},h.prototype.getContainer=function(){return this.get("group")},h.prototype.getKeyShape=function(){return this.get("keyShape")},h.prototype.getModel=function(){return this.get("model")},h.prototype.getType=function(){return this.get("type")},h.prototype.getID=function(){return this.get("id")},h.prototype.isItem=function(){return!0},h.prototype.getStates=function(){return this.get("states")},h.prototype.hasState=function(t){var e=this.getStates();return e.indexOf(t)>=0},h.prototype.refresh=function(t){var e=this.get("model");this.updatePosition(e),this.updateShape(t),this.afterUpdate(),this.clearCache()},h.prototype.getUpdateType=function(t){},h.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,i=t.visible;n!==i&&i!==void 0&&this.changeVisibility(i);var a={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,_.mix)(o,s),delete t.stateStyles}Object.assign(r,t),(a.x!==t.x||a.y!==t.y)&&this.updatePosition(t),this.updateShape(e)}this.afterUpdate(),this.clearCache()},h.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 i=this.getShapeCfg(r,t);e.baseUpdate(n,i,this,t),t!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(e,n)},h.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,i=this.get("group");if(isNaN(r)||isNaN(n))return!1;e.x=r,e.y=n;var a=i.getMatrix();return a&&a[6]===r&&a[7]===n?!1:(i.resetMatrix(),bs(i,{x:r,y:n}),this.clearCache(),!0)},h.prototype.getBBox=function(){var t=this.get(kc);return t||(t=this.calculateBBox(),this.set(kc,t)),t},h.prototype.getCanvasBBox=function(){var t=this.get(Tu);return t||(t=this.calculateCanvasBBox(),this.set(Tu,t)),t},h.prototype.toFront=function(){var t=this.get("group");t.toFront()},h.prototype.toBack=function(){var t=this.get("group");t.toBack()},h.prototype.show=function(){this.changeVisibility(!0)},h.prototype.hide=function(){this.changeVisibility(!1)},h.prototype.changeVisibility=function(t){var e=this.get("group");t?e.show():e.hide(),this.set("visible",t)},h.prototype.isVisible=function(){return this.get("visible")},h.prototype.enableCapture=function(t){var e=this.get("group");e&&e.set("capture",t)},h.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}},h}(),Au=yl,$a={source:"start",target:"end"},Qa="Node",Us="Point",ml="Anchor",Cf=function(h){(0,g.__extends)(t,h);function t(){return h!==null&&h.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=$a[e]+Us,i=e+Qa,a=this.get(i);a&&!a.destroyed&&a.removeEdge(this),(0,_.isPlainObject)(r)?(this.set(n,r),this.set(i,null)):r&&(r.addEdge(this),this.set(i,r),this.set(n,null))},t.prototype.getLinkPoint=function(e,r,n){var i=$a[e]+Us,a=e+Qa,o=this.get(i);if(!o){var s=this.get(a),d=e+ml,y=this.getPrePoint(e,n),C=r[d];(0,_.isNil)(C)||(o=s.getLinkPointByAnchor(C)),o=o||s.getLinkPoint(y),(0,_.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 i=e==="source"?"target":"source";return this.getEndPoint(i)},t.prototype.getEndPoint=function(e){var r=e+Qa,n=$a[e]+Us,i=this.get(r);return i?i.get("model"):this.get(n)},t.prototype.getControlPointsByCenter=function(e){var r=this.getEndPoint("source"),n=this.getEndPoint("target"),i=this.get("shapeFactory"),a=e.type;return i.getControlPoints(a,{startPoint:r,endPoint:n})},t.prototype.getEndCenter=function(e){var r=e+Qa,n=$a[e]+Us,i=this.get(r);if(i){var a=i.getBBox();return{x:a.centerX,y:a.centerY}}return this.get(n)},t.prototype.init=function(){h.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},t.prototype.getShapeCfg=function(e,r){var n=this,i=n.get("linkCenter"),a=(r==null?void 0:r.includes("move"))?e:h.prototype.getShapeCfg.call(this,e);if(i)a.startPoint=n.getEndCenter("source"),a.endPoint=n.getEndCenter("target");else{var o=a.controlPoints||n.getControlPointsByCenter(a);a.startPoint=n.getLinkPoint("source",e,o),a.endPoint=n.getLinkPoint("target",e,o)}return a.sourceNode=n.get("sourceNode"),a.targetNode=n.get("targetNode"),a},t.prototype.getModel=function(){var e=this.get("model"),r=this.get("source".concat(Qa)),n=this.get("target".concat(Qa));return r?delete e["source".concat(Qa)]:e.source=this.get("start".concat(Us)),n?delete e["target".concat(Qa)]:e.target=this.get("end".concat(Us)),!(0,_.isString)(e.source)&&!(0,_.isPlainObject)(e.source)&&(e.source=e.source.getID()),!(0,_.isString)(e.target)&&!(0,_.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"),i=n.visible,a=e.visible;i!==a&&a!==void 0&&this.changeVisibility(a);var o=this.get("styles");if(e.stateStyles){var s=e.stateStyles;(0,_.mix)(o,s),delete e.stateStyles}Object.assign(n,e),this.updateShape(r),this.afterUpdate(),this.clearCache()},t.prototype.destroy=function(){var e=this.get("source".concat(Qa)),r=this.get("target".concat(Qa));e&&!e.destroyed&&e.removeEdge(this),r&&!r.destroyed&&r.removeEdge(this),h.prototype.destroy.call(this)},t}(Au),Tf=Cf,fu="anchorPointsCache",bl="bboxCache",Af=function(h){(0,g.__extends)(t,h);function t(){return h!==null&&h.apply(this,arguments)||this}return t.prototype.getNearestPoint=function(e,r){for(var n=0,i=e[0],a=Jo(e[0],r),o=0;o<e.length;o++){var s=e[o],d=Jo(s,r);d<a&&(i=s,a=d,n=o)}return i.anchorIndex=n,i},t.prototype.getDefaultCfg=function(){return{type:"node",edges:[]}},t.prototype.getEdges=function(){return this.get("edges")},t.prototype.getInEdges=function(){var e=this;return this.get("edges").filter(function(r){return r.get("target")===e})},t.prototype.getOutEdges=function(){var e=this;return this.get("edges").filter(function(r){return r.get("source")===e})},t.prototype.getNeighbors=function(e){var r=this,n=this.get("edges");if(e==="target"){var i=function(d){return d.getSource()===r};return n.filter(i).map(function(s){return s.getTarget()})}if(e==="source"){var a=function(d){return d.getTarget()===r};return n.filter(a).map(function(s){return s.getSource()})}var o=function(d){return d.getSource()===r?d.getTarget():d.getSource()};return n.map(o)},t.prototype.getLinkPointByAnchor=function(e){var r=this.getAnchorPoints();return r[e]},t.prototype.getLinkPoint=function(e){var r=this.get("keyShape"),n=r.get("type"),i=this.get("type"),a,o,s=this.getBBox();i==="combo"?(a=s.centerX||(s.maxX+s.minX)/2,o=s.centerY||(s.maxY+s.minY)/2):(a=s.centerX,o=s.centerY);var d=this.getAnchorPoints(),y;switch(n){case"circle":y=ys({x:a,y:o,r:s.width/2},e);break;case"ellipse":y=Nn({x:a,y:o,rx:s.width/2,ry:s.height/2},e);break;default:y=ru(s,e)}var C=y;return d.length&&(C||(C=e),C=this.getNearestPoint(d,C)),C||(C={x:a,y:o}),C},t.prototype.getAnchorPoints=function(){var e=this.get(fu);if(!e){e=[];var r=this.get("shapeFactory"),n=this.getBBox(),i=this.get("model"),a=this.getShapeCfg(i),o=i.type,s=r.getAnchorPoints(o,a)||[];(0,_.each)(s,function(d,y){var C={x:n.minX+d[0]*n.width,y:n.minY+d[1]*n.height,anchorIndex:y};e.push(C)}),this.set(fu,e)}return e},t.prototype.addEdge=function(e){this.get("edges").push(e)},t.prototype.lock=function(){this.set("locked",!0)},t.prototype.unlock=function(){this.set("locked",!1)},t.prototype.hasLocked=function(){return this.get("locked")},t.prototype.removeEdge=function(e){var r=this.getEdges(),n=r.indexOf(e);n>-1&&r.splice(n,1)},t.prototype.clearCache=function(){this.set(bl,null),this.set(fu,null)},t.prototype.getUpdateType=function(e){var r,n,i,a,o;if(!!e){var s=!(0,_.isNil)(e.x),d=!(0,_.isNil)(e.y),y=Object.keys(e);if(y.length===1&&(s||d)||y.length===2&&s&&d)return"move";if((0,_.isNumber)(e.x)||(0,_.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)||((i=e==null?void 0:e.style)===null||i===void 0?void 0:i.height)||((a=e==null?void 0:e.style)===null||a===void 0?void 0:a.rx)||((o=e==null?void 0:e.style)===null||o===void 0?void 0:o.ry)))return"bbox|label";var C=y.includes("label")||y.includes("labelCfg");return C?"style|label":"style"}},t}(Au),as=Af,Sa="bboxCache",Bc="bboxCanvasCache",ws="sizeCache",Go="anchorPointsCache",If=function(h){(0,g.__extends)(t,h);function t(){return h!==null&&h.apply(this,arguments)||this}return t.prototype.getDefaultCfg=function(){return{type:"combo",nodes:[],edges:[],combos:[]}},t.prototype.getShapeCfg=function(e){var r=this.get("styles"),n=this.get("bbox");if(r&&n){var i=e,a={r:Math.hypot(n.height,n.width)/2||bn.defaultCombo.size[0]/2,width:n.width||bn.defaultCombo.size[0],height:n.height||bn.defaultCombo.size[1]};i.style=(0,g.__assign)((0,g.__assign)((0,g.__assign)({},r),e.style),a);var o=e.padding||bn.defaultCombo.padding;return(0,_.isNumber)(o)?(a.r+=o,a.width+=o*2,a.height+=o*2):(a.r+=o[0],a.width+=o[1]+o[3]||o[1]*2,a.height+=o[0]+o[2]||o[0]*2),this.set(ws,a),i}return e},t.prototype.calculateCanvasBBox=function(){if(!this.destroyed){var e=this.get("keyShape"),r=this.get("group"),n=Ro(e,r);n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2;var i=this.get(ws),a=this.get(Sa)||{},o=a.x,s=a.x;if(i){i.width=Math.max(i.width,n.width),i.height=Math.max(i.height,n.height);var d=e.get("type");d==="circle"?(n.width=i.r*2,n.height=i.r*2):(n.width=i.width,n.height=i.height),n.minX=n.centerX-n.width/2,n.minY=n.centerY-n.height/2,n.maxX=n.centerX+n.width/2,n.maxY=n.centerY+n.height/2}else n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.centerX=(n.minX+n.maxX)/2,n.centerY=(n.minY+n.maxY)/2;return n.x=n.minX,n.y=n.minY,(n.x!==o||n.y!==s)&&this.set(Go,null),n}},t.prototype.getChildren=function(){var e=this;return{nodes:e.getNodes(),combos:e.getCombos()}},t.prototype.getNodes=function(){var e=this;return e.get("nodes")},t.prototype.getCombos=function(){var e=this;return e.get("combos")},t.prototype.addChild=function(e){var r=this,n=e.getType();switch(n){case"node":r.addNode(e);break;case"combo":r.addCombo(e);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},t.prototype.addCombo=function(e){var r=this;return r.get("combos").push(e),!0},t.prototype.addNode=function(e){var r=this;return r.get("nodes").push(e),!0},t.prototype.removeChild=function(e){var r=this,n=e.getType();switch(n){case"node":r.removeNode(e);break;case"combo":r.removeCombo(e);break;default:return console.warn("Only node or combo items are allowed to be added into a combo"),!1}return!0},t.prototype.removeCombo=function(e){if(!!e){var r=this.getCombos(),n=r.indexOf(e);return n>-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(Bc,null);var e=this.calculateCanvasBBox();return e},t.prototype.clearCache=function(){this.set(Sa,null),this.set(Bc,null),this.set(Go,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(ws,null),this.set("bbox",null),r.remove(),this._cfg=null,this.destroyed=!0}},t}(as),Pf=If,Gc="node",Fc="edge",El="vedge",uc="combo",Io="default",Uc="Mapper",zs="stateStyles",_l=function(){function h(t){var e=this;this.edgeToBeUpdateMap={},this.throttleRefresh=(0,_.throttle)(function(r){var n,i=e.graph;if(!(!i||i.get("destroyed"))){var a=e.edgeToBeUpdateMap;!a||!((n=Object.keys(a))===null||n===void 0?void 0:n.length)||(Object.keys(a).forEach(function(o){var s=a[o].edge;if(!(!s||s.destroyed)){var d=s.getSource(),y=s.getTarget();!d||d.destroyed||!y||y.destroyed||s.refresh(a[o].updateType)}}),e.edgeToBeUpdateMap={})}},16,{trailing:!0,leading:!0}),this.graph=t,this.destroyed=!1}return h.prototype.addItem=function(t,e){var r=this.graph,n=t===El?Fc:t,i=r.get("".concat(n,"Group"))||r.get("group"),a=(0,_.upperFirst)(n),o=null,s=r.get(n+(0,_.upperFirst)(zs))||{},d=r.get(Io+a);e[zs]&&(s=e[zs]),d&&(0,_.each)(d,function(ze,$e){(0,_.isObject)(ze)&&!(0,_.isArray)(ze)?e[$e]=(0,_.deepMix)({},ze,e[$e]):(0,_.isArray)(ze)?e[$e]=e[$e]||(0,_.clone)(d[$e]):e[$e]=e[$e]||d[$e]});var y=r.get(n+Uc);if(y){var C=y(e);C[zs]&&(s=C[zs],delete C[zs]),(0,_.each)(C,function(ze,$e){(0,_.isObject)(ze)&&!(0,_.isArray)(ze)?e[$e]=(0,_.deepMix)({},e[$e],ze):e[$e]=C[$e]||e[$e]})}if(r.emit("beforeadditem",{type:t,model:e}),t===Fc||t===El){var F=void 0,G=void 0;if(F=e.source,G=e.target,F&&(0,_.isString)(F)&&(F=r.findById(F)),G&&(0,_.isString)(G)&&(G=r.findById(G)),!F||!G){console.warn("The source or target node of edge ".concat(e.id," does not exist!"));return}F.getType&&F.getType()==="combo"&&(e.isComboEdge=!0),G.getType&&G.getType()==="combo"&&(e.isComboEdge=!0),o=new Tf({model:e,source:F,target:G,styles:s,linkCenter:r.get("linkCenter"),group:i.addGroup()})}else if(t===Gc)o=new as({model:e,styles:s,group:i.addGroup()});else if(t===uc){var H=e.children,ie=ko(H,r),se=void 0,ce=void 0;if(isNaN(ie.x)?isNaN(e.x)&&(se=Math.random()*100):se=ie.x,isNaN(ie.y)?isNaN(e.y)&&(ce=Math.random()*100):ce=ie.y,isNaN(e.x)||isNaN(e.y))e.x=se,e.y=ce;else{var de=e.x-se,xe=e.y-ce;this.updateComboSucceeds(e.id,de,xe,H)}var Ie=i.addGroup();Ie.setZIndex(e.depth),o=new Pf({model:e,styles:s,animate:!1,bbox:e.collapsed?ko([],r):ie,group:Ie});var qe=o.getModel();(H||[]).forEach(function(ze){var $e=r.findById(ze.id);o.addChild($e),ze.depth=qe.depth+2})}if(o)return r.get("".concat(t,"s")).push(o),r.get("itemMap")[o.get("id")]=o,r.emit("afteradditem",{item:o,model:e}),o},h.prototype.updateItem=function(t,e){var r=this,n,i,a=this.graph;if((0,_.isString)(t)&&(t=a.findById(t)),!(!t||t.destroyed)){var o="";t.getType&&(o=t.getType());var s=a.get(o+Uc),d=t.getModel(),y=d.x,C=d.y,F=t.getUpdateType(e);if(s){var G=(0,_.deepMix)({},d,e),H=s(G),ie=(0,_.deepMix)({},d,H,e);H[zs]&&(t.set("styles",ie[zs]),delete ie[zs]),(0,_.each)(ie,function(wt,Yt){e[Yt]=wt})}else(0,_.each)(e,function(wt,Yt){d[Yt]&&(0,_.isObject)(wt)&&!(0,_.isArray)(wt)&&(e[Yt]=(0,g.__assign)((0,g.__assign)({},d[Yt]),e[Yt]))});if(a.emit("beforeupdateitem",{item:t,cfg:e}),o===Fc){if(e.source){var se=e.source;(0,_.isString)(se)&&(se=a.findById(se)),t.setSource(se)}if(e.target){var ce=e.target;(0,_.isString)(ce)&&(ce=a.findById(ce)),t.setTarget(ce)}t.update(e)}else if(o===Gc){t.update(e,F);var de=t.getEdges(),xe=(F==null?void 0:F.includes("bbox"))||F==="move";F==="move"?(0,_.each)(de,function(wt){r.edgeToBeUpdateMap[wt.getID()]={edge:wt,updateType:F},r.throttleRefresh()}):xe&&(0,_.each)(de,function(wt){wt.refresh(F)})}else if(o===uc){if(t.update(e,F),!isNaN(e.x)||!isNaN(e.y)){var Ie=e.x-y||0,qe=e.y-C||0;this.updateComboSucceeds(d.id,Ie,qe)}var ze=t.getEdges(),xe=(F==null?void 0:F.includes("bbox"))||F==="move";if(xe&&o===uc){var $e=t.get("shapeFactory"),mt=d.type||"circle",xt=d.animate===void 0||e.animate===void 0?(i=(n=$e[mt])===null||n===void 0?void 0:n.options)===null||i===void 0?void 0:i.animate:d.animate||e.animate;xt?setTimeout(function(){if(!(!t||t.destroyed)){var Yt=t.getKeyShape();!Yt||Yt.destroyed||(0,_.each)(ze,function(Zt){Zt&&!Zt.destroyed&&Zt.refresh()})}},201):(0,_.each)(ze,function(Yt){Yt.refresh()})}}a.emit("afterupdateitem",{item:t,cfg:e})}},h.prototype.updateCombo=function(t,e,r){var n=this,i,a,o=this.graph;if((0,_.isString)(t)&&(t=o.findById(t)),!(!t||t.destroyed)){var s=t.getModel(),d=ko(e,o,t),y=d.x,C=d.y;t.set("bbox",d);var F=y,G=C;r?(F=isNaN(s.x)?y:s.x,G=isNaN(s.y)?C:s.y):(F=isNaN(y)?s.x:y,G=isNaN(C)?s.y:C),t.update({x:F,y:G});var H=t.get("shapeFactory"),ie=s.type||"circle",se=s.animate===void 0?(a=(i=H[ie])===null||i===void 0?void 0:i.options)===null||a===void 0?void 0:a.animate:s.animate;se?setTimeout(function(){if(!(!t||t.destroyed)){var ce=t.getKeyShape();!ce||ce.destroyed||(t.getShapeCfg(s),n.updateComboEdges(t))}},201):this.updateComboEdges(t)}},h.prototype.updateComboEdges=function(t){for(var e=t.getEdges()||[],r=0;r<e.length;r++){var n=e[r];n&&!n.destroyed&&n.refresh()}},h.prototype.collapseCombo=function(t,e){e===void 0&&(e=!0);var r=this.graph;(0,_.isString)(t)&&(t=r.findById(t));var n=t.getChildren();n.nodes.forEach(function(i){r.hideItem(i,e)}),n.combos.forEach(function(i){r.hideItem(i,e)})},h.prototype.updateComboSucceeds=function(t,e,r,n){var i=this;n===void 0&&(n=[]);var a=this.graph;if(!(!e&&!r)){var o=n;if(!(o==null?void 0:o.length)){var s=a.get("comboTrees");s==null||s.forEach(function(d){Fa(d,function(y){return y.id===t?(o=y.children,!1):!0})})}o==null||o.forEach(function(d){var y=a.findById(d.id);if(y){var C=y.getModel();i.updateItem(d.id,{x:(C.x||0)+e,y:(C.y||0)+r})}})}},h.prototype.expandCombo=function(t,e){e===void 0&&(e=!0);var r=this.graph;(0,_.isString)(t)&&(t=r.findById(t));var n=t.getChildren();n.nodes.forEach(function(i){r.showItem(i,e)}),n.combos.forEach(function(i){i.getModel().collapsed?i.show():r.showItem(i,e)})},h.prototype.removeItem=function(t){var e=this,r=this.graph;if((0,_.isString)(t)&&(t=r.findById(t)),!(!t||t.destroyed)){var n=(0,_.clone)(t.getModel());r.emit("beforeremoveitem",{item:n});var i="";t.getType&&(i=t.getType());var a=r.get("".concat(i,"s")),o=a.indexOf(t);if(o>-1&&a.splice(o,1),i===Fc){var s=r.get("v".concat(i,"s")),d=s.indexOf(t);d>-1&&s.splice(d,1)}var y=t.get("id"),C=r.get("itemMap");delete C[y];var F=r.get("comboTrees"),G=t.get("id");if(i===Gc){var H=t.getModel().comboId;if(F&&H){var ie=F,se=!1;F.forEach(function(ze){se||Fa(ze,function($e){if($e.id===G&&ie){var mt=ie.indexOf($e);return ie.splice(mt,1),se=!0,!1}return ie=$e.children,!0})})}for(var ce=t.getEdges(),de=ce.length-1;de>=0;de--)r.removeItem(ce[de],!1);H&&r.updateCombo(H)}else if(i===uc){var xe=t.getModel().parentId,Ie,qe=!1;(F||[]).forEach(function($e){qe||Fa($e,function(mt){return mt.id===G?(Ie=mt,qe=!0,!1):!0})}),Ie.removed=!0,Ie&&Ie.children&&Ie.children.forEach(function($e){e.removeItem($e.id)});for(var ce=t.getEdges(),de=ce.length;de>=0;de--)r.removeItem(ce[de],!1);xe&&r.updateCombo(xe)}t.destroy(),r.emit("afterremoveitem",{item:n,type:i})}},h.prototype.setItemState=function(t,e,r){var n=this.graph,i=e;(0,_.isString)(r)&&(i="".concat(e,":").concat(r)),!(t.hasState(i)===r&&r||(0,_.isString)(r)&&t.hasState(i))&&(n.emit("beforeitemstatechange",{item:t,state:i,enabled:r}),t.setState(e,r),n.autoPaint(),n.emit("afteritemstatechange",{item:t,state:i,enabled:r}))},h.prototype.priorityState=function(t,e){var r=this.graph,n=t;(0,_.isString)(t)&&(n=r.findById(t)),this.setItemState(n,e,!1),this.setItemState(n,e,!0)},h.prototype.clearItemStates=function(t,e){var r=this.graph;(0,_.isString)(t)&&(t=r.findById(t)),r.emit("beforeitemstatesclear",{item:t,states:e}),t.clearStates(e),r.emit("afteritemstatesclear",{item:t,states:e})},h.prototype.refreshItem=function(t){var e=this.graph;(0,_.isString)(t)&&(t=e.findById(t)),e.emit("beforeitemrefresh",{item:t}),t.refresh(),e.emit("afteritemrefresh",{item:t})},h.prototype.addCombos=function(t,e){var r=this,n=this.graph;(t||[]).forEach(function(a){ao(a,function(o){var s;return e.forEach(function(d){d.id===o.id&&(d.children=o.children,d.depth=o.depth,s=d)}),s&&r.addItem("combo",s),!0})});var i=n.get("comboGroup");i&&i.sort()},h.prototype.changeItemVisibility=function(t,e){var r=this,n=this.graph;if((0,_.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()===Gc){var i=t.getEdges();(0,_.each)(i,function(y){e&&!(y.get("source").isVisible()&&y.get("target").isVisible())||r.changeItemVisibility(y,e)})}else if(t.getType&&t.getType()===uc){var a=n.get("comboTrees"),o=t.get("id"),s=[],d=!1;(a||[]).forEach(function(C){d||!C.children||C.children.length===0||Fa(C,function(F){return F.id===o?(s=F.children,d=!0,!1):!0})}),s&&(!e||e&&!t.getModel().collapsed)&&s.forEach(function(C){var F=n.findById(C.id);r.changeItemVisibility(F,e)});var i=t.getEdges();(0,_.each)(i,function(C){e&&!(C.get("source").isVisible()&&C.get("target").isVisible())||r.changeItemVisibility(C,e)})}return n.emit("afteritemvisibilitychange",{item:t,visible:e}),t},h.prototype.destroy=function(){this.graph=null,this.destroyed=!0},h}(),xl=_l,Ms=null,wa=function(){function h(t){this.graph=t,this.cachedStates={enabled:{},disabled:{}},this.destroyed=!1}return h.checkCache=function(t,e,r){if(!!r[e]){var n=r[e].indexOf(t);n>=0&&r[e].splice(n,1)}},h.cacheState=function(t,e,r){r[e]||(r[e]=[]),r[e].push(t)},h.prototype.updateState=function(t,e,r){var n=this,i=h.checkCache,a=h.cacheState;if(!t.destroyed){var o=this.cachedStates,s=o.enabled,d=o.disabled;r?(i(t,e,d),a(t,e,s)):(i(t,e,s),a(t,e,d)),Ms&&clearTimeout(Ms),Ms=setTimeout(function(){Ms=null,n.updateGraphStates()},16)}},h.prototype.updateStates=function(t,e,r){var n=this;(0,_.isString)(e)?this.updateState(t,e,r):e.forEach(function(i){n.updateState(t,i,r)})},h.prototype.updateGraphStates=function(){var t=this.graph.get("states"),e=this.cachedStates;(0,_.each)(e.disabled,function(r,n){t[n]&&(t[n]=t[n].filter(function(i){return r.indexOf(i)<0&&!r.destroyed}))}),(0,_.each)(e.enabled,function(r,n){if(!t[n])t[n]=r;else{var i={};t[n].forEach(function(a){a.destroyed||(i[a.get("id")]=!0)}),r.forEach(function(a){if(!a.destroyed){var o=a.get("id");i[o]||(i[o]=!0,t[n].push(a))}})}}),this.graph.emit("graphstatechange",{states:t}),this.cachedStates={enabled:{},disabled:{}}},h.prototype.destroy=function(){this.graph=null,this.cachedStates=null,Ms&&clearTimeout(Ms),Ms=null,this.destroyed=!0},h}(),rd=wa,yn=M(80389),cc=function(t,e){return!t||!e?t:t.replace(/\\?\{([^{}]+)\}/g,function(r,n){if(r.charAt(0)==="\\")return r.slice(1);var i=e[n];return i===0&&(i="0"),i||""})},gi=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;r<n.length;r++){var i=n[r],a=i.x,o=i.y;e.push(a),e.push(o)}var s=(0,yn.e9)(e);return s.unshift(["M",t[0].x,t[0].y]),s},fc=function(t,e,r,n){r===void 0&&(r=0),n===void 0&&(n=0);var i={x:(1-r)*t.x+r*e.x,y:(1-r)*t.y+r*e.y},a=[0,0];Ti.normalize(a,[e.x-t.x,e.y-t.y]),(!a||!a[0]&&!a[1])&&(a=[0,0]);var o=[-a[1]*n,a[0]*n];return i.x+=o[0],i.y+=o[1],i},Sl=function(t,e){var r=t.length;if(!r)return"";for(var n="",i="",a=0;a<r;a++){var o=t[a];a===0?i="M{x} {y}":i="L{x} {y}",n+=cc(i,o)}return e&&(n+="Z"),n},lu=function(t){var e=[];return t.forEach(function(r){var n=r[0];if(n!=="A")for(var i=1;i<r.length;i=i+2)e.push([r[i],r[i+1]]);else{var a=r.length;e.push([r[a-2],r[a-1]])}}),e},Of=function(t){if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));var e=t[0],r=t[1],n=t[t.length-1],i=t[t.length-2];t.unshift(n),t.unshift(i),t.push(e),t.push(r);for(var a=[],o=1;o<t.length-2;o+=1){var s=t[o-1].x,d=t[o-1].y,y=t[o].x,C=t[o].y,F=t[o+1].x,G=t[o+1].y,H=o!==t.length-2?t[o+2].x:F,ie=o!==t.length-2?t[o+2].y:G,se=y+(F-s)/6,ce=C+(G-d)/6,de=F-(H-y)/6,xe=G-(ie-C)/6;a.push(["C",se,ce,de,xe,F,G])}return a.unshift(["M",n.x,n.y]),a},zc=function(t,e){return Ti.scale([0,0],Ti.normalize([0,0],t),e)},Df=function(t,e){var r=[t[1]-e[1],e[0]-t[0]],n=Math.sqrt(r[0]*r[0]+r[1]*r[1]);if(n===0)throw new Error("p0 should not be equal to p1");return[r[0]/n,r[1]/n]},wl=function(t,e){return[e[0]-t[0],e[1]-t[1]]};function Nf(h,t){var e=function(C){var F=[C[0][0],C[0][1]-t],G=[C[0][0],C[0][1]+t];return"M ".concat(F," A ").concat(t,",").concat(t,",0,0,0,").concat(G," A ").concat(t,",").concat(t,",0,0,0,").concat(F)},r=function(C){var F=Ti.scale([0,0],Df(C[0],C[1]),t),G=Ti.scale([0,0],F,-1),H=Ti.add([0,0],C[0],F),ie=Ti.add([0,0],C[1],F),se=Ti.add([0,0],C[1],G),ce=Ti.add([0,0],C[0],G);return"M ".concat(H," L ").concat(ie," A ").concat([t,t,"0,0,0",se].join(",")," L ").concat(ce," A ").concat([t,t,"0,0,0",H].join(","))};if(!h||h.length<1)return"";if(h.length===1)return e(h);if(h.length===2)return r(h);for(var n=new Array(h.length),i=0;i<n.length;++i){var a=i===0?h[h.length-1]:h[i-1],o=h[i],s=Ti.scale([0,0],Df(a,o),t);n[i]=[Ti.add([0,0],a,s),Ti.add([0,0],o,s)]}var d="A ".concat([t,t,"0,0,0,"].join(","));return n=n.map(function(y,C){var F="";return C===0&&(F="M ".concat(n[n.length-1][1]," ")),F+="".concat(d+y[0]," L ").concat(y[1]),F}),n.join(" ")}function Fo(h,t){var e=h.length,r=function(y){var C=[y[0][0],y[0][1]-t],F=[y[0][0],y[0][1]+t];return"M ".concat(C," A ").concat([t,t,"0,0,0",F].join(",")," A ").concat([t,t,"0,0,0",C].join(","))},n=function(y){var C=wl(y[0],y[1]),F=zc(C,t),G=Ti.add([0,0],y[0],Ti.scale([0,0],F,-1)),H=Ti.add([0,0],y[1],F),ie=1.2*t,se=zc(Ti.normalize([0,0],C),ie),ce=Ti.scale([0,0],se,-1),de=Ti.add([0,0],G,ce),xe=Ti.add([0,0],H,ce),Ie=Ti.add([0,0],G,se);return"M ".concat(G," C ").concat([de,xe,H].join(",")," S ").concat([Ie,G].join(",")," Z")};if(!h||e<1)return"";if(e===1)return r(h);if(e===2)return n(h);for(var i=h.map(function(d,y){var C=h[(y+1)%e];return{p:d,v:Ti.normalize([0,0],wl(d,C))}}),a=0;a<i.length;++a){var o=a>0?a-1:e-1,s=Ti.normalize([0,0],Ti.add([0,0],i[o].v,Ti.scale([0,0],i[a].v,-1)));i[a].p=Ti.add([0,0],i[a].p,Ti.scale([0,0],s,t))}return i.map(function(d){var y=d.p;return{x:y[0],y:y[1]}})}var Ml=function(t,e,r){return(t.y-r.y)*(e.x-r.x)-(t.x-r.x)*(e.y-r.y)},Wc=function(t){var e=t.map(function(o){return{x:o.getModel().x,y:o.getModel().y}});if(e.sort(function(o,s){return o.x===s.x?o.y-s.y:o.x-s.x}),e.length===1)return e;for(var r=[],n=0;n<e.length;n++){for(;r.length>=2&&Ml(r[r.length-2],r[r.length-1],e[n])<=0;)r.pop();r.push(e[n])}for(var i=[],n=e.length-1;n>=0;n--){for(;i.length>=2&&Ml(i[i.length-2],i[i.length-1],e[n])<=0;)i.pop();i.push(e[n])}i.pop(),r.pop();var a=r.concat(i);return a},Da={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 Lf(h,t,e){var r=!1,n=function(s,d){return t.cells[s+d*t.width]},i=function(s,d){var y=0;return n(s-1,d-1)>=e&&(y+=1),n(s,d-1)>e&&(y+=2),n(s-1,d)>e&&(y+=4),n(s,d)>e&&(y+=8),y},a=function(s,d){for(var y=s,C=d,F,G,H=0;H<t.width*t.height;H++){if(F=y,G=C,h.findIndex(function(se){return se.x===y&&se.y===C})>-1){if(!(h[0].x!==y||h[0].y!==C))return!0}else h.push({x:y,y:C});var ie=i(y,C);switch(ie){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:y++;break;case 12:case 14:case 4:y--;break;case 6:F===0&&(G===-1?y-=1:y+=1);break;case 1:case 13:case 5:C--;break;case 9:F===1&&(G===0?C-=1:C+=1);break;case 10:case 8:case 11:C++;break;default:return console.warn("Marching squares invalid state: ".concat(ie)),!0}}};this.march=function(){for(var o=0;o<t.width&&!r;o+=1)for(var s=0;s<t.height&&!r;s+=1)n(o,s)>e&&i(o,s)!==15&&(r=a(o,s));return r}}var Iu=function(t,e,r){var n=Math.ceil(t/r),i=Math.ceil(e/r),a=new Float32Array(Math.max(0,n*i)).fill(0);return{cells:a,width:n,height:i}},Rf=function(t,e,r){var n=null,i=Number.POSITIVE_INFINITY;return e.forEach(function(a){var o={x:t.getModel().x,y:t.getModel().y},s={x:a.getModel().x,y:a.getModel().y},d=ca(o,s),y=new pi(o.x,o.y,s.x,s.y),C=r.reduce(function(F,G){return au(G,y)>0?F+1:F},0);d*Math.pow(C+1,2)<i&&(n=a,i=d*Math.pow(C+1,2))}),n},kf=function(t,e){var r=Number.POSITIVE_INFINITY,n=null;return t.forEach(function(i){var a=au(i,e);a>=0&&a<r&&(n=i,r=a)}),n},nd=function(t,e,r,n){var i=[],a=[];a.push(t);for(var o=!0,s=0,d=function(G,H){var ie=!1;return H.forEach(function(se){ie||(Ra(G,{x:se.x1,y:se.y1})||Ra(G,{x:se.x2,y:se.y2}))&&(ie=!0)}),ie},y=function(G,H){for(var ie=0,se=H;ie<se.length;ie++){var ce=se[ie],de=ce.getBBox(),xe=[[de.x,de.y],[de.x+de.width,de.y],[de.x,de.y+de.height],[de.x+de.width,de.y+de.height]];if(ts(xe,G.x,G.y))return!0}return!1};o&&s<r;){o=!1;for(var C=function(){var G=a.pop(),H=kf(e,G);if(H){var ie=Ha(H,G),se=ie[0],ce=ie[1];if(ce===2){var de=function(Ie){for(var qe=n,ze=lc(H,qe,se,Ie),$e=d(ze,a)||d(ze,i),mt=y(ze,e);!$e&&mt&&qe>=1;)qe/=1.5,ze=lc(H,qe,se,Ie),$e=d(ze,a)||d(ze,i),mt=y(ze,e);ze&&!$e&&(!Ie||!mt)&&(a.push(new pi(G.x1,G.y1,ze.x,ze.y)),a.push(new pi(ze.x,ze.y,G.x2,G.y2)),o=!0)};de(!0),o||de(!1)}}o||i.push(G),s+=1};!o&&a.length;)C()}for(;a.length;)i.push(a.pop());return i};function Ws(h,t,e,r,n){var i=Rf(h,e,t);if(i===null)return[];var a=function(C){for(var F=[];C.length>0;){var G=C.pop();if(C.length===0){F.push(G);break}var H=C.pop(),ie=new pi(G.x1,G.y1,H.x2,H.y2),se=kf(t,ie);se?(F.push(G),C.push(H)):C.push(ie)}return F},o=new pi(h.getModel().x,h.getModel().y,i.getModel().x,i.getModel().y),s=nd(o,t,r,n),d=a(s);return d}var Bf=function(t,e,r){var n=Object.assign(Da,r),i=po(t.map(function(de){return{x:de.getModel().x,y:de.getModel().y}}));t=t.sort(function(de,xe){return ca({x:de.getModel().x,y:de.getModel().y},i)-ca({x:xe.getModel().x,y:xe.getModel().y},i)});var a=[],o=[];t.forEach(function(de){var xe=Ws(de,e,a,n.maxRoutingIterations,n.morphBuffer);xe.forEach(function(Ie){o.push(Ie)}),a.push(de)});for(var s=Uo(t,o,n.nodeR0),d=Iu(s.width,s.height,n.pixelGroupSize),y=[],C=[],F=0;F<n.maxMarchingIterations;F++)if(Pu(t,e,o,s,d,n),y=[],C=[],!!new Lf(y,d,n.threshold).march()){var G=y.map(function(de){return{x:Math.round(de.x*n.pixelGroupSize+s.minX),y:Math.round(de.y*n.pixelGroupSize+s.minY)}});if(G){var H=G.length;if(n.skip>1)for(H=Math.floor(G.length/n.skip);H<3&&n.skip>1;)n.skip-=1,H=Math.floor(G.length/n.skip);for(var ie=0,se=0;se<H;se+=1,ie+=n.skip)C.push({x:G[ie].x,y:G[ie].y})}var ce=function(){for(var xe=0,Ie=t;xe<Ie.length;xe++){var qe=Ie[xe],ze=C.map(function($e){return[$e.x,$e.y]});if(!ts(ze,qe.getBBox().centerX,qe.getBBox().centerY))return!1}return!0};if(C&&ce())return C;if(n.threshold*=.9,F<=n.maxMarchingIterations*.5)n.memberInfluenceFactor*=1.2,n.edgeInfluenceFactor*=1.2;else if(n.nonMemberInfluenceFactor!==0&&e.length>0)n.nonMemberInfluenceFactor*=.8;else break}return C};function Uo(h,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=[];h.forEach(function(s){n.push(s.getBBox())}),t.forEach(function(s){n.push(s.getBBox())});for(var i=0,a=n;i<a.length;i++){var o=a[i];r.minX=(o.minX<r.minX?o.minX:r.minX)-e,r.minY=(o.minY<r.minY?o.minY:r.minY)-e,r.maxX=(o.maxX>r.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 Pu(h,t,e,r,n,i){function a(G,H){var ie=Math.floor((G-H)/i.pixelGroupSize);return ie<0?0:ie}function o(G,H){return G*i.pixelGroupSize+H}var s=(i.nodeR0-i.nodeR1)*(i.nodeR0-i.nodeR1),d=(i.edgeR0-i.edgeR1)*(i.edgeR0-i.edgeR1),y=function(H,ie){var se=Math.min(a(H.minX,ie+r.minX),n.width),ce=Math.min(a(H.minY,ie+r.minY),n.height),de=Math.min(a(H.maxX,-ie+r.minX),n.width),xe=Math.min(a(H.maxY,-ie+r.minY),n.height);return[se,ce,de,xe]},C=function(H,ie){for(var se=H.getBBox(),ce=y(se,i.nodeR1),de=ce[0],xe=ce[1],Ie=ce[2],qe=ce[3],ze=xe;ze<qe;ze+=1)for(var $e=de;$e<Ie;$e+=1)if(!(ie<0&&n[$e+ze*n.width]<=0)){var mt=o($e,r.minX),xt=o(ze,r.minY),wt=Ao({x:mt,y:xt},{x:se.minX,y:se.minY,width:se.width,height:se.height});if(wt<Math.pow(i.nodeR1,2)){var Yt=Math.sqrt(wt)-i.nodeR1;n.cells[$e+ze*n.width]+=ie*Yt*Yt}}},F=function(H,ie){for(var se=H.getBBox(),ce=y(se,i.edgeR1),de=ce[0],xe=ce[1],Ie=ce[2],qe=ce[3],ze=xe;ze<qe;ze+=1)for(var $e=de;$e<Ie;$e+=1)if(!(ie<0&&n.cells[$e+ze*n.width]<=0)){var mt=o($e,r.minX),xt=o(ze,r.minY),wt=to({x:mt,y:xt},H);if(wt<Math.pow(i.edgeR1,2)){var Yt=Math.sqrt(wt)-i.edgeR1;n.cells[$e+ze*n.width]+=ie*Yt*Yt}}};i.nodeInfluenceFactor&&h.forEach(function(G){C(G,i.nodeInfluenceFactor/s)}),i.edgeInfluenceFactor&&e.forEach(function(G){F(G,i.edgeInfluenceFactor/d)}),i.negativeNodeInfluenceFactor&&t.forEach(function(G){C(G,i.negativeNodeInfluenceFactor/s)})}function lc(h,t,e,r){var n=h.getBBox(),i=e[0],a=e[1],o=e[2],s=e[3],d={topLeft:{x:n.minX-t,y:n.minY-t},topRight:{x:n.maxX+t,y:n.minY-t},bottomLeft:{x:n.minX-t,y:n.maxY+t},bottomRight:{x:n.maxX+t,y:n.maxY+t}},y=n.height*n.width;function C(H,ie){return n.width*((H.y-n.minY+(ie.y-n.minY))*.5)}if(a){if(i)return r?d.topLeft:d.bottomRight;if(o)return r?d.bottomLeft:d.topRight;var F=C(a,s);return F<y*.5?a.y>s.y?r?d.topLeft:d.bottomRight:r?d.topRight:d.bottomLeft:a.y<s.y?r?d.bottomLeft:d.topRight:r?d.bottomRight:d.topLeft}if(s){if(i)return r?d.topRight:d.bottomLeft;if(o)return r?d.bottomRight:d.topLeft}var G=C(i,o);return G<y*.5?i.x>o.x?r?d.topLeft:d.bottomRight:r?d.bottomLeft:d.topRight:i.x<o.x?r?d.topRight:d.bottomLeft:r?d.bottomRight:d.topLeft}var jc=function(){function h(t,e){this.cfg=(0,_.deepMix)(this.getDefaultCfg(),e),this.graph=t,this.id=this.cfg.id,this.group=this.cfg.group,this.members=this.cfg.members.map(function(r){return(0,_.isString)(r)?t.findById(r):r}),this.nonMembers=this.cfg.nonMembers.map(function(r){return(0,_.isString)(r)?t.findById(r):r}),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()}return h.prototype.getDefaultCfg=function(){return{id:"g6-hull",type:"round-convex",members:[],nonMembers:[],style:{fill:"lightblue",stroke:"blue",opacity:.2},padding:10}},h.prototype.setPadding=function(){var t=this.members.length&&this.members[0].getKeyShape().getCanvasBBox().width/2;this.padding=this.cfg.padding>0?this.cfg.padding+t:10+t,this.cfg.bubbleCfg={nodeR0:this.padding-t,nodeR1:this.padding-t,morphBuffer:this.padding-t}},h.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")},h.prototype.calcPath=function(t,e){var r,n,i;switch(this.type){case"round-convex":r=Wc(t),i=Nf(r.map(function(a){return[a.x,a.y]}),this.padding),n=(0,yn.tr)(i);break;case"smooth-convex":r=Wc(t),r.length===2?(i=Nf(r.map(function(a){return[a.x,a.y]}),this.padding),n=(0,yn.tr)(i)):r.length>2&&(i=Fo(r.map(function(a){return[a.x,a.y]}),this.padding),n=Of(i));break;case"bubble":r=Bf(t,e,this.cfg.bubbleCfg),n=r.length>=2&&Of(r);break;default:}return n},h.prototype.render=function(){this.group.addShape("path",{attrs:(0,g.__assign)({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},h.prototype.addMember=function(t){if(!!t){(0,_.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}},h.prototype.addNonMember=function(t){if(!!t){(0,_.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}},h.prototype.removeMember=function(t){if(!!t){(0,_.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}},h.prototype.removeNonMember=function(t){if(!!t){(0,_.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}},h.prototype.updateData=function(t,e){var r=this;this.group.findById(this.id).remove(),t&&(this.members=t.map(function(n){return(0,_.isString)(n)?r.graph.findById(n):n})),e&&(this.nonMembers=e.map(function(n){return(0,_.isString)(n)?r.graph.findById(n):n})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},h.prototype.updateStyle=function(t){var e=this.group.findById(this.id);e.attr((0,g.__assign)({},t))},h.prototype.updateCfg=function(t){var e=this;this.cfg=(0,_.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,_.isString)(r)?e.graph.findById(r):r})),t.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(r){return(0,_.isString)(r)?e.graph.findById(r):r})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},h.prototype.contain=function(t){var e=this,r;(0,_.isString)(t)?r=this.graph.findById(t):r=t;var n,i=r.getKeyShape();if(r.get("type")==="path")n=lu(i.attr("path"));else{var a=i.getCanvasBBox();n=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]]}return n=n.map(function(o){var s=e.graph.getPointByCanvas(o[0],o[1]);return[s.x,s.y]}),Es(n,lu(this.path))},h.prototype.destroy=function(){this.group.remove(),this.cfg=null},h}(),zo=jc,so=ee.vs,Cl="node",Po=function(h){(0,g.__extends)(t,h);function t(e){var r=h.call(this)||this;return r.sortCombos=(0,_.debounce)(function(){var n=r.get("comboSorted");if(!(!r||r.destroyed||n)){r.set("comboSorted",!0);var i=[],a={},o=r.get("comboTrees");(o||[]).forEach(function(d){Fa(d,function(y){return i[y.depth]?i[y.depth].push(y.id):i[y.depth]=[y.id],a[y.id]=y.depth,!0})});var s=r.getEdges().concat(r.get("vedges"));(s||[]).forEach(function(d){var y=d.getModel(),C=a[y.source]||0,F=a[y.target]||0,G=Math.max(C,F);i[G]?i[G].push(y.id):i[G]=[y.id]}),i.forEach(function(d){if(!(!d||!d.length))for(var y=d.length-1;y>=0;y--){var C=r.findById(d[y]);C&&C.toFront()}})}},500,!1),r.cfg=(0,_.deepMix)(r.getDefaultCfg(),e),r.init(),r.animating=!1,r.destroyed=!1,r.cfg.enabledStack&&(r.undoStack=new Ea(r.cfg.maxStep),r.redoStack=new Ea(r.cfg.maxStep)),r}return t.prototype.init=function(){this.initCanvas();var e=new pl(this),r=new Ef(this),n=new xl(this),i=new rd(this);this.set({viewController:e,modeController:r,itemController:n,stateController:i}),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,i=n===void 0?"g6":n,a=e.addGroup({id:"".concat(i,"-root"),className:bn.rootContainerClassName});if(this.get("groupByTypes")){var o=a.addGroup({id:"".concat(i,"-edge"),className:bn.edgeContainerClassName}),s=a.addGroup({id:"".concat(i,"-node"),className:bn.nodeContainerClassName}),d=a.addGroup({id:"".concat(i,"-combo"),className:bn.comboContainerClassName});d.toBack(),this.set({nodeGroup:s,edgeGroup:o,comboGroup:d})}var y=a.addGroup({id:"".concat(i,"-delegate"),className:bn.delegateContainerClassName});this.set({delegateGroup:y}),this.set("group",a)}},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:[]}},t.prototype.set=function(e,r){return(0,_.isPlainObject)(e)?this.cfg=(0,g.__assign)((0,g.__assign)({},this.cfg),e):this.cfg[e]=r,e==="enabledStack"&&r&&!this.undoStack&&!this.redoStack&&(this.undoStack=new Ea(this.cfg.maxStep),this.redoStack=new Ea(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,_.isString)(e)&&(e=this.findById(e));var n=this.get("itemController");r||(r=e.get("states")),n.clearItemStates(e,r);var i=this.get("stateController");i.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,i=this.get("".concat(e,"s"));return(0,_.each)(i,function(a,o){if(r(a,o))return n=a,n}),n},t.prototype.findAll=function(e,r){var n=[];return(0,_.each)(this.get("".concat(e,"s")),function(i,a){r(i,a)&&n.push(i)}),n},t.prototype.findAllByState=function(e,r,n){return n?this.findAll(e,function(i){return i.hasState(r)&&n(i)}):this.findAll(e,function(i){return i.hasState(r)})},t.prototype.translate=function(e,r,n,i){var a=this,o=this.get("group"),s=(0,_.clone)(o.getMatrix());if(s||(s=[1,0,0,0,1,0,0,0,1]),n){var d=Bo({animateCfg:i,callback:function(){return a.emit("viewportchange",{action:"translate",matrix:o.getMatrix()})}});xa(o,{x:o.getCanvasBBox().x+e,y:o.getCanvasBBox().y+r},n,d||{duration:500,easing:"easeCubic"})}else s=so(s,[["t",e,r]]),o.setMatrix(s),this.emit("viewportchange",{action:"translate",matrix:s}),this.autoPaint()},t.prototype.moveTo=function(e,r,n,i){var a=this.get("group");xa(a,{x:e,y:r},n,i||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:a.getMatrix()})},t.prototype.fitView=function(e,r,n,i){e&&this.set("fitViewPadding",e);var a=this.get("viewController");r?a.fitViewByRules(r,n,i):a.fitView(n,i),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 i=this.get("modeController");return i.updateBehavior(e,r,n),this},t.prototype.zoom=function(e,r,n,i){var a=this,o=this.get("group"),s=(0,_.clone)(o.getMatrix())||[1,0,0,0,1,0,0,0,1],d=this.get("minZoom"),y=this.get("maxZoom"),C=this.getZoom()||1,F=C*e,G=e,H=!1;if(d&&F<d?(G=d/C,H=!0):y&&F>y&&(G=y/C,H=!0),r?s=so(s,[["t",-r.x,-r.y],["s",G,G],["t",r.x,r.y]]):s=so(s,[["s",G,G]]),n){var ie=(0,_.clone)(o.getMatrix());ie||(ie=[1,0,0,0,1,0,0,0,1]);var se=ie[0],ce=se*G,de=Bo({animateCfg:i,callback:function(){return a.emit("viewportchange",{action:"zoom",matrix:o.getMatrix()})}});o.animate(function(xe){if(xe===1)ie=s;else{var Ie=fa(se,ce,xe)/ie[0];r?ie=so(ie,[["t",-r.x,-r.y],["s",Ie,Ie],["t",r.x,r.y]]):ie=so(ie,[["s",Ie,Ie]])}return{matrix:ie}},de)}else o.setMatrix(s),this.emit("viewportchange",{action:"zoom",matrix:s}),this.autoPaint();return!H},t.prototype.zoomTo=function(e,r,n,i){var a=e/this.getZoom();return this.zoom(a,r,n,i)},t.prototype.focusItem=function(e,r,n){var i=this.get("viewController"),a=!1;r?a=!0:r===void 0&&(a=this.get("animate"));var o={};n?o=n:n===void 0&&(o=this.get("animateCfg")),i.focus(e,a,o),this.autoPaint()},t.prototype.focusItems=function(e,r,n,i){var a=this.get("viewController");a.focusItems(e,r,n,i)},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"),i=n.changeItemVisibility(e,!0);if(r&&this.get("enabledStack")){var a=i.getID(),o=i.getType(),s={},d={};switch(o){case"node":s.nodes=[{id:a,visible:!1}],d.nodes=[{id:a,visible:!0}];break;case"edge":s.nodes=[{id:a,visible:!1}],d.edges=[{id:a,visible:!0}];break;case"combo":s.nodes=[{id:a,visible:!1}],d.combos=[{id:a,visible:!0}];break;default:break}this.pushStack("visible",{before:s,after:d})}},t.prototype.hideItem=function(e,r){r===void 0&&(r=!0);var n=this.get("itemController"),i=n.changeItemVisibility(e,!1);if(r&&this.get("enabledStack")){var a=i.getID(),o=i.getType(),s={},d={};switch(o){case"node":s.nodes=[{id:a,visible:!0}],d.nodes=[{id:a,visible:!1}];break;case"edge":s.nodes=[{id:a,visible:!0}],d.edges=[{id:a,visible:!1}];break;case"combo":s.nodes=[{id:a,visible:!0}],d.combos=[{id:a,visible:!1}];break;default:break}this.pushStack("visible",{before:s,after:d})}},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,_.isString)(e)&&(n=this.findById(e)),!n&&(0,_.isString)(e))console.warn("The item ".concat(e," to be removed does not exist!"));else if(n){var i="";if(n.getType&&(i=n.getType()),r&&this.get("enabledStack")){var a=(0,g.__assign)((0,g.__assign)({},n.getModel()),{itemType:i}),o={};switch(i){case"node":{o.nodes=[a],o.edges=[];for(var s=n.getEdges(),d=s.length-1;d>=0;d--)o.edges.push((0,g.__assign)((0,g.__assign)({},s[d].getModel()),{itemType:"edge"}));break}case"edge":o.edges=[a];break;case"combo":o.combos=[a];break;default:break}this.pushStack("delete",{before:o,after:{}})}if(i==="node"){var y=n.getModel();y.comboId&&this.updateComboTree(n,void 0,!1)}var C=this.get("itemController");if(C.removeItem(n),i==="combo"){var F=uu(this.get("comboTrees"));this.set("comboTrees",F)}}},t.prototype.innerAddItem=function(e,r,n){if(!bf(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 i,a=this.get("comboTrees")||[];if(e==="combo"){var o=this.get("itemMap"),s=!1;if(a.forEach(function(H){s||ao(H,function(ie){if(r.parentId===ie.id){s=!0;var se=(0,g.__assign)({id:r.id,depth:ie.depth+2},r);ie.children?ie.children.push(se):ie.children=[se],r.depth=se.depth,i=n.addItem(e,r)}var ce=o[ie.id];return s&&ce&&ce.getType&&ce.getType()==="combo"&&n.updateCombo(ce,ie.children),!0})}),!s){var d=(0,g.__assign)({id:r.id,depth:0},r);r.depth=d.depth,a.push(d),i=n.addItem(e,r)}this.set("comboTrees",a),r.collapsed&&(this.collapseCombo(i,!1),this.updateCombo(i))}else if(e==="node"&&(0,_.isString)(r.comboId)&&a){var y=this.findById(r.comboId);y&&y.getType&&y.getType()!=="combo"&&console.warn("'".concat(r.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),i=n.addItem(e,r);var C=this.get("itemMap"),F=!1,G=!1;a.forEach(function(H){G||F||ao(H,function(ie){if(ie.id===r.id)return G=!0,!1;if(r.comboId===ie.id&&!G){F=!0;var se=(0,_.clone)(r);se.itemType="node",ie.children?ie.children.push(se):ie.children=[se],se.depth=ie.depth+1}return F&&C[ie.id].getType&&C[ie.id].getType()==="combo"&&n.updateCombo(C[ie.id],ie.children),!0})})}else i=n.addItem(e,r);if(e==="node"&&r.comboId||e==="combo"&&r.parentId){var y=this.findById(r.comboId||r.parentId);y&&y.getType&&y.getType()==="combo"&&y.addChild(i)}return i},t.prototype.addItem=function(e,r,n,i){n===void 0&&(n=!0),i===void 0&&(i=!0);var a=this.get("comboSorted");this.set("comboSorted",a&&!i);var o=this.get("itemController"),s=this.innerAddItem(e,r,o);if(s===!1||s===!0)return s;var d=this.get("combos");if(d&&d.length>0&&this.sortCombos(),this.autoPaint(),n&&this.get("enabledStack")){var y=(0,g.__assign)((0,g.__assign)({},s.getModel()),{itemType:e}),C={};switch(e){case"node":C.nodes=[y];break;case"edge":C.edges=[y];break;case"combo":C.combos=[y];break;default:break}this.pushStack("add",{before:{},after:C})}return s},t.prototype.addItems=function(e,r,n){e===void 0&&(e=[]),r===void 0&&(r=!0),n===void 0&&(n=!0);var i=this.get("comboSorted");this.set("comboSorted",i&&!n);for(var a=this.get("itemController"),o=[],s=0;s<e.length;s++){var d=e[s];d.type!=="edge"&&d.type!=="vedge"?o.push(this.innerAddItem(d.type,d.model,a)):o.push(void 0)}for(var s=0;s<e.length;s++){var d=e[s];(d.type==="edge"||d.type==="vedge")&&(o[s]=this.innerAddItem(d.type,d.model,a))}if(n){var y=this.get("combos");y&&y.length>0&&this.sortCombos()}if(this.autoPaint(),r&&this.get("enabledStack")){for(var C={nodes:[],edges:[],combos:[]},s=0;s<e.length;s++){var F=e[s].type,G=o[s];if(!!G&&G!==!0){var H=(0,g.__assign)((0,g.__assign)({},G.getModel()),{itemType:F});switch(F){case"node":C.nodes.push(H);break;case"edge":C.edges.push(H);break;case"combo":C.combos.push(H);break;default:break}}}this.pushStack("addItems",{before:{},after:C})}return o},t.prototype.add=function(e,r,n,i){return n===void 0&&(n=!0),i===void 0&&(i=!0),this.addItem(e,r,n,i)},t.prototype.updateItem=function(e,r,n){var i=this;n===void 0&&(n=!0);var a=this.get("itemController"),o;(0,_.isString)(e)?o=this.findById(e):o=e;var s=(0,_.clone)(o.getModel()),d="";o.getType&&(d=o.getType());var y=(0,g.__spreadArray)([],o.getStates(),!0);if(d==="combo"&&(0,_.each)(y,function(H){return i.setItemState(o,H,!1)}),a.updateItem(o,r),d==="combo"&&(0,_.each)(y,function(H){return i.setItemState(o,H,!0)}),n&&this.get("enabledStack")){var C={nodes:[],edges:[],combos:[]},F={nodes:[],edges:[],combos:[]},G=(0,g.__assign)({id:s.id},r);switch(d){case"node":C.nodes.push(s),F.nodes.push(G);break;case"edge":C.edges.push(s),F.edges.push(G);break;case"combo":C.combos.push(s),F.combos.push(G);break;default:break}d==="node"&&C.nodes.push(s),this.pushStack("update",{before:C,after:F})}},t.prototype.update=function(e,r,n){n===void 0&&(n=!0),this.updateItem(e,r,n)},t.prototype.setItemState=function(e,r,n){(0,_.isString)(e)&&(e=this.findById(e));var i=this.get("itemController");i.setItemState(e,r,n);var a=this.get("stateController");(0,_.isString)(n)?a.updateState(e,"".concat(r,":").concat(n),!0):a.updateState(e,r,n)},t.prototype.priorityState=function(e,r){var n=this.get("itemController");n.priorityState(e,r)},t.prototype.data=function(e){cu(e),this.set("data",e)},t.prototype.render=function(){var e=this;this.set("comboSorted",!1);var r=this.get("data");if(this.get("enabledStack")&&this.clearStack(),!r)throw new Error("data must be defined first");var n=r.nodes,i=n===void 0?[]:n,a=r.edges,o=a===void 0?[]:a,s=r.combos,d=s===void 0?[]:s;if(this.clear(!0),this.emit("beforerender"),e.addItems(i.map(function(se){return{type:"node",model:se}}),!1,!1),(d==null?void 0:d.length)!==0){var y=su(d,i);this.set("comboTrees",y),e.addCombos(d)}e.addItems(o.map(function(se){return{type:"edge",model:se}}),!1,!1);var C=e.get("animate");(e.get("fitView")||e.get("fitCenter"))&&e.set("animate",!1);var F=e.get("layoutController");if(F){if(F.layout(G),this.destroyed)return}else G();function G(){(e.get("comboTrees")||[]).forEach(function(se){ao(se,function(ce){var de=e.findById(ce.id);return de.getType()==="combo"&&ce.collapsed&&(e.collapseCombo(ce.id,!1),e.updateCombo(de)),!0})}),e.get("fitView")?e.fitView():e.get("fitCenter")&&e.fitCenter(),e.autoPaint(),e.emit("afterrender"),(e.get("fitView")||e.get("fitCenter"))&&e.set("animate",C),setTimeout(function(){var se;(se=e.getCombos())===null||se===void 0||se.forEach(function(ce){ce.set("animate",!0)})},0)}if(!this.get("groupByTypes"))if(d&&d.length!==0)this.sortCombos();else if(r.nodes&&r.edges&&r.nodes.length<r.edges.length){var H=this.getNodes();H.forEach(function(se){se.toFront()})}else{var ie=this.getEdges();ie.forEach(function(se){se.toBack()})}this.get("enabledStack")&&this.pushStack("render")},t.prototype.read=function(e){this.data(e),this.render()},t.prototype.diffItems=function(e,r,n){var i=this,a,o=this.get("itemMap");(0,_.each)(n,function(s){if(a=o[s.id],a){if(i.get("animate")&&e===Cl){var d=a.getContainer().getMatrix();d||(d=[1,0,0,0,1,0,0,0,1]),a.set("originAttrs",{x:d[6],y:d[7]})}i.updateItem(a,s,!1)}else a=i.addItem(e,s,!1);a&&r["".concat(e,"s")].push(a)})},t.prototype.changeData=function(e,r){var n=this,i;r===void 0&&(r=!0);var a=this,o=e||a.get("data");if(!cu(o))return this;this.emit("beforechangedata"),r&&this.get("enabledStack")&&this.pushStack("changedata",{before:a.save(),after:o}),this.set("comboSorted",!1),this.removeHulls(),this.getNodes().map(function(de){return a.clearItemStates(de)}),this.getEdges().map(function(de){return a.clearItemStates(de)});var s=this.get("canvas"),d=s.get("localRefresh");s.set("localRefresh",!1),a.get("data")||(a.data(o),a.render());var y=this.get("itemMap"),C={nodes:[],edges:[]},F=o.combos;if(F){var G=su(F,o.nodes);this.set("comboTrees",G)}else this.set("comboTrees",[]);this.diffItems("node",C,o.nodes),(0,_.each)(y,function(de,xe){y[xe].getModel().depth=0,!(de.getType&&de.getType()==="edge")&&(de.getType&&de.getType()==="combo"?(delete y[xe],de.destroy()):C.nodes.indexOf(de)<0&&(delete y[xe],a.remove(de,!1)))});for(var H=this.getCombos(),ie=H.length,se=ie-1;se>=0;se--)H[se].destroyed&&H.splice(se,1);F&&(a.addCombos(F),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",C,o.edges),(0,_.each)(y,function(de,xe){de.getType&&(de.getType()==="node"||de.getType()==="combo")||C.edges.indexOf(de)<0&&(delete y[xe],a.remove(de,!1))}),(this.get("comboTrees")||[]).forEach(function(de){ao(de,function(xe){var Ie=n.findById(xe.id);return Ie.getType()==="combo"&&xe.collapsed&&n.collapseCombo(xe.id,!1),!0})}),this.set({nodes:C.nodes,edges:C.edges});var ce=this.get("layoutController");return ce&&(ce.changeData(function(){setTimeout(function(){var de;(de=a.getCombos())===null||de===void 0||de.forEach(function(xe){xe.set("animate",!0)})},0)}),a.get("animate")&&!ce.getLayoutType()?(a.positionsAnimate(),(i=a.getCombos())===null||i===void 0||i.forEach(function(de){return de.set("animate",!0)})):a.autoPaint()),setTimeout(function(){s.set("localRefresh",d)},16),this.emit("afterchangedata"),this},t.prototype.addCombos=function(e){var r=this,n=r.get("comboTrees"),i=this.get("itemController");i.addCombos(n,e)},t.prototype.createCombo=function(e,r){var n=this;this.set("comboSorted",!1);var i="",a;if(!!e){if((0,_.isString)(e))i=e,a={id:e};else{if(i=e.id,!i){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}a=e}var o=r.map(function(d){var y=n.findById(d),C=y.getModel(),F="";y.getType&&(F=y.getType());var G={id:y.getID(),itemType:F};return F==="combo"?(G.parentId=i,C.parentId=i):F==="node"&&(G.comboId=i,C.comboId=i),G});a.children=o,this.addItem("combo",a,!1),this.set("comboSorted",!1);var s=this.get("comboTrees");(s||[]).forEach(function(d){ao(d,function(y){return y.id===i?(y.itemType="combo",y.children=o,!1):!0})}),s&&this.sortCombos()}},t.prototype.uncombo=function(e){var r=this,n,i=this,a=e;if((0,_.isString)(e)&&(a=this.findById(e)),!a||a.getType&&a.getType()!=="combo"){console.warn("The item is not a combo!");return}var o=a.getModel().parentId,s=i.get("comboTrees");s||(s=[]);var d=this.get("itemMap"),y=a.get("id"),C,F=[],G=this.get("combos"),H=this.findById(o);if(s.forEach(function(se){C||ao(se,function(ce){var de;if(ce.id===y){C=ce;var xe=a.getEdges().map(function(qe){return qe.getID()});xe.forEach(function(qe){r.removeItem(qe,!1)});var Ie=G.indexOf(a);G.splice(Ie,1),delete d[y],a.destroy(),r.emit("afterremoveitem",{item:a,type:"combo"})}if(o&&C&&ce.id===o){H.removeCombo(a),F=ce.children;var Ie=F.indexOf(C);return Ie!==-1&&F.splice(Ie,1),(de=C.children)===null||de===void 0||de.forEach(function(ze){var $e=r.findById(ze.id),mt=$e.getModel();$e.getType&&$e.getType()==="combo"?(ze.parentId=o,delete ze.comboId,mt.parentId=o,delete mt.comboId):$e.getType&&$e.getType()==="node"&&(ze.comboId=o,mt.comboId=o),H.addChild($e),F.push(ze)}),!1}return!0})}),!o&&C){var ie=s.indexOf(C);s.splice(ie,1),(n=C.children)===null||n===void 0||n.forEach(function(se){se.parentId=void 0;var ce=r.findById(se.id).getModel();delete ce.parentId,delete ce.comboId,se.itemType!=="node"&&s.push(se)})}},t.prototype.updateCombos=function(e){var r=this;e===void 0&&(e=!1);var n=this,i=this.get("comboTrees"),a=n.get("itemController"),o=n.get("itemMap");(i||[]).forEach(function(s){ao(s,function(d){var y;if(!d)return!0;var C=o[d.id];if(((y=C==null?void 0:C.getType)===null||y===void 0?void 0:y.call(C))==="combo"){var F=(0,g.__spreadArray)([],C.getStates(),!0);(0,_.each)(F,function(G){return r.setItemState(C,G,!1)}),a.updateCombo(C,d.children,e),(0,_.each)(F,function(G){return r.setItemState(C,G,!0)})}return!0})}),n.sortCombos()},t.prototype.updateCombo=function(e){var r=this,n=this,i=e,a;if((0,_.isString)(e)&&(i=this.findById(e)),!i||i.getType&&i.getType()!=="combo"){console.warn("The item to be updated is not a combo!");return}a=i.get("id");var o=this.get("comboTrees"),s=n.get("itemController"),d=n.get("itemMap");(o||[]).forEach(function(y){ao(y,function(C){if(!C)return!0;var F=d[C.id];if(a===C.id&&F&&F.getType&&F.getType()==="combo"){var G=(0,g.__spreadArray)([],F.getStates(),!0);(0,_.each)(G,function(H){F.getStateStyle(H)&&r.setItemState(F,H,!1)}),s.updateCombo(F,C.children),(0,_.each)(G,function(H){F.getStateStyle(H)&&r.setItemState(F,H,!0)}),a&&(a=C.parentId)}return!0})})},t.prototype.updateComboTree=function(e,r,n){n===void 0&&(n=!0);var i=this;this.set("comboSorted",!1);var a;(0,_.isString)(e)?a=i.findById(e):a=e;var o=a.getModel(),s=o.comboId||o.parentId,d="";if(a.getType&&(d=a.getType()),r&&d==="combo"){var y=this.get("comboTrees"),C=!0,F;if((y||[]).forEach(function(de){F||Fa(de,function(xe){if(!F)return xe.id===a.getID()&&(F=xe),!0})}),Fa(F,function(de){return de.id===r?(C=!1,!1):!0}),!C){console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!");return}}if(n&&this.get("enabledStack")){var G={},H={};d==="combo"?(G.combos=[{id:o.id,parentId:o.parentId}],H.combos=[{id:o.id,parentId:r}]):d==="node"&&(G.nodes=[{id:o.id,parentId:o.comboId}],H.nodes=[{id:o.id,parentId:r}]),this.pushStack("updateComboTree",{before:G,after:H})}if(o.parentId||o.comboId){var ie=this.findById(o.parentId||o.comboId);ie&&ie.removeChild(a)}if(d==="combo"?o.parentId=r:d==="node"&&(o.comboId=r),r){var se=this.findById(r);se&&se.addChild(a)}if(s){var se=this.findById(s);se&&se.removeChild(a)}var ce=uu(this.get("comboTrees"),o.id,r);this.set("comboTrees",ce),this.updateCombos()},t.prototype.save=function(){var e=[],r=[],n=[];return(0,_.each)(this.get("nodes"),function(i){e.push(i.getModel())}),(0,_.each)(this.get("edges"),function(i){r.push(i.getModel())}),(0,_.each)(this.get("combos"),function(i){n.push(i.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"),i=e.get("edges");(0,_.each)(r,function(a){a.refresh()}),(0,_.each)(n,function(a){a.refresh()}),(0,_.each)(i,function(a){a.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,_.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"),i=n.onFrame,a=e?r.getNodes().concat(r.getCombos()):r.getNodes(),o=a.map(function(d){var y=d.getModel();return{id:y.id,x:y.x,y:y.y}});r.stopAnimate();var s=r.get("canvas");r.animating=!0,s.animate(function(d){(0,_.each)(o,function(y){var C=r.findById(y.id);if(!(!C||C.destroyed)){var F=C.get("originAttrs"),G=C.get("model"),H=C.getContainer().getMatrix();if(F==null&&(H&&(F={x:H[6],y:H[7]}),C.set("originAttrs",F||0)),i){var ie=i(C,d,y,F||{x:0,y:0});C.set("model",Object.assign(G,ie))}else F?(G.x=F.x+(y.x-F.x)*d,G.y=F.y+(y.y-F.y)*d):(G.x=y.x,G.y=y.y)}}),r.refreshPositions(e)},{duration:n.duration,easing:n.easing,callback:function(){(0,_.each)(a,function(y){y.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"),i=r.get("edges"),a=r.get("vedges"),o=r.get("combos"),s,d={},y=function(F){(0,_.each)(F,function(G){s=G.getModel();var H=G.get("originAttrs");if(!(H&&s.x===H.x&&s.y===H.y)){var ie=G.updatePosition({x:s.x,y:s.y});d[s.id]=ie,s.comboId&&(d[s.comboId]=d[s.comboId]||ie)}})};y(n),o&&o.length!==0&&(e&&y(o),r.updateCombos()),(0,_.each)(i,function(C){var F=C.getSource().getModel(),G=C.getTarget();if(!(0,_.isPlainObject)(G)){var H=G.getModel();(d[F.id]||d[H.id]||C.getModel().isComboEdge)&&C.refresh()}}),(0,_.each)(a,function(C){C.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,i){var a=this;e===void 0&&(e={}),i===void 0&&(i=!0);var o=this.get("layoutController");if((0,_.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 d=["force","gForce","fruchterman","force2"];d.includes(e.type)||!e.type&&d.includes(o==null?void 0:o.layoutType)?e.center=[s.x,s.y]:this.once("afterlayout",function(F){var G=a.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];s.x=s.x*G[0]+G[6],s.y=s.y*G[0]+G[7];var H=a.getGroup().getCanvasBBox(),ie=H.minX,se=H.maxX,ce=H.minY,de=H.maxY,xe={x:(ie+se)/2,y:(ce+de)/2};r==="begin"&&(xe.x=ie,xe.y=ce),a.translate(s.x-xe.x,s.y-xe.y)})}var y=(0,g.__assign)({},this.get("layout")),C={};Object.assign(C,y,e),e.pipes&&!e.type?delete C.type:!e.pipes&&C.type&&delete C.pipes,this.set("layout",C),!!o&&(o.isLayoutTypeSame(C)&&C.gpuEnabled===y.gpuEnabled?o.updateLayoutCfg(C):o.changeLayout(C),i&&this.get("enabledStack")&&this.pushStack("layout",{before:y,after:C}))},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,_.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 i=e.getModel(),a=this.get("itemController");a.collapseCombo(e,r),i.collapsed=!0;var o=this.getEdges().concat(this.get("vedges")),s=[],d=this.get("comboTrees"),y=!1;(d||[]).forEach(function(F){y||Fa(F,function(G){if(y&&G.depth<=i.depth)return!1;if(i.id===G.id&&(y=!0),y){var H=n.findById(G.id);H&&H.getType&&H.getType()==="combo"&&(s=s.concat(H.getNodes()),s=s.concat(H.getCombos()))}return!0})});var C={};o.forEach(function(F){var G=F.getModel(),H=G.isVEdge,ie=G.size,se=ie===void 0?1:ie;if(!(F.isVisible()&&!H)){var ce=F.getSource(),de=F.getTarget(),xe=null,Ie;if(ce.getModel().id===i.id||s.includes(ce)&&!s.includes(de)?(xe=de,Ie=!1):(de.getModel().id===i.id||!s.includes(ce)&&s.includes(de))&&(xe=ce,Ie=!0),xe){if(H){n.removeItem(F,!1);return}for(var qe=xe.getModel();!xe.isVisible();){var ze=qe.parentId,$e=qe.comboId,mt=ze||$e;if(xe=n.findById(mt),!xe||!mt)return;qe=xe.getModel()}var xt=qe.id,wt=Ie?{source:xt,target:i.id,size:se,isVEdge:!0}:{source:i.id,target:xt,size:se,isVEdge:!0},Yt="".concat(wt.source,"-").concat(wt.target);if(C[Yt]){C[Yt].size+=se;return}C[Yt]=wt}}}),this.addItems(Object.values(C).map(function(F){return{type:"vedge",model:F}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:e})}},t.prototype.expandCombo=function(e,r){var n=this;if(r===void 0&&(r=!0),(0,_.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 i=e.getModel(),a=this.get("itemController");a.expandCombo(e,r),i.collapsed=!1;var o=this.getEdges().concat(this.get("vedges")),s=[],d=this.get("comboTrees"),y=!1;(d||[]).forEach(function(F){y||Fa(F,function(G){if(y&&G.depth<=i.depth)return!1;if(i.id===G.id&&(y=!0),y){var H=n.findById(G.id);H&&H.getType&&H.getType()==="combo"&&(s=s.concat(H.getNodes()),s=s.concat(H.getCombos()))}return!0})});var C={};o.forEach(function(F){if(!(F.isVisible()&&!F.getModel().isVEdge)){var G=F.getSource(),H=F.getTarget(),ie=G.get("id"),se=H.get("id"),ce=null,de;if(ie===i.id||s.includes(G)&&!s.includes(H)?(ce=H,de=!1):se===i.id||!s.includes(G)&&s.includes(H)?(ce=G,de=!0):s.includes(G)&&s.includes(H)&&G.isVisible()&&H.isVisible()&&F.show(),ce){var xe=F.getModel(),Ie=xe.isVEdge,qe=xe.size,ze=qe===void 0?1:qe;if(Ie){n.removeItem(F,!1);return}for(var $e=ce.getModel();!ce.isVisible();){var mt=$e.parentId,xt=$e.comboId,wt=mt||xt;if(ce=n.findById(wt),!ce||!wt)return;$e=ce.getModel()}for(var Yt=$e.id,Zt=de?H:G,Er=Zt.getModel();!Zt.isVisible();){var Fr=Er.parentId,Ur=Er.comboId,Or=Fr||Ur;if(Zt=n.findById(Or),!Zt||!Or)return;if(Er.comboId===i.id||Er.parentId===i.id)break;Er=Zt.getModel()}var hn=Er.id;if(Yt){var sn=de?{source:Yt,target:hn,isVEdge:!0,size:ze}:{source:hn,target:Yt,isVEdge:!0,size:ze},Ir="".concat(sn.source,"-").concat(sn.target);if(C[Ir]){C[Ir].size+=ze;return}C[Ir]=sn}}}}),this.addItems(Object.values(C).map(function(F){return{type:"vedge",model:F}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:e})},t.prototype.collapseExpandCombo=function(e,r){if(r===void 0&&(r=!0),(0,_.isString)(e)&&(e=this.findById(e)),!(!e||e.getType&&e.getType()!=="combo")){for(var n=e.getModel(),i=this.findById(n.parentId);i;){var a=i.getModel();if(a.collapsed){console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),i=void 0;return}i=this.findById(a.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,_.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 i=e;(0,_.isString)(e)&&(i=this.findById(e));var a=this.get("degrees");(!a||n)&&(a=we(this.save()),this.set("degrees",a));var o=a[i.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())},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 i=r?(0,_.clone)(r):{before:{},after:(0,_.clone)(this.save())};n==="redo"?this.redoStack.push({action:e,data:i}):this.undoStack.push({action:e,data:i}),this.emit("stackchange",{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=re(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"),i=this.get("shortestPathMatrix");return(!n||!e)&&(n=re(this.save(),r),this.set("adjMatrix",n)),(!i||!e)&&(i=vr(this.save(),r),this.set("shortestPathMatrix",i)),i},t.prototype.on=function(e,r,n){return h.prototype.on.call(this,e,r,n)},t.prototype.destroy=function(){var e,r,n,i,a;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(),(i=this.get("stateController"))===null||i===void 0||i.destroy(),(a=this.get("canvas"))===null||a===void 0||a.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 i=r.addGroup({id:"".concat(e.id,"-container")}),a=new zo(this,(0,g.__assign)((0,g.__assign)({},e),{group:i})),o=a.id;return n[o]=a,a},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,_.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}(J.Z),Vc=Po;function Cs(h){return Cs=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},Cs(h)}var Ts=ee.vs,Gf="-shape",Ou="-label",js=["startArrow","endArrow"],Ri={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},Xc={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},os={edge:Xc,node:Ri,combo:Ri},Wo="-label-bg",ss={options:{labelCfg:{style:{fontFamily:bn.windowFontFamily}},descriptionCfg:{style:{fontFamily:bn.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(t){return{}},getOptions:function(t,e){return e==="move"||(e==null?void 0:e.includes("bbox"))?{}:(0,_.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+Gf),e.shapeMap[this.itemType+Gf]=r,t.label){var n=this.drawLabel(t,e);n.set("className",this.itemType+Ou),e.shapeMap[this.itemType+Ou]=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||{},i=this.getLabelStyle(t,n,e),a=i.rotate;delete i.rotate;var o=e.addShape("text",{attrs:i,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=o,!isNaN(a)&&a!==""){var s=o.getBBox(),d=[1,0,0,0,1,0,0,0,1];if(i.rotateCenter)switch(i.rotateCenter){case"center":d=Ts(d,[["t",-s.width/2,-s.height/2],["r",a],["t",s.width/2,s.height/2]]);break;case"lefttop":d=Ts(d,[["t",-i.x,-i.y],["r",a],["t",i.x,i.y]]);break;case"leftcenter":d=Ts(d,[["t",-i.x,-i.y-s.height/2],["r",a],["t",i.x,i.y+s.height/2]]);break;default:d=Ts(d,[["t",-s.width/2,-s.height/2],["r",a],["t",s.width/2,s.height/2]]);break}else d=Ts(d,[["t",-i.x,-i.y-s.height/2],["r",a],["t",i.x,i.y+s.height/2]]);o.setMatrix(d)}if(i.background){var y=this.drawLabelBg(t,e,o),C=this.itemType+Wo;y.set("classname",C),e.shapeMap[C]=y,o.toFront()}return o},drawLabelBg:function(t,e,r){var n=this.options.labelCfg,i=(0,_.mix)({},n,t.labelCfg),a=this.getLabelBgStyleByPosition(r,i),o=e.addShape("rect",{name:"text-bg-shape",attrs:a,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),i="".concat(this.itemType,"Label"),a=bn[i]?bn[i].style:null;return(0,g.__assign)((0,g.__assign)((0,g.__assign)({},a),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,i=e.getContainer(),a=e.getKeyShape(),o=(0,_.mix)({},a.attr(),t.style),s=function(C){var F,G=o[C];if((0,_.isPlainObject)(G)){var H=((n=i.shapeMap)===null||n===void 0?void 0:n[C])||i.find(function(ie){return ie.get("name")===C});H==null||H.attr(G)}else a.attr((F={},F[C]=G,F))};for(var d in o)s(d)},updateLabel:function(t,e,r){var n,i;if(t.label||t.label===""){var a=e.getContainer(),o=(this.mergeStyle||this.getOptions({},r)||{}).labelCfg,s=o===void 0?{}:o,d=this.itemType+Ou,y=a.shapeMap[d]||a.find(function(Ie){return Ie.get("className")===d}),C=this.itemType+Wo,F=a.shapeMap[C]||a.find(function(Ie){return Ie.get("className")===C});if(y){(!r||r==="bbox|label"||this.itemType==="edge"&&r!=="style")&&(s=(0,_.deepMix)(s,t.labelCfg));var H=this.getLabelStyleByPosition(t,s,a),ie=(n=t.labelCfg)===null||n===void 0?void 0:n.style,se=(0,g.__assign)((0,g.__assign)({},H),ie),ce=se.rotate;if(delete se.rotate,!isNaN(ce)&&ce!==""){var de=[1,0,0,0,1,0,0,0,1];de=Ts(de,[["t",-se.x,-se.y],["r",ce],["t",se.x,se.y]]),se.matrix=de,y.attr(se)}else((i=y.getMatrix())===null||i===void 0?void 0:i[4])!==1&&y.resetMatrix(),y.attr(se);if(!F)se.background&&(F=this.drawLabelBg(t,a,y),F.set("classname",C),a.shapeMap[C]=F,y.toFront());else if(se.background){var xe=this.getLabelBgStyleByPosition(y,s);F.attr(xe)}else a.removeChild(F)}else{var G=this.drawLabel(t,a);G.set("className",d),a.shapeMap[d]=G}}},afterUpdate:function(t,e){},setState:function(t,e,r){var n,i,a,o=r.get("keyShape");if(!(!o||o.destroyed)){var s=r.getType(),d=(0,_.isBoolean)(e)?t:"".concat(t,":").concat(e),y=this.getStateStyle(d,r),C=r.getStateStyle(d);if(!(!C&&!y)){var F=(0,_.mix)({},C||y),G=r.getContainer(),H={x:1,y:1,cx:1,cy:1,matrix:1};if(s==="combo"&&(H.r=1,H.width=1,H.height=1),e){var ie=function(Or){var hn,sn=F[Or];if((0,_.isPlainObject)(sn)&&!js.includes(Or)){var Ir=((a=G.shapeMap)===null||a===void 0?void 0:a[Or])||G.find(function(en){return en.get("name")===Or});Ir==null||Ir.attr(sn)}else o.attr((hn={},hn[Or]=sn,hn))};for(var se in F)ie(se)}else{var ce=Ss(r.getCurrentStatesStyle()),de=r.getModel(),xe=(0,_.mix)({},de.style,Ss(r.getOriginStyle())),Ie=o.get("name"),qe=o.attr(),ze={};Object.keys(qe).forEach(function(Ur){if(Ur!=="img"){var Or=qe[Ur];Or&&Cs(Or)==="object"?ze[Ur]=(0,_.clone)(Or):ze[Ur]=Or}});var $e={},mt=function(Or){var hn=F[Or];if((0,_.isPlainObject)(hn)&&!js.includes(Or)){var sn=G.shapeMap[Or]||G.find(function(un){return un.get("name")===Or});if(sn){var Ir=Ss(sn.attr());(0,_.each)(hn,function(un,fn){if(Or===Ie&&ze[fn]&&!H[fn]){delete ze[fn];var pn=xe[Or][fn]||os[s][fn];o.attr(fn,pn)}else if(Ir[fn]||Ir[fn]===0){delete Ir[fn];var Tn=xe[Or][fn]||os[s][fn];sn.attr(fn,Tn)}}),$e[Or]=Ir}}else if(ze[Or]&&!H[Or]){delete ze[Or];var en=xe[Or]||(xe[Ie]?xe[Ie][Or]:void 0)||os[s][Or];o.attr(Or,en)}};for(var xt in F)mt(xt);Ie?$e[Ie]=ze:(0,_.mix)($e,ze);for(var se in ce)if(!H[se]){var wt=ce[se];(!(0,_.isPlainObject)(wt)||js.includes(se))&&(Ie?((0,_.mix)(xe[Ie],(i={},i[se]=wt,i)),delete xe[se]):(0,_.mix)(xe,(n={},n[se]=wt,n)),delete ce[se])}var Yt={};(0,_.deepMix)(Yt,xe,$e,ce);var Zt=!1,Er=function(Or){var hn,sn,Ir=Yt[Or];if((0,_.isPlainObject)(Ir)&&!js.includes(Or)){var en=G.shapeMap[Or]||G.find(function(fn){return fn.get("name")===Or});en&&((en.get("type")==="text"||en.get("labelRelated"))&&(delete Ir.x,delete Ir.y,delete Ir.matrix),Or===Ie&&(s==="combo"&&(delete Ir.r,delete Ir.width,delete Ir.height),Zt=!0),en.attr(Ir))}else if(!Zt){var un=Ir||os[s][Or];s==="combo"?Ie||o.attr((hn={},hn[Or]=un,hn)):o.attr((sn={},sn[Or]=un,sn))}};for(var Fr in Yt)Er(Fr)}}}},getStateStyle:function(t,e){var r=e.getModel(),n=e.getType(),i=this.getOptions(r),a=i.stateStyles,o=i.style,s=o===void 0?{}:o,d=r.stateStyles?r.stateStyles[t]:a&&a[t];return n==="combo"?(0,_.clone)(d):(0,_.mix)({},s,d)},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}},Yc={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:bn.nodeLabel.offset,getSize:function(t){var e,r=((e=this.mergeStyle)===null||e===void 0?void 0:e.size)||t.size||this.getOptions({}).size||bn.defaultNode.size;return(0,_.isArray)(r)&&r.length===1&&(r=[r[0],r[0]]),(0,_.isArray)(r)||(r=[r,r]),r},getLabelStyleByPosition:function(t,e){var r=e.maxLength,n=t.label;r&&(n=bo(n,r));var i=e.position||this.labelPosition;if(i==="center")return{x:0,y:0,text:n,textBaseline:"middle",textAlign:"center"};var a=e.offset;(0,_.isNil)(a)&&(a=this.offset);var o=this.getSize(t),s;switch(i){case"top":s={x:0,y:-o[1]/2-a,textBaseline:"bottom",textAlign:"center"};break;case"bottom":s={x:0,y:o[1]/2+a,textBaseline:"top",textAlign:"center"};break;case"left":s={x:-o[0]/2-a,y:0,textBaseline:"middle",textAlign:"right"};break;default:s={x:o[0]/2+a,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 i=t.getBBox(),a=Su(n.padding),o=i.width+a[1]+a[3],s=i.height+a[0]+a[2];return(0,g.__assign)((0,g.__assign)({x:i.minX-a[3],y:i.minY-a[0]},n),{width:o,height:s})},drawShape:function(t,e){var r=this.shapeType,n=this.getShapeStyle(t),i=e.addShape(r,{attrs:n,draggable:!0,name:"node-shape"});return e.shapeMap["node-shape"]=i,i},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"}),i=e.shapeMap["link-point-right"]||e.find(function(Yt){return Yt.get("className")==="link-point-right"}),a=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()),i&&!s&&(s=i.attr()),a&&!s&&(s=a.attr()),o&&!s&&(s=o.attr()),s||(s=r);var d=(0,_.mix)({},s,t.linkPoints),y=d.fill,C=d.stroke,F=d.lineWidth,G=d.size/2;G||(G=d.r);var H=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},ie=H.left,se=H.right,ce=H.top,de=H.bottom,xe=this.getSize(t),Ie=xe[0],qe=xe[1],ze={r:G,fill:y,stroke:C,lineWidth:F};if(n)!ie&&ie!==void 0?(n.remove(),delete e.shapeMap["link-point-left"]):n.attr((0,g.__assign)((0,g.__assign)({},ze),{x:-Ie/2,y:0}));else if(ie){var $e="link-point-left";e.shapeMap[$e]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},ze),{x:-Ie/2,y:0}),className:$e,name:$e,isAnchorPoint:!0})}if(i)!se&&se!==void 0&&(i.remove(),delete e.shapeMap["link-point-right"]),i.attr((0,g.__assign)((0,g.__assign)({},ze),{x:Ie/2,y:0}));else if(se){var mt="link-point-right";e.shapeMap[mt]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},ze),{x:Ie/2,y:0}),className:mt,name:mt,isAnchorPoint:!0})}if(a)!ce&&ce!==void 0&&(a.remove(),delete e.shapeMap["link-point-top"]),a.attr((0,g.__assign)((0,g.__assign)({},ze),{x:0,y:-qe/2}));else if(ce){var xt="link-point-top";e.shapeMap[xt]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},ze),{x:0,y:-qe/2}),className:xt,name:xt,isAnchorPoint:!0})}if(o)!de&&de!==void 0?(o.remove(),delete e.shapeMap["link-point-bottom"]):o.attr((0,g.__assign)((0,g.__assign)({},ze),{x:0,y:qe/2}));else if(de){var wt="link-point-bottom";e.shapeMap[wt]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},ze),{x:0,y:qe/2}),className:wt,name:wt,isAnchorPoint:!0})}},updateShape:function(t,e,r,n,i){var a=e.get("keyShape");a.attr((0,g.__assign)({},r)),this.updateLabel(t,e,i),n&&this.updateIcon(t,e)},updateIcon:function(t,e){var r=this,n=e.getContainer(),i=(this.mergeStyle||this.getOptions(t)).icon,a=t.icon?t.icon:{show:void 0,text:void 0},o=a.show,s=a.text,d=n.shapeMap["".concat(this.type,"-icon")]||n.find(function(ce){return ce.get("name")==="".concat(r.type,"-icon")});if(d)if(o||o===void 0){var y=(0,_.mix)({},d.attr(),i),C=y.width,F=C===void 0?20:C,G=y.height,H=G===void 0?20:G;(y.fontFamily==="iconfont"||y.hasOwnProperty("text"))&&(F=0,H=0),d.attr((0,g.__assign)((0,g.__assign)({},y),{x:-F/2,y:-H/2}))}else d.remove(),delete n.shapeMap["".concat(this.type,"-icon")];else if(o){var ie="".concat(this.type,"-icon");if(s)n.shapeMap[ie]=n.addShape("text",{attrs:(0,g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:ie,name:ie});else{var F=i.width,H=i.height;n.shapeMap[ie]=n.addShape("image",{attrs:(0,g.__assign)((0,g.__assign)({},i),{x:-F/2,y:-H/2}),className:ie,name:ie})}var se=n.shapeMap["node-label"]||n.find(function(ce){return ce.get("name")==="node-label"});se&&se.toFront()}}},dc=(0,g.__assign)((0,g.__assign)({},ss),Yc);Oa.registerNode("single-node",dc);var hc="edge-shape";function Tl(h){var t=h;return h==="start"?t="end":h==="end"&&(t="start"),t}var Ff={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:bn.defaultEdge.size,style:{x:0,y:0,stroke:bn.defaultEdge.style.stroke,lineAppendWidth:bn.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:bn.edgeLabel.style.fill,fontSize:bn.edgeLabel.style.fontSize,fontFamily:bn.windowFontFamily}},stateStyles:(0,g.__assign)({},bn.edgeStateStyles)},getPath:function(t){var e=[];return(0,_.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,_.mix)({},e,r,t.style),i=t.size||bn.defaultEdge.size;t=this.getPathPoints(t);var a=t.startPoint,o=t.endPoint,s=this.getControlPoints(t),d=[a];s&&(d=d.concat(s)),d.push(o);var y=this.getPath(d),C=(0,_.mix)({},bn.defaultEdge.style,{stroke:bn.defaultEdge.color,lineWidth:i,path:y},n);return C},updateShapeStyle:function(t,e,r){var n,i=e.getContainer(),a=((n=e.getKeyShape)===null||n===void 0?void 0:n.call(e))||i.shapeMap["edge-shape"],o=t.size;t=this.getPathPoints(t);var s=t.startPoint,d=t.endPoint,y=this.getControlPoints(t),C=[s];y&&(C=C.concat(y)),C.push(d);var F=a.attr(),G=t.style||{};G.stroke===void 0&&(G.stroke=t.color);var H=t.sourceNode,ie=t.targetNode,se={radius:G.radius};y||(se={source:H,target:ie,offset:G.offset,radius:G.radius});var ce=this.getPath(C,se),de={};r==="move"?de={path:ce}:(F.endArrow&&G.endArrow===!1&&(t.style.endArrow={path:""}),F.startArrow&&G.startArrow===!1&&(t.style.startArrow={path:""}),de=(0,g.__assign)({},t.style),de.lineWidth===void 0&&(de.lineWdith=((0,_.isNumber)(o)?o:o==null?void 0:o[0])||F.lineWidth),de.path===void 0&&(de.path=ce),de.stroke===void 0&&(de.stroke=F.stroke||t.color)),a&&a.attr(de)},getLabelStyleByPosition:function(t,e,r){var n=e.position||this.labelPosition,i={},a=r==null?void 0:r.shapeMap[hc],o;n==="start"?o=0:n==="end"?o=1:o=.5;var s=e.refX||this.refX,d=e.refY||this.refY;if(t.startPoint.x===t.endPoint.x&&t.startPoint.y===t.endPoint.y)return i.x=t.startPoint.x+s,i.y=t.startPoint.y+d,i.text=t.label,i;var y;(0,_.isNil)(e.autoRotate)?y=this.labelAutoRotate:y=e.autoRotate;var C=fl(a,o,s,d,y);return i.x=C.x,i.y=C.y,i.rotate=C.rotate,i.textAlign=this._getTextAlign(n,C.angle),i.text=t.label,i},getLabelBgStyleByPosition:function(t,e){if(!t)return{};var r=t.getBBox(),n=e.style&&e.style.background;if(!n)return{};var i=n.padding,a=r.width+i[1]+i[3],o=r.height+i[0]+i[2],s=(0,g.__assign)((0,g.__assign)({},n),{width:a,height:o,x:r.minX-i[3],y:r.minY-i[0],matrix:[1,0,0,0,1,0,0,0,1]}),d;return(0,_.isNil)(e.autoRotate)?d=this.labelAutoRotate:d=e.autoRotate,d&&(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=Tl(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:hc,name:hc,attrs:r});return e.shapeMap[hc]=n,n},drawLabel:function(t,e){var r=this.options.labelCfg,n=(0,_.deepMix)({},r,t.labelCfg),i=this.getLabelStyle(t,n,e),a=i.rotate;delete i.rotate;var o=e.addShape("text",{attrs:i,name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=o,!isNaN(a)&&a!==""&&o.rotateAtStart(a),i.background){var s=this.drawLabelBg(t,e,o,i,a),d=this.itemType+Wo;s.set("classname",d),e.shapeMap[d]=s,o.toFront()}return o},drawLabelBg:function(t,e,r,n,i){var a=this.options.labelCfg,o=(0,_.deepMix)({},a,t.labelCfg),s=this.getLabelBgStyleByPosition(r,o),d=e.addShape("rect",{name:"text-bg-shape",attrs:s,labelRelated:!0});return e.shapeMap["text-bg-shape"]=d,d}},Uf=(0,g.__assign)((0,g.__assign)({},ss),Ff);Oa.registerEdge("single-edge",Uf),Oa.registerEdge("line",{getControlPoints:function(){}},"single-edge"),Oa.registerEdge("spline",{getPath:function(t){var e=gi(t);return e}},"single-edge"),Oa.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},i,a;if(t.controlPoints!==void 0){if(a=t.controlPoints[0],i=ua(e,a,r),e.x<=r.x&&e.y>r.y?this.clockwise=i.x>a.x?0:1:e.x<=r.x&&e.y<r.y?this.clockwise=i.x>a.x?1:0:e.x>r.x&&e.y<=r.y?this.clockwise=i.y<a.y?0:1:this.clockwise=i.y<a.y?1:0,(a.x-e.x)/(a.y-e.y)==(r.x-e.x)/(r.y-e.y))return[]}else{t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),(0,_.isArray)(t.curveOffset)&&(t.curveOffset=t.curveOffset[0]),t.curveOffset<0?this.clockwise=0:this.clockwise=1;var o={x:r.x-e.x,y:r.y-e.y},s=Math.atan2(o.y,o.x);a={x:t.curveOffset*Math.cos(-Math.PI/2+s)+n.x,y:t.curveOffset*Math.sin(-Math.PI/2+s)+n.y},i=ua(e,a,r)}var d=Jo(e,i),y=[{x:d,y:d}];return y},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),t.length===2?e.push(["L",t[1].x,t[1].y]):e.push(["A",t[1].x,t[1].y,0,0,this.clockwise,t[2].x,t[2].y]),e}},"single-edge"),Oa.registerEdge("quadratic",{curvePosition:.5,curveOffset:-20,getControlPoints:function(t){var e=t.controlPoints;if(!e||!e.length){var r=t.startPoint,n=t.endPoint;t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),t.curvePosition===void 0&&(t.curvePosition=this.curvePosition),(0,_.isArray)(this.curveOffset)&&(t.curveOffset=t.curveOffset[0]),(0,_.isArray)(this.curvePosition)&&(t.curvePosition=t.curveOffset[0]);var i=fc(r,n,t.curvePosition,t.curveOffset);e=[i]}return e},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),e.push(["Q",t[1].x,t[1].y,t[2].x,t[2].y]),e}},"single-edge"),Oa.registerEdge("cubic",{curvePosition:[1/2,1/2],curveOffset:[-20,20],getControlPoints:function(t){var e=t.controlPoints;if(t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),t.curvePosition===void 0&&(t.curvePosition=this.curvePosition),(0,_.isNumber)(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),(0,_.isNumber)(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]),!e||!e.length||e.length<2){var r=t.startPoint,n=t.endPoint,i=fc(r,n,t.curvePosition[0],t.curveOffset[0]),a=fc(r,n,t.curvePosition[1],t.curveOffset[1]);e=[i,a]}return e},getPath:function(t){var e=[];return e.push(["M",t[0].x,t[0].y]),e.push(["C",t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y]),e}},"single-edge"),Oa.registerEdge("cubic-vertical",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(t){var e=t.startPoint,r=t.endPoint;t.curvePosition===void 0&&(t.curvePosition=this.curvePosition),t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),t.minCurveOffset===void 0&&(t.minCurveOffset=this.minCurveOffset),(0,_.isNumber)(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),(0,_.isNumber)(t.minCurveOffset)&&(t.minCurveOffset=[t.minCurveOffset,-t.minCurveOffset]),(0,_.isNumber)(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]);var n=r.y-e.y,i=[0,0];t.curveOffset?i=t.curveOffset:Math.abs(n)<Math.abs(t.minCurveOffset[0])&&(i=t.minCurveOffset);var a={x:e.x,y:e.y+n*this.curvePosition[0]+i[0]},o={x:r.x,y:r.y-n*this.curvePosition[1]+i[1]};return[a,o]}},"cubic"),Oa.registerEdge("cubic-horizontal",{curvePosition:[1/2,1/2],minCurveOffset:[0,0],curveOffset:void 0,getControlPoints:function(t){var e=t.startPoint,r=t.endPoint;t.curvePosition===void 0&&(t.curvePosition=this.curvePosition),t.curveOffset===void 0&&(t.curveOffset=this.curveOffset),t.minCurveOffset===void 0&&(t.minCurveOffset=this.minCurveOffset),(0,_.isNumber)(t.curveOffset)&&(t.curveOffset=[t.curveOffset,-t.curveOffset]),(0,_.isNumber)(t.minCurveOffset)&&(t.minCurveOffset=[t.minCurveOffset,-t.minCurveOffset]),(0,_.isNumber)(t.curvePosition)&&(t.curvePosition=[t.curvePosition,1-t.curvePosition]);var n=r.x-e.x,i=[0,0];t.curveOffset?i=t.curveOffset:Math.abs(n)<Math.abs(t.minCurveOffset[0])&&(i=t.minCurveOffset);var a={x:e.x+n*this.curvePosition[0]+i[0],y:e.y},o={x:r.x-n*this.curvePosition[1]+i[1],y:r.y},s=[a,o];return s}},"cubic"),Oa.registerEdge("loop",{getPathPoints:function(t){return cl(t)},getControlPoints:function(t){return t.controlPoints},afterDraw:function(t){t.controlPoints=void 0},afterUpdate:function(t){t.controlPoints=void 0}},"cubic");var us={itemType:"combo",shapeType:"single-combo",labelPosition:"top",refX:bn.comboLabel.refX,refY:bn.comboLabel.refY,options:{style:{stroke:bn.defaultCombo.style.stroke,fill:bn.defaultCombo.style.fill,lineWidth:bn.defaultCombo.style.lineWidth},labelCfg:{style:{fill:bn.comboLabel.style.fill,fontSize:bn.comboLabel.style.fontSize,fontFamily:bn.windowFontFamily}},stateStyles:(0,g.__assign)({},bn.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},getSize:function(t){var e=(0,_.clone)(t.size||this.options.size||bn.defaultCombo.size);return(0,_.isArray)(e)&&e.length===1&&(e=[e[0],e[0]]),(0,_.isArray)(e)||(e=[e,e]),e},getLabelStyleByPosition:function(t,e){var r=e.position||this.labelPosition,n=t.style,i=t.padding||this.options.padding;(0,_.isArray)(i)&&(i=i[0]);var a=e.refX,o=e.refY;(0,_.isNil)(a)&&(a=this.refX),(0,_.isNil)(o)&&(o=this.refY);var s=this.getSize(t),d=Math.max(n.r,s[0]/2)||s[0]/2,y=d+i,C;switch(r){case"top":C={x:0,y:-y-o,textBaseline:"bottom",textAlign:"center"};break;case"bottom":C={x:0,y:y+o,textBaseline:"bottom",textAlign:"center"};break;case"left":C={x:-y+a,y:0,textAlign:"left"};break;case"center":C={x:0,y:0,text:t.label,textAlign:"center"};break;default:C={x:y+a,y:0,textAlign:"right"};break}return C.text=t.label,C},drawShape:function(t,e){var r=this.shapeType,n=this.getShapeStyle(t),i=e.addShape(r,{attrs:n,draggable:!0,name:"combo-shape"});return i},updateCollapsedIcon:function(t,e,r){var n=t.collapsed,i=t.collapsedSubstituteIcon,a=i===void 0?{}:i,o=Object.assign({},this.options.collapsedSubstituteIcon,a),s=o.show,d=o.img,y=o.width,C=o.height,F=e.getContainer(),G=F.find(function(se){return se.get("name")==="combo-collapsed-substitute-icon"}),H=G&&!G.destroyed;if(n&&s)if(H)G.show();else{var ie={width:y||r.r*2||r.width,height:C||r.r*2||r.height};F.addShape("image",{attrs:(0,g.__assign)({img:d,x:-ie.width/2,y:-ie.height/2},ie),name:"combo-collapsed-substitute-icon",draggable:!0})}else H&&G.hide()},updateShape:function(t,e,r){var n=this,i=e.get("keyShape"),a=e.get("animate"),o=a&&(t.animate===void 0?this.options.animate:t.animate);o&&i.animate?(t.collapsed||this.updateCollapsedIcon(t,e,r),i.animate(r,{duration:200,easing:"easeLinear",callback:function(){t.collapsed&&n.updateCollapsedIcon(t,e,r)}})):(i.attr((0,g.__assign)({},r)),this.updateCollapsedIcon(t,e,r)),this.updateLabel(t,e)}},Al=(0,g.__assign)((0,g.__assign)({},ss),us);Oa.registerCombo("single-combo",Al),Oa.registerCombo("circle",{options:{size:[bn.defaultCombo.size[0],bn.defaultCombo.size[0]],padding:bn.defaultCombo.padding[0],animate:!0,style:{stroke:bn.defaultCombo.style.stroke,fill:bn.defaultCombo.style.fill,lineWidth:bn.defaultCombo.style.lineWidth},labelCfg:{style:{fill:bn.comboLabel.style.fill,fontSize:bn.comboLabel.style.fontSize},refX:0,refY:0},stateStyles:(0,g.__assign)({},bn.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"circle",labelPosition:"top",drawShape:function(t,e){var r=this.getShapeStyle(t);delete r.height,delete r.width;var n=e.addShape("circle",{attrs:r,className:"circle-combo",name:"circle-combo",draggable:!0});return n},getShapeStyle:function(t){var e=this.options.style,r=t.padding||this.options.padding;(0,_.isArray)(r)&&(r=r[0]);var n={stroke:t.color},i=(0,_.mix)({},e,n,t.style),a=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize,o;if(a)o=(0,_.isNumber)(a)?a:a[0];else{var s=this.getSize(t);!(0,_.isNumber)(i.r)||isNaN(i.r)?o=s[0]/2||bn.defaultCombo.style.r:o=Math.max(i.r,s[0]/2)||s[0]/2}i.r=o+r;var d=(0,g.__assign)({x:0,y:0},i);return t.style?t.style.r=o:t.style={r:o},d},update:function(t,e){var r=this.getSize(t),n=t.padding||this.options.padding;(0,_.isArray)(n)&&(n=n[0]);var i=(0,_.clone)(t.style),a=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize,o;a?o=(0,_.isNumber)(a)?a:a[0]:o=Math.max(i.r,r[0]/2)||r[0]/2,i.r=o+n;var s=e.get("sizeCache");s&&(s.r=i.r);var d={stroke:t.color},y=e.get("keyShape"),C=(0,_.mix)({},y.attr(),d,i);t.style?t.style.r=o:t.style={r:o},this.updateShape(t,e,C,!0)}},"single-combo"),Oa.registerCombo("rect",{options:{size:[40,5],padding:[25,20,15,20],animate:!0,style:{radius:0,stroke:bn.defaultCombo.style.stroke,fill:bn.defaultCombo.style.fill,lineWidth:bn.defaultCombo.style.lineWidth},labelCfg:{style:{fill:bn.comboLabel.style.fill,fontSize:bn.comboLabel.style.fontSize,fontFamily:bn.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:(0,g.__assign)({},bn.comboStateStyles),collapsedSubstituteIcon:{show:!1,img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*RsnHRqLfJn4AAAAAAAAAAAAAARQnAQ"}},shapeType:"rect",labelPosition:"top",drawShape:function(t,e){var r=this.getShapeStyle(t),n=e.addShape("rect",{attrs:r,className:"rect-combo",name:"rect-combo",draggable:!0});return n},getLabelStyleByPosition:function(t,e){var r=e.position||this.labelPosition,n=t.style,i=t.padding||this.options.padding;(0,_.isNumber)(i)&&(i=[i,i,i,i]);var a=e.refX,o=e.refY;(0,_.isNil)(a)&&(a=this.refX),(0,_.isNil)(o)&&(o=this.refY);var s=n.width/2+i[3],d=n.height/2+i[0],y;switch(r){case"top":y={x:0-s+a,y:0-d+o,textBaseline:"top",textAlign:"left"};break;case"bottom":y={x:0,y:d+o,textBaseline:"bottom",textAlign:"center"};break;case"left":y={x:0-s+o,y:0,textAlign:"left"};break;case"center":y={x:0,y:0,text:t.label,textAlign:"center"};break;default:y={x:s+a,y:0,textAlign:"right"};break}return y.text=t.label,y},getShapeStyle:function(t){var e=this.options.style,r=t.padding||this.options.padding;(0,_.isNumber)(r)&&(r=[r,r,r,r]);var n={stroke:t.color},i=(0,_.mix)({},e,n,t.style),a=this.getSize(t),o,s,d=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize;d?(0,_.isNumber)(d)?(o=d,s=d):(o=d[0],s=d[1]):(!(0,_.isNumber)(i.width)||isNaN(i.width)?o=a[0]||bn.defaultCombo.style.width:o=Math.max(i.width,a[0])||a[0],!(0,_.isNumber)(i.height)||isNaN(i.height)?s=a[1]||bn.defaultCombo.style.height:s=Math.max(i.height,a[1])||a[1]);var y=-o/2-r[3],C=-s/2-r[0];i.width=o+r[1]+r[3],i.height=s+r[0]+r[2];var F=(0,g.__assign)({x:y,y:C},i);return t.style?(t.style.width=o,t.style.height=s):t.style={width:o,height:s},F},update:function(t,e){var r=this.getSize(t),n=t.padding||this.options.padding;(0,_.isNumber)(n)&&(n=[n,n,n,n]);var i=(0,_.clone)(t.style),a,o,s=t.collapsed&&t.fixCollapseSize?t.fixCollapseSize:t.fixSize;s?(0,_.isNumber)(s)?(a=s,o=s):(a=s[0],o=s[1]):(a=Math.max(i.width,r[0])||r[0],o=Math.max(i.height,r[1])||r[1]),i.width=a+n[1]+n[3],i.height=o+n[0]+n[2];var d=e.get("sizeCache");d&&(d.width=i.width,d.height=i.height),i.x=-a/2-n[3],i.y=-o/2-n[0];var y={stroke:t.color},C=e.get("keyShape"),F=(0,_.mix)({},C.attr(),y,i);t.style?(t.style.width=a,t.style.height=o):t.style={width:a,height:o},this.updateShape(t,e,F,!1)}},"single-combo"),Oa.registerNode("simple-circle",{options:{size:bn.defaultNode.size,style:{x:0,y:0,stroke:bn.defaultNode.style.stroke,fill:bn.defaultNode.style.fill,lineWidth:bn.defaultNode.style.lineWidth},labelCfg:{style:{fill:bn.nodeLabel.style.fill,fontSize:bn.nodeLabel.style.fontSize,fontFamily:bn.windowFontFamily}},stateStyles:(0,g.__assign)({},bn.nodeStateStyles)},shapeType:"simple-circle",labelPosition:"center",shapeMap:{},drawShape:function(t,e){var r=this.getShapeStyle(t),n="".concat(this.type,"-keyShape"),i=e.addShape("circle",{attrs:r,className:"".concat(this.type,"-keyShape"),name:n,draggable:!0});return e.shapeMap[n]=i,i},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,_.deepMix)({},e,r),i=this.getSize(t),a=i[0]/2,o=(0,g.__assign)({x:0,y:0,r:a},n);return o},update:function(t,e,r){var n=this.getSize(t),i={stroke:t.color,r:n[0]/2},a=e.get("keyShape"),o=(0,_.deepMix)({},a.attr(),i,t.style);this.updateShape(t,e,o,!0,r)}},"single-node"),Oa.registerNode("simple-rect",{options:{size:[100,30],style:{radius:0,stroke:bn.defaultNode.style.stroke,fill:bn.defaultNode.style.fill,lineWidth:bn.defaultNode.style.lineWidth},labelCfg:{style:{fill:bn.nodeLabel.style.fill,fontSize:bn.nodeLabel.style.fontSize,fontFamily:bn.windowFontFamily}},anchorPoints:[[0,.5],[1,.5]],stateStyles:(0,g.__assign)({},bn.nodeStateStyles)},shapeType:"simple-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 n},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,_.mix)({},e,r),i=this.getSize(t),a=n.width||i[0],o=n.height||i[1],s=(0,g.__assign)({x:-a/2,y:-o/2,width:a,height:o},n);return s},update:function(t,e,r){var n=e.getContainer(),i=(this.mergeStyle||this.getOptions(t)).style,a=this.getSize(t),o=e.get("keyShape");t.size||(a[0]=o.attr("width")||i.width,a[1]=o.attr("height")||i.height);var s={stroke:t.color,x:-a[0]/2,y:-a[1]/2,width:a[0],height:a[1]},d=(0,_.mix)({},i,o.attr(),s);d=(0,_.mix)(d,t.style),this.updateShape(t,e,d,!1,r)}},"single-node"),Oa.registerNode("image",{options:{img:"https://gw.alipayobjects.com/mdn/rms_f8c6a0/afts/img/A*eD7nT6tmYgAAAAAAAAAAAABkARQnAQ",size:200,labelCfg:{style:{fontFamily:bn.windowFontFamily}},clipCfg:{show:!1,type:"circle",r:50,rx:50,ry:35,width:50,height:35,points:[[30,12],[12,30],[30,48],[48,30]],path:[["M",25,25],["L",50,25],["A",12.5,12.5,0,1,1,50,50],["A",12.5,12.5,0,1,0,50,50],["L",25,75],["Z"]],x:0,y:0}},shapeType:"image",labelPosition:"bottom",drawShape:function(t,e){var r=this.shapeType,n=this.getShapeStyle(t);delete n.fill;var i=e.addShape(r,{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return this.drawClip(t,i),i},drawClip:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).clipCfg;if(!!r.show){var n=r.type,i=r.x,a=r.y,o=r.style;if(n==="circle"){var s=r.r;e.setClip({type:"circle",attrs:(0,g.__assign)({r:s,x:i,y:a},o)})}else if(n==="rect"){var d=r.width,y=r.height,C=i-d/2,F=a-y/2;e.setClip({type:"rect",attrs:(0,g.__assign)({x:C,y:F,width:d,height:y},o)})}else if(n==="ellipse"){var G=r.rx,H=r.ry;e.setClip({type:"ellipse",attrs:(0,g.__assign)({x:i,y:a,rx:G,ry:H},o)})}else if(n==="polygon"){var ie=r.points;e.setClip({type:"polygon",attrs:(0,g.__assign)({points:ie},o)})}else if(n==="path"){var se=r.path;e.setClip({type:"path",attrs:(0,g.__assign)({path:se},o)})}}},getShapeStyle:function(t){var e=this.mergeStyle||this.getOptions(t),r=e.style,n=e.img,i=this.getSize(t),a=i[0],o=i[1];r&&(a=r.width||i[0],o=r.height||i[1]);var s=(0,g.__assign)({x:-a/2,y:-o/2,width:a,height:o,img:n},r);return s},updateShapeStyle:function(t,e){var r=e.getContainer(),n="".concat(this.itemType,"-shape"),i=r.shapeMap[n]||r.find(function(o){return o.get("className")===n})||e.getKeyShape(),a=this.getShapeStyle(t);i&&!i.destroyed&&i.attr(a)}},"single-node");var cs={triangle:function(t,e,r){t===void 0&&(t=10),e===void 0&&(e=15),r===void 0&&(r=0);var n=r*2,i="M ".concat(n,",0 L ").concat(n+e,",-").concat(t/2," L ").concat(n+e,",").concat(t/2," Z");return i},vee:function(t,e,r){t===void 0&&(t=15),e===void 0&&(e=20),r===void 0&&(r=0);var n=r*2,i="M ".concat(n,",0 L ").concat(n+e,",-").concat(t/2,`
  2. L `).concat(n+2*e/3,",0 L ").concat(n+e,",").concat(t/2," Z");return i},circle:function(t,e){t===void 0&&(t=5),e===void 0&&(e=0);var r=e*2,n="M ".concat(r,`, 0
  3. a `).concat(t,",").concat(t," 0 1,0 ").concat(t*2,`,0
  4. a `).concat(t,",").concat(t," 0 1,0 ").concat(-t*2,",0");return n},rect:function(t,e,r){t===void 0&&(t=10),e===void 0&&(e=10),r===void 0&&(r=0);var n=r*2,i="M ".concat(n,",").concat(-t/2,`
  5. L `).concat(n+e,",").concat(-t/2,`
  6. L `).concat(n+e,",").concat(t/2,`
  7. L `).concat(n,",").concat(t/2," Z");return i},diamond:function(t,e,r){t===void 0&&(t=15),e===void 0&&(e=15),r===void 0&&(r=0);var n=r*2,i="M ".concat(n,`,0
  8. L `).concat(n+e/2,",").concat(-t/2,`
  9. L `).concat(n+e,`,0
  10. L `).concat(n+e/2,",").concat(t/2," Z");return i},triangleRect:function(t,e,r,n,i,a){t===void 0&&(t=15),e===void 0&&(e=15),r===void 0&&(r=15),n===void 0&&(n=3),i===void 0&&(i=5),a===void 0&&(a=0);var o=a*2,s=o+e+i,d="M ".concat(o,",0 L ").concat(o+e,",-").concat(t/2," L ").concat(o+e,",").concat(t/2,` Z
  11. M `).concat(s,", -").concat(r/2,`
  12. L `).concat(s+n," -").concat(r/2,`
  13. L `).concat(s+n," ").concat(r/2,`
  14. L `).concat(s," ").concat(r/2,`
  15. Z`);return d}},on={collapse:function(t,e,r){return[["M",t-r,e],["a",r,r,0,1,0,r*2,0],["a",r,r,0,1,0,-r*2,0],["M",t-r+4,e],["L",t+r-4,e]]},expand:function(t,e,r){return[["M",t-r,e],["a",r,r,0,1,0,r*2,0],["a",r,r,0,1,0,-r*2,0],["M",t-r+4,e],["L",t-r+2*r-4,e],["M",t-r+r,e-r+4],["L",t,e+r-4]]},upTriangle:function(t,e,r){var n=r*Math.cos(Math.PI/6),i=r*Math.sin(Math.PI/6);return[["M",t-n,e+i],["L",t+n,e+i],["L",t,e-r],["Z"]]},downTriangle:function(t,e,r){var n=r*Math.cos(Math.PI/6),i=r*Math.sin(Math.PI/6);return[["M",t-n,e-i],["L",t+n,e-i],["L",t,e+r],["Z"]]}},jo=Oa,id=["#5F95FF","#61DDAA","#65789B","#F6BD16","#7262FD","#78D3F8","#9661BC","#F6903D","#008685","#F08BB4"],Zc=ee.vs,ad=(0,g.__assign)((0,g.__assign)((0,g.__assign)((0,g.__assign)((0,g.__assign)((0,g.__assign)({},E),N),I),B),A),{transform:Zc,mat3:$o}),Eo=ad,Il=function(){function h(t){this.graph=t,this.layoutCfg=t.get("layout")||{},this.layoutType=this.getLayoutType(),this.layoutMethods=[],this.initLayout()}return h.prototype.initLayout=function(){},h.prototype.getLayoutType=function(){return this.getLayoutCfgType(this.layoutCfg)},h.prototype.getLayoutCfgType=function(t){var e=t.type;if(e)return e;var r=t.pipes;return Array.isArray(r)?r.map(function(n){return(n==null?void 0:n.type)||""}):null},h.prototype.isLayoutTypeSame=function(t){var e=this.getLayoutCfgType(t),r=Array.isArray(this.layoutType),n=Array.isArray(e);return r&&n?this.layoutType.every(function(i,a){return i===e[a]}):Array.isArray(e)||Array.isArray(this.layoutType)?!1:(t==null?void 0:t.type)===this.layoutType},h.prototype.refreshLayout=function(){var t=this,e=t.graph,r=t.layoutType;!e||(e.get("animate")?e.positionsAnimate(r==="comboCombined"):e.refreshPositions(r==="comboCombined"))},h.prototype.changeLayout=function(t){var e=t.disableTriggerLayout,r=(0,g.__rest)(t,["disableTriggerLayout"]);this.layoutCfg=r,this.layoutType=r.type||this.layoutType,!e&&this.layout()},h.prototype.changeData=function(t){this.layout(t)},h.prototype.destoryLayoutMethods=function(){var t=this.layoutMethods,e=[];return t==null||t.forEach(function(r){var n,i=(n=r.getType)===null||n===void 0?void 0:n.call(r);i&&e.push(i),r.destroy()}),this.layoutMethods=[],e},h.prototype.destroyLayout=function(){var t=this.graph;this.destoryLayoutMethods(),t.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0},h.prototype.setDataFromGraph=function(){for(var t=[],e=[],r=[],n=[],i=[],a=[],o=[],s=this.graph.getNodes(),d=this.graph.getEdges(),y=this.graph.getCombos(),C=s.length,F=0;F<C;F++){var G=s[F];if(!(!G||G.destroyed)){var H=G.getModel();if(!G.isVisible()){e.push(H);continue}t.push(H)}}for(var ie=d.length,F=0;F<ie;F++){var se=d[F];if(!(!se||se.destroyed)){var H=se.getModel();if(!se.isVisible()){n.push(H);continue}H.isComboEdge?i.push(H):r.push(H)}}for(var ce=y.length,F=0;F<ce;F++){var de=y[F];if(!de.destroyed){var H=de.getModel();if(!de.isVisible()){o.push(H);continue}a.push(H)}}return{nodes:t,hiddenNodes:e,edges:r,hiddenEdges:n,combos:a,hiddenCombos:o,comboEdges:i}},h.prototype.relayout=function(t){var e=this,r=this,n=r.graph,i=r.layoutMethods,a=r.layoutCfg;if(t){this.data=this.setDataFromGraph();var o=this.data.nodes;if(!o)return!1;this.initPositions(a.center,o)}n.emit("beforelayout");var s=Promise.resolve();i==null||i.forEach(function(d,y){var C=a[y]||a;s=s.then(function(){var F,G=e.execLayoutMethod(C,y);return y===i.length-1&&((F=a.onAllLayoutEnd)===null||F===void 0||F.call(a)),G})})},h.prototype.filterLayoutData=function(t,e){var r=t.nodes,n=t.edges,i=(0,g.__rest)(t,["nodes","edges"]);if(!r)return t;var a,o;(0,_.isFunction)(e==null?void 0:e.nodesFilter)?a=e.nodesFilter:a=function(){return!0};var s=r.filter(a);if((0,_.isFunction)(e==null?void 0:e.edgesFilter))o=e.edgesFilter;else{var d=s.reduce(function(y,C){return y[C.id]=!0,y},{});o=function(C){return d[C.source]&&d[C.target]}}return(0,g.__assign)({nodes:s,edges:n.filter(o)},i)},h.prototype.getLayoutBBox=function(t){var e=this.graph,r=(0,_.groupBy)(e.getNodes(),function(a){return a.getModel().layoutOrder}),n=Object.values(r).map(function(a){var o=wu(a);return o.size=[o.width,o.height],o}),i=Object.values((0,_.groupBy)(t,"layoutOrder"));return{groupNodes:i,layoutNodes:n}},h.prototype.layoutAnimate=function(){},h.prototype.moveToZero=function(){var t=this.graph,e=t.get("data"),r=e.nodes;if(!(r[0].x===void 0||r[0].x===null||is(r[0].x))){for(var n=[0,0],i=r.length,a=0;a<i;a++){var o=r[a];n[0]+=o.x,n[1]+=o.y}n[0]/=r.length,n[1]/=r.length;for(var a=0;a<i;a++){var o=r[a];o.x-=n[0],o.y-=n[1]}}},h.prototype.initPositions=function(t,e){var r,n=this.graph;if(!e)return!1;var i=e?e.length:0;if(!!i){var a=(r=this.initWithPreset)===null||r===void 0?void 0:r.call(this);if(a)return!1;var o=n.get("width")*.85,s=n.get("height")*.85,d=Math.ceil(Math.sqrt(i)*(o/s)),y=Math.ceil(i/d),C=o/(d-1),F=s/(y-1);(!isFinite(C)||!C)&&(C=0),(!isFinite(F)||!C)&&(F=0);for(var G=t[0]-o/2,H=t[1]-s/2,ie=!0,se=0;se<i;se++){var ce=e[se];is(+ce.x)&&(ie=!1,ce.x=se%d*C+G),is(+ce.y)&&(ie=!1,ce.y=Math.floor(se/d)*F+H)}return ie}},h.prototype.destroy=function(){this.graph=null,this.destoryLayoutMethods(),this.destroyed=!0},h}(),Pl=Il,od=function(){function h(t){this.graph=t,this.destroyed=!1,this.initEvents()}return h}(),Du=od,Vo=jo.registerNode,vc=jo.registerEdge,sd=jo.registerCombo,du=Z.registerBehavior,ln=bn,ud={version:bn.version,AbstractGraph:Vc,BaseGlobal:ln,Util:Eo,Shape:jo,Node:as,Edge:Tf,Combo:Pf,Hull:zo,registerNode:jo.registerNode,registerEdge:jo.registerEdge,registerCombo:jo.registerCombo,registerBehavior:Z.registerBehavior,Arrow:cs,Marker:on,AbstractLayout:Pl,AbstractEvent:Du},Nu=M(10369),fs=M(13063),ls=M(73578),zf=M(6767),hu=M.n(zf),Wf=M(17621),Lu=M.n(Wf),Ru=2,pc=.16,Ol=.05,Dl=.05,Nl=.15,jf=5,Vf=4,Xf=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function Wi(h,t,e){var r;return Math.round(h.h)>=60&&Math.round(h.h)<=240?r=e?Math.round(h.h)-Ru*t:Math.round(h.h)+Ru*t:r=e?Math.round(h.h)+Ru*t:Math.round(h.h)-Ru*t,r<0?r+=360:r>=360&&(r-=360),r}function Ll(h,t,e){if(h.h===0&&h.s===0)return h.s;var r;return e?r=h.s-pc*t:t===Vf?r=h.s+pc:r=h.s+Ol*t,r>1&&(r=1),e&&t===jf&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2))}function Yf(h,t,e){var r;return e?r=h.v+Dl*t:r=h.v-Nl*t,r>1&&(r=1),Number(r.toFixed(2))}function gc(h){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=[],r=Lu()(h),n=jf;n>0;n-=1){var i=r.toHsv(),a=Lu()({h:Wi(i,n,!0),s:Ll(i,n,!0),v:Yf(i,n,!0)}).toHexString();e.push(a)}e.push(r.toHexString());for(var o=1;o<=Vf;o+=1){var s=r.toHsv(),d=Lu()({h:Wi(s,o),s:Ll(s,o),v:Yf(s,o)}).toHexString();e.push(d)}return t.theme==="dark"?Xf.map(function(y){var C=y.index,F=y.opacity,G=Lu().mix(t.backgroundColor||"#141414",e[C],F*100).toHexString();return G}):e}var vu={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"},ka={},Bt={};Object.keys(vu).forEach(function(h){ka[h]=gc(vu[h]),ka[h].primary=ka[h][5],Bt[h]=gc(vu[h],{theme:"dark",backgroundColor:"#141414"}),Bt[h].primary=Bt[h][5]});var Rl=ka.red,ku=ka.volcano,Hc=ka.gold,kl=ka.orange,Zf=ka.yellow,Kc=ka.lime,Bl=ka.green,yc=ka.cyan,$c=ka.blue,Hf=ka.geekblue,Qc=ka.purple,ha=ka.magenta,Bu=ka.grey,ia=function(t,e,r){var n=hu()(t),i=hu()(e);return hu()([(1-r)*n.red()+r*i.red(),(1-r)*n.green()+r*i.green(),(1-r)*n.blue()+r*i.blue()]).rgb()},Gu=function(t,e,r){e===void 0&&(e="#fff"),r===void 0&&(r="rgb(150, 150, 150)");var n=ia(e,t,.05).rgb().toString(),i=ia(e,t,.1).rgb().toString(),a=ia(e,t,.2).rgb().toString(),o=ia(e,t,.4).rgb().toString(),s=ia(e,r,.02).rgb().toString(),d=ia(e,r,.05).rgb().toString(),y=ia(e,r,.1).rgb().toString(),C=ia(e,r,.2).rgb().toString(),F=ia(e,r,.3).rgb().toString(),G=gc(t,{theme:"default",backgroundColor:e}),H=hu()(t).hex().toLowerCase(),ie=G.indexOf(H),se=t;return ie!==-1&&(se=G[ie+1]),{mainStroke:t,mainFill:i,activeStroke:t,activeFill:n,inactiveStroke:o,inactiveFill:n,selectedStroke:t,selectedFill:e,highlightStroke:se,highlightFill:a,disableStroke:F,disableFill:d,edgeMainStroke:F,edgeActiveStroke:t,edgeInactiveStroke:C,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:y,comboMainStroke:F,comboMainFill:s,comboActiveStroke:t,comboActiveFill:n,comboInactiveStroke:F,comboInactiveFill:s,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:se,comboHighlightFill:s,comboDisableStroke:C,comboDisableFill:d}},Oo=function(t,e,r){e===void 0&&(e="#fff"),r===void 0&&(r="#777");var n=ia(e,t,.2).rgb().toString(),i=ia(e,t,.3).rgb().toString(),a=ia(e,t,.6).rgb().toString(),o=ia(e,t,.8).rgb().toString(),s=ia(e,r,.2).rgb().toString(),d=ia(e,r,.25).rgb().toString(),y=ia(e,r,.3).rgb().toString(),C=ia(e,r,.4).rgb().toString(),F=ia(e,r,.5).rgb().toString(),G=gc(t,{theme:"dark",backgroundColor:e}),H=hu()(t).hex().toLowerCase(),ie=G.indexOf(H),se=t;return ie!==-1&&(se=G[ie+1]),{mainStroke:o,mainFill:n,activeStroke:t,activeFill:i,inactiveStroke:o,inactiveFill:n,selectedStroke:t,selectedFill:n,highlightStroke:t,highlightFill:a,disableStroke:F,disableFill:d,edgeMainStroke:r,edgeActiveStroke:t,edgeInactiveStroke:r,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:y,comboMainStroke:C,comboMainFill:d,comboActiveStroke:t,comboActiveFill:s,comboInactiveStroke:C,comboInactiveFill:d,comboSelectedStroke:t,comboSelectedFill:s,comboHighlightStroke:se,comboHighlightFill:d,comboDisableStroke:C,comboDisableFill:s}},As=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"?Gu(t,e,"rgb(150, 150, 150)"):Oo(t,e,"#777")},Vs=function(t,e,r,n){e===void 0&&(e="#fff"),r===void 0&&(r="default"),n===void 0&&(n="rgb(150, 150, 150)");var i=[];return t.forEach(function(a){i.push(As(a,e,r,n))}),i},Is="rgb(95, 149, 255)",Xs="rgb(255, 255, 255)",Ps="rgb(0, 0, 0)",ai=As(Is,Xs),uo={version:"0.7.4",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:ai.mainStroke,fill:ai.mainFill},size:20,color:ai.mainStroke,linkPoints:{size:8,lineWidth:1,fill:ai.activeFill,stroke:ai.activeStroke}},nodeStateStyles:{active:{fill:ai.activeFill,stroke:ai.activeStroke,lineWidth:2,shadowColor:ai.mainStroke,shadowBlur:10},selected:{fill:ai.selectedFill,stroke:ai.selectedStroke,lineWidth:4,shadowColor:ai.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:ai.highlightFill,stroke:ai.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:ai.inactiveFill,stroke:ai.inactiveStroke,lineWidth:1},disable:{fill:ai.disableFill,stroke:ai.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:Ps,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:ai.edgeMainStroke,lineAppendWidth:2},color:ai.edgeMainStroke},edgeStateStyles:{active:{stroke:ai.edgeActiveStroke,lineWidth:1},selected:{stroke:ai.edgeSelectedStroke,lineWidth:2,shadowColor:ai.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ai.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:ai.edgeInactiveStroke,lineWidth:1},disable:{stroke:ai.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:Ps,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:ai.comboMainFill,lineWidth:1,stroke:ai.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:ai.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:ai.comboActiveStroke,lineWidth:1,fill:ai.comboActiveFill},selected:{stroke:ai.comboSelectedStroke,lineWidth:2,fill:ai.comboSelectedFill,shadowColor:ai.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ai.comboHighlightStroke,lineWidth:2,fill:ai.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:ai.comboInactiveStroke,fill:ai.comboInactiveFill,lineWidth:1},disable:{stroke:ai.comboDisableStroke,fill:ai.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"},Os=M(57817),mc=Eo.cloneEvent,Fu=Eo.isViewportChanged,Jc=function(h){(0,g.__extends)(t,h);function t(e){var r=h.call(this,e)||this;return r.extendEvents=[],r.dragging=!1,r.preItem=null,r.graph=e,r.destroyed=!1,r.initEvents(),r}return t.prototype.initEvents=function(){var e=this,r=e.graph,n=e.extendEvents,i=n===void 0?[]:n,a=r.get("canvas"),o=a.get("el"),s=(0,_.wrapBehavior)(this,"onCanvasEvents"),d=(0,_.wrapBehavior)(this,"onExtendEvents"),y=(0,_.wrapBehavior)(this,"onWheelEvent");a.off("*").on("*",s),this.canvasHandler=s,i.push((0,Os.Z)(o,"DOMMouseScroll",y)),i.push((0,Os.Z)(o,"mousewheel",y)),typeof window!="undefined"&&(i.push((0,Os.Z)(window,"keydown",d)),i.push((0,Os.Z)(window,"keyup",d)),i.push((0,Os.Z)(window,"focus",d)))},t.getItemRoot=function(e){for(;e&&!e.get("item");)e=e.get("parent");return e},t.prototype.onCanvasEvents=function(e){var r=this.graph,n=r.get("canvas"),i=e.target,a=e.type;e.canvasX=e.x,e.canvasY=e.y;var o={x:e.canvasX,y:e.canvasY},s=r.get("group"),d=s.getMatrix();if(d||(d=[1,0,0,0,1,0,0,0,1]),Fu(d)&&(o=r.getPointByClient(e.clientX,e.clientY)),e.x=o.x,e.y=o.y,e.currentTarget=r,i===n){(a==="mousemove"||a==="mouseleave")&&this.handleMouseMove(e,"canvas"),e.target=n,e.item=null,r.emit(a,e),r.emit("canvas:".concat(a),e);return}var y=t.getItemRoot(i);if(!y){r.emit(a,e);return}var C=y.get("item");if(!C.destroyed){var F=C.getType();if(e.target=i,e.item=C,e.canvasX===e.x&&e.canvasY===e.y){var G=r.getCanvasByPoint(e.x,e.y);e.canvasX=G.x,e.canvasY=G.y}r.emit(a,e),e.name&&!e.name.includes(":")?r.emit("".concat(F,":").concat(a),e):r.emit(e.name,e),a==="dragstart"&&(this.dragging=!0),a==="dragend"&&(this.dragging=!1),a==="mousemove"&&this.handleMouseMove(e,F)}},t.prototype.onExtendEvents=function(e){this.graph.emit(e.type,e)},t.prototype.onWheelEvent=function(e){(0,_.isNil)(e.wheelDelta)&&(e.wheelDelta=-e.detail),this.graph.emit("wheel",e)},t.prototype.handleMouseMove=function(e,r){var n=this,i=n.graph,a=n.preItem,o=i.get("canvas"),s=e.target===o?null:e.item;e=mc(e),a&&a!==s&&!a.destroyed&&(e.item=a,this.emitCustomEvent(a.getType(),"mouseleave",e),this.dragging&&this.emitCustomEvent(a.getType(),"dragleave",e)),s&&a!==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.destroy=function(){var e=this,r=e.graph,n=e.canvasHandler,i=e.extendEvents,a=r.get("canvas");a.off("*",n),(0,_.each)(i,function(o){o.remove()}),this.dragging=!1,this.preItem=null,this.extendEvents.length=0,this.canvasHandler=null,this.destroyed=!0},t}(Du),Ys=Jc,ti=M(67320),_o=M(81746),pu=M.n(_o),qc=Eo.traverseTree,gu=function(t,e){var r;return t?(0,_.isNumber)(t)?r=function(i){return t}:r=t:r=function(i){return e||1},r},ef=function(t,e){var r=[],n=[],i={},a=0;for(a=0;a<t.length;a++){var o=t[a];i[o.id]=a,r.push(o.x),r.push(o.y),r.push(0),r.push(0),n.push([])}for(a=0;a<e.length;a++){var s=e[a];n[i[s.source]].push(i[s.target]),n[i[s.target]].push(i[s.source])}var d=0;for(a=0;a<t.length;a++){var y=r.length,C=n[a],F=C.length;r[a*4+2]=y,r[a*4+3]=C.length,d=Math.max(d,C.length);for(var G=0;G<F;++G){var H=C[G];r.push(+H)}}for(;r.length%4!=0;)r.push(0);return{array:new Float32Array(r),maxEdgePerVetex:d}},Xo=function(t,e,r){var n=[],i=[],a={},o=0;for(o=0;o<t.length;o++){var s=t[o];a[s.id]=o,n.push(s.x),n.push(s.y),n.push(0),n.push(0),i.push([])}for(o=0;o<e.length;o++){var d=e[o];i[a[d.source]].push(a[d.target]),i[a[d.source]].push(r(d)),i[a[d.target]].push(a[d.source]),i[a[d.target]].push(r(d))}var y=0;for(o=0;o<t.length;o++){var C=n.length,F=i[o],G=F.length;n[o*4+2]=C,n[o*4+3]=G/2,y=Math.max(y,G/2);for(var H=0;H<G;++H){var ie=F[H];n.push(+ie)}}for(;n.length%4!=0;)n.push(0);return{array:new Float32Array(n),maxEdgePerVetex:y}},Gl=function(t,e,r,n){var i=[],a=[],o={},s=0;for(s=0;s<t.length;s++){var d=t[s];o[d.id]=s,i.push(d.x),i.push(d.y),i.push(0),i.push(0),a.push([])}for(s=0;s<e.length;s++){var y=e[s];a[o[y.source]].push(o[y.target]),a[o[y.source]].push(r(y)),a[o[y.source]].push(n(y)),a[o[y.source]].push(0),a[o[y.target]].push(o[y.source]),a[o[y.target]].push(r(y)),a[o[y.target]].push(n(y)),a[o[y.target]].push(0)}var C=0;for(s=0;s<t.length;s++){var F=i.length,G=a[s],H=G.length;i[s*4+2]=F+1048576*H/4,i[s*4+3]=0,C=Math.max(C,H/4);for(var ie=0;ie<H;++ie){var se=G[ie];i.push(+se)}}for(;i.length%4!=0;)i.push(0);return{array:new Float32Array(i),maxEdgePerVetex:C}},yu=function(t,e){var r=[],n=t.length,i={};return e.forEach(function(a){t.forEach(function(o,s){if(i[a[o]]===void 0&&(i[a[o]]=Object.keys(i).length),r.push(i[a[o]]),s===n-1)for(;r.length%4!=0;)r.push(0)})}),{array:new Float32Array(r),count:Object.keys(i).length}},Fl=function(t){for(var e=[],r=t.length,n=t[0].length,i=function(s){t.forEach(function(d,y){if(e.push(d[s]),y===r-1)for(;e.length%4!=0;)e.push(0)})},a=0;a<n;a++)i(a);return new Float32Array(e)},ds=function(t,e){var r=["V","TB","BT"],n={x:Infinity,y:Infinity},i={x:-Infinity,y:-Infinity},a="x",o="y";e&&r.indexOf(e)>=0&&(o="x",a="y");var s=0;qc(t,function(C){return s++,C.x>i.x&&(i.x=C.x),C.x<n.x&&(n.x=C.x),C.y>i.y&&(i.y=C.y),C.y<n.y&&(n.y=C.y),!0});var d=Math.PI*2/s,y=i[o]-n[o];return y===0||qc(t,function(C){var F=(C[o]-n[o])/y*(Math.PI*2-d)+d,G=Math.abs(a==="x"?C.x-t.x:C.y-t.y);return C.x=G*Math.cos(F),C.y=G*Math.sin(F),!0}),t},Uu=function h(){return typeof window=="undefined"||typeof document=="undefined"?{}:{canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var t=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(t.getContext("webgl")||t.getContext("experimental-webgl")))}catch(e){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var e=document.createElement("div");return e.id="webgl-error-message",e.style.fontFamily="monospace",e.style.fontSize="13px",e.style.fontWeight="normal",e.style.textAlign="center",e.style.background="#fff",e.style.color="#000",e.style.padding="1.5em",e.style.width="400px",e.style.margin="5em auto 0",this.webgl||(e.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br />','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join(`
  16. `):['Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" rel="external nofollow" rel="external nofollow" style="color:#000">WebGL</a>.<br/>','Find out how to get it <a href="http://get.webgl.org/" rel="external nofollow" rel="external nofollow" style="color:#000">here</a>.'].join(`
  17. `)),e},addGetWebGLMessage:function(e){e=e||{};var r=e.parent!==void 0?e.parent:document.body,n=e.id!==void 0?e.id:"oldie",i=h().getWebGLErrorMessage();i.id=n,r.appendChild(i)}}},hs=(0,g.__assign)((0,g.__assign)((0,g.__assign)((0,g.__assign)({},Eo),v),p),c),va=hs,bc=va.radialLayout,Ds=function(){function h(t){this.type=t.type,this.radial=t.radial,this.config=t}return h.prototype.init=function(t){var e=this;if(this.data=t,this.radial){this.layoutMethod=function(r){var n=pu()[e.type](r,e.config);return bc(n),n};return}this.layoutMethod=function(r){return pu()[e.type](r,e.config)}},h.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},h.prototype.layout=function(t){return this.init(t),this.execute()},h}(),zu=Ds;(0,ti.registerLayout)("grid",ti.GridLayout),(0,ti.registerLayout)("random",ti.RandomLayout),(0,ti.registerLayout)("force",ti.ForceLayout),(0,ti.registerLayout)("circular",ti.CircularLayout),(0,ti.registerLayout)("dagre",ti.DagreLayout),(0,ti.registerLayout)("dagreCompound",ti.DagreCompoundLayout),(0,ti.registerLayout)("radial",ti.RadialLayout),(0,ti.registerLayout)("concentric",ti.ConcentricLayout),(0,ti.registerLayout)("mds",ti.MDSLayout),(0,ti.registerLayout)("fruchterman",ti.FruchtermanLayout),(0,ti.registerLayout)("fruchterman-gpu",ti.FruchtermanGPULayout),(0,ti.registerLayout)("gForce",ti.GForceLayout),(0,ti.registerLayout)("force2",ti.Force2Layout),(0,ti.registerLayout)("gForce-gpu",ti.GForceGPULayout),(0,ti.registerLayout)("comboForce",ti.ComboForceLayout),(0,ti.registerLayout)("comboCombined",ti.ComboCombinedLayout),(0,ti.registerLayout)("forceAtlas2",ti.ForceAtlas2Layout);var tf=function(t,e){e.isCustomLayout=!0,ti.Layouts[t]=(0,ti.registerLayout)(t,e)},Yo=function(){function h(t,e){var r=t.toString(),n=new Blob(["importScripts('".concat(e,"');(").concat(r,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(n))}return h}(),Zs=Yo,Ba=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("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 i(o){var s=o.data.type;return s===n.RUN||s===n.GPURUN}function a(o){var s=this,d=o.data.type;switch(d){case n.RUN:{var y=o.data,C=y.nodes,F=y.edges,G=y.layoutCfg,H=G===void 0?{}:G,ie=H.type,se=layout.getLayoutByName(ie);if(!se){this.postMessage({type:n.ERROR,message:"layout ".concat(ie," not found")});break}var ce;H.onLayoutEnd=function(){s.postMessage({type:n.END,nodes:C}),ce==null||ce.destroy()},ce=new se(H),ce.init({nodes:C,edges:F}),ce.execute();break}case n.GPURUN:{var de=o.data,xe=de.nodes,F=de.edges,Ie=de.layoutCfg,H=Ie===void 0?{}:Ie,qe=de.canvas,ie=H.type,se=layout.getLayoutByName(ie);if(!se){this.postMessage({type:n.ERROR,message:"layout ".concat(ie," not found")});break}if(ie.split("-")[1]!=="gpu"){this.postMessage({type:n.ERROR,message:"layout ".concat(ie," does not support GPU")});break}var ze=new se(H);ze.init({nodes:xe,edges:F}),ze.executeWithWorker(qe,this);break}default:break}}onmessage=function(s){i(s)&&a(s)}}var r=new Zs(e,t);return r},Ja={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function co(h){return co=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},co(h)}var Ns=function(t){return setTimeout(t,16)},Ec=function(t){return clearTimeout(t)},Hs={requestAnimationFrame:function(t){var e=typeof window!="undefined"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||Ns;return e(t)},cancelAnimationFrame:function(t){var e=typeof window!="undefined"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||Ec;return e(t)}},Wu=["fruchterman","gForce"],Kf=["force","grid","circular"],rf=function(h){(0,g.__extends)(t,h);function t(e){var r=h.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=Ba(this.layoutCfg.workerScriptURL),this.worker)},t.prototype.stopWorker=function(){var e=this.workerData;!this.worker||(this.worker.terminate(),this.worker=null,e.requestId&&(Hs.cancelAnimationFrame(e.requestId),e.requestId=null),e.requestId2&&(Hs.cancelAnimationFrame(e.requestId2),e.requestId2=null))},t.prototype.execLayoutMethod=function(e,r){var n=this;return new Promise(function(i,a){return(0,g.__awaiter)(n,void 0,void 0,function(){var o,s,d,y,C,F,G,H,ie,se,G,ce;return(0,g.__generator)(this,function(de){switch(de.label){case 0:if(o=this.graph,!o||o.get("destroyed"))return[2];s=e.type,e.onLayoutEnd=function(){o.emit("aftersublayout",{type:s}),i()},s&&this.isGPU&&(this.hasGPUVersion(s)?s="".concat(s,"-gpu"):console.warn("The '".concat(s,"' layout does not support GPU calculation for now, it will run in CPU."))),d=s==="force"||s==="g6force"||s==="gForce"||s==="force2",d?(y=e.onTick,C=e.animate,F=C===void 0&&(s==="force"||s==="force2"),G=function(){y&&y(),(C||F)&&o.refreshPositions()},e.tick=G):(s==="comboForce"||s==="comboCombined")&&(e.comboTrees=o.get("comboTrees")),H=!1;try{ie=new ti.Layouts[s](e),this.layoutMethods[r]&&this.layoutMethods[r].destroy(),this.layoutMethods[r]=ie}catch(xe){console.warn("The layout method: '".concat(s,"' does not exist! Please specify it first.")),a()}return H=ie.enableTick,H&&(se=e.onTick,G=function(){se&&se(),o.refreshPositions()},ie.tick=G),ce=this.filterLayoutData(this.data,e),xc(ce,r),ie.init(ce),o.emit("beforesublayout",{type:s}),[4,ie.execute()];case 1:return de.sent(),ie.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd(),[2]}})})})},t.prototype.updateLayoutMethod=function(e,r){var n=this;return new Promise(function(i,a){return(0,g.__awaiter)(n,void 0,void 0,function(){var o,s,d;return(0,g.__generator)(this,function(y){switch(y.label){case 0:return o=this.graph,s=r==null?void 0:r.type,r.onLayoutEnd=function(){o.emit("aftersublayout",{type:s}),i()},d=this.filterLayoutData(this.data,r),e.init(d),e.updateCfg(r),o.emit("beforesublayout",{type:s}),[4,e.execute()];case 1:return y.sent(),e.isCustomLayout&&r.onLayoutEnd&&r.onLayoutEnd(),[2]}})})})},t.prototype.layout=function(e){var r=this,n=this.graph;this.data=this.setDataFromGraph();var i=this.data,a=i.nodes,o=i.hiddenNodes;if(!a)return!1;var s=n.get("width"),d=n.get("height"),y={};Object.assign(y,{width:s,height:d,center:[s/2,d/2]},this.layoutCfg),this.layoutCfg=y;var C=y.type,F=this.destoryLayoutMethods();n.emit("beforelayout"),(F==null?void 0:F.length)&&C&&(F==null?void 0:F.length)===1&&F[0]===C?this.tweakInit():this.initPositions(y.center,a),this.initPositions(y.center,o),C&&C.split("-")[1]==="gpu"&&(C=C.split("-")[0],y.gpuEnabled=!0);var G=!1;y.gpuEnabled&&(G=!0,Uu().webgl||(console.warn("Your browser does not support webGL or GPGPU. The layout will run in CPU."),G=!1)),this.isGPU=G;var H=y.onLayoutEnd,ie=y.layoutEndFormatted,se=y.adjust;if(ie||(y.layoutEndFormatted=!0,y.onAllLayoutEnd=function(){return(0,g.__awaiter)(r,void 0,void 0,function(){return(0,g.__generator)(this,function(xe){switch(xe.label){case 0:return H&&H(a),this.refreshLayout(),se&&y.pipes?[4,this.adjustPipesBox(this.data,se)]:[3,2];case 1:xe.sent(),this.refreshLayout(),xe.label=2;case 2:return n.emit("afterlayout"),[2]}})})}),this.stopWorker(),y.workerEnabled&&this.layoutWithWorker(this.data,e))return!0;var ce=Promise.resolve(),de=!1;return y.type?(de=!0,ce=ce.then(function(){return(0,g.__awaiter)(r,void 0,void 0,function(){return(0,g.__generator)(this,function(xe){switch(xe.label){case 0:return[4,this.execLayoutMethod(y,0)];case 1:return[2,xe.sent()]}})})})):y.pipes&&(de=!0,y.pipes.forEach(function(xe,Ie){ce=ce.then(function(){return(0,g.__awaiter)(r,void 0,void 0,function(){return(0,g.__generator)(this,function(qe){switch(qe.label){case 0:return[4,this.execLayoutMethod(xe,Ie)];case 1:return[2,qe.sent()]}})})})})),de?ce.then(function(){y.onAllLayoutEnd&&y.onAllLayoutEnd(),e&&e()}).catch(function(xe){console.warn("graph layout failed,",xe)}):(n.refreshPositions(),e==null||e()),!1},t.prototype.tweakInit=function(){var e=this,r=e.data,n=e.graph,i=r.nodes,a=r.edges;if(!!(i==null?void 0:i.length)){var o={};i.forEach(function(y){var C=y.x,F=y.y;!isNaN(C)&&!isNaN(F)&&(o[y.id]={x:C,y:F},y.mass=y.mass||2)}),a.forEach(function(y){var C=y.source,F=y.target,G=o[C],H=o[F];!G&&H?o[C]={x:H.x+(Math.random()-.5)*80,y:H.y+(Math.random()-.5)*80}:!H&&G&&(o[F]={x:G.x+(Math.random()-.5)*80,y:G.y+(Math.random()-.5)*80})});var s=n.get("width"),d=n.get("height");i.forEach(function(y){var C=o[y.id]||{x:s/2+(Math.random()-.5)*20,y:d/2+(Math.random()-.5)*20};y.x=C.x,y.y=C.y})}},t.prototype.initWithPreset=function(){var e=this,r=e.layoutCfg,n=e.data,i=r.preset;if(!(i==null?void 0:i.type)||!ti.Layouts[i==null?void 0:i.type])return!1;var a=new ti.Layouts[i==null?void 0:i.type](i);return a.layout(n),delete r.preset,!0},t.prototype.layoutWithWorker=function(e,r){var n=this,i=this,a=i.layoutCfg,o=i.graph,s=this.getWorker(),d=this.workerData;if(!s)return!1;d.requestId=null,d.requestId2=null,d.currentTick=null,d.currentTickData=null,o.emit("beforelayout");var y=Promise.resolve(),C=!1;if(a.type)C=!0,y=y.then(function(){return n.runWebworker(s,e,a)});else if(a.pipes){C=!0;for(var F=function(ce){y=y.then(function(){return n.runWebworker(s,e,ce)})},G=0,H=a.pipes;G<H.length;G++){var ie=H[G];F(ie)}}return C&&y.then(function(){a.onAllLayoutEnd&&a.onAllLayoutEnd(),r==null||r()}).catch(function(se){console.error("layout failed",se)}),!0},t.prototype.runWebworker=function(e,r,n){var i=this,a=this.isGPU,o=this.filterLayoutData(r,n),s=o.nodes,d=o.edges,y=document.createElement("canvas"),C=a&&typeof window!="undefined"&&window.navigator&&!navigator.gpu&&"OffscreenCanvas"in window&&"transferControlToOffscreen"in y,F=$f(n,function(H){return typeof H!="function"});if(!C)e.postMessage({type:Ja.RUN,nodes:s,edges:d,layoutCfg:F});else{var G=y.transferControlToOffscreen();F.type="".concat(F.type,"-gpu"),e.postMessage({type:Ja.GPURUN,nodes:s,edges:d,layoutCfg:F,canvas:G},[G])}return new Promise(function(H,ie){e.onmessage=function(se){i.handleWorkerMessage(H,ie,se,o,n)}})},t.prototype.handleWorkerMessage=function(e,r,n,i,a){var o=this,s=o.graph,d=o.workerData,y=n.data,C=y.type,F=function(){a.onTick&&a.onTick()};switch(C){case Ja.TICK:d.currentTick=y.currentTick,d.currentTickData=y,d.requestId||(d.requestId=Hs.requestAnimationFrame(function(){Ks(i,y),s.refreshPositions(),F(),y.currentTick===y.totalTicks?e():d.currentTick===y.totalTicks&&(d.requestId2=Hs.requestAnimationFrame(function(){Ks(i,d.currentTickData),s.refreshPositions(),d.requestId2=null,F(),e()})),d.requestId=null}));break;case Ja.END:d.currentTick==null&&(Ks(i,y),e());break;case Ja.GPUEND:d.currentTick==null&&(nf(i,y),e());break;case Ja.ERROR:console.warn("Web-Worker layout error!",y.message),r();break;default:r();break}},t.prototype.updateLayoutCfg=function(e){var r=this,n=this,i=n.graph,a=n.layoutMethods,o=e.disableTriggerLayout,s=(0,g.__rest)(e,["disableTriggerLayout"]),d=(0,_.mix)({},this.layoutCfg,s);if(this.layoutCfg=d,!o){if(!(a==null?void 0:a.length)){this.layout();return}if(this.data=this.setDataFromGraph(),this.stopWorker(),!(s.workerEnabled&&this.layoutWithWorker(this.data,null))){i.emit("beforelayout");var y=Promise.resolve(),C=!1;(a==null?void 0:a.length)===1?(C=!0,y=y.then(function(){return(0,g.__awaiter)(r,void 0,void 0,function(){return(0,g.__generator)(this,function(F){switch(F.label){case 0:return[4,this.updateLayoutMethod(a[0],d)];case 1:return[2,F.sent()]}})})})):(a==null?void 0:a.length)&&(C=!0,a.forEach(function(F,G){var H=d.pipes[G];y=y.then(function(){return(0,g.__awaiter)(r,void 0,void 0,function(){return(0,g.__generator)(this,function(ie){switch(ie.label){case 0:return[4,this.updateLayoutMethod(F,H)];case 1:return[2,ie.sent()]}})})})})),C&&y.then(function(){d.onAllLayoutEnd&&d.onAllLayoutEnd()}).catch(function(F){console.warn("layout failed",F)})}}},t.prototype.adjustPipesBox=function(e,r){var n=this;return new Promise(function(i){var a=e.nodes;(a==null?void 0:a.length)||i(),Kf.includes(r)||(console.warn("The adjust type ".concat(r," is not supported yet, please assign it with 'force', 'grid', or 'circular'.")),i());var o={center:n.layoutCfg.center,nodeSize:function(H){return Math.max(H.height,H.width)},preventOverlap:!0,onLayoutEnd:function(){}},s=n.getLayoutBBox(a),d=s.groupNodes,y=s.layoutNodes,C=(0,_.clone)(y);o.onLayoutEnd=function(){y==null||y.forEach(function(G,H){var ie,se,ce,de=G.x-((ie=C[H])===null||ie===void 0?void 0:ie.x),xe=G.y-((se=C[H])===null||se===void 0?void 0:se.y);(ce=d[H])===null||ce===void 0||ce.forEach(function(Ie){Ie.x+=de,Ie.y+=xe})}),i()};var F=new ti.Layouts[r](o);F.layout({nodes:y})})},t.prototype.hasGPUVersion=function(e){return Wu.includes(e)},t.prototype.destroy=function(){this.destoryLayoutMethods();var e=this.worker;e&&(e.terminate(),this.worker=null),this.destroyed=!0,this.graph.set("layout",void 0),this.layoutCfg=void 0,this.layoutType=void 0,this.layoutMethods=void 0,this.graph=null},t}(Pl),_c=rf;function Ks(h,t){for(var e=h.nodes,r=t.nodes,n=e.length,i=0;i<n;i++){var a=e[i];a.x=r[i].x,a.y=r[i].y}}function $f(h,t){var e={};return h&&co(h)==="object"?(Object.keys(h).forEach(function(r){h.hasOwnProperty(r)&&t(h[r])&&(e[r]=h[r])}),e):h}function nf(h,t){for(var e=h.nodes,r=t.vertexEdgeData,n=e.length,i=0;i<n;i++){var a=e[i],o=r[4*i],s=r[4*i+1];a.x=o,a.y=s}}function xc(h,t){var e;if(!!((e=h==null?void 0:h.nodes)===null||e===void 0?void 0:e.length)){var r=h.nodes;r.forEach(function(n){n.layoutOrder=t})}}var Di=M(6056),ju=ee.vs,vs="svg",Vu=function(h){(0,g.__extends)(t,h);function t(e){var r=h.call(this,e)||this,n=r.get("defaultNode");return n||r.set("defaultNode",{type:"circle"}),n.type||(n.type="circle",r.set("defaultNode",n)),r.destroyed=!1,r}return t.prototype.initLayoutController=function(){var e=new _c(this);this.set({layoutController:e})},t.prototype.initEventController=function(){var e=new Ys(this);this.set({eventController:e})},t.prototype.initCanvas=function(){var e=this.get("container");if(typeof e=="string"&&(e=document.getElementById(e),this.set("container",e)),!e)throw new Error("invalid container");var r=e.clientWidth,n=e.clientHeight,i=this.get("width")||r,a=this.get("height")||n;!this.get("width")&&!this.get("height")&&(this.set("width",r),this.set("height",n));var o=this.get("renderer"),s;if(o===vs)s=new ls.Canvas({container:e,width:i,height:a});else{var d={container:e,width:i,height:a},y=this.get("pixelRatio");y&&(d.pixelRatio=y),s=new fs.Canvas(d)}this.set("canvas",s)},t.prototype.initPlugins=function(){var e=this;(0,_.each)(e.get("plugins"),function(r){!r.destroyed&&r.initPlugin&&r.initPlugin(e)})},t.prototype.downloadImageWatermark=function(e,r,n,i){return(0,g.__awaiter)(this,void 0,void 0,function(){var a,o,s;return(0,g.__generator)(this,function(d){switch(d.label){case 0:return a=e.style.backgroundImage,o=a.slice(5,a.length-2),s=new Image,s.src=o,[4,new Promise(function(y){s.onload=function(){var C=r.createPattern(s,"repeat");r.rect(0,0,n,i),r.fillStyle=C,r.fill(),y("")}})];case 1:return d.sent(),[2]}})})},t.prototype.asyncToDataUrl=function(e,r,n,i,a,o){var s=this,d=document.querySelector(".g6-graph-watermarker"),y=this.get("canvas"),C=y.getRenderer(),F=o||y.get("el"),G="";e||(e="image/png"),setTimeout(function(){return(0,g.__awaiter)(s,void 0,void 0,function(){var H,ie,se,ce,de,xe,Ie,qe,ze,$e;return(0,g.__generator)(this,function(mt){switch(mt.label){case 0:return C!=="svg"?[3,1]:(H=F.cloneNode(!0),ie=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),se=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",ie),se.replaceChild(H,se.documentElement),ce=new XMLSerializer().serializeToString(se),G="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(ce)),[3,4]);case 1:return de=void 0,xe=F.getContext("2d"),Ie=i||this.get("width"),qe=a||this.get("height"),ze=void 0,d?[4,this.downloadImageWatermark(d,xe,Ie,qe)]:[3,3];case 2:mt.sent(),mt.label=3;case 3:if(r){$e=typeof window!="undefined"?window.devicePixelRatio:1;try{de=xe.getImageData(0,0,Ie*$e,qe*$e),ze=xe.globalCompositeOperation,xe.globalCompositeOperation="destination-over",xe.fillStyle=r,xe.fillRect(0,0,Ie,qe)}catch(xt){console.error("Download image failed. Out of memory at ImageData creation")}}G=F.toDataURL(e),r&&(xe.clearRect(0,0,Ie,qe),xe.putImageData(de,0,0),xe.globalCompositeOperation=ze),mt.label=4;case 4:return n&&n(G),[2]}})})},16)},t.prototype.toDataURL=function(e,r){var n=this.get("canvas"),i=n.getRenderer(),a=n.get("el");e||(e="image/png");var o="";if(i==="svg"){var s=a.cloneNode(!0),d=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),y=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",d);y.replaceChild(s,y.documentElement);var C=new XMLSerializer().serializeToString(y);o="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(C))}else{var F=void 0,G=a.getContext("2d"),H=Math.max(this.get("width"),500),ie=Math.max(this.get("height"),500),se=void 0;if(r){var ce=typeof window!="undefined"&&window.devicePixelRatio||1;try{F=G.getImageData(0,0,H*ce,ie*ce),se=G.globalCompositeOperation,G.globalCompositeOperation="destination-over",G.fillStyle=r,G.fillRect(0,0,H,ie)}catch(de){console.error("Download image failed. Out of memory at ImageData creation")}}o=a.toDataURL(e),r&&(G.clearRect(0,0,H,ie),G.putImageData(F,0,0),G.globalCompositeOperation=se)}return o},t.prototype.toFullDataURL=function(e,r,n){var i=this.get("group").getCanvasBBox(),a=i.height,o=i.width,s=this.get("renderer"),d=(0,Di.Z)('<div id="virtual-image"></div>'),y=n?n.backgroundColor:void 0,C=n?n.padding:void 0;C?(0,_.isNumber)(C)&&(C=[C,C,C,C]):C=[0,0,0,0];var F=a+C[0]+C[2],G=o+C[1]+C[3],H={container:d,height:F,width:G,quickHit:!0},ie=s==="svg"?new ls.Canvas(H):new fs.Canvas(H),se=this.get("group"),ce=se.clone(),de=(0,_.clone)(ce.getMatrix());de||(de=[1,0,0,0,1,0,0,0,1]);var xe=(i.maxX+i.minX)/2,Ie=(i.maxY+i.minY)/2;de=ju(de,[["t",-xe,-Ie],["t",o/2+C[3],a/2+C[0]]]),ce.resetMatrix(),ce.setMatrix(de),ie.add(ce);var qe=ie.get("el"),ze="";r||(r="image/png"),setTimeout(function(){if(s==="svg"){var $e=qe.cloneNode(!0),mt=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),xt=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",mt);xt.replaceChild($e,xt.documentElement);var wt=new XMLSerializer().serializeToString(xt);ze="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(wt))}else{var Yt=void 0,Zt=qe.getContext("2d"),Er=void 0;if(y){var Fr=typeof window!="undefined"?window.devicePixelRatio:1;try{Yt=Zt.getImageData(0,0,G*Fr,F*Fr),Er=Zt.globalCompositeOperation,Zt.globalCompositeOperation="destination-over",Zt.fillStyle=y,Zt.fillRect(0,0,G,F)}catch(Ur){console.error("Download image failed. Out of memory at ImageData creation")}}ze=qe.toDataURL(r),y&&(Zt.clearRect(0,0,G,F),Zt.putImageData(Yt,0,0),Zt.globalCompositeOperation=Er)}e&&e(ze)},16)},t.prototype.downloadFullImage=function(e,r,n){var i=this,a=this.get("group").getCanvasBBox(),o=a.height,s=a.width,d=this.get("renderer"),y=(0,Di.Z)('<div id="virtual-image"></div>'),C=document.querySelector(".g6-graph-watermarker"),F=n?n.backgroundColor:void 0,G=n?n.padding:void 0;G?(0,_.isNumber)(G)&&(G=[G,G,G,G]):G=[0,0,0,0];var H=o+G[0]+G[2],ie=s+G[1]+G[3];if(C){var se=this.get("graphWaterMarker").cfg||{},ce=se.width,de=se.height;H=Math.ceil(H/de)*de,ie=Math.ceil(ie/ce)*ce}var xe={container:y,height:H,width:ie},Ie=d==="svg"?new ls.Canvas(xe):new fs.Canvas(xe),qe=this.get("group"),ze=qe.clone(),$e=(0,_.clone)(ze.getMatrix());$e||($e=[1,0,0,0,1,0,0,0,1]);var mt=(a.maxX+a.minX)/2,xt=(a.maxY+a.minY)/2;$e=ju($e,[["t",-mt,-xt],["t",s/2+G[3],o/2+G[0]]]),ze.resetMatrix(),ze.setMatrix($e),Ie.add(ze);var wt=Ie.get("el");r||(r="image/png"),this.asyncToDataUrl(r,F,function(Yt){var Zt=document.createElement("a"),Er=(e||"graph")+(d==="svg"?".svg":".".concat(r.split("/")[1]));i.dataURLToImage(Yt,d,Zt,Er);var Fr=document.createEvent("MouseEvents");Fr.initEvent("click",!1,!1),Zt.dispatchEvent(Fr)},ie,H,wt)},t.prototype.downloadImage=function(e,r,n){var i=this,a=this;a.stopAnimate();var o=a.get("canvas"),s=o.getRenderer();r||(r="image/png");var d=(e||"graph")+(s==="svg"?".svg":r.split("/")[1]),y=document.createElement("a");a.asyncToDataUrl(r,n,function(C){i.dataURLToImage(C,s,y,d);var F=document.createEvent("MouseEvents");F.initEvent("click",!1,!1),y.dispatchEvent(F)})},t.prototype.dataURLToImage=function(e,r,n,i){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 a=e.split(","),o="";if(a&&a.length>0){var s=a[0].match(/:(.*?);/);s&&s.length>=2&&(o=s[1])}for(var d=atob(a[1]),y=d.length,C=new Uint8Array(y);y--;)C[y]=d.charCodeAt(y);var F=new Blob([C],{type:o});window.navigator.msSaveBlob?window.navigator.msSaveBlob(F,i):n.addEventListener("click",function(){n.download=i,n.href=window.URL.createObjectURL(F)})}else n.addEventListener("click",function(){n.download=i,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=uo.waterMarkerImage);var n=this.get("container");(0,_.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var i=this.get("graphWaterMarker"),a=(0,_.deepMix)({},uo.imageWaterMarkerConfig,r),o=a.width,s=a.height,d=a.compatible,y=a.image;if(!i){var C={container:n,width:o,height:s,capture:!1},F=this.get("pixelRatio");F&&(C.pixelRatio=F),i=new fs.Canvas(C),this.set("graphWaterMarker",i)}i.get("el").style.display="none";var G=i.get("context"),H=y.rotate,ie=y.x,se=y.y;G.rotate(-H*Math.PI/180);var ce=new Image;ce.crossOrigin="anonymous",ce.src=e,ce.onload=function(){if(G.drawImage(ce,ie,se,y.width,y.height),G.rotate(H*Math.PI/180),d)n.style.cssText="background-image: url(".concat(i.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var de=document.querySelector(".g6-graph-watermarker");de||(de=document.createElement("div"),de.className="g6-graph-watermarker"),de.className="g6-graph-watermarker",i.destroyed||(de.style.cssText="background-image: url(".concat(i.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(de))}}},t.prototype.setTextWaterMarker=function(e,r){var n=this.get("container");(0,_.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var i=this.get("graphWaterMarker"),a=(0,_.deepMix)({},uo.textWaterMarkerConfig,r),o=a.width,s=a.height,d=a.compatible,y=a.text;if(!i){var C={container:n,width:o,height:s,capture:!1},F=this.get("pixelRatio");F&&(C.pixelRatio=F),i=new fs.Canvas(C),this.set("graphWaterMarker",i)}i.get("el").style.display="none";var G=i.get("context"),H=y.rotate,ie=y.fill,se=y.fontFamily,ce=y.fontSize,de=y.baseline,xe=y.x,Ie=y.y,qe=y.lineHeight;G.rotate(-H*Math.PI/180),G.font="".concat(ce,"px ").concat(se),G.fillStyle=ie,G.textBaseline=de;for(var ze=e.length-1;ze>=0;ze--)G.fillText(e[ze],xe,Ie+ze*qe);if(G.rotate(H*Math.PI/180),d)n.style.cssText="background-image: url(".concat(i.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var $e=document.querySelector(".g6-graph-watermarker");$e||($e=document.createElement("div"),$e.className="g6-graph-watermarker"),$e.style.cssText="background-image: url(".concat(i.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($e)}},t.prototype.destroy=function(){var e,r,n,i;(0,_.each)(this.get("plugins"),function(y){y.destroyPlugin()});var a=this.get("tooltips");if(a)for(var o=0;o<a.length;o++){var s=a[o];if(!!s){var d=s.parentElement;!d||d.removeChild(s)}}(e=this.get("eventController"))===null||e===void 0||e.destroy(),(r=this.get("layoutController"))===null||r===void 0||r.destroy(),(n=this.get("graphWaterMarker"))===null||n===void 0||n.destroy(),(i=document.querySelector(".g6-graph-watermarker"))===null||i===void 0||i.remove(),h.prototype.destroy.call(this)},t}(Vc),Xu=Vu,Yi=va.radialLayout,Ul=va.traverseTree,Sc=function(h){(0,g.__extends)(t,h);function t(e){var r=h.call(this,e)||this;return r.layoutAnimating=!1,r.set("removeList",[]),r.set("layoutMethod",r.getLayout()),r}return t.prototype.getLayout=function(){var e=this.get("layout");return e?typeof e=="function"?e:(e.type||(e.type="dendrogram"),e.direction||(e.direction="TB"),e.radial?function(r){var n=pu()[e.type](r,e);return Yi(n),n}:function(r){return pu()[e.type](r,e)}):null},t.indexOfChild=function(e,r){var n=-1;return(0,_.each)(e,function(i,a){if(r===i.id)return n=a,!1}),n},t.prototype.getDefaultCfg=function(){var e=h.prototype.getDefaultCfg.call(this);return e.animate=!0,e},t.prototype.innerAddChild=function(e,r,n){var i=this,a=e.data;a&&(a.x=e.x,a.y=e.y,a.depth=e.depth);var o=i.addItem("node",a,!1);if(r){if(o.set("parent",r),n){var s=r.get("originAttrs");if(s)o.set("originAttrs",s);else{var d=r.getModel();o.set("originAttrs",{x:d.x,y:d.y})}}var y=r.get("children");y?y.push(o):r.set("children",[o]),i.addItem("edge",{source:r.get("id"),target:o.get("id"),id:"".concat(r.get("id"),":").concat(o.get("id"))},!1)}return(0,_.each)(e.children||[],function(C){i.innerAddChild(C,o,n)}),i.emit("afteraddchild",{item:o,parent:r}),o},t.prototype.innerUpdateChild=function(e,r,n){var i=this,a=i.findById(e.id);if(!a){i.innerAddChild(e,r,n);return}(0,_.each)(e.children||[],function(H){i.innerUpdateChild(H,a,n)});var o=a.get("children");if(o){var s=o.length;if(s>0)for(var d=o.length-1;d>=0;d--){var y=o[d].getModel();t.indexOfChild(e.children||[],y.id)===-1&&(i.innerRemoveChild(y.id,{x:e.x,y:e.y},n),o.splice(d,1))}}var C,F;a.get("originAttrs")&&(C=a.get("originAttrs").x,F=a.get("originAttrs").y);var G=a.getModel();n&&a.set("originAttrs",{x:G.x,y:G.y}),a.set("model",e.data),(C!==e.x||F!==e.y)&&a.updatePosition({x:e.x,y:e.y})},t.prototype.innerRemoveChild=function(e,r,n){var i=this,a=i.findById(e);if(!!a)if((0,_.each)(a.get("children"),function(s){i.innerRemoveChild(s.getModel().id,r,n)}),n){var o=a.getModel();a.set("to",r),a.set("originAttrs",{x:o.x,y:o.y}),i.get("removeList").push(a)}else i.removeItem(a,!1)},t.prototype.changeData=function(e){var r=this;this.getNodes().map(function(n){return r.clearItemStates(n)}),this.getEdges().map(function(n){return r.clearItemStates(n)}),e?(r.data(e),r.render()):r.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){var r=this;if(!e){console.warn("layout cannot be null");return}r.set("layout",e),r.set("layoutMethod",r.getLayout()),r.layout()},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=r.get("data"),i=r.get("layoutMethod"),a=i?i(n,r.get("layout")):n,o=r.get("animate");if(r.emit("beforerefreshlayout",{data:n,layoutData:a}),r.emit("beforelayout"),r.innerUpdateChild(a,void 0,o),e){var s=r.get("viewController");s.fitView()}o?r.layoutAnimate(a):(r.refresh(),r.paint()),r.emit("afterrefreshlayout",{data:n,layoutData:a}),r.emit("afterlayout")},t.prototype.addChild=function(e,r){var n=this;n.emit("beforeaddchild",{model:e,parent:r}),(0,_.isString)(r)||(r=r.get("id"));var i=n.findDataById(r);i&&(i.children||(i.children=[]),i.children.push(e),n.changeData())},t.prototype.updateChildren=function(e,r){var n=this;if(!r||!n.findById(r)){console.warn("Update children failed! There is no node with id '".concat(r,"'"));return}var i=n.findDataById(r);i.children=e,n.changeData()},t.prototype.updateChild=function(e,r){var n=this;if(!r||!n.findById(r)){n.changeData(e);return}var i=n.findDataById(r),a=n.findById(e.id);if(i.children||(i.children=[]),!a)i.children.push(e);else{var o=t.indexOfChild(i.children,e.id);i.children[o]=e}n.changeData()},t.prototype.removeChild=function(e){var r=this,n=r.findById(e);if(!!n){var i=n.get("parent");if(i&&!i.destroyed){var a=r.findDataById(i.get("id")),o=a&&a.children||[],s=n.getModel(),d=t.indexOfChild(o,s.id);o.splice(d,1)}r.changeData()}},t.prototype.findDataById=function(e,r){var n=this;if(r||(r=n.get("data")),e===r.id)return r;var i=null;return(0,_.each)(r.children||[],function(a){if(a.id===e)return i=a,!1;if(i=n.findDataById(e,a),i)return!1}),i},t.prototype.layoutAnimate=function(e,r){var n=this,i=this.get("animateCfg");n.emit("beforeanimate",{data:e}),n.getEdges().forEach(function(a){var o=a.get("model");o.sourceAnchor||(o.sourceAnchor=a.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(a){Ul(e,function(o){var s=n.findById(o.id);if(s){var d=s.get("originAttrs"),y=s.get("model");if(d||(d={x:y.x,y:y.y},s.set("originAttrs",d)),r){var C=r(s,a,d,e);s.set("model",Object.assign(y,C))}else y.x=d.x+(o.x-d.x)*a,y.y=d.y+(o.y-d.y)*a}return!0}),(0,_.each)(n.get("removeList"),function(o){var s=o.getModel(),d=o.get("originAttrs"),y=o.get("to");s.x=d.x+(y.x-d.x)*a,s.y=d.y+(y.y-d.y)*a}),n.refreshPositions()},{duration:i.duration,easing:i.ease,callback:function(){(0,_.each)(n.getNodes(),function(o){o.set("originAttrs",null)}),(0,_.each)(n.get("removeList"),function(o){n.removeItem(o)}),n.set("removeList",[]),i.callback&&i.callback(),n.emit("afteranimate",{data:e})},delay:i.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(){var e=this,r=e.get("data");if(!r||!(0,_.isObject)(r)||!Object.keys(r).length)throw new Error("data must be defined first");e.clear(),e.emit("beforerender"),e.layout(this.get("fitView")),e.emit("afterrender")},t.prototype.save=function(){return this.get("data")},t}(Xu),mu=Sc,Qn=M(45442),af=function(){function h(t){this._cfgs=(0,_.deepMix)(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return h.prototype.getDefaultCfgs=function(){return{}},h.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var r=e.getEvents(),n={};(0,_.each)(r,function(i,a){var o=(0,_.wrapBehavior)(e,i);n[a]=o,t.on(a,o)}),this._events=n,this.init()},h.prototype.getEvents=function(){return{}},h.prototype.get=function(t){var e;return(e=this._cfgs)===null||e===void 0?void 0:e[t]},h.prototype.set=function(t,e){this._cfgs[t]=e},h.prototype.destroy=function(){},h.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;(0,_.each)(e,function(r,n){t.off(n,r)}),this._events=null,this._cfgs=null,this.destroyed=!0},h}(),fo=af,cd=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),zl="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",$s=function(h){cd(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{img:zl,follow:!0}},t.prototype.init=function(){var e=this.get("graph"),r=e.get("container"),n=e.get("canvas").get("el"),i=this.get("img")||zl;i.includes("url(")||(i='url("'.concat(i,'")'));var a=(0,Di.Z)(`<div class='g6-grid-container' style="position:absolute;overflow:hidden;z-index: -1;"></div>`),o=(0,Di.Z)(`<div
  18. class='g6-grid'
  19. style='position:absolute;
  20. background-image: `.concat(i,`;
  21. user-select: none
  22. '></div>`));this.set("container",a),this.set("gridContainer",o),this.positionInit(),a.appendChild(o),r.insertBefore(a,n)},t.prototype.positionInit=function(){var e=this.get("graph"),r=e.get("minZoom"),n=e.get("width"),i=e.get("height");(0,Qn.Z)(this.get("container"),{width:"".concat(n,"px"),height:"".concat(i,"px")});var a=n*80/r,o=i*80/r;(0,Qn.Z)(this.get("gridContainer"),{width:"".concat(a,"px"),height:"".concat(o,"px"),left:"-".concat(a/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 i=this.get("follow"),a="matrix(".concat(n[0],", ").concat(n[1],", ").concat(n[3],", ").concat(n[4],", ").concat(i?n[6]:"0",", ").concat(i?n[7]:"0",")");(0,Qn.Z)(r,{transform:a})},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}(fo),Wl=$s,jl=M(38186),Yu=M.n(jl),fd=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();typeof document!="undefined"&&Yu()(`
  23. .g6-component-contextmenu {
  24. border: 1px solid #e2e2e2;
  25. border-radius: 4px;
  26. font-size: 12px;
  27. color: #545454;
  28. background-color: rgba(255, 255, 255, 0.9);
  29. padding: 10px 8px;
  30. box-shadow: rgb(174, 174, 174) 0px 0px 10px;
  31. }
  32. .g6-contextmenu-ul {
  33. padding: 0;
  34. margin: 0;
  35. list-style: none;
  36. }
  37. `);var Vl=function(h){fd(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(r){return`
  38. <ul class='g6-contextmenu-ul'>
  39. <li>\u83DC\u5355\u98791</li>
  40. <li>\u83DC\u5355\u98792</li>
  41. </ul>
  42. `},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,Di.Z)("<div class=".concat(e||"g6-component-contextmenu","></div>"));(0,Qn.Z)(r,{top:"0px",position:"absolute",visibility:"hidden"});var n=this.get("container");n||(n=this.get("graph").get("container")),(0,_.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 i=this.get("shouldBegin");if(!!i(e)){var a=this.get("menu"),o=this.get("getContent"),s=this.get("graph"),d=o(e,s);(0,_.isString)(d)?a.innerHTML=d:a.innerHTML=d.outerHTML,this.removeMenuEventListener();var y=this.get("handleMenuClick");if(y){var C=function(mt){y(mt.target,e.item,s)};this.set("handleMenuClickWrapper",C),a.addEventListener("click",C)}var F=s.get("width"),G=s.get("height"),H=a.getBoundingClientRect(),ie=this.get("offsetX")||0,se=this.get("offsetY")||0,ce=s.getContainer().offsetTop,de=s.getContainer().offsetLeft,xe=e.canvasX+de+ie,Ie=e.canvasY+ce+se;xe+H.width>F&&(xe=e.canvasX-H.width-ie+de),Ie+H.height>G&&(Ie=e.canvasY-H.height-se+ce),(0,Qn.Z)(a,{top:"".concat(Ie,"px"),left:"".concat(xe,"px"),visibility:"visible"});var qe=this.get("trigger")==="click",ze=function(mt){if(qe){qe=!1;return}r.onMenuHide()};document.body.addEventListener("click",ze),this.set("handler",ze)}},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,Qn.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,_.isString)(r)&&(r=document.getElementById(r)),r.removeChild(e)}},t}(fo),ld=Vl,Ua=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),of=function(){return of=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},of.apply(this,arguments)},bu=Math.max,Qs=ee.vs,Xl="default",Qf="keyShape",sf="delegate",Jf="svg",ro=function(h){Ua(t,h);function t(e){var r=h.call(this,e)||this;return r.handleUpdateCanvas=(0,_.debounce)(function(n){var i=r;i.destroyed||i.updateCanvas()},100,!1),r}return t.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",type:"default",padding:50,size:[200,120],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.size,i=r.graph;if(!this.destroyed){var a=this.get("canvas"),o=a.get("container"),s=(0,Di.Z)(`
  43. <div
  44. class=`.concat(r.viewportClassName,`
  45. style='position:absolute;
  46. left:0;
  47. top:0;
  48. box-sizing:border-box;
  49. outline: 2px solid #1980ff;
  50. cursor:move'
  51. draggable=true
  52. </div>`)),d=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,y=0,C=0,F=!1,G=0,H=0,ie=0,se=0,ce=0,de=0;s.addEventListener("dragstart",function(xe){var Ie,qe;if(xe.dataTransfer){var ze=new Image;ze.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",(qe=(Ie=xe.dataTransfer).setDragImage)===null||qe===void 0||qe.call(Ie,ze,0,0);try{xe.dataTransfer.setData("text/html","view-port-minimap")}catch(mt){xe.dataTransfer.setData("text","view-port-minimap")}}if(r.refresh=!1,xe.target===s){var $e=s.style;G=parseInt($e.left,10),H=parseInt($e.top,10),ie=parseInt($e.width,10),se=parseInt($e.height,10),!(ie>n[0]||se>n[1])&&(de=i.getZoom(),ce=e.get("ratio"),F=!0,y=xe.clientX,C=xe.clientY)}},!1),s.addEventListener(d?"dragover":"drag",function(xe){if(!(!F||(0,_.isNil)(xe.clientX)||(0,_.isNil)(xe.clientY))){var Ie=y-xe.clientX,qe=C-xe.clientY;(G-Ie<0||G-Ie+ie>=n[0])&&(Ie=0),(H-qe<0||H-qe+se>=n[1])&&(qe=0),G-=Ie,H-=qe,(0,Qn.Z)(s,{left:"".concat(G,"px"),top:"".concat(H,"px")}),i.translate(Ie*de/ce,qe*de/ce),y=xe.clientX,C=xe.clientY}},!1),s.addEventListener("dragend",function(){F=!1,r.refresh=!0},!1),this.set("viewport",s),o.appendChild(s)}},t.prototype.updateViewport=function(){if(!this.destroyed){var e=this.get("ratio"),r=this.get("dx"),n=this.get("dy"),i=this.get("totaldx"),a=this.get("totaldy"),o=this.get("graph"),s=this.get("size"),d=o.get("width"),y=o.get("height"),C=o.getPointByCanvas(0,0),F=o.getPointByCanvas(d,y),G=this.get("viewport");G||this.initViewport();var H=(F.x-C.x)*e,ie=(F.y-C.y)*e,se=C.x*e+i,ce=C.y*e+a,de=se+H,xe=ce+ie;se<0&&(H+=se,se=0),de>s[0]&&(H=H-(de-s[0])),ce<0&&(ie+=ce,ce=0),xe>s[1]&&(ie=ie-(xe-s[1])),this.set("ratio",e);var Ie="".concat(se,"px"),qe="".concat(ce,"px");(0,Qn.Z)(G,{left:Ie,top:qe,width:"".concat(H,"px"),height:"".concat(ie,"px")})}},t.prototype.updateGraphShapes=function(){var e=this._cfgs.graph,r=this.get("canvas"),n=e.get("group");if(!n.destroyed){var i=n.clone();i.resetMatrix(),r.clear(),r.add(i);var a=e.get("renderer");a===Jf&&this.updateVisible(i)}},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(i){i.get("visible")||i.hide(),r.updateVisible(i)})}},t.prototype.updateKeyShapes=function(){var e=this,r=this._cfgs.graph,n=this.get("canvas"),i=n.get("children")[0]||n.addGroup();(0,_.each)(r.getEdges(),function(s){e.updateOneEdgeKeyShape(s,i)}),(0,_.each)(r.getNodes(),function(s){e.updateOneNodeKeyShape(s,i)});var a=r.getCombos();if(a&&a.length){var o=i.find(function(s){return s.get("name")==="comboGroup"})||i.addGroup({name:"comboGroup"});setTimeout(function(){e.destroyed||((0,_.each)(a,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")||{},i=n[e.get("id")],a=e.getBBox(),o=e.get("keyShape").clone(),s=o.attr(),d={x:a.centerX,y:a.centerY};i?d=Object.assign(s,d):(i=o,r.add(i));var y=i.get("type");(y==="rect"||y==="image")&&(d.x=a.minX,d.y=a.minY),i.attr(d),e.isVisible()?i.show():i.hide(),i.exist=!0;var C=e.getModel().depth;isNaN(C)||i.set("zIndex",C),n[e.get("id")]=i,this.set("itemMap",n)}},t.prototype.updateOneNodeKeyShape=function(e,r){var n=this.get("itemMap")||{},i=n[e.get("id")],a=e.getBBox(),o=e.get("keyShape").clone(),s=o.attr(),d={x:a.centerX,y:a.centerY};i?d=Object.assign(s,d):(i=o,r.add(i));var y=i.get("type");(y==="rect"||y==="image")&&(d.x=a.minX,d.y=a.minY),i.attr(d),e.isVisible()?i.show():i.hide(),i.exist=!0;var C=e.getModel().depth;isNaN(C)||i.set("zIndex",C),n[e.get("id")]=i,this.set("itemMap",n)},t.prototype.updateDelegateShapes=function(){var e=this,r=this._cfgs.graph,n=this.get("canvas"),i=n.get("children")[0]||n.addGroup();(0,_.each)(r.getEdges(),function(s){e.updateOneEdgeKeyShape(s,i)}),(0,_.each)(r.getNodes(),function(s){e.updateOneNodeDelegateShape(s,i)});var a=r.getCombos();if(a&&a.length){var o=i.find(function(s){return s.get("name")==="comboGroup"})||i.addGroup({name:"comboGroup"});setTimeout(function(){e.destroyed||((0,_.each)(a,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 i=e[r[n]],a=i.exist;i.exist=!1,a||(i.remove(),delete e[r[n]])}},t.prototype.updateOneEdgeKeyShape=function(e,r){var n=this.get("itemMap")||{},i=n[e.get("id")];if(i){var a=e.get("keyShape").attr("path");i.attr("path",a)}else i=e.get("keyShape").clone(),r.add(i);e.isVisible()?i.show():i.hide(),i.exist=!0,n[e.get("id")]=i,this.set("itemMap",n)},t.prototype.updateOneNodeDelegateShape=function(e,r){var n=this.get("delegateStyle"),i=this.get("itemMap")||{},a=i[e.get("id")],o=e.getBBox();if(a){var s={x:o.minX,y:o.minY,width:o.width,height:o.height};a.attr(s)}else a=r.addShape("rect",{attrs:of({x:o.minX,y:o.minY,width:o.width,height:o.height},n),name:"minimap-node-shape"});e.isVisible()?a.show():a.hide(),a.exist=!0,i[e.get("id")]=a,this.set("itemMap",i)},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"),i=e.get("className"),a=e.get("container"),o=(0,Di.Z)("<div class='".concat(i,"' style='width: ").concat(n[0],"px; height: ").concat(n[1],"px; overflow: hidden'></div>"));(0,_.isString)(a)&&(a=document.getElementById(a)),a?a.appendChild(o):r.get("container").appendChild(o),e.set("container",o);var s=(0,Di.Z)('<div class="g6-minimap-container" style="position: relative;"></div>');o.appendChild(s),s.addEventListener("dragenter",function(C){C.preventDefault()}),s.addEventListener("dragover",function(C){C.preventDefault()});var d,y=r.get("renderer");y===Jf?d=new ls.Canvas({container:s,width:n[0],height:n[1]}):d=new fs.Canvas({container:s,width:n[0],height:n[1]}),e.set("canvas",d),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"),i=this.get("canvas"),a=this.get("type"),o=this.get("padding");if(!i.destroyed){switch(a){case Xl:this.updateGraphShapes();break;case Qf:this.updateKeyShapes();break;case sf:this.updateDelegateShapes();break;default:break}var s=i.get("children")[0];if(!!s){s.resetMatrix();var d=s.getCanvasBBox(),y=r.get("canvas").getCanvasBBox(),C=r.getZoom()||1,F=y.width/C,G=y.height/C;Number.isFinite(d.width)&&(F=bu(d.width,F),G=bu(d.height,G)),F+=2*o,G+=2*o;var H=Math.min(n[0]/F,n[1]/G),ie=[1,0,0,0,1,0,0,0,1],se=0,ce=0;Number.isFinite(d.minX)&&(se=-d.minX),Number.isFinite(d.minY)&&(ce=-d.minY);var de=(n[0]-(F-2*o)*H)/2,xe=(n[1]-(G-2*o)*H)/2;ie=Qs(ie,[["t",se,ce],["s",H,H],["t",de,xe]]),s.setMatrix(ie),this.set("ratio",H),this.set("totaldx",de+se*H),this.set("totaldy",xe+ce*H),this.set("dx",de),this.set("dy",xe),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}(fo),Js=ro,oi=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();function Ji(h,t,e){var r=h.x-t.x,n=h.y-t.y;return!e||Math.abs(r)>e||Math.abs(n)>e?Math.sqrt(r*r+n*n):e}function uf(h,t){return h.x*t.x+h.y*t.y}function Yl(h,t){var e=(t.source.y-t.target.y)/(t.source.x-t.target.x),r=(e*e*t.source.x+e*(h.y-t.source.y)+h.x)/(e*e+1),n=e*(r-t.source.x)+t.source.y;return{x:r,y:n}}var Zl=function(h){oi(t,h);function t(e){return h.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||[],i=e.nodes||[],a={},o=!1;if(i.forEach(function(Ie){(Ie.x===null||!Ie.y===null||Ie.x===void 0||!Ie.y===void 0)&&(o=!0),a[Ie.id]=Ie}),o)throw new Error("please layout the graph or assign x and y for nodes first");r.set("nodeIdMap",a);var s=r.get("divisions"),d=r.get("divRate"),y=r.divideEdges(s);r.set("edgePoints",y);var C=r.getEdgeBundles();r.set("edgeBundles",C);for(var F=r.get("cycles"),G=r.get("iterations"),H=r.get("iterRate"),ie=r.get("lambda"),se=0;se<F;se++){for(var ce=function(qe){var ze=[];n.forEach(function($e,mt){if($e.source!==$e.target){var xt=a[$e.source],wt=a[$e.target];ze[mt]=r.getEdgeForces({source:xt,target:wt},mt,s,ie);for(var Yt=0;Yt<s+1;Yt++)y[mt][Yt].x+=ze[mt][Yt].x,y[mt][Yt].y+=ze[mt][Yt].y}})},de=0;de<G;de++)ce(de);ie=ie/2,s*=d,G*=H,y=r.divideEdges(s),r.set("edgePoints",y)}n.forEach(function(Ie,qe){Ie.source!==Ie.target&&(Ie.type="polyline",Ie.controlPoints=y[qe].slice(1,y[qe].length-1))});var xe=r.get("graph");xe.refresh()}},t.prototype.updateBundling=function(e){var r=this,n=e.data;if(n&&r.set("data",n),r.get("ticking")&&r.set("ticking",!1),Object.keys(e).forEach(function(a){r.set(a,e[a])}),e.onTick){var i=this.get("graph");r.set("tick",function(){e.onTick(),i.refresh()})}r.bundling(n)},t.prototype.divideEdges=function(e){var r=this,n=r.get("data").edges,i=r.get("nodeIdMap"),a=r.get("edgePoints");return(!a||a===void 0)&&(a=[]),n.forEach(function(o,s){var d;(!a[s]||a[s]===void 0)&&(a[s]=[]);var y=i[o.source],C=i[o.target];if(e===1)a[s].push({x:y.x,y:y.y}),a[s].push({x:.5*(y.x+C.x),y:.5*(y.y+C.y)}),a[s].push({x:C.x,y:C.y});else{var F=0;((d=a[s])===null||d===void 0?void 0:d.length)?F=r.getEdgeLength(a[s]):F=Ji({x:y.x,y:y.y},{x:C.x,y:C.y});var G=F/(e+1),H=G,ie=[{x:y.x,y:y.y}];a[s].forEach(function(se,ce){if(ce!==0){for(var de=Ji(se,a[s][ce-1]);de>H;){var xe=H/de,Ie={x:a[s][ce-1].x,y:a[s][ce-1].y};Ie.x+=xe*(se.x-a[s][ce-1].x),Ie.y+=xe*(se.y-a[s][ce-1].y),ie.push(Ie),de-=H,H=G}H-=de}}),ie.push({x:C.x,y:C.y}),a[s]=ie}}),a},t.prototype.getEdgeLength=function(e){var r=0;return e.forEach(function(n,i){i!==0&&(r+=Ji(n,e[i-1]))}),r},t.prototype.getEdgeBundles=function(){var e=this,r=e.get("data"),n=r.edges||[],i=e.get("bundleThreshold"),a=e.get("nodeIdMap"),o=e.get("edgeBundles");return o||(o=[]),n.forEach(function(s,d){(!o[d]||o[d]===void 0)&&(o[d]=[])}),n.forEach(function(s,d){var y=a[s.source],C=a[s.target];n.forEach(function(F,G){if(!(G<=d)){var H=a[F.source],ie=a[F.target],se=e.getBundleScore({source:y,target:C},{source:H,target:ie});se>=i&&(o[d].push(G),o[G].push(d))}})}),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=Ji({x:e.source.x,y:e.source.y},{x:e.target.x,y:e.target.y}),r.length=Ji({x:r.source.x,y:r.source.y},{x:r.target.x,y:r.target.y});var i=n.getAngleScore(e,r),a=n.getScaleScore(e,r),o=n.getPositionScore(e,r),s=n.getVisibilityScore(e,r);return i*a*o*s},t.prototype.getAngleScore=function(e,r){var n=uf({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,i=2/(n/Math.min(e.length,r.length)+Math.max(e.length,r.length)/n);return i},t.prototype.getPositionScore=function(e,r){var n=(e.length+r.length)/2,i={x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2},a={x:(r.source.x+r.target.x)/2,y:(r.source.y+r.target.y)/2},o=Ji(i,a);return n/(n+o)},t.prototype.getVisibilityScore=function(e,r){var n=this.getEdgeVisibility(e,r),i=this.getEdgeVisibility(r,e);return n<i?n:i},t.prototype.getEdgeVisibility=function(e,r){var n=Yl(r.source,e),i=Yl(r.target,e),a={x:(n.x+i.x)/2,y:(n.y+i.y)/2},o={x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2};return Math.max(0,1-2*Ji(a,o)/Ji(n,i))},t.prototype.getEdgeForces=function(e,r,n,i){for(var a=this,o=a.get("edgePoints"),s=a.get("K"),d=s/(Ji(e.source,e.target)*(n+1)),y=[{x:0,y:0}],C=1;C<n;C++){var F={x:0,y:0},G=a.getSpringForce({pre:o[r][C-1],cur:o[r][C],next:o[r][C+1]},d),H=a.getElectrostaticForce(C,r);F.x=i*(G.x+H.x),F.y=i*(G.y+H.y),y.push(F)}return y.push({x:0,y:0}),y},t.prototype.getSpringForce=function(e,r){var n=e.pre.x+e.next.x-2*e.cur.x,i=e.pre.y+e.next.y-2*e.cur.y;return n*=r,i*=r,{x:n,y:i}},t.prototype.getElectrostaticForce=function(e,r){var n=this,i=n.get("eps"),a=n.get("edgeBundles"),o=n.get("edgePoints"),s=a[r],d={x:0,y:0};return s.forEach(function(y){var C={x:o[y][e].x-o[r][e].x,y:o[y][e].y-o[r][e].y};if(Math.abs(C.x)>i||Math.abs(C.y)>i){var F=Ji(o[y][e],o[r][e]),G=1/F;d.x+=C.x*G,d.y+=C.y*G}}),d},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(),h.prototype.destroy.call(this)},t}(fo),dd=Zl,hd=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Zu=function(){return Zu=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},Zu.apply(this,arguments)},wc=.05,qf={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:.1,fill:"#ccc"},vd=function(h){hd(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{trigger:"mousemove",d:1.5,r:300,delegateStyle:(0,_.clone)(qf),showLabel:!1,maxD:5,minD:0,scaleRBy:"unset",scaleDBy:"unset",showDPercent:!0}},t.prototype.getEvents=function(){var e;switch(this.get("trigger")){case"click":e={click:"magnify"};break;case"drag":e={click:"createDelegate"};break;default:e={mousemove:"magnify"};break}return e},t.prototype.init=function(){var e=this,r=e.get("r");e.set("cachedMagnifiedModels",[]),e.set("cachedOriginPositions",{}),e.set("r2",r*r);var n=e.get("d");e.set("molecularParam",(n+1)*r)},t.prototype.createDelegate=function(e){var r=this,n=this,i=n.get("delegate");(!i||i.destroyed)&&(n.magnify(e),i=n.get("delegate"),i.on("dragstart",function(a){n.set("delegateCenterDiff",{x:i.attr("x")-a.x,y:i.attr("y")-a.y})}),i.on("drag",function(a){n.magnify(a)}),this.get("scaleDBy")==="wheel"&&i.on("mousewheel",function(a){r.scaleDByWheel(a)}),this.get("scaleRBy")==="wheel"&&i.on("mousewheel",function(a){n.scaleRByWheel(a)}))},t.prototype.scaleRByWheel=function(e){var r=this;if(!(!e||!e.originalEvent)){e.preventDefault&&e.preventDefault();var n=r.get("graph"),i,a=r.get("delegate"),o=a?{x:a.attr("x"),y:a.attr("y")}:void 0,s=o||n.getPointByClient(e.clientX,e.clientY);e.originalEvent.wheelDelta<0?i=1-wc:i=1/(1-wc);var d=r.get("maxR"),y=r.get("minR"),C=r.get("r");(C>(d||n.get("height"))&&i>1||C<(y||n.get("height")*.05)&&i<1)&&(i=1),C*=i,r.set("r",C),r.set("r2",C*C);var F=r.get("d");r.set("molecularParam",(F+1)*C),r.set("delegateCenterDiff",void 0),r.magnify(e,s)}},t.prototype.scaleRByDrag=function(e){var r=this;if(!!e){var n=r.get("dragPrePos"),i=r.get("graph"),a,o=i.getPointByClient(e.clientX,e.clientY);e.x-n.x<0?a=1-wc:a=1/(1-wc);var s=r.get("maxR"),d=r.get("minR"),y=r.get("r");(y>(s||i.get("height"))&&a>1||y<(d||i.get("height")*.05)&&a<1)&&(a=1),y*=a,r.set("r",y),r.set("r2",y*y);var C=r.get("d");r.set("molecularParam",(C+1)*y),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 i=r.get("d"),a=i+n,o=r.get("maxD"),s=r.get("minD");if(a<o&&a>s){r.set("d",a);var d=r.get("r");r.set("molecularParam",(a+1)*d);var y=r.get("delegate"),C=y?{x:y.attr("x"),y:y.attr("y")}:void 0;r.set("delegateCenterDiff",void 0),r.magnify(e,C)}}},t.prototype.scaleDByDrag=function(e){var r=this,n=r.get("dragPrePos"),i=e.x-n.x>0?.1:-.1,a=r.get("d"),o=a+i,s=r.get("maxD"),d=r.get("minD");if(o<s&&o>d){r.set("d",o);var y=r.get("r");r.set("molecularParam",(o+1)*y),r.magnify(e)}r.set("dragPrePos",{x:e.x,y:e.y})},t.prototype.magnify=function(e,r){var n=this;n.restoreCache();var i=n.get("graph"),a=n.get("cachedMagnifiedModels"),o=n.get("cachedOriginPositions"),s=n.get("showLabel"),d=n.get("r"),y=n.get("r2"),C=n.get("d"),F=n.get("molecularParam"),G=i.getNodes(),H=G.length,ie=r?{x:r.x,y:r.y}:{x:e.x,y:e.y};n.get("dragging")&&(n.get("trigger")==="mousemove"||n.get("trigger")==="click")&&(ie=n.get("cacheCenter"));var se=n.get("delegateCenterDiff");se&&(ie.x+=se.x,ie.y+=se.y),n.updateDelegate(ie,d);for(var ce=0;ce<H;ce++){var de=G[ce].getModel(),xe=de.x,Ie=de.y;if(!(isNaN(xe)||isNaN(Ie))){var qe=(xe-ie.x)*(xe-ie.x)+(Ie-ie.y)*(Ie-ie.y);if(!isNaN(qe)&&qe<y&&qe!==0){var ze=Math.sqrt(qe),$e=F*ze/(C*ze+d),mt=(xe-ie.x)/ze,xt=(Ie-ie.y)/ze;if(de.x=mt*$e+ie.x,de.y=xt*$e+ie.y,o[de.id]||(o[de.id]={x:xe,y:Ie,texts:[]}),a.push(de),s&&2*ze<d)for(var wt=G[ce],Yt=wt.getContainer(),Zt=Yt.getChildren(),Er=Zt.length,Fr=0;Fr<Er;Fr++){var Ur=Zt[Fr];Ur.get("type")==="text"&&(o[de.id].texts.push({visible:Ur.get("visible"),shape:Ur}),Ur.set("visible",!0))}}}}i.refreshPositions()},t.prototype.restoreCache=function(){for(var e=this,r=e.get("cachedMagnifiedModels"),n=e.get("cachedOriginPositions"),i=r.length,a=0;a<i;a++){var o=r[a],s=o.id,d=n[s];o.x=d.x,o.y=d.y;for(var y=d.texts.length,C=0;C<y;C++){var F=d.texts[C];F.shape.set("visible",F.visible)}}e.set("cachedMagnifiedModels",[]),e.set("cachedOriginPositions",{})},t.prototype.updateParams=function(e){var r=this,n=e.r,i=e.d,a=e.trigger,o=e.minD,s=e.maxD,d=e.minR,y=e.maxR,C=e.scaleDBy,F=e.scaleRBy;isNaN(e.r)||(r.set("r",n),r.set("r2",n*n)),isNaN(i)||r.set("d",i),isNaN(s)||r.set("maxD",s),isNaN(o)||r.set("minD",o),isNaN(y)||r.set("maxR",y),isNaN(d)||r.set("minR",d);var G=r.get("d"),H=r.get("r");if(r.set("molecularParam",(G+1)*H),(a==="mousemove"||a==="click"||a==="drag")&&r.set("trigger",a),C==="drag"||C==="wheel"||C==="unset"){r.set("scaleDBy",C),r.get("delegate").remove(),r.get("delegate").destroy();var ie=r.get("dPercentText");ie&&(ie.remove(),ie.destroy())}if(F==="drag"||F==="wheel"||F==="unset"){r.set("scaleRBy",F),r.get("delegate").remove(),r.get("delegate").destroy();var ie=r.get("dPercentText");ie&&(ie.remove(),ie.destroy())}},t.prototype.updateDelegate=function(e,r){var n=this,i=this,a=i.get("graph"),o=i.get("delegate");if(!o||o.destroyed){var s=a.get("group"),d=i.get("delegateStyle")||qf;o=s.addShape("circle",{attrs:Zu({r:r/1.5,x:e.x,y:e.y},d),name:"lens-shape",draggable:!0}),this.get("trigger")!=="drag"&&(this.get("scaleRBy")==="wheel"?o.on("mousewheel",function(H){i.scaleRByWheel(H)}):this.get("scaleRBy")==="drag"&&(o.on("dragstart",function(H){i.set("dragging",!0),i.set("cacheCenter",{x:H.x,y:H.y}),i.set("dragPrePos",{x:H.x,y:H.y})}),o.on("drag",function(H){i.scaleRByDrag(H)}),o.on("dragend",function(H){i.set("dragging",!1)})),this.get("scaleDBy")==="wheel"?o.on("mousewheel",function(H){n.scaleDByWheel(H)}):this.get("scaleDBy")==="drag"&&(o.on("dragstart",function(H){i.set("dragging",!0),i.set("cacheCenter",{x:H.x,y:H.y}),i.set("dragPrePos",{x:H.x,y:H.y})}),o.on("drag",function(H){n.scaleDByDrag(H)}),o.on("dragend",function(H){i.set("dragging",!1)})))}else o.attr({x:e.x,y:e.y,r:r/1.5});if(i.get("showDPercent")){var y=Math.round((i.get("d")-i.get("minD"))/(i.get("maxD")-i.get("minD"))*100),C=i.get("dPercentText"),F=e.y+r/1.5+16;if(!C||C.destroyed){var G=a.get("group");C=G.addShape("text",{attrs:{text:"".concat(y,"%"),x:e.x,y:F,fill:"#aaa",stroke:"#fff",lineWidth:1,fontSize:12}}),i.set("dPercentText",C)}else C.attr({text:"".concat(y,"%"),x:e.x,y:F})}i.set("delegate",o)},t.prototype.clear=function(){var e=this.get("graph");this.restoreCache(),e.refreshPositions();var r=this.get("delegate");r&&!r.destroyed&&(r.remove(),r.destroy());var n=this.get("dPercentText");n&&!n.destroyed&&(n.remove(),n.destroy())},t.prototype.destroy=function(){this.clear()},t}(fo),Hl=vd,Mc=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),cf=.05;typeof document!="undefined"&&Yu()(`
  53. .g6-component-toolbar {
  54. position: absolute;
  55. list-style-type: none;
  56. padding: 6px;
  57. left: 0px;
  58. top: 0px;
  59. background-color: rgba(255, 255, 255, 0.9);
  60. border: 1px solid #e2e2e2;
  61. border-radius: 4px;
  62. font-size: 12px;
  63. color: #545454;
  64. margin: 0;
  65. }
  66. .g6-component-toolbar li {
  67. float: left;
  68. text-align: center;
  69. width: 35px;
  70. height: 24px;
  71. cursor: pointer;
  72. list-style-type:none;
  73. list-style: none;
  74. margin-left: 0px;
  75. }
  76. .g6-component-toolbar li .icon {
  77. opacity: 0.7;
  78. }
  79. .g6-component-toolbar li .icon:hover {
  80. opacity: 1;
  81. }
  82. `);var ff=function(t){if(!t)return[];if(t.composedPath)return t.composedPath();for(var e=[],r=t.target;r;){if(e.push(r),r.tagName==="HTML")return e.push(document,window),e;r=r.parentElement}return e},Kl=function(h){Mc(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{handleClick:void 0,getContent:function(r){return`
  83. <ul class='g6-component-toolbar'>
  84. <li code='redo'>
  85. <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
  86. <path d="M256 682.666667c0-102.741333 66.730667-213.333333 213.333333-213.333334 107.008 0 190.762667 56.576 230.570667 125.354667L611.968 682.666667H853.333333v-241.365334l-91.562666 91.562667C704.768 448.469333 601.130667 384 469.333333 384c-196.096 0-298.666667 150.229333-298.666666 298.666667h85.333333z" fill="" p-id="2041"></path>
  87. </svg>
  88. </li>
  89. <li code='undo'>
  90. <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
  91. <path d="M170.666667 682.666667h241.365333l-87.936-87.978667C363.904 525.909333 447.658667 469.333333 554.666667 469.333333c146.602667 0 213.333333 110.592 213.333333 213.333334h85.333333c0-148.437333-102.570667-298.666667-298.666666-298.666667-131.797333 0-235.392 64.469333-292.48 148.821333L170.666667 441.301333V682.666667z" fill="" p-id="2764"></path>
  92. </svg>
  93. </li>
  94. <li code='zoomOut'>
  95. <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
  96. <path d="M658.432 428.736a33.216 33.216 0 0 1-33.152 33.152H525.824v99.456a33.216 33.216 0 0 1-66.304 0V461.888H360.064a33.152 33.152 0 0 1 0-66.304H459.52V296.128a33.152 33.152 0 0 1 66.304 0V395.52H625.28c18.24 0 33.152 14.848 33.152 33.152z m299.776 521.792a43.328 43.328 0 0 1-60.864-6.912l-189.248-220.992a362.368 362.368 0 0 1-215.36 70.848 364.8 364.8 0 1 1 364.8-364.736 363.072 363.072 0 0 1-86.912 235.968l192.384 224.64a43.392 43.392 0 0 1-4.8 61.184z m-465.536-223.36a298.816 298.816 0 0 0 298.432-298.432 298.816 298.816 0 0 0-298.432-298.432A298.816 298.816 0 0 0 194.24 428.8a298.816 298.816 0 0 0 298.432 298.432z"></path>
  97. </svg>
  98. </li>
  99. <li code='zoomIn'>
  100. <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
  101. <path d="M639.936 416a32 32 0 0 1-32 32h-256a32 32 0 0 1 0-64h256a32 32 0 0 1 32 32z m289.28 503.552a41.792 41.792 0 0 1-58.752-6.656l-182.656-213.248A349.76 349.76 0 0 1 480 768 352 352 0 1 1 832 416a350.4 350.4 0 0 1-83.84 227.712l185.664 216.768a41.856 41.856 0 0 1-4.608 59.072zM479.936 704c158.784 0 288-129.216 288-288S638.72 128 479.936 128a288.32 288.32 0 0 0-288 288c0 158.784 129.216 288 288 288z" p-id="3853"></path>
  102. </svg>
  103. </li>
  104. <li code='realZoom'>
  105. <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
  106. <path d="M384 320v384H320V320h64z m256 0v384H576V320h64zM512 576v64H448V576h64z m0-192v64H448V384h64z m355.968 576H92.032A28.16 28.16 0 0 1 64 931.968V28.032C64 12.608 76.608 0 95.168 0h610.368L896 192v739.968a28.16 28.16 0 0 1-28.032 28.032zM704 64v128h128l-128-128z m128 192h-190.464V64H128v832h704V256z"></path>
  107. </svg>
  108. </li>
  109. <li code='autoZoom'>
  110. <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="20" height="24">
  111. <path d="M684.288 305.28l0.128-0.64-0.128-0.64V99.712c0-19.84 15.552-35.904 34.496-35.712a35.072 35.072 0 0 1 34.56 35.776v171.008h170.944c19.648 0 35.84 15.488 35.712 34.432a35.072 35.072 0 0 1-35.84 34.496h-204.16l-0.64-0.128a32.768 32.768 0 0 1-20.864-7.552c-1.344-1.024-2.816-1.664-3.968-2.816-0.384-0.32-0.512-0.768-0.832-1.088a33.472 33.472 0 0 1-9.408-22.848zM305.28 64a35.072 35.072 0 0 0-34.56 35.776v171.008H99.776A35.072 35.072 0 0 0 64 305.216c0 18.944 15.872 34.496 35.84 34.496h204.16l0.64-0.128a32.896 32.896 0 0 0 20.864-7.552c1.344-1.024 2.816-1.664 3.904-2.816 0.384-0.32 0.512-0.768 0.768-1.088a33.024 33.024 0 0 0 9.536-22.848l-0.128-0.64 0.128-0.704V99.712A35.008 35.008 0 0 0 305.216 64z m618.944 620.288h-204.16l-0.64 0.128-0.512-0.128c-7.808 0-14.72 3.2-20.48 7.68-1.28 1.024-2.752 1.664-3.84 2.752-0.384 0.32-0.512 0.768-0.832 1.088a33.664 33.664 0 0 0-9.408 22.912l0.128 0.64-0.128 0.704v204.288c0 19.712 15.552 35.904 34.496 35.712a35.072 35.072 0 0 0 34.56-35.776V753.28h170.944c19.648 0 35.84-15.488 35.712-34.432a35.072 35.072 0 0 0-35.84-34.496z m-593.92 11.52c-0.256-0.32-0.384-0.768-0.768-1.088-1.088-1.088-2.56-1.728-3.84-2.688a33.088 33.088 0 0 0-20.48-7.68l-0.512 0.064-0.64-0.128H99.84a35.072 35.072 0 0 0-35.84 34.496 35.072 35.072 0 0 0 35.712 34.432H270.72v171.008c0 19.84 15.552 35.84 34.56 35.776a35.008 35.008 0 0 0 34.432-35.712V720l-0.128-0.64 0.128-0.704a33.344 33.344 0 0 0-9.472-22.848zM512 374.144a137.92 137.92 0 1 0 0.128 275.84A137.92 137.92 0 0 0 512 374.08z"></path>
  112. </svg>
  113. </li>
  114. </ul>
  115. `},zoomSensitivity:2}},t.prototype.init=function(){var e=this,r=this.get("graph"),n=this.get("getContent"),i=n(r),a=i;(0,_.isString)(i)&&(a=(0,Di.Z)(i));var o=this.get("className");a.setAttribute("class",o||"g6-component-toolbar");var s=this.get("container");s||(s=this.get("graph").get("container")),(0,_.isString)(s)&&(s=document.getElementById(s)),s.appendChild(a),this.set("toolBar",a);var d=this.get("handleClick");a.addEventListener("click",function(C){var F=ff(C).filter(function(H){return H.nodeName==="LI"});if(F.length!==0){var G=F[0].getAttribute("code");!G||(d?d(G,r):e.handleDefaultOperator(G))}});var y=this.get("position");y&&(0,Qn.Z)(a,{top:"".concat(y.y,"px"),left:"".concat(y.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'),i=document.querySelector('.g6-component-toolbar li[code="redo"]'),a=document.querySelector('.g6-component-toolbar li[code="redo"] svg');!r||!n||!i||!a||e.on("stackchange",function(o){var s=o.undoStack,d=o.redoStack,y=s.length,C=d.length;y===1?(r.setAttribute("style","cursor: not-allowed"),n.setAttribute("style","opacity: 0.4")):(r.removeAttribute("style"),n.removeAttribute("style")),C===0?(i.setAttribute("style","cursor: not-allowed"),a.setAttribute("style","opacity: 0.4")):(i.removeAttribute("style"),a.removeAttribute("style"))})},t.prototype.undo=function(){var e=this.get("graph"),r=e.getUndoStack();if(!(!r||r.length===1)){var n=r.pop();if(n){var i=n.action;e.pushStack(i,(0,_.clone)(n.data),"redo");var a=n.data.before;if(i==="add"&&(a=n.data.after),!a)return;switch(i){case"visible":{Object.keys(a).forEach(function(o){var s=a[o];!s||s.forEach(function(d){var y=e.findById(d.id);d.visible?e.showItem(y,!1):e.hideItem(y,!1)})});break}case"render":case"update":Object.keys(a).forEach(function(o){var s=a[o];!s||s.forEach(function(d){var y=e.findById(d.id);delete d.id,e.updateItem(y,d,!1),y.getType()==="combo"&&e.updateCombo(y)})});break;case"changedata":e.changeData(a,!1);break;case"delete":{Object.keys(a).forEach(function(o){var s=a[o];!s||s.forEach(function(d){var y=d.itemType;delete d.itemType,e.addItem(y,d,!1)})});break}case"add":Object.keys(a).forEach(function(o){var s=a[o];!s||s.forEach(function(d){e.removeItem(d.id,!1)})});break;case"updateComboTree":Object.keys(a).forEach(function(o){var s=a[o];!s||s.forEach(function(d){e.updateComboTree(d.id,d.parentId,!1)})});break;case"layout":e.updateLayout(a,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 i=n.action,a=n.data.after;if(e.pushStack(i,(0,_.clone)(n.data)),i==="delete"&&(a=n.data.before),!a)return;switch(i){case"visible":{Object.keys(a).forEach(function(o){var s=a[o];!s||s.forEach(function(d){var y=e.findById(d.id);d.visible?e.showItem(y,!1):e.hideItem(y,!1)})});break}case"render":case"update":Object.keys(a).forEach(function(o){var s=a[o];!s||s.forEach(function(d){var y=e.findById(d.id);delete d.id,e.updateItem(y,d,!1),y.getType()==="combo"&&e.updateCombo(y)})});break;case"changedata":e.changeData(a,!1);break;case"delete":a.edges&&a.edges.forEach(function(o){e.removeItem(o.id,!1)}),a.nodes&&a.nodes.forEach(function(o){e.removeItem(o.id,!1)}),a.combos&&a.combos.forEach(function(o){e.removeItem(o.id,!1)});break;case"add":{Object.keys(a).forEach(function(o){var s=a[o];!s||s.forEach(function(d){var y=d.itemType;delete d.itemType,e.addItem(y,d,!1)})});break}case"updateComboTree":Object.keys(a).forEach(function(o){var s=a[o];!s||s.forEach(function(d){e.updateComboTree(d.id,d.parentId,!1)})});break;case"layout":e.updateLayout(a,void 0,void 0,!1);break;default:}}}},t.prototype.zoomOut=function(){var e=this.get("graph"),r=e.getZoom(),n=1/(1-cf*this.get("zoomSensitivity")),i=this.get("maxZoom")||e.get("maxZoom");n*r>i||e.zoomTo(r*n)},t.prototype.zoomIn=function(){var e=this.get("graph"),r=e.getZoom(),n=1-cf*this.get("zoomSensitivity"),i=this.get("minZoom")||e.get("minZoom");n*r<i||e.zoomTo(r*n)},t.prototype.realZoom=function(){var e=this.get("graph");e.zoomTo(1)},t.prototype.autoZoom=function(){var e=this.get("graph");e.fitView([20,20])},t.prototype.handleDefaultOperator=function(e){switch(e){case"redo":this.redo();break;case"undo":this.undo();break;case"zoomOut":this.zoomOut();break;case"zoomIn":this.zoomIn();break;case"realZoom":this.realZoom();break;case"autoZoom":this.autoZoom();break;default:}},t.prototype.destroy=function(){var e=this.get("toolBar");if(e){var r=this.get("container");r||(r=this.get("graph").get("container")),(0,_.isString)(r)&&(r=document.getElementById(r)),r.removeChild(e)}var n=this.get("handleClick");n&&e.removeEventListener("click",n)},t}(fo),pd=Kl,Hu=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();typeof document!="undefined"&&Yu()(`
  116. .g6-component-tooltip {
  117. border: 1px solid #e2e2e2;
  118. border-radius: 4px;
  119. font-size: 12px;
  120. color: #545454;
  121. background-color: rgba(255, 255, 255, 0.9);
  122. padding: 10px 8px;
  123. box-shadow: rgb(174, 174, 174) 0px 0px 10px;
  124. }
  125. .tooltip-type {
  126. padding: 0;
  127. margin: 0;
  128. }
  129. .tooltip-id {
  130. color: #531dab;
  131. }
  132. `);var lf=function(h){Hu(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,getContent:function(r){return`
  133. <h4 class='tooltip-type'>\u7C7B\u578B\uFF1A`.concat(r.item.getType(),`</h4>
  134. <span class='tooltip-id'>ID\uFF1A`).concat(r.item.getID(),`</span>
  135. `)},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,Di.Z)("<div class='".concat(r,"'></div>")),i=e.get("container");i||(i=e.get("graph").get("container")),(0,_.isString)(i)&&(i=document.getElementById(i)),(0,Qn.Z)(n,{position:"absolute",visibility:"hidden",display:"none"}),i.appendChild(n),e.get("trigger")!=="click"&&(n.addEventListener("mouseenter",function(a){(0,Qn.Z)(n,{visibility:"visible",display:"unset"})}),n.addEventListener("mouseleave",function(a){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,i=this.get("graph");this.currentTarget===n?(this.currentTarget=null,this.hideTooltip(),i.emit("tooltipchange",{item:e.item,action:"hide"})):(this.currentTarget=n,this.showTooltip(e),i.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,i=this.get("graph");this.currentTarget=n,this.showTooltip(e),i.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"),i=this.get("getContent"),a=i(e);(0,_.isString)(a)?n.innerHTML=a:(this.clearContainer(),n.appendChild(a)),this.updatePosition(e)}}},t.prototype.hideTooltip=function(){var e=this.get("tooltip");e&&(0,Qn.Z)(e,{visibility:"hidden",display:"none"})},t.prototype.updatePosition=function(e){var r=this.get("shouldBegin"),n=this.get("tooltip");if(!r(e)){(0,Qn.Z)(n,{visibility:"hidden",display:"none"});return}var i=this.get("graph"),a=i.get("width"),o=i.get("height"),s=this.get("offsetX")||0,d=this.get("offsetY")||0,y=i.getPointByClient(e.clientX,e.clientY),C=this.get("fixToNode"),F=e.item;if(F.getType&&F.getType()==="node"&&C&&(0,_.isArray)(C)&&C.length>=2){var G=F.getBBox();y={x:G.minX+G.width*C[0],y:G.minY+G.height*C[1]}}var H=i.getCanvasByPoint(y.x,y.y),ie=H.x,se=H.y,ce=i.getContainer(),de={x:ie+ce.offsetLeft+s,y:se+ce.offsetTop+d};(0,Qn.Z)(n,{visibility:"visible",display:"unset"});var xe=n.getBoundingClientRect();ie+xe.width+s>a&&(de.x-=xe.width+s),se+xe.height+d>o&&(de.y-=xe.height+d),(0,Qn.Z)(n,{left:"".concat(de.x,"px"),top:"".concat(de.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,_.isString)(r)&&(r=document.getElementById(r)),r.removeChild(e)}},t}(fo),Cc=lf,ge=M(86429),tt=function(h,t,e){if(e||arguments.length===2)for(var r=0,n=t.length,i;r<n;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return h.concat(i||Array.prototype.slice.call(t))};function Et(h){return(0,_.map)(h,function(t,e){var r=e===0?"M":"L",n=t[0],i=t[1];return[r,n,i]})}function gr(h){return Et(h)}function Nr(h){if(h.length<=2)return gr(h);var t=[];(0,_.each)(h,function(a){(0,_.isEqual)(a,t.slice(t.length-2))||t.push(a[0],a[1])});var e=yn.e9(t,!1),r=(0,_.head)(h),n=r[0],i=r[1];return e.unshift(["M",n,i]),e}function pr(h,t,e,r){r===void 0&&(r=!0);var n=new ge.bJ({values:h}),i=new ge.WD({values:(0,_.map)(h,function(o,s){return s})}),a=(0,_.map)(h,function(o,s){return[i.scale(s)*t,e-n.scale(o)*e]});return r?Nr(a):gr(a)}function _r(h,t,e,r){r===void 0&&(r=5);for(var n=new ge.bJ({values:h}),i=new ge.WD({values:(0,_.map)(h,function(F,G){return G})}),a=(0,_.map)(h,function(F,G){return[i.scale(G)*t,e-n.scale(F)*e]}),o=[],s=0;s<a.length;s++){var d=a[s],y={x:d[0],y:d[1],y0:e,size:r},C=Hr(y);o.push.apply(o,C)}return zr(o)}function Wr(h,t){var e=new ge.bJ({values:h}),r=Math.max(0,e.min);return t-e.scale(r)*t}function Zr(h,t,e,r){var n=tt([],h,!0),i=Wr(r,e);return n.push(["L",t,i]),n.push(["L",0,i]),n.push(["Z"]),n}function Hr(h){var t=h.x,e=h.y,r=h.y0,n=h.size,i,a;(0,_.isArray)(e)?(i=e[0],a=e[1]):(i=r,a=e);var o,s;(0,_.isArray)(t)?(o=t[0],s=t[1]):(o=t-n/2,s=t+n/2);var d=[{x:o,y:i},{x:o,y:a}];return d.push({x:s,y:a},{x:s,y:i}),d}function zr(h,t){t===void 0&&(t=!0);var e=[],r=h[0];e.push(["M",r.x,r.y]);for(var n=1,i=h.length;n<i;n++)e.push(["L",h[n].x,h[n].y]);return t&&(e.push(["L",r.x,r.y]),e.push(["z"])),e}var qr=function(){return qr=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},qr.apply(this,arguments)},u={stroke:"#C5C5C5",strokeOpacity:.85},P={fill:"#CACED4",opacity:.85},W=function(){function h(t){var e=t.x,r=e===void 0?0:e,n=t.y,i=n===void 0?0:n,a=t.width,o=a===void 0?200:a,s=t.height,d=s===void 0?26:s,y=t.smooth,C=y===void 0?!0:y,F=t.isArea,G=F===void 0?!1:F,H=t.data,ie=H===void 0?[]:H,se=t.lineStyle,ce=t.areaStyle,de=t.group,xe=t.interval,Ie=xe===void 0?null:xe;this.group=de,this.x=r,this.y=i,this.width=o,this.height=d,this.data=ie,this.smooth=C,this.isArea=G,this.lineStyle=Object.assign({},u,se),this.areaStyle=Object.assign({},P,ce),this.intervalConfig=Ie,this.renderLine()}return h.prototype.renderLine=function(){var t=this,e=t.x,r=t.y,n=t.width,i=t.height,a=t.barWidth,o=t.data,s=t.smooth,d=t.isArea,y=t.lineStyle,C=t.areaStyle,F=this.group.addGroup({name:"trend-group"});if(o){var G=pr(o,n,i,s);if(F.addShape("path",{attrs:qr({path:G},y),name:"trend-line"}),d){var H=Zr(G,n,i,o);F.addShape("path",{attrs:qr({path:H},C),name:"trend-area"})}}this.intervalConfig&&F.addShape("path",{attrs:qr({path:_r(this.intervalConfig.data,n,i,this.intervalConfig.style.barWidth)},this.intervalConfig.style),name:"trend-interval"}),F.move(e,r)},h.prototype.destory=function(){this.group.destroy()},h}(),$=W,oe=function(){return oe=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},oe.apply(this,arguments)},ue={fill:"#1890ff",stroke:"#1890ff",type:"trend",radius:2,opacity:1,cursor:"ew-resize",highLightFill:"#0050b3"},pe={fill:"#fff",stroke:"#1890ff",radius:2,opacity:1,cursor:"ew-resize"},_e=function(){function h(t){var e=t.group,r=t.name,n=t.type,i=t.x,a=i===void 0?0:i,o=t.y,s=o===void 0?0:o,d=t.width,y=d===void 0?2:d,C=t.height,F=C===void 0?24:C,G=t.style,H=G===void 0?{}:G;this.group=e,this.name=r,this.handleType=n,this.x=a,this.y=s,this.width=y,this.height=F,n==="trend"?this.style=oe(oe({},ue),H):n==="simple"&&(this.style=oe(oe({},pe),H)),this.renderHandle()}return h.prototype.setX=function(t){this.setXY(t,void 0)},h.prototype.setY=function(t){this.setXY(void 0,t)},h.prototype.setXY=function(t,e){(0,_.isNumber)(t)&&(this.x=t),(0,_.isNumber)(e)&&(this.y=e),this.updateXY()},h.prototype.renderHandle=function(){var t=this,e=t.width,r=t.height,n=t.style,i=t.name,a=n.fill,o=n.stroke,s=n.radius,d=n.opacity,y=n.cursor;this.handleGroup=this.group.addGroup(),this.handleType==="trend"?(this.verticalLine=this.handleGroup.addShape("rect",{attrs:{x:0,y:0,width:e,height:r,fill:a,stroke:o,radius:s,opacity:d,cursor:y},name:"".concat(i,"-handler")}),this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:e/2,y:0,r:2*e,fill:a,stroke:o,radius:s,opacity:d,cursor:y,lineAppendWidth:12},name:"".concat(i,"-handler")}),this.bottomCircle=this.handleGroup.addShape("circle",{attrs:{x:e/2,y:r,r:2*e,fill:a,stroke:o,radius:s,opacity:d,cursor:y},name:"".concat(i,"-handler")})):this.handleType==="simple"&&(this.topCircle=this.handleGroup.addShape("circle",{attrs:{x:e/2,y:r/2,r:2*e,fill:a,stroke:o,radius:s,opacity:d,cursor:y,lineWidth:2},name:"".concat(i,"-handler")})),this.updateXY(),this.handleType==="trend"?this.bindTrendEvents():this.handleType==="simple"&&this.bindSimpleEvents()},h.prototype.bindSimpleEvents=function(){var t=this,e=this.name;this.handleGroup.on("".concat(e,"-handler:mouseenter"),function(){var r=t.style.highLightFill;t.topCircle.attr("fill",r)}),this.handleGroup.on("".concat(e,"-handler:mouseleave"),function(){var r=t.style.fill;t.topCircle.attr("fill",r)})},h.prototype.bindTrendEvents=function(){var t=this,e=this.name;this.handleGroup.on("".concat(e,"-handler:mouseenter"),function(){var r=t.style.highLightFill;t.verticalLine.attr("fill",r),t.topCircle.attr("fill",r),t.bottomCircle.attr("fill",r)}),this.handleGroup.on("".concat(e,"-handler:mouseleave"),function(){var r=t.style.fill;t.verticalLine.attr("fill",r),t.topCircle.attr("fill",r),t.bottomCircle.attr("fill",r)})},h.prototype.show=function(){this.handleGroup.show()},h.prototype.hide=function(){this.handleGroup.hide()},h.prototype.updateXY=function(){this.handleGroup.setMatrix([1,0,0,0,1,0,this.x,this.y,1])},h}(),Te=_e,Re="timebarstartplay",Ze="timebarendplay",je="valuechange",ht="timebarConfigChanged",zt="playPauseBtn",wr="nextStepBtn",Kt="preStepBtn",qt=function(){return qt=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},qt.apply(this,arguments)},Qt=function(){function h(t){this.config=(0,_.deepMix)({},t),this.init()}return h.prototype.update=function(t){this.config=(0,_.deepMix)({},this.config,t),this.updateElement(),this.renderMarker()},h.prototype.init=function(){this.initElement(),this.renderMarker()},h.prototype.initElement=function(){var t=this.config,e=t.group,r=t.style,n=r.scale,i=n===void 0?1:n,a=r.offsetX,o=a===void 0?0:a,s=r.offsetY,d=s===void 0?0:s,y=this.config.x+o,C=this.config.y+d,F=e.addGroup({name:zt});this.startMarkerGroup=F.addGroup({name:zt}),this.circle=e.addShape("circle",{attrs:qt({x:y,y:C,r:this.config.r*i},r),name:zt}),this.startMarker=this.startMarkerGroup.addShape("path",{attrs:{path:this.getStartMarkerPath(y,C,i),fill:r.stroke||"#aaa"},name:"start-marker"}),this.pauseMarkerGroup=F.addGroup({name:zt});var G=.25*this.config.r*i,H=.5*this.config.r*Math.sqrt(3)*i;this.pauseLeftMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:y-.375*this.config.r*i,y:C-H/2,width:G,height:H,fill:r.stroke||"#aaa",lineWidth:0}}),this.pauseRightMarker=this.pauseMarkerGroup.addShape("rect",{attrs:{x:y+1/8*this.config.r*i,y:C-H/2,width:G,height:H,fill:r.stroke||"#aaa",lineWidth:0}})},h.prototype.updateElement=function(){var t=this.config.style,e=t.scale,r=e===void 0?1:e,n=t.offsetX,i=n===void 0?0:n,a=t.offsetY,o=a===void 0?0:a,s=this.config.x+i,d=this.config.y+o;this.circle.attr("x",s),this.circle.attr("y",d),this.circle.attr("r",this.config.r*r),this.startMarker.attr("path",this.getStartMarkerPath(s,d,r));var y=.25*this.config.r*r,C=.5*this.config.r*Math.sqrt(3)*r;this.pauseLeftMarker.attr("x",s-(1/4+1/8)*this.config.r*r),this.pauseLeftMarker.attr("y",d-C/2),this.pauseLeftMarker.attr("width",y),this.pauseLeftMarker.attr("height",C),this.pauseRightMarker.attr("x",s+1/8*this.config.r*r),this.pauseRightMarker.attr("y",d-C/2),this.pauseRightMarker.attr("width",y),this.pauseRightMarker.attr("height",C)},h.prototype.renderMarker=function(){this.config.isPlay?(this.startMarkerGroup.hide(),this.pauseMarkerGroup.show()):(this.startMarkerGroup.show(),this.pauseMarkerGroup.hide())},h.prototype.getStartMarkerPath=function(t,e,r){var n=.5*this.config.r*Math.sqrt(3)*r;return[["M",t-n/Math.sqrt(3)/2,e-n/2],["L",t+n/Math.sqrt(3),e],["L",t-n/Math.sqrt(3)/2,e+n/2]]},h}(),Xr=Qt,Yr=function(){return Yr=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},Yr.apply(this,arguments)},Kr=ee.vs,Cn="#aaa",Sn="green",Rn={fill:"#aaa",fillOpacity:.35,stroke:"#aaa"},jn={fill:"#fff"},kn={fill:"green"},Bi={pointer:{fill:"#aaa",lineWidth:0},scroller:{stroke:"#aaa",fill:"#aaa",lineWidth:1,lineAppendWidth:5,cursor:"pointer"},text:{fill:"#aaa",textBaseline:"top"}},Xn={check:{stroke:"green",lineWidth:3},box:{fill:"#fff",stroke:"#aaa",lineWidth:2,radius:3,width:12,height:12},text:{fill:"#aaa",fontSize:12,textBaseline:"top"}},qi={speed:1,loop:!1,fill:"#fff",stroke:"#fff",hideTimeTypeController:!1,preBtnStyle:{fill:"#aaa",stroke:"#aaa"},nextBtnStyle:{fill:"#aaa",stroke:"#aaa"},playBtnStyle:{fill:"#aaa",stroke:"#aaa",fillOpacity:.05},speedControllerStyle:Bi,timeTypeControllerStyle:Xn},Oi=110,Kn=50,Zi=function(){function h(t){this.controllerCfg=(0,_.deepMix)({},qi,t),this.group=t.group,this.controllerGroup=this.group.addGroup({name:"controller-group"}),this.speedAxisY=[],this.currentSpeed=this.controllerCfg.speed,this.currentType="range",this.fontFamily=t.fontFamily||"Arial, sans-serif",this.init()}return h.prototype.init=function(){this.renderPlayButton()},h.prototype.getNextMarkerPath=function(t,e,r){return[["M",t,e-r],["L",t+r,e],["L",t,e+r],["Z",t,e-r],["M",t,e],["L",t-r,e-r],["L",t-r,e+r],["Z"]]},h.prototype.getPreMarkerPath=function(t,e,r){return[["M",t,e-r],["L",t-r,e],["L",t,e+r],["L",t,e-r],["M",t,e],["L",t+r,e-r],["L",t+r,e+r],["Z"]]},h.prototype.renderPlayButton=function(){var t=this.controllerCfg,e=t.width,r=t.height,n=t.x,i=t.y,a=t.hideTimeTypeController,o=t.fill,s=o===void 0?Cn:o,d=t.stroke,y=d===void 0?Sn:d,C=t.containerStyle,F=C===void 0?{}:C,G=Yr(Yr({},Rn),t.playBtnStyle||{}),H=Yr(Yr({},jn),t.preBtnStyle||{}),ie=Yr(Yr({},kn),t.nextBtnStyle||{}),se=r/2-5,ce=i+10,de=this.controllerGroup.addShape("rect",{attrs:Yr({x:n,y:ce,width:e,height:r,stroke:y,fill:s},F),name:"container-rect"});this.playButton?this.playButton.update({x:e/2,y:ce,r:se}):this.playButton=new Xr({group:this.controllerGroup,x:e/2,y:ce+se+5,r:se,isPlay:this.isPlay,style:G});var xe=H.offsetX||0,Ie=H.offsetY||0,qe=(H.scale||1)*se;this.controllerGroup.addShape("path",{attrs:Yr({path:this.getPreMarkerPath(e/2-5*se+xe,ce+se+5+Ie,qe*.5)},H),name:Kt});var ze=ie.offsetX||0,$e=ie.offsetY||0,mt=(ie.scale||1)*se;this.controllerGroup.addShape("path",{attrs:Yr({path:this.getNextMarkerPath(e/2+5*se+ze,ce+se+5+$e,mt*.5)},ie),name:wr}),de.toBack(),this.renderSpeedBtn(),a||this.renderToggleTime(),this.bindEvent();var xt=this.controllerCfg.scale,wt=xt===void 0?1:xt,Yt=this.controllerGroup.getCanvasBBox(),Zt=(Yt.maxX+Yt.minX)/2,Er=(Yt.maxY+Yt.minY)/2,Fr=Kr([1,0,0,0,1,0,0,0,1],[["t",-Zt,-Er],["s",wt,wt],["t",Zt,Er]]);this.controllerGroup.setMatrix(Fr)},h.prototype.renderSpeedBtn=function(){var t=this.controllerCfg,e=t.y,r=t.width,n=t.hideTimeTypeController,i=Yr(Yr({},Bi),this.controllerCfg.speedControllerStyle||{}),a=i.scroller,o=a===void 0?{}:a,s=i.text,d=s===void 0?{}:s,y=i.pointer,C=y===void 0?{}:y,F=i.scale,G=F===void 0?1:F,H=i.offsetX,ie=H===void 0?0:H,se=i.offsetY,ce=se===void 0?0:se,de=this.controllerGroup.addGroup({name:"speed-group"});this.speedGroup=de;var xe=[],Ie=5;this.speedAxisY=[19,22,26,32,39];for(var qe=0;qe<5;qe++){var ze=e+this.speedAxisY[qe],$e=r-(n?Kn:Oi);de.addShape("line",{attrs:Yr({x1:$e,x2:$e+15,y1:ze,y2:ze},o),speed:Ie,name:"speed-rect"}),this.speedAxisY[qe]=ze,xe.push(Ie),Ie=Ie-1}this.speedText=de.addShape("text",{attrs:Yr({x:r-(n?Kn:Oi)+20,y:this.speedAxisY[0]+4,text:"1.0X",fontFamily:this.fontFamily||"Arial, sans-serif"},d),name:"speed-text"}),this.speedPoint=de.addShape("path",{attrs:Yr({path:this.getPointerPath(r-(n?Kn:Oi),0),matrix:[1,0,0,0,1,0,0,this.speedAxisY[4],1]},C),name:"speed-pointer"});var mt=this.speedGroup.getCanvasBBox(),xt=(mt.maxX+mt.minX)/2,wt=(mt.maxY+mt.minY)/2,Yt=this.speedGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];Yt=Kr(Yt,[["t",-xt,-wt],["s",G,G],["t",xt+ie*G,wt+ce*G]]),this.speedGroup.setMatrix(Yt)},h.prototype.getPointerPath=function(t,e){return[["M",t,e],["L",t-10,e-4],["L",t-10,e+4],["Z"]]},h.prototype.renderToggleTime=function(){var t,e=this.controllerCfg.width,r=Yr(Yr({},Xn),this.controllerCfg.timeTypeControllerStyle||{}),n=r.scale,i=n===void 0?1:n,a=r.offsetX,o=a===void 0?0:a,s=r.offsetY,d=s===void 0?0:s,y=r.box,C=y===void 0?{}:y,F=r.check,G=F===void 0?{}:F,H=r.text,ie=H===void 0?{}:H;this.toggleGroup=this.controllerGroup.addGroup({name:"toggle-group"}),this.toggleGroup.addShape("rect",{attrs:Yr({x:e-Kn,y:this.speedAxisY[0]+3.5},C),isChecked:!1,name:"toggle-model"}),this.checkedIcon=this.toggleGroup.addShape("path",{attrs:Yr({path:[["M",e-Kn+3,this.speedAxisY[1]+6],["L",e-Kn+7,this.speedAxisY[1]+10],["L",e-Kn+12,this.speedAxisY[1]+4]]},G),capture:!1,name:"check-icon"}),this.checkedIcon.hide(),this.checkedText=this.toggleGroup.addShape("text",{attrs:Yr({text:((t=this.controllerCfg)===null||t===void 0?void 0:t.timePointControllerText)||"\u5355\u4E00\u65F6\u95F4",x:e-Kn+15,y:this.speedAxisY[0]+4,fontFamily:typeof window!="undefined"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif"},ie),name:"checked-text"});var se=this.toggleGroup.getCanvasBBox(),ce=(se.maxX+se.minX)/2,de=(se.maxY+se.minY)/2,xe=this.toggleGroup.getMatrix()||[1,0,0,0,1,0,0,0,1];xe=Kr(xe,[["t",-ce,-de],["s",i,i],["t",ce+o*i,de+d*i]]),this.toggleGroup.setMatrix(xe)},h.prototype.bindEvent=function(){var t=this;this.speedGroup.on("speed-rect:click",function(e){var r=e.target.attr("y1"),n=t.speedPoint.attr("matrix"),i=t.speedAxisY.indexOf(n[7]||0),a=t.speedAxisY.indexOf(r),o=t.speedAxisY[a]-t.speedAxisY[i];n=Kr(n,[["t",0,o]]),t.speedPoint.setMatrix(n),t.currentSpeed=t.speedAxisY.length-a,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit(ht,{speed:t.currentSpeed,type:t.currentType})}),this.speedGroup.on("mousewheel",function(e){e.preventDefault();var r=t.speedPoint.attr("matrix")||[1,0,0,0,1,0,0,0,1],n=r[7],i=t.speedAxisY.indexOf(n);if(i===-1){var a=Infinity;t.speedAxisY.forEach(function(s,d){var y=Math.abs(s-n);a>y&&(a=y,i=d)})}e.originalEvent.deltaY>0?i=Math.max(0,i-1):i=Math.min(t.speedAxisY.length-1,i+1);var o=t.speedAxisY[i]-n;r=Kr(r,[["t",0,o]]),t.speedPoint.setMatrix(r),t.currentSpeed=t.speedAxisY.length-i,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit(ht,{speed:t.currentSpeed,type:t.currentType})}),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",function(e){var r,n,i=e.target.get("isChecked");i?(t.checkedIcon.hide(),t.checkedText.attr("text",((n=t.controllerCfg)===null||n===void 0?void 0:n.timePointControllerText)||"\u5355\u4E00\u65F6\u95F4"),t.currentType="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="single"),e.target.set("isChecked",!i),t.group.emit(ht,{type:t.currentType,speed:t.currentSpeed})})},h.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},h}(),Ki=Zi,ri=function(){return ri=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},ri.apply(this,arguments)},za=ee.vs,pa={fill:"#416180",opacity:.05},Jn={fill:"#416180",opacity:.15,radius:5},Ga={fill:"#5B8FF9",opacity:.3,cursor:"grab"},Mi=2,Bn={width:Mi,height:24},hi={textBaseline:"middle",fill:"#000",opacity:.45},yi={textAlign:"center",textBaseline:"top",fill:"#607889",opacity:.35},aa={lineWidth:1,stroke:"#ccc"},qs=function(){function h(t){var e=this;this.prevX=0,this.onMouseDown=function(un){return function(fn){e.currentHandler=un;var pn=fn.originalEvent;pn.stopPropagation(),pn.preventDefault(),e.prevX=(0,_.get)(pn,"touches.0.pageX",pn.pageX);var Tn=e.canvas.get("container");Tn.addEventListener("mousemove",e.onMouseMove),Tn.addEventListener("mouseup",e.onMouseUp),Tn.addEventListener("mouseleave",e.onMouseUp),Tn.addEventListener("touchmove",e.onMouseMove),Tn.addEventListener("touchend",e.onMouseUp),Tn.addEventListener("touchcancel",e.onMouseUp)}},this.onMouseMove=function(un){un.stopPropagation(),un.preventDefault();var fn=(0,_.get)(un,"touches.0.pageX",un.pageX),pn=fn-e.prevX,Tn=e.adjustOffsetRange(pn/e.width);e.updateStartEnd(Tn),e.updateUI(),e.prevX=fn},this.onMouseUp=function(){e.currentHandler&&(e.currentHandler=void 0);var un=e.canvas.get("container");un&&(un.removeEventListener("mousemove",e.onMouseMove),un.removeEventListener("mouseup",e.onMouseUp),un.removeEventListener("mouseleave",e.onMouseUp),un.removeEventListener("touchmove",e.onMouseMove),un.removeEventListener("touchend",e.onMouseUp),un.removeEventListener("touchcancel",e.onMouseUp))};var r=t.x,n=r===void 0?0:r,i=t.y,a=i===void 0?0:i,o=t.width,s=o===void 0?100:o,d=t.height,y=t.padding,C=y===void 0?10:y,F=t.trendCfg,G=t.controllerCfg,H=G===void 0?{speed:1}:G,ie=t.backgroundStyle,se=ie===void 0?{}:ie,ce=t.foregroundStyle,de=ce===void 0?{}:ce,xe=t.handlerStyle,Ie=xe===void 0?{}:xe,qe=t.textStyle,ze=qe===void 0?{}:qe,$e=t.start,mt=$e===void 0?0:$e,xt=t.end,wt=xt===void 0?1:xt,Yt=t.minText,Zt=Yt===void 0?"":Yt,Er=t.maxText,Fr=Er===void 0?"":Er,Ur=t.group,Or=t.graph,hn=t.canvas,sn=t.tick,Ir=sn===void 0?{tickLabelStyle:{},tickLineStyle:{},tickLabelFormatter:function(fn){return fn},ticks:[]}:sn,en=t.type;this.graph=Or,this.canvas=hn,this.group=Ur,this.timeBarType=en,this.x=n,this.y=a,this.width=s,this.height=d,this.padding=C,this.ticks=Ir.ticks,this.trendCfg=F,this.controllerCfg=H,this.currentSpeed=H.speed||1,this.tickLabelFormatter=Ir.tickLabelFormatter,en==="trend"?this.backgroundStyle=ri(ri({},pa),se):en==="simple"&&(this.backgroundStyle=ri(ri({},Jn),se)),this.foregroundStyle=ri(ri({},Ga),de),this.handlerStyle=ri(ri({},Bn),Ie),this.textStyle=ri(ri({},hi),ze),this.tickLabelStyle=ri(ri({},yi),Ir.tickLabelStyle),this.tickLineStyle=ri(ri({},aa),Ir.tickLineStyle),this.currentMode="range",this.start=mt,this.end=wt,this.minText=Zt,this.maxText=Fr,this.fontFamily=typeof window!="undefined"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlider()}return h.prototype.update=function(t){var e=t.x,r=t.y,n=t.width,i=t.height,a=t.minText,o=t.maxText,s=t.start,d=t.end;this.start=Math.min(1,Math.max(s,0)),this.end=Math.min(1,Math.max(d,0)),(0,_.assign)(this,{x:e,y:r,width:n,height:i,minText:a,maxText:o}),this.updateUI()},h.prototype.setText=function(t,e){this.minTextShape.attr("text",t),this.maxTextShape.attr("text",e)},h.prototype.renderSlider=function(){var t=this,e=this,r=e.width,n=e.height,i=e.timeBarType;if(i==="trend"&&(0,_.size)((0,_.get)(this.trendCfg,"data"))){var a=new $(ri(ri({x:this.x,y:this.y,width:r,height:n},this.trendCfg),{group:this.group}));this.trendComponent=a}var o=this.group.addGroup({name:"slider-group"});o.addShape("rect",{attrs:ri({x:0,y:0,width:r,height:n},this.backgroundStyle),name:"background"});var s=this.group.addGroup();i==="trend"?(this.minTextShape=s.addShape("text",{attrs:ri({x:0,y:n/2+this.y,textAlign:"right",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=s.addShape("text",{attrs:ri({y:n/2+this.y,textAlign:"left",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})):(this.minTextShape=s.addShape("text",{attrs:ri({x:0,y:this.y-10,textAlign:"center",text:this.minText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"min-text-shape"}),this.maxTextShape=s.addShape("text",{attrs:ri({y:this.y-10,textAlign:"center",text:this.maxText,silent:!1,fontFamily:this.fontFamily||"Arial, sans-serif",stroke:"#fff",lineWidth:5},this.textStyle),capture:!1,name:"max-text-shape"})),this.foregroundShape=this.group.addGroup().addShape("rect",{attrs:ri({x:0,y:this.y,height:n},this.foregroundStyle),name:"foreground-shape"}),this.foregroundShape.on("mousedown",function(ce){ce.target.attr("cursor","grabbing")}),this.foregroundShape.on("mouseup",function(ce){ce.target.attr("cursor",t.foregroundStyle.cursor||"grab")});var d=(0,_.get)(this.handlerStyle,"width",2),y=(0,_.get)(this.handlerStyle,"height",24),C=this.group.addGroup({name:"minHandlerShape"});this.minHandlerShape=new Te({name:"minHandlerShape",group:C,type:i,x:this.x,y:this.y,width:d,height:y,style:this.handlerStyle});var F=this.group.addGroup({name:"maxHandlerShape"});this.maxHandlerShape=new Te({name:"maxHandlerShape",group:F,type:i,x:this.x,y:this.y,width:d,height:y,style:this.handlerStyle});var G=this.ticks,H=r/(G.length-1);this.tickPosList=[],this.textList&&this.textList.length&&this.textList.forEach(function(ce){ce.destroy()});var ie=-Infinity,se=this.tickLabelStyle.rotate;delete this.tickLabelStyle.rotate,this.textList=G.map(function(ce,de){t.tickPosList.push(t.x+de*H);var xe;t.tickLabelFormatter?(xe=t.tickLabelFormatter(ce),!(0,_.isString)(xe)&&xe&&(xe=ce.date)):xe=ce.date;var Ie=t.x+de*H,qe=t.y+n+5,ze=t.group.addShape("text",{attrs:ri({x:Ie,y:qe,text:xe,fontFamily:t.fontFamily||"Arial, sans-serif"},t.tickLabelStyle),name:"tick-label"});if((0,_.isNumber)(se)&&de!==G.length-1){var $e=za([1,0,0,0,1,0,0,0,1],[["t",-Ie,-qe],["r",se],["t",Ie-5,qe+2]]);ze.attr({textAlign:"left",matrix:$e})}de===0?ze.attr({textAlign:"left"}):de!==G.length-1&&ze.attr({textAlign:"right"});var mt=t.group.addShape("line",{attrs:ri({x1:t.x+de*H,y1:t.y+n+2,x2:t.x+de*H,y2:t.y+n+6},t.tickLineStyle),name:"tick-line"});mt.toBack();var xt=ze.getBBox();return xt.minX>ie?(ze.show(),mt.show(),ie=xt.minX+xt.width+10):(ze.hide(),mt.hide()),ze}),this.controllerBtnGroup=new Ki(ri({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()},h.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(zt,":click"),function(){t.isPlay=!t.isPlay,t.currentHandler=t.maxHandlerShape,t.changePlayStatus()}),this.group.on("".concat(wr,":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(.01),t.updateUI()}),this.group.on("".concat(Kt,":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(-.01),t.updateUI()}),this.group.on(ht,function(n){var i=n.type,a=n.speed;t.currentSpeed=a,t.currentMode=i,i==="single"?(t.minHandlerShape.hide(),t.foregroundShape.hide(),t.minTextShape.hide()):i==="range"&&(t.minHandlerShape.show(),t.foregroundShape.show(),t.minTextShape.show())})},h.prototype.adjustTickIndex=function(t){for(var e=0;e<this.tickPosList.length-1;e++)if(this.tickPosList[e]<=t&&t<=this.tickPosList[e+1])return Math.abs(this.tickPosList[e]-t)<Math.abs(t-this.tickPosList[e+1])?e:e+1;return 0},h.prototype.adjustOffsetRange=function(t){switch(this.currentHandler){case this.minHandlerShape:{var e=0-this.start,r=1-this.start;return Math.min(r,Math.max(e,t))}case this.maxHandlerShape:{var e=0-this.end,r=1-this.end;return Math.min(r,Math.max(e,t))}case this.foregroundShape:{var e=0-this.start,r=1-this.end;return Math.min(r,Math.max(e,t))}default:return 0}},h.prototype.updateStartEnd=function(t){var e=this.ticks[this.adjustTickIndex(this.start*this.width)],r=this.ticks[this.adjustTickIndex(this.end*this.width)];if(!this.currentHandler){this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):e==null?void 0:e.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(r):r==null?void 0:r.date;return}switch(this.currentHandler){case this.minHandlerShape:this.maxText=this.maxTextShape.attr("text"),this.start+=t,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):e.date;break;case this.maxHandlerShape:this.minText=this.minTextShape.attr("text"),this.end+=t,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(r):r.date;break;case this.foregroundShape:this.start+=t,this.end+=t,this.minText=this.tickLabelFormatter?this.tickLabelFormatter(e):e.date,this.maxText=this.tickLabelFormatter?this.tickLabelFormatter(r):r.date;break;default:break}},h.prototype.updateUI=function(){var t=this;this.start<0&&(this.start=0),this.end>1&&(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,_.get)(this.handlerStyle,"width",Mi);this.setText(this.minText,this.maxText);var i=this.dodgeText([e,r]),a=i[0],o=i[1];this.minHandlerShape.setX(e-n/2),(0,_.each)(a,function(s,d){return t.minTextShape.attr(d,s)}),this.maxHandlerShape.setX(r-n/2),(0,_.each)(o,function(s,d){return t.maxTextShape.attr(d,s)}),this.currentMode==="range"?this.graph.emit(je,{value:[this.start,this.end].sort()}):this.currentMode==="single"&&this.graph.emit(je,{value:[this.end,this.end]})},h.prototype.dodgeText=function(t){var e,r,n=2,i=(0,_.get)(this.handlerStyle,"width",Mi),a=this.minTextShape,o=this.maxTextShape,s=t[0],d=t[1],y=!1;s>d&&(e=[d,s],s=e[0],d=e[1],r=[o,a],a=r[0],o=r[1],y=!0);var C=a.getBBox(),F=o.getBBox(),G=null,H=null;return this.timeBarType==="trend"?(G=s-C.width<this.x+n?{x:s+i/2+n,textAlign:"left"}:{x:s-i/2-n,textAlign:"right"},H=d+F.width>this.x+this.width?{x:d-i/2-n,textAlign:"right"}:{x:d+i/2+n,textAlign:"left"}):this.timeBarType==="simple"&&(G=a.attr("x")>C.width?{x:s,textAlign:"center"}:{x:s,textAlign:"left"},H=o.attr("x")>this.width-F.width?{x:d,textAlign:"right"}:{x:d,textAlign:"center"}),y?[H,G]:[G,H]},h.prototype.startPlay=function(){var t=this;return typeof window!="undefined"?window.requestAnimationFrame(function(){var e=t,r=e.ticks,n=e.width,i=t.currentSpeed,a=n/r.length,o=a/((10-i)*1e3/60),s=t.adjustOffsetRange(o/t.width);t.updateStartEnd(s),t.updateUI(),t.isPlay&&(t.playHandler=t.startPlay())}):void 0},h.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(Re,null)):this.playHandler&&(typeof window!="undefined"&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit(Ze,null))},h.prototype.destory=function(){this.graph.off(je,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(zt,":click")),t.off("".concat(wr,":click")),t.off("".concat(Kt,":click")),t.off(ht),t.destroy(),this.trendComponent&&this.trendComponent.destory()},h}(),Tc=qs,yt={opacity:.5,fill:"#000"},br={opacity:.5,fill:"#000",r:5},hr={fill:"#fff",fontSize:12},mn=function(){function h(t){var e=t.x,r=e===void 0?0:e,n=t.y,i=n===void 0?0:n,a=t.container,o=t.text,s=t.padding,d=s===void 0?[4,4,4,4]:s,y=t.className,C=y===void 0?"g6-component-timebar-tooltip":y,F=t.backgroundColor,G=F===void 0?"#000":F,H=t.textColor,ie=H===void 0?"#fff":H,se=t.opacity,ce=se===void 0?.8:se,de=t.fontSize,xe=de===void 0?12:de;this.container=a,this.className=C,this.backgroundColor=G,this.textColor=ie,this.x=r,this.y=i,this.text=o,this.padding=d,this.opacity=ce,this.fontSize=xe,this.render()}return h.prototype.render=function(){var t=this,e=t.className,r=t.x,n=t.y,i=t.backgroundColor,a=t.textColor,o=t.text,s=t.padding,d=t.opacity,y=t.fontSize,C=t.container,F=(0,Di.Z)("<div class='".concat(e,`' style="position: absolute; width: fit-content; height: fit-content; opacity: `).concat(d,'"></div>'));(0,_.isString)(C)&&(C=document.getElementById(C)),C.appendChild(F),t.parentHeight=C.offsetHeight,t.parentWidth=C.offsetWidth,(0,Qn.Z)(F,{visibility:"hidden",top:0,left:0});var G=(0,Di.Z)(`
  136. <div style='position: absolute; white-space:nowrap; background-color: `.concat(i,"; font-size: ").concat(y,"px; border-radius: 4px; width: fit-content; height: fit-content; color: ").concat(a,"; padding: ").concat(s[0],"px ").concat(s[1],"px ").concat(s[2],"px ").concat(s[3],"px'></div>"));G.innerHTML=o,F.appendChild(G),t.backgroundDOM=G;var H=(0,Di.Z)("<div style='position: absolute; width: 0px; height: 0px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 10px solid ".concat(i,"'></div>"));F.appendChild(H),t.arrowDOM=H,t.container=F},h.prototype.show=function(t){var e=this,r=t.text,n=t.x,i=t.y,a=t.clientX,o=t.clientY;e.backgroundDOM.innerHTML=r;var s=e.backgroundDOM.offsetWidth,d=e.backgroundDOM.offsetHeight,y=e.arrowDOM.offsetWidth,C=e.arrowDOM.offsetHeight;(0,Qn.Z)(e.container,{top:"".concat(-d-C,"px"),left:"".concat(n,"px"),visibility:"visible"}),(0,Qn.Z)(e.backgroundDOM,{marginLeft:"".concat(-s/2,"px")}),(0,Qn.Z)(e.arrowDOM,{marginLeft:"".concat(-y/2,"px"),top:"".concat(d,"px")});var F=n-s/2,G=n+s/2;F<0?(0,Qn.Z)(e.backgroundDOM,{marginLeft:"".concat(-s/2-F,"px")}):G>e.parentWidth&&(0,Qn.Z)(e.backgroundDOM,{marginLeft:"".concat(-s/2-G+e.parentWidth+12,"px")})},h.prototype.hide=function(){(0,Qn.Z)(this.container,{top:0,left:0,visibility:"hidden"})},h}(),fi=mn,ot=function(){return ot=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},ot.apply(this,arguments)},Xe=ee.vs,Gt={fill:"#5B8FF9"},tr={fill:"#e6e8e9"},or=function(){function h(t){this.frameCount=0,this.fontFamily="Arial, sans-serif";var e=t.graph,r=t.canvas,n=t.group,i=t.width,a=t.height,o=t.padding,s=t.data,d=t.start,y=t.end,C=t.x,F=C===void 0?0:C,G=t.y,H=G===void 0?0:G,ie=t.tickLabelFormatter,se=t.selectedTickStyle,ce=se===void 0?Gt:se,de=t.unselectedTickStyle,xe=de===void 0?tr:de,Ie=t.tooltipBackgroundColor,qe=t.tooltipFomatter,ze=t.tickLabelStyle;this.graph=e,this.group=n,this.sliceGroup=n.addGroup({name:"slice-group"}),this.canvas=r,this.width=i,this.height=a,this.padding=o,this.data=s,this.start=d,this.end=y,this.tickLabelFormatter=ie,this.tickLabelStyle=ze||{},this.selectedTickStyle=ce,this.unselectedTickStyle=xe,this.x=F,this.y=H,this.tooltipBackgroundColor=Ie,this.tooltipFomatter=qe,this.fontFamily=typeof window!="undefined"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif",this.renderSlices(),this.initEvent()}return h.prototype.renderSlices=function(){var t=this,e=this,r=e.width,n=e.height,i=e.padding,a=e.data,o=e.start,s=e.end,d=e.tickLabelFormatter,y=e.selectedTickStyle,C=e.unselectedTickStyle,F=e.tickLabelStyle,G=r-2*i,H=10,ie=4,se=3*i+ie+H,ce=n-se-2*i,de=2,xe=a.length,Ie=(G-de*(xe-1))/xe;this.tickWidth=Ie;var qe=this.sliceGroup,ze=[],$e=[],mt=Math.round(xe*o),xt=Math.round(xe*s);this.startTickRectId=mt,this.endTickRectId=xt;var wt=F.rotate;delete F.rotate,a.forEach(function(Zt,Er){var Fr=Er>=mt&&Er<=xt,Ur=Fr?y:C,Or=qe.addShape("rect",{attrs:ot({x:i+Er*(Ie+de),y:i,width:Ie,height:ce},Ur),draggable:!0,name:"tick-rect-".concat(Er)}),hn=qe.addShape("rect",{attrs:{x:i+Er*Ie+de*(2*Er-1)/2,y:i,width:Er===0||Er===xe-1?Ie+de/2:Ie+de,height:ce,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(Er)});hn.toFront();var sn=Or.getBBox(),Ir=(sn.minX+sn.maxX)/2;ze.push({rect:Or,pickRect:hn,value:Zt.date,x:Ir,y:sn.minY});var en;if(d?(en=d(Zt),!(0,_.isString)(en)&&en&&(en=Zt.date)):Er%Math.round(xe/10)==0&&(en=Zt.date),en){$e.push(en);var un=sn.maxY+i*2;qe.addShape("line",{attrs:{stroke:"#BFBFBF",x1:Ir,y1:un,x2:Ir,y2:un+ie},name:"tick-line"});var fn=un+ie+i,pn=qe.addShape("text",{attrs:ot({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:Ir,y:fn,textAlign:"center",text:en,textBaseline:"top",fontSize:10,fontFamily:t.fontFamily||"Arial, sans-serif"},F),capture:!1,name:"tick-label"}),Tn=pn.getBBox();if(Tn.maxX>r?pn.attr("textAlign","right"):Tn.minX<0&&pn.attr("textAlign","left"),(0,_.isNumber)(wt)&&$e.length!==10){var Zn=Xe([1,0,0,0,1,0,0,0,1],[["t",-Ir,-fn],["r",wt],["t",Ir-5,fn+2]]);pn.attr({textAlign:"left",matrix:Zn})}$e.length===1?pn.attr({textAlign:"left"}):$e.length===10&&pn.attr({textAlign:"right"})}}),this.tickRects=ze;var Yt=this.group;this.currentSpeed=1,this.controllerBtnGroup=new Ki({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"})},h.prototype.initEvent=function(){var t=this,e=this.sliceGroup;e.on("click",function(y){var C=y.target;if(!(C.get("type")!=="rect"||!C.get("name"))){var F=parseInt(C.get("name").split("-")[2],10);if(!isNaN(F)){var G=t.tickRects,H=t.unselectedTickStyle;G.forEach(function(de){de.rect.attr(H)});var ie=t.selectedTickStyle;G[F].rect.attr(ie),t.startTickRectId=F,t.endTickRectId=F;var se=G.length,ce=F/se;t.graph.emit(je,{value:[ce,ce]})}}}),e.on("dragstart",function(y){var C=t.tickRects,F=t.unselectedTickStyle;C.forEach(function(de){de.rect.attr(F)});var G=y.target,H=parseInt(G.get("name").split("-")[2],10),ie=t.selectedTickStyle;C[H].rect.attr(ie),t.startTickRectId=H;var se=C.length,ce=H/se;t.graph.emit(je,{value:[ce,ce]}),t.dragging=!0}),e.on("dragover",function(y){if(!!t.dragging&&y.target.get("type")==="rect"){for(var C=parseInt(y.target.get("name").split("-")[2],10),F=t.startTickRectId,G=t.tickRects,H=t.selectedTickStyle,ie=t.unselectedTickStyle,se=0;se<G.length;se++){var ce=se>=F&&se<=C?H:ie;G[se].rect.attr(ce)}var de=G.length;t.endTickRectId=C;var xe=F/de,Ie=C/de;t.graph.emit(je,{value:[xe,Ie]})}}),e.on("drop",function(y){if(!!t.dragging&&(t.dragging=!1,y.target.get("type")==="rect")){var C=t.startTickRectId,F=parseInt(y.target.get("name").split("-")[2],10);if(!(F<C)){var G=t.selectedTickStyle,H=t.tickRects;H[F].rect.attr(G),t.endTickRectId=F;var ie=H.length,se=C/ie,ce=F/ie;t.graph.emit(je,{value:[se,ce]})}}});var r=this,n=r.tooltipBackgroundColor,i=r.tooltipFomatter,a=r.canvas,o=new fi({container:a.get("container"),backgroundColor:n}),s=this.tickRects;s.forEach(function(y){var C=y.pickRect;C.on("mouseenter",function(F){var G=F.target;if(G.get("type")==="rect"){var H=parseInt(G.get("name").split("-")[2],10),ie=a.getClientByPoint(s[H].x,s[H].y);o.show({x:s[H].x,y:s[H].y,clientX:ie.x,clientY:ie.y,text:i?i(s[H].value):s[H].value})}}),C.on("mouseleave",function(F){o.hide()})});var d=this.group;d.on("".concat(zt,":click"),function(){t.isPlay=!t.isPlay,t.changePlayStatus()}),d.on("".concat(wr,":click"),function(){t.updateStartEnd(1)}),d.on("".concat(Kt,":click"),function(){t.updateStartEnd(-1)}),d.on(ht,function(y){var C=y.type,F=y.speed;t.currentSpeed=F})},h.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(Re,null)):this.playHandler&&(typeof window!="undefined"&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit(Ze,null))},h.prototype.startPlay=function(){var t=this;return typeof window!="undefined"?window.requestAnimationFrame(function(){var e=t.currentSpeed;t.frameCount%(60/e)==0&&(t.frameCount=0,t.updateStartEnd(1)),t.frameCount++,t.isPlay&&(t.playHandler=t.startPlay())}):void 0},h.prototype.updateStartEnd=function(t){var e=this,r=this.tickRects,n=r.length,i=this.unselectedTickStyle,a=this.selectedTickStyle,o=e.endTickRectId;if(t>0?e.endTickRectId++:(r[e.endTickRectId].rect.attr(i),e.endTickRectId--),o!==e.startTickRectId)e.endTickRectId<e.startTickRectId&&(e.startTickRectId=e.endTickRectId);else{for(var s=e.startTickRectId;s<=e.endTickRectId-1;s++)r[s].rect.attr(i);e.startTickRectId=e.endTickRectId}if(r[e.endTickRectId]){r[e.endTickRectId].rect.attr(a);var d=e.startTickRectId/n,y=e.endTickRectId/n;this.graph.emit(je,{value:[d,y]})}},h.prototype.destory=function(){this.graph.off(je,function(){});var t=this.sliceGroup;t.off("click"),t.off("dragstart"),t.off("dragover"),t.off("drop"),this.tickRects.forEach(function(e){var r=e.pickRect;r.off("mouseenter"),r.off("mouseleave")}),this.tickRects.length=0,t.off("".concat(zt,":click")),t.off("".concat(wr,":click")),t.off("".concat(Kt,":click")),t.off(ht),this.sliceGroup.destroy()},h}(),Wt=or,Ft=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Xt=function(){return Xt=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},Xt.apply(this,arguments)},st=function(h,t){var e={};for(var r in h)Object.prototype.hasOwnProperty.call(h,r)&&t.indexOf(r)<0&&(e[r]=h[r]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(h);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(h,r[n])&&(e[r[n]]=h[r[n]]);return e},Ot=4,it=26,Jt=function(h){Ft(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-component-timebar",padding:10,type:"trend",trend:{data:[],isArea:!1,smooth:!0},controllerCfg:{speed:1,loop:!1},slider:{start:.1,end:.9,minText:"min",maxText:"max"},tick:{start:.1,end:.9,data:[]},textStyle:{},filterEdge:!1,filterItemTypes:["node"],containerCSS:{}}},t.prototype.initContainer=function(){var e=this.get("graph"),r=this._cfgs,n=r.width,i=r.height,a=this.get("className")||"g6-component-timebar",o=this.get("container"),s=this.get("graph").get("container"),d;o?((0,_.isString)(o)&&(o=document.getElementById(o)),d=o):(d=(0,Di.Z)("<div class='".concat(a,"'></div>")),(0,Qn.Z)(d,{position:"relative"})),s.appendChild(d),this.set("timeBarContainer",d);var y,C=e.get("renderer");C==="SVG"?y=new ls.Canvas({container:d,width:n,height:i}):y=new fs.Canvas({container:d,width:n,height:i}),this.get("containerCSS")&&(0,Qn.Z)(d,this.get("containerCSS")),this.set("canvas",y)},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.renderTrend=function(){var e=this,r=this._cfgs,n=r.width,i=r.x,a=r.y,o=r.padding,s=r.type,d=r.trend,y=r.slider,C=r.controllerCfg,F=r.textStyle,G=r.tick,H=r.backgroundStyle,ie=r.foregroundStyle,se=d.data,ce=st(d,["data"]),de=n-2*o,xe=s==="trend"?it:Ot,Ie=this.get("graph"),qe=this.get("timeBarGroup"),ze=this.get("canvas"),$e=null;if(s==="trend"||s==="simple"){var mt=this.get("getValue");$e=new Tc(Xt(Xt({graph:Ie,canvas:ze,group:qe,type:s,x:i+o,y:s==="trend"?a+o:a+o+15,width:de,height:xe,padding:o,backgroundStyle:H,foregroundStyle:ie,trendCfg:Xt(Xt({},ce),{data:se.map(function(wt){return(mt==null?void 0:mt(wt))||wt.value})})},y),{tick:{ticks:se,tickLabelFormatter:G.tickLabelFormatter,tickLabelStyle:G.tickLabelStyle,tickLineStyle:G.tickLineStyle},handlerStyle:Xt(Xt({},y.handlerStyle),{height:y.height||xe}),controllerCfg:C,textStyle:F}))}else s==="tick"&&($e=new Wt(Xt({graph:Ie,canvas:ze,group:qe,x:i+o,y:a+o,width:n,height:42,padding:2},G)));var xt=function wt(){var Yt=e.get("timebar");Yt.draggingHandler=!1,Yt.isPlay&&(Yt.isPlay=!1,Yt.currentHandler=Yt.maxHandlerShape,Yt.changePlayStatus()),document.removeEventListener("mouseup",wt)};ze.on("mousedown",function(wt){(wt.target.get("name")==="maxHandlerShape-handler"||wt.target.get("name")==="minHandlerShape-handler"||wt.target===$e.foregroundShape)&&document.addEventListener("mouseup",xt)}),this.set("timebar",$e)},t.prototype.filterData=function(e){var r,n=e.value,i=null,a=this._cfgs.type;if(a==="trend"||a==="simple"?i=this._cfgs.trend.data:a==="tick"&&(i=this._cfgs.tick.data),!i||i.length===0){console.warn("\u8BF7\u914D\u7F6E TimeBar \u7EC4\u4EF6\u7684\u6570\u636E");return}var o=this.get("rangeChange"),s=this.get("graph"),d=Math.round(i.length*n[0]),y=Math.round(i.length*n[1]);y=y>=i.length?i.length-1:y,d=d>=i.length?i.length-1:d;var C=(r=this._cfgs.tick)===null||r===void 0?void 0:r.tickLabelFormatter,F=C?C(i[d]):i[d].date,G=C?C(i[y]):i[y].date;if(a!=="tick"){var H=this.get("timebar");H.setText(F,G)}if(o)o(s,F,G);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&this.cacheGraphData.nodes.length===0)&&(this.cacheGraphData=s.get("data"));var ie=this.get("filterItemTypes"),se=this.get("changeData"),ce=this.get("getDate"),de=this.get("shouldIgnore"),xe=i[d].date,Ie=i[y].date;if(se||se===void 0){var qe=this.cacheGraphData.nodes,ze=this.cacheGraphData.edges;if(ie.includes("node")){qe=qe.filter(function(mt){var xt=+((ce==null?void 0:ce(mt))||mt.date);return xt>=xe&&xt<=Ie||(de==null?void 0:de("node",mt,{min:xe,max:Ie}))});var $e=qe.map(function(mt){return mt.id});ze&&(ze=ze.filter(function(mt){return $e.includes(mt.source)&&$e.includes(mt.target)||(de==null?void 0:de("edge",mt,{min:xe,max:Ie}))}))}(this.get("filterEdge")||ie.includes("edge"))&&(ze=ze.filter(function(mt){var xt=+((ce==null?void 0:ce(mt))||mt.date);return xt>=xe&&xt<=Ie||(de==null?void 0:de("edge",mt,{min:xe,max:Ie}))})),s.changeData({nodes:qe,edges:ze})}else ie.includes("node")&&s.getNodes().forEach(function(mt){var xt=mt.getModel();if(!(de==null?void 0:de("node",xt,{min:xe,max:Ie}))){var wt=+((ce==null?void 0:ce(xt))||xt.date);wt<xe||wt>Ie?s.hideItem(mt):s.showItem(mt)}}),(this.get("filterEdge")||ie.includes("edge"))&&s.getEdges().forEach(function(mt){var xt=mt.getModel();if(!(de==null?void 0:de("edge",xt,{min:i[d].date,max:i[y].date}))){var wt=+((ce==null?void 0:ce(xt))||xt.date);wt<i[d].date||wt>i[y].date?s.hideItem(mt):s.showItem(mt)}})}},t.prototype.initEvent=function(){var e=this,r=0,n=0,i=this._cfgs.type;!i||i==="trend"||i==="simple"?(r=this._cfgs.slider.start,n=this._cfgs.slider.end):i==="tick"&&(r=this._cfgs.tick.start,n=this._cfgs.tick.end);var a=this.get("graph");a.on("afterrender",function(o){e.filterData({value:[r,n]})}),a.on(je,(0,_.throttle)(function(o){e.filterData(o)},200,{trailing:!0,leading:!0}))},t.prototype.destroy=function(){var e=this.get("timebar");e&&e.destory&&e.destory(),h.prototype.destroy.call(this);var r=this.get("timeBarContainer");if(r){var n=this.get("container");n||(n=this.get("graph").get("container")),(0,_.isString)(n)&&(n=document.getElementById(n)),n.removeChild(r)}},t}(fo),cr=Jt,Lr=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Br=Eo.applyMatrix;function Tr(h,t){var e,r;if(h.naturalWidth)e=h.naturalWidth,r=h.naturalHeight;else{var n=new Image;n.src=h.src,n.onload=function(){t&&t(n.width,n.height)}}return[e,r]}var $r=function(h){Lr(t,h);function t(e){return h.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 i=this.get("container");(0,_.isString)(i)&&(i=document.getElementById(i));var a=(0,Di.Z)("<div class=".concat(r.viewportClassName,`
  137. style='position:absolute;
  138. left:0;
  139. top:0;
  140. box-sizing:border-box;
  141. border: 2px solid #1980ff;
  142. cursor:move'
  143. </div>`)),o=0,s=0,d=!1,y=0,C=0,F=0,G=0,H=0,ie=0;i.addEventListener("mousedown",function(se){if(r.refresh=!1,se.target===a){var ce=a.style;F=parseInt(ce.width,10),G=parseInt(ce.height,10);var de=e.get("width"),xe=e.get("height");F>de||G>xe||(ie=n.getZoom(),H=e.get("ratio"),d=!0,o=se.clientX,s=se.clientY)}},!1),i.addEventListener("mousemove",function(se){if(!(!d||(0,_.isNil)(se.clientX)||(0,_.isNil)(se.clientY))){var ce=e.get("width"),de=e.get("height"),xe=a.style;y=parseInt(xe.left,10),C=parseInt(xe.top,10),F=parseInt(xe.width,10),G=parseInt(xe.height,10);var Ie=o-se.clientX,qe=s-se.clientY;y-Ie<0?Ie=y:y-Ie+F>=ce&&(Ie=0),C-qe<0?qe=C:C-qe+G>=de&&(qe=0),y-=Ie,C-=qe,(0,Qn.Z)(a,{left:"".concat(y,"px"),top:"".concat(C,"px")}),n.translate(Ie*ie/H,qe*ie/H),o=se.clientX,s=se.clientY}},!1),i.addEventListener("mouseleave",function(){d=!1,r.refresh=!0},!1),i.addEventListener("mouseup",function(){d=!1,r.refresh=!0},!1),this.set("viewport",a),i.appendChild(a)}},t.prototype.updateViewport=function(){if(!this.destroyed){var e=this.get("ratio"),r=this.get("width"),n=this.get("height"),i=this.get("graph"),a=i.get("width"),o=i.get("height"),s=a/o,d=i.getGroup(),y=d.getCanvasBBox(),C=[(y.minX+y.maxX)/2,(y.minY+y.maxY)/2],F=[y.maxX-y.minX,y.maxY-y.minY],G={centerX:C[0],centerY:C[1],width:0,height:0,minX:0,minY:0};y[0]/y[1]>s?(G.width=F[0],G.height=G.width/s):(G.height=F[1],G.width=G.height*s),G.minX=C[0]-G.width/2,G.minY=C[1]-G.height/2;var H=d.getMatrix();H||(H=[1,0,0,0,1,0,0,0,1]);var ie=$o.invert([1,0,0,0,1,0,0,0,1],H),se=Br({x:G.minX,y:G.minY},ie),ce=i.getCanvasByPoint(se.x,se.y),de=this.get("viewport");de||this.initViewport();var xe=a/G.width,Ie=xe*r,qe=xe*n,ze=r*-ce.x/G.width,$e=n*-ce.y/G.height,mt=ze+Ie,xt=$e+qe;ze<0&&(Ie+=ze,ze=0),mt>r&&(Ie=Ie-(mt-r)),$e<0&&(qe+=$e,$e=0),xt>n&&(qe=qe-(xt-n)),this.set("ratio",e);var wt="".concat(ze,"px"),Yt="".concat($e,"px");(0,Qn.Z)(de,{left:wt,top:Yt,width:"".concat(Ie,"px"),height:"".concat(qe,"px")})}},t.prototype.init=function(){this.initContainer()},t.prototype.initContainer=function(){var e=this,r=e.get("graph"),n=r.get("width"),i=r.get("height"),a=i/n,o=e.get("className"),s=e.get("container"),d=e.get("width"),y=e.get("height");!d&&!y&&(d=200),d?(y=a*d,e.set("height",y)):(d=1/a*y,e.set("width",d));var C=(0,Di.Z)("<div class='".concat(o,"' style='width: ").concat(d,"px; height: ").concat(y,"px; overflow: hidden; position: relative;'></div>"));(0,_.isString)(s)&&(s=document.getElementById(s)),s?s.appendChild(C):r.get("container").appendChild(C),e.set("container",C);var F=(0,Di.Z)('<div class="g6-minimap-container" style="position: relative; width: 100%; height: 100%; text-align: center; display: table;"></div>');C.appendChild(F);var G=(0,Di.Z)('<span style="display: table-cell; vertical-align: middle; "></span>');F.appendChild(G),e.set("containerDOM",F),e.set("containerSpan",G);var H=(0,Di.Z)('<img alt="" src="'.concat(this.get("graphImg"),'" style="display: inline-block; user-select: none;" draggable="false" />'));e.set("imgDOM",H),e.updateImgSize(),G.appendChild(H),e.updateCanvas()},t.prototype.updateImgSize=function(){var e=this,r=e.get("imgDOM"),n=e.get("width"),i=e.get("height");r.onload=function(){var a=Tr(r);a[0]>a[1]?r.width=n:r.height=i}},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"),i=r.get("canvas").getCanvasBBox(),a=i.width,o=n/a;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 i=(0,Di.Z)('<img alt="" src="'.concat(e,'" style="display: inline-block;" ondragstart="return false;" onselectstart="return false;"/>'));r.set("imgDOM",i),i.src=e,r.updateImgSize();var a=r.get("containerSpan");a.appendChild(i),r.updateCanvas()},t.prototype.destroy=function(){var e=this.get("container");e.parentNode.removeChild(e)},t}(fo),Pn=$r,qn=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),En=function(){return En=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},En.apply(this,arguments)},Fn=Eo.distance,Yn=.05,_i={stroke:"#000",strokeOpacity:.8,lineWidth:2,fillOpacity:1,fill:"#fff"},ra=function(h){qn(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{type:"both",trigger:"mousemove",r:60,delegateStyle:(0,_.clone)(_i),showLabel:"edge",scaleRBy:"wheel"}},t.prototype.getEvents=function(){var e;switch(this.get("trigger")){case"click":e={click:"filter"};break;case"drag":e={click:"createDelegate"};break;default:e={mousemove:"filter"};break}return e},t.prototype.init=function(){var e=this,r=e.get("showLabel"),n=r==="node"||r==="both",i=r==="edge"||r==="both";e.set("showNodeLabel",n),e.set("showEdgeLabel",i);var a=e.get("shouldShow");a||e.set("shouldShow",function(){return!0})},t.prototype.createDelegate=function(e){var r=this,n=r.get("delegate");(!n||n.destroyed)&&(r.filter(e),n=r.get("delegate"),n.on("dragstart",function(i){}),n.on("drag",function(i){r.filter(i)}),this.get("scaleRBy")==="wheel"&&n.on("mousewheel",function(i){r.scaleRByWheel(i)}))},t.prototype.scaleRByWheel=function(e){var r=this;if(!(!e||!e.originalEvent)){e.preventDefault&&e.preventDefault();var n=r.get("graph"),i,a=r.get("delegate"),o=a?{x:a.attr("x"),y:a.attr("y")}:void 0,s=o||n.getPointByClient(e.clientX,e.clientY);e.originalEvent.wheelDelta<0?i=1-Yn:i=1/(1-Yn);var d=r.get("maxR"),y=r.get("minR"),C=r.get("r");(C>(d||n.get("height"))&&i>1||C<(y||n.get("height")*.05)&&i<1)&&(i=1),C*=i,r.set("r",C),r.filter(e)}},t.prototype.filter=function(e){var r=this,n=r.get("graph"),i=n.getNodes(),a={},o=r.get("r"),s=r.get("type"),d={x:e.x,y:e.y};r.updateDelegate(d,o);var y=r.get("shouldShow"),C=r.get("vShapes");C&&C.forEach(function(ce){ce.remove(),ce.destroy()}),C=[],i.forEach(function(ce){var de=ce.getModel(),xe=de.x,Ie=de.y;Fn({x:xe,y:Ie},d)<o&&(a[de.id]=ce)});var F=n.getEdges(),G=[];F.forEach(function(ce){var de=ce.getModel(),xe=de.source,Ie=de.target;y(de)&&(s==="only-source"||s==="one"?a[xe]&&!a[Ie]&&G.push(ce):s==="only-target"||s==="one"?a[Ie]&&!a[xe]&&G.push(ce):s==="both"&&a[xe]&&a[Ie]&&G.push(ce))});var H=r.get("showNodeLabel"),ie=r.get("showEdgelabel"),se=n.get("group");G.forEach(function(ce){var de=ce.get("group").get("children");de.forEach(function(xe){var Ie=xe.get("type"),qe=se.addShape(Ie,{attrs:xe.attr()});C.push(qe),H&&Ie==="text"&&qe.set("visible",!0)})}),Object.keys(a).forEach(function(ce){var de=a[ce],xe=de.get("group").clone();if(se.add(xe),C.push(xe),ie)for(var Ie=xe.get("children"),qe=0;qe<Ie.length;qe++){var ze=Ie[qe];ze.get("type")==="text"&&ze.set("visible",!0)}}),r.set("vShapes",C)},t.prototype.updateParams=function(e){var r=this,n=e.r,i=e.trigger,a=e.minR,o=e.maxR,s=e.scaleRBy,d=e.showLabel,y=e.shouldShow;if(isNaN(e.r)||r.set("r",n),isNaN(o)||r.set("maxR",o),isNaN(a)||r.set("minR",a),(i==="mousemove"||i==="click")&&r.set("trigger",i),s==="wheel"||s==="unset"){r.set("scaleRBy",s),r.get("delegate").remove(),r.get("delegate").destroy();var C=r.get("dPercentText");C&&(C.remove(),C.destroy())}(d==="node"||d==="both")&&r.set("showNodeLabel",!0),(d==="edge"||d==="both")&&r.set("showEdgeLabel",!0),y&&r.set("shouldShow",y)},t.prototype.updateDelegate=function(e,r){var n=this,i=n.get("graph"),a=n.get("delegate");if(!a||a.destroyed){var o=i.get("group"),s=n.get("delegateStyle")||_i;a=o.addShape("circle",{attrs:En({r,x:e.x,y:e.y},s),name:"lens-shape",draggable:!0}),this.get("trigger")!=="drag"&&this.get("scaleRBy")==="wheel"&&a.on("mousewheel",function(d){n.scaleRByWheel(d)})}else a.attr({x:e.x,y:e.y,r});n.set("delegate",a)},t.prototype.clear=function(){var e=this,r=e.get("vShapes");r&&r.forEach(function(i){i.remove(),i.destroy()}),r=[],e.set("vShapes",r);var n=e.get("delegate");n&&!n.destroyed&&(n.remove(),n.destroy())},t.prototype.destroy=function(){this.clear()},t}(fo),lo=ra,$l=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Zo=Eo.pointLineDistance,gd={stroke:"#FA8C16",lineWidth:1},xo=function(h){$l(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{line:gd,itemAlignType:"center",tolerance:5,horizontalLines:{},verticalLines:{},alignLines:[]}},t.prototype.init=function(){},t.prototype.getEvents=function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd"}},t.prototype.onDragStart=function(){this.initBoxLine()},t.prototype.onDrag=function(e){var r=e.item,n=r.get("delegateShape")||r,i=n.getBBox(),a=r.getModel(),o=a.x-i.x,s=a.y-i.y;this.show({x:i.minX+o,y:i.minY+s},{width:i.width,height:i.height})},t.prototype.onDragEnd=function(){this.destory()},t.prototype.initBoxLine=function(){var e=this._cfgs,r=e.horizontalLines,n=e.verticalLines,i=e.itemAlignType,a=this.get("graph"),o=a.getNodes();o.forEach(function(s){var d=s.getBBox(),y=s.get("id");i===!0||i==="horizontal"?(r["".concat(y,"tltr")]=[d.minX,d.minY,d.maxX,d.minY,s],r["".concat(y,"lcrc")]=[d.minX,d.centerY,d.maxX,d.centerY,s],r["".concat(y,"blbr")]=[d.minX,d.maxY,d.maxX,d.maxY,s]):i==="center"&&(r["".concat(y,"lcrc")]=[d.minX,d.centerY,d.maxX,d.centerY,s]),i===!0||i==="vertical"?(n["".concat(y,"tlbl")]=[d.minX,d.minY,d.minX,d.maxY,s],n["".concat(y,"tcbc")]=[d.centerX,d.minY,d.centerX,d.maxY,s],n["".concat(y,"trbr")]=[d.maxX,d.minY,d.maxX,d.maxY,s]):i==="center"&&(n["".concat(y,"tcbc")]=[d.centerX,d.minY,d.centerX,d.maxY,s])})},t.prototype.show=function(e,r){var n=(0,_.mix)({},e);return this.itemAlign(e,r,n),e},t.prototype.itemAlign=function(e,r,n){var i=this,a=this._cfgs,o=a.horizontalLines,s=a.verticalLines,d=a.tolerance,y={x:n.x+r.width/2,y:n.y},C={x:n.x+r.width/2,y:n.y+r.height/2},F={x:n.x+r.width/2,y:n.y+r.height},G={x:n.x,y:n.y+r.height/2},H={x:n.x+r.width,y:n.y+r.height/2},ie=[],se=[],ce=null;if(this.clearAlignLine(),(0,_.each)(o,function(xe){xe[4].isVisible&&(ie.push(i.getLineDisObject(xe,y)),ie.push(i.getLineDisObject(xe,C)),ie.push(i.getLineDisObject(xe,F)))}),(0,_.each)(s,function(xe){xe[4].isVisible&&(se.push(i.getLineDisObject(xe,G)),se.push(i.getLineDisObject(xe,C)),se.push(i.getLineDisObject(xe,H)))}),ie.sort(function(xe,Ie){return xe.dis-Ie.dis}),se.sort(function(xe,Ie){return xe.dis-Ie.dis}),ie.length!==0&&ie[0].dis<d){e.y=ie[0].line[1]-ie[0].point.y+n.y,ce={type:"item",horizontals:[ie[0]]};for(var de=1;de<3;de++)ie[0].dis===ie[de].dis&&ce.horizontals.push(ie[de])}if(se.length!==0&&se[0].dis<d){e.x=se[0].line[0]-se[0].point.x+n.x,ce?ce.verticals=[se[0]]:ce={type:"item",verticals:[se[0]]};for(var de=1;de<3;de++)se[0].dis===se[de].dis&&ce.verticals.push(se[de])}ce&&(ce.bbox=r,this.addAlignLine(ce))},t.prototype.addAlignLine=function(e){var r=e.bbox,n=e.type,i=e.horizontals,a=e.verticals,o=this._cfgs,s=o.line,d=o.alignLines,y=this.get("graph"),C=y.get("group");n==="item"&&(i&&(0,_.each)(i,function(F){var G=F.line,H=F.point,ie=(G[0]+G[2])/2,se,ce;H.x<ie?(se=H.x-r.width/2,ce=Math.max(G[0],G[2])):(se=H.x+r.width/2,ce=Math.min(G[0],G[2]));var de=(0,_.mix)({x1:se,y1:G[1],x2:ce,y2:G[1]},s),xe=C.addShape("line",{attrs:de,capture:!1});d.push(xe)}),a&&(0,_.each)(a,function(F){var G=F.line,H=F.point,ie=(G[1]+G[3])/2,se,ce;H.y<ie?(se=H.y-r.height/2,ce=Math.max(G[1],G[3])):(se=H.y+r.height/2,ce=Math.min(G[1],G[3]));var de=(0,_.mix)({x1:G[0],y1:se,x2:G[0],y2:ce},s),xe=C.addShape("line",{attrs:de,capture:!1});d.push(xe)}))},t.prototype.getLineDisObject=function(e,r){return{line:e,point:r,dis:Zo(e,r)}},t.prototype.getContainer=function(){return this.get("container")},t.prototype.clearAlignLine=function(){var e=this._cfgs.alignLines;(0,_.each)(e,function(r){r.remove()}),e.length=0},t.prototype.destory=function(){var e=this._cfgs,r=e.horizontalLines,n=e.verticalLines,i=this.get("graph"),a=i.getNodes();a.forEach(function(o){var s=o.get("id");delete r["".concat(s,"tltr")],delete r["".concat(s,"lcrc")],delete r["".concat(s,"blbr")],delete n["".concat(s,"tlbl")],delete n["".concat(s,"tcbc")],delete n["".concat(s,"trbr")]}),this.clearAlignLine()},t}(fo),yd=xo,ah=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),ga=function(){return ga=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},ga.apply(this,arguments)},oh=["click","mouseenter"],Qh=function(h){ah(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{data:{},position:"top",padding:8,margin:8,offsetX:0,offsetY:0,layout:"horizontal",flipPage:!1,containerStyle:{},align:void 0,horiSep:8,vertiSep:8,filter:{enable:!1,trigger:"click"}}},t.prototype.init=function(){this.formatArray("padding"),this.formatArray("margin");var e=this.get("filter")||{},r=e.multiple;r&&e.trigger==="mouseenter"&&this.set("multiple",!1);var n=this.get("align");if(!n){var i=this.get("position").split("-");i.includes("left")&&(n="left"),i.includes("right")?n="right":n="center",this.set("align",n)}var a=this.get("graph"),o=a.get("container"),s=(0,Di.Z)(`<div class='g6-legend-container' style="position: absolute;"></div>`);o.appendChild(s),this.set("container",s);var d=this.render();(0,Qn.Z)(s,this.getContainerPos(d)),this.bindEvents()},t.prototype.getContainerPos=function(e){e===void 0&&(e=[0,0]);var r=this,n=r.get("graph"),i=this.get("offsetX"),a=this.get("offsetY"),o=this.get("margin"),s=this.get("position").split("-"),d={top:0,right:1,bottom:2,left:3},y=0,C=0,F={left:(n.getWidth()-e[0])/2+y,top:(n.getHeight()-e[1])/2+C};return s.forEach(function(G){var H=o[d[G]],ie=G;switch(G){case"top":H+=C;break;case"left":H+=y;break;case"bottom":H=n.getHeight()-e[1]-H+C,ie="top";break;default:H=n.getWidth()-e[0]-H+y,ie="left";break}F[ie]=H}),F.top+=a+n.getContainer().offsetTop,F.left+=i+n.getContainer().offsetLeft,Object.keys(F).forEach(function(G){F[G]="".concat(F[G],"px")}),F},t.prototype.bindEvents=function(){var e=this,r=e.get("filter");if(!(!r||!r.enable)){var n=r.trigger||"click";oh.includes(n)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),n="click");var i=e.get("legendCanvas");n==="mouseenter"?(i.on("node-container:mouseenter",function(a){return e.filterData(a)}),i.on("node-container:mouseleave",function(a){e.clearFilter(),e.clearActiveLegend()})):(i.on("node-container:click",function(a){return e.filterData(a)}),i.on("click",function(a){a.target&&a.target.isCanvas&&a.target.isCanvas()&&(e.clearFilter(),e.clearActiveLegend())}))}},t.prototype.changeData=function(e){this.set("data",e);var r=this.render();(0,Qn.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 i=e.get("parent");i.get("active")?(i.set("active",!1),this.findLegendItemsByState("active").length&&i.set("inactive",!0)):(i.set("inactive",!1),i.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach(function(C){C.set("inactive",!0)}):this.clearActiveLegend();var a=(r==null?void 0:r.legendStateStyles)||{},o=(a==null?void 0:a.inactive)||{opacity:.5,"text-shape":{opacity:.5}},s=o["text-shape"]||{};this.findLegendItemsByState("inactive").forEach(function(C){var F=C.get("children"),G=F[0],H=F[1];G.attr(ga(ga({},G.get("oriAttrs")),o)),H.attr(ga(ga({},H.get("oriAttrs")),s))});var d=(a==null?void 0:a.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},y=d["text-shape"]||{};this.findLegendItemsByState("active").forEach(function(C){var F=C.get("children"),G=F[0],H=F[1];G.attr(ga(ga({},G.get("oriAttrs")),d)),H.attr(ga(ga({},H.get("oriAttrs")),y))})},t.prototype.findLegendItemsByState=function(e,r,n){r===void 0&&(r="all"),n===void 0&&(n=!0);var i=this.get("legendCanvas").find(function(s){return s.get("name")==="root"}),a=i.find(function(s){return s.get("name")==="node-group"}),o=i.find(function(s){return s.get("name")==="edge-group"});return r==="node"?a.get("children").filter(function(s){return!!s.get(e)===n}):r==="edge"?o.get("children").filter(function(s){return!!s.get(e)===n}):a.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(i){return i.get("name")==="root"}),n=[r.find(function(i){return i.get("name")==="node-group"}),r.find(function(i){return i.get("name")==="edge-group"})];n.forEach(function(i){i.get("children").forEach(function(a){a.set("active",!1),a.set("inactive",!1);var o=a.get("children"),s=o[0],d=o[1];s.attr(s.get("oriAttrs")),d.attr(d.get("oriAttrs"))})})},t.prototype.filterData=function(e){var r=this.get("filter"),n=r==null?void 0:r.filterFunctions;if(!(!r||!n)){var i=this.get("legendCanvas"),a=this.get("graph"),o=r.graphActiveState||"active",s=r.graphInactiveState||"inactive",d=r.multiple;this.clearFilter(),d||this.clearActiveLegend(),this.activateLegend(e.target);var y=i.find(function(ce){return ce.get("name")==="root"}),C=y.find(function(ce){return ce.get("name")==="node-group"}),F=y.find(function(ce){return ce.get("name")==="edge-group"}),G=C.get("children").filter(function(ce){return ce.get("active")}),H=F.get("children").filter(function(ce){return ce.get("active")}),ie=0,se=["getNodes","getEdges"];se.forEach(function(ce){a[ce]().forEach(function(de){var xe=!1,Ie=ce==="getNodes"?G:H;Ie.forEach(function(qe){var ze=n[qe.get("id")];xe=xe||ze(de.getModel())}),xe?(a.setItemState(de,s,!1),a.setItemState(de,o,!0),ie++):(a.setItemState(de,o,!1),a.setItemState(de,s,!0))})}),ie||se.forEach(function(ce){a[ce]().forEach(function(de){a.clearItemStates(de,[s])})})}},t.prototype.clearFilter=function(){var e=this.get("graph"),r=this.get("filter");if(!!r){var n=r.graphActiveState||"active",i=r.graphInactiveState||"inactive";e.getNodes().forEach(function(a){e.clearItemStates(a,[n,i])}),e.getEdges().forEach(function(a){e.clearItemStates(a,[n,i])})}},t.prototype.render=function(){var e=this;this.processData();var r=this.get("legendCanvas");r?r.clear():r=new fs.Canvas({container:this.get("container"),width:200,height:200});var n=r.addGroup({name:"root"}),i=n.addGroup({name:"node-group"}),a=n.addGroup({name:"edge-group"});this.set("legendCanvas",r);var o=this.get("itemsData"),s=["nodes","edges"],d=[i,a];s.forEach(function(Or,hn){o[Or].forEach(function(sn){var Ir,en=d[hn].addGroup({id:sn.id,name:"node-container"}),un,fn=sn.type,pn=e.getShapeSize(sn),Tn=pn.width,Zn=pn.height,ii=pn.r,xi=e.getStyle(Or.substr(0,4),sn);switch(sn.type){case"circle":un={r:ii,x:0,y:0};break;case"rect":un={width:Tn,height:Zn,x:-Tn/2,y:-Zn/2};break;case"ellipse":un={r1:Tn,r2:Zn,x:0,y:0};break;case"line":un={x1:-Tn/2,y1:0,x2:Tn/2,y2:0},fn="line";break;case"quadratic":un={path:[["M",-Tn/2,0],["Q",0,Tn/2,Tn/2,0]]},fn="path";break;case"cubic":un={path:[["M",-Tn/2,0],["C",-Tn/6,Tn/2,Tn/6,-Tn/2,Tn/2,0]]},fn="path";break;default:un={r:ii,x:0,y:0};break}var ui=en.addShape(fn,{attrs:ga(ga({},un),xi),name:"".concat(sn.type,"-node-keyShape"),oriAttrs:ga({opacity:1},xi)});if(sn.label){var ji=ui.getBBox(),Gi=((Ir=sn.labelCfg)===null||Ir===void 0?void 0:Ir.style)||{},Ta=ga({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},Gi);en.addShape("text",{attrs:ga({x:ji.maxX+4,y:0,text:sn.label},Ta),className:"legend-label",name:"".concat(sn.type,"-node-text"),oriAttrs:Ta})}})});var y=this.get("padding"),C,F=n.find(function(Or){return Or.get("name")==="title-container"}),G={height:0,maxY:0,width:0};if(this.get("title")){F||(F=n.addGroup({name:"title-container"}));var H={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:y[0]},ie=this.get("titleConfig")||{},se=Object.assign(H,ie.style||{});C=F.addShape("text",{attrs:ga({text:this.get("title")},se)}),G=F.getCanvasBBox(),F.setMatrix([1,0,0,0,1,0,ie.offsetX,ie.offsetY,1])}this.layoutItems();var ce=n.getCanvasBBox(),de=i.getCanvasBBox(),xe=de.minX<0?Math.abs(de.minX)+y[3]:y[3],Ie=G.maxY<de.minY?Math.abs(G.maxY-de.minY)+y[0]:G.maxY+y[0],qe=[1,0,0,0,1,0,xe,Ie,1];i.setMatrix(qe),ce=n.getCanvasBBox();var ze=[ce.minX+ce.width+y[1],ce.minY+ce.height+y[2]];if(C){var ie=ga({position:"center",offsetX:0,offsetY:0},this.get("titleConfig"));G=F.getCanvasBBox();var $e=F.getMatrix()||[1,0,0,0,1,0,0,0,1];ie.position==="center"?$e[6]=ze[0]/2+ie.offsetX:ie.position==="right"?($e[6]=ze[0]-y[3]+ie.offsetX,C.attr({textAlign:"right"})):($e[6]=y[3]+ie.offsetX,C.attr({textAlign:"left"})),F.setMatrix($e),G=F.getCanvasBBox(),xe=de.minX<0?Math.abs(de.minX)+y[3]:y[3],Ie=de.minY<G.maxY?Math.abs(G.maxY-de.minY)+y[0]:G.maxY+y[0],qe=[1,0,0,0,1,0,xe,Ie,1],i.setMatrix(qe);var mt=[1,0,0,0,1,0,xe,Ie,1];this.get("layout")==="vertical"?mt[6]+=de.maxX+this.get("horiSep"):mt[7]+=de.maxY+this.get("vertiSep"),a.setMatrix(mt)}else{de=i.getCanvasBBox();var xt=[1,0,0,0,1,0,0,0,1];this.get("layout")==="vertical"?xt[6]+=qe[6]+de.maxX+this.get("horiSep"):xt[7]+=qe[7]+de.maxY+this.get("vertiSep"),a.setMatrix(xt)}ce=n.getCanvasBBox(),de=i.getCanvasBBox(),qe=i.getMatrix()||[1,0,0,0,1,0,0,0,1];var wt=a.getMatrix()||[1,0,0,0,1,0,0,0,1],Yt=a.getCanvasBBox();ze=[Math.max(de.width+qe[6],Yt.width+wt[6])+y[1],Math.max(de.height+qe[7],Yt.height+wt[7])+y[2]],r.changeSize(ze[0],ze[1]);var Zt=this.get("containerStyle"),Er=n.getMatrix()||[1,0,0,0,1,0,0,0,1],Fr=Eo.invertMatrix({x:0,y:0},Er),Ur=n.addShape("rect",{attrs:ga({x:Fr.x+(Zt.lineWidth||1),y:Fr.y+(Zt.lineWidth||1),width:ze[0]-2*(Zt.lineWidth||1),height:ze[1]-2*(Zt.lineWidth||1),fill:"#f00",stroke:"#000",lineWidth:1,opacity:.5},Zt),name:"legend-back-rect",capture:!1});return Ur.toBack(),ze},t.prototype.layoutItems=function(){var e=this.get("legendCanvas"),r=this.get("horiSep"),n=this.get("vertiSep"),i=this.get("layout"),a=this.get("align"),o=[0,0],s=e.find(function(Ie){return Ie.get("name")==="root"}),d=s.find(function(Ie){return Ie.get("name")==="node-group"}),y=s.find(function(Ie){return Ie.get("name")==="edge-group"}),C={min:0,max:-Infinity},F=-Infinity;d.get("children").forEach(function(Ie,qe){qe===0&&(C.min=o[0]);var ze=Ie.get("children")[0],$e=Ie.getCanvasBBox(),mt=ze.getBBox(),xt=mt.width,wt=mt.height,Yt=0,Zt=0,Er=0;i==="vertical"?(Zt=o[1],Er=o[0]+xt/2,o[0]=Er+$e.height+n,Yt=$e.maxX+Zt+xt/2):(Zt=o[0]+xt/2,Er=o[1],o[0]=Zt+$e.width+r,Yt=$e.maxY+Er+wt/2),o[0]>C.max&&(C.max=o[0]),Yt>F&&(F=Yt),Ie.setMatrix([1,0,0,0,1,0,Zt,Er,1])});var G=C.max-C.min,H={min:0,max:-Infinity},ie=d.getCanvasBBox();o[0]=0,o[1]=i==="vertical"?ie.maxX+r:ie.maxY+n,y.get("children").forEach(function(Ie,qe){qe===0&&(H.min=o[0]);var ze=Ie.get("children")[0],$e=Ie.getCanvasBBox(),mt=ze.getBBox(),xt=mt.width,wt=mt.height,Yt=0,Zt=0;i==="vertical"?(Yt=o[1],Zt=o[0],o[0]=Zt+$e.height+n,Ie.setMatrix([1,0,0,0,1,0,0,Zt+wt/2,1])):(Yt=o[0],Zt=o[1],o[0]=Yt+$e.width+r,Ie.setMatrix([1,0,0,0,1,0,Yt+xt/2,0,1])),o[0]>H.max&&(H.max=o[0])});var se=H.max-H.min;if(a&&a!==""&&a!=="left"){var ce=G-se,de=a==="center"?Math.abs(ce)/2:Math.abs(ce),xe=ce<0?d:y;xe.get("children").forEach(function(Ie){var qe=Ie.getMatrix()||[1,0,0,0,1,0,0,0,1];i==="vertical"?qe[7]+=de:qe[6]+=de,Ie.setMatrix(qe)})}},t.prototype.processData=function(){var e=this.get("data"),r={nodes:[],edges:[]};e.nodes&&(e.nodes.sort(function(n,i){return n.order-i.order}),e.nodes.forEach(function(n){var i,a,o,s,d,y=n.size||[((i=n.style)===null||i===void 0?void 0:i.width)||((a=n.style)===null||a===void 0?void 0:a.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],C=((d=n.labelCfg)===null||d===void 0?void 0:d.style)||{};r.nodes.push({id:n.id||(0,_.uniqueId)(),type:n.type||"circle",style:ga({},n.style),order:n.order,label:n.label,itemType:"node",size:y,labelCfg:{position:"right",style:ga({fontFamily:"Arial"},C)}})})),e.edges&&(e.edges.sort(function(n,i){return n.order-i.order}),e.edges.forEach(function(n){var i,a,o=n.type||"line";n.type==="cubic-horizontal"&&(o="cubic");var s=((i=n.labelCfg)===null||i===void 0?void 0:i.style)||{},d=n.size||[((a=n.style)===null||a===void 0?void 0:a.width)||8,1];r.edges.push({id:n.id||(0,_.uniqueId)(),type:o,size:d,style:ga({lineWidth:(0,_.isArray)(d)?d[1]:1},n.style),order:n.order,label:n.label,itemType:"edge",labelCfg:{position:"right",style:ga({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,_.isNumber)(r))this.set(e,[r,r,r,r]);else if((0,_.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,i;return e.size&&((0,_.isArray)(e.size)?(r=e.size[0],n=e.size[1]||e.size[0],i=e.size[0]/2):(0,_.isNumber)(e.size)&&(r=e.size,n=e.size,i=e.size/2)),e.style&&(e.style.width&&(r=e.style.width),e.style.height&&(n=e.style.height),e.style.r&&(i=e.style.r)),i||(i=5),r||(r=i),n||(n=i),{width:r,height:n,r:i}},t.prototype.getStyle=function(e,r){var n=e==="node"?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1};return ga(ga({},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"),i=this.get("container");n.removeChild(i)},t}(fo),Jh=Qh,qh=function(){var h=function(e,r){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),eu=function(){return eu=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},eu.apply(this,arguments)},sh=function(h,t){var e={};for(var r in h)Object.prototype.hasOwnProperty.call(h,r)&&t.indexOf(r)<0&&(e[r]=h[r]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(h);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(h,r[n])&&(e[r[n]]=h[r[n]]);return e};typeof document!="undefined"&&Yu()(`
  144. .g6-annotation-container {
  145. background-color: rgba(255, 255, 255, 0.3);
  146. padding: 8px;
  147. }
  148. .g6-annotation-wrapper {
  149. background-color: #fff;
  150. box-shadow: 0 0 8px rgba(0, 0, 0, 0.85);
  151. }
  152. .g6-annotation-header-wapper {
  153. height: fit-content;
  154. width: 100%;
  155. background-color: #5B8FF9;
  156. display: inline-flex;
  157. cursor: move;
  158. }
  159. .g6-annotation-title {
  160. margin: 4px 40px 4px 8px;
  161. cursor: text;
  162. min-width: 32px;
  163. }
  164. .g6-annotation-collapse {
  165. margin: 4px;
  166. cursor: pointer;
  167. }
  168. .g6-annotation-expand {
  169. margin: 4px;
  170. cursor: pointer;
  171. }
  172. .g6-annotation-close {
  173. margin: 4px 8px 4px 0;
  174. cursor: pointer;
  175. }
  176. .g6-annotation-content {
  177. padding: 8px;
  178. width: fit-content;
  179. cursor: text;
  180. word-break: break-all;
  181. min-width: 32px;
  182. }
  183. .g6-annotation-title-input-wrapper {
  184. margin: 4px 40px 4px 8px;
  185. }
  186. .g6-annotation-content-input {
  187. height: 100%;
  188. word-break: break-all;
  189. }
  190. .g6-annotation-content-input-wrapper {
  191. margin: 8px;
  192. height: 100%;
  193. }
  194. `);var xd=function(h){qh(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{trigger:"click",editable:!0,itemHighlightState:"highlight",linkHighlightStyle:{shadowColor:"#5B8FF9",shadowBlur:10},cardCfg:{minHeight:60,width:"fit-content",height:"fit-content",collapseType:"minimize",closeType:"hide",borderRadius:5,maxTitleLength:20}}},t.prototype.getEvents=function(){var e={viewportchange:"updateLinks",afterlayout:"updateLinks",aftergraphrefreshposition:"updateLinks",afterupdateitem:"updateLink",afterchangedata:"onGraphDataChange",afteritemvisibilitychange:"onGraphItemVisibilityChange"};switch(this.get("trigger")){case"click":e=eu(eu({},e),{"node:click":"showAnnotation","edge:click":"showAnnotation"})}return e},t.prototype.getDOMContent=function(e){if(!this.destroyed){var r=e.collapsed,n=e.maxWidth,i=e.title,a=i===void 0?"":i,o=e.content,s=o===void 0?"":o,d=e.borderRadius,y=d===void 0?5:d,C=r?"<p class='g6-annotation-expand'>+</p>":"<p class='g6-annotation-collapse'>-</p>",F=r?"":" <p class='g6-annotation-content'>".concat(s,"</p>"),G="<p class='g6-annotation-close'>x</p>",H=r?"".concat(y,"px"):"".concat(y,"px ").concat(y,"px 0 0");return'<div class="g6-annotation-wrapper" style="border-radius: '.concat(y,"px; max-width: ").concat(n,`px">
  195. <div
  196. class="g6-annotation-header-wapper"
  197. style="border-radius: `).concat(H,`;"
  198. >
  199. <h4 class='g6-annotation-title'>`).concat(a,`</h4>
  200. `).concat(C,`
  201. `).concat(G,`
  202. </div>
  203. `).concat(F,`
  204. </div>`)}},t.prototype.init=function(){var e=this;if(!e.destroyed){var r=e.get("graph"),n=r.getContainer(),i=e.get("container"),a=this.get("containerCfg");a?(i=this.createContainer(),n.appendChild(i)):i=n,this.set("container",i);var o=n.getBoundingClientRect(),s=new fs.Canvas({container:n,width:o.right-o.left,height:o.bottom-o.top});(0,Qn.Z)(s.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",(0,_.debounce)(function(){return e.resizeCanvas(e)},100));var d=s.addGroup({id:"annotation-link-group"});e.set("linkGroup",d),e.set("canvas",s),e.get("getTitle")||e.set("getTitle",function(C){var F,G=((F=C==null?void 0:C.getModel)===null||F===void 0?void 0:F.call(C))||{},H=G.label,ie=G.id;return H||ie||"-"}),e.get("getContent")||e.set("getContent",function(C){var F,G;if(!C)return"-";var H=((F=C.getModel)===null||F===void 0?void 0:F.call(C))||{},ie=H.label,se=H.id,ce=(G=C.getType)===null||G===void 0?void 0:G.call(C),de=ce?"".concat(ce,": "):"";return"".concat(de).concat(ie||se||"")});var y=e.get("defaultData");y&&this.readData(y)}},t.prototype.createContainer=function(){var e=this;if(!this.destroyed){var r=this.get("containerCfg"),n=this.get("graph"),i=n.getContainer(),a=i.getBoundingClientRect(),o=a.left,s=a.right,d=a.top,y=a.bottom,C=y-d,F=s-o,G=r.position,H=G===void 0?"top":G,ie=r.offsetX,se=ie===void 0?0:ie,ce=r.offsetY,de=ce===void 0?0:ce,xe=sh(r,["position","offsetX","offsetY"]),Ie=r.height,qe=Ie===void 0?"fit-content":Ie,ze=r.width,$e=ze===void 0?n.getWidth():ze;qe==="100%"&&(qe=C),$e==="100%"&&($e=F);var mt="unset",xt="unset",wt={};switch(H){case"right":mt="".concat(C,"px"),wt={top:0,right:0},wt.right+=o+se,wt.top+=d+de;break;case"bottom":xt="".concat(F,"px"),wt={bottom:0,left:0},wt.left+=o+se,wt.bottom+=d+de;break;case"top":xt="".concat(F,"px");case"left":mt="".concat(C,"px");default:wt={top:0,left:0},wt.left+=o+se,wt.top+=d+de;break}Object.keys(wt).forEach(function(Zt){wt[Zt]="".concat(wt[Zt],"px")});var Yt=(0,Di.Z)("<div class='".concat(r.className," g6-annotation-container'></div>"));return(0,Qn.Z)(Yt,eu(eu({position:"absolute",display:H==="top"||H==="bottom"?"inline-flex":"unset",width:(0,_.isNumber)($e)?"".concat($e,"px"):$e,height:(0,_.isNumber)(qe)?"".concat(qe,"px"):qe,maxHeight:mt,maxWidth:xt,overflow:"scroll"},wt),xe)),i.appendChild(Yt),Yt.addEventListener("scroll",function(Zt){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,i=r.bottom-r.top;e.get("canvas").changeSize(n,i),e.updateOutsideCards(e)}},250)},t.prototype.updateOutsideCards=function(e){var r=e.get("cardInfoMap")||{},n=e.get("graph"),i=n.getPointByCanvas(0,0),a=n.getPointByCanvas(n.getWidth(),n.getHeight()),o=n.getClientByPoint(i.x,i.y),s=o.x,d=o.y,y=n.getClientByPoint(a.x,a.y),C=y.x,F=y.y;Object.values(r).forEach(function(G){var H=G.card;if(!!H){var ie=H.style,se=rl(ie.left),ce=rl(ie.top),de=H.getBoundingClientRect(),xe=de.width,Ie=de.height,qe=se,ze=ce;se+xe>C-s&&(qe=C-s-xe),se<0&&(qe=0),ce+Ie>F-d&&(ze=F-d-Ie),ce<0&&(ze=0),(0,Qn.Z)(H,{left:"".concat(qe,"px"),top:"".concat(ze,"px")})}}),e.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;r===void 0&&(r={});var i=this;if(!i.destroyed){var a=i.get("cardInfoMap")||{},o=i.get("graph"),s=i.get("container"),d=i.get("containerCfg"),y=Object.assign({},i.get("cardCfg")||{},r),C=y.minHeight,F=y.minWidth,G=y.width,H=y.height,ie=y.collapsed,se=ie===void 0?!1:ie,ce=y.x,de=y.y,xe=y.title,Ie=y.content,qe=y.maxTitleLength,ze=y.defaultBegin,$e=sh(y,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),mt=i.get("linkGroup"),xt=this.get("rows")||[[]],wt=(n=e.isCanvas)===null||n===void 0?void 0:n.call(e),Yt=wt?"canvas-annotation":e.getID(),Zt=a[Yt]||{},Er=Zt.card,Fr=Zt.link,Ur=Zt.x,Or=Zt.y,hn=Zt.title,sn=Zt.content,Ir=this.get("getTitle"),en=this.get("getContent"),un=(0,Di.Z)(this.getDOMContent(eu({itemId:Yt,collapsed:se,title:(hn||xe||(Ir==null?void 0:Ir(e))).substr(0,qe),content:sn||Ie||(en==null?void 0:en(e))},$e))),fn=(0,_.isNumber)(C)?"".concat(C,"px"):C;(0,Qn.Z)(un,{minHeight:se?"unset":fn,minWidth:(0,_.isNumber)(F)?"".concat(F,"px"):F,height:H,width:G});var pn=!!Er;pn?(Fr==null||Fr.remove(!0),s.replaceChild(un,Er)):s.appendChild(un);var Tn;if(!d){if(Tn=s.getBoundingClientRect()||{},ce!==void 0&&de!==void 0)Ur=ce,Or=de;else if(!pn&&!wt){var Zn=Tn.top,ii=ze||{},xi=ii.left,ui=ii.right,ji=ui===void 0?16:ui,Gi=ii.top,Ta=Gi===void 0?8:Gi,Fi=ii.bottom,ya=ji,ma=Ta;isNaN(xi)||(ya=s.scrollWidth-xi),isNaN(Fi)||(ma=s.scrollHeight-Fi);var So=(0,_.isNumber)(F)?F:100;Ur=s.scrollWidth-un.scrollWidth-(xt.length-1)*So-ya;var Qi=xt[xt.length-1],Ui=(Qi[Qi.length-1]||{}).bbox;Or=(Ui==null?void 0:Ui.bottom)-Zn||ma}(0,Qn.Z)(un,{position:"absolute",left:"".concat(Ur,"px"),top:"".concat(Or,"px"),cusor:d?"unset":"move"})}this.bindListener(un,Yt);var ja=un.getBoundingClientRect();if(!wt){var Va=tl(e,ja,o,this.get("canvas")),Ko=this.get("linkStyle");Fr=mt.addShape("path",{attrs:eu({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:Va},Ko)})}if(a[Yt]=eu(eu({},a[Yt]||{}),{id:Yt,collapsed:se,card:un,link:Fr,x:Ur,y:Or,cardBBox:ja,content:sn||Ie,title:hn||xe,isCanvas:wt}),i.set("cardInfoMap",a),d)this.updateCardPositionsInConatainer(),this.updateLinks();else{var bi=!isNaN(ce)&&!isNaN(de);if(!pn&&!wt&&!bi){var Si=Tn.bottom,Ci=Si===void 0?0:Si,Zn=Tn.top;xt[xt.length-1].push({id:Yt,bbox:ja}),ja.top>Ci-Zn-ja.height-16&&xt.push([]),this.set("rows",xt)}}this.updateCardSize(Yt);var Ni=this.get("onAnnotationChange");Ni==null||Ni(a[Yt],pn?"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,i=r.getBoundingClientRect().width,a=getComputedStyle(r),o=rl(a.paddingLeft)+rl(a.paddingRight);i-=o,Object.values(e).forEach(function(s){var d=s.card,y=d.getBoundingClientRect().width;switch(n){case"right":(0,Qn.Z)(d,{marginLeft:i?"".concat(i-y,"px"):"0px"});break;case"top":case"bottom":(0,Qn.Z)(d,{marginLeft:"8px"});default:break}})}}},t.prototype.handleExpandCollapseCard=function(e){if(!this.destroyed){var r=this.get("graph"),n=this.get("cardInfoMap");if(!!n){var i=n[e].collapsed,a=r.findById(e);if(!!a){var o=this.get("cardCfg").collapseType;o==="hide"&&!i?this.hideCard(e):this.toggleAnnotation(a,{collapsed:!i}),n[e]=eu(eu({},n[e]),{collapsed:!i})}}}},t.prototype.hideCard=function(e){if(!this.destroyed){var r=this.get("cardInfoMap");if(!!r){var n=r[e],i=n.card,a=n.link;(0,Qn.Z)(i,{display:"none"}),a==null||a.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],i=n.card,a=n.link,o=this.get("container");o.removeChild(i),a==null||a.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 d;if(s.target.className==="g6-annotation-collapse"?d="collapse":s.target.className==="g6-annotation-expand"?d="expand":s.target.className==="g6-annotation-close"&&(d="close"),d){var y=n.get("cardCfg").onMouseEnterIcon,C=y===void 0?function(){}:y;C(s,r,d)}}),e.addEventListener("mouseout",function(s){var d;if(s.target.className==="g6-annotation-collapse"?d="collapse":s.target.className==="g6-annotation-expand"?d="expand":s.target.className==="g6-annotation-close"&&(d="close"),d){var y=n.get("cardCfg").onMouseLeaveIcon,C=y===void 0?function(){}:y;C(s,r,d)}}),e.addEventListener("mouseenter",function(s){var d=n.get("cardInfoMap");if(!!d){var y=n.get("graph"),C=y.findById(r);if(C){var F=n.get("itemHighlightState");y.setItemState(C,F,!0)}var G=d[r].link;if(G){var H=n.get("linkHighlightStyle")||{};G.attr(H)}}}),e.addEventListener("mouseleave",function(s){var d=n.get("cardInfoMap");if(!!d){var y=n.get("graph"),C=y.findById(r);if(C){var F=n.get("itemHighlightState");y.setItemState(C,F,!1)}var G=d[r].link;if(G){var H=n.get("linkHighlightStyle")||{};Object.keys(H).forEach(function(se){G.attr(se,void 0),G.attr(se,void 0)});var ie=n.get("linkStyle");G.attr(ie)}}}),e.addEventListener("click",function(s){var d=(n.get("cardCfg")||{}).onClickIcon;if(s.target.className==="g6-annotation-collapse"||s.target.className==="g6-annotation-expand"){var y=n.get("cardCfg").collapseType;y==="hide"?n.hideCard(r):n.handleExpandCollapseCard(r),d==null||d(s,r,s.target.className==="g6-annotation-collapse"?"collapse":"expand")}else if(s.target.className==="g6-annotation-close"){var C=n.get("cardCfg").closeType;C==="remove"?n.removeCard(r):n.hideCard(r),d==null||d(s,r,"close")}});var i=this.get("editable");i&&e.addEventListener("dblclick",function(s){var d=n.get("cardInfoMap"),y=(n.get("cardCfg")||{}).maxTitleLength,C=y===void 0?20:y;if(!!d){var F=s.target,G=F.className;if(!(G!=="g6-annotation-title"&&G!=="g6-annotation-content")){var H=G==="g6-annotation-title"?F.getBoundingClientRect():F.parentNode.getBoundingClientRect(),ie=H.width,se=H.height,ce=getComputedStyle(F),de=G==="g6-annotation-title"?"input":"textarea",xe=(0,Di.Z)("<".concat(de,' class="').concat(G,'-input" type="textarea" style="width:').concat(ie,"px; height: ").concat(se,'px; min-width: 16px;"/>')),Ie=(0,Di.Z)('<div class="'.concat(G,'-input-wrapper" style="width: ').concat(ie,"px; height: ").concat(se,"px; min-width: 16px; margin-right: ").concat(ce.marginRight,'" />'));Ie.appendChild(xe),F.parentNode.replaceChild(Ie,F),G==="g6-annotation-title"?(xe.name="title",xe.maxLength=C):xe.name="content",xe.innerHTML=F.innerHTML,xe.value=F.innerHTML,xe.focus();var qe=d[r];xe.addEventListener("blur",function(ze){xe.value&&(F.innerHTML=xe.value,qe[xe.name||"title"]=xe.value),Ie.parentNode.replaceChild(F,Ie),n.updateCardSize(r);var $e=n.get("onAnnotationChange");$e==null||$e(qe,"update")})}}});var a=["g6-annotation-title","g6-annotation-content","g6-annotation-title-input","g6-annotation-content-input"];e.draggable=!0,e.addEventListener("dragstart",function(s){var d=s.target.className;if(!a.includes(d)){var y=e.style;n.set("dragging",{card:e,x:s.clientX,y:s.clientY,left:rl(y.left),top:rl(y.top)})}}),e.addEventListener("drag",function(s){s.preventDefault();var d=n.get("cardInfoMap");if(!!d){var y=s.clientX,C=s.clientY,F=n.get("dragging");if(!(isNaN(y)||isNaN(C)||!F)){var G=F.x,H=F.y,ie=F.left,se=F.top,ce=F.card,de=y-G,xe=C-H;ie+=de,se+=xe;var Ie=n.get("graph"),qe=Ie.getPointByCanvas(0,0),ze=Ie.getPointByCanvas(Ie.getWidth(),Ie.getHeight()),$e=Ie.getClientByPoint(qe.x,qe.y),mt=$e.x,xt=$e.y,wt=Ie.getClientByPoint(ze.x,ze.y),Yt=wt.x,Zt=wt.y,Er=ce.getBoundingClientRect(),Fr=Er.right-Er.left,Ur=Er.bottom-Er.top;(ie>Yt-mt-Fr&&de>0||ie<0&&de<0)&&(ie-=de),(se>Zt-xt-Ur&&xe>0||se<0&&xe<0)&&(se-=xe),(0,Qn.Z)(ce,{left:"".concat(ie,"px"),top:"".concat(se,"px"),visibility:"hidden"}),G=y,H=C;var Or=(d[r]||{}).link;if(Or){var hn=Ie.findById(r);Or.attr("path",tl(hn,Er,Ie,n.get("canvas")))}n.set("dragging",{x:G,y:H,left:ie,top:se,card:ce})}}});var o=function(d){var y=n.get("cardInfoMap");if(!!y){var C=n.get("dragging");if(C){var F=C.left,G=C.top,H=C.card;y[r].x=F,y[r].y=G,(0,Qn.Z)(H,{visibility:"visible"}),n.set("dragging",!1);var ie=n.get("rows");ie==null||ie.forEach(function(ce){for(var de=ce.length-1;de>=0;de--)ce[de].id===r&&ce.splice(de,1)});var se=n.get("onAnnotationChange");se==null||se(y[r],"update")}}};e.addEventListener("dragend",o)}},t.prototype.updateCardSize=function(e){var r=this.get("cardInfoMap");if(!!r){var n=r[e].card,i=n.getBoundingClientRect().width,a=n.getElementsByClassName("g6-annotation-title")[0];if(a){var o=getComputedStyle(a),s=rl(o.marginLeft),d=a.getBoundingClientRect().width;(0,Qn.Z)(a,{marginRight:"".concat(i-s-24-16-d,"px")})}}},t.prototype.updateLink=function(e){var r=e.item;if(!!r){var n=this.get("cardInfoMap");if(!!n){var i=this.get("canvas"),a=this.get("graph"),o=r.getID(),s=n[o]||{},d=s.link,y=s.card;if(d){var C=tl(r,y.getBoundingClientRect(),a,i);d.attr("path",C)}}}},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(i){var a=i.id,o=n.findById(a);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(i){var a=i.id,o=i.card,s=i.isCanvas;if(!(s||o.style.display==="none")){var d=n.findById(a);d&&d.isVisible()?e.toggleAnnotation(d):e.hideCard(a)}})}},t.prototype.onGraphItemVisibilityChange=function(e){var r=e.item,n=e.visible;if(!(!r||r.destroyed)){var i=this.get("cardInfoMap");if(!!i){var a=r.getID();!i[a]||n||this.hideCard(a)}}},t.prototype.saveData=function(e){e===void 0&&(e=!1);var r=this.get("cardInfoMap");if(!!r){var n=this.get("graph"),i=this.get("getTitle"),a=this.get("getContent"),o=[];return Object.values(r).forEach(function(s){var d=s.title,y=s.content,C=s.x,F=s.y,G=s.id,H=s.collapsed,ie=s.card;if(!(ie.style.display==="none"&&!e)){var se=n.findById(G)||n.get("canvas");o.push({id:G,x:C,y:F,collapsed:H,title:d||(i==null?void 0:i(se)),content:y||(a==null?void 0:a(se)),visible:ie.style.display!=="none"})}}),o}},t.prototype.readData=function(e){var r=this,n=this.get("graph");e.forEach(function(i){var a=i.id,o=i.x,s=i.y,d=i.title,y=i.content,C=i.collapsed,F=i.visible,G=n.findById(a)||n.get("canvas");r.toggleAnnotation(G,{x:o,y:s,title:d,content:y,collapsed:C}),F||r.hideCard(a)})},t.prototype.clear=function(){var e=this.get("cardInfoMap");if(!!e){var r=this.get("container");Object.values(e).forEach(function(n){var i=n.card,a=n.link;r.removeChild(i),a==null||a.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}(fo),el=xd,Sd=function(t,e){var r,n,i,a=Infinity;Object.keys(t).forEach(function(d){var y=t[d];Object.keys(e).forEach(function(C){var F=e[C],G=y.x-F.x,H=y.y-F.y,ie=G*G+H*H;a>ie&&(a=ie,r=y,n=F,i=[d,C])})});var o=20,s=Eo.getControlPoint(r,n,.5,o);return[["M",r.x,r.y],["Q",s.x,s.y,n.x,n.y]]},tl=function(t,e,r,n){var i,a,o=t.getType();if(o==="edge")a=[t.getKeyShape().getPoint(.5)];else{var s=(i=t.getKeyShape)===null||i===void 0?void 0:i.call(t).getBBox(),d=s.minX,y=s.minY,C=s.maxX,F=s.maxY,G=t.getModel(),H=G.x,ie=G.y;d+=H,y+=ie,C+=H,F+=ie,a={left:{x:d,y:(y+F)/2},right:{x:C,y:(y+F)/2},top:{x:(d+C)/2,y},bottom:{x:(d+C)/2,y:F}}}Object.keys(a).forEach(function(xt){var wt=a[xt],Yt=wt.x,Zt=wt.y,Er=r.getClientByPoint(Yt,Zt);a[xt]=n.getPointByClient(Er.x,Er.y)});var se=e.top,ce=se===void 0?0:se,de=e.left,xe=de===void 0?0:de,Ie=e.right,qe=Ie===void 0?0:Ie,ze=e.bottom,$e=ze===void 0?0:ze,mt={left:n.getPointByClient(xe,(ce+$e)/2),right:n.getPointByClient(qe,(ce+$e)/2),top:n.getPointByClient((xe+qe)/2,ce),bottom:n.getPointByClient((xe+qe)/2,$e)};return Sd(a,mt)},rl=function(t){return Number(t.replace(/\s+|px/gi,""))||0},uh={PluginBase:fo,Menu:ld,Grid:Wl,Minimap:Js,Bundling:dd,ToolBar:pd,Tooltip:Cc,Fisheye:Hl,TimeBar:cr,ImageMinimap:Pn,EdgeFilterLens:lo,SnapLine:yd,Legend:Jh,Annotation:el},ch=uh,Wa=ch;Vo("circle",{options:{size:ln.defaultNode.size,style:{x:0,y:0,stroke:ln.defaultNode.style.stroke,fill:ln.defaultNode.style.fill,lineWidth:ln.defaultNode.style.lineWidth},labelCfg:{style:{fill:ln.nodeLabel.style.fill,fontSize:ln.nodeLabel.style.fontSize,fontFamily:ln.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:ln.defaultNode.linkPoints.size,lineWidth:ln.defaultNode.linkPoints.lineWidth,fill:ln.defaultNode.linkPoints.fill,stroke:ln.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,g.__assign)({},ln.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,i=this.getShapeStyle(t),a=(0,_.deepMix)({},n,t.icon),o="".concat(this.type,"-keyShape"),s=e.addShape("circle",{attrs:i,className:o,name:o,draggable:!0});e.shapeMap[o]=s;var d=a.width,y=a.height,C=a.show,F=a.text;if(C){var G="".concat(this.type,"-icon");F?e.shapeMap[G]=e.addShape("text",{attrs:(0,g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:G,name:G,draggable:!0}):e.shapeMap[G]=e.addShape("image",{attrs:(0,g.__assign)({x:-d/2,y:-y/2},a),className:G,name:G,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||{},i=n.top,a=n.left,o=n.right,s=n.bottom,d=n.size,y=n.r,C=(0,g.__rest)(n,["top","left","right","bottom","size","r"]),F=this.getSize(t),G=F[0]/2;if(a){var H="link-point-left";e.shapeMap[H]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:-G,y:0,r:d/2||y||5}),className:H,name:H,isAnchorPoint:!0})}if(o){var ie="link-point-right";e.shapeMap[ie]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:G,y:0,r:d/2||y||5}),className:ie,name:ie,isAnchorPoint:!0})}if(i){var se="link-point-top";e.shapeMap[se]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:-G,r:d/2||y||5}),className:se,name:se,isAnchorPoint:!0})}if(s){var ce="link-point-bottom";e.shapeMap[ce]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:G,r:d/2||y||5}),className:ce,name:ce,isAnchorPoint:!0})}}},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,_.deepMix)({},e,r),i=this.getSize(t),a=i[0]/2,o=(0,g.__assign)({x:0,y:0,r:a},n);return o},update:function(t,e,r){var n=e.getContainer(),i=this.getSize(t),a=(0,g.__assign)({},t.style);t.style.stroke===void 0&&t.color&&(a.stroke=t.color),t.style.r===void 0&&!isNaN(i[0])&&(a.r=i[0]/2),this.updateShape(t,e,a,!0,r),this.updateLinkPoints(t,n)}},"single-node"),Vo("rect",{options:{size:[100,30],style:{radius:0,stroke:ln.defaultNode.style.stroke,fill:ln.defaultNode.style.fill,lineWidth:ln.defaultNode.style.lineWidth},labelCfg:{style:{fill:ln.nodeLabel.style.fill,fontSize:ln.nodeLabel.style.fontSize,fontFamily:ln.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:ln.defaultNode.linkPoints.size,lineWidth:ln.defaultNode.linkPoints.lineWidth,fill:ln.defaultNode.linkPoints.fill,stroke:ln.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,g.__assign)({},ln.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,i=n.top,a=n.left,o=n.right,s=n.bottom,d=n.size,y=n.r,C=(0,g.__rest)(n,["top","left","right","bottom","size","r"]),F=this.getSize(t),G=F[0],H=F[1];a&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:-G/2,y:0,r:d/2||y||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:G/2,y:0,r:d/2||y||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:-H/2,r:d/2||y||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:H/2,r:d/2||y||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,_.mix)({},e,r),i=this.getSize(t),a=n.width||i[0],o=n.height||i[1],s=(0,g.__assign)({x:-a/2,y:-o/2,width:a,height:o},n);return s},update:function(t,e,r){var n=e.getContainer(),i=this.getOptions({}).style,a=this.getSize(t),o=e.get("keyShape");t.size||(a[0]=o.attr("width")||i.width,a[1]=o.attr("height")||i.height);var s={stroke:t.color,x:-a[0]/2,y:-a[1]/2,width:a[0],height:a[1]},d=(0,_.mix)({},i,o.attr(),s);d=(0,_.mix)(d,t.style),this.updateShape(t,e,d,!1,r),this.updateLinkPoints(t,n)}},"single-node"),Vo("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:ln.defaultNode.style.stroke,fill:ln.defaultNode.style.fill,lineWidth:ln.defaultNode.style.lineWidth},labelCfg:{style:{fill:ln.nodeLabel.style.fill,fontSize:ln.nodeLabel.style.fontSize,fontFamily:ln.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:ln.defaultNode.linkPoints.size,lineWidth:ln.defaultNode.linkPoints.lineWidth,fill:ln.defaultNode.linkPoints.fill,stroke:ln.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,g.__assign)({},ln.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,i=this.getShapeStyle(t),a=e.addShape("ellipse",{attrs:i,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});e.shapeMap["ellipse-keyShape"]=a;var o=n.width,s=n.height,d=n.show,y=n.text;return d&&(y?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,g.__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,g.__assign)({x:-o/2,y:-s/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),a},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,i=n.top,a=n.left,o=n.right,s=n.bottom,d=n.size,y=n.r,C=(0,g.__rest)(n,["top","left","right","bottom","size","r"]),F=this.getSize(t),G=F[0]/2,H=F[1]/2;a&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:-G,y:0,r:d/2||y||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:G,y:0,r:d/2||y||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:-H,r:d/2||y||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:H,r:d/2||y||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,_.mix)({},e,r),i=this.getSize(t),a=i[0]/2,o=i[1]/2,s=(0,g.__assign)({x:0,y:0,rx:a,ry:o},n);return s},update:function(t,e,r){var n=e.getContainer(),i=this.getOptions({}).style,a=this.getSize(t),o={stroke:t.color,rx:a[0]/2,ry:a[1]/2},s=e.get("keyShape"),d=(0,_.mix)({},i,s.attr(),o);d=(0,_.mix)(d,t.style),this.updateShape(t,e,d,!0,r),this.updateLinkPoints(t,n)}},"single-node"),Vo("diamond",{options:{size:[80,80],style:{stroke:ln.defaultNode.style.stroke,fill:ln.defaultNode.style.fill,lineWidth:ln.defaultNode.style.lineWidth},labelCfg:{style:{fill:ln.nodeLabel.style.fill,fontSize:ln.nodeLabel.style.fontSize,fontFamily:ln.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:ln.defaultNode.linkPoints.size,lineWidth:ln.defaultNode.linkPoints.lineWidth,fill:ln.defaultNode.linkPoints.fill,stroke:ln.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,g.__assign)({},ln.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,i=this.getShapeStyle(t),a=e.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=a;var o=n.width,s=n.height,d=n.show,y=n.text;return d&&(y?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,g.__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,g.__assign)({x:-o/2,y:-s/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),a},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,i=n.top,a=n.left,o=n.right,s=n.bottom,d=n.size,y=n.r,C=(0,g.__rest)(n,["top","left","right","bottom","size","r"]),F=this.getSize(t),G=F[0],H=F[1];a&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:-G/2,y:0,r:d/2||y||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:G/2,y:0,r:d/2||y||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:-H/2,r:d/2||y||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:H/2,r:d/2||y||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],i=[["M",0,-n/2],["L",r/2,0],["L",0,n/2],["L",-r/2,0],["Z"]];return i},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,_.mix)({},e,r),i=this.getPath(t),a=(0,g.__assign)({path:i},n);return a},update:function(t,e,r){var n=e.getContainer(),i=this.getOptions({}).style,a=this.getPath(t),o={stroke:t.color,path:a},s=e.get("keyShape"),d=(0,_.mix)({},i,s.attr(),o);d=(0,_.mix)(d,t.style),this.updateShape(t,e,d,!0,r),this.updateLinkPoints(t,n)}},"single-node"),Vo("triangle",{options:{size:40,direction:"up",style:{stroke:ln.defaultNode.style.stroke,fill:ln.defaultNode.style.fill,lineWidth:ln.defaultNode.style.lineWidth},labelCfg:{style:{fill:ln.nodeLabel.style.fill,fontSize:ln.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:ln.defaultNode.linkPoints.size,lineWidth:ln.defaultNode.linkPoints.lineWidth,fill:ln.defaultNode.linkPoints.fill,stroke:ln.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,g.__assign)({},ln.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.icon,i=n===void 0?{}:n,a=r.direction,o=this.getShapeStyle(t),s=t.direction||a,d=e.addShape("path",{attrs:o,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=d;var y=i.width,C=i.height,F=i.show,G=i.offset,H=i.text;if(F)if(H)e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,g.__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});else{var ie=-y/2,se=-C/2;(s==="up"||s==="down")&&(se+=G),(s==="left"||s==="right")&&(ie+=G),e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,g.__assign)({x:ie,y:se},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(t,e),d},drawLinkPoints:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.linkPoints,i=n===void 0?{}:n,a=r.direction,o=t.direction||a,s=i.top,d=i.left,y=i.right,C=i.bottom,F=i.size,G=i.r,H=(0,g.__rest)(i,["top","left","right","bottom","size","r"]),ie=this.getSize(t),se=ie[0];if(d){var ce=null,de=se*Math.sin(1/3*Math.PI),xe=se*Math.sin(1/3*Math.PI);o==="up"?ce=[-xe,de]:o==="down"?ce=[-xe,-de]:o==="left"&&(ce=[-xe,xe-de]),ce&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},H),{x:ce[0],y:ce[1],r:F/2||G||5}),className:"link-point-left",name:"link-point-left"}))}if(y){var Ie=null,de=se*Math.sin(1/3*Math.PI),xe=se*Math.sin(1/3*Math.PI);o==="up"?Ie=[xe,de]:o==="down"?Ie=[xe,-de]:o==="right"&&(Ie=[xe,xe-de]),Ie&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},H),{x:Ie[0],y:Ie[1],r:F/2||G||5}),className:"link-point-right",name:"link-point-right"}))}if(s){var qe=null,de=se*Math.sin(1/3*Math.PI),xe=se*Math.sin(1/3*Math.PI);o==="up"?qe=[xe-de,-de]:o==="left"?qe=[xe,-de]:o==="right"&&(qe=[-xe,-de]),qe&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},H),{x:qe[0],y:qe[1],r:F/2||G||5}),className:"link-point-top",name:"link-point-top"}))}if(C){var ze=null,de=se*Math.sin(1/3*Math.PI),xe=se*Math.sin(1/3*Math.PI);o==="down"?ze=[-xe+de,de]:o==="left"?ze=[xe,de]:o==="right"&&(ze=[-xe,de]),ze&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},H),{x:ze[0],y:ze[1],r:F/2||G||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),i=n[0],a=i*Math.sin(1/3*Math.PI),o=i*Math.sin(1/3*Math.PI),s=[["M",-o,a],["L",0,-a],["L",o,a],["Z"]];return r==="down"?s=[["M",-o,-a],["L",o,-a],["L",0,a],["Z"]]:r==="left"?s=[["M",-o,o-a],["L",o,-o],["L",o,o],["Z"]]:r==="right"&&(s=[["M",o,o-a],["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,_.mix)({},e,r),i=this.getPath(t),a=(0,g.__assign)({path:i},n);return a},update:function(t,e,r){var n=e.getContainer(),i=this.getOptions({}).style,a=this.getPath(t),o={stroke:t.color,path:a},s=e.get("keyShape"),d=(0,_.mix)({},i,s.attr(),o);d=(0,_.mix)(d,t.style),this.updateShape(t,e,d,!0,r),this.updateLinkPoints(t,n)},updateLinkPoints:function(t,e){var r=this.getOptions({}),n=r.linkPoints,i=r.direction,a=t.direction||i,o=e.shapeMap["link-point-left"]||e.find(function(Or){return Or.get("className")==="link-point-left"}),s=e.shapeMap["link-point-right"]||e.find(function(Or){return Or.get("className")==="link-point-right"}),d=e.shapeMap["link-point-top"]||e.find(function(Or){return Or.get("className")==="link-point-top"}),y=e.shapeMap["link-point-bottom"]||e.find(function(Or){return Or.get("className")==="link-point-bottom"}),C=n,F=o||s||d||y;F&&(C=F.attr());var G=(0,_.mix)({},C,t.linkPoints),H=G.fill,ie=G.stroke,se=G.lineWidth,ce=G.size/2;ce||(ce=G.r);var de=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},xe=de.left,Ie=de.right,qe=de.top,ze=de.bottom,$e=this.getSize(t),mt=$e[0],xt={r:ce,fill:H,stroke:ie,lineWidth:se},wt=null,Yt=mt*Math.sin(1/3*Math.PI),Zt=mt*Math.sin(1/3*Math.PI);a==="up"?wt=[-Zt,Yt]:a==="down"?wt=[-Zt,-Yt]:a==="left"&&(wt=[-Zt,Zt-Yt]),wt&&(o?!xe&&xe!==void 0?(o.remove(),delete e.shapeMap["link-point-left"]):o.attr((0,g.__assign)((0,g.__assign)({},xt),{x:wt[0],y:wt[1]})):xe&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},xt),{x:wt[0],y:wt[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var Er=null;a==="up"?Er=[Zt,Yt]:a==="down"?Er=[Zt,-Yt]:a==="right"&&(Er=[Zt,Zt-Yt]),Er&&(s?!Ie&&Ie!==void 0?(s.remove(),delete e.shapeMap["link-point-right"]):s.attr((0,g.__assign)((0,g.__assign)({},xt),{x:Er[0],y:Er[1]})):Ie&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},xt),{x:Er[0],y:Er[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var Fr=null;a==="up"?Fr=[Zt-Yt,-Yt]:a==="left"?Fr=[Zt,-Yt]:a==="right"&&(Fr=[-Zt,-Yt]),Fr&&(d?!qe&&qe!==void 0?(d.remove(),delete e.shapeMap["link-point-top"]):d.attr((0,g.__assign)((0,g.__assign)({},xt),{x:Fr[0],y:Fr[1]})):qe&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},xt),{x:Fr[0],y:Fr[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var Ur=null;a==="down"?Ur=[-Zt+Yt,Yt]:a==="left"?Ur=[Zt,Yt]:a==="right"&&(Ur=[-Zt,Yt]),Ur&&(y?!ze&&ze!==void 0?(y.remove(),delete e.shapeMap["link-point-bottom"]):y.attr((0,g.__assign)((0,g.__assign)({},xt),{x:Ur[0],y:Ur[1]})):ze&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},xt),{x:Ur[0],y:Ur[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node"),Vo("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:ln.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:ln.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:ln.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,i=this.getShapeStyle(t),a=this.getSize(t),o=a[0],s=a[1],d=e.addShape("rect",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=d;var y=n.show,C=(0,g.__rest)(n,["show"]);return y&&(e.shapeMap["pre-rect"]=e.addShape("rect",{attrs:(0,g.__assign)({x:-o/2,y:-s/2,height:s},C),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(t,e),this.drawStateIcon(t,e),this.drawLinkPoints(t,e),d},drawLogoIcon:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).logoIcon,n=r===void 0?{}:r,i=this.getSize(t),a=i[0];if(n.show){var o=n.width,s=n.height,d=n.x,y=n.y,C=n.offset,F=n.text,G=(0,g.__rest)(n,["width","height","x","y","offset","text"]);F?e.shapeMap["rect-logo-icon"]=e.addShape("text",{attrs:(0,g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},G),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):e.shapeMap["rect-logo-icon"]=e.addShape("image",{attrs:(0,g.__assign)((0,g.__assign)({},G),{x:d||-a/2+o+C,y:y||-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,i=this.getSize(t),a=i[0];if(n.show){var o=n.width,s=n.height,d=n.x,y=n.y,C=n.offset,F=n.text,G=(0,g.__rest)(n,["width","height","x","y","offset","text"]);F?e.shapeMap["rect-state-icon"]=e.addShape("text",{attrs:(0,g.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},G),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):e.shapeMap["rect-state-icon"]=e.addShape("image",{attrs:(0,g.__assign)((0,g.__assign)({},G),{x:d||a/2-o+C,y:y||-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,i=n.top,a=n.left,o=n.right,s=n.bottom,d=n.size,y=n.r,C=(0,g.__rest)(n,["top","left","right","bottom","size","r"]),F=this.getSize(t),G=F[0],H=F[1];a&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:-G/2,y:0,r:d/2||y||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:G/2,y:0,r:d/2||y||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:-H/2,r:d/2||y||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),s&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},C),{x:0,y:H/2,r:d/2||y||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(t,e){var r=this.getOptions(t),n=r.labelCfg,i=n===void 0?{}:n,a=r.logoIcon,o=a===void 0?{}:a,s=r.descriptionCfg,d=s===void 0?{}:s,y=this.getSize(t),C=y[0],F=null,G=o.show,H=o.width,ie=-C/2+i.offset;G&&(ie=-C/2+H+i.offset);var se=i.style,ce=d.style,de=d.paddingTop;return(0,_.isString)(t.description)?(F=e.addShape("text",{attrs:(0,g.__assign)((0,g.__assign)({},se),{x:ie,y:-5,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=F,e.shapeMap["rect-description"]=e.addShape("text",{attrs:(0,g.__assign)((0,g.__assign)({},ce),{x:ie,y:17+(de||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(F=e.addShape("text",{attrs:(0,g.__assign)((0,g.__assign)({},se),{x:ie,y:7,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=F),F},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,_.mix)({},e,r),i=this.getSize(t),a=n.width||i[0],o=n.height||i[1],s=(0,g.__assign)({x:-a/2,y:-o/2,width:a,height:o},n);return s},update:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.style,i=n===void 0?{}:n,a=r.labelCfg,o=a===void 0?{}:a,s=r.descriptionCfg,d=s===void 0?{}:s,y=this.getSize(t),C=y[0],F=y[1],G=e.get("keyShape");G.attr((0,g.__assign)((0,g.__assign)({},i),{x:-C/2,y:-F/2,width:C,height:F}));var H=e.getContainer(),ie=H.shapeMap["rect-logo-icon"]||H.find(function(ii){return ii.get("className")==="rect-logo-icon"}),se=ie?ie.attr():{},ce=(0,_.mix)({},se,t.logoIcon),de=ce.width;de===void 0&&(de=this.options.logoIcon.width);var xe=t.logoIcon?t.logoIcon.show:void 0,Ie=o.offset,qe=-C/2+de+Ie;!xe&&xe!==void 0&&(qe=-C/2+Ie);var ze=H.shapeMap["node-label"]||H.find(function(ii){return ii.get("className")==="node-label"}),$e=H.shapeMap["rect-description"]||H.find(function(ii){return ii.get("className")==="rect-description"});if(t.label)if(!ze)H.shapeMap["node-label"]=H.addShape("text",{attrs:(0,g.__assign)((0,g.__assign)({},o.style),{x:qe,y:t.description?-5:7,text:t.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var mt=t.labelCfg?t.labelCfg.style:{},xt=(0,_.mix)({},ze.attr(),mt);t.label&&(xt.text=t.label),xt.x=qe,(0,_.isString)(t.description)&&(xt.y=-5),$e&&($e.resetMatrix(),$e.attr({x:qe})),ze.resetMatrix(),ze.attr(xt)}if((0,_.isString)(t.description)){var wt=d.paddingTop;if(!$e)H.shapeMap["rect-description"]=H.addShape("text",{attrs:(0,g.__assign)((0,g.__assign)({},d.style),{x:qe,y:17+(wt||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var mt=t.descriptionCfg?t.descriptionCfg.style:{},Yt=(0,_.mix)({},$e.attr(),mt);(0,_.isString)(t.description)&&(Yt.text=t.description),Yt.x=qe,$e.resetMatrix(),$e.attr((0,g.__assign)((0,g.__assign)({},Yt),{y:17+(wt||0)}))}}var Zt=H.shapeMap["pre-rect"]||H.find(function(ii){return ii.get("className")==="pre-rect"});if(Zt&&!Zt.destroyed){var Er=(0,_.mix)({},Zt.attr(),t.preRect);Zt.attr((0,g.__assign)((0,g.__assign)({},Er),{x:-C/2,y:-F/2,height:F}))}if(ie&&!ie.destroyed)if(!xe&&xe!==void 0)ie.remove(),delete H.shapeMap["pre-rect"];else{var Fr=ce.width,Ur=ce.height,Or=ce.x,hn=ce.y,sn=ce.offset,Ir=(0,g.__rest)(ce,["width","height","x","y","offset"]);ie.attr((0,g.__assign)((0,g.__assign)({},Ir),{x:Or||-C/2+Fr+sn,y:hn||-Ur/2,width:Fr,height:Ur}))}else xe&&this.drawLogoIcon(t,H);var en=H.shapeMap["rect-state-icon"]||H.find(function(ii){return ii.get("className")==="rect-state-icon"}),un=en?en.attr():{},fn=(0,_.mix)({},un,t.stateIcon);if(en){!fn.show&&fn.show!==void 0&&(en.remove(),delete H.shapeMap["rect-state-icon"]);var pn=fn.width,Ur=fn.height,Or=fn.x,hn=fn.y,Tn=fn.offset,Zn=(0,g.__rest)(fn,["width","height","x","y","offset"]);en.attr((0,g.__assign)((0,g.__assign)({},Zn),{x:Or||C/2-pn+Tn,y:hn||-Ur/2,width:pn,height:Ur}))}else fn.show&&this.drawStateIcon(t,H);this.updateLinkPoints(t,H)}},"single-node"),Vo("star",{options:{size:60,style:{stroke:ln.defaultNode.style.stroke,fill:ln.defaultNode.style.fill,lineWidth:ln.defaultNode.style.lineWidth},labelCfg:{style:{fill:ln.nodeLabel.style.fill,fontSize:ln.nodeLabel.style.fontSize,fontFamily:ln.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:ln.defaultNode.linkPoints.size,lineWidth:ln.defaultNode.linkPoints.lineWidth,fill:ln.defaultNode.linkPoints.fill,stroke:ln.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,g.__assign)({},ln.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,i=this.getShapeStyle(t),a=e.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=a;var o=n.width,s=n.height,d=n.show,y=n.text;return d&&(y?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,g.__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,g.__assign)({x:-o/2,y:-s/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),a},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,i=n.top,a=n.left,o=n.right,s=n.leftBottom,d=n.rightBottom,y=n.size,C=n.r,F=(0,g.__rest)(n,["top","left","right","leftBottom","rightBottom","size","r"]),G=this.getSize(t),H=G[0];if(o){var ie=Math.cos((18+72*0)/180*Math.PI)*H,se=Math.sin((18+72*0)/180*Math.PI)*H;e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},F),{x:ie,y:-se,r:y/2||C||5}),className:"link-point-right",name:"link-point-right"})}if(i){var ie=Math.cos((18+72*1)/180*Math.PI)*H,se=Math.sin((18+72*1)/180*Math.PI)*H;e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},F),{x:ie,y:-se,r:y/2||C||5}),className:"link-point-top",name:"link-point-top"})}if(a){var ie=Math.cos((18+72*2)/180*Math.PI)*H,se=Math.sin((18+72*2)/180*Math.PI)*H;e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},F),{x:ie,y:-se,r:y/2||C||5}),className:"link-point-left",name:"link-point-left"})}if(s){var ie=Math.cos((18+72*3)/180*Math.PI)*H,se=Math.sin((18+72*3)/180*Math.PI)*H;e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},F),{x:ie,y:-se,r:y/2||C||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(d){var ie=Math.cos((18+72*4)/180*Math.PI)*H,se=Math.sin((18+72*4)/180*Math.PI)*H;e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},F),{x:ie,y:-se,r:y/2||C||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(t){for(var e=this.getSize(t),r=e[0],n=r*3/8,i=t.innerR||n,a=[],o=0;o<5;o++){var s=Math.cos((18+72*o)/180*Math.PI)*r,d=Math.sin((18+72*o)/180*Math.PI)*r,y=Math.cos((54+72*o)/180*Math.PI)*i,C=Math.sin((54+72*o)/180*Math.PI)*i;o===0?a.push(["M",s,-d]):a.push(["L",s,-d]),a.push(["L",y,-C])}return a.push(["Z"]),a},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,_.mix)({},e,r),i=this.getPath(t),a=(0,g.__assign)({path:i},n);return a},update:function(t,e,r){var n=e.getContainer(),i=this.getOptions({}).style,a=this.getPath(t),o={stroke:t.color,path:a},s=e.get("keyShape"),d=(0,_.mix)({},i,s.attr(),o);d=(0,_.mix)(d,t.style),this.updateShape(t,e,d,!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"}),i=e.shapeMap["link-point-right"]||e.find(function(Yt){return Yt.get("className")==="link-point-right"}),a=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"}),d=r,y=n||i||a||o||s;y&&(d=y.attr());var C=(0,_.mix)({},d,t.linkPoints),F=C.fill,G=C.stroke,H=C.lineWidth,ie=C.size/2;ie||(ie=C.r);var se=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},ce=se.left,de=se.right,xe=se.top,Ie=se.leftBottom,qe=se.rightBottom,ze=this.getSize(t),$e=ze[0],mt={r:ie,fill:F,stroke:G,lineWidth:H},xt=Math.cos((18+72*0)/180*Math.PI)*$e,wt=Math.sin((18+72*0)/180*Math.PI)*$e;i?!de&&de!==void 0?(i.remove(),delete e.shapeMap["link-point-right"]):i.attr((0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt})):de&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),xt=Math.cos((18+72*1)/180*Math.PI)*$e,wt=Math.sin((18+72*1)/180*Math.PI)*$e,a?!xe&&xe!==void 0?(a.remove(),delete e.shapeMap["link-point-top"]):a.attr((0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt})):xe&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),xt=Math.cos((18+72*2)/180*Math.PI)*$e,wt=Math.sin((18+72*2)/180*Math.PI)*$e,n?!ce&&ce!==void 0?(n.remove(),delete e.shapeMap["link-point-left"]):n.attr((0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt})):ce&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),xt=Math.cos((18+72*3)/180*Math.PI)*$e,wt=Math.sin((18+72*3)/180*Math.PI)*$e,o?!Ie&&Ie!==void 0?(o.remove(),delete e.shapeMap["link-point-left-bottom"]):o.attr((0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt})):Ie&&(e.shapeMap["link-point-left-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),xt=Math.cos((18+72*4)/180*Math.PI)*$e,wt=Math.sin((18+72*4)/180*Math.PI)*$e,s?!qe&&qe!==void 0?(s.remove(),delete e.shapeMap["link-point-right-bottom"]):s.attr((0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt})):qe&&(e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:(0,g.__assign)((0,g.__assign)({},mt),{x:xt,y:-wt}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var Ql=Eo.defaultSubjectColors;Vo("donut",{options:{size:ln.defaultNode.size,style:{x:0,y:0,stroke:ln.defaultNode.style.stroke,fill:ln.defaultNode.style.fill,lineWidth:ln.defaultNode.style.lineWidth},labelCfg:{style:{fill:ln.nodeLabel.style.fill,fontSize:ln.nodeLabel.style.fontSize,fontFamily:ln.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:ln.defaultNode.linkPoints.size,lineWidth:ln.defaultNode.linkPoints.lineWidth,fill:ln.defaultNode.linkPoints.fill,stroke:ln.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,g.__assign)({},ln.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,i=this.getShapeStyle(t),a=(0,_.deepMix)({},n,t.icon),o=e.addShape("circle",{attrs:i,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});e.shapeMap["".concat(this.type,"-keyShape")]=o;var s=a.width,d=a.height,y=a.show,C=a.text;y&&(C?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,g.__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}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,g.__assign)({x:-s/2,y:-d/2},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}));var F=o.attr("r"),G=.6*F,H=(F+G)/2,ie=t,se=ie.donutAttrs,ce=se===void 0?{}:se,de=ie.donutColorMap,xe=de===void 0?{}:de,Ie=Object.keys(ce).length;if(ce&&Ie>1){var qe=[],ze=0;if(Object.keys(ce).forEach(function(wt){var Yt=ce[wt]||0;!(0,_.isNumber)(Yt)||(qe.push({key:wt,value:Yt,color:xe[wt]}),ze+=Yt)}),ze){var $e=F-G;if(Ie===1){e.shapeMap["fan-shape-0"]=e.addShape("circle",{attrs:{r:H,x:0,y:0,stroke:qe[0].color||Ql[0],lineWidth:$e},name:"fan-shape-0",draggable:!0});return}var mt=[H,0],xt=0;qe.forEach(function(wt,Yt){var Zt=wt.value/ze;if(!(Zt<.001)){if(Zt>.999&&(Zt=1),Zt===1){e.shapeMap["fan-shape-".concat(Yt)]=e.addShape("circle",{attrs:{r:H,x:0,y:0,stroke:wt.color||Ql[Yt%Ql.length],lineWidth:$e},name:"fan-shape-".concat(Yt),draggable:!0});return}wt.percent=Zt,wt.angle=Zt*Math.PI*2,wt.beginAgnle=xt,xt+=wt.angle,wt.endAngle=xt,wt.arcBegin=mt,wt.arcEnd=[H*Math.cos(wt.endAngle),-H*Math.sin(wt.endAngle)];var Er=wt.angle>Math.PI?1:0,Fr=[["M",wt.arcBegin[0],wt.arcBegin[1]],["A",H,H,0,Er,0,wt.arcEnd[0],wt.arcEnd[1]],["L",wt.arcEnd[0],wt.arcEnd[1]]];e.shapeMap["fan-shape-".concat(Yt)]=e.addShape("path",{attrs:{path:Fr,lineWidth:$e,stroke:wt.color||Ql[Yt%Ql.length]},name:"fan-shape-".concat(Yt),draggable:!0}),mt=wt.arcEnd}})}}return this.drawLinkPoints(t,e),o},update:void 0},"circle");var md=function(t){var e=t.x,r=t.y;return{x:e,y:r,centerX:e,centerY:r,minX:e,minY:r,maxX:e,maxY:r,height:0,width:0}},fh=function(t){t===void 0&&(t=[]);var e=[],r=[];t.forEach(function(s){e.push(s.x),r.push(s.y)});var n=Math.min.apply(Math,e),i=Math.max.apply(Math,e),a=Math.min.apply(Math,r),o=Math.max.apply(Math,r);return{centerX:(n+i)/2,centerY:(a+o)/2,maxX:i,maxY:o,minX:n,minY:a,height:o-a,width:i-n}},ev=function(t,e){return Math.abs(t.centerX-e.centerX)*2<t.width+e.width&&Math.abs(t.centerY-e.centerY)*2<t.height+e.height},nl=function(t){for(var e=[],r={},n=t.length,i=n-1;i>=0;i--){var a=t[i];a.id="".concat(a.x,"|||").concat(a.y),r[a.id]=a,e.push(a)}return e},Rd=function(t){return nl(t)},tv=function(t,e){return[t,{x:t.x,y:e.y},e]},bd=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},lh=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},kd=function(t,e,r){var n=lh(e,t);if(n===0){var i=t.centerX,a=t.centerY;return r.y<e.y?a=t.minY:r.x>e.x?i=t.maxX:r.x<e.x?i=t.minX:r.x===e.x&&(a=t.maxY),{x:i,y:a}}return n?{x:e.x>t.centerX?t.maxX:t.minX,y:e.y}:{x:e.x,y:e.y>t.centerY?t.maxY:t.minY}},dh=function(t,e){var r=Math.min(t.minX,e.minX),n=Math.min(t.minY,e.minY),i=Math.max(t.maxX,e.maxX),a=Math.max(t.maxY,e.maxY);return{centerX:(r+i)/2,centerY:(n+a)/2,minX:r,minY:n,maxX:i,maxY:a,height:a-n,width:i-r}},Bd=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}]},wd=function(t,e){var r=t.x,n=t.y;return r<e.minX||r>e.maxX||n<e.minY||n>e.maxY},rv=function(t,e){return e<t.minX||e>t.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]},nv=function(t,e){return e<t.minY||e>t.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]},hh=function(t,e){return rv(t,e.x).concat(nv(t,e.y))},Jl=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},vh=function(t,e){var r=-2,n=0;return e.forEach(function(i){i&&(t.x===i.x&&(n+=r),t.y===i.y&&(n+=r))}),n},Gd=function(t,e,r,n,i){return Jl(t,e)+Jl(t,r)+vh(t,[e,r,n,i])},ph=function h(t,e,r,n,i){i===void 0&&(i=0),t.unshift(e[n]),r[n]&&r[n]!==n&&i<=100&&h(t,e,r,r[n],i+1)},gh=function(t,e){var r=t.indexOf(e);r>-1&&t.splice(r,1)},Ed=function(t,e,r,n){var i=r.x-t.x,a=r.y-t.y,o=n.x-t.x,s=n.y-t.y,d=r.x-e.x,y=r.y-e.y,C=n.x-e.x,F=n.y-e.y,G=i*s-a*o,H=d*F-y*C,ie=i*y-a*d,se=o*F-s*C;return G*H<=0&&ie*se<=0},il=function(t,e,r){if(r.width||r.height){var n=Bd(r),i=n[0],a=n[1],o=n[2],s=n[3];return Ed(t,e,i,a)||Ed(t,e,i,s)||Ed(t,e,a,o)||Ed(t,e,o,s)}return!1},yh=function(t,e,r,n){var i=[];return t.forEach(function(a){if(a!==e&&(a.x===e.x||a.y===e.y)){if(il(a,e,r)||il(a,e,n))return;i.push(a)}}),nl(i)},mh=function(t,e,r,n,i,a,o){var s=[],d=[e],y={},C={},F={};C[e.id]=0,F[e.id]=Gd(e,r,e);var G={};t.forEach(function(ce){G[ce.id]=ce});for(var H,ie;d.length;){if(H=void 0,ie=Infinity,d.forEach(function(ce){F[ce.id]<=ie&&(ie=F[ce.id],H=ce)}),H===r){var se=[];return ph(se,G,y,r.id),se}gh(d,H),s.push(H),yh(t,H,n,i).forEach(function(ce){if(s.indexOf(ce)===-1){d.indexOf(ce)===-1&&d.push(ce);var de=F[H.id]+Jl(H,ce);C[ce.id]&&de>=C[ce.id]||(y[ce.id]=H.id,C[ce.id]=de,F[ce.id]=C[ce.id]+Gd(ce,r,e,a,o))}})}return[e,r]},bh=function(t,e,r){return!(t.x===e.x&&e.x===r.x||t.y===e.y&&e.y===r.y)},Eh=function(t,e,r,n){var i=Jl(t,e),a=Jl(r,e);i<n&&(n=i),a<n&&(n=a);var o={x:e.x-n/i*(e.x-t.x),y:e.y-n/i*(e.y-t.y)},s={x:e.x-n/a*(e.x-r.x),y:e.y-n/a*(e.y-r.y)};return[o,s]},Fd=function(t,e){var r=[],n=t[0];return r.push("M".concat(n.x," ").concat(n.y)),t.forEach(function(i,a){var o=t[a+1],s=t[a+2];if(o&&s)if(bh(i,o,s)){var d=Eh(i,o,s,e),y=d[0],C=d[1];r.push("L".concat(y.x," ").concat(y.y)),r.push("Q".concat(o.x," ").concat(o.y," ").concat(C.x," ").concat(C.y)),r.push("L".concat(C.x," ").concat(C.y))}else r.push("L".concat(o.x," ").concat(o.y));else o&&r.push("L".concat(o.x," ").concat(o.y))}),r.join("")},_h=function(t,e,r,n,i){var a,o;if(!r||!r.getType())a=md(t);else if(r.getType()==="combo"){var s=r.getKeyShape().getBBox();if(s){var d=r.getModel(),y=d.x,C=d.y;a={x:y,y:C,width:s.width,height:s.height,minX:s.minX+y,maxX:s.maxX+y,minY:s.minY+C,maxY:s.maxY+C},a.centerX=(a.minX+a.maxX)/2,a.centerY=(a.minY+a.maxY)/2}else a=md(t)}else a=r&&r.getBBox();if(!n||!n.getType())o=md(e);else if(n.getType()==="combo"){var F=n.getKeyShape().getBBox();if(F){var G=n.getModel(),H=G.x,ie=G.y;o={x:H,y:ie,width:F.width,height:F.height,minX:F.minX+H,maxX:F.maxX+H,minY:F.minY+ie,maxY:F.maxY+ie},o.centerX=(o.minX+o.maxX)/2,o.centerY=(o.minY+o.maxY)/2}else o=md(e)}else o=n&&n.getBBox();var se=bd(a,i),ce=bd(o,i),de=kd(se,t,e),xe=kd(ce,e,t),Ie=fh([de,xe]),qe=dh(se,Ie),ze=dh(ce,Ie),$e=[];$e=$e.concat(Bd(qe)).concat(Bd(ze));var mt={x:(t.x+e.x)/2,y:(t.y+e.y)/2};[Ie,qe,ze].forEach(function(wt){$e=$e.concat(hh(wt,mt).filter(function(Yt){return wd(Yt,se)&&wd(Yt,ce)}))}),[{x:de.x,y:xe.y},{x:xe.x,y:de.y}].forEach(function(wt){wd(wt,se)&&wd(wt,ce)&&$e.push(wt)}),$e.unshift(de),$e.push(xe),$e=nl($e);var xt=mh($e,de,xe,a,o,t,e);return xt.unshift(t),xt.push(e),Rd(xt)},iv=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},av=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},ov=function(t,e){return[t,e]},sv=function(t,e,r,n,i){return Rd(_h(t,e,r,n,i.offset))},uv={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:iv,fallbackRoute:sv},xv={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:av,fallbackRoute:ov},Ku=function(t,e){var r=Math.round(Math.abs(t/e)),n=t<0?-1:1;return r<0?0:n*r},xh=function(t,e,r){var n={};return t.forEach(function(i){if(!!i)for(var a=bd(i.getBBox(),r),o=Ku(a.minX,e);o<=Ku(a.maxX,e);o+=1)for(var s=Ku(a.minY,e);s<=Ku(a.maxY,e);s+=1)n["".concat(o,"|||").concat(s)]=!0}),n},Md=function(t,e){var r=e.x-t.x,n=e.y-t.y;return r||n?Math.atan2(n,r):0},Ud=function(t,e){var r=Math.abs(t-e);return r>Math.PI?2*Math.PI-r:r},zd=function(t,e,r){for(var n=Infinity,i=0,a=e.length;i<a;i++){var o=r(t,e[i]);o<n&&(n=o)}return n},ql=function(t,e,r,n,i){var a=[];if(!r)return[t];var o=i.directions,s=i.offset,d=r.getBBox(),y=e.x>d.minX&&e.x<d.maxX&&e.y>d.minY&&e.y<d.maxY,C=bd(d,s);for(var F in C)C[F]=Ku(C[F],i.gridSize);if(y){for(var G=0,H=o;G<H.length;G++)for(var ie=H[G],se=[[{x:C.minX,y:C.minY},{x:C.maxX,y:C.minY}],[{x:C.minX,y:C.minY},{x:C.minX,y:C.maxY}],[{x:C.maxX,y:C.minY},{x:C.maxX,y:C.maxY}],[{x:C.minX,y:C.maxY},{x:C.maxX,y:C.maxY}]],F=0;F<4;F++){var ce=se[F],de=Eo.getLineIntersect(t,{x:t.x+ie.stepX*C.width,y:t.y+ie.stepY*C.height},ce[0],ce[1]);de&&!il(t,de,d)&&(de.id="".concat(de.x,"|||").concat(de.y),a.push(de))}return a}var xe=kd(C,t,n);return xe.id="".concat(xe.x,"|||").concat(xe.y),[xe]},Cd=function(t,e,r,n){var i=Md(t,e);if(!r[t.id]){var a=Md(n,t);return Ud(a,i)}var o=Md({x:r[t.id].x,y:r[t.id].y},t);return Ud(o,i)},Sh=function(t,e,r,n,i,a,o){var s=[n],d=t.id,y=t.x,C=t.y,F={x:y,y:C,id:d};for(Cd(F,a,e,r)&&s.unshift({x:a.x===n.x?n.x:F.x*o,y:a.y===n.y?n.y:F.y*o});e[d]&&e[d].id!==d;){var G={x:y,y:C,id:d},H=e[d].id,ie=e[d].x,se=e[d].y,ce={x:ie,y:se,id:H},de=Cd(ce,G,e,r);de&&s.unshift({x:ce.x===G.x?s[0].x:ce.x*o,y:ce.y===G.y?s[0].y:ce.y*o}),d=H,y=ie,C=se}var xe={x:y,y:C,id:d};return s[0].x=xe.x===r.x?i.x:s[0].x,s[0].y=xe.y===r.y?i.y:s[0].y,s.unshift(i),s},wh=function(t,e,r,n,i){if(isNaN(t.x)||isNaN(e.x))return[];var a=(0,_.deepMix)(uv,i);a.obstacles=a.obstacles||[];var o=a.gridSize,s=xh(a.obstacles.concat([r,n]),o,a.offset),d={x:Ku(t.x,o),y:Ku(t.y,o)},y={x:Ku(e.x,o),y:Ku(e.y,o)};t.id="".concat(d.x,"|||").concat(d.y),e.id="".concat(y.x,"|||").concat(y.y);var C=ql(d,t,r,y,a),F=ql(y,e,n,d,a);C.forEach(function(Er){delete s[Er.id]}),F.forEach(function(Er){delete s[Er.id]});for(var G={},H={},ie={},se={},ce={},de=0;de<C.length;de++){var xe=C[de];G[xe.id]=xe,se[xe.id]=0,ce[xe.id]=zd(xe,F,a.distFunc)}for(var Ie=a.maximumLoops,qe=a.penalties,ze,$e,mt,xt,wt,Yt,Zt;Object.keys(G).length>0&&Ie>0&&(ze=void 0,$e=Infinity,Object.keys(G).forEach(function(Er){var Fr=G[Er].id;ce[Fr]<=$e&&($e=ce[Fr],ze=G[Fr])}),!!ze);){if(F.findIndex(function(Er){return Er.x===ze.x&&Er.y===ze.y})>-1)return Sh(ze,ie,d,e,t,y,o);delete G[ze.id],H[ze.id]=!0;for(var de=0;de<a.directions.length;de++)mt=a.directions[de],xt={x:ze.x+mt.stepX,y:ze.y+mt.stepY,id:"".concat(Math.round(ze.x)+mt.stepX,"|||").concat(Math.round(ze.y)+mt.stepY)},!H[xt.id]&&(Zt=Cd(ze,xt,ie,d),!(Zt>a.maxAllowedDirectionChange)&&(s[xt.id]||(G[xt.id]||(G[xt.id]=xt),wt=a.distFunc(ze,xt)+(isNaN(qe[Zt])?o:qe[Zt]),Yt=se[ze.id]+wt,!(se[xt.id]&&Yt>=se[xt.id])&&(ie[xt.id]=ze,se[xt.id]=Yt,ce[xt.id]=Yt+zd(xt,F,a.distFunc)))));Ie-=1}return a.fallbackRoute(t,e,r,n,a)};vc("polyline",{options:{color:ln.defaultEdge.color,size:ln.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:ln.defaultEdge.style.stroke,lineAppendWidth:ln.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:ln.edgeLabel.style.fill,fontSize:ln.edgeLabel.style.fontSize,fontFamily:ln.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:(0,g.__assign)({},ln.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,_.mix)({},e,r,t.style);t=this.getPathPoints(t),this.radius=n.radius,this.offset=n.offset;var i=t.startPoint,a=t.endPoint,o=this.getControlPoints(t),s=[i];o&&(s=s.concat(o)),s.push(a);var d=t.sourceNode,y=t.targetNode,C=n.radius,F=this.options.routeCfg,G=(0,_.mix)({},F,t.routeCfg);G.offset=n.offset;var H=this.getPath(s,d,y,C,G);((0,_.isArray)(H)&&H.length<=1||(0,_.isString)(H)&&H.indexOf("L")===-1)&&(H="M0 0, L0 0"),(isNaN(i.x)||isNaN(i.y)||isNaN(a.x)||isNaN(a.y))&&(H="M0 0, L0 0");var ie=(0,_.mix)({},ln.defaultEdge.style,n,{lineWidth:t.size,path:H});return ie},updateShapeStyle:function(t,e){var r=e.getContainer();if(!!e.isVisible()){var n={stroke:t.color},i=r.shapeMap["edge-shape"]||r.find(function(Ie){return Ie.get("className")==="edge-shape"})||e.getKeyShape(),a=t.size;t=this.getPathPoints(t);var o=t.startPoint,s=t.endPoint,d=this.getControlPoints(t),y=[o];d&&(y=y.concat(d)),y.push(s);var C=i.attr(),F=(0,_.mix)({},n,C,t.style),G=t.sourceNode,H=t.targetNode,ie=F.radius,se=this.options.routeCfg,ce=(0,_.mix)({},se,t.routeCfg);ce.offset=F.offset;var de=this.getPath(y,G,H,ie,ce);((0,_.isArray)(de)&&de.length<=1||(0,_.isString)(de)&&de.indexOf("L")===-1)&&(de="M0 0, L0 0"),(isNaN(o.x)||isNaN(o.y)||isNaN(s.x)||isNaN(s.y))&&(de="M0 0, L0 0"),C.endArrow&&F.endArrow===!1&&(t.style.endArrow={path:""}),C.startArrow&&F.startArrow===!1&&(t.style.startArrow={path:""});var xe=(0,_.mix)(n,i.attr(),{lineWidth:a,path:de},t.style);i&&i.attr(xe)}},getPath:function(t,e,r,n,i){var a=i.offset,o=i.simple;if(!a||t.length>2){if(n)return Fd(t,n);var s=[];return(0,_.each)(t,function(F,G){G===0?s.push(["M",F.x,F.y]):s.push(["L",F.x,F.y])}),s}var d=o?_h(t[t.length-1],t[0],r,e,a):wh(t[0],t[t.length-1],e,r,i);if(!d||!d.length)return"M0 0, L0 0";if(n){var y=Fd(d,n);return y}var C=Eo.pointsToPolygon(d);return C}},"single-edge");var Wd=va.cloneEvent,jd=va.isNaN,Mh=Math.abs,Ch=10,cv=["shift","ctrl","alt","control"],fv={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{dragstart:"onMouseDown",drag:"onMouseMove",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(!(jd(r)||jd(n))){var i=r-e.x,a=n-e.y;this.get("direction")==="x"?a=0:this.get("direction")==="y"&&(i=0),this.origin={x:r,y:n};var o=this.graph.get("width"),s=this.graph.get("height"),d=this.graph.get("canvas").getCanvasBBox(),y=this.scalableRange,C=this.scalableRange;y<1&&y>-1&&(y=o*y,C=s*C),(d.minX<=o+y&&d.minX+i>o+y||d.maxX+y>=0&&d.maxX+y+i<0)&&(i=0),(d.minY<=s+C&&d.minY+a>s+C||d.maxY+C>=0&&d.maxY+C+a<0)&&(a=0),this.graph.translate(i,a)}},onTouchStart:function(t){var e=this,r=t.originalEvent.touches,n=r[0],i=r[1];n&&i||(t.preventDefault(),e.onMouseDown(t))},onMouseDown: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.call(this,t)&&!e.keydown){var n=t.target,i=n&&n.isCanvas&&n.isCanvas();if(!(!this.allowDragOnItem&&!i)&&(e.origin={x:t.clientX,y:t.clientY},e.dragging=!1,this.enableOptimize)){for(var a=this.graph,o=a.getEdges(),s=0,d=o.length;s<d;s++){var y=o[s].get("group").get("children");!y||y.forEach(function(Ie){Ie.set("ori-visibility",Ie.get("ori-visibility")||Ie.get("visible")),Ie.hide()})}for(var C=a.getNodes(),F=0,G=C.length;F<G;F++)for(var H=C[F].getContainer(),ie=H.get("children"),se=0,ce=ie;se<ce.length;se++){var de=ce[se],xe=de.get("isKeyShape");xe||(de.set("ori-visibility",de.get("ori-visibility")||de.get("visible")),de.hide())}}}},onTouchMove:function(t){var e=this,r=t.originalEvent.touches,n=r[0],i=r[1];if(n&&i){this.onMouseUp(t);return}t.preventDefault(),e.onMouseMove(t)},onMouseMove:function(t){var e=this.graph;if(!this.keydown){var r=t.target,n=r&&r.isCanvas&&r.isCanvas();if(!(!this.allowDragOnItem&&!n)&&(t=Wd(t),!!this.origin)){if(this.dragging)t.type="drag",e.emit("canvas:drag",t);else{if(Mh(this.origin.x-t.clientX)+Mh(this.origin.y-t.clientY)<Ch)return;this.shouldBegin.call(this,t)&&(t.type="dragstart",e.emit("canvas:dragstart",t),this.originPosition={x:t.clientX,y:t.clientY},this.dragging=!0)}this.shouldUpdate.call(this,t)&&this.updateViewport(t)}}},onMouseUp:function(t){var e,r,n=this.graph;if(!this.keydown){var i=n.getZoom(),a=n.get("modeController"),o=(r=(e=a==null?void 0:a.modes[a.mode])===null||e===void 0?void 0:e.filter(function($e){return $e.type==="zoom-canvas"}))===null||r===void 0?void 0:r[0],s=o?o.optimizeZoom||.1:0;if(this.enableOptimize){for(var d=n.getEdges(),y=0,C=d.length;y<C;y++){var F=d[y].get("group").get("children");!F||F.forEach(function($e){var mt=$e.get("ori-visibility");$e.set("ori-visibility",void 0),mt&&$e.show()})}if(i>s)for(var G=n.getNodes(),H=0,ie=G.length;H<ie;H++)for(var se=G[H].getContainer(),ce=se.get("children"),de=0,xe=ce;de<xe.length;de++){var Ie=xe[de],qe=Ie.get("isKeyShape");if(!qe){var ze=Ie.get("ori-visibility");Ie.set("ori-visibility",void 0),ze&&Ie.show()}}}if(!this.dragging){this.origin=null;return}t=Wd(t),this.shouldEnd.call(this,t)&&this.updateViewport(t),t.type="dragend",t.dx=t.clientX-this.originPosition.x,t.dy=t.clientY-this.originPosition.y,n.emit("canvas:dragend",t),this.endDrag()}},endDrag:function(){this.origin=null,this.dragging=!1,this.dragbegin=!1},onKeyDown:function(t){var e=this,r=t.key;!r||(cv.indexOf(r.toLowerCase())>-1?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1}},lv={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:dragstart":"onDragStart","node:drag":"onDrag","node:dragend":"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"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],i=r[1];if(n&&i)return;t.preventDefault()}catch(a){console.warn("Touch original event not exist!")}e.onDragStart(t)}},onTouchMove:function(t){var e=this;try{var r=t.originalEvent.touches,n=r[0],i=r[1];if(n&&i){e.onDragEnd(t);return}t.preventDefault()}catch(a){console.warn("Touch original event not exist!")}e.onDrag(t)},onDragStart:function(t){var e=this;if(this.currentShouldEnd=!0,!!this.shouldBegin.call(this,t)){var r=t.item;if(!(!r||r.destroyed||r.hasLocked())){var n=r.getContainer();n.set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(r);var i=t.target;if(i){var a=i.get("isAnchorPoint");if(a)return}var o=this.graph;this.targets=[],this.targetCombo=null;var s=o.findAllByState("node",this.selectedState),d=r.get("id"),y=s.filter(function(F){var G=F.get("id");return d===G});y.length===0?this.targets.push(r):s.length>1?s.forEach(function(F){var G=F.hasLocked();G||e.targets.push(F)}):this.targets.push(r);var C=[];this.targets.forEach(function(F){var G=F.getModel(),H=G.x,ie=G.y,se=G.id;C.push({x:H,y:ie,id:se})}),this.set("beforeDragNodes",C),this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(F){var G=F.getEdges();G.forEach(function(H){!H.isVisible()||(e.hidenEdge[H.getID()]=!0,H.hide())})}),this.origin={x:t.x,y:t.y},this.point={},this.originPoint={}}}},onDrag:function(t){var e=this;!this.origin||!this.shouldUpdate.call(this,t)||(this.get("enableDelegate")?this.updateDelegate(t):this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge")}):this.targets.map(function(r){e.update(r,t)}))},onDragEnd:function(t){var e=this,r;if(!!this.origin){(r=this.cachedCaptureItems)===null||r===void 0||r.forEach(function(a){var o=a.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(a){var o=a.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 i={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(a){i.before.nodes.push(a)}),this.targets.forEach(function(a){var o=a.getModel(),s=o.x,d=o.y,y=o.id;i.after.nodes.push({x:s,y:d,id:y})}),n.pushStack("update",(0,_.clone)(i))}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.call(this,t,e),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(i){var a=i.getModel();a.comboId!==n.id&&r.updateComboTree(i,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.call(this,t,void 0),this.updatePositions(t,!this.currentShouldEnd),!(!this.targets||this.targets.length===0||!this.currentShouldEnd)&&(this.onlyChangeComboSize?e.updateCombos():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,i=r.getModel().comboId,a=i?n.findById(i):void 0;if(this.currentShouldEnd=this.shouldEnd.call(this,t,a),this.updatePositions(t,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)n.updateCombos();else if(i){var o=n.findById(i);e.comboActiveState&&n.setItemState(o,e.comboActiveState,!1),this.targets.map(function(s){var d=s.getModel();i!==d.comboId&&n.updateComboTree(s,i)}),n.updateCombo(o)}else this.targets.map(function(s){var d=s.getModel();d.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"),updateFunc:this.update}):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,i=t.get("model"),a=t.get("id");this.point[a]||(this.point[a]={x:i.x||0,y:i.y||0});var o=e.x-n.x+this.point[a].x,s=e.y-n.y+this.point[a].y;r&&(o+=n.x-e.x,s+=n.y-e.y);var d={x:o,y:s};this.get("updateEdge")?this.graph.updateItem(t,d,!1):t.updatePosition(d)},debounceUpdate:(0,_.debounce)(function(h){var t=h.targets,e=h.graph,r=h.point,n=h.origin,i=h.evt,a=h.updateEdge,o=h.updateFunc;t.map(function(s){var d=s.get("model"),y=s.get("id");r[y]||(r[y]={x:d.x||0,y:d.y||0});var C=i.x-n.x+r[y].x,F=i.y-n.y+r[y].y,G={x:C,y:F};a?e.updateItem(s,G,!1):s.updatePosition(G)})},50,!0),updateDelegate:function(t){var e=this.graph;if(this.delegateRect){var F=t.x-this.origin.x+this.originPoint.minX,G=t.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:F,y:G})}else{var r=e.get("group"),n=(0,_.deepMix)({},uo.delegateStyle,this.delegateStyle),i=this.calculationGroupPosition(t),a=i.x,o=i.y,s=i.width,d=i.height,y=i.minX,C=i.minY;this.originPoint={x:a,y:o,width:s,height:d,minX:y,minY:C},this.delegateRect=r.addShape("rect",{attrs:(0,g.__assign)({width:s,height:d,x:a,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,i=Infinity,a=-Infinity,o=0;o<e.length;o++){var s=e[o],d=s.getBBox(),y=d.minX,C=d.minY,F=d.maxX,G=d.maxY;y<r&&(r=y),C<i&&(i=C),F>n&&(n=F),G>a&&(a=G)}var H=Math.floor(r),ie=Math.floor(i),se=Math.ceil(n)-Math.floor(r),ce=Math.ceil(a)-Math.floor(i);return{x:H,y:ie,width:se,height:ce,minX:r,minY:i}}},dv={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],i=r[1];if(n&&i)return;t.preventDefault()}catch(a){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],i=r[1];if(n&&i)return;t.preventDefault()}catch(a){console.warn("Touch original event not exist!")}e.clearActiveState(t)},setAllItemStates:function(t){var e=t.item,r=this.graph;if(this.item=e,!!this.shouldUpdate(t.item,{event:t,action:"activate"})){for(var n=this,i=this.activeState,a=this.inactiveState,o=r.getNodes(),s=r.getCombos(),d=r.getEdges(),y=r.get("vedges"),C=o.length,F=s.length,G=d.length,H=y.length,ie=0;ie<C;ie++){var se=o[ie],ce=se.hasState("selected");n.resetSelected&&ce&&r.setItemState(se,"selected",!1),r.setItemState(se,i,!1),a&&r.setItemState(se,a,!0)}for(var ie=0;ie<F;ie++){var de=s[ie],ce=de.hasState("selected");n.resetSelected&&ce&&r.setItemState(de,"selected",!1),r.setItemState(de,i,!1),a&&r.setItemState(de,a,!0)}for(var ie=0;ie<G;ie++){var xe=d[ie];r.setItemState(xe,i,!1),a&&r.setItemState(xe,a,!0)}for(var ie=0;ie<H;ie++){var Ie=y[ie];r.setItemState(Ie,i,!1),a&&r.setItemState(Ie,a,!0)}a&&r.setItemState(e,a,!1),r.setItemState(e,i,!0);for(var qe=e.getEdges(),ze=qe.length,ie=0;ie<ze;ie++){var xe=qe[ie],$e=void 0;xe.getSource()===e?$e=xe.getTarget():$e=xe.getSource(),a&&r.setItemState($e,a,!1),r.setItemState($e,i,!0),r.setItemState(xe,a,!1),r.setItemState(xe,i,!0),xe.toFront()}r.emit("afteractivaterelations",{item:t.item,action:"activate"})}},clearActiveState:function(t){var e=this,r=e.get("graph");if(!!e.shouldUpdate(t.item,{event:t,action:"deactivate"})){var n=this.activeState,i=this.inactiveState,a=r.get("autoPaint");r.setAutoPaint(!1);for(var o=r.getNodes()||[],s=r.getCombos()||[],d=r.getEdges()||[],y=r.get("vedges")||[],C=o.length,F=s.length,G=d.length,H=y.length,ie=0;ie<C;ie++){var se=o[ie];r.clearItemStates(se,[n,i])}for(var ie=0;ie<F;ie++){var ce=s[ie];r.clearItemStates(ce,[n,i])}for(var ie=0;ie<G;ie++){var de=d[ie];r.clearItemStates(de,[n,i,"deactivate"])}for(var ie=0;ie<H;ie++){var xe=y[ie];r.clearItemStates(xe,[n,i,"deactivate"])}r.paint(),r.setAutoPaint(a),r.emit("afteractivaterelations",{item:t.item||e.get("item"),action:"deactivate"})}}},Td=Math.min,Vd=Math.max,Xd=Math.abs,Yd="shift",Th=["drag","shift","ctrl","alt","control"],Ah={getDefaultCfg:function(){return{brushStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},selectedState:"selected",trigger:Yd,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Th.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=Yd,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),i=e.findAllByState("edge",r);n.forEach(function(a){return e.setItemState(a,r,!1)}),i.forEach(function(a){return e.setItemState(a,r,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),e.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedNodes:function(t){var e=this,r=this,n=r.graph,i=r.originPoint,a=r.shouldUpdate,o=this.selectedState,s={x:t.x,y:t.y},d=n.getPointByCanvas(i.x,i.y),y=Td(s.x,d.x),C=Vd(s.x,d.x),F=Td(s.y,d.y),G=Vd(s.y,d.y),H=[],ie=[];n.getNodes().forEach(function(ce){if(!!ce.isVisible()){var de=ce.getBBox();if(de.centerX>=y&&de.centerX<=C&&de.centerY>=F&&de.centerY<=G&&a(ce,"select")){H.push(ce);var xe=ce.getModel();ie.push(xe.id),n.setItemState(ce,o,!0)}}});var se=[];this.includeEdges&&H.forEach(function(ce){var de=ce.getOutEdges();de.forEach(function(xe){if(!!xe.isVisible()){var Ie=xe.getModel(),qe=Ie.source,ze=Ie.target;ie.includes(qe)&&ie.includes(ze)&&a(xe,"select")&&(se.push(xe),n.setItemState(xe,e.selectedState,!0))}})}),this.selectedEdges=se,this.selectedNodes=H,this.onSelect&&this.onSelect(H,se),n.emit("nodeselectchange",{selectedItems:{nodes:H,edges:se},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:Xd(t.canvasX-e.x),height:Xd(t.canvasY-e.y),x:Td(t.canvasX,e.x),y:Td(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}},Zd="shift",Ih=["shift","ctrl","alt","control"],Ph={getDefaultCfg:function(){return{multiple:!0,trigger:Zd,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var t=this;return Ih.indexOf(t.trigger.toLowerCase())>-1||(t.trigger=Zd,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(),i=e.graph,a=e.keydown,o=e.multiple,s=e.shouldUpdate,d=e.shouldBegin;if(!!d.call(e,t)){if(!a||!o){var y=i.findAllByState("node",e.selectedState).concat(i.findAllByState("edge",e.selectedState)).concat(i.findAllByState("combo",e.selectedState));(0,_.each)(y,function(ie){ie!==r&&i.setItemState(ie,e.selectedState,!1)})}var C=function(){switch(n){case"node":return e.selectNode;case"edge":return e.selectEdge;case"combo":return e.selectCombo;default:return!1}}();if(!C){var F=i.findAllByState("node",e.selectedState),G=i.findAllByState("edge",e.selectedState),H=i.findAllByState("combo",e.selectedState);i.emit("nodeselectchange",{selectedItems:{nodes:F,edges:G,combos:H},select:!1});return}if(r.hasState(e.selectedState)){s.call(e,t)&&i.setItemState(r,e.selectedState,!1);var F=i.findAllByState("node",e.selectedState),G=i.findAllByState("edge",e.selectedState),H=i.findAllByState("combo",e.selectedState);i.emit("nodeselectchange",{target:r,selectedItems:{nodes:F,edges:G,combos:H},select:!1})}else{s.call(e,t)&&i.setItemState(r,e.selectedState,!0);var F=i.findAllByState("node",e.selectedState),G=i.findAllByState("edge",e.selectedState),H=i.findAllByState("combo",e.selectedState);i.emit("nodeselectchange",{target:r,selectedItems:{nodes:F,edges:G,combos:H},select:!0})}}}},onCanvasClick:function(t){var e=this,r=this,n=r.graph,i=r.shouldBegin;if(!!i.call(this,t)){var a=n.findAllByState("node",this.selectedState);(0,_.each)(a,function(d){n.setItemState(d,e.selectedState,!1)});var o=n.findAllByState("edge",this.selectedState);(0,_.each)(o,function(d){n.setItemState(d,e.selectedState,!1)});var s=n.findAllByState("combo",this.selectedState);(0,_.each)(s,function(d){n.setItemState(d,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}},Oh=ee.vs,Hd=.05,Dh={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.call(this,t)||(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 i=function(ie,se){return Math.hypot(se.x-ie.x,se.y-ie.y)},a=i({x:r.pageX,y:r.pageY},{x:n.pageX,y:n.pageY})/i({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),o=this.originScale*a;this.currentScale=o;var s=this.get("minZoom")||this.graph.get("minZoom"),d=this.get("maxZoom")||this.graph.get("maxZoom");if(!(o>d||o<s)){var y=this.get("animate"),C=this.get("animateCfg"),F=this.graph.get("canvas"),G=F.getPointByClient(t.clientX,t.clientY);this.graph.zoomTo(o,{x:G.x,y:G.y},y,C),this.graph.emit("wheelzoom",t)}}}},onTouchEnd:function(){this.moveable=!1,this.endPoint=null},onWheel:function(t){var e=this,r=this,n=r.graph,i=r.fixSelectedItems;if(!(this.shouldBegin&&!this.shouldBegin.call(this,t))&&!!this.shouldUpdate.call(this,t)){t.preventDefault();var a=n.get("canvas"),o=a.getPointByClient(t.clientX,t.clientY),s=this.get("sensitivity"),d=n.getZoom(),y=d,C=d;t.wheelDelta<0?y=1-Hd*s:y=1/(1-Hd*s),C=d*y;var F=this.get("minZoom")||n.get("minZoom"),G=this.get("maxZoom")||n.get("maxZoom");C>G?C=G:C<F&&(C=F);var H=this.get("enableOptimize");if(H){var ie=this.get("optimizeZoom"),se=this.get("optimized"),ce=n.getNodes(),de=n.getEdges(),xe=ce.length,Ie=de.length;if(!se){for(var qe=0;qe<xe;qe++){var ze=ce[qe];if(!ze.destroyed)for(var $e=ze.get("group").get("children"),mt=$e.length,xt=0;xt<mt;xt++){var wt=$e[xt];!wt.destoryed&&!wt.get("isKeyShape")&&(wt.set("ori-visibility",wt.get("ori-visibility")||wt.get("visible")),wt.hide())}}for(var Yt=0;Yt<Ie;Yt++)for(var Zt=de[Yt],$e=Zt.get("group").get("children"),mt=$e.length,xt=0;xt<mt;xt++){var wt=$e[xt];wt.set("ori-visibility",wt.get("ori-visibility")||wt.get("visible")),wt.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var Er=setTimeout(function(){var bi=n.getZoom(),Si=e.get("optimized");if(Si){e.set("optimized",!1);for(var Ci=0;Ci<xe;Ci++){var Ni=ce[Ci],ta=Ni.get("group").get("children"),Wn=ta.length;if(bi<ie){var Pi=Ni.getKeyShape(),wi=Pi.get("ori-visibility");Pi.set("ori-visibility",void 0),wi&&Pi.show()}else for(var Ei=0;Ei<Wn;Ei++){var Ai=ta[Ei],wi=Ai.get("ori-visibility");Ai.set("ori-visibility",void 0),!Ai.get("visible")&&wi&&wi&&Ai.show()}}for(var Li=0;Li<Ie;Li++){var ba=de[Li],ta=ba.get("group").get("children"),Wn=ta.length;if(bi<ie){var Pi=ba.getKeyShape(),wi=Pi.get("ori-visibility");Pi.set("ori-visibility",void 0),wi&&Pi.show()}else for(var Ei=0;Ei<Wn;Ei++){var Ai=ta[Ei];if(!Ai.get("visible")){var wi=Ai.get("ori-visibility");Ai.set("ori-visibility",void 0),wi&&Ai.show()}}}}},100);this.set("timeout",Er)}if(d<=1){var Fr=void 0,Ur=void 0;if(i.fixAll||i.fixLineWidth||i.fixLabel){Fr=n.findAllByState("node",i.fixState),Ur=n.findAllByState("edge",i.fixState);for(var Or=d/C,hn=Fr.length,sn=0;sn<hn;sn++){var ze=Fr[sn],Ir=ze.getContainer(),en=ze.getModel(),un=ze.getOriginStyle(),fn=ze.getStateStyle(i.fixState),pn=ze.get("shapeFactory").getShape(en.type).getStateStyle(i.fixState,ze)[i.fixState];if(i.fixAll){if(C<=1){var Tn=(0,_.clone)(Ir.getMatrix());Tn||(Tn=[1,0,0,0,1,0,0,0,1]);var Zn=ze.getModel(),ii=Zn.x,xi=Zn.y;Tn=Oh(Tn,[["t",-ii,-xi],["s",Or,Or],["t",ii,xi]]),Ir.setMatrix(Tn)}}else for(var $e=Ir.get("children"),mt=$e.length,xt=0;xt<mt;xt++){var wt=$e[xt],ui=void 0,ji=void 0;if(i.fixLabel){var Gi=wt.get("type");if(Gi==="text"){ui=wt.attr("fontSize")||12;var Ta=fn[wt.get("name")],Fi=pn[wt.get("name")],ya=Ta?Ta.fontSize:12,ma=Fi?Fi.fontSize:12,So=ya||ma||12;if(C<=1&&wt.attr("fontSize",So/C),ji)break}}if(i.fixLineWidth&&wt.get("isKeyShape")){ji=wt.attr("lineWidth")||0;var Qi=fn.lineWidth||pn.lineWidth||un.lineWidth||0;if(C<=1&&wt.attr("lineWidth",Qi/C),ui)break}}}for(var Ui=Ur.length,ja=0;ja<Ui;ja++)for(var Zt=Ur[ja],Ir=Zt.getContainer(),$e=Ir.get("children"),en=Zt.getModel(),fn=Zt.getStateStyle(i.fixState),pn=Zt.get("shapeFactory").getShape(en.type).getStateStyle(i.fixState,Zt)[i.fixState],mt=$e.length,xt=0;xt<mt;xt++){var wt=$e[xt],ui=void 0,ji=void 0;if(i.fixLabel||i.fixAll){var Gi=wt.get("type");if(Gi==="text"){ui=wt.attr("fontSize")||12;var Ta=fn[wt.get("name")],Fi=pn[wt.get("name")],ya=Ta?Ta.fontSize:12,ma=Fi?Fi.fontSize:12,So=ya||ma||12;if(C<=1&&wt.attr("fontSize",So/C),ji)break}}if((i.fixLineWidth||i.fixAll)&&wt.get("isKeyShape")){ji=wt.attr("lineWidth")||0;var Qi=fn.lineWidth||pn.lineWidth||1;if(C<=1&&wt.attr("lineWidth",Qi/C),ui)break}}}}var Va=this.get("animate"),Ko=this.get("animateCfg");n.zoomTo(C,{x:o.x,y:o.y},Va,Ko),n.emit("wheelzoom",t)}}},Kd={onMouseEnter:function(t){var e=t.item;this.currentTarget=e,this.showTooltip(t),this.graph.emit("tooltipchange",{item:t.item,action:"show"})},onMouseMove:function(t){if(!this.shouldUpdate(t)){this.hideTooltip();return}!this.currentTarget||t.item!==this.currentTarget||this.updatePosition(t)},onMouseLeave:function(t){!this.shouldEnd(t)||(this.hideTooltip(),this.graph.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null)},showTooltip:function(t){var e=this.container;if(!(!t.item||t.item.destroyed)){e||(e=this.createTooltip(this.graph.get("canvas")),this.container=e);var r=this.formatText(t.item.get("model"),t);e.innerHTML=r,(0,Qn.Z)(this.container,{visibility:"visible"}),this.updatePosition(t)}},hideTooltip:function(){(0,Qn.Z)(this.container,{visibility:"hidden"})},updatePosition:function(t){var e=this.get("shouldBegin"),r=this,n=r.width,i=r.height,a=r.container,o=r.graph;if(!e(t)){(0,Qn.Z)(a,{visibility:"hidden"});return}var s=o.getPointByClient(t.clientX,t.clientY),d=o.getCanvasByPoint(s.x,s.y),y=d.x,C=d.y,F=a.getBoundingClientRect();y>n/2?y-=F.width:y+=this.offset,C>i/2?C-=F.height:C+=this.offset;var G="".concat(y,"px"),H="".concat(C,"px");(0,Qn.Z)(this.container,{left:G,top:H,visibility:"visible"})},createTooltip:function(t){var e=t.get("el");e.style.position="relative";var r=(0,Di.Z)('<div class="g6-tooltip g6-'.concat(this.item,'-tooltip"></div>'));return e.parentNode.appendChild(r),(0,Qn.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}},Nh=(0,g.__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"}}},Kd),Ad=(0,g.__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"}}},Kd),$d="click",Lh=["click","dblclick"],Rh={getDefaultCfg:function(){return{trigger:$d,onChange:function(){}}},getEvents:function(){var t,e;return Lh.includes(this.trigger)?e=this.trigger:(e=$d,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=t.item;if(!!e){var r=this.graph.findDataById(e.get("id"));if(!!r){var n=r.children;if(!(!n||n.length===0)){var i=!r.collapsed;!this.shouldBegin(t,i)||(r.collapsed=i,e.getModel().collapsed=i,this.graph.emit("itemcollapsed",{item:t.item,collapsed:i}),!!this.shouldUpdate(t,i)&&(this.onChange(e,i),this.graph.layout()))}}}}},kh=va.calculationItemsBBox,Bh=function h(t,e){if(e(t)!==!1&&t){var r=t.get("combos");if(r.length===0)return!1;(0,_.each)(r,function(n){h(n,e)})}},Gh={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected",enableStack:!0}},getEvents:function(){return{"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.call(this,t))return!1;var r=e.getType();return r==="combo"},onDragStart:function(t){var e=this,r=this.graph,n=t.item;if(this.currentShouldEnd=!0,!!this.validationCombo(t)){this.targets=[];var i=r.findAllByState("combo",this.selectedState),a=n.get("id"),o=i.filter(function(d){var y=d.get("id");return a===y});o.length===0?this.targets.push(n):this.targets=i;var s=[];this.targets.forEach(function(d){var y=d.getModel(),C=y.x,F=y.y,G=y.id;s.push({x:C,y:F,id:G})}),this.set("beforeDragItems",s),this.activeState&&this.targets.map(function(d){var y=d.getModel();if(y.parentId){var C=r.findById(y.parentId);C&&r.setItemState(C,e.activeState,!0)}}),this.point={},this.originPoint={},this.origin={x:t.x,y:t.y},this.currentItemChildCombos=[],Bh(n,function(d){if(d.destroyed)return!1;var y=d.getModel();return e.currentItemChildCombos.push(y.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,i=n.getModel(),a=r.getCombos(),o=n.getBBox(),s=o.centerX,d=o.centerY,y=o.width,C=a.filter(function(F){var G=F.getModel();return i.parentId,G.id!==i.id&&!e.currentItemChildCombos.includes(G.id)});C.map(function(F){var G=F.getBBox(),H=G.centerX,ie=G.centerY,se=G.width,ce=s-H,de=d-ie,xe=2*Math.sqrt(ce*ce+de*de);y+se-xe>.8*y?r.setItemState(F,e.activeState,!0):r.setItemState(F,e.activeState,!1)})}(0,_.each)(this.targets,function(F){e.updateCombo(F,t)})}},updatePositions:function(t,e){var r=this;(this.enableDelegate||e)&&(0,_.each)(this.targets,function(n){r.updateCombo(n,t,e)})},onDrop:function(t){var e=this,r=t.item;if(this.currentShouldEnd=this.shouldEnd.call(this,t,r),this.updatePositions(t,!this.currentShouldEnd),!(!this.currentShouldEnd||!r||!this.targets||r.destroyed)){var n=this.graph,i=r.getModel();this.targets.map(function(a){var o=a.getModel();o.parentId!==i.id?(e.activeState&&n.setItemState(r,e.activeState,!1),e.onlyChangeComboSize?n.updateCombo(a):n.updateComboTree(a,i.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,i=n.getModel().comboId,a=i?r.findById(i):void 0;if(this.currentShouldEnd=this.shouldEnd.call(this,t,a),this.updatePositions(t,!this.currentShouldEnd),!!this.currentShouldEnd){var o;if(i){if(this.activeState){var s=r.findById(i);r.setItemState(s,this.activeState,!1)}this.targets.map(function(d){e.onlyChangeComboSize?r.updateCombo(d):i!==d.getID()&&(o=r.findById(i),i!==d.getModel().parentId&&r.updateComboTree(d,i,!1))})}else this.targets.map(function(d){if(e.onlyChangeComboSize)r.updateCombo(d);else{var y=d.getModel();y.comboId&&r.updateComboTree(d,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 i=n.get("delegateGroup");i.clear(),this.delegateShape=null}if(t&&this.activeState&&n.setItemState(t,this.activeState,!1),!t){var a=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,a);else{n.updateCombo(s);var d=s.getModel(),y=d.x,C=d.y,F=d.id;o.after.combos.push({x:y,y:C,id:F}),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 i=t.get("combos");(0,_.each)(i,function(o){n.traverse(o,e,r)});var a=t.get("nodes");(0,_.each)(a,function(o){n.traverse(o,e,r)})}},updateCombo:function(t,e,r){this.updateSingleItem(t,e,r);var n={};this.traverse(t,function(i,a){return i.destroyed?!1:(i.getEdges().forEach(function(o){return a[o.getID()]=o}),!0)},n),Object.values(n).forEach(function(i){return i.refresh()})},updateSingleItem:function(t,e,r){var n=this.origin,i=this.graph,a=t.getModel(),o=t.get("id");this.point[o]||(this.point[o]={x:a.x,y:a.y});var s=e.x-n.x+this.point[o].x,d=e.y-n.y+this.point[o].y;r&&(s+=n.x-e.x,d+=n.y-e.y),i.updateItem(t,{x:s,y:d},!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 F=t.x-this.origin.x+this.originPoint.minX,G=t.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:F,y:G})}else{var r=e.get("delegateGroup"),n=null;this.targets.length>1?n=kh(this.targets):n=this.targets[0].getBBox();var i=n.x,a=n.y,o=n.width,s=n.height,d=n.minX,y=n.minY;this.originPoint={x:i,y:a,width:o,height:s,minX:d,minY:y};var C=(0,g.__assign)((0,g.__assign)({},uo.delegateStyle),this.delegateStyle);this.delegateShape=r.addShape("rect",{attrs:(0,g.__assign)({width:n.width,height:n.height,x:n.x,y:n.y},C),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}}},Qd="dblclick",Fh=["click","dblclick"],Uh={getDefaultCfg:function(){return{trigger:Qd,relayout:!0}},getEvents:function(){var t,e;return Fh.includes(this.trigger)?e=this.trigger:(e=Qd,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,i=r.relayout;if(!(!e||e.destroyed||e.getType()!=="combo")){var a=e.getModel(),o=a.id;!o||(n.collapseExpandCombo(o),i&&n.get("layout")?n.layout():n.refreshPositions())}}},zh=va.isPolygonsIntersect,Jd=va.pathToPoints,qd="shift",Wh=["drag","shift","ctrl","alt","control"],jh=function(t,e){var r,n=t.getKeyShape();if(t.get("type")==="path")r=Jd(n.attr("path"));else{var i=n.getCanvasBBox();r=[[i.minX,i.minY],[i.maxX,i.minY],[i.maxX,i.maxY],[i.minX,i.maxY]]}return zh(e,r)},Vh={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:qd,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Wh.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=qd,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,i=e.shouldDeselect,a=r.findAllByState("node",n),o=r.findAllByState("edge",n);(!i||i({action:t,nodes:a,edges:o}))&&(a.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,i=this.points.map(function(y){return[r.getCanvasByPoint(y.x,y.y).x,r.getCanvasByPoint(y.x,y.y).y]}),a=this.selectedState,o=[],s=[];r.getNodes().forEach(function(y){if(!!y.isVisible()&&jh(y,i)&&n(y,"select")){o.push(y);var C=y.getModel();s.push(C.id),r.setItemState(y,a,!0)}});var d=[];this.includeEdges&&o.forEach(function(y){var C=y.getOutEdges();C.forEach(function(F){if(!!F.isVisible()){var G=F.getModel(),H=G.source,ie=G.target;s.includes(H)&&s.includes(ie)&&n(F,"select")&&(d.push(F),r.setItemState(F,t.selectedState,!0))}})}),this.selectedEdges=d,this.selectedNodes=o,this.onSelect&&this.onSelect(o,d),r.emit("nodeselectchange",{selectedItems:{nodes:o,edges:d},select:!0})},createLasso:function(){var t=this,e=t.graph.get("delegateGroup").addShape("path",{attrs:(0,g.__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}},eh="click",Xh=["click","drag"],Id=void 0,Yh=["shift","ctrl","control","alt","meta",void 0],Zh={getDefaultCfg:function(){return{trigger:eh,key:Id,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var t=this;Xh.indexOf(t.trigger.toLowerCase())>-1||(t.trigger=eh,console.warn("Behavior create-edge \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click'\uFF0C'drag'")),t.key&&Yh.indexOf(t.key.toLowerCase())===-1&&(t.trigger=Id,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,i=r.getModel(),a=e.getEdgeConfig;if(e.addingEdge&&e.edge){if(!e.shouldEnd.call(e,t))return;var o=void 0;a&&(0,_.isFunction)(a)?o=a({source:e.source,target:i.id}):o=e.edgeConfig;var s=(0,g.__assign)({target:i.id},o);if(e.source===i.id&&(s.type="loop"),n.emit("beforecreateedge",{}),n.updateItem(e.edge,s,!1),n.get("enabledStack")){var d=(0,g.__assign)((0,g.__assign)({},e.edge.getModel()),{itemType:"edge"}),y={};y.edges=[d],n.pushStack("add",{before:{},after:y})}n.emit("aftercreateedge",{edge:e.edge}),e.edge.getKeyShape().set("capture",!0),e.edge=null,e.addingEdge=!1}else{if(!e.shouldBegin.call(e,t))return;var o=void 0;a&&(0,_.isFunction)(a)?o=a({source:i.id,target:i.id}):o=e.edgeConfig,e.edge=n.addItem("edge",(0,g.__assign)({source:i.id,target:i.id},o),!1),e.source=i.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 i=n.graph,a=t.item;if(n.addingEdge&&(n.edge===a||((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&&i.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}},th="ctrl",hv=["shift","ctrl","alt","control"],vv="1",b={getDefaultCfg:function(){return{trigger:th,combinedKey:vv,functionName:"fitView",functionParams:[]}},getEvents:function(){return hv.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=th,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 i=this.graph;if(!i[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?i[this.functionName].apply(i,this.functionParams):i[this.functionName]();return}var a=this.combinedKey.toLowerCase();this.triggerKeydown&&(n===a||n==="control"&&a==="ctrl"||n==="ctrl"&&a==="control")&&(this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]())}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}},q=["shift","ctrl","alt","control","meta"],L={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0}},getEvents:function(){return(!this.zoomKey||q.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(t){var e=this,r=this.graph,n=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];n.includes("control")&&n.push("ctrl");var i=n.some(function(en){return t["".concat(en,"Key")]});if(i){var a=r.get("canvas"),o=a.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 d=t.deltaX||t.movementX,y=t.deltaY||t.movementY;!y&&navigator.userAgent.indexOf("Firefox")>-1&&(y=-t.wheelDelta*125/3);var C=this.graph.get("width"),F=this.graph.get("height"),G=this.graph.get("canvas").getCanvasBBox(),H=this.scalableRange,ie=this.scalableRange;H<1&&H>-1&&(H=C*H,ie=F*ie);var se=G.minX,ce=G.maxX,de=G.minY,xe=G.maxY;d>0?ce<-H?d=0:ce-d<-H&&(d=ce+H):d<0&&(se>C+H?d=0:se-d>C+H&&(d=se-(C+H))),y>0?xe<-ie?y=0:xe-y<-ie&&(y=xe+ie):y<0&&(de>F+ie?y=0:de-y>F+ie&&(y=de-(F+ie))),this.get("direction")==="x"?y=0:this.get("direction")==="y"&&(d=0),r.translate(-d,-y)}t.preventDefault();var Ie=this.get("enableOptimize");if(Ie){var qe=this.get("optimizeZoom"),ze=this.get("optimized"),$e=r.getNodes(),mt=r.getEdges(),xt=$e.length,wt=mt.length;if(!ze){for(var Yt=0;Yt<xt;Yt++){var Zt=$e[Yt];if(!Zt.destroyed)for(var Er=Zt.get("group").get("children"),Fr=Er.length,Ur=0;Ur<Fr;Ur++){var Or=Er[Ur];!Or.destoryed&&!Or.get("isKeyShape")&&(Or.set("ori-visibility",Or.get("ori-visibility")||Or.get("visible")),Or.hide())}}for(var hn=0;hn<wt;hn++)for(var sn=mt[hn],Er=sn.get("group").get("children"),Fr=Er.length,Ur=0;Ur<Fr;Ur++){var Or=Er[Ur];Or.set("ori-visibility",Or.get("ori-visibility")||Or.get("visible")),Or.hide()}this.set("optimized",!0)}clearTimeout(this.get("timeout"));var Ir=setTimeout(function(){var en=r.getZoom(),un=e.get("optimized");if(un){e.set("optimized",!1);for(var fn=0;fn<xt;fn++){var pn=$e[fn],Tn=pn.get("group").get("children"),Zn=Tn.length;if(en<qe){var ii=pn.getKeyShape(),xi=ii.get("ori-visibility");xi&&ii.show()}else for(var ui=0;ui<Zn;ui++){var ji=Tn[ui],xi=ji.get("ori-visibility");!ji.get("visible")&&xi&&xi&&ji.show()}}for(var Gi=0;Gi<wt;Gi++){var Ta=mt[Gi],Tn=Ta.get("group").get("children"),Zn=Tn.length;if(en<qe){var ii=Ta.getKeyShape(),xi=ii.get("ori-visibility");xi&&ii.show()}else for(var ui=0;ui<Zn;ui++){var ji=Tn[ui];if(!ji.get("visible")){var xi=ji.get("ori-visibility");xi&&ji.show()}}}}},100);this.set("timeout",Ir)}}},X={"drag-canvas":fv,"zoom-canvas":Dh,"drag-node":lv,"activate-relations":dv,"brush-select":Ah,"click-select":Ph,"lasso-select":Vh,tooltip:Nh,"edge-tooltip":Ad,"collapse-expand":Rh,"drag-combo":Gh,"collapse-expand-combo":Uh,"create-edge":Zh,"shortcuts-call":b,"scroll-canvas":L};(0,_.each)(X,function(h,t){du(t,h)});var K=(0,g.__assign)((0,g.__assign)({},S),Nu),ve=Wa.Grid,Ce=Wa.Minimap,Ue=Wa.Bundling,nt=Wa.Menu,vt=Wa.Fisheye,_t=Wa.ToolBar,rr=Wa.Tooltip,Mr=Wa.TimeBar,Rr=Wa.ImageMinimap,Cr=Wa.EdgeFilterLens,Dr=Wa.SnapLine,an=Wa.Legend,_n=Wa.Annotation,An={version:uo.version,Graph:Xu,TreeGraph:mu,Util:va,Layout:ti.Layouts,TreeLayout:zu,registerLayout:tf,Global:uo,registerBehavior:du,registerCombo:sd,registerEdge:vc,registerNode:Vo,Minimap:Wa.Minimap,Grid:Wa.Grid,Bundling:Wa.Bundling,Menu:Wa.Menu,ToolBar:Wa.ToolBar,Tooltip:Wa.Tooltip,Legend:Wa.Legend,TimeBar:Mr,SnapLine:Dr,Fisheye:vt,ImageMinimap:Rr,EdgeFilterLens:Cr,Annotation:_n,Algorithm:K,Arrow:cs,Marker:on,Shape:jo};An.version="4.7.4";var vn=An,ei="4.7.4",Gn=M(73935),mi=function(h,t){var e=document.createElement("div");return e.className=t,Gn.render(h,e),e},si=function(){function h(t){this._cfgs=(0,_.deepMix)(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return h.prototype.getDefaultCfgs=function(){return{}},h.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var r=e.getEvents(),n={};(0,_.each)(r,function(i,a){var o=(0,_.wrapBehavior)(e,i);n[a]=o,t.on(a,o)}),this._events=n,this.init()},h.prototype.getEvents=function(){return{}},h.prototype.get=function(t){var e;return(e=this._cfgs)===null||e===void 0?void 0:e[t]},h.prototype.set=function(t,e){this._cfgs[t]=e},h.prototype.destroy=function(){},h.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;(0,_.each)(e,function(r,n){t.off(n,r)}),this._events=null,this._cfgs=null,this.destroyed=!0},h}(),ni=si,oa=function(){var h=function(t,e){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},h(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");h(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();typeof document!="undefined"&&Yu()(`
  205. .g6-component-contextmenu {
  206. border: 1px solid #e2e2e2;
  207. border-radius: 4px;
  208. font-size: 12px;
  209. color: #545454;
  210. background-color: rgba(255, 255, 255, 0.9);
  211. padding: 10px 8px;
  212. box-shadow: rgb(174, 174, 174) 0px 0px 10px;
  213. }
  214. .g6-contextmenu-ul {
  215. padding: 0;
  216. margin: 0;
  217. list-style: none;
  218. }
  219. `);var Ma=function(h){oa(t,h);function t(e){return h.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,customContent:function(e){return`
  220. <ul class='g6-contextmenu-ul'>
  221. <li>\u83DC\u5355\u98791</li>
  222. <li>\u83DC\u5355\u98792</li>
  223. </ul>
  224. `},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,Di.Z)("<div class=".concat(e||"g6-component-contextmenu","></div>"));(0,Qn.Z)(r,{top:"0px",position:"absolute",visibility:"hidden"});var n=this.get("container");n||(n=this.get("graph").get("container")),(0,_.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 i=this.get("shouldBegin");if(!!i(e)){var a=this.get("menu"),o=this.get("customContent"),s=this.get("graph"),d=o(e,s);Gn.render(d,a),this.removeMenuEventListener();var y=this.get("handleMenuClick");if(y){var C=function($e){y($e.target,e.item,s)};this.set("handleMenuClickWrapper",C),a.addEventListener("click",C)}var F=s.get("width"),G=s.get("height"),H=a.getBoundingClientRect(),ie=this.get("offsetX")||0,se=this.get("offsetY")||0,ce=s.getContainer().offsetTop,de=s.getContainer().offsetLeft,xe=e.canvasX+de+ie,Ie=e.canvasY+ce+se;xe+H.width>F&&(xe=e.canvasX-H.width-ie+de),Ie+H.height>G&&(Ie=e.canvasY-H.height-se+ce),(0,Qn.Z)(a,{top:"".concat(Ie,"px"),left:"".concat(xe,"px"),visibility:"visible"});var qe=this.get("trigger")==="click",ze=function($e){if(qe){qe=!1;return}r.onMenuHide()};document.body.addEventListener("click",ze),this.set("handler",ze)}},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,Qn.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,_.isString)(r)&&(r=document.getElementById(r)),r.removeChild(e)}},t}(ni),Na=Ma,$i=function(h,t){return(0,_.reduce)(h,function(e,r,n){return n=t?t(r):r,e.hasOwnProperty(n)?++e[n]:e[n]=1,e},{})},Ca={hover:{stroke:"#1890ff",lineWidth:2}},sa=null,Ls={stroke:"#40a9ff"},Ac=[[0,.5],[1,.5]],df={fill:"#000",fontSize:12},ea={fill:"#000",fontSize:12,textAlign:"start",textBaseline:"middle"},Pd={show:!1,size:[150,100],type:"keyShape"},hf={fill:"#fff",stroke:"#40a9ff",radius:2},al=6,ps="g",ed=function(h){var t=h.center,e=h.eventNodePosition,r=h.nodes,n=h.layoutNodes,i=h.options,a=i===void 0?{}:i,o=a,s=o.unitRadius,d=s===void 0?80:s,y=o.nodeSize,C=y===void 0?20:y,F=o.nodeSpacing,G=F===void 0?10:F;!n.length;var H=n.filter(function(Er){return r.findIndex(function(Fr){var Ur=Fr.id;return Ur===Er.id})!==-1});if(!H.length)return n;var ie=function(Er,Fr){var Ur=Er.x-Fr.x,Or=Er.y-Fr.y;return Math.sqrt(Math.pow(Ur,2)+Math.pow(Or,2))},se=t[0],ce=t[1],de=e[0],xe=e[1],Ie=de-se,qe=xe-ce,ze=[];r.forEach(function(Er){var Fr=Er.id,Ur=Er.x,Or=Er.y;ze.push({id:Fr,x:Ur,y:Or,layer:Math.round(ie({x:Ur,y:Or},{x:se,y:ce}))/d})});var $e=Math.sqrt(Math.pow(Ie,2)+Math.pow(qe,2)),mt=Math.atan2(qe,Ie),xt=$e+d,wt=[],Yt=function(Er,Fr){var Ur=2*Math.asin((C+G)/2/Fr);wt=[];var Or=Er.length-1;Er.forEach(function(hn,sn){hn.x=se+Fr*Math.cos(mt+(-Or/2+sn)*Ur),hn.y=ce+Fr*Math.sin(mt+(-Or/2+sn)*Ur),wt.push({x:hn.x,y:hn.y})})},Zt=function(Er,Fr){for(var Ur=!1,Or=Math.round(xt/d),hn=Er.filter(function(en){return en.layer===Or}),sn=0;sn<hn.length;sn++){var Ir=hn[sn];if(ie(Fr[0],Ir)<C||ie(Fr[Fr.length-1],Ir)<C){Ur=!0;break}}return Ur};for(Yt(H,xt);Zt(ze,wt);)xt+=d,Yt(H,xt);return n},qa=function(){return qa=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},qa.apply(this,arguments)},Od=function(h,t,e,r){function n(i){return i instanceof e?i:new e(function(a){a(i)})}return new(e||(e=Promise))(function(i,a){function o(y){try{d(r.next(y))}catch(C){a(C)}}function s(y){try{d(r.throw(y))}catch(C){a(C)}}function d(y){y.done?i(y.value):n(y.value).then(o,s)}d((r=r.apply(h,t||[])).next())})},Dd=function(h,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,n,i,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(d){return function(y){return s([d,y])}}function s(d){if(r)throw new TypeError("Generator is already executing.");for(;e;)try{if(r=1,n&&(i=d[0]&2?n.return:d[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,d[1])).done)return i;switch(n=0,i&&(d=[d[0]&2,i.value]),d[0]){case 0:case 1:i=d;break;case 4:return e.label++,{value:d[1],done:!1};case 5:e.label++,n=d[1],d=[0];continue;case 7:d=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){e=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){e.label=d[1];break}if(d[0]===6&&e.label<i[1]){e.label=i[1],i=d;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(d);break}i[2]&&e.ops.pop(),e.trys.pop();continue}d=t.call(h,e)}catch(y){d=[6,y],n=0}finally{r=i=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}},Hh=function(h,t){var e={}.toString;return e.call(h)==="[object ".concat(t,"]")},vf=window.console,Fv=function(h){return Object.prototype.toString.call(h).slice(8,-1)},Nd=function(h){if(!h||typeof h!="object")return h;var t;return Array.isArray(h)?t=h.map(function(e){return Nd(e)}):h instanceof HTMLElement?t=h:(t={},Object.keys(h).forEach(function(e){return t[e]=Nd(h[e])})),t},Sv=function(h,t,e){var r,n;return e&&e.current&&(r=e.current.offsetWidth,n=e.current.offsetHeight||500),!h&&!r||!t&&!n?(vf.warn("\u8BF7\u4E3A Graph \u6307\u5B9A width \u4E0E height\uFF01\u5426\u5219\u5C06\u4F7F\u7528\u9ED8\u8BA4\u503C 500 * 500"),[500,500]):[h||r||500,t||n||500]},wv=function(){function h(t){t&&this.setData(t)}return h.prototype.getData=function(){return this.data},h.prototype.setData=function(t){this.data=t},h}(),Mv=function(h){var t=h.nodes,e=h.edges;if(t.length===1)return t[0].id;var r=[];e.forEach(function(s){r.push(s.source)});var n=$i(r),i=0,a="";for(var o in n)n.hasOwnProperty(o)&&n[o]>i&&(i=n[o],a=o);return a},Uv=function(h,t,e,r){var n=function(i){return Od(void 0,void 0,void 0,function(){var a,o,s,d,y,C,F,G,H,ie,se,ce,de,xe,Ie,qe;return Dd(this,function(ze){switch(ze.label){case 0:return a=i.item,o=a.getModel(),mv(o,r),[4,t(a.getModel())];case 1:return s=ze.sent(),bv(),d=h.getNodes(),y=h.getEdges(),C=o.x,F=o.y,G=h.get("centerNode"),H=G?h.findById(G):d[0],ie=H.getModel(),se=ie.x,ce=ie.y,de=s.nodes.filter(function($e){return(0,_.findIndex)(d,function(mt){return mt.getModel().id===$e.id})===-1}),xe=s.edges.filter(function($e){return(0,_.findIndex)(y,function(mt){var xt=mt.getModel(),wt=xt.source,Yt=xt.target;return wt===$e.source&&Yt===$e.target})===-1}),Ie=[],qe=[],de.forEach(function($e){$e.x=o.x,$e.y=o.y,h.addItem("node",$e)}),xe.forEach(function($e,mt){h.addItem("edge",$e)}),y.forEach(function($e){qe.push($e.getModel())}),d.forEach(function($e){Ie.push($e.getModel())}),ed({center:[se,ce],eventNodePosition:[C,F],nodes:d.map(function($e){return $e.getModel()}),layoutNodes:de,options:e}),h.positionsAnimate(),h.data({nodes:Ie,edges:qe}),[2]}})})};h.on("node:dblclick",function(i){n(i)})},zv=function(h,t,e,r){var n=function(i){return Od(void 0,void 0,void 0,function(){var a,o,s,d,y,C,F,G,H,ie,se,ce;return Dd(this,function(de){switch(de.label){case 0:return a=i.item,o=a.getModel(),i.target.get("name")!=="collapse-icon"?[3,3]:(s=a.getModel(),d=s.collapsed,y=s.g_currentPath,C=s.children,F=C===void 0?[]:C,G=s.g_parentId,H=s.g_level,ie=s.id,se=t&&!F.length&&$v(h.get("eventData").getData(),y),e&&!(F==null?void 0:F.length)&&!(se==null?void 0:se.length)?(mv(o,r),[4,e(a.getModel())]):[3,2]);case 1:ce=de.sent(),ce&&(ce=ce.map(function(xe,Ie){var qe;return qa((qe={},qe["".concat(ps,"_level")]=H+1,qe["".concat(ps,"_parentId")]="".concat(G,"-").concat(ie),qe["".concat(ps,"_currentPath")]="".concat(y,"-").concat(Ie),qe),xe)}),Kv(h,ce,y)),se=ce,bv(),de.label=2;case 2:(se==null?void 0:se.length)>0?(o.children=se,h.updateChild(o,o.id),h.updateItem(a,{collapsed:!1}),h.refreshItem(a)):(h.updateItem(a,{collapsed:!d}),h.layout()),de.label=3;case 3:return[2]}})})};h.on("node:click",function(i){n(i)}),h.on("node:touchstart",function(i){n(i)})},Wv=function(h,t,e){var r=Nd(t),n=r;e&&(n=gv(t),r=yv(n,e)),h.data(r),h.set("eventData",new wv(n)),h.render(),h.get("canvas").set("localRefresh",!1)},rh={},Cv=function(h,t){h===void 0&&(h={});var e=t==null?void 0:t.get("id");if(!t||t.destroyed){rh[e]=null;return}if((!h||!h.show)&&rh[e]){var r=t.get("plugins")[0];r&&t.removePlugin(r),rh[e]=null}if(h.show&&!rh[e]){var n=Object.assign(Pd,h),i=new vn.Minimap(qa(qa({},n),{id:e}));return t.addPlugin(i),rh[e]=i,i}return null},jv=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(h){var t=Math.random()*16|0,e=h=="x"?t:t&3|8;return e.toString(16)})},Vv=function(h){return h.current||(h.current="graph-".concat(jv())),h.current},Tv=function(h,t){h===void 0&&(h="right");var e=t[0],r=t[1],n=0,i=0;switch(h){case"top":n=e/2,i=0;break;case"right":n=e,i=r/2;break;case"bottom":n=e/2,i=r;break;case"left":n=0,i=r/2;break}return{x:n,y:i}},Xv=function(h,t,e){var r=function(n){return Od(void 0,void 0,void 0,function(){var i,a,o,s,d,y,C,F,G,H,ie,se,ce,de,xe,Ie;return Dd(this,function(qe){switch(qe.label){case 0:return i=h.get("eventData").getData(),n.target.get("name")!=="collapse-icon"?[3,5]:(a=n.item,o=a.getModel().collapsed,Hh(o,"Boolean")||(o=(Ie=a._cfg.group.getChildren().find(function(ze){return ze.get("name")==="main-box"}))===null||Ie===void 0?void 0:Ie.attr("defaultCollapsed")),s=(i!=null?i:{}).edges,d=s===void 0?[]:s,y=a.getModel().id,C=[],F=[],G=[],H=function(ze){d.forEach(function($e){var mt=$e.source,xt=$e.target;mt===ze&&(C.push(xt),H(xt))})},H(y),o?[3,1]:(h.findAll("node",function(ze){return C.includes(ze.get("id"))}).forEach(function(ze){return h.hideItem(ze)}),i.nodes.forEach(function(ze){var $e=ze.collapsedLevel,mt=$e===void 0?0:$e,xt=ze.id;C.includes(xt)&&(ze.collapsedLevel=mt+1)}),[3,4]));case 1:return ie=h.findAll("node",function(ze){var $e=i.nodes.find(function(mt){return mt.id===ze.get("id")}).collapsedLevel;return C.includes(ze.get("id"))&&(!$e||$e<2)}),ie.length?(ie.forEach(function(ze){return h.showItem(ze)}),i.nodes.forEach(function(ze){var $e=ze.collapsedLevel,mt=$e===void 0?0:$e,xt=ze.id;C.includes(xt)&&(ze.collapsedLevel=mt-1)}),[3,4]):[3,2];case 2:return t?(mv(a.getModel(),e),[4,t(a.getModel())]):[3,4];case 3:return se=qe.sent(),ce=se.nodes,de=se.edges,xe={nodes:i.nodes.concat(ce),edges:i.edges.concat((de==null?void 0:de.length)?de:ce.map(function(ze){return{source:y,target:ze.id}}))},bv(),h.set("eventData",new wv(xe)),h.changeData(xe),h.get("fitCenter")&&h.fitCenter(),[2];case 4:d.forEach(function(ze){var $e=ze.source,mt=ze.target;C.includes(mt)&&G.push($e)}),G=Array.from(new Set(G)),G.forEach(function(ze){F.push(h.find("node",function($e){return $e.get("id")===ze}))}),F.forEach(function(ze){h.updateItem(ze,{collapsed:!ze.getModel().collapsed}),h.refreshItem(ze)}),qe.label=5;case 5:return[2]}})})};h.on("node:click",function(n){r(n)}),h.on("node:touchstart",function(n){r(n)})},Yv=function(h){if(typeof h=="number")return[h,h,h,h];var t=[];switch(h.length){case 1:t=[h[0],h[0],h[0],h[0]];break;case 2:t=[h[0],h[1],h[0],h[1]];break;case 3:t=[h[0],h[1],h[2],h[1]];break;case 4:t=h;break;default:break}return t},Ld=function(h,t){if(!!h&&!(typeof h=="object"&&(h==null?void 0:h.show)===!1)){var e=typeof h=="function"?h(t):h,r=e.type,n=r===void 0?"vee":r,i=e.d,a=i===void 0?0:i,o=e.size,s=o===void 0?10:o;return qa({path:vn.Arrow[n](s,s,a),fill:"#ccc",d:a},e)}},Zv=function(h,t){var e=t!=null?t:{},r=e.nodeCfg,n=r===void 0?{}:r,i=e.edgeCfg,a=i===void 0?{}:i,o=n.nodeStateStyles,s=a.edgeStateStyles,d={},y=function(G,H,ie){h.updateItem(G,{style:{endArrow:!!H&&{fill:H},startArrow:!!ie&&{fill:ie}}})},C=function(G,H,ie){var se,ce,de;ie?G.toFront():G.toBack();var xe=(se=G.getModel().style)!==null&&se!==void 0?se:{},Ie=xe.endArrow,qe=xe.startArrow;if(Ie||qe){if(!d[G.getID()]){var ze=(Ie!=null?Ie:{}).fill,$e=(qe!=null?qe:{}).fill,mt=(de=(ce=G.getModel().style)===null||ce===void 0?void 0:ce[H])===null||de===void 0?void 0:de.stroke;d[G.getID()]=[[mt!=null?mt:ze,ze],[mt!=null?mt:$e,$e]]}var xt=d[G.getID()];y(G,Ie&&xt[0][ie?0:1],qe&&xt[1][ie?0:1])}h.setItemState(G,H,ie)},F=function(G,H,ie,se){var ce=se==="node"?h.findAll("edge",function(xe){return xe.getSource()===G||xe.getTarget()===G}):h.findAll("node",function(xe){return G.getSource().get("id")===xe.get("id")||G.getTarget().get("id")===xe.get("id")}),de=[G].concat(ce);de.forEach(function(xe){C(xe,H,ie)})};o&&(h.on("node:mouseenter",function(G){var H=G.item;F(H,"hover",!0,"node")}),h.on("node:mouseleave",function(G){var H=G.item;F(H,"hover",!1,"node")})),s&&(h.on("edge:mouseenter",function(G){var H=G.item;F(H,"hover",!0,"edge")}),h.on("edge:mouseleave",function(G){var H=G.item;F(H,"hover",!1,"edge")}))},Av=function(h,t,e,r){return typeof h=="function"?h(t,e,r)||{}:h||{}},nh=function(h,t,e){return typeof h=="function"?h(t,e):h},Iv=function(h){return Array.isArray(h)?h:h?[h,h]:defaultNodeSize},pf=4,bp=function(h){if(!h)return[0,0,0,0];var t=h.size,e=t===void 0?[]:t,r=h.position,n=r===void 0?"left":r,i=Iv(e),a=i[0],o=i[1],s=[];switch(n){case"top":s.push(o!=null?o:pf,0,0,0);break;case"right":s.push(0,a!=null?a:pf,0,0);break;case"bottom":s.push(0,0,o!=null?o:pf,0);break;case"left":s.push(0,0,0,a!=null?a:pf);break}return s},Ep=function(h,t){var e=h!=null?h:{},r=e.size,n=r===void 0?[]:r,i=e.position,a=i===void 0?"left":i,o=Iv(n),s=o[0],d=o[1],y=t[0],C=t[1],F=0,G=0,H=0,ie=0;switch(a){case"top":F=0,G=0,H=s!=null?s:y,ie=d!=null?d:pf;break;case"left":F=0,G=0,H=s!=null?s:pf,ie=d!=null?d:C;break;case"right":F=y-(isNumber(s)?s:pf),G=0,H=s!=null?s:pf,ie=d!=null?d:C;break;case"bottom":F=0,G=C-(isNumber(d)?d:pf),H=s!=null?s:y,ie=d!=null?d:pf;break}return{x:F,y:G,width:H,height:ie}},Hv=function(h,t,e){var r=h.show,n=h.position,i=h.collapsed,a=h.style;r&&t.addShape("marker",{attrs:qa(qa(qa({},Tv(n,e)),{r:6,cursor:"pointer",symbol:i?vn.Marker.expand:vn.Marker.collapse,stroke:hf.stroke,lineWidth:1,fill:"#fff"}),a),defaultCollapsed:!1,name:"collapse-icon"})},_p=function(h){var t={};return Object.keys(h).forEach(function(e){var r=h[e];if(isObject(r)){var n={};Object.keys(r).forEach(function(i){var a=r[i];i==="img"&&!isString(a)||(n[i]=clone(a))}),t[e]=n}else t[e]=clone(r)}),t},pv=function(h,t){t===void 0&&(t={});var e=Object.keys(t);e.forEach(function(r){h.style[r]=t[r]})},gv=function(h,t,e,r){var n;t===void 0&&(t=0),e===void 0&&(e=""),r===void 0&&(r="");var i=h.id,a=h.children,o=a===void 0?[]:a;return qa(qa((n={},n["".concat(ps,"_level")]=t,n["".concat(ps,"_parentId")]=e,n["".concat(ps,"_currentPath")]=r,n),h),{children:o==null?void 0:o.map(function(s,d){return gv(s,t+1,e?"".concat(e,"-").concat(i):i,"".concat(r,"-").concat(d))})})},yv=function(h,t){var e=h.children,r=e===void 0?[]:e,n=h.g_level,i=n===void 0?0:n;return t<=0?h:qa(qa({},h),{children:i+1<t?r==null?void 0:r.map(function(a){return yv(a,t)}):[]})},Kv=function(h,t,e){var r=h.get("eventData").getData(),n=e.split("-");n.shift();var i=r;n.forEach(function(a){i=i.children[Number(a)]}),i.children=t},$v=function(h,t){var e=t.split("-");e.shift();var r=h;return e.forEach(function(n){r=r.children[Number(n)]}),(r==null?void 0:r.children)?r.children.map(function(n){return qa(qa({},n),{children:[]})}):[]},xp=function(h,t,e){var r=t.split("-");r.shift();var n=h;return r.forEach(function(i){n=n.children[Number(i)]}),n.children=e,h},Sp=function(h,t,e){t===void 0&&(t=12),e===void 0&&(e=120);var r=isNumber(t)?t:Number(t.replace("px","")),n=Math.floor(e/r);return h.length<=n?h:h.slice(0,n-1)+"..."},mv=function(h,t){var e="".concat(ps,"-antd-loading");if(t){var r=(0,_.isFunction)(t)?t(h):t;document.body.appendChild(mi(r,e))}else{var n=document.createElement("div");n.className=e;var i={position:"fixed",left:"0",top:"0",width:"100vw",height:"100vh",display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0, 0.25)",color:"#fff",fontSize:"16px",zIndex:999};pv(n,i);var a=document.createElement("span");a.innerText="loading...",n.appendChild(a),document.body.appendChild(n)}},bv=function(){var h=document.getElementsByClassName("".concat(ps,"-antd-loading"));Array.from(h).forEach(function(t){document.body.removeChild(t)})},Pv=function(h,t){return typeof h=="function"&&t?h(t)||{}:Array.isArray(h)?h:Ac},Qv=function(h){var t=(0,f.useState)(!1),e=t[0],r=t[1],n=function(){document.fullscreenElement||r(!1)},i=function(){h&&h.requestFullscreen&&h.requestFullscreen().then(function(){r(!0)}).catch(function(s){vf.error("requestFullscreen error: ",s)})},a=function(){document.exitFullscreen&&document.exitFullscreen().then(function(){r(!1)}).catch(function(s){vf.error("exitFullscreen error: ",s)})},o=function(){if(!h){vf.error("need dom");return}e?a():i()};return(0,f.useEffect)(function(){return document.addEventListener("fullscreenchange",n,!1),function(){document.removeEventListener("fullscreenchange",n)}},[]),[e,o]},Jv=Qv,qv=function(h){var t,e,r=h.toolbarCfg,n=h.container,i=h.graph,a=(0,f.useRef)(),o=(0,f.useRef)(),s=(0,f.useRef)(),d=(0,f.useRef)(1),y=r.zoomFactor,C=y===void 0?.25:y,F=r.renderIcon,G=r.customContent,H=Jv(n),ie=H[0],se=H[1],ce=function(){return[window.outerWidth,window.outerHeight]},de=function(mt){var xt,wt=mt?ce():[o.current,s.current];(xt=a.current)===null||xt===void 0||xt.changeSize(wt[0],wt[1])},xe=function(){return n?{x:n.clientWidth/2,y:n.clientHeight/2}:{x:0,y:0}},Ie=function(){var mt;(mt=a.current)===null||mt===void 0||mt.zoom(Math.min(d.current+C,5),xe())},qe=function(){var mt;(mt=a.current)===null||mt===void 0||mt.zoom(Math.max(d.current-C,.25),xe())};(0,f.useEffect)(function(){i&&(a.current=i,o.current=n==null?void 0:n.clientWidth,s.current=n==null?void 0:n.clientHeight)},[i]);var ze=function(){se(),de(!document.fullscreenElement)},$e=G||F;return $e?(((e=(t=$e.toString().match(/\(([^)]*)\)/))===null||t===void 0?void 0:t[1])===null||e===void 0?void 0:e.includes("{"))||vf.warn("customContent \u7528\u6CD5\u5DF2\u7ECF\u5347\u7EA7\uFF0CcustomContent(zoomIn, xx) => customContent({zoomIn, xx})"),$e({zoomIn:Ie,zoomOut:qe,toggleFullscreen:ze,fullscreen:ie})):f.createElement(f.Fragment,null,ie?f.createElement("span",{style:{cursor:"pointer"},onClick:ze},"\u2684"):f.createElement("span",{style:{cursor:"pointer"},onClick:ze},"\u2610"),f.createElement("span",{style:{cursor:"pointer"},onClick:Ie},"+"),f.createElement("span",{style:{cursor:"pointer"},onClick:qe},"-"))},ep=function(h){var t,e=h.graph,r=h.container,n=h.toolbarCfg,i=n.style,a=n.show,o=n.className,s="".concat(e.get("id"),"-toolbar"),d=document.querySelector("#".concat(s));if(d&&((t=d.parentNode)===null||t===void 0||t.removeChild(d)),!!a){var y={position:"absolute",right:"12px",top:"12px",display:"flex",flexDirection:"column",padding:"6px",borderRadius:"2px",fontSize:"24px",textAlign:"center",lineHeight:"24px",color:"rgba(0,0,0,.65)",backgroundColor:"#fff",boxShadow:"0 0 3px #ccc"},C=document.createElement("div");C.id=s,C.className=o!=null?o:"charts-toolbar",pv(C,y),pv(C,i),Gn.render(f.createElement(qv,{graph:e,container:r,toolbarCfg:n}),C),r.appendChild(C)}},Ov={},tp=function(h,t){Ov[h]=t},wp=function(h){return Ov[h]},Ho=function(){return Ho=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},Ho.apply(this,arguments)},rp=function(h,t){var e={};for(var r in h)Object.prototype.hasOwnProperty.call(h,r)&&t.indexOf(r)<0&&(e[r]=h[r]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(h);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(h,r[n])&&(e[r[n]]=h[r[n]]);return e};function np(h,t,e){e===void 0&&(e={});var r=(0,f.useRef)(null),n=(0,f.useRef)(),i=(0,f.useRef)(),a=(0,f.useRef)(),o=t.data,s=t.width,d=t.height,y=t.layout,C=t.minimapCfg,F=t.behaviors,G=t.fitCenter,H=t.nodeCfg,ie=t.edgeCfg,se=t.markerCfg,ce=t.level,de=t.toolbarCfg,xe=t.customLayout,Ie=n.current,qe=function(Zt){Zt.forEach(function(Er){var Fr,Ur,Or=Er.getModel(),hn=Or.source,sn=Or.target,Ir=(Fr=Ie==null?void 0:Ie.findById(hn))===null||Fr===void 0?void 0:Fr.get("visible"),en=(Ur=Ie==null?void 0:Ie.findById(sn))===null||Ur===void 0?void 0:Ur.get("visible");(Ir===!1||en===!1)&&Er.changeVisibility(!1)})},ze=function(){var Zt;if(!!Ie){var Er=o;ce&&(Er=gv(o)),Ie.changeData(ce?yv(Er,ce):o),(Zt=Ie.get("eventData"))===null||Zt===void 0||Zt.setData(Er),qe(Ie.getEdges()),G&&Ie.fitCenter()}},$e=function(){Ie==null||Ie.updateLayout(y),G&&(Ie==null||Ie.fitCenter())},mt=function(){if(!!Ie){var Zt=H!=null?H:{},Er=Zt.type,Fr=Zt.anchorPoints,Ur=Zt.style,Or=Zt.title;Ie.getNodes().forEach(function(hn){var sn=Pv(Fr,hn.getModel());Ie.updateItem(hn,{nodeCfg:H,markerCfg:se,type:Er,style:Ur,anchorPoints:sn,labelCfg:Or})})}},xt=function(){if(!!Ie){var Zt=ie!=null?ie:{},Er=Zt.type,Fr=Zt.style,Ur=Zt.startArrow,Or=Zt.endArrow,hn=Zt.label;Ie.getEdges().forEach(function(sn){if(["fund-line","labels-line"].includes(Er))Ie.updateItem(sn,{edgeCfg:ie});else{var Ir=sn.getModel(),en=Ld(Ur,Ir),un=Ld(Or,Ir),fn=hn!=null?hn:{},pn=fn.style,Tn=fn.content;Ie.updateItem(sn,{type:Er,label:nh(Tn,Ir,Ie),labelCfg:{style:nh(pn,Ir,Ie)},style:Ho({stroke:"#ccc",startArrow:en,endArrow:un},typeof Fr=="function"?Fr(Ir,Ie):Fr)})}})}},wt=function(){!Ie||Ie.getNodes().forEach(function(Zt){var Er=(typeof se=="function"?se(Zt.getModel(),Zt.get("group")):se).position,Fr=Er===void 0?"right":Er,Ur=Zt.getBBox(),Or=Ur.width,hn=Ur.height,sn=Zt.get("group").get("children").find(function(Ir){return Ir.get("name")==="collapse-icon"});sn&&(sn==null||sn.attr(Ho({},Tv(Fr,[Or,hn]))))})},Yt=function(Zt){var Er=e.name,Fr=Er===void 0?"":Er;if(Fr!=="FundFlowGraph")return Zt;if(!!Zt){var Ur=Zt.hover,Or=Ur===void 0?{}:Ur,hn=Or.endArrow,sn=Or.startArrow;return!hn&&!sn?Zt:{hover:Ho(Ho({},Or),{endArrow:hn?Ld(hn):!1,startArrow:sn?Ld(sn):!1})}}};return(0,f.useEffect)(function(){var Zt;if(Ie&&!Ie.destroyed){if((0,_.isEqual)(o,a.current))return;if(e.name==="RadialGraph"&&!((Zt=a.current.nodes)===null||Zt===void 0?void 0:Zt.length)){var Er=Mv(o);Ie.set("centerNode",Er),Ie.updateLayout(Ho(Ho({},y),{focusNode:Er}))}else ze();a.current=Nd(o)}},[o]),(0,f.useEffect)(function(){var Zt,Er,Fr,Ur,Or;if(Ie&&!Ie.destroyed){if((0,_.isEqual)(t,i.current))return;!xe&&!(0,_.isEqual)(y,(Zt=i.current)===null||Zt===void 0?void 0:Zt.layout)&&$e(),(0,_.isEqual)(C,(Er=i.current)===null||Er===void 0?void 0:Er.minimapCfg)||Cv(C,Ie),(0,_.isEqual)(H,(Fr=i.current)===null||Fr===void 0?void 0:Fr.nodeCfg)||mt(),(0,_.isEqual)(ie,(Ur=i.current)===null||Ur===void 0?void 0:Ur.edgeCfg)||xt(),(0,_.isEqual)(se,(Or=i.current)===null||Or===void 0?void 0:Or.markerCfg)||wt(),i.current=t}},[t]),(0,f.useEffect)(function(){if(Ie&&!Ie.destroyed){var Zt=Sv(s,d,r);Ie.changeSize(Zt[0],Zt[1])}},[r,s,d]),(0,f.useEffect)(function(){if(Ie&&!Ie.destroyed){var Zt=Ie.get("modes").default,Er=[];Zt.forEach(function(Fr){(0,_.isObject)(Fr)?Er.push(Fr.type):(0,_.isString)(Fr)&&Er.push(Fr)}),Ie.removeBehaviors(Er,"default"),Ie.addBehaviors(F,"default")}},[F]),(0,f.useEffect)(function(){if(r.current&&h){var Zt=e.name,Er=Zt===void 0?"":Zt,Fr=Sv(s,d,r),Ur=[],Or=t.nodeCfg,hn=t.edgeCfg,sn=t.behaviors,Ir=t.layout,en=t.animate,un=t.autoFit,fn=t.fitCenter,pn=t.onReady,Tn=t.tooltipCfg,Zn=t.customLayout,ii=t.menuCfg,xi=t.fetchLoading,ui=Or!=null?Or:{},ji=ui.type,Gi=ui.anchorPoints,Ta=ui.nodeStateStyles,Fi=ui.style,ya=ui.title,ma=ui.linkCenter,So=ui.getChildren,Qi=ui.asyncData,Ui=hn!=null?hn:{},ja=Ui.type,Va=Ui.style,Ko=Ui.startArrow,bi=Ui.endArrow,Si=Ui.label,Ci=Ui.edgeStateStyles;if(Tn&&(0,_.isFunction)(Tn.customContent)){var Ni=Tn.customContent,ta=rp(Tn,["customContent"]),Wn=new vn.Tooltip(Ho(Ho({offsetX:10,offsetY:20,itemTypes:["node"]},ta),{getContent:function(Vi){return mi(Ni(Vi.item.getModel()),"g6-tooltip")}}));Ur.push(Wn)}if(ii&&(0,_.isFunction)(ii.customContent)){var Pi=new Na(Ho({offsetX:16+10,offsetY:0,itemTypes:["node"]},ii));Ur.push(Pi)}n.current=new vn[h]({container:r.current,width:Fr[0],height:Fr[1],animate:en,linkCenter:ma,modes:{default:sn},defaultNode:Ho(Ho({},Or),{nodeCfg:Or}),defaultEdge:Ho(Ho({},(0,_.omit)(hn,["label"])),{edgeCfg:hn,labelCfg:Si==null?void 0:Si.style}),nodeStateStyles:Ta,edgeStateStyles:Yt(Ci),layout:Zn?void 0:Ir,fitView:un,fitCenter:fn,plugins:Ur});var wi=Vv(n.current),Ei=n.current;Ei.set("id",wi),tp(wi,Ei);var Ai=function(Vi){return(0,_.isString)(Vi)?Vi:Er==="FundFlowGraph"?Vi==null?void 0:Vi.text:Vi==null?void 0:Vi.title},Li=["fund-card","indicator-card"];Ei.node(function(Vi){if(Li.includes(ji)||Er==="OrganizationGraph"){var $u=Pv(Gi,Vi);return Vi.markerCfg=se,{anchorPoints:$u,_graphId:wi}}var La=(ya!=null?ya:{}).style;return{_graphId:wi,label:Ai(Vi.value),labelCfg:{style:nh(La,Vi,Ei)},style:Ho({stroke:"#ccc"},typeof Fi=="function"?Fi(Vi,Ei):Fi)}});var ba=function(Vi){var $u=(Si!=null?Si:{}).content;if(["DecompositionTreeGraph","OrganizationGraph","RadialTreeGraph"].includes(Er))return nh($u,Vi,Ei);if(["FundFlowGraph","FlowAnalysisGraph"].includes(Er)){var La=Vi.value;return typeof La=="object"?La==null?void 0:La.text:La}return Vi.value};if(["fund-line","labels-line"].includes(ja)||Ei.edge(function(Vi){var $u=Ld(Ko,Vi),La=Ld(bi,Vi),tu=(Si!=null?Si:{}).style;return{label:ba(Vi),labelCfg:{style:nh(tu,Vi,Ei)},style:Ho({stroke:"#ccc",startArrow:$u,endArrow:La},typeof Va=="function"?Va(Vi,Ei):Va)}}),Cv(C,Ei),Zv(Ei,t),se){var Rs=["FlowAnalysisGraph","FundFlowGraph"];Rs.includes(Er)?Xv(Ei,Qi,xi):zv(Ei,ce,So,xi)}if(Er==="RadialGraph"){var Xa=Mv(o);Ei.set("centerNode",Xa),Uv(Ei,Qi,Ir,xi)}Wv(Ei,o,ce),fn&&Ei.fitCenter(),pn&&pn(Ei),a.current=Nd(o)}},[]),(0,f.useEffect)(function(){n.current&&de&&ep({graph:n.current,container:r.current,toolbarCfg:de})},[n,de]),(0,f.useEffect)(function(){return function(){(Ie==null?void 0:Ie.current)&&!Ie.current.destroyed&&Ie.current.destroy()}},[]),{container:r}}var ih=function(){return ih=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},ih.apply(this,arguments)};function ip(h,t){var e=Nd(h),r=(0,f.useCallback)(function(i,a){var o=ih({},a),s=Object.keys(i);return s.forEach(function(d){Fv(i[d])==="Object"?o[d]=ih(ih({},a[d]),i[d]):o[d]=i[d]}),o},[h,t]),n=r(e,t);return{uProps:n}}var ol=function(){return ol=Object.assign||function(h){for(var t,e=1,r=arguments.length;e<r;e++){t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(h[n]=t[n])}return h},ol.apply(this,arguments)},ap=function(h,t,e){if(e||arguments.length===2)for(var r=0,n=t.length,i;r<n;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return h.concat(i||Array.prototype.slice.call(t))},op=function(){var h={width:12,height:12};vn.registerNode("organization-card",{draw:function(t,e){var r,n,i;t===void 0&&(t={});var a=t.value,o=a===void 0?{}:a,s=t.nodeCfg,d=t.markerCfg,y=ol({},o),C=!1;y.text&&(C=!0,y.name=y.text),y.value&&(C=!0,y.title=y.value);var F=s,G=F.style,H=F.padding,ie=H===void 0?0:H,se=F.label,ce=se===void 0?{}:se,de=F.autoWidth,xe=F.customContent,Ie=ce.style,qe=Yv(ie),ze=(t==null?void 0:t.size)||[100,30];typeof ze=="number"&&(ze=[ze,ze]);var $e=0,mt=ze[0]-qe[1]-qe[3],xt=Av(G,t,e),wt=e.addShape("rect",{attrs:ol(ol({x:0,y:0,width:ze[0],height:ze[1]},hf),xt),name:"main-box",draggable:!0});if(y){var Yt=function(Zn){if(C){var ii={name:"text",title:"value"};return ii[Zn]}return Zn};$e+=qe[0];var Zt=function(Zn,ii,xi,ui){ui===void 0&&(ui=0);var ji=0,Gi=[],Ta=["icon","name","title"],Fi=function(ya,ma){var So=ma.fontSize,Qi=So===void 0?12:So,Ui=0,ja=0,Va=de?ji&&ji+qe[3]:(ii+ji)/2;switch(ya){case"icon":Ui=xi,ja=$e;break;case"name":Ui=xi+Va,ja=Zn.title?qe[0]:(ze[1]-Qi)/2;break;case"title":Ui=xi+Va,ja=Zn.name?qe[0]+Gi[1]+al:(ze[1]-Qi)/2;break;default:break}return{x:Ui,y:ja}};return Ta.forEach(function(ya,ma){var So=ya.startsWith("icon"),Qi=Av(Ie,t,e,Yt(ya));ya==="icon"&&Zn[ya]&&(ji=Qi.width||32);var Ui=e.addShape(So?"image":"text",{attrs:ol(ol(ol(ol({textBaseline:"top",textAlign:de?"start":"center"},Fi(ya,Qi)),{text:Zn[ya],img:Zn[ya]}),So?h:df),Qi),name:"".concat(ya,"-").concat(ui,"-").concat(ma)});Gi.push(Ui.getBBox().height)}),Gi},Er=function(Zn,ii){var xi;ii===void 0&&(ii=0);var ui=[];xe?ui.push((xi=xe(Zn,e,{startX:qe[3],startY:$e,width:mt}))!==null&&xi!==void 0?xi:0):ui.push.apply(ui,Zt(Zn,mt,qe[3],ii)),$e+=Math.max.apply(Math,ui)};Er(y)}if(wt==null||wt.attr("height",Math.max($e+qe[2],ze[1])),de){var Fr=Math.max.apply(Math,ap([ze[0]],(r=e==null?void 0:e.getChildren())===null||r===void 0?void 0:r.map(function(Zn){return(Zn.getBBox().maxX||0)+qe[1]}),!1));wt==null||wt.attr("width",Fr)}if(d){var Ur=((i=(n=e==null?void 0:e.get("item"))===null||n===void 0?void 0:n.getModel())!==null&&i!==void 0?i:{}).collapsed,Or=wt.getBBox(),hn=Or.width,sn=Or.height,Ir=typeof d=="function"?d(t,e):d,en=Ir.show,un=Ir.position,fn=un===void 0?"right":un,pn=Ir.collapsed,Tn=Ir.style;Hv({show:en,position:fn,collapsed:Ur!=null?Ur:pn,style:Tn},e,[hn,sn]),wt.attr("defaultCollapsed",pn)}return wt},update:void 0},"single-node")},sp=function(h,t){var e={};for(var r in h)Object.prototype.hasOwnProperty.call(h,r)&&t.indexOf(r)<0&&(e[r]=h[r]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(h);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(h,r[n])&&(e[r[n]]=h[r[n]]);return e};op();var up={fill:"#91d5ff",stroke:"#40a9ff",radius:2},cp={type:"compactBox",direction:"TB",getId:function(t){return t.id},getHeight:function(){return 16},getWidth:function(){return 16},getVGap:function(){return 40},getHGap:function(){return 70}},fp={nodeCfg:{type:"organization-card",size:[100,44],style:up,padding:6,anchorPoints:[[.5,0],[.5,1]],nodeStateStyles:Ca,label:{style:function(h,t,e){var r={icon:{width:32,height:32},title:{fill:"#fff"},name:{fill:"#000"}};return e?r[e]:{}}}},edgeCfg:{type:"polyline",endArrow:{type:"triangle",fill:"#91d5ff"},edgeStateStyles:Ca,style:{stroke:"#91d5ff"}},behaviors:["zoom-canvas","drag-canvas"],layout:cp,animate:!0,markerPosition:"right",autoFit:!0,fitCenter:!0,style:{position:"relative",height:"inherit",backgroundColor:"#fff"}},lp=function(h){var t=ip(h,fp).uProps,e=t.className,r=t.style,n=t.loading,i=t.loadingTemplate,a=t.errorTemplate,o=sp(t,["className","style","loading","loadingTemplate","errorTemplate"]),s=np("TreeGraph",o,{name:"OrganizationGraph"}).container;return f.createElement(D,{errorTemplate:a},n&&f.createElement(m,{loadingTemplate:i}),f.createElement("div",{className:e,style:r,ref:s}))},dp=lp},31199:function(dt,x,M){"use strict";var S=M(28991),B=M(81253),N=M(85893),E=M(67294),I=M(31649),A=["fieldProps","min","proFieldProps","max"],v=function(c,f){var l=c.fieldProps,T=c.min,m=c.proFieldProps,w=c.max,O=(0,B.Z)(c,A);return(0,N.jsx)(I.Z,(0,S.Z)({valueType:"digit",fieldProps:(0,S.Z)({min:T,max:w},l),ref:f,filedConfig:{defaultProps:{width:"100%"}},proFieldProps:m},O))};x.Z=E.forwardRef(v)},64317:function(dt,x,M){"use strict";var S=M(28991),B=M(81253),N=M(85893),E=M(22270),I=M(67294),A=M(66758),v=M(31649),p=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","showSearch","options"],c=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","options"],f=I.forwardRef(function(O,D){var g=O.fieldProps,_=O.children,Y=O.params,V=O.proFieldProps,z=O.mode,Z=O.valueEnum,J=O.request,ee=O.showSearch,Q=O.options,re=(0,B.Z)(O,p),fe=(0,I.useContext)(A.Z);return(0,N.jsx)(v.Z,(0,S.Z)((0,S.Z)({valueEnum:(0,E.h)(Z),request:J,params:Y,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,S.Z)({options:Q,mode:z,showSearch:ee,getPopupContainer:fe.getPopupContainer},g),ref:D,proFieldProps:V},re),{},{children:_}))}),l=I.forwardRef(function(O,D){var g=O.fieldProps,_=O.children,Y=O.params,V=O.proFieldProps,z=O.mode,Z=O.valueEnum,J=O.request,ee=O.options,Q=(0,B.Z)(O,c),re=(0,S.Z)({options:ee,mode:z||"multiple",labelInValue:!0,showSearch:!0,showArrow:!1,autoClearSearchValue:!0,optionLabelProp:"label"},g),fe=(0,I.useContext)(A.Z);return(0,N.jsx)(v.Z,(0,S.Z)((0,S.Z)({valueEnum:(0,E.h)(Z),request:J,params:Y,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,S.Z)({getPopupContainer:fe.getPopupContainer},re),ref:D,proFieldProps:V},Q),{},{children:_}))}),T=f,m=l,w=T;w.SearchSelect=m,w.displayName="ProFormComponent",x.Z=w},5966:function(dt,x,M){"use strict";var S=M(28991),B=M(81253),N=M(85893),E=M(31649),I=["fieldProps","proFieldProps"],A=["fieldProps","proFieldProps"],v="text",p=function(T){var m=T.fieldProps,w=T.proFieldProps,O=(0,B.Z)(T,I);return(0,N.jsx)(E.Z,(0,S.Z)({valueType:v,fieldProps:m,filedConfig:{valueType:v},proFieldProps:w},O))},c=function(T){var m=T.fieldProps,w=T.proFieldProps,O=(0,B.Z)(T,A);return(0,N.jsx)(E.Z,(0,S.Z)({valueType:"password",fieldProps:m,proFieldProps:w,filedConfig:{valueType:v}},O))},f=p;f.Password=c,f.displayName="ProFormComponent",x.Z=f},62238:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var M=function(N,E){var I=N.nodes,A=N.edges,v=[],p={};if(!I)throw new Error("invalid nodes data!");return I&&I.forEach(function(c,f){p[c.id]=f;var l=[];v.push(l)}),A&&A.forEach(function(c){var f=c.source,l=c.target,T=p[f],m=p[l];!T&&T!==0||!m&&m!==0||(v[T][m]=1,E||(v[m][T]=1))}),v},S=M;x.default=S},10369:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),Object.defineProperty(x,"GADDIAsync",{enumerable:!0,get:function(){return S.GADDIAsync}}),Object.defineProperty(x,"connectedComponentAsync",{enumerable:!0,get:function(){return S.connectedComponentAsync}}),x.default=void 0,Object.defineProperty(x,"detectAllCyclesAsync",{enumerable:!0,get:function(){return S.detectAllCyclesAsync}}),Object.defineProperty(x,"detectAllDirectedCycleAsync",{enumerable:!0,get:function(){return S.detectAllDirectedCycleAsync}}),Object.defineProperty(x,"detectAllUndirectedCycleAsync",{enumerable:!0,get:function(){return S.detectAllUndirectedCycleAsync}}),Object.defineProperty(x,"detectCycleAsync",{enumerable:!0,get:function(){return S.detectCycleAsync}}),x.detectDirectedCycleAsync=void 0,Object.defineProperty(x,"dijkstraAsync",{enumerable:!0,get:function(){return S.dijkstraAsync}}),Object.defineProperty(x,"findAllPathAsync",{enumerable:!0,get:function(){return S.findAllPathAsync}}),Object.defineProperty(x,"findShortestPathAsync",{enumerable:!0,get:function(){return S.findShortestPathAsync}}),Object.defineProperty(x,"floydWarshallAsync",{enumerable:!0,get:function(){return S.floydWarshallAsync}}),Object.defineProperty(x,"getAdjMatrixAsync",{enumerable:!0,get:function(){return S.getAdjMatrixAsync}}),Object.defineProperty(x,"getDegreeAsync",{enumerable:!0,get:function(){return S.getDegreeAsync}}),Object.defineProperty(x,"getInDegreeAsync",{enumerable:!0,get:function(){return S.getInDegreeAsync}}),Object.defineProperty(x,"getNeighborsAsync",{enumerable:!0,get:function(){return S.getNeighborsAsync}}),Object.defineProperty(x,"getOutDegreeAsync",{enumerable:!0,get:function(){return S.getOutDegreeAsync}}),Object.defineProperty(x,"labelPropagationAsync",{enumerable:!0,get:function(){return S.labelPropagationAsync}}),Object.defineProperty(x,"louvainAsync",{enumerable:!0,get:function(){return S.louvainAsync}}),Object.defineProperty(x,"minimumSpanningTreeAsync",{enumerable:!0,get:function(){return S.minimumSpanningTreeAsync}}),Object.defineProperty(x,"pageRankAsync",{enumerable:!0,get:function(){return S.pageRankAsync}});var S=M(30485),B=S.detectCycleAsync;x.detectDirectedCycleAsync=B;var N={getAdjMatrixAsync:S.getAdjMatrixAsync,connectedComponentAsync:S.connectedComponentAsync,getDegreeAsync:S.getDegreeAsync,getInDegreeAsync:S.getInDegreeAsync,getOutDegreeAsync:S.getOutDegreeAsync,detectCycleAsync:S.detectCycleAsync,detectDirectedCycleAsync:B,detectAllCyclesAsync:S.detectAllCyclesAsync,detectAllDirectedCycleAsync:S.detectAllDirectedCycleAsync,detectAllUndirectedCycleAsync:S.detectAllUndirectedCycleAsync,dijkstraAsync:S.dijkstraAsync,findAllPathAsync:S.findAllPathAsync,findShortestPathAsync:S.findShortestPathAsync,floydWarshallAsync:S.floydWarshallAsync,labelPropagationAsync:S.labelPropagationAsync,louvainAsync:S.louvainAsync,minimumSpanningTreeAsync:S.minimumSpanningTreeAsync,pageRankAsync:S.pageRankAsync,getNeighborsAsync:S.getNeighborsAsync,GADDIAsync:S.GADDIAsync};x.default=N},83764:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=N(M(93026)),B=M(70643);function N(v){return v&&v.__esModule?v:{default:v}}function E(v){v===void 0&&(v={});var p=v,c=function(){},f=function(){var l={};return function(T){var m=T.next,w=m;return l[w]?!1:(l[w]=!0,!0)}}();return p.allowTraversal=v.allowTraversal||f,p.enter=v.enter||c,p.leave=v.leave||c,p}var I=function(p,c,f,l){l===void 0&&(l=!0);var T=E(f),m=new S.default,w=p.edges,O=w===void 0?[]:w;m.enqueue(c);for(var D="",g=function(){var Y=m.dequeue();T.enter({current:Y,previous:D}),(0,B.getNeighbors)(Y,O,l?"target":void 0).forEach(function(V){T.allowTraversal({previous:D,current:Y,next:V})&&m.enqueue(V)}),T.leave({current:Y,previous:D}),D=Y};!m.isEmpty();)g()},A=I;x.default=A},59527:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=E,x.detectStrongConnectComponents=x.detectConnectedComponents=void 0;var S=M(70643),B=function(A){for(var v=A.nodes,p=v===void 0?[]:v,c=A.edges,f=c===void 0?[]:c,l=[],T={},m=[],w=function _(Y){m.push(Y),T[Y.id]=!0;for(var V=(0,S.getNeighbors)(Y.id,f),z=function(ee){var Q=V[ee];if(!T[Q]){var re=p.filter(function(fe){return fe.id===Q});re.length>0&&_(re[0])}},Z=0;Z<V.length;++Z)z(Z)},O=0;O<p.length;O++){var D=p[O];if(!T[D.id]){w(D);for(var g=[];m.length>0;)g.push(m.pop());l.push(g)}}return l};x.detectConnectedComponents=B;var N=function(A){for(var v=A.nodes,p=v===void 0?[]:v,c=A.edges,f=c===void 0?[]:c,l=[],T={},m={},w={},O=[],D=0,g=function z(Z){m[Z.id]=D,w[Z.id]=D,D+=1,l.push(Z),T[Z.id]=!0;for(var J=(0,S.getNeighbors)(Z.id,f,"target").filter(function(me){return p.map(function(ae){return ae.id}).indexOf(me)>-1}),ee=function(ae){var Ee=J[ae];if(!m[Ee]&&m[Ee]!==0){var Le=p.filter(function(De){return De.id===Ee});Le.length>0&&z(Le[0]),w[Z.id]=Math.min(w[Z.id],w[Ee])}else T[Ee]&&(w[Z.id]=Math.min(w[Z.id],m[Ee]))},Q=0;Q<J.length;Q++)ee(Q);if(w[Z.id]===m[Z.id]){for(var re=[];l.length>0;){var fe=l.pop();if(T[fe.id]=!1,re.push(fe),fe===Z)break}re.length>0&&O.push(re)}},_=0,Y=p;_<Y.length;_++){var V=Y[_];!m[V.id]&&m[V.id]!==0&&g(V)}return O};x.detectStrongConnectComponents=N;function E(I,A){return A?N(I):B(I)}},92935:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.secondReg=x.dateReg=void 0;var M=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/;x.secondReg=M;var S=/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/;x.dateReg=S},82556:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.getOutDegree=x.getInDegree=x.default=void 0;var M=function(I){var A={},v=I.nodes,p=v===void 0?[]:v,c=I.edges,f=c===void 0?[]:c;return p.forEach(function(l){A[l.id]={degree:0,inDegree:0,outDegree:0}}),f.forEach(function(l){A[l.source].degree++,A[l.source].outDegree++,A[l.target].degree++,A[l.target].inDegree++}),A},S=M;x.default=S;var B=function(I,A){var v=M(I);return v[A]?M(I)[A].inDegree:0};x.getInDegree=B;var N=function(I,A){var v=M(I);return v[A]?M(I)[A].outDegree:0};x.getOutDegree=N},94282:function(dt,x,M){"use strict";function S(m){return S=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},S(m)}Object.defineProperty(x,"__esModule",{value:!0}),x.detectAllUndirectedCycle=x.detectAllDirectedCycle=x.detectAllCycles=x.default=void 0;var B=v(M(45891)),N=A(M(59527)),E=M(70643);function I(m){if(typeof WeakMap!="function")return null;var w=new WeakMap,O=new WeakMap;return(I=function(g){return g?O:w})(m)}function A(m,w){if(!w&&m&&m.__esModule)return m;if(m===null||S(m)!=="object"&&typeof m!="function")return{default:m};var O=I(w);if(O&&O.has(m))return O.get(m);var D={},g=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var _ in m)if(_!=="default"&&Object.prototype.hasOwnProperty.call(m,_)){var Y=g?Object.getOwnPropertyDescriptor(m,_):null;Y&&(Y.get||Y.set)?Object.defineProperty(D,_,Y):D[_]=m[_]}return D.default=m,O&&O.set(m,D),D}function v(m){return m&&m.__esModule?m:{default:m}}var p=function(w){var O=null,D=w.nodes,g=D===void 0?[]:D,_={},Y={},V={},z={};g.forEach(function(ee){Y[ee.id]=ee});for(var Z={enter:function(Q){var re=Q.current,fe=Q.previous;if(V[re]){O={};for(var me=re,ae=fe;ae!==re;)O[me]=ae,me=ae,ae=_[ae];O[me]=ae}else V[re]=re,delete Y[re],_[re]=fe},leave:function(Q){var re=Q.current;z[re]=re,delete V[re]},allowTraversal:function(Q){var re=Q.next;return O?!1:!z[re]}};Object.keys(Y).length;){var J=Object.keys(Y)[0];(0,B.default)(w,J,Z)}return O},c=function(w,O,D){var g,_;D===void 0&&(D=!0);for(var Y=[],V=(0,N.default)(w,!1),z=0,Z=V;z<Z.length;z++){var J=Z[z];if(!!J.length)for(var ee=J[0],Q=ee.id,re=[ee],fe=(g={},g[Q]=ee,g),me=(_={},_[Q]=new Set,_);re.length>0;)for(var ae=re.pop(),Ee=ae.id,Le=(0,E.getNeighbors)(Ee,w.edges),De=function(It){var er,nr=Le[It],Fe=w.nodes.find(function(we){return we.id===nr});if(nr===Ee)Y.push((er={},er[nr]=ae,er));else if(!(nr in me))fe[nr]=ae,re.push(Fe),me[nr]=new Set([ae]);else if(!me[Ee].has(Fe)){for(var Vt=!0,$t=[Fe,ae],Ar=fe[Ee];me[nr].size&&!me[nr].has(Ar)&&($t.push(Ar),Ar!==fe[Ar.id]);)Ar=fe[Ar.id];if($t.push(Ar),O&&D?(Vt=!1,$t.findIndex(function(we){return O.indexOf(we.id)>-1})>-1&&(Vt=!0)):O&&!D&&$t.findIndex(function(we){return O.indexOf(we.id)>-1})>-1&&(Vt=!1),Vt){for(var ke={},Oe=1;Oe<$t.length;Oe+=1)ke[$t[Oe-1].id]=$t[Oe];$t.length&&(ke[$t[$t.length-1].id]=$t[0]),Y.push(ke)}me[nr].add(ae)}},Ve=0;Ve<Le.length;Ve+=1)De(Ve)}return Y};x.detectAllUndirectedCycle=c;var f=function(w,O,D){D===void 0&&(D=!0);for(var g=[],_=new Set,Y=[],V=[],z={},Z={},J=function(Ar){for(var ke=[Ar];ke.length>0;){var Oe=ke.pop();_.has(Oe)&&(_.delete(Oe),Y[Oe.id].forEach(function(we){ke.push(we)}),Y[Oe.id].clear())}},ee=function $t(Ar,ke,Oe){var we=!1;if(O&&D===!1&&O.indexOf(Ar.id)>-1)return we;g.push(Ar),_.add(Ar);for(var Be=Oe[Ar.id],We=0;We<Be.length;We+=1){var He=z[Be[We]];if(He===ke){for(var St={},Mt=1;Mt<g.length;Mt+=1)St[g[Mt-1].id]=g[Mt];g.length&&(St[g[g.length-1].id]=g[0]),V.push(St),we=!0}else _.has(He)||$t(He,ke,Oe)&&(we=!0)}if(we)J(Ar);else for(var We=0;We<Be.length;We+=1){var He=z[Be[We]];Y[He.id].has(Ar)||Y[He.id].add(Ar)}return g.pop(),we},Q=w.nodes,re=Q===void 0?[]:Q,fe=0;fe<re.length;fe+=1){var me=re[fe],ae=me.id;Z[ae]=fe,z[fe]=me}if(O&&D)for(var Ee=function(Ar){var ke=O[Ar];Z[re[Ar].id]=Z[ke],Z[ke]=0,z[0]=re.find(function(Oe){return Oe.id===ke}),z[Z[re[Ar].id]]=re[Ar]},fe=0;fe<O.length;fe++)Ee(fe);for(var Le=function(Ar){for(var ke,Oe,we=Infinity,Be=0;Be<Ar.length;Be+=1)for(var We=Ar[Be],He=0;He<We.length;He++){var St=Z[We[He].id];St<we&&(we=St,Oe=Be)}for(var Mt=Ar[Oe],sr=[],Be=0;Be<Mt.length;Be+=1){var Ge=Mt[Be];sr[Ge.id]=[];for(var ut=0,U=(0,E.getNeighbors)(Ge.id,w.edges,"target").filter(function(le){return Mt.map(function(ct){return ct.id}).indexOf(le)>-1});ut<U.length;ut++){var he=U[ut];he===Ge.id&&!(D===!1&&O.indexOf(Ge.id)>-1)?V.push((ke={},ke[Ge.id]=Ge,ke)):sr[Ge.id].push(Z[he])}}return{component:Mt,adjList:sr,minIdx:we}},De=0;De<re.length;){var Ve=re.filter(function($t){return Z[$t.id]>=De}),et=(0,N.detectStrongConnectComponents)({nodes:Ve,edges:w.edges}).filter(function($t){return $t.length>1});if(et.length===0)break;var It=Le(et),er=It.minIdx,nr=It.adjList,Fe=It.component;if(Fe.length>1){Fe.forEach(function($t){Y[$t.id]=new Set});var Vt=z[er];if(O&&D&&O.indexOf(Vt.id)===-1)return V;ee(Vt,Vt,nr),De=er+1}else break}return V};x.detectAllDirectedCycle=f;var l=function(w,O,D,g){return g===void 0&&(g=!0),O?f(w,D,g):c(w,D,g)};x.detectAllCycles=l;var T=p;x.default=T},45891:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=E;var S=M(70643);function B(I){I===void 0&&(I={});var A=I,v=function(){},p=function(){var c={};return function(f){var l=f.next;return c[l]?!1:(c[l]=!0,!0)}}();return A.allowTraversal=I.allowTraversal||p,A.enter=I.enter||v,A.leave=I.leave||v,A}function N(I,A,v,p){p.enter({current:A,previous:v});var c=I.edges,f=c===void 0?[]:c;(0,S.getNeighbors)(A,f,"target").forEach(function(l){p.allowTraversal({previous:v,current:A,next:l})&&N(I,l,A,p)}),p.leave({current:A,previous:v})}function E(I,A,v){N(I,A,"",B(v))}},78089:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=M(70655),B=M(49242),N=M(70643),E=function(c,f,l){for(var T=Infinity,m,w=0;w<f.length;w++){var O=f[w].id;!l[O]&&c[O]<=T&&(T=c[O],m=f[w])}return m},I=function(c,f,l,T){var m=c.nodes,w=m===void 0?[]:m,O=c.edges,D=O===void 0?[]:O,g=[],_={},Y={},V={};w.forEach(function(fe,me){var ae=fe.id;g.push(ae),Y[ae]=Infinity,ae===f&&(Y[ae]=0)});for(var z=w.length,Z=function(me){var ae=E(Y,w,_),Ee=ae.id;if(_[Ee]=!0,Y[Ee]===Infinity)return"continue";var Le=[];l?Le=(0,N.getOutEdgesNodeId)(Ee,D):Le=(0,N.getEdgesByNodeId)(Ee,D),Le.forEach(function(De){var Ve=De.target,et=De.source,It=Ve===Ee?et:Ve,er=T&&De[T]?De[T]:1;Y[It]>Y[ae.id]+er?(Y[It]=Y[ae.id]+er,V[It]=[ae.id]):Y[It]===Y[ae.id]+er&&V[It].push(ae.id)})},J=0;J<z;J++)Z(J);V[f]=[f];var ee={};for(var Q in Y)Y[Q]!==Infinity&&v(f,Q,V,ee);var re={};for(var Q in ee)re[Q]=ee[Q][0];return{length:Y,path:re,allPath:ee}},A=I;x.default=A;function v(p,c,f,l){if(p===c)return[p];if(l[c])return l[c];for(var T=[],m=0,w=f[c];m<w.length;m++){var O=w[m],D=v(p,O,f,l);if(!D)return;for(var g=0,_=D;g<_.length;g++){var Y=_[g];(0,B.isArray)(Y)?T.push((0,S.__spreadArray)((0,S.__spreadArray)([],Y,!0),[c],!1)):T.push([Y,c])}}return l[c]=T,l[c]}},41727:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.findShortestPath=x.findAllPath=void 0;var S=N(M(78089)),B=M(70643);function N(A){return A&&A.__esModule?A:{default:A}}var E=function(v,p,c,f,l){var T=(0,S.default)(v,p,f,l),m=T.length,w=T.path,O=T.allPath;return{length:m[c],path:w[c],allPath:O[c]}};x.findShortestPath=E;var I=function(v,p,c,f){var l;if(p===c)return[[p]];var T=v.edges,m=T===void 0?[]:T,w=[p],O=(l={},l[p]=!0,l),D=[],g=[],_=f?(0,B.getNeighbors)(p,m,"target"):(0,B.getNeighbors)(p,m);for(D.push(_);w.length>0&&D.length>0;){var Y=D[D.length-1];if(Y.length){var V=Y.shift();V&&(w.push(V),O[V]=!0,_=f?(0,B.getNeighbors)(V,m,"target"):(0,B.getNeighbors)(V,m),D.push(_.filter(function(J){return!O[J]})))}else{var z=w.pop();O[z]=!1,D.pop();continue}if(w[w.length-1]===c){var Z=w.map(function(ee){return ee});g.push(Z);var z=w.pop();O[z]=!1,D.pop()}}return g};x.findAllPath=I},75033:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=B(M(62238));function B(I){return I&&I.__esModule?I:{default:I}}var N=function(A,v){for(var p=(0,S.default)(A,v),c=[],f=p.length,l=0;l<f;l+=1){c[l]=[];for(var T=0;T<f;T+=1)l===T?c[l][T]=0:p[l][T]===0||!p[l][T]?c[l][T]=Infinity:c[l][T]=p[l][T]}for(var m=0;m<f;m+=1)for(var l=0;l<f;l+=1)for(var T=0;T<f;T+=1)c[l][T]>c[l][m]+c[m][T]&&(c[l][T]=c[l][m]+c[m][T]);return c},E=N;x.default=E},21146:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=M(49242),B=M(68575),N=function(){function T(m,w,O,D,g){this.fromNode=m,this.toNode=w,this.nodeEdgeNodeLabel={nodeLabel1:O||B.VACANT_NODE_LABEL,edgeLabel:D||B.VACANT_EDGE_LABEL,nodeLabel2:g||B.VACANT_NODE_LABEL}}return T.prototype.equalTo=function(m){return this.fromNode===m.formNode&&this.toNode===m.toNode&&this.nodeEdgeNodeLabel===m.nodeEdgeNodeLabel},T.prototype.notEqualTo=function(m){return!this.equalTo(m)},T}(),E=function(){function T(){this.rmpath=[],this.dfsEdgeList=[]}return T.prototype.equalTo=function(m){var w=this.dfsEdgeList.length,O=m.length;if(w!==O)return!1;for(var D=0;D<w;D++)if(this.dfsEdgeList[D]!==m[D])return!1;return!0},T.prototype.notEqualTo=function(m){return!this.equalTo(m)},T.prototype.pushBack=function(m,w,O,D,g){return this.dfsEdgeList.push(new N(m,w,O,D,g)),this.dfsEdgeList},T.prototype.toGraph=function(m,w){m===void 0&&(m=B.VACANT_GRAPH_ID),w===void 0&&(w=!1);var O=new B.Graph(m,!0,w);return this.dfsEdgeList.forEach(function(D){var g=D.fromNode,_=D.toNode,Y=D.nodeEdgeNodeLabel,V=Y.nodeLabel1,z=Y.edgeLabel,Z=Y.nodeLabel2;V!==B.VACANT_NODE_LABEL&&O.addNode(g,V),Z!==B.VACANT_NODE_LABEL&&O.addNode(_,Z),V!==B.VACANT_NODE_LABEL&&Z!==V&&O.addEdge(void 0,g,_,z)}),O},T.prototype.buildRmpath=function(){this.rmpath=[];for(var m=void 0,w=this.dfsEdgeList.length,O=w-1;O>=0;O--){var D=this.dfsEdgeList[O],g=D.fromNode,_=D.toNode;g<_&&(m===void 0||_===m)&&(this.rmpath.push(O),m=g)}return this.rmpath},T.prototype.getNodeNum=function(){var m={};return this.dfsEdgeList.forEach(function(w){m[w.fromNode]||(m[w.fromNode]=!0),m[w.toNode]||(m[w.toNode]=!0)}),Object.keys(m).length},T}(),I=function(){function T(m){if(this.his={},this.nodesUsed={},this.edgesUsed={},this.edges=[],!!m){for(;m;){var w=m.edge;this.edges.push(w),this.nodesUsed[w.from]=1,this.nodesUsed[w.to]=1,this.edgesUsed[w.id]=1,m=m.preNode}this.edges=this.edges.reverse()}}return T.prototype.hasNode=function(m){return this.nodesUsed[m.id]===1},T.prototype.hasEdge=function(m){return this.edgesUsed[m.id]===1},T}(),A=function(){function T(m){var w=m.graphs,O=m.minSupport,D=O===void 0?2:O,g=m.minNodeNum,_=g===void 0?1:g,Y=m.maxNodeNum,V=Y===void 0?4:Y,z=m.top,Z=z===void 0?10:z,J=m.directed,ee=J===void 0?!1:J,Q=m.verbose,re=Q===void 0?!1:Q;this.graphs=w,this.dfsCode=new E,this.support=0,this.frequentSize1Subgraphs=[],this.frequentSubgraphs=[],this.minSupport=D,this.top=Z,this.directed=ee,this.counter=0,this.maxNodeNum=V,this.minNodeNum=_,this.verbose=re,this.maxNodeNum<this.minNodeNum&&(this.maxNodeNum=this.minNodeNum),this.reportDF=[]}return T.prototype.findForwardRootEdges=function(m,w){var O=this,D=[],g=m.nodeMap;return w.edges.forEach(function(_){(O.directed||w.label<=g[_.to].label)&&D.push(_)}),D},T.prototype.findBackwardEdge=function(m,w,O,D){if(!this.directed&&w===O)return null;for(var g=m.nodeMap,_=g[O.to],Y=_.edges,V=Y.length,z=0;z<V;z++){var Z=Y[z];if(!(D.hasEdge(Z)||Z.to!==w.from)){if(this.directed){if(g[w.from].label<g[O.to].label||g[w.from].label===g[O.to].label&&w.label<=Z.label)return Z}else if(w.label<Z.label||w.label===Z.label&&g[w.to].label<=g[O.to].label)return Z}}return null},T.prototype.findForwardPureEdges=function(m,w,O,D){for(var g=[],_=w.to,Y=m.nodeMap[_].edges,V=Y.length,z=0;z<V;z++){var Z=Y[z],J=m.nodeMap[Z.to];O<=J.label&&!D.hasNode(J)&&g.push(Z)}return g},T.prototype.findForwardRmpathEdges=function(m,w,O,D){for(var g=[],_=m.nodeMap,Y=_[w.to].label,V=_[w.from],z=V.edges,Z=z.length,J=0;J<Z;J++){var ee=z[J],Q=_[ee.to].label;w.to===ee.to||O>Q||D.hasNode(_[ee.to])||(w.label<ee.label||w.label===ee.label&&Y<=Q)&&g.push(ee)}return g},T.prototype.getSupport=function(m){var w={};return m.forEach(function(O){w[O.graphId]||(w[O.graphId]=!0)}),Object.keys(w).length},T.prototype.findMinLabel=function(m){var w=void 0;return Object.keys(m).forEach(function(O){var D=m[O],g=D.nodeLabel1,_=D.edgeLabel,Y=D.nodeLabel2;if(!w){w={nodeLabel1:g,edgeLabel:_,nodeLabel2:Y};return}(g<w.nodeLabel1||g===w.nodeLabel1&&_<w.edgeLabel||g===w.nodeLabel1&&_===w.edgeLabel&&Y<w.nodeLabel2)&&(w={nodeLabel1:g,edgeLabel:_,nodeLabel2:Y})}),w},T.prototype.isMin=function(){var m=this,w=this.dfsCode;if(this.verbose&&console.log("isMin checking",w),w.dfsEdgeList.length===1)return!0;var O=this.directed,D=w.toGraph(B.VACANT_GRAPH_ID,O),g=D.nodeMap,_=new E,Y={};D.nodes.forEach(function(J){var ee=m.findForwardRootEdges(D,J);ee.forEach(function(Q){var re=g[Q.to],fe="".concat(J.label,"-").concat(Q.label,"-").concat(re.label);Y[fe]||(Y[fe]={projected:[],nodeLabel1:J.label,edgeLabel:Q.label,nodeLabel2:re.label});var me={graphId:D.id,edge:Q,preNode:null};Y[fe].projected.push(me)})});var V=this.findMinLabel(Y);if(!!V){_.dfsEdgeList.push(new N(0,1,V.nodeLabel1,V.edgeLabel,V.nodeLabel2));var z=function J(ee){for(var Q=_.buildRmpath(),re=_.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,fe=_.dfsEdgeList[Q[0]].toNode,me={},ae=!1,Ee=0,Le=O?-1:0,De=function(Be){if(ae)return"break";ee.forEach(function(We){var He=new I(We),St=m.findBackwardEdge(D,He.edges[Q[Be]],He.edges[Q[0]],He);St&&(me[St.label]||(me[St.label]={projected:[],edgeLabel:St.label}),me[St.label].projected.push({graphId:D.id,edge:me,preNode:We}),Ee=_.dfsEdgeList[Q[Be]].fromNode,ae=!0)})},Ve=Q.length-1;Ve>Le;Ve--){var et=De(Ve);if(et==="break")break}if(ae){var It=m.findMinLabel(me);_.dfsEdgeList.push(new N(fe,Ee,B.VACANT_NODE_LABEL,It.edgeLabel,B.VACANT_NODE_LABEL));var er=_.dfsEdgeList.length-1;return m.dfsCode.dfsEdgeList[er]!==_.dfsEdgeList[er]?!1:J(me[It.edgeLabel].projected)}var nr={};ae=!1;var Fe=0;ee.forEach(function(we){var Be=new I(we),We=m.findForwardPureEdges(D,Be.edges[Q[0]],re,Be);We.length>0&&(ae=!0,Fe=fe,We.forEach(function(He){var St="".concat(He.label,"-").concat(g[He.to].label);nr[St]||(nr[St]={projected:[],edgeLabel:He.label,nodeLabel2:g[He.to].label}),nr[St].projected.push({graphId:D.id,edge:He,preNode:we})}))});for(var Vt=Q.length,$t=function(Be){if(ae)return"break";var We=Q[Be];ee.forEach(function(He){var St=new I(He),Mt=m.findForwardRmpathEdges(D,St.edges[We],re,St);Mt.length>0&&(ae=!0,Fe=_.dfsEdgeList[We].fromNode,Mt.forEach(function(sr){var Ge="".concat(sr.label,"-").concat(g[sr.to].label);nr[Ge]||(nr[Ge]={projected:[],edgeLabel:sr.label,nodeLabel2:g[sr.to].label}),nr[Ge].projected.push({graphId:D.id,edge:sr,preNode:He})}))})},Ve=0;Ve<Vt;Ve++){var Ar=$t(Ve);if(Ar==="break")break}if(!ae)return!0;var ke=m.findMinLabel(nr);_.dfsEdgeList.push(new N(Fe,fe+1,B.VACANT_NODE_LABEL,ke.edgeLabel,ke.nodeLabel2));var Oe=_.dfsEdgeList.length-1;return w.dfsEdgeList[Oe]!==_.dfsEdgeList[Oe]?!1:J(nr["".concat(ke.edgeLabel,"-").concat(ke.nodeLabel2)].projected)},Z="".concat(V.nodeLabel1,"-").concat(V.edgeLabel,"-").concat(V.nodeLabel2);return z(Y[Z].projected)}},T.prototype.report=function(){if(!(this.dfsCode.getNodeNum()<this.minNodeNum)){this.counter++;var m=this.dfsCode.toGraph(this.counter,this.directed);this.frequentSubgraphs.push((0,S.clone)(m))}},T.prototype.subGraphMining=function(m){var w=this,O=this.getSupport(m);if(!(O<this.minSupport)&&!!this.isMin()){this.report();var D=this.dfsCode.getNodeNum(),g=this.dfsCode.buildRmpath(),_=this.dfsCode.dfsEdgeList[g[0]].toNode,Y=this.dfsCode.dfsEdgeList[0].nodeEdgeNodeLabel.nodeLabel1,V={},z={};m.forEach(function(Z){for(var J=w.graphs[Z.graphId],ee=J.nodeMap,Q=new I(Z),re=g.length-1;re>=0;re--){var fe=w.findBackwardEdge(J,Q.edges[g[re]],Q.edges[g[0]],Q);if(fe){var me="".concat(w.dfsCode.dfsEdgeList[g[re]].fromNode,"-").concat(fe.label);z[me]||(z[me]={projected:[],toNodeId:w.dfsCode.dfsEdgeList[g[re]].fromNode,edgeLabel:fe.label}),z[me].projected.push({graphId:Z.graphId,edge:fe,preNode:Z})}}if(!(D>=w.maxNodeNum)){var ae=w.findForwardPureEdges(J,Q.edges[g[0]],Y,Q);ae.forEach(function(Le){var De="".concat(_,"-").concat(Le.label,"-").concat(ee[Le.to].label);V[De]||(V[De]={projected:[],fromNodeId:_,edgeLabel:Le.label,nodeLabel2:ee[Le.to].label}),V[De].projected.push({graphId:Z.graphId,edge:Le,preNode:Z})});for(var Ee=function(De){var Ve=w.findForwardRmpathEdges(J,Q.edges[g[De]],Y,Q);Ve.forEach(function(et){var It="".concat(w.dfsCode.dfsEdgeList[g[De]].fromNode,"-").concat(et.label,"-").concat(ee[et.to].label);V[It]||(V[It]={projected:[],fromNodeId:w.dfsCode.dfsEdgeList[g[De]].fromNode,edgeLabel:et.label,nodeLabel2:ee[et.to].label}),V[It].projected.push({graphId:Z.graphId,edge:et,preNode:Z})})},re=0;re<g.length;re++)Ee(re)}}),Object.keys(z).forEach(function(Z){var J=z[Z],ee=J.toNodeId,Q=J.edgeLabel;w.dfsCode.dfsEdgeList.push(new N(_,ee,"-1",Q,"-1")),w.subGraphMining(z[Z].projected),w.dfsCode.dfsEdgeList.pop()}),Object.keys(V).forEach(function(Z){var J=V[Z],ee=J.fromNodeId,Q=J.edgeLabel,re=J.nodeLabel2;w.dfsCode.dfsEdgeList.push(new N(ee,_+1,B.VACANT_NODE_LABEL,Q,re)),w.subGraphMining(V[Z].projected),w.dfsCode.dfsEdgeList.pop()})}},T.prototype.generate1EdgeFrequentSubGraphs=function(){var m=this.graphs,w=this.directed,O=this.minSupport,D=this.frequentSize1Subgraphs,g={},_={},Y={},V={};return Object.keys(m).forEach(function(z){var Z=m[z],J=Z.nodeMap;Z.nodes.forEach(function(ee,Q){var re=ee.label,fe="".concat(z,"-").concat(re);if(!Y[fe]){var me=g[re]||0;me++,g[re]=me}Y[fe]={graphKey:z,label:re},ee.edges.forEach(function(ae){var Ee=re,Le=J[ae.to].label;if(!w&&Ee>Le){var De=Le;Le=Ee,Ee=De}var Ve=ae.label,et="".concat(z,"-").concat(Ee,"-").concat(Ve,"-").concat(Le),It="".concat(Ee,"-").concat(Ve,"-").concat(Le);if(!_[It]){var er=_[It]||0;er++,_[It]=er}V[et]={graphId:z,nodeLabel1:Ee,edgeLabel:Ve,nodeLabel2:Le}})})}),Object.keys(g).forEach(function(z){var Z=g[z];if(!(Z<O)){var J={nodes:[],edges:[]};J.nodes.push({id:"0",label:z}),D.push(J)}}),D},T.prototype.run=function(){var m=this;if(this.frequentSize1Subgraphs=this.generate1EdgeFrequentSubGraphs(),!(this.maxNodeNum<2)){var w=this.graphs,O=this.directed,D={};Object.keys(w).forEach(function(g){var _=w[g],Y=_.nodeMap;_.nodes.forEach(function(V){var z=m.findForwardRootEdges(_,V);z.forEach(function(Z){var J=Y[Z.to],ee="".concat(V.label,"-").concat(Z.label,"-").concat(J.label);D[ee]||(D[ee]={projected:[],nodeLabel1:V.label,edgeLabel:Z.label,nodeLabel2:J.label});var Q={graphId:g,edge:Z,preNode:null};D[ee].projected.push(Q)})})}),Object.keys(D).forEach(function(g){var _=D[g],Y=_.projected,V=_.nodeLabel1,z=_.edgeLabel,Z=_.nodeLabel2;m.dfsCode.dfsEdgeList.push(new N(0,1,V,z,Z)),m.subGraphMining(Y),m.dfsCode.dfsEdgeList.pop()})}},T}(),v=function(m,w,O,D){var g={};return Object.keys(m).forEach(function(_,Y){var V=m[_],z=new B.Graph(Y,!0,w),Z={};V.nodes.forEach(function(J,ee){z.addNode(ee,J[O]),Z[J.id]=ee}),V.edges.forEach(function(J,ee){var Q=Z[J.source],re=Z[J.target];z.addEdge(-1,Q,re,J[D])}),z&&z.getNodeNum()&&(g[z.id]=z)}),g},p=function(m,w,O){var D=[];return m.forEach(function(g){var _={nodes:[],edges:[]};g.nodes.forEach(function(Y){var V;_.nodes.push((V={id:"".concat(Y.id)},V[w]=Y.label,V))}),g.edges.forEach(function(Y){var V;_.edges.push((V={source:"".concat(Y.from),target:"".concat(Y.to)},V[O]=Y.label,V))}),D.push(_)}),D},c="cluster",f=function(m){var w=m.graphs,O=m.directed,D=O===void 0?!1:O,g=m.nodeLabelProp,_=g===void 0?c:g,Y=m.edgeLabelProp,V=Y===void 0?c:Y,z=v(w,D,_,V),Z=m.minSupport,J=m.maxNodeNum,ee=m.minNodeNum,Q=m.verbose,re=m.top,fe={graphs:z,minSupport:Z,maxNodeNum:J,minNodeNum:ee,top:re,verbose:Q,directed:D},me=new A(fe);me.run();var ae=p(me.frequentSubgraphs,_,V);return ae},l=f;x.default=l},68575:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.VACANT_NODE_LABEL=x.VACANT_NODE_ID=x.VACANT_GRAPH_ID=x.VACANT_EDGE_LABEL=x.VACANT_EDGE_ID=x.Node=x.Graph=x.Edge=x.AUTO_EDGE_ID=void 0;var M=-1;x.VACANT_EDGE_ID=M;var S=-1;x.VACANT_NODE_ID=S;var B="-1";x.VACANT_EDGE_LABEL=B;var N="-1";x.VACANT_NODE_LABEL=N;var E=-1;x.VACANT_GRAPH_ID=E;var I="-1";x.AUTO_EDGE_ID=I;var A=function(){function c(f,l,T,m){f===void 0&&(f=M),l===void 0&&(l=S),T===void 0&&(T=S),m===void 0&&(m=B),this.id=f,this.from=l,this.to=T,this.label=m}return c}();x.Edge=A;var v=function(){function c(f,l){f===void 0&&(f=S),l===void 0&&(l=N),this.id=f,this.label=l,this.edges=[],this.edgeMap={}}return c.prototype.addEdge=function(f){this.edges.push(f),this.edgeMap[f.id]=f},c}();x.Node=v;var p=function(){function c(f,l,T){f===void 0&&(f=S),l===void 0&&(l=!0),T===void 0&&(T=!1),this.id=f,this.edgeIdAutoIncrease=l,this.edges=[],this.nodes=[],this.nodeMap={},this.edgeMap={},this.nodeLabelMap={},this.edgeLabelMap={},this.counter=0,this.directed=T}return c.prototype.getNodeNum=function(){return this.nodes.length},c.prototype.addNode=function(f,l){if(!this.nodeMap[f]){var T=new v(f,l);this.nodes.push(T),this.nodeMap[f]=T,this.nodeLabelMap[l]||(this.nodeLabelMap[l]=[]),this.nodeLabelMap[l].push(f)}},c.prototype.addEdge=function(f,l,T,m){if((this.edgeIdAutoIncrease||f===void 0)&&(f=this.counter++),!(this.nodeMap[l]&&this.nodeMap[T]&&this.nodeMap[T].edgeMap[f])){var w=new A(f,l,T,m);if(this.edges.push(w),this.edgeMap[f]=w,this.nodeMap[l].addEdge(w),this.edgeLabelMap[m]||(this.edgeLabelMap[m]=[]),this.edgeLabelMap[m].push(w),!this.directed){var O=new A(f,T,l,m);this.nodeMap[T].addEdge(O),this.edgeLabelMap[m].push(O)}}},c}();x.Graph=p},82812:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=M(70655),B=A(M(75033)),N=A(M(21146)),E=A(M(78089)),I=M(70643);function A(V){return V&&V.__esModule?V:{default:V}}var v=function(z,Z,J,ee){J===void 0&&(J="cluster"),ee===void 0&&(ee=2);var Q=[],re=z.nodes;return Z.forEach(function(fe,me){Q.push(p(re,fe,me,J,ee))}),Q},p=function(z,Z,J,ee,Q){var re=[J],fe=[],me={};return Z.forEach(function(ae,Ee){if(ae<=Q&&J!==Ee){re.push(Ee),fe.push(z[Ee]);var Le=z[Ee][ee];me[Le]?(me[Le].count++,me[Le].dists.push(ae)):me[Le]={count:1,dists:[ae]}}}),Object.keys(me).forEach(function(ae){me[ae].dists=me[ae].dists.sort(function(Ee,Le){return Ee-Le})}),{nodeIdx:J,nodeId:z[J].id,nodeIdxs:re,neighbors:fe,neighborNum:re.length-1,nodeLabelCountMap:me}},c=function(z,Z,J,ee,Q){var re=Math.ceil(J/Z),fe={},me=0;return ee.forEach(function(ae,Ee){for(var Le=0,De=0,Ve=ae.nodeIdxs,et=ae.neighborNum-1;Le<re;){for(var It=Ve[1+Math.floor(Math.random()*et)],er=0;(fe["".concat(Ee,"-").concat(It)]||fe["".concat(It,"-").concat(Ee)])&&(It=Math.floor(Math.random()*Z),er++,!(er>2*Z)););if(er<2*Z&&(fe["".concat(Ee,"-").concat(It)]={start:Ee,end:It,distance:Q[Ee][It]},Le++,me++,me>=J))return fe;if(De++,De>2*Z)break}if(Le<re){var nr=re-Le;re=(re+nr)/(Z-Ee-1)}}),fe},f=function(z,Z,J,ee){var Q=J.nodes;return ee||(ee={}),Object.keys(z).forEach(function(re){var fe,me;if(!(ee&&ee[re])){ee[re]={nodes:[],edges:[]};var ae=z[re],Ee=(fe=Z[ae.start])===null||fe===void 0?void 0:fe.nodeIdxs,Le=(me=Z[ae.end])===null||me===void 0?void 0:me.nodeIdxs;if(!(!Ee||!Le)){var De=new Set(Le),Ve=Ee.filter(function(Fe){return De.has(Fe)});if(!(!Ve||!Ve.length)){for(var et={},It=Ve.length,er=0;er<It;er++){var nr=Q[Ve[er]];ee[re].nodes.push(nr),et[nr.id]=!0}J.edges.forEach(function(Fe){et[Fe.source]&&et[Fe.target]&&ee[re].edges.push(Fe)})}}}}),ee},l=function(z,Z,J,ee){var Q,re,fe={};z.nodes.forEach(function(ae){fe[ae.id]=ae});var me=0;return!((Q=Z==null?void 0:Z.edges)===null||Q===void 0?void 0:Q.length)||((re=Z==null?void 0:Z.nodes)===null||re===void 0?void 0:re.length)<2?0:(z.edges.forEach(function(ae){var Ee=fe[ae.source][J],Le=fe[ae.target][J],De=Z==null?void 0:Z.nodes[0][J],Ve=Z==null?void 0:Z.nodes[1][J],et=Z==null?void 0:Z.edges[0][ee];ae[ee]===et&&(Ee===De&&Le===Ve||Ee===Ve&&Le===De)&&me++}),me)},T=function(z,Z,J){for(var ee=Infinity,Q=0,re=function(ae){var Ee=z[ae],Le=Object.keys(Ee).sort(function(Fe,Vt){return Ee[Fe]-Ee[Vt]}),De=10,Ve=[];Le.forEach(function(Fe,Vt){Ve[Vt%De]||(Ve[Vt%De]={graphs:[],totalCount:0,aveCount:0}),Ve[Vt%De].graphs.push(Fe),Ve[Vt%De].totalCount+=Ee[Fe]});var et=0,It=[];Ve.forEach(function(Fe){var Vt=Fe.totalCount/Fe.graphs.length;Fe.aveCount=Vt,It.push(Vt);var $t=0,Ar=Fe.length;Fe.graphs.forEach(function(ke,Oe){var we=Ee[ke];Fe.graphs.forEach(function(Be,We){Oe!==We&&($t+=Math.abs(we-Ee[Be]))})}),$t/=Ar*(Ar-1)/2,et+=$t}),et/=Ve.length;var er=0;It.forEach(function(Fe,Vt){It.forEach(function($t,Ar){Vt!==Ar&&(er+=Math.abs(Fe-$t))}),er/=It.length*(It.length-1)/2});var nr=er-et;ee<nr&&(ee=nr,Q=ae)},fe=0;fe<Z;fe++)re(fe);return{structure:J[Q],structureCountMap:z[Q]}},m=function(z,Z){var J={},ee={};return z.forEach(function(Q,re){J[Q.id]={idx:re,node:Q,degree:0,inDegree:0,outDegree:0};var fe=Q[Z];ee[fe]||(ee[fe]=[]),ee[fe].push(Q)}),{nodeMap:J,nodeLabelMap:ee}},w=function(z,Z,J){var ee={},Q={};return z.forEach(function(re,fe){ee["".concat(I.uniqueId)]={idx:fe,edge:re};var me=re[Z];Q[me]||(Q[me]=[]),Q[me].push(re);var ae=J[re.source];ae&&(ae.degree++,ae.outDegree++);var Ee=J[re.target];Ee&&(Ee.degree++,Ee.inDegree++)}),{edgeMap:ee,edgeLabelMap:Q}},O=function(z,Z,J){var ee=Z.length,Q={};return Z.forEach(function(re,fe){for(var me=J?0:fe+1,ae=z[fe].id,Ee=me;Ee<ee;Ee++)if(fe!==Ee){var Le=z[Ee].id,De=re[Ee];Q["".concat(ae,"-").concat(Le)]=De,J||(Q["".concat(Le,"-").concat(ae)]=De)}}),Q},D=function(z,Z,J,ee,Q,re,fe,me,ae,Ee,Le){var De,Ve="".concat(Z.id,"-").concat(J.id);if(Ee&&Ee[Ve])return Ee[Ve];var et=Le?Le[Ve]:void 0;if(!et){var It=(De={},De[Ve]={start:ee[Z.id].idx,end:ee[J.id].idx,distance:Q},De);Le=f(It,re,z,Le),et=Le[Ve]}return l(et,fe,me,ae)},g=function(z,Z,J,ee){var Q,re,fe,me=(Q=z[Z])===null||Q===void 0?void 0:Q.degree,ae=(re=z[Z])===null||re===void 0?void 0:re.inDegree,Ee=(fe=z[Z])===null||fe===void 0?void 0:fe.outDegree;return z[Z]===void 0&&(me=Infinity,ae=Infinity,Ee=Infinity,ee[Z].forEach(function(Le){var De=J[Le.id].degree;me>De&&(me=De);var Ve=J[Le.id].inDegree;ae>Ve&&(ae=Ve);var et=J[Le.id].outDegree;Ee>et&&(Ee=et)}),z[Z]={degree:me,inDegree:ae,outDegree:Ee}),{minPatternNodeLabelDegree:me,minPatternNodeLabelInDegree:ae,minPatternNodeLabelOutDegree:Ee}},_=function(z,Z,J,ee,Q,re,fe){var me;if(J===void 0&&(J=!1),re===void 0&&(re="cluster"),fe===void 0&&(fe="cluster"),!(!z||!z.nodes)){var ae=z.nodes.length;if(!!ae){var Ee=(0,B.default)(z,J),Le=(0,B.default)(Z,J),De=O(z.nodes,Ee,J),Ve=O(Z.nodes,Le,J),et=m(z.nodes,re),It=et.nodeMap,er=et.nodeLabelMap,nr=m(Z.nodes,re),Fe=nr.nodeMap,Vt=nr.nodeLabelMap;w(z.edges,fe,It);var $t=w(Z.edges,fe,Fe).edgeLabelMap,Ar=[];Le==null||Le.forEach(function(cn){Ar=Ar.concat(cn)}),Q||(Q=Math.max.apply(Math,(0,S.__spreadArray)((0,S.__spreadArray)([],Ar,!1),[2],!1))),ee||(ee=Q);var ke=v(z,Ee,re,ee),Oe=v(Z,Le,re,ee),we=Math.min(100,ae*(ae-1)/2),Be=c(ee,ae,we,ke,Ee),We=f(Be,ke,z),He=10,St=1,Mt=1,sr=4,Ge={graphs:We,nodeLabelProp:re,edgeLabelProp:fe,minSupport:St,minNodeNum:Mt,maxNodeNum:sr,directed:J},ut=(0,N.default)(Ge).slice(0,He),U=ut.length,he=[];ut.forEach(function(cn,wn){he[wn]={},Object.keys(We).forEach(function(xn){var gn=We[xn],Un=l(gn,cn,re,fe);he[wn][xn]=Un})});var Qe=T(he,U,ut),le=Qe.structure,ct=Qe.structureCountMap,ft=Z.nodes[0],jt=[],Lt=(me=Z.nodes[0])===null||me===void 0?void 0:me[re],Ht=-Infinity;Z.nodes.forEach(function(cn){var wn=cn[re],xn=er[wn];(xn==null?void 0:xn.length)>Ht&&(Ht=xn.length,jt=xn,Lt=wn,ft=cn)});var vr={},rt={},at={},Pt={},gt={},Dt={};Object.keys(Vt).forEach(function(cn,wn){gt[cn]=[],J&&(Dt[cn]=[]);var xn=-Infinity,gn=Vt[cn],Un={};gn.forEach(function(j){var R=Ve["".concat(ft.id,"-").concat(j.id)];if(R&&gt[cn].push(R),xn<R&&(xn=R),Un["".concat(ft.id,"-").concat(j.id)]={start:0,end:Fe[j.id].idx,distance:R},J){var k=Ve["".concat(j.id,"-").concat(ft.id)];k&&Dt[cn].push(k)}}),gt[cn]=gt[cn].sort(function(j,R){return j-R}),J&&(Dt[cn]=Dt[cn].sort(function(j,R){return j-R})),rt=f(Un,Oe,Z,rt);var bt=[];if(Object.keys(Un).forEach(function(j){if(at[j]){bt.push(at[j]);return}var R=rt[j];at[j]=l(R,le,re,fe),bt.push(at[j])}),bt=bt.sort(function(j,R){return R-j}),Pt["".concat(ft.id,"-").concat(cn)]=bt,cn!==Lt)for(var Mn=(jt==null?void 0:jt.length)||0,be=function(R){var k=jt[R],te=ke[It[k.id].idx],Me=te.nodeLabelCountMap[cn],Ne=Vt[cn].length;if(!Me||Me.count<Ne)return jt.splice(R,1),"continue";for(var Pe=!1,Ke=0;Ke<Ne;Ke++)if(Me.dists[Ke]>gt[cn][Ke]){Pe=!0;break}if(Pe)return jt.splice(R,1),"continue";var Ut={};te.neighbors.forEach(function(kr){var ur=De["".concat(k.id,"-").concat(kr.id)];Ut["".concat(k.id,"-").concat(kr.id)]={start:It[k.id].idx,end:It[kr.id].idx,distance:ur}}),We=f(Ut,ke,z,We);var Rt=[];Object.keys(Ut).forEach(function(kr){if(ct[kr]){Rt.push(ct[kr]);return}var ur=We[kr];ct[kr]=l(ur,le,re,fe),Rt.push(ct[kr])}),Rt=Rt.sort(function(kr,ur){return ur-kr});for(var fr=!1,Ke=0;Ke<Ne;Ke++)if(Rt[Ke]<bt[Ke]){fr=!0;break}if(fr)return jt.splice(R,1),"continue"},Se=Mn-1;Se>=0;Se--)be(Se)});var ir=[];jt==null||jt.forEach(function(cn){for(var wn=It[cn.id].idx,xn=p(z.nodes,Ee[wn],wn,re,Q),gn=xn.neighbors,Un=gn.length,bt=!1,Mn=Un-1;Mn>=0;Mn--){if(gn.length+1<Z.nodes.length){bt=!0;return}var be=gn[Mn],Se=be[re];if(!Vt[Se]||!Vt[Se].length){gn.splice(Mn,1);continue}if(!gt[Se]||!gt[Se].length){gn.splice(Mn,1);continue}var j="".concat(cn.id,"-").concat(be.id),R=De[j],k=gt[Se].length-1,te=gt[Se][k];if(R>te){gn.splice(Mn,1);continue}if(J){var Me="".concat(be.id,"-").concat(cn.id),Ne=De[Me];k=Dt[Se].length-1;var Pe=Dt[Se][k];if(Ne>Pe){gn.splice(Mn,1);continue}}var Ke=ct[j]?ct[j]:D(z,cn,be,It,R,ke,le,re,fe,ct,We),Ut="".concat(ft.id,"-").concat(Se),Rt=Pt[Ut][Pt[Ut].length-1];if(Ke<Rt){gn.splice(Mn,1);continue}var fr=g(vr,Se,Fe,Vt),kr=fr.minPatternNodeLabelDegree,ur=fr.minPatternNodeLabelInDegree,rn=fr.minPatternNodeLabelOutDegree;if(It[be.id].degree<kr){gn.splice(Mn,1);continue}}bt||ir.push({nodes:[cn].concat(gn)})});var At=(0,E.default)(Z,ft.id,!1).length,xr={};J?(Object.keys(At).forEach(function(cn){var wn=Fe[cn].node[re];xr[wn]?xr[wn].push(At[cn]):xr[wn]=[At[cn]]}),Object.keys(xr).forEach(function(cn){xr[cn].sort(function(wn,xn){return wn-xn})})):xr=gt;for(var Pr=ir.length,Qr=function(wn){var xn=ir[wn],gn=xn.nodes[0],Un={},bt={};xn.nodes.forEach(function(Sr,lt){bt[Sr.id]={idx:lt,node:Sr,degree:0,inDegree:0,outDegree:0};var Ae=Sr[re];Un[Ae]?Un[Ae]++:Un[Ae]=1});var Mn=[],be={};z.edges.forEach(function(Sr){bt[Sr.source]&&bt[Sr.target]&&(Mn.push(Sr),be[Sr[fe]]?be[Sr[fe]]++:be[Sr[fe]]=1,bt[Sr.source].degree++,bt[Sr.target].degree++,bt[Sr.source].outDegree++,bt[Sr.target].inDegree++)});for(var Se=Object.keys($t).length,j=!1,R=0;R<Se;R++){var k=Object.keys($t)[R];if(!be[k]||be[k]<$t[k].length){j=!0;break}}if(j)return ir.splice(wn,1),"continue";var te=Mn.length;if(te<Z.edges.length)return ir.splice(wn,1),"break";for(var Me=!1,Ne=function(lt){var Ae=Mn[lt],Ye=Ae[fe],Tt=$t[Ye];if(!Tt||!Tt.length)return be[Ye]--,Tt&&be[Ye]<Tt.length?(Me=!0,"break"):(Mn.splice(lt,1),bt[Ae.source].degree--,bt[Ae.target].degree--,bt[Ae.source].outDegree--,bt[Ae.target].inDegree--,"continue");var pt=bt[Ae.source].node[re],kt=bt[Ae.target].node[re],ar=!1;if(Tt.forEach(function(jr){var tn=Fe[jr.source].node,Ln=Fe[jr.target].node;tn[re]===pt&&Ln[re]===kt&&(ar=!0),!J&&tn[re]===kt&&Ln[re]===pt&&(ar=!0)}),!ar)return be[Ye]--,Tt&&be[Ye]<Tt.length?(Me=!0,"break"):(Mn.splice(lt,1),bt[Ae.source].degree--,bt[Ae.target].degree--,bt[Ae.source].outDegree--,bt[Ae.target].inDegree--,"continue")},R=te-1;R>=0;R--){var Pe=Ne(R);if(Pe==="break")break}if(Me)return ir.splice(wn,1),"continue";xn.edges=Mn;var Ke=(0,E.default)(xn,xn.nodes[0].id,!1).length;if(Object.keys(Ke).reverse().forEach(function(Sr){if(!(Sr===xn.nodes[0].id||Me)){if(Ke[Sr]===Infinity){var lt=bt[Sr].node[re];if(Un[lt]--,Un[lt]<Vt[lt].length){Me=!0;return}var Ae=xn.nodes.indexOf(bt[Sr].node);xn.nodes.splice(Ae,1),bt[Sr]=void 0;return}var Ye=It[Sr].node[re];if(!xr[Ye]||!xr[Ye].length||Ke[Sr]>xr[Ye][xr[Ye].length-1]){var lt=bt[Sr].node[re];if(Un[lt]--,Un[lt]<Vt[lt].length){Me=!0;return}var Ae=xn.nodes.indexOf(bt[Sr].node);xn.nodes.splice(Ae,1),bt[Sr]=void 0}}}),Me)return ir.splice(wn,1),"continue";for(var Ut=!0,Rt=0;Ut&&!Me;){Ut=!1;var fr=J?bt[gn.id].degree<Fe[ft.id].degree||bt[gn.id].inDegree<Fe[ft.id].inDegree||bt[gn.id].outDegree<Fe[ft.id].outDegree:bt[gn.id].degree<Fe[ft.id].degree;if(fr){Me=!0;break}if(Un[gn[re]]<Vt[gn[re]].length){Me=!0;break}for(var kr=xn.nodes.length,ur=kr-1;ur>=0;ur--){var rn=xn.nodes[ur],On=bt[rn.id].degree,ne=bt[rn.id].inDegree,ye=bt[rn.id].outDegree,Je=rn[re],Ct=g(vr,Je,Fe,Vt),Nt=Ct.minPatternNodeLabelDegree,mr=Ct.minPatternNodeLabelInDegree,lr=Ct.minPatternNodeLabelOutDegree,dr=J?On<Nt||ne<mr||ye<lr:On<Nt;if(dr){if(Un[rn[re]]--,Un[rn[re]]<Vt[rn[re]].length){Me=!0;break}xn.nodes.splice(ur,1),bt[rn.id]=void 0,Ut=!0}}if(Me||!Ut&&Rt!==0)break;te=Mn.length;for(var yr=te-1;yr>=0;yr--){var Gr=Mn[yr];if(!bt[Gr.source]||!bt[Gr.target]){Mn.splice(yr,1);var Jr=Gr[fe];if(be[Jr]--,bt[Gr.source]&&(bt[Gr.source].degree--,bt[Gr.source].outDegree--),bt[Gr.target]&&(bt[Gr.target].degree--,bt[Gr.target].inDegree--),$t[Jr]&&be[Jr]<$t[Jr].length){Me=!0;break}Ut=!0}}Rt++}if(Me||Me||xn.nodes.length<Z.nodes.length||Mn.length<Z.edges.length)return ir.splice(wn,1),"continue"},Vr=Pr-1;Vr>=0;Vr--){var nn=Qr(Vr);if(nn==="break")break}for(var dn=ir.length,Vn=function(wn){var xn=ir[wn],gn={};xn.edges.forEach(function(Mn){var be="".concat(Mn.source,"-").concat(Mn.target,"-").concat(Mn.label);gn[be]?gn[be]++:gn[be]=1});for(var Un=function(be){var Se=ir[be],j={};Se.edges.forEach(function(k){var te="".concat(k.source,"-").concat(k.target,"-").concat(k.label);j[te]?j[te]++:j[te]=1});var R=!0;Object.keys(j).length!==Object.keys(gn).length?R=!1:Object.keys(gn).forEach(function(k){j[k]!==gn[k]&&(R=!1)}),R&&ir.splice(be,1)},bt=dn-1;bt>wn;bt--)Un(bt);dn=ir.length},Vr=0;Vr<=dn-1;Vr++)Vn(Vr);return ir}}},Y=_;x.default=Y},5170:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=N(M(62238)),B=M(70643);function N(A){return A&&A.__esModule?A:{default:A}}var E=function(v,p,c,f){p===void 0&&(p=!1),c===void 0&&(c="weight"),f===void 0&&(f=1e3);var l=v.nodes,T=l===void 0?[]:l,m=v.edges,w=m===void 0?[]:m,O={},D={};T.forEach(function(re,fe){var me=(0,B.uniqueId)();re.clusterId=me,O[me]={id:me,nodes:[re]},D[re.id]={node:re,idx:fe}});var g=(0,S.default)(v,p),_=[],Y={};g.forEach(function(re,fe){var me=0,ae=T[fe].id;Y[ae]={},re.forEach(function(Ee,Le){if(!!Ee){me+=Ee;var De=T[Le].id;Y[ae][De]=Ee}}),_.push(me)});for(var V=0,z=function(){var fe=!1;if(T.forEach(function(me){var ae={};Object.keys(Y[me.id]).forEach(function(nr){var Fe=Y[me.id][nr],Vt=D[nr].node,$t=Vt.clusterId;ae[$t]||(ae[$t]=0),ae[$t]+=Fe});var Ee=-Infinity,Le=[];if(Object.keys(ae).forEach(function(nr){Ee<ae[nr]?(Ee=ae[nr],Le=[nr]):Ee===ae[nr]&&Le.push(nr)}),!(Le.length===1&&Le[0]===me.clusterId)){var De=Le.indexOf(me.clusterId);if(De>=0&&Le.splice(De,1),Le&&Le.length){fe=!0;var Ve=O[me.clusterId],et=Ve.nodes.indexOf(me);Ve.nodes.splice(et,1);var It=Math.floor(Math.random()*Le.length),er=O[Le[It]];er.nodes.push(me),me.clusterId=er.id}}}),!fe)return"break";V++};V<f;){var Z=z();if(Z==="break")break}Object.keys(O).forEach(function(re){var fe=O[re];(!fe.nodes||!fe.nodes.length)&&delete O[re]});var J=[],ee={};w.forEach(function(re){var fe=re.source,me=re.target,ae=re[c]||1,Ee=D[fe].node.clusterId,Le=D[me].node.clusterId,De="".concat(Ee,"---").concat(Le);if(ee[De])ee[De].weight+=ae,ee[De].count++;else{var Ve={source:Ee,target:Le,weight:ae,count:1};ee[De]=Ve,J.push(Ve)}});var Q=[];return Object.keys(O).forEach(function(re){Q.push(O[re])}),{clusters:Q,clusterEdges:J}},I=E;x.default=I},35179:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=M(49242),B=A(M(62238)),N=A(M(29741)),E=M(3665),I=M(26838);function A(l){return l&&l.__esModule?l:{default:l}}var v=function(T,m,w,O){for(var D=m.length,g=2*O,_=0,Y=0;Y<D;Y++)for(var V=T[Y].clusterId,z=0;z<D;z++){var Z=T[z].clusterId;if(V===Z){var J=m[Y][z]||0,ee=w[Y]||0,Q=w[z]||0;_+=J-ee*Q/g}}return _*=1/g,_},p=function(T,m){T===void 0&&(T=[]);for(var w=T.length,O=new N.default([]),D=0;D<w;D++)O=O.add(new N.default(m[D]));var g=O.avg(w);g.normalize();for(var _=0,D=0;D<w;D++){var Y=new N.default(m[D]),V=Y.squareEuclideanDistance(g);_+=V}var z=[];T.forEach(function(){z.push([])});for(var D=0;D<w;D++){var Y=new N.default(m[D]);T[D].clusterInertial=0;for(var Z=0;Z<w;Z++){if(D===Z){z[D][Z]=0;continue}var J=new N.default(m[Z]);z[D][Z]=Y.squareEuclideanDistance(J),T[D].clusterInertial+=z[D][Z]}}for(var ee=0,Q=2*w*_,D=0;D<w;D++)for(var re=T[D].clusterId,Z=0;Z<w;Z++){var fe=T[Z].clusterId;if(!(D===Z||re!==fe)){var me=T[D].clusterInertial*T[Z].clusterInertial/Math.pow(Q,2)-z[D][Z]/Q;ee+=me}}return Number(ee.toFixed(4))},c=function(T,m,w,O,D,g,_,Y,V){m===void 0&&(m=!1),w===void 0&&(w="weight"),O===void 0&&(O=1e-4),D===void 0&&(D=!1),g===void 0&&(g=void 0),_===void 0&&(_=[]),Y===void 0&&(Y=["id"]),V===void 0&&(V=1);var z=T.nodes,Z=z===void 0?[]:z,J=T.edges,ee=J===void 0?[]:J,Q=[];if(D){Z.forEach(function(We,He){We.properties=We.properties||{},We.originIndex=He});var re=[];Z.every(function(We){return We.hasOwnProperty("nodeType")})&&(re=Array.from(new Set(Z.map(function(We){return We.nodeType}))),Z.forEach(function(We){We.properties.nodeType=re.findIndex(function(He){return He===We.nodeType})}));var fe=(0,E.getAllProperties)(Z,g);Q=(0,I.oneHot)(fe,_,Y)}var me=1,ae={},Ee={};Z.forEach(function(We,He){var St=String(me++);We.clusterId=St,ae[St]={id:St,nodes:[We]},Ee[We.id]={node:We,idx:He}});var Le=(0,B.default)(T,m),De=[],Ve={},et=0;Le.forEach(function(We,He){var St=0,Mt=Z[He].id;Ve[Mt]={},We.forEach(function(sr,Ge){if(!!sr){St+=sr;var ut=Z[Ge].id;Ve[Mt][ut]=sr,et+=sr}}),De.push(St)}),et/=2;for(var It=Infinity,er=Infinity,nr=0,Fe=[],Vt={};;){D&&Z.every(function(We){return We.hasOwnProperty("properties")})?It=v(Z,Le,De,et)+p(Z,Q)*V:It=v(Z,Le,De,et),nr===0&&(er=It,Fe=Z,Vt=ae);var $t=It>0&&It>er&&It-er<O;if(It>er&&(Fe=Z.map(function(We){return{node:We,clusterId:We.clusterId}}),Vt=(0,S.clone)(ae),er=It),$t||nr>100)break;nr++,Object.keys(ae).forEach(function(We){var He=0;ee.forEach(function(St){var Mt=St.source,sr=St.target,Ge=Ee[Mt].node.clusterId,ut=Ee[sr].node.clusterId;(Ge===We&&ut!==We||ut===We&&Ge!==We)&&(He=He+(St[w]||1))}),ae[We].sumTot=He}),Z.forEach(function(We,He){var St=ae[We.clusterId],Mt=0,sr,Ge=De[He]/(2*et),ut=0,U=St.nodes;U.forEach(function(rt){var at=Ee[rt.id].idx;ut+=Le[He][at]||0});var he=ut-St.sumTot*Ge,Qe=U.filter(function(rt){return rt.id!==We.id}),le=[];Qe.forEach(function(rt,at){le[at]=Q[rt.originIndex]});var ct=p(Qe,Q)*V,ft=Ve[We.id];if(Object.keys(ft).forEach(function(rt){var at=Ee[rt].node,Pt=at.clusterId;if(Pt!==We.clusterId){var gt=ae[Pt],Dt=gt.nodes;if(!(!Dt||!Dt.length)){var ir=0;Dt.forEach(function(nn){var dn=Ee[nn.id].idx;ir+=Le[He][dn]||0});var At=ir-gt.sumTot*Ge,xr=Dt.concat([We]),Pr=[];xr.forEach(function(nn,dn){Pr[dn]=Q[nn.originIndex]});var Qr=p(xr,Q)*V,Vr=At-he;D&&(Vr=At+Qr-(he+ct)),Vr>Mt&&(Mt=Vr,sr=gt)}}}),Mt>0){sr.nodes.push(We);var jt=We.clusterId;We.clusterId=sr.id;var Lt=St.nodes.indexOf(We);St.nodes.splice(Lt,1);var Ht=0,vr=0;ee.forEach(function(rt){var at=rt.source,Pt=rt.target,gt=Ee[at].node.clusterId,Dt=Ee[Pt].node.clusterId;(gt===sr.id&&Dt!==sr.id||Dt===sr.id&&gt!==sr.id)&&(Ht=Ht+(rt[w]||1)),(gt===jt&&Dt!==jt||Dt===jt&&gt!==jt)&&(vr=vr+(rt[w]||1))}),sr.sumTot=Ht,St.sumTot=vr}})}var Ar={},ke=0;Object.keys(Vt).forEach(function(We){var He=Vt[We];if(!He.nodes||!He.nodes.length){delete Vt[We];return}var St=String(ke+1);St!==We&&(He.id=St,He.nodes=He.nodes.map(function(Mt){return{id:Mt.id,clusterId:St}}),Vt[St]=He,Ar[We]=St,delete Vt[We],ke++)}),Fe.forEach(function(We){var He=We.node,St=We.clusterId;!He||(He.clusterId=St,He.clusterId&&Ar[He.clusterId]&&(He.clusterId=Ar[He.clusterId]))});var Oe=[],we={};ee.forEach(function(We){var He=We.source,St=We.target,Mt=We[w]||1,sr=Ee[He].node.clusterId,Ge=Ee[St].node.clusterId;if(!(!sr||!Ge)){var ut="".concat(sr,"---").concat(Ge);if(we[ut])we[ut].weight+=Mt,we[ut].count++;else{var U={source:sr,target:Ge,weight:Mt,count:1};we[ut]=U,Oe.push(U)}}});var Be=[];return Object.keys(Vt).forEach(function(We){Be.push(Vt[We])}),{clusters:Be,clusterEdges:Oe}},f=c;x.default=f},89454:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=E(M(38823)),B=E(M(57085)),N=M(70643);function E(c){return c&&c.__esModule?c:{default:c}}var I=function(f,l){var T=[],m=f.nodes,w=m===void 0?[]:m,O=f.edges,D=O===void 0?[]:O;if(w.length===0)return T;var g=w[0],_=new Set;_.add(g);var Y=function(Q,re){return l?Q.weight-re.weight:0},V=new B.default(Y);for((0,N.getEdgesByNodeId)(g.id,D).forEach(function(ee){V.insert(ee)});!V.isEmpty();){var z=V.delMin(),Z=z.source,J=z.target;_.has(Z)&&_.has(J)||(T.push(z),_.has(Z)||(_.add(Z),(0,N.getEdgesByNodeId)(Z,D).forEach(function(ee){V.insert(ee)})),_.has(J)||(_.add(J),(0,N.getEdgesByNodeId)(J,D).forEach(function(ee){V.insert(ee)})))}return T},A=function(f,l){var T=[],m=f.nodes,w=m===void 0?[]:m,O=f.edges,D=O===void 0?[]:O;if(w.length===0)return T;var g=D.map(function(Z){return Z});l&&g.sort(function(Z,J){return Z.weight-J.weight});for(var _=new S.default(w.map(function(Z){return Z.id}));g.length>0;){var Y=g.shift(),V=Y.source,z=Y.target;_.connected(V,z)||(T.push(Y),_.union(V,z))}return T},v=function(f,l,T){var m={prim:I,kruskal:A};return T?m[T](f,l):A(f,l)},p=v;x.default=p},74926:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=N(M(82556)),B=M(70643);function N(A){return A&&A.__esModule?A:{default:A}}var E=function(v,p,c){typeof p!="number"&&(p=1e-6),typeof c!="number"&&(c=.85);for(var f=1,l=0,T=1e3,m=v.nodes,w=m===void 0?[]:m,O=v.edges,D=O===void 0?[]:O,g=w.length,_,Y={},V={},z=0;z<g;++z){var Z=w[z],J=Z.id;Y[J]=1/g,V[J]=1/g}for(var ee=(0,S.default)(v);T>0&&f>p;){l=0;for(var z=0;z<g;++z){var Z=w[z],J=Z.id;if(_=0,ee[Z.id].inDegree===0)Y[J]=0;else{for(var Q=(0,B.getNeighbors)(J,D,"source"),re=0;re<Q.length;++re){var fe=Q[re],me=ee[fe].outDegree;me>0&&(_+=V[fe]/me)}Y[J]=c*_,l+=Y[J]}}l=(1-l)/g,f=0;for(var z=0;z<g;++z){var Z=w[z],J=Z.id;_=Y[J]+l,f+=Math.abs(_-V[J]),V[J]=_}T-=1}return V},I=E;x.default=I},57085:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var M=function(E,I){return E-I},S=function(){function N(E){E===void 0&&(E=M),this.compareFn=E,this.list=[]}return N.prototype.getLeft=function(E){return 2*E+1},N.prototype.getRight=function(E){return 2*E+2},N.prototype.getParent=function(E){return E===0?null:Math.floor((E-1)/2)},N.prototype.isEmpty=function(){return this.list.length<=0},N.prototype.top=function(){return this.isEmpty()?void 0:this.list[0]},N.prototype.delMin=function(){var E=this.top(),I=this.list.pop();return this.list.length>0&&(this.list[0]=I,this.moveDown(0)),E},N.prototype.insert=function(E){if(E!==null){this.list.push(E);var I=this.list.length-1;return this.moveUp(I),!0}return!1},N.prototype.moveUp=function(E){for(var I=this.getParent(E);E&&E>0&&this.compareFn(this.list[I],this.list[E])>0;){var A=this.list[I];this.list[I]=this.list[E],this.list[E]=A,E=I,I=this.getParent(E)}},N.prototype.moveDown=function(E){var I,A=E,v=this.getLeft(E),p=this.getRight(E),c=this.list.length;v!==null&&v<c&&this.compareFn(this.list[A],this.list[v])>0?A=v:p!==null&&p<c&&this.compareFn(this.list[A],this.list[p])>0&&(A=p),E!==A&&(I=[this.list[A],this.list[E]],this.list[E]=I[0],this.list[A]=I[1],this.moveDown(A))},N}(),B=S;x.default=B},88481:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=x.LinkedListNode=void 0;var M=function(I,A){return I===A},S=function(){function E(I,A){A===void 0&&(A=null),this.value=I,this.next=A}return E.prototype.toString=function(I){return I?I(this.value):"".concat(this.value)},E}();x.LinkedListNode=S;var B=function(){function E(I){I===void 0&&(I=M),this.head=null,this.tail=null,this.compare=I}return E.prototype.prepend=function(I){var A=new S(I,this.head);return this.head=A,this.tail||(this.tail=A),this},E.prototype.append=function(I){var A=new S(I);return this.head?(this.tail.next=A,this.tail=A,this):(this.head=A,this.tail=A,this)},E.prototype.delete=function(I){if(!this.head)return null;for(var A=null;this.head&&this.compare(this.head.value,I);)A=this.head,this.head=this.head.next;var v=this.head;if(v!==null)for(;v.next;)this.compare(v.next.value,I)?(A=v.next,v.next=v.next.next):v=v.next;return this.compare(this.tail.value,I)&&(this.tail=v),A},E.prototype.find=function(I){var A=I.value,v=A===void 0?void 0:A,p=I.callback,c=p===void 0?void 0:p;if(!this.head)return null;for(var f=this.head;f;){if(c&&c(f.value)||v!==void 0&&this.compare(f.value,v))return f;f=f.next}return null},E.prototype.deleteTail=function(){var I=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,I;for(var A=this.head;A.next;)A.next.next?A=A.next:A.next=null;return this.tail=A,I},E.prototype.deleteHead=function(){if(!this.head)return null;var I=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),I},E.prototype.fromArray=function(I){var A=this;return I.forEach(function(v){return A.append(v)}),this},E.prototype.toArray=function(){for(var I=[],A=this.head;A;)I.push(A),A=A.next;return I},E.prototype.reverse=function(){for(var I=this.head,A=null,v=null;I;)v=I.next,I.next=A,A=I,I=v;this.tail=this.head,this.head=A},E.prototype.toString=function(I){return I===void 0&&(I=void 0),this.toArray().map(function(A){return A.toString(I)}).toString()},E}(),N=B;x.default=N},93026:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=B(M(88481));function B(I){return I&&I.__esModule?I:{default:I}}var N=function(){function I(){this.linkedList=new S.default}return I.prototype.isEmpty=function(){return!this.linkedList.head},I.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},I.prototype.enqueue=function(A){this.linkedList.append(A)},I.prototype.dequeue=function(){var A=this.linkedList.deleteHead();return A?A.value:null},I.prototype.toString=function(A){return this.linkedList.toString(A)},I}(),E=N;x.default=E},38823:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var M=function(){function B(N){this.count=N.length,this.parent={};for(var E=0,I=N;E<I.length;E++){var A=I[E];this.parent[A]=A}}return B.prototype.find=function(N){for(;this.parent[N]!==N;)N=this.parent[N];return N},B.prototype.union=function(N,E){var I=this.find(N),A=this.find(E);I!==A&&(I<A?(this.parent[E]!==E&&this.union(this.parent[E],N),this.parent[E]=this.parent[N]):(this.parent[N]!==N&&this.union(this.parent[N],E),this.parent[N]=this.parent[E]))},B.prototype.connected=function(N,E){return this.find(N)===this.find(E)},B}(),S=M;x.default=S},17892:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.DistanceType=void 0;var M;x.DistanceType=M,function(S){S.EuclideanDistance="euclideanDistance"}(M||(x.DistanceType=M={}))},70643:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.uniqueId=x.getOutEdgesNodeId=x.getNeighbors=x.getEdgesByNodeId=void 0;var M=function(I,A,v){A===void 0&&(A=[]);var p=A.filter(function(T){return T.source===I||T.target===I});if(v==="target"){var c=function(m){return m.source===I};return p.filter(c).map(function(T){return T.target})}if(v==="source"){var f=function(m){return m.target===I};return p.filter(f).map(function(T){return T.source})}var l=function(m){return m.source===I?m.target:m.source};return p.map(l)};x.getNeighbors=M;var S=function(I,A){return A.filter(function(v){return v.source===I})};x.getOutEdgesNodeId=S;var B=function(I,A){return A.filter(function(v){return v.source===I||v.target===I})};x.getEdgesByNodeId=B;var N=function(I){I===void 0&&(I=0);var A="".concat(Math.random()).split(".")[1].substr(0,5),v="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(I,"-").concat(A).concat(v)};x.uniqueId=N},26838:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.oneHot=x.getDistance=x.getAllKeyValueMap=x.default=void 0;var S=M(49242),B=M(17892),N=E(M(29741));function E(c){return c&&c.__esModule?c:{default:c}}var I=function(f,l,T){var m=[];(l==null?void 0:l.length)?m=l:(f.forEach(function(O){m=m.concat(Object.keys(O))}),m=(0,S.uniq)(m));var w={};return m.forEach(function(O){var D=[];f.forEach(function(g){g[O]!==void 0&&g[O]!==""&&D.push(g[O])}),D.length&&!(T==null?void 0:T.includes(O))&&(w[O]=(0,S.uniq)(D))}),w};x.getAllKeyValueMap=I;var A=function(f,l,T){var m=I(f,l,T),w=[];if(!Object.keys(m).length)return w;var O=Object.values(m),D=O.every(function(g){return g.every(function(_){return typeof _=="number"})});return f.forEach(function(g,_){var Y=[];Object.keys(m).forEach(function(V){var z=g[V],Z=m[V],J=Z.findIndex(function(re){return z===re}),ee=[];if(D)ee.push(z);else for(var Q=0;Q<Z.length;Q++)Q===J?ee.push(1):ee.push(0);Y=Y.concat(ee)}),w[_]=Y}),w};x.oneHot=A;var v=function(f,l,T,m){T===void 0&&(T=B.DistanceType.EuclideanDistance);var w=0;switch(T){case B.DistanceType.EuclideanDistance:w=new N.default(f).euclideanDistance(new N.default(l));break;default:break}return w};x.getDistance=v;var p={getAllKeyValueMap:I,oneHot:A,getDistance:v};x.default=p},3665:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.getPropertyWeight=x.getAllSortProperties=x.getAllProperties=x.default=void 0;var S=M(92935),B=function(p,c){p===void 0&&(p=[]),c===void 0&&(c=100);var f={};p.forEach(function(T){!T.properties||Object.keys(T.properties).forEach(function(m){if(m==="id"||!"".concat(T.properties[m]).match(S.secondReg)&&!"".concat(T.properties[m]).match(S.dateReg)&&isNaN(Number(T.properties[m]))){f.hasOwnProperty(m)&&delete f[m];return}f.hasOwnProperty(m)?f[m]+=1:f[m]=1})});var l=Object.keys(f).sort(function(T,m){return f[m]-f[T]});return l.length<c?l:l.slice(0,c)};x.getAllSortProperties=B;var N=function(p,c){return c.map(function(f){return p.hasOwnProperty(f)?p[f]:0})},E=function(p){for(var c=B(p),f=[],l=0;l<p.length;l++)f[l]=N(p[l].properties,c);return f};x.getPropertyWeight=E;var I=function(p,c){c===void 0&&(c=void 0);var f=[];return p.forEach(function(l){c===void 0&&f.push(l),l[c]!==void 0&&f.push(l[c])}),f};x.getAllProperties=I;var A={getAllSortProperties:B,getPropertyWeight:E,getAllProperties:I};x.default=A},29741:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=M(49242),B=function(){function E(I){this.arr=I}return E.prototype.getArr=function(){return this.arr||[]},E.prototype.add=function(I){var A,v=I.arr;if(!((A=this.arr)===null||A===void 0?void 0:A.length))return new E(v);if(!(v==null?void 0:v.length))return new E(this.arr);if(this.arr.length===v.length){var p=[];for(var c in this.arr)p[c]=this.arr[c]+v[c];return new E(p)}},E.prototype.subtract=function(I){var A,v=I.arr;if(!((A=this.arr)===null||A===void 0?void 0:A.length))return new E(v);if(!(v==null?void 0:v.length))return new E(this.arr);if(this.arr.length===v.length){var p=[];for(var c in this.arr)p[c]=this.arr[c]-v[c];return new E(p)}},E.prototype.avg=function(I){var A=[];if(I!==0)for(var v in this.arr)A[v]=this.arr[v]/I;return new E(A)},E.prototype.negate=function(){var I=[];for(var A in this.arr)I[A]=-this.arr[A];return new E(I)},E.prototype.squareEuclideanDistance=function(I){var A,v=I.arr;if(!((A=this.arr)===null||A===void 0?void 0:A.length)||!(v==null?void 0:v.length))return 0;if(this.arr.length===v.length){var p=0;for(var c in this.arr)p+=Math.pow(this.arr[c]-I.arr[c],2);return p}},E.prototype.euclideanDistance=function(I){var A,v=I.arr;if(!((A=this.arr)===null||A===void 0?void 0:A.length)||!(v==null?void 0:v.length))return 0;if(this.arr.length===v.length){var p=0;for(var c in this.arr)p+=Math.pow(this.arr[c]-I.arr[c],2);return Math.sqrt(p)}else console.error("The two vectors are unequal in length.")},E.prototype.normalize=function(){var I=[],A=(0,S.clone)(this.arr);A.sort(function(f,l){return f-l});var v=A[A.length-1],p=A[0];for(var c in this.arr)I[c]=(this.arr[c]-p)/(v-p);return new E(I)},E.prototype.norm2=function(){var I;if(!((I=this.arr)===null||I===void 0?void 0:I.length))return 0;var A=0;for(var v in this.arr)A+=Math.pow(this.arr[v],2);return Math.sqrt(A)},E.prototype.dot=function(I){var A,v=I.arr;if(!((A=this.arr)===null||A===void 0?void 0:A.length)||!(v==null?void 0:v.length))return 0;if(this.arr.length===v.length){var p=0;for(var c in this.arr)p+=this.arr[c]*I.arr[c];return p}else console.error("The two vectors are unequal in length.")},E.prototype.equal=function(I){var A,v=I.arr;if(((A=this.arr)===null||A===void 0?void 0:A.length)!==(v==null?void 0:v.length))return!1;for(var p in this.arr)if(this.arr[p]!==v[p])return!1;return!0},E}(),N=B;x.default=N},31656:function(dt,x,M){"use strict";function S(V){return S=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(z){return typeof z}:function(z){return z&&typeof Symbol=="function"&&z.constructor===Symbol&&z!==Symbol.prototype?"symbol":typeof z},S(V)}Object.defineProperty(x,"__esModule",{value:!0}),Object.defineProperty(x,"GADDI",{enumerable:!0,get:function(){return O.default}}),Object.defineProperty(x,"breadthFirstSearch",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(x,"connectedComponent",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(x,"depthFirstSearch",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(x,"detectCycle",{enumerable:!0,get:function(){return A.default}}),Object.defineProperty(x,"dijkstra",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(x,"findAllPath",{enumerable:!0,get:function(){return c.findAllPath}}),Object.defineProperty(x,"findShortestPath",{enumerable:!0,get:function(){return c.findShortestPath}}),Object.defineProperty(x,"floydWarshall",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(x,"getAdjMatrix",{enumerable:!0,get:function(){return B.default}}),Object.defineProperty(x,"getDegree",{enumerable:!0,get:function(){return I.default}}),Object.defineProperty(x,"getInDegree",{enumerable:!0,get:function(){return I.getInDegree}}),Object.defineProperty(x,"getNeighbors",{enumerable:!0,get:function(){return D.getNeighbors}}),Object.defineProperty(x,"getOutDegree",{enumerable:!0,get:function(){return I.getOutDegree}}),Object.defineProperty(x,"labelPropagation",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(x,"louvain",{enumerable:!0,get:function(){return T.default}}),Object.defineProperty(x,"minimumSpanningTree",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(x,"pageRank",{enumerable:!0,get:function(){return w.default}});var B=Y(M(62238)),N=Y(M(83764)),E=Y(M(59527)),I=_(M(82556)),A=Y(M(94282)),v=Y(M(45891)),p=Y(M(78089)),c=M(41727),f=Y(M(75033)),l=Y(M(5170)),T=Y(M(35179)),m=Y(M(89454)),w=Y(M(74926)),O=Y(M(82812)),D=M(70643);function g(V){if(typeof WeakMap!="function")return null;var z=new WeakMap,Z=new WeakMap;return(g=function(ee){return ee?Z:z})(V)}function _(V,z){if(!z&&V&&V.__esModule)return V;if(V===null||S(V)!=="object"&&typeof V!="function")return{default:V};var Z=g(z);if(Z&&Z.has(V))return Z.get(V);var J={},ee=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Q in V)if(Q!=="default"&&Object.prototype.hasOwnProperty.call(V,Q)){var re=ee?Object.getOwnPropertyDescriptor(V,Q):null;re&&(re.get||re.set)?Object.defineProperty(J,Q,re):J[Q]=V[Q]}return J.default=V,Z&&Z.set(V,J),J}function Y(V){return V&&V.__esModule?V:{default:V}}},66044:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.MESSAGE=x.ALGORITHM=void 0;var M={pageRank:"pageRank",breadthFirstSearch:"breadthFirstSearch",connectedComponent:"connectedComponent",depthFirstSearch:"depthFirstSearch",detectCycle:"detectCycle",detectDirectedCycle:"detectDirectedCycle",detectAllCycles:"detectAllCycles",detectAllDirectedCycle:"detectAllDirectedCycle",detectAllUndirectedCycle:"detectAllUndirectedCycle",dijkstra:"dijkstra",findAllPath:"findAllPath",findShortestPath:"findShortestPath",floydWarshall:"floydWarshall",getAdjMatrix:"getAdjMatrix",getDegree:"getDegree",getInDegree:"getInDegree",getNeighbors:"getNeighbors",getOutDegree:"getOutDegree",labelPropagation:"labelPropagation",louvain:"louvain",GADDI:"GADDI",minimumSpanningTree:"minimumSpanningTree",SUCCESS:"SUCCESS",FAILURE:"FAILURE"};x.ALGORITHM=M;var S={SUCCESS:"SUCCESS",FAILURE:"FAILURE"};x.MESSAGE=S},70585:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=M(66044),B=N(M(12067));function N(A){return A&&A.__esModule?A:{default:A}}var E=function(v){return function(){for(var p=[],c=0;c<arguments.length;c++)p[c]=arguments[c];return new Promise(function(f,l){var T=new B.default;T.postMessage({_algorithmType:v,data:p}),T.onmessage=function(m){var w=m.data,O=w.data,D=w._algorithmType;S.MESSAGE.SUCCESS===D?f(O):l(),T.terminate()}})}},I=E;x.default=I},30485:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.pageRankAsync=x.minimumSpanningTreeAsync=x.louvainAsync=x.labelPropagationAsync=x.getOutDegreeAsync=x.getNeighborsAsync=x.getInDegreeAsync=x.getDegreeAsync=x.getAdjMatrixAsync=x.floydWarshallAsync=x.findShortestPathAsync=x.findAllPathAsync=x.dijkstraAsync=x.detectCycleAsync=x.detectAllUndirectedCycleAsync=x.detectAllDirectedCycleAsync=x.detectAllCyclesAsync=x.connectedComponentAsync=x.GADDIAsync=void 0;var S=N(M(70585)),B=M(66044);function N(J){return J&&J.__esModule?J:{default:J}}var E=function(ee,Q){return(0,S.default)(B.ALGORITHM.getAdjMatrix).apply(void 0,[ee,Q])};x.getAdjMatrixAsync=E;var I=function(ee,Q){return(0,S.default)(B.ALGORITHM.connectedComponent).apply(void 0,[ee,Q])};x.connectedComponentAsync=I;var A=function(ee){return(0,S.default)(B.ALGORITHM.getDegree)(ee)};x.getDegreeAsync=A;var v=function(ee,Q){return(0,S.default)(B.ALGORITHM.getInDegree)(ee,Q)};x.getInDegreeAsync=v;var p=function(ee,Q){return(0,S.default)(B.ALGORITHM.getOutDegree)(ee,Q)};x.getOutDegreeAsync=p;var c=function(ee){return(0,S.default)(B.ALGORITHM.detectCycle)(ee)};x.detectCycleAsync=c;var f=function(ee){return(0,S.default)(B.ALGORITHM.detectAllCycles)(ee)};x.detectAllCyclesAsync=f;var l=function(ee){return(0,S.default)(B.ALGORITHM.detectAllDirectedCycle)(ee)};x.detectAllDirectedCycleAsync=l;var T=function(ee){return(0,S.default)(B.ALGORITHM.detectAllUndirectedCycle)(ee)};x.detectAllUndirectedCycleAsync=T;var m=function(ee,Q,re,fe){return(0,S.default)(B.ALGORITHM.dijkstra).apply(void 0,[ee,Q,re,fe])};x.dijkstraAsync=m;var w=function(ee,Q,re,fe){return(0,S.default)(B.ALGORITHM.findAllPath).apply(void 0,[ee,Q,re,fe])};x.findAllPathAsync=w;var O=function(ee,Q,re,fe,me){return(0,S.default)(B.ALGORITHM.findShortestPath).apply(void 0,[ee,Q,re,fe,me])};x.findShortestPathAsync=O;var D=function(ee,Q){return(0,S.default)(B.ALGORITHM.floydWarshall).apply(void 0,[ee,Q])};x.floydWarshallAsync=D;var g=function(ee,Q,re,fe){return fe===void 0&&(fe=1e3),(0,S.default)(B.ALGORITHM.labelPropagation)(ee,Q,re,fe)};x.labelPropagationAsync=g;var _=function(ee,Q,re,fe){return(0,S.default)(B.ALGORITHM.louvain)(ee,Q,re,fe)};x.louvainAsync=_;var Y=function(ee,Q,re){return(0,S.default)(B.ALGORITHM.minimumSpanningTree).apply(void 0,[ee,Q,re])};x.minimumSpanningTreeAsync=Y;var V=function(ee,Q,re){return(0,S.default)(B.ALGORITHM.pageRank).apply(void 0,[ee,Q,re])};x.pageRankAsync=V;var z=function(ee,Q,re){return(0,S.default)(B.ALGORITHM.getNeighbors).apply(void 0,[ee,Q,re])};x.getNeighborsAsync=z;var Z=function(ee,Q,re,fe,me,ae,Ee){return re===void 0&&(re=!1),ae===void 0&&(ae="cluster"),Ee===void 0&&(Ee="cluster"),(0,S.default)(B.ALGORITHM.GADDI).apply(void 0,[ee,Q,re,fe,me,ae,Ee])};x.GADDIAsync=Z},12067:function(dt,x,M){"use strict";function S(p){return S=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(c){return typeof c}:function(c){return c&&typeof Symbol=="function"&&c.constructor===Symbol&&c!==Symbol.prototype?"symbol":typeof c},S(p)}Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var B=I(M(31656)),N=M(66044);function E(p){if(typeof WeakMap!="function")return null;var c=new WeakMap,f=new WeakMap;return(E=function(T){return T?f:c})(p)}function I(p,c){if(!c&&p&&p.__esModule)return p;if(p===null||S(p)!=="object"&&typeof p!="function")return{default:p};var f=E(c);if(f&&f.has(p))return f.get(p);var l={},T=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var m in p)if(m!=="default"&&Object.prototype.hasOwnProperty.call(p,m)){var w=T?Object.getOwnPropertyDescriptor(p,m):null;w&&(w.get||w.set)?Object.defineProperty(l,m,w):l[m]=p[m]}return l.default=p,f&&f.set(p,l),l}var A=typeof self!="undefined"?self:{};A.onmessage=function(p){var c=p.data,f=c._algorithmType,l=c.data;if(!!f){if(typeof B[f]=="function"){var T=B[f].apply(B,l);A.postMessage({_algorithmType:N.MESSAGE.SUCCESS,data:T});return}A.postMessage({_algorithmType:N.MESSAGE.FAILURE})}};var v=null;x.default=v},20499:function(){},64851:function(){},59518:function(){},26199:function(){},14156:function(){},71468:function(){},48871:function(){},9871:function(){},25612:function(){},92777:function(){},20159:function(){},61622:function(){},75866:function(dt,x,M){"use strict";M.r(x),M.d(x,{Camera:function(){return Yc},Geometry:function(){return cs},Kernel:function(){return ha},Material:function(){return Xs},Renderable:function(){return Xo},World:function(){return vv}});function S(b,q,L,X){!L||Object.defineProperty(b,q,{enumerable:L.enumerable,configurable:L.configurable,writable:L.writable,value:L.initializer?L.initializer.call(X):void 0})}var B=M(6610),N=M(5991);function E(b,q,L,X,K){var ve={};return Object.keys(X).forEach(function(Ce){ve[Ce]=X[Ce]}),ve.enumerable=!!ve.enumerable,ve.configurable=!!ve.configurable,("value"in ve||ve.initializer)&&(ve.writable=!0),ve=L.slice().reverse().reduce(function(Ce,Ue){return Ue(b,q,Ce)||Ce},ve),K&&ve.initializer!==void 0&&(ve.value=ve.initializer?ve.initializer.call(K):void 0,ve.initializer=void 0),ve.initializer===void 0&&(Object.defineProperty(b,q,ve),ve=null),ve}var I=M(28660),A=M(87757),v=M.n(A),p=M(92137),c=-1,f=1;function l(){return f++}var T=function b(q){(0,B.Z)(this,b)},m=function(){function b(q){(0,B.Z)(this,b),this.clazz=void 0,this.components=[],this.entities=[],this.lookup={},this.clazz=q}return(0,N.Z)(b,[{key:"clear",value:function(){this.components=[],this.entities=[],this.lookup={}}},{key:"contains",value:function(L){return this.lookup[L]>-1}},{key:"create",value:function(L,X){this.lookup[L]=this.components.length;var K=new this.clazz(X||{});return this.components.push(K),this.entities.push(L),K}},{key:"remove",value:function(L){var X=this.lookup[L];X>-1&&X<this.components.length-1&&(this.components[X]=this.components[this.components.length-1],this.entities[X]=this.entities[this.entities.length-1],this.lookup[this.entities[X]]=X),this.components.pop(),this.entities.pop(),delete this.lookup[L]}},{key:"removeKeepSorted",value:function(L){var X=this.lookup[L];if(X>-1){var K=this.entities[X];if(X<this.components.length-1){for(var ve=X+1;ve<this.components.length;++ve)this.components[ve-1]=this.components[ve];for(var Ce=X+1;Ce<this.entities.length;++Ce)this.entities[Ce-1]=this.entities[Ce],this.lookup[this.entities[Ce-1]]=Ce-1}this.components.pop(),this.entities.pop(),delete this.lookup[K]}}},{key:"moveItem",value:function(L,X){if(L!==X){for(var K=this.components[L],ve=this.entities[L],Ce=L<X?1:-1,Ue=L;Ue!==X;Ue+=Ce){var nt=Ue+Ce;this.components[Ue]=this.components[nt],this.entities[Ue]=this.entities[nt],this.lookup[this.entities[Ue]]=Ue}this.components[X]=K,this.entities[X]=ve,this.lookup[ve]=X}}},{key:"getEntity",value:function(L){return this.entities[L]}},{key:"getComponent",value:function(L){return this.components[L]}},{key:"getComponentByEntity",value:function(L){var X=this.lookup[L];return X>-1?this.components[X]:null}},{key:"getCount",value:function(){return this.components.length}},{key:"getEntityByComponentIndex",value:function(L){for(var X=0,K=Object.keys(this.lookup);X<K.length;X++){var ve=K[X],Ce=Number(ve);if(this.lookup[Ce]===L)return Ce}return c}},{key:"find",value:function(L){for(var X=0;X<this.getCount();X++){var K=this.getComponent(X);if(L(K,X))return K}return null}},{key:"findIndex",value:function(L){for(var X=0;X<this.getCount();X++){var K=this.getComponent(X);if(L(K,X))return X}return-1}},{key:"forEach",value:function(L){for(var X=0,K=Object.keys(this.lookup);X<K.length;X++){var ve=K[X],Ce=Number(ve),Ue=this.lookup[Ce];L(Ce,this.getComponent(Ue))}}},{key:"forEachAsync",value:function(){var q=(0,p.Z)(v().mark(function X(K){var ve,Ce,Ue,nt,vt;return v().wrap(function(rr){for(;;)switch(rr.prev=rr.next){case 0:ve=0,Ce=Object.keys(this.lookup);case 1:if(!(ve<Ce.length)){rr.next=10;break}return Ue=Ce[ve],nt=Number(Ue),vt=this.lookup[nt],rr.next=7,K(nt,this.getComponent(vt));case 7:ve++,rr.next=1;break;case 10:case"end":return rr.stop()}},X,this)}));function L(X){return q.apply(this,arguments)}return L}()},{key:"map",value:function(L){for(var X=[],K=0,ve=Object.keys(this.lookup);K<ve.length;K++){var Ce=ve[K],Ue=Number(Ce),nt=this.lookup[Ue];X.push(L(Ue,this.getComponent(nt)))}return X}}]),b}(),w=M(28481),O=M(86700),D={HierarchyComponentManager:Symbol("HierarchyComponentManager"),TransformComponentManager:Symbol("TransformComponentManager"),NameComponentManager:Symbol("NameComponentManager"),SceneGraphSystem:Symbol("SceneGraphSystem"),FrameGraphSystem:Symbol("FrameGraphSystem"),ResourcePool:Symbol("ResourcePool"),ResourceHandleComponentManager:Symbol("ResourceHandleComponentManager"),PassNodeComponentManager:Symbol("PassNodeComponentManager"),RendererSystem:Symbol("RendererSystem"),RenderPass:Symbol("RenderPass"),RenderPassFactory:Symbol("Factory<IRenderPass>"),Renderable:Symbol("Factory<IRenderPass>"),MeshSystem:Symbol("MeshSystem"),MeshComponentManager:Symbol("MeshComponentManager"),CullableComponentManager:Symbol("CullableComponentManager"),Geometry:Symbol("Geometry"),GeometrySystem:Symbol("GeometrySystem"),GeometryComponentManager:Symbol("GeometryComponentManager"),Material:Symbol("Material"),MaterialSystem:Symbol("MaterialSystem"),MaterialComponentManager:Symbol("MaterialComponentManager"),ForwardRenderPath:Symbol("ForwardRenderPath"),ComputeSystem:Symbol("ComputeSystem"),ComputeComponentManager:Symbol("ComputeComponentManager"),ComputeStrategy:Symbol("ComputeStrategy"),Systems:Symbol("Systems"),World:Symbol("World"),RenderEngine:Symbol("RenderEngine"),WebGPUEngine:Symbol("WebGPUEngine"),WebGLEngine:Symbol("WebGLEngine"),ShaderModuleService:Symbol("ShaderModuleService"),ConfigService:Symbol("ConfigService"),InteractorService:Symbol("InteractorService"),IEventEmitter:Symbol("IEventEmitter"),Light:Symbol("Light")},g=function b(){(0,B.Z)(this,b),this.index=void 0},_=function b(){(0,B.Z)(this,b),this.name=void 0,this.data=void 0,this.execute=void 0,this.tearDown=void 0},Y=function(){function b(){(0,B.Z)(this,b),this.name=void 0,this.refCount=0,this.hasSideEffect=!1,this.devirtualize=[],this.destroy=[],this.reads=[],this.writes=[]}return(0,N.Z)(b,[{key:"read",value:function(L){return this.reads.find(function(X){return X.index===L.index})||this.reads.push(L),L}},{key:"sample",value:function(L){return this.read(L),L}},{key:"write",value:function(L,X){var K=this.writes.find(function(nt){return nt.index===X.index});if(K)return X;var ve=L.getResourceNode(X);ve.resource.version++,ve.resource.imported&&(this.hasSideEffect=!0);var Ce=L.createResourceNode(ve.resource),Ue=L.getResourceNode(Ce);return Ue.writer=this,this.writes.push(Ce),Ce}}]),b}(),V=M(10379),z=M(46070),Z=M(77608),J=function b(){(0,B.Z)(this,b),this.first=void 0,this.last=void 0};function ee(b){var q=Q();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function Q(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var re=function(b){(0,V.Z)(L,b);var q=ee(L);function L(){var X;(0,B.Z)(this,L);for(var K=arguments.length,ve=new Array(K),Ce=0;Ce<K;Ce++)ve[Ce]=arguments[Ce];return X=q.call.apply(q,[this].concat(ve)),X.version=0,X.refs=0,X.name=void 0,X.imported=void 0,X.priority=void 0,X.discardStart=!0,X.discardEnd=!1,X.descriptor=void 0,X.resource=void 0,X}return(0,N.Z)(L,[{key:"preExecuteDestroy",value:function(){this.discardEnd=!0}},{key:"postExecuteDestroy",value:function(){!this.imported}},{key:"postExecuteDevirtualize",value:function(){this.discardStart=!1}},{key:"preExecuteDevirtualize",value:function(){!this.imported}}]),L}(J),fe=function b(){(0,B.Z)(this,b),this.resource=void 0,this.writer=void 0,this.readerCount=0,this.version=void 0},me,ae,Ee,Le,De,Ve;function et(b,q){var L;if(typeof Symbol=="undefined"||b[Symbol.iterator]==null){if(Array.isArray(b)||(L=It(b))||q&&b&&typeof b.length=="number"){L&&(b=L);var X=0,K=function(){};return{s:K,n:function(){return X>=b.length?{done:!0}:{done:!1,value:b[X++]}},e:function(vt){throw vt},f:K}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
  225. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ve=!0,Ce=!1,Ue;return{s:function(){L=b[Symbol.iterator]()},n:function(){var vt=L.next();return ve=vt.done,vt},e:function(vt){Ce=!0,Ue=vt},f:function(){try{!ve&&L.return!=null&&L.return()}finally{if(Ce)throw Ue}}}}function It(b,q){if(!!b){if(typeof b=="string")return er(b,q);var L=Object.prototype.toString.call(b).slice(8,-1);if(L==="Object"&&b.constructor&&(L=b.constructor.name),L==="Map"||L==="Set")return Array.from(b);if(L==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L))return er(b,q)}}function er(b,q){(q==null||q>b.length)&&(q=b.length);for(var L=0,X=new Array(q);L<q;L++)X[L]=b[L];return X}var nr=(me=(0,O.b2)(),ae=(0,O.f3)(D.RenderEngine),me(Ee=(Le=(Ve=function(){function b(){(0,B.Z)(this,b),this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[],S(this,"engine",De,this)}return(0,N.Z)(b,[{key:"execute",value:function(){var q=(0,p.Z)(v().mark(function X(K){return v().wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:return this.compile(),Ce.next=3,this.executePassNodes(K);case 3:case"end":return Ce.stop()}},X,this)}));function L(X){return q.apply(this,arguments)}return L}()},{key:"tearDown",value:function(){this.frameGraphPasses.forEach(function(L){L.tearDown&&L.tearDown()}),this.reset()}},{key:"addPass",value:function(L,X,K,ve){var Ce=new _;Ce.execute=K,ve&&(Ce.tearDown=ve),Ce.name=L;var Ue=new Y;return Ue.name=L,this.passNodes.push(Ue),this.frameGraphPasses.push(Ce),X(this,Ue,Ce),Ce}},{key:"getPass",value:function(L){return this.frameGraphPasses.find(function(X){return X.name===L})}},{key:"compile",value:function(){var L=this,X=et(this.passNodes),K;try{for(X.s();!(K=X.n()).done;){var ve=K.value;ve.refCount=ve.writes.length+(ve.hasSideEffect?1:0),ve.reads.forEach(function(ea){L.resourceNodes[ea.index].readerCount++})}}catch(ea){X.e(ea)}finally{X.f()}var Ce=[],Ue=et(this.resourceNodes),nt;try{for(Ue.s();!(nt=Ue.n()).done;){var vt=nt.value;vt.readerCount===0&&Ce.push(vt)}}catch(ea){Ue.e(ea)}finally{Ue.f()}for(;Ce.length;){var _t=Ce.pop(),rr=_t&&_t.writer;if(rr&&--rr.refCount==0){var Mr=et(rr.reads),Rr;try{for(Mr.s();!(Rr=Mr.n()).done;){var Cr=Rr.value,Dr=this.resourceNodes[Cr.index];--Dr.readerCount==0&&Ce.push(Dr)}}catch(ea){Mr.e(ea)}finally{Mr.f()}}}this.resourceNodes.forEach(function(ea){ea.resource.refs+=ea.readerCount});var an=et(this.passNodes),_n;try{for(an.s();!(_n=an.n()).done;){var An=_n.value;if(!!An.refCount){var vn=et(An.reads),ei;try{for(vn.s();!(ei=vn.n()).done;){var Gn=ei.value,mi=this.resourceNodes[Gn.index].resource;mi.first=mi.first?mi.first:An,mi.last=An}}catch(ea){vn.e(ea)}finally{vn.f()}var si=et(An.writes),ni;try{for(si.s();!(ni=si.n()).done;){var oa=ni.value,Ma=this.resourceNodes[oa.index].resource;Ma.first=Ma.first?Ma.first:An,Ma.last=An}}catch(ea){si.e(ea)}finally{si.f()}}}}catch(ea){an.e(ea)}finally{an.f()}for(var Na=0;Na<2;Na++){var $i=et(this.resourceNodes),Ca;try{for($i.s();!(Ca=$i.n()).done;){var sa=Ca.value,Ls=sa.resource;if(Ls.priority===Na&&Ls.refs){var Ac=Ls.first,df=Ls.last;Ac&&df&&(Ac.devirtualize.push(Ls),df.destroy.push(Ls))}}}catch(ea){$i.e(ea)}finally{$i.f()}}}},{key:"executePassNodes",value:function(){var q=(0,p.Z)(v().mark(function X(K){var ve,Ce,Ue,nt,vt,_t,rr,Mr,Rr,Cr,Dr,an,_n,An,vn,ei,Gn;return v().wrap(function(si){for(;;)switch(si.prev=si.next){case 0:ve=et(this.passNodes.entries()),si.prev=1,ve.s();case 3:if((Ce=ve.n()).done){si.next=18;break}if(Ue=(0,w.Z)(Ce.value,2),nt=Ue[0],vt=Ue[1],!vt.refCount){si.next=16;break}_t=et(vt.devirtualize);try{for(_t.s();!(rr=_t.n()).done;)Mr=rr.value,Mr.preExecuteDevirtualize(this.engine)}catch(ni){_t.e(ni)}finally{_t.f()}Rr=et(vt.destroy);try{for(Rr.s();!(Cr=Rr.n()).done;)Dr=Cr.value,Dr.preExecuteDestroy(this.engine)}catch(ni){Rr.e(ni)}finally{Rr.f()}return si.next=12,this.frameGraphPasses[nt].execute(this,this.frameGraphPasses[nt],K);case 12:an=et(vt.devirtualize);try{for(an.s();!(_n=an.n()).done;)An=_n.value,An.postExecuteDevirtualize(this.engine)}catch(ni){an.e(ni)}finally{an.f()}vn=et(vt.destroy);try{for(vn.s();!(ei=vn.n()).done;)Gn=ei.value,Gn.postExecuteDestroy(this.engine)}catch(ni){vn.e(ni)}finally{vn.f()}case 16:si.next=3;break;case 18:si.next=23;break;case 20:si.prev=20,si.t0=si.catch(1),ve.e(si.t0);case 23:return si.prev=23,ve.f(),si.finish(23);case 26:this.reset();case 27:case"end":return si.stop()}},X,this,[[1,20,23,26]])}));function L(X){return q.apply(this,arguments)}return L}()},{key:"reset",value:function(){this.passNodes=[],this.resourceNodes=[],this.frameGraphPasses=[]}},{key:"getResourceNode",value:function(L){return this.resourceNodes[L.index]}},{key:"createResourceNode",value:function(L){var X=new fe;X.resource=L,X.version=L.version,this.resourceNodes.push(X);var K=new g;return K.index=this.resourceNodes.length-1,K}},{key:"createTexture",value:function(L,X,K){var ve=new re;return ve.name=X,ve.descriptor=K,this.createResourceNode(ve)}},{key:"createRenderTarget",value:function(L,X,K){var ve=new re;return ve.name=X,ve.descriptor=K,this.createResourceNode(ve)}},{key:"present",value:function(L){this.addPass("Present",function(X,K){K.read(L),K.hasSideEffect=!0},(0,p.Z)(v().mark(function X(){return v().wrap(function(ve){for(;;)switch(ve.prev=ve.next){case 0:case"end":return ve.stop()}},X)})))}}]),b}(),Ve),De=E(Le.prototype,"engine",[ae],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Le))||Ee),Fe=M(96156),Vt=M(63349),$t=M(98333),Ar=M(35600),ke=M(77160),Oe=M(90484),we=9007199254740991,Be="[object Arguments]",We="[object Array]",He="[object Boolean]",St="[object Date]",Mt="[object Error]",sr="[object Function]",Ge="[object Map]",ut="[object Number]",U="[object Object]",he="[object RegExp]",Qe="[object Set]",le="[object String]",ct="[object WeakMap]",ft="[object ArrayBuffer]",jt="[object DataView]",Lt="[object Float32Array]",Ht="[object Float64Array]",vr="[object Int8Array]",rt="[object Int16Array]",at="[object Int32Array]",Pt="[object Uint8Array]",gt="[object Uint8ClampedArray]",Dt="[object Uint16Array]",ir="[object Uint32Array]",At={};At[Lt]=At[Ht]=At[vr]=At[rt]=At[at]=At[Pt]=At[gt]=At[Dt]=At[ir]=!0,At[Be]=At[We]=At[ft]=At[He]=At[jt]=At[St]=At[Mt]=At[sr]=At[Ge]=At[ut]=At[U]=At[he]=At[Qe]=At[le]=At[ct]=!1;function xr(b){return function(q){return b(q)}}var Pr=Object.prototype,Qr=Pr.toString;function Vr(b){return dn(b)&&nn(b.length)&&!!At[Qr.call(b)]}function nn(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=we}function dn(b){return!!b&&(0,Oe.Z)(b)==="object"}var Vn=Vr;function cn(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function wn(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?cn(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):cn(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}function xn(b){var q=gn();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function gn(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var Un=function(b){(0,V.Z)(L,b);var q=xn(L);function L(X){var K;return(0,B.Z)(this,L),K=q.call(this,X),K.dirty=!0,K.attributes=[],K.indices=void 0,K.indicesBuffer=void 0,K.vertexCount=0,K.maxInstancedCount=void 0,K.aabb=void 0,K.entity=void 0,Object.assign((0,Vt.Z)(K),X),K}return(0,N.Z)(L,[{key:"setAttribute",value:function(K,ve,Ce,Ue){var nt=this.attributes.find(function(vt){return vt.name===K});return nt?(nt.data=ve,nt.dirty=!0):this.attributes.push(wn(wn({dirty:!0,name:K,data:ve},Ce),{},{bufferGetter:Ue})),this.dirty=!0,this}},{key:"setIndex",value:function(K){return this.indices=new Uint32Array(K.buffer?K.buffer:K),this.dirty=!0,this}},{key:"applyMatrix",value:function(K){var ve=this.attributes.find(function(Mr){var Rr=Mr.name;return Rr==="position"}),Ce=this.attributes.find(function(Mr){var Rr=Mr.name;return Rr==="normal"});if(ve&&(ve.dirty=!0,ve.data&&ve.data.length))for(var Ue=0;Ue<ve.data.length;Ue+=3){var nt=$t.fromValues(ve.data[Ue],ve.data[Ue+1],ve.data[Ue+2],1);$t.transformMat4(nt,nt,K),Vn(ve.data)?ve.data.set([nt[0],nt[1],nt[2]],Ue):(ve.data[Ue]=nt[0],ve.data[Ue+1]=nt[1],ve.data[Ue+2]=nt[2])}if(Ce){var vt=Ar.normalFromMat4(Ar.create(),K);if(Ce.data&&Ce.data.length)for(var _t=0;_t<Ce.data.length;_t+=3){var rr=ke.fromValues(Ce.data[_t],Ce.data[_t+1],Ce.data[_t+2]);ke.transformMat3(rr,rr,vt),ke.normalize(rr,rr),Vn(Ce.data)?Ce.data.set([rr[0],rr[1],rr[2]],_t):(Ce.data[_t]=rr[0],Ce.data[_t+1]=rr[1],Ce.data[_t+2]=rr[2])}}}}]),L}(T),bt;(function(b){b[b.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",b[b.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",b[b.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",b[b.POINTS=0]="POINTS",b[b.LINES=1]="LINES",b[b.LINE_LOOP=2]="LINE_LOOP",b[b.LINE_STRIP=3]="LINE_STRIP",b[b.TRIANGLES=4]="TRIANGLES",b[b.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",b[b.TRIANGLE_FAN=6]="TRIANGLE_FAN",b[b.ZERO=0]="ZERO",b[b.ONE=1]="ONE",b[b.SRC_COLOR=768]="SRC_COLOR",b[b.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",b[b.SRC_ALPHA=770]="SRC_ALPHA",b[b.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",b[b.DST_ALPHA=772]="DST_ALPHA",b[b.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",b[b.DST_COLOR=774]="DST_COLOR",b[b.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",b[b.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",b[b.FUNC_ADD=32774]="FUNC_ADD",b[b.BLEND_EQUATION=32777]="BLEND_EQUATION",b[b.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",b[b.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",b[b.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",b[b.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",b[b.MAX_EXT=32776]="MAX_EXT",b[b.MIN_EXT=32775]="MIN_EXT",b[b.BLEND_DST_RGB=32968]="BLEND_DST_RGB",b[b.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",b[b.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",b[b.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",b[b.CONSTANT_COLOR=32769]="CONSTANT_COLOR",b[b.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",b[b.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",b[b.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",b[b.BLEND_COLOR=32773]="BLEND_COLOR",b[b.ARRAY_BUFFER=34962]="ARRAY_BUFFER",b[b.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",b[b.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",b[b.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",b[b.STREAM_DRAW=35040]="STREAM_DRAW",b[b.STATIC_DRAW=35044]="STATIC_DRAW",b[b.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",b[b.BUFFER_SIZE=34660]="BUFFER_SIZE",b[b.BUFFER_USAGE=34661]="BUFFER_USAGE",b[b.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",b[b.FRONT=1028]="FRONT",b[b.BACK=1029]="BACK",b[b.FRONT_AND_BACK=1032]="FRONT_AND_BACK",b[b.CULL_FACE=2884]="CULL_FACE",b[b.BLEND=3042]="BLEND",b[b.DITHER=3024]="DITHER",b[b.STENCIL_TEST=2960]="STENCIL_TEST",b[b.DEPTH_TEST=2929]="DEPTH_TEST",b[b.SCISSOR_TEST=3089]="SCISSOR_TEST",b[b.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",b[b.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",b[b.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",b[b.NO_ERROR=0]="NO_ERROR",b[b.INVALID_ENUM=1280]="INVALID_ENUM",b[b.INVALID_VALUE=1281]="INVALID_VALUE",b[b.INVALID_OPERATION=1282]="INVALID_OPERATION",b[b.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",b[b.CW=2304]="CW",b[b.CCW=2305]="CCW",b[b.LINE_WIDTH=2849]="LINE_WIDTH",b[b.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",b[b.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",b[b.CULL_FACE_MODE=2885]="CULL_FACE_MODE",b[b.FRONT_FACE=2886]="FRONT_FACE",b[b.DEPTH_RANGE=2928]="DEPTH_RANGE",b[b.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",b[b.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",b[b.DEPTH_FUNC=2932]="DEPTH_FUNC",b[b.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",b[b.STENCIL_FUNC=2962]="STENCIL_FUNC",b[b.STENCIL_FAIL=2964]="STENCIL_FAIL",b[b.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",b[b.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",b[b.STENCIL_REF=2967]="STENCIL_REF",b[b.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",b[b.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",b[b.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",b[b.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",b[b.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",b[b.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",b[b.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",b[b.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",b[b.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",b[b.VIEWPORT=2978]="VIEWPORT",b[b.SCISSOR_BOX=3088]="SCISSOR_BOX",b[b.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",b[b.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",b[b.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",b[b.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",b[b.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",b[b.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",b[b.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",b[b.RED_BITS=3410]="RED_BITS",b[b.GREEN_BITS=3411]="GREEN_BITS",b[b.BLUE_BITS=3412]="BLUE_BITS",b[b.ALPHA_BITS=3413]="ALPHA_BITS",b[b.DEPTH_BITS=3414]="DEPTH_BITS",b[b.STENCIL_BITS=3415]="STENCIL_BITS",b[b.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",b[b.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",b[b.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",b[b.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",b[b.SAMPLES=32937]="SAMPLES",b[b.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",b[b.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",b[b.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",b[b.DONT_CARE=4352]="DONT_CARE",b[b.FASTEST=4353]="FASTEST",b[b.NICEST=4354]="NICEST",b[b.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",b[b.BYTE=5120]="BYTE",b[b.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",b[b.SHORT=5122]="SHORT",b[b.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",b[b.INT=5124]="INT",b[b.UNSIGNED_INT=5125]="UNSIGNED_INT",b[b.FLOAT=5126]="FLOAT",b[b.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",b[b.ALPHA=6406]="ALPHA",b[b.RGB=6407]="RGB",b[b.RGBA=6408]="RGBA",b[b.LUMINANCE=6409]="LUMINANCE",b[b.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",b[b.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",b[b.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",b[b.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",b[b.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",b[b.VERTEX_SHADER=35633]="VERTEX_SHADER",b[b.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",b[b.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",b[b.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",b[b.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",b[b.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",b[b.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",b[b.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",b[b.SHADER_TYPE=35663]="SHADER_TYPE",b[b.DELETE_STATUS=35712]="DELETE_STATUS",b[b.LINK_STATUS=35714]="LINK_STATUS",b[b.VALIDATE_STATUS=35715]="VALIDATE_STATUS",b[b.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",b[b.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",b[b.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",b[b.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",b[b.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",b[b.NEVER=512]="NEVER",b[b.LESS=513]="LESS",b[b.EQUAL=514]="EQUAL",b[b.LEQUAL=515]="LEQUAL",b[b.GREATER=516]="GREATER",b[b.NOTEQUAL=517]="NOTEQUAL",b[b.GEQUAL=518]="GEQUAL",b[b.ALWAYS=519]="ALWAYS",b[b.KEEP=7680]="KEEP",b[b.REPLACE=7681]="REPLACE",b[b.INCR=7682]="INCR",b[b.DECR=7683]="DECR",b[b.INVERT=5386]="INVERT",b[b.INCR_WRAP=34055]="INCR_WRAP",b[b.DECR_WRAP=34056]="DECR_WRAP",b[b.VENDOR=7936]="VENDOR",b[b.RENDERER=7937]="RENDERER",b[b.VERSION=7938]="VERSION",b[b.NEAREST=9728]="NEAREST",b[b.LINEAR=9729]="LINEAR",b[b.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",b[b.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",b[b.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",b[b.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",b[b.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",b[b.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",b[b.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",b[b.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",b[b.TEXTURE_2D=3553]="TEXTURE_2D",b[b.TEXTURE=5890]="TEXTURE",b[b.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",b[b.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",b[b.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",b[b.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",b[b.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",b[b.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",b[b.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",b[b.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",b[b.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",b[b.TEXTURE0=33984]="TEXTURE0",b[b.TEXTURE1=33985]="TEXTURE1",b[b.TEXTURE2=33986]="TEXTURE2",b[b.TEXTURE3=33987]="TEXTURE3",b[b.TEXTURE4=33988]="TEXTURE4",b[b.TEXTURE5=33989]="TEXTURE5",b[b.TEXTURE6=33990]="TEXTURE6",b[b.TEXTURE7=33991]="TEXTURE7",b[b.TEXTURE8=33992]="TEXTURE8",b[b.TEXTURE9=33993]="TEXTURE9",b[b.TEXTURE10=33994]="TEXTURE10",b[b.TEXTURE11=33995]="TEXTURE11",b[b.TEXTURE12=33996]="TEXTURE12",b[b.TEXTURE13=33997]="TEXTURE13",b[b.TEXTURE14=33998]="TEXTURE14",b[b.TEXTURE15=33999]="TEXTURE15",b[b.TEXTURE16=34e3]="TEXTURE16",b[b.TEXTURE17=34001]="TEXTURE17",b[b.TEXTURE18=34002]="TEXTURE18",b[b.TEXTURE19=34003]="TEXTURE19",b[b.TEXTURE20=34004]="TEXTURE20",b[b.TEXTURE21=34005]="TEXTURE21",b[b.TEXTURE22=34006]="TEXTURE22",b[b.TEXTURE23=34007]="TEXTURE23",b[b.TEXTURE24=34008]="TEXTURE24",b[b.TEXTURE25=34009]="TEXTURE25",b[b.TEXTURE26=34010]="TEXTURE26",b[b.TEXTURE27=34011]="TEXTURE27",b[b.TEXTURE28=34012]="TEXTURE28",b[b.TEXTURE29=34013]="TEXTURE29",b[b.TEXTURE30=34014]="TEXTURE30",b[b.TEXTURE31=34015]="TEXTURE31",b[b.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",b[b.REPEAT=10497]="REPEAT",b[b.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",b[b.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",b[b.FLOAT_VEC2=35664]="FLOAT_VEC2",b[b.FLOAT_VEC3=35665]="FLOAT_VEC3",b[b.FLOAT_VEC4=35666]="FLOAT_VEC4",b[b.INT_VEC2=35667]="INT_VEC2",b[b.INT_VEC3=35668]="INT_VEC3",b[b.INT_VEC4=35669]="INT_VEC4",b[b.BOOL=35670]="BOOL",b[b.BOOL_VEC2=35671]="BOOL_VEC2",b[b.BOOL_VEC3=35672]="BOOL_VEC3",b[b.BOOL_VEC4=35673]="BOOL_VEC4",b[b.FLOAT_MAT2=35674]="FLOAT_MAT2",b[b.FLOAT_MAT3=35675]="FLOAT_MAT3",b[b.FLOAT_MAT4=35676]="FLOAT_MAT4",b[b.SAMPLER_2D=35678]="SAMPLER_2D",b[b.SAMPLER_CUBE=35680]="SAMPLER_CUBE",b[b.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",b[b.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",b[b.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",b[b.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",b[b.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",b[b.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",b[b.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",b[b.COMPILE_STATUS=35713]="COMPILE_STATUS",b[b.LOW_FLOAT=36336]="LOW_FLOAT",b[b.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",b[b.HIGH_FLOAT=36338]="HIGH_FLOAT",b[b.LOW_INT=36339]="LOW_INT",b[b.MEDIUM_INT=36340]="MEDIUM_INT",b[b.HIGH_INT=36341]="HIGH_INT",b[b.FRAMEBUFFER=36160]="FRAMEBUFFER",b[b.RENDERBUFFER=36161]="RENDERBUFFER",b[b.RGBA4=32854]="RGBA4",b[b.RGB5_A1=32855]="RGB5_A1",b[b.RGB565=36194]="RGB565",b[b.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",b[b.STENCIL_INDEX=6401]="STENCIL_INDEX",b[b.STENCIL_INDEX8=36168]="STENCIL_INDEX8",b[b.DEPTH_STENCIL=34041]="DEPTH_STENCIL",b[b.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",b[b.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",b[b.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",b[b.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",b[b.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",b[b.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",b[b.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",b[b.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",b[b.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",b[b.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",b[b.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",b[b.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",b[b.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",b[b.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",b[b.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",b[b.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",b[b.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",b[b.NONE=0]="NONE",b[b.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",b[b.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",b[b.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",b[b.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",b[b.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",b[b.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",b[b.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",b[b.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",b[b.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",b[b.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",b[b.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",b[b.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",b[b.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",b[b.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",b[b.COPY_SRC=1]="COPY_SRC",b[b.COPY_DST=2]="COPY_DST",b[b.SAMPLED=4]="SAMPLED",b[b.STORAGE=8]="STORAGE",b[b.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"})(bt||(bt={}));var Mn,be,Se,j,R,k,te,Me,Ne=(Mn=(0,O.b2)(),be=(0,O.f3)(D.GeometryComponentManager),Se=(0,O.f3)(D.RenderEngine),Mn(j=(R=(Me=function(){function b(){(0,B.Z)(this,b),S(this,"geometry",k,this),S(this,"engine",te,this)}return(0,N.Z)(b,[{key:"execute",value:function(){var q=(0,p.Z)(v().mark(function X(){var K=this;return v().wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:this.geometry.forEach(function(Ue,nt){nt.dirty&&(nt.attributes.forEach(function(vt){if(vt.dirty&&vt.data){if(!vt.buffer)vt.buffer=K.engine.createBuffer({data:vt.data,type:bt.FLOAT});else{var _t;(_t=vt.buffer)===null||_t===void 0||_t.subData({data:vt.data,offset:0})}vt.dirty=!1}}),nt.indices&&(nt.indicesBuffer?nt.indicesBuffer.subData({data:nt.indices,offset:0}):nt.indicesBuffer=K.engine.createElements({data:nt.indices,count:nt.indices.length,type:bt.UNSIGNED_INT,usage:bt.STATIC_DRAW})),nt.dirty=!1)});case 1:case"end":return Ce.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"tearDown",value:function(){this.geometry.forEach(function(L,X){X.indicesBuffer&&X.indicesBuffer.destroy(),X.attributes.forEach(function(K){K.buffer&&K.buffer.destroy()})}),this.geometry.clear()}},{key:"createBufferGeometry",value:function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{vertexCount:3},X=L.vertexCount,K=l();return this.geometry.create(K,{vertexCount:X})}},{key:"createInstancedBufferGeometry",value:function(L){var X=L.maxInstancedCount,K=L.vertexCount,ve=l();return this.geometry.create(ve,{maxInstancedCount:X,vertexCount:K})}}]),b}(),Me),k=E(R.prototype,"geometry",[be],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),te=E(R.prototype,"engine",[Se],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),R))||j);function Pe(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function Ke(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?Pe(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):Pe(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}function Ut(b){var q=Rt();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function Rt(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var fr=function(b){(0,V.Z)(L,b);var q=Ut(L);function L(X){var K;return(0,B.Z)(this,L),K=q.call(this,X),K.vertexShaderGLSL=void 0,K.fragmentShaderGLSL=void 0,K.defines={},K.dirty=!0,K.uniforms=[],K.cull={enable:!0,face:bt.BACK},K.depth={enable:!0},K.blend=void 0,K.entity=void 0,K.type=void 0,Object.assign((0,Vt.Z)(K),X),K}return(0,N.Z)(L,[{key:"setDefines",value:function(K){return this.defines=Ke(Ke({},this.defines),K),this}},{key:"setCull",value:function(K){return this.cull=K,this}},{key:"setDepth",value:function(K){return this.depth=K,this}},{key:"setBlend",value:function(K){return this.blend=K,this}},{key:"setUniform",value:function(K,ve){var Ce=this;if(typeof K!="string")return Object.keys(K).forEach(function(nt){return Ce.setUniform(nt,K[nt])}),this;var Ue=this.uniforms.find(function(nt){return nt.name===K});return Ue?(Ue.dirty=!0,Ue.data=ve):this.uniforms.push({name:K,dirty:!0,data:ve}),this.dirty=!0,this}}]),L}(T),kr,ur,rn,On,ne,ye,Je,Ct,Nt,mr;function lr(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function dr(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?lr(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):lr(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}var yr=(kr=(0,O.b2)(),ur=(0,O.f3)(D.MaterialComponentManager),rn=(0,O.f3)(D.RenderEngine),On=(0,O.f3)(D.ShaderModuleService),kr(ne=(ye=(mr=function(){function b(){(0,B.Z)(this,b),S(this,"material",Je,this),S(this,"engine",Ct,this),S(this,"shaderModule",Nt,this)}return(0,N.Z)(b,[{key:"execute",value:function(){var q=(0,p.Z)(v().mark(function X(){return v().wrap(function(ve){for(;;)switch(ve.prev=ve.next){case 0:case"end":return ve.stop()}},X)}));function L(){return q.apply(this,arguments)}return L}()},{key:"tearDown",value:function(){this.material.clear()}},{key:"createShaderMaterial",value:function(L){var X=l(),K=L.vertexShader,ve=L.fragmentShader,Ce=[];if(!this.engine.supportWebGPU){var Ue="material-".concat(X);this.shaderModule.registerModule(Ue,{vs:L.vertexShader,fs:L.fragmentShader});var nt=this.shaderModule.getModule(Ue);K=nt.vs,ve=nt.fs,nt.uniforms&&(Ce=Object.keys(nt.uniforms).map(function(vt){return{dirty:!0,name:vt,data:nt.uniforms[vt]}}))}return this.material.create(X,dr(dr({vertexShaderGLSL:K,fragmentShaderGLSL:ve},L),{},{uniforms:Ce}))}}]),b}(),mr),Je=E(ye.prototype,"material",[ur],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ct=E(ye.prototype,"engine",[rn],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Nt=E(ye.prototype,"shaderModule",[On],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ye))||ne);function Gr(b){var q=Jr();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function Jr(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var Sr;(function(b){b[b.Standard=0]="Standard"})(Sr||(Sr={}));var lt=function(b){(0,V.Z)(L,b);var q=Gr(L);function L(X){var K;return(0,B.Z)(this,L),K=q.call(this,X),K.strategy=Sr.Standard,K.visibilityPlaneMask=0,K.visible=!1,Object.assign((0,Vt.Z)(K),X),K}return L}(T),Ae=function(){function b(q,L){(0,B.Z)(this,b),this.center=void 0,this.halfExtents=void 0,this.min=ke.create(),this.max=ke.create(),this.update(q,L)}return(0,N.Z)(b,[{key:"update",value:function(L,X){this.center=L||ke.create(),this.halfExtents=X||ke.fromValues(.5,.5,.5),this.min=ke.sub(this.min,this.center,this.halfExtents),this.max=ke.add(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(L,X){ke.add(this.center,X,L),ke.scale(this.center,this.center,.5),ke.sub(this.halfExtents,X,L),ke.scale(this.halfExtents,this.halfExtents,.5),ke.copy(this.min,L),ke.copy(this.max,X)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(L){var X=this.center,K=X[0],ve=X[1],Ce=X[2],Ue=this.halfExtents,nt=Ue[0],vt=Ue[1],_t=Ue[2],rr=K-nt,Mr=K+nt,Rr=ve-vt,Cr=ve+vt,Dr=Ce-_t,an=Ce+_t,_n=L.center,An=_n[0],vn=_n[1],ei=_n[2],Gn=L.halfExtents,mi=Gn[0],si=Gn[1],ni=Gn[2],oa=An-mi,Ma=An+mi,Na=vn-si,$i=vn+si,Ca=ei-ni,sa=ei+ni;oa<rr&&(rr=oa),Ma>Mr&&(Mr=Ma),Na<Rr&&(Rr=Na),$i>Cr&&(Cr=$i),Ca<Dr&&(Dr=Ca),sa>an&&(an=sa),X[0]=(rr+Mr)*.5,X[1]=(Rr+Cr)*.5,X[2]=(Dr+an)*.5,Ue[0]=(Mr-rr)*.5,Ue[1]=(Cr-Rr)*.5,Ue[2]=(an-Dr)*.5,this.min[0]=rr,this.min[1]=Rr,this.min[2]=Dr,this.max[0]=Mr,this.max[1]=Cr,this.max[2]=an}},{key:"intersects",value:function(L){var X=this.getMax(),K=this.getMin(),ve=L.getMax(),Ce=L.getMin();return K[0]<=ve[0]&&X[0]>=Ce[0]&&K[1]<=ve[1]&&X[1]>=Ce[1]&&K[2]<=ve[2]&&X[2]>=Ce[2]}},{key:"containsPoint",value:function(L){var X=this.getMin(),K=this.getMax();return!(L[0]<X[0]||L[0]>K[0]||L[1]<X[1]||L[1]>K[1]||L[2]<X[2]||L[2]>K[2])}},{key:"getNegativeFarPoint",value:function(L){return L.pnVertexFlag===273?ke.copy(ke.create(),this.min):L.pnVertexFlag===272?ke.fromValues(this.min[0],this.min[1],this.max[2]):L.pnVertexFlag===257?ke.fromValues(this.min[0],this.max[1],this.min[2]):L.pnVertexFlag===256?ke.fromValues(this.min[0],this.max[1],this.max[2]):L.pnVertexFlag===17?ke.fromValues(this.max[0],this.min[1],this.min[2]):L.pnVertexFlag===16?ke.fromValues(this.max[0],this.min[1],this.max[2]):L.pnVertexFlag===1?ke.fromValues(this.max[0],this.max[1],this.min[2]):ke.fromValues(this.max[0],this.max[1],this.max[2])}},{key:"getPositiveFarPoint",value:function(L){return L.pnVertexFlag===273?ke.copy(ke.create(),this.max):L.pnVertexFlag===272?ke.fromValues(this.max[0],this.max[1],this.min[2]):L.pnVertexFlag===257?ke.fromValues(this.max[0],this.min[1],this.max[2]):L.pnVertexFlag===256?ke.fromValues(this.max[0],this.min[1],this.min[2]):L.pnVertexFlag===17?ke.fromValues(this.min[0],this.max[1],this.max[2]):L.pnVertexFlag===16?ke.fromValues(this.min[0],this.max[1],this.min[2]):L.pnVertexFlag===1?ke.fromValues(this.min[0],this.min[1],this.max[2]):ke.fromValues(this.min[0],this.min[1],this.min[2])}}]),b}();function Ye(b){var q=Tt();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function Tt(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var pt=function(b){(0,V.Z)(L,b);var q=Ye(L);function L(X){var K;return(0,B.Z)(this,L),K=q.call(this,X),K.material=void 0,K.geometry=void 0,K.aabb=new Ae,K.aabbDirty=!0,K.model=void 0,K.visible=!0,K.children=[],Object.assign((0,Vt.Z)(K),X),K}return L}(T),kt=function(){function b(q,L){(0,B.Z)(this,b),this.distance=void 0,this.normal=void 0,this.pnVertexFlag=void 0,this.distance=q||0,this.normal=L||ke.fromValues(0,1,0),this.updatePNVertexFlag()}return(0,N.Z)(b,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(L){return ke.dot(L,this.normal)-this.distance}},{key:"normalize",value:function(){var L=1/ke.len(this.normal);ke.scale(this.normal,this.normal,L),this.distance*=L}},{key:"intersectsLine",value:function(L,X,K){var ve=this.distanceToPoint(L),Ce=this.distanceToPoint(X),Ue=ve/(ve-Ce),nt=Ue>=0&&Ue<=1;return nt&&K&&ke.lerp(K,L,X,Ue),nt}}]),b}(),ar;(function(b){b[b.OUTSIDE=4294967295]="OUTSIDE",b[b.INSIDE=0]="INSIDE",b[b.INDETERMINATE=2147483647]="INDETERMINATE"})(ar||(ar={}));var jr=function(){function b(q){if((0,B.Z)(this,b),this.planes=[],q)this.planes=q;else for(var L=0;L<6;L++)this.planes.push(new kt)}return(0,N.Z)(b,[{key:"extractFromVPMatrix",value:function(L){var X=(0,w.Z)(L,16),K=X[0],ve=X[1],Ce=X[2],Ue=X[3],nt=X[4],vt=X[5],_t=X[6],rr=X[7],Mr=X[8],Rr=X[9],Cr=X[10],Dr=X[11],an=X[12],_n=X[13],An=X[14],vn=X[15];ke.set(this.planes[0].normal,Ue-K,rr-nt,Dr-Mr),this.planes[0].distance=-(vn-an),ke.set(this.planes[1].normal,Ue+K,rr+nt,Dr+Mr),this.planes[1].distance=-(vn+an),ke.set(this.planes[2].normal,Ue+ve,rr+vt,Dr+Rr),this.planes[2].distance=-(vn+_n),ke.set(this.planes[3].normal,Ue-ve,rr-vt,Dr-Rr),this.planes[3].distance=-(vn-_n),ke.set(this.planes[4].normal,Ue-Ce,rr-_t,Dr-Cr),this.planes[4].distance=-(vn-An),ke.set(this.planes[5].normal,Ue+Ce,rr+_t,Dr+Cr),this.planes[5].distance=-(vn+An),this.planes.forEach(function(ei){ei.normalize(),ei.updatePNVertexFlag()})}}]),b}();function tn(b){return typeof b=="number"}function Ln(b){return b===void 0?0:b>360||b<-360?b%360:b}function Dn(b,q,L){return isNumber(b)?vec3.fromValues(b,q,L):b.length===3?vec3.clone(b):vec3.fromValues(b[0],b[1],b[2])}function $n(b,q){return q[0]=b[0],q[1]=b[1],q[2]=b[2],q[3]=b[4],q[4]=b[5],q[5]=b[6],q[6]=b[8],q[7]=b[9],q[8]=b[10],q}function ci(b){var q=(0,w.Z)(b,3),L=q[0],X=q[1],K=q[2],ve=L+X*256+K*65536-1;return ve}function Ii(b){return[b+1&255,b+1>>8&255,b+1>>8>>8&255]}var ki,zi,Hn,Mo,Ia,vi,Ya,no,Co,ho,Ea,gs,_u,_a;function $o(b,q){var L;if(typeof Symbol=="undefined"||b[Symbol.iterator]==null){if(Array.isArray(b)||(L=Ti(b))||q&&b&&typeof b.length=="number"){L&&(b=L);var X=0,K=function(){};return{s:K,n:function(){return X>=b.length?{done:!0}:{done:!1,value:b[X++]}},e:function(vt){throw vt},f:K}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
  226. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ve=!0,Ce=!1,Ue;return{s:function(){L=b[Symbol.iterator]()},n:function(){var vt=L.next();return ve=vt.done,vt},e:function(vt){Ce=!0,Ue=vt},f:function(){try{!ve&&L.return!=null&&L.return()}finally{if(Ce)throw Ue}}}}function Ti(b,q){if(!!b){if(typeof b=="string")return Qo(b,q);var L=Object.prototype.toString.call(b).slice(8,-1);if(L==="Object"&&b.constructor&&(L=b.constructor.name),L==="Map"||L==="Set")return Array.from(b);if(L==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L))return Qo(b,q)}}function Qo(b,q){(q==null||q>b.length)&&(q=b.length);for(var L=0,X=new Array(q);L<q;L++)X[L]=b[L];return X}var vo=(ki=(0,O.b2)(),zi=(0,O.f3)(D.MeshComponentManager),Hn=(0,O.f3)(D.CullableComponentManager),Mo=(0,O.f3)(D.GeometryComponentManager),Ia=(0,O.f3)(D.HierarchyComponentManager),vi=(0,O.f3)(D.TransformComponentManager),ki(Ya=(no=(_a=function(){function b(){(0,B.Z)(this,b),S(this,"mesh",Co,this),S(this,"cullable",ho,this),S(this,"geometry",Ea,this),S(this,"hierarchy",gs,this),S(this,"transform",_u,this),this.planes=void 0}return(0,N.Z)(b,[{key:"setFrustumPlanes",value:function(L){this.planes=L}},{key:"execute",value:function(){var q=(0,p.Z)(v().mark(function X(K){var ve,Ce,Ue,nt,vt,_t,rr,Mr,Rr,Cr,Dr,an,_n,An,vn,ei,Gn,mi,si,ni,oa;return v().wrap(function(Na){for(;;)switch(Na.prev=Na.next){case 0:ve=$o(K);try{for(ve.s();!(Ce=ve.n()).done;){Ue=Ce.value,nt=Ue.getScene(),vt=Ue.getCamera(),_t=$o(nt.getEntities());try{for(_t.s();!(rr=_t.n()).done;)Mr=rr.value,Rr=this.mesh.getComponentByEntity(Mr),Rr&&(Cr=this.hierarchy.getComponentByEntity(Mr),Dr=this.cullable.getComponentByEntity(Mr),an=Rr.geometry,_n=this.transform.getComponentByEntity(Mr),an&&an.aabb&&_n&&Rr.aabbDirty&&(An=_n.worldTransform,vn=an.aabb,ei=vn.center,Gn=vn.halfExtents,mi=ke.transformMat4(ke.create(),ei,An),si=$n(An,Ar.create()),ni=ke.transformMat3(ke.create(),Gn,si),Rr.aabb.update(mi,ni),Rr.aabbDirty=!1),Dr&&an&&(oa=this.cullable.getComponentByEntity((Cr==null?void 0:Cr.parentID)||-1),Dr.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(Rr.aabb,(oa==null?void 0:oa.visibilityPlaneMask)||ar.INDETERMINATE,this.planes||vt.getFrustum().planes),Dr.visible=Dr.visibilityPlaneMask!==ar.OUTSIDE))}catch($i){_t.e($i)}finally{_t.f()}}}catch($i){ve.e($i)}finally{ve.f()}case 2:case"end":return Na.stop()}},X,this)}));function L(X){return q.apply(this,arguments)}return L}()},{key:"tearDown",value:function(){this.cullable.clear(),this.mesh.clear()}},{key:"computeVisibilityWithPlaneMask",value:function(L,X,K){if(X===ar.OUTSIDE||X===ar.INSIDE)return X;for(var ve=ar.INSIDE,Ce=0,Ue=K.length;Ce<Ue;++Ce){var nt=Ce<31?1<<Ce:0;if(!(Ce<31&&(X&nt)==0)){var vt=K[Ce],_t=vt.normal,rr=vt.distance;if(ke.dot(_t,L.getNegativeFarPoint(K[Ce]))+rr>0)return ar.OUTSIDE;ke.dot(_t,L.getPositiveFarPoint(K[Ce]))+rr>0&&(ve|=nt)}}return ve}}]),b}(),_a),Co=E(no.prototype,"mesh",[zi],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ho=E(no.prototype,"cullable",[Hn],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ea=E(no.prototype,"geometry",[Mo],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),gs=E(no.prototype,"hierarchy",[Ia],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_u=E(no.prototype,"transform",[vi],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),no))||Ya),In=M(85975),Bs,ru,ys,Nn,Do,Qu,ua,Jo,Gs,Za,ms,bs,xa,Pa,qo,eo,es,ts,nu,To,Es,pi,Fs,iu;function Ha(b,q){var L;if(typeof Symbol=="undefined"||b[Symbol.iterator]==null){if(Array.isArray(b)||(L=au(b))||q&&b&&typeof b.length=="number"){L&&(b=L);var X=0,K=function(){};return{s:K,n:function(){return X>=b.length?{done:!0}:{done:!1,value:b[X++]}},e:function(vt){throw vt},f:K}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
  227. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ve=!0,Ce=!1,Ue;return{s:function(){L=b[Symbol.iterator]()},n:function(){var vt=L.next();return ve=vt.done,vt},e:function(vt){Ce=!0,Ue=vt},f:function(){try{!ve&&L.return!=null&&L.return()}finally{if(Ce)throw Ue}}}}function au(b,q){if(!!b){if(typeof b=="string")return po(b,q);var L=Object.prototype.toString.call(b).slice(8,-1);if(L==="Object"&&b.constructor&&(L=b.constructor.name),L==="Map"||L==="Set")return Array.from(b);if(L==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L))return po(b,q)}}function po(b,q){(q==null||q>b.length)&&(q=b.length);for(var L=0,X=new Array(q);L<q;L++)X[L]=b[L];return X}var ca=(Bs=(0,O.b2)(),ru=(0,O.f3)(D.MeshComponentManager),ys=(0,O.f3)(D.GeometryComponentManager),Nn=(0,O.f3)(D.MaterialComponentManager),Do=(0,O.f3)(D.CullableComponentManager),Qu=(0,O.f3)(D.TransformComponentManager),ua=(0,O.f3)(D.HierarchyComponentManager),Jo=(0,O.f3)(D.Systems),Gs=(0,O.t6)(D.FrameGraphSystem),Za=(0,O.f3)(D.RenderEngine),ms=(0,O.f3)(D.ResourcePool),Bs(bs=(xa=(iu=Fs=function(){function b(){var q=this;(0,B.Z)(this,b),S(this,"mesh",Pa,this),S(this,"geometry",qo,this),S(this,"material",eo,this),S(this,"cullable",es,this),S(this,"transform",ts,this),S(this,"hierarchy",nu,this),S(this,"frameGraphSystem",To,this),S(this,"engine",Es,this),S(this,"resourcePool",pi,this),this.modelCache={},this.setup=function(L,X,K){var ve=L.createRenderTarget(X,"color buffer",{width:1,height:1,usage:bt.RENDER_ATTACHMENT|bt.SAMPLED|bt.COPY_SRC});K.data={output:X.write(L,ve)}},this.execute=function(){var L=(0,p.Z)(v().mark(function X(K,ve,Ce){var Ue,nt,vt,_t,rr,Mr;return v().wrap(function(Cr){for(;;)switch(Cr.prev=Cr.next){case 0:Ue=K.getResourceNode(ve.data.output),nt=q.resourcePool.getOrCreateResource(Ue.resource),vt=Ha(Ce),Cr.prev=3,vt.s();case 5:if((_t=vt.n()).done){Cr.next=11;break}return rr=_t.value,Cr.next=9,q.initView(rr);case 9:Cr.next=5;break;case 11:Cr.next=16;break;case 13:Cr.prev=13,Cr.t0=Cr.catch(3),vt.e(Cr.t0);case 16:return Cr.prev=16,vt.f(),Cr.finish(16);case 19:Mr=q.engine.getCanvas(),nt.resize({width:Mr.width,height:Mr.height}),q.engine.setScissor({enable:!1}),q.engine.clear({framebuffer:nt,color:Ce[0].getClearColor(),depth:1}),q.engine.useFramebuffer(nt,function(){var Dr=Ha(Ce),an;try{for(Dr.s();!(an=Dr.n()).done;){var _n=an.value;q.renderView(_n)}}catch(An){Dr.e(An)}finally{Dr.f()}});case 24:case"end":return Cr.stop()}},X,null,[[3,13,16,19]])}));return function(X,K,ve){return L.apply(this,arguments)}}()}return(0,N.Z)(b,[{key:"renderView",value:function(L){var X=L.getScene(),K=L.getCamera(),ve=K.getViewTransform(),Ce=In.multiply(In.create(),K.getPerspective(),ve);K.getFrustum().extractFromVPMatrix(Ce);var Ue=L.getViewport(),nt=Ue.x,vt=Ue.y,_t=Ue.width,rr=Ue.height;this.engine.viewport({x:nt,y:vt,width:_t,height:rr});var Mr=Ha(X.getEntities()),Rr;try{for(Mr.s();!(Rr=Mr.n()).done;){var Cr=Rr.value;this.renderMesh(Cr,{camera:K,view:L,viewMatrix:ve})}}catch(Dr){Mr.e(Dr)}finally{Mr.f()}}},{key:"renderMesh",value:function(L,X){var K=X.camera,ve=X.view,Ce=X.viewMatrix,Ue=this.mesh.getComponentByEntity(L);if(!(!Ue||!Ue.visible)){var nt=Ue.material,vt=Ue.geometry;if(!(!vt||vt.dirty||!nt)){var _t=this.transform.getComponentByEntity(L),rr=In.multiply(In.create(),Ce,_t.worldTransform),Mr=ve.getViewport(),Rr=Mr.width,Cr=Mr.height;nt.setUniform({projectionMatrix:K.getPerspective(),modelViewMatrix:rr,modelMatrix:_t.worldTransform,viewMatrix:Ce,cameraPosition:K.getPosition(),u_viewport:[Rr,Cr]}),Ue.model&&(Ue.model.draw({uniforms:nt.uniforms.reduce(function(Dr,an){return Dr[an.name]=an.data,Dr},{})}),nt.uniforms.forEach(function(Dr){Dr.dirty=!1}),nt.dirty=!1)}}}},{key:"initMesh",value:function(){var q=(0,p.Z)(v().mark(function X(K,ve){var Ce,Ue,nt,vt,_t,rr,Mr,Rr;return v().wrap(function(Dr){for(;;)switch(Dr.prev=Dr.next){case 0:if(Ce=this.mesh.getComponentByEntity(K),Ce){Dr.next=3;break}return Dr.abrupt("return");case 3:if(Ue=Ce.material,nt=Ce.geometry,!(!nt||nt.dirty||!Ue)){Dr.next=7;break}return Dr.abrupt("return");case 7:if(Ce.model){Dr.next=24;break}if(vt="m-".concat(Ue.entity,"-g-").concat(nt.entity),!this.modelCache[vt]){Dr.next=12;break}return Ce.model=this.modelCache[vt],Dr.abrupt("return");case 12:return Ue.setUniform({projectionMatrix:1,modelViewMatrix:1,modelMatrix:1,viewMatrix:1,cameraPosition:1,u_viewport:1}),_t=this.engine,rr=_t.createModel,Mr=_t.createAttribute,Rr={vs:Ue.vertexShaderGLSL,fs:Ue.fragmentShaderGLSL,defines:Ue.defines,attributes:nt.attributes.reduce(function(an,_n){return _n.data&&_n.buffer&&(an[_n.name]=Mr({buffer:_n.buffer,attributes:_n.attributes,arrayStride:_n.arrayStride,stepMode:_n.stepMode,divisor:_n.stepMode==="vertex"?0:1})),an},{}),uniforms:Ue.uniforms.reduce(function(an,_n){return an[_n.name]=_n.data,an},{}),scissor:{enable:!0,box:function(){return ve.getViewport()}}},Ue.cull&&(Rr.cull=Ue.cull),Ue.depth&&(Rr.depth=Ue.depth),Ue.blend&&(Rr.blend=Ue.blend),nt.indicesBuffer&&(Rr.elements=nt.indicesBuffer),nt.maxInstancedCount&&(Rr.instances=nt.maxInstancedCount,Rr.count=nt.vertexCount||3),Dr.next=22,rr(Rr);case 22:Ce.model=Dr.sent,this.modelCache[vt]=Ce.model;case 24:case"end":return Dr.stop()}},X,this)}));function L(X,K){return q.apply(this,arguments)}return L}()},{key:"initView",value:function(){var q=(0,p.Z)(v().mark(function X(K){var ve,Ce,Ue,nt;return v().wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:ve=K.getScene(),Ce=Ha(ve.getEntities()),_t.prev=2,Ce.s();case 4:if((Ue=Ce.n()).done){_t.next=10;break}return nt=Ue.value,_t.next=8,this.initMesh(nt,K);case 8:_t.next=4;break;case 10:_t.next=15;break;case 12:_t.prev=12,_t.t0=_t.catch(2),Ce.e(_t.t0);case 15:return _t.prev=15,Ce.f(),_t.finish(15);case 18:case"end":return _t.stop()}},X,this,[[2,12,15,18]])}));function L(X){return q.apply(this,arguments)}return L}()}]),b}(),Fs.IDENTIFIER="Render Pass",iu),Pa=E(xa.prototype,"mesh",[ru],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),qo=E(xa.prototype,"geometry",[ys],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),eo=E(xa.prototype,"material",[Nn],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),es=E(xa.prototype,"cullable",[Do],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ts=E(xa.prototype,"transform",[Qu],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),nu=E(xa.prototype,"hierarchy",[ua],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),To=E(xa.prototype,"frameGraphSystem",[Jo,Gs],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Es=E(xa.prototype,"engine",[Za],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),pi=E(xa.prototype,"resourcePool",[ms],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xa))||bs),to,Ra,Ao,li,fa,na,Xi,io,go,_s,No,yo,rs;function Lo(b,q){var L;if(typeof Symbol=="undefined"||b[Symbol.iterator]==null){if(Array.isArray(b)||(L=Hi(b))||q&&b&&typeof b.length=="number"){L&&(b=L);var X=0,K=function(){};return{s:K,n:function(){return X>=b.length?{done:!0}:{done:!1,value:b[X++]}},e:function(vt){throw vt},f:K}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
  228. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ve=!0,Ce=!1,Ue;return{s:function(){L=b[Symbol.iterator]()},n:function(){var vt=L.next();return ve=vt.done,vt},e:function(vt){Ce=!0,Ue=vt},f:function(){try{!ve&&L.return!=null&&L.return()}finally{if(Ce)throw Ue}}}}function Hi(b,q){if(!!b){if(typeof b=="string")return Ju(b,q);var L=Object.prototype.toString.call(b).slice(8,-1);if(L==="Object"&&b.constructor&&(L=b.constructor.name),L==="Map"||L==="Set")return Array.from(b);if(L==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L))return Ju(b,q)}}function Ju(b,q){(q==null||q>b.length)&&(q=b.length);for(var L=0,X=new Array(q);L<q;L++)X[L]=b[L];return X}var mf={NONE:0,ENCODE:1,HIGHLIGHT:2},mo=(to=(0,O.b2)(),Ra=(0,O.f3)(D.RenderEngine),Ao=(0,O.f3)(D.ResourcePool),li=(0,O.f3)(D.RenderPassFactory),fa=(0,O.f3)(D.MeshComponentManager),to(na=(Xi=(rs=yo=function(){function b(){var q=this;(0,B.Z)(this,b),S(this,"engine",io,this),S(this,"resourcePool",go,this),S(this,"renderPassFactory",_s,this),S(this,"mesh",No,this),this.pickingFBO=void 0,this.views=void 0,this.highlightEnabled=!0,this.highlightColor=[255,0,0,255],this.alreadyInRendering=!1,this.setup=function(L,X,K){var ve=L.createRenderTarget(X,"picking fbo",{width:1,height:1});K.data={output:X.write(L,ve)},X.hasSideEffect=!0},this.execute=function(){var L=(0,p.Z)(v().mark(function X(K,ve,Ce){var Ue,nt,vt;return v().wrap(function(rr){for(;;)switch(rr.prev=rr.next){case 0:if(q.views=Ce,!q.alreadyInRendering){rr.next=3;break}return rr.abrupt("return");case 3:Ue=Lo(Ce);try{for(vt=function(){var Rr=nt.value,Cr=Rr.getViewport(),Dr=Cr.width,an=Cr.height;q.alreadyInRendering=!0;var _n=K.getResourceNode(ve.data.output);q.pickingFBO=q.resourcePool.getOrCreateResource(_n.resource),q.pickingFBO.resize({width:Dr,height:an}),q.engine.useFramebuffer(q.pickingFBO,function(){q.engine.clear({framebuffer:q.pickingFBO,color:[0,0,0,0],stencil:0,depth:1});var An=q.renderPassFactory(ca.IDENTIFIER),vn=[],ei=Rr.getScene(),Gn=Lo(ei.getEntities()),mi;try{for(Gn.s();!(mi=Gn.n()).done;){var si=mi.value,ni=q.mesh.getComponentByEntity(si),oa=ni.material;oa.setUniform("u_PickingStage",mf.ENCODE),vn.push(ni)}}catch(Ma){Gn.e(Ma)}finally{Gn.f()}An.renderView(Rr),vn.forEach(function(Ma){var Na=Ma.material;Na.setUniform("u_PickingStage",mf.HIGHLIGHT)}),q.alreadyInRendering=!1})},Ue.s();!(nt=Ue.n()).done;)vt()}catch(Mr){Ue.e(Mr)}finally{Ue.f()}case 5:case"end":return rr.stop()}},X)}));return function(X,K,ve){return L.apply(this,arguments)}}(),this.pick=function(L,X){var K=L.x,ve=L.y,Ce=q.engine,Ue=Ce.readPixels,nt=Ce.useFramebuffer,vt=X.getViewport(),_t=vt.width,rr=vt.height,Mr=K*window.devicePixelRatio,Rr=ve*window.devicePixelRatio;if(!(Mr>_t||Mr<0||Rr>rr||Rr<0)){var Cr,Dr;return nt(q.pickingFBO,function(){Cr=Ue({x:Math.round(Mr),y:Math.round(rr-(ve+1)*window.devicePixelRatio),width:1,height:1,data:new Uint8Array(1*1*4),framebuffer:q.pickingFBO}),(Cr[0]!==0||Cr[1]!==0||Cr[2]!==0)&&(Dr=ci(Cr),q.highlightEnabled&&q.highlightPickedFeature(Cr,X))}),Dr}}}return(0,N.Z)(b,[{key:"enableHighlight",value:function(L){this.highlightEnabled=L}},{key:"setHighlightColor",value:function(L){this.highlightColor=L}},{key:"highlightPickedFeature",value:function(L,X){if(L){var K=Lo(X.getScene().getEntities()),ve;try{for(K.s();!(ve=K.n()).done;){var Ce=ve.value,Ue=this.mesh.getComponentByEntity(Ce),nt=Ue.material;nt.setUniform("u_PickingStage",mf.HIGHLIGHT),nt.setUniform("u_PickingColor",[L[0],L[1],L[2]]),nt.setUniform("u_HighlightColor",this.highlightColor)}}catch(vt){K.e(vt)}finally{K.f()}}}}]),b}(),yo.IDENTIFIER="PixelPicking Pass",rs),io=E(Xi.prototype,"engine",[Ra],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),go=E(Xi.prototype,"resourcePool",[Ao],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_s=E(Xi.prototype,"renderPassFactory",[li],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),No=E(Xi.prototype,"mesh",[fa],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Xi))||na),Pc,di,bn,qu,Ka,xs,ou,la,da,Ro=`varying vec2 v_UV;
  229. uniform sampler2D u_Texture;
  230. void main() {
  231. gl_FragColor = vec4(texture2D(u_Texture, v_UV));
  232. }`,cl=`attribute vec2 a_Position;
  233. varying vec2 v_UV;
  234. void main() {
  235. v_UV = 0.5 * (a_Position + 1.0);
  236. gl_Position = vec4(a_Position, 0., 1.);
  237. }`,fl=`layout(set = 0, binding = 0) uniform sampler u_TextureSampler;
  238. layout(set = 0, binding = 1) uniform texture2D u_Texture;
  239. layout(location = 0) in vec2 v_UV;
  240. layout(location = 0) out vec4 outColor;
  241. void main() {
  242. outColor = texture(sampler2D(u_Texture, u_TextureSampler), v_UV);
  243. }`,Oc=`layout(location = 0) in vec2 a_Position;
  244. layout(location = 0) out vec2 v_UV;
  245. void main() {
  246. v_UV = 0.5 * (a_Position + 1.0);
  247. gl_Position = vec4(a_Position, 0., 1.);
  248. }`,xu=(Pc=(0,O.b2)(),di=(0,O.f3)(D.RenderEngine),bn=(0,O.f3)(D.ResourcePool),Pc(qu=(Ka=(da=la=function b(){var q=this;(0,B.Z)(this,b),S(this,"engine",xs,this),S(this,"resourcePool",ou,this),this.model=void 0,this.setup=function(L,X,K){var ve=L.getPass(ca.IDENTIFIER);if(ve){var Ce=L.createRenderTarget(X,"render to screen",{width:1,height:1});K.data={input:X.read(ve.data.output),output:X.write(L,Ce)}}},this.execute=function(){var L=(0,p.Z)(v().mark(function X(K,ve){var Ce,Ue,nt,vt,_t,rr,Mr;return v().wrap(function(Cr){for(;;)switch(Cr.prev=Cr.next){case 0:if(Ce=q.engine,Ue=Ce.createModel,nt=Ce.createAttribute,vt=Ce.createBuffer,q.model){Cr.next=6;break}return Cr.next=4,Ue({vs:q.engine.supportWebGPU?Oc:cl,fs:q.engine.supportWebGPU?fl:Ro,attributes:{a_Position:nt({buffer:vt({data:[-4,-4,4,-4,0,4],type:bt.FLOAT}),size:2,arrayStride:2*4,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})},uniforms:{u_Texture:null},depth:{enable:!1},count:3,blend:{enable:!0}});case 4:_t=Cr.sent,q.model=_t;case 6:rr=K.getResourceNode(ve.data.input),Mr=q.resourcePool.getOrCreateResource(rr.resource),q.engine.useFramebuffer(null,function(){q.engine.clear({framebuffer:null,color:[0,0,0,0],depth:1,stencil:0}),q.model.draw({uniforms:{u_Texture:Mr}})});case 9:case"end":return Cr.stop()}},X)}));return function(X,K){return L.apply(this,arguments)}}(),this.tearDown=function(){q.model=void 0}},la.IDENTIFIER="Copy Pass",da),xs=E(Ka.prototype,"engine",[di],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ou=E(Ka.prototype,"resourcePool",[bn],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ka))||qu),Fa,ao,ec,tc,bo,su,uu,ko,rc,Ss,Bo,cu,bf,ll=(Fa=(0,O.b2)(),ao=(0,O.f3)(D.Systems),ec=(0,O.t6)(D.FrameGraphSystem),tc=(0,O.f3)(D.RenderPassFactory),bo=(0,O.f3)(D.ConfigService),su=(0,O.f3)(D.ResourcePool),Fa(uu=(ko=(bf=function(){function b(){(0,B.Z)(this,b),S(this,"frameGraphSystem",rc,this),S(this,"renderPassFactory",Ss,this),S(this,"configService",Bo,this),S(this,"resourcePool",cu,this)}return(0,N.Z)(b,[{key:"execute",value:function(){var q=(0,p.Z)(v().mark(function X(K){var ve,Ce,Ue,nt,vt,_t,rr,Mr,Rr;return v().wrap(function(Dr){for(;;)switch(Dr.prev=Dr.next){case 0:ve=this.renderPassFactory(ca.IDENTIFIER),Ce=ve.setup,Ue=ve.execute,nt=this.frameGraphSystem.addPass(ca.IDENTIFIER,Ce,Ue),vt=this.renderPassFactory(xu.IDENTIFIER),_t=vt.setup,rr=vt.execute,Mr=vt.tearDown,Rr=this.frameGraphSystem.addPass(xu.IDENTIFIER,_t,rr,Mr),this.frameGraphSystem.present(Rr.data.output);case 5:case"end":return Dr.stop()}},X,this)}));function L(X){return q.apply(this,arguments)}return L}()},{key:"tearDown",value:function(){this.resourcePool.clean()}},{key:"pick",value:function(L,X){var K=this.renderPassFactory(mo.IDENTIFIER);return K.pick(L,X)}}]),b}(),bf),rc=E(ko.prototype,"frameGraphSystem",[ao,ec],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ss=E(ko.prototype,"renderPassFactory",[tc],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Bo=E(ko.prototype,"configService",[bo],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),cu=E(ko.prototype,"resourcePool",[su],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ko))||uu);function Ef(b){var q=_f();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function _f(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var dl=function(b){(0,V.Z)(L,b);var q=Ef(L);function L(X){var K;return(0,B.Z)(this,L),K=q.call(this,X),K.parentID=void 0,Object.assign((0,Vt.Z)(K),X),K}return L}(T),ns,Su,Dc,oo,is,wu,hl,Mu,vl,pl,Nc=(ns=(0,O.b2)(),Su=(0,O.f3)(D.HierarchyComponentManager),Dc=(0,O.f3)(D.TransformComponentManager),oo=(0,O.f3)(D.MeshComponentManager),ns(is=(wu=(pl=function(){function b(){(0,B.Z)(this,b),S(this,"hierarchy",hl,this),S(this,"transform",Mu,this),S(this,"mesh",vl,this)}return(0,N.Z)(b,[{key:"execute",value:function(){var q=(0,p.Z)(v().mark(function X(){return v().wrap(function(ve){for(;;)switch(ve.prev=ve.next){case 0:this.runTransformUpdateSystem(),this.runHierarchyUpdateSystem();case 2:case"end":return ve.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"tearDown",value:function(){this.hierarchy.clear(),this.transform.clear()}},{key:"getHierarchyComponentManager",value:function(){return this.hierarchy}},{key:"getTransformComponentManager",value:function(){return this.transform}},{key:"runTransformUpdateSystem",value:function(){var L=this;this.transform.forEach(function(X,K){(K.isDirty()||K.isLocalDirty())&&(L.setMeshAABBDirty(L.mesh.getComponentByEntity(X)),K.updateTransform())})}},{key:"runHierarchyUpdateSystem",value:function(){var L=this;this.hierarchy.forEach(function(X,K){var ve=L.transform.getComponentByEntity(X),Ce=L.transform.getComponentByEntity(K.parentID);ve!==null&&Ce!==null&&ve.updateTransformWithParent(Ce)})}},{key:"attach",value:function(L,X,K){this.hierarchy.contains(L)&&this.detach(L),this.hierarchy.create(L,{parentID:X});var ve=this.mesh.getComponentByEntity(X);if(this.setMeshAABBDirty(ve),ve&&ve.children.indexOf(L)===-1&&ve.children.push(L),this.hierarchy.getCount()>1)for(var Ce=this.hierarchy.getCount()-1;Ce>0;--Ce)for(var Ue=this.hierarchy.getEntity(Ce),nt=0;nt<Ce;++nt){var vt=this.hierarchy.getComponent(nt);if(vt.parentID===Ue){this.hierarchy.moveItem(Ce,nt),++Ce;break}}var _t=this.hierarchy.getComponentByEntity(L),rr=this.transform.getComponentByEntity(X);rr===null&&(rr=this.transform.create(X));var Mr=this.transform.getComponentByEntity(L);Mr===null&&(Mr=this.transform.create(L),rr=this.transform.getComponentByEntity(X)),Mr.parent=rr,!K&&rr&&(Mr.matrixTransform(In.invert(In.create(),rr.worldTransform)),Mr.updateTransform()),rr&&Mr.updateTransformWithParent(rr)}},{key:"detach",value:function(L){var X=this.hierarchy.getComponentByEntity(L);if(X!==null){var K=this.transform.getComponentByEntity(L);K!==null&&(K.parent=null,K.applyTransform()),this.hierarchy.removeKeepSorted(L);var ve=this.mesh.getComponentByEntity(X.parentID);if(ve){var Ce=ve.children.indexOf(L);ve.children.splice(Ce,1)}this.setMeshAABBDirty(ve)}}},{key:"detachChildren",value:function(L){var X=this.mesh.getComponentByEntity(L);X&&(X.children=[]);for(var K=0;K<this.hierarchy.getCount();){var ve;if(((ve=this.hierarchy.getComponent(K))===null||ve===void 0?void 0:ve.parentID)===L){var Ce=this.hierarchy.getEntity(K);this.detach(Ce)}else++K}}},{key:"setMeshAABBDirty",value:function(L){L&&(L.aabbDirty=!0)}}]),b}(),pl),hl=E(wu.prototype,"hierarchy",[Su],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Mu=E(wu.prototype,"transform",[Dc],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),vl=E(wu.prototype,"mesh",[oo],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),wu))||is),zn=M(32945);function gl(b){var q=xf();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function xf(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var Lc=function(b){(0,V.Z)(L,b);var q=gl(L);function L(X){var K;return(0,B.Z)(this,L),K=q.call(this,X),K.dirtyFlag=void 0,K.localDirtyFlag=void 0,K.parent=null,K.localPosition=ke.fromValues(0,0,0),K.localRotation=zn.fromValues(0,0,0,1),K.localScale=ke.fromValues(1,1,1),K.localTransform=In.create(),K.position=ke.fromValues(0,0,0),K.rotation=zn.fromValues(0,0,0,1),K.scaling=ke.fromValues(1,1,1),K.worldTransform=In.create(),K.matrixTransform=function(){var ve=In.create();return function(Ce){In.multiply(ve,K.getLocalTransform(),Ce),In.getScaling(K.localScale,ve),In.getTranslation(K.localPosition,ve),In.getRotation(K.localRotation,ve)}}(),K.rotateRollPitchYaw=function(){var ve=zn.create(),Ce=zn.create(),Ue=zn.create();return function(nt,vt,_t){K.setDirty(),zn.fromEuler(ve,nt,0,0),zn.fromEuler(Ce,0,vt,0),zn.fromEuler(Ue,0,0,_t),zn.multiply(K.localRotation,ve,K.localRotation),zn.multiply(K.localRotation,K.localRotation,Ce),zn.multiply(K.localRotation,Ue,K.localRotation),zn.normalize(K.localRotation,K.localRotation)}}(),K.lerp=function(){var ve=ke.create(),Ce=zn.create(),Ue=ke.create(),nt=ke.create(),vt=zn.create(),_t=ke.create();return function(rr,Mr,Rr){K.setDirty(),In.getScaling(ve,rr.worldTransform),In.getTranslation(Ue,rr.worldTransform),In.getRotation(Ce,rr.worldTransform),In.getScaling(nt,Mr.worldTransform),In.getTranslation(_t,Mr.worldTransform),In.getRotation(vt,Mr.worldTransform),ke.lerp(K.localScale,ve,nt,Rr),zn.slerp(K.localRotation,Ce,vt,Rr),ke.lerp(K.localPosition,Ue,_t,Rr)}}(),K.translate=function(){var ve=ke.create();return function(Ce){return ke.add(ve,K.getPosition(),Ce),K.setPosition(ve),K.setDirty(!0),(0,Vt.Z)(K)}}(),K.translateLocal=function(){return function(ve){return ke.transformQuat(ve,ve,K.localRotation),ke.add(K.localPosition,K.localPosition,ve),K.setLocalDirty(!0),(0,Vt.Z)(K)}}(),K.setPosition=function(){var ve=In.create();return function(Ce){return K.position=Ce,K.setLocalDirty(!0),K.parent===null?ke.copy(K.localPosition,Ce):(In.copy(ve,K.parent.worldTransform),In.invert(ve,ve),ke.transformMat4(K.localPosition,Ce,ve)),(0,Vt.Z)(K)}}(),K.rotate=function(){var ve=zn.create();return function(Ce){if(K.parent===null)zn.multiply(K.localRotation,K.localRotation,Ce),zn.normalize(K.localRotation,K.localRotation);else{var Ue=K.getRotation(),nt=K.parent.getRotation();zn.copy(ve,nt),zn.invert(ve,ve),zn.multiply(ve,ve,Ce),zn.multiply(K.localRotation,Ce,Ue),zn.normalize(K.localRotation,K.localRotation)}return K.setLocalDirty(),(0,Vt.Z)(K)}}(),K.rotateLocal=function(){return function(ve){return zn.multiply(K.localRotation,K.localRotation,ve),zn.normalize(K.localRotation,K.localRotation),K.setLocalDirty(!0),(0,Vt.Z)(K)}}(),K.setRotation=function(){var ve=zn.create();return function(Ce){return K.parent===null?zn.copy(K.localRotation,Ce):(zn.copy(ve,K.parent.getRotation()),zn.invert(ve,ve),zn.copy(K.localRotation,ve),zn.mul(K.localRotation,K.localRotation,Ce)),K.setLocalDirty(!0),(0,Vt.Z)(K)}}(),K}return(0,N.Z)(L,[{key:"setLocalPosition",value:function(K){ke.copy(this.localPosition,K),this.setLocalDirty(!0)}},{key:"setLocalScale",value:function(K){ke.copy(this.localScale,K),this.setLocalDirty(!0)}},{key:"setLocalRotation",value:function(K){return zn.copy(this.localRotation,K),this.setLocalDirty(!0),this}},{key:"isDirty",value:function(){return this.dirtyFlag}},{key:"setDirty",value:function(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;K?this.dirtyFlag|=L.DIRTY:this.dirtyFlag&=~L.DIRTY}},{key:"isLocalDirty",value:function(){return this.localDirtyFlag}},{key:"setLocalDirty",value:function(){var K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;K?(this.localDirtyFlag|=L.DIRTY,this.setDirty(!0)):this.localDirtyFlag&=~L.DIRTY}},{key:"updateTransform",value:function(){this.isLocalDirty()&&this.getLocalTransform(),this.isDirty()&&this.parent===null&&(In.copy(this.worldTransform,this.getLocalTransform()),this.setDirty(!1))}},{key:"updateTransformWithParent",value:function(K){In.multiply(this.worldTransform,K.worldTransform,this.getLocalTransform())}},{key:"applyTransform",value:function(){this.setDirty(),In.getScaling(this.localScale,this.worldTransform),In.getTranslation(this.localPosition,this.worldTransform),In.getRotation(this.localRotation,this.worldTransform)}},{key:"clearTransform",value:function(){this.setDirty(),this.localPosition=ke.fromValues(0,0,0),this.localRotation=zn.fromValues(0,0,0,1),this.localScale=ke.fromValues(1,1,1)}},{key:"scaleLocal",value:function(K){return this.setLocalDirty(),ke.multiply(this.localScale,this.localScale,K),this}},{key:"getLocalPosition",value:function(){return this.localPosition}},{key:"getLocalRotation",value:function(){return this.localRotation}},{key:"getLocalScale",value:function(){return this.localScale}},{key:"getLocalTransform",value:function(){return this.localDirtyFlag&&(In.fromRotationTranslationScale(this.localTransform,this.localRotation,this.localPosition,this.localScale),this.setLocalDirty(!1)),this.localTransform}},{key:"getWorldTransform",value:function(){return!this.isLocalDirty()&&!this.isDirty()?this.worldTransform:(this.parent&&this.parent.getWorldTransform(),this.updateTransform(),this.worldTransform)}},{key:"getPosition",value:function(){return In.getTranslation(this.position,this.worldTransform),this.position}},{key:"getRotation",value:function(){return In.getRotation(this.rotation,this.worldTransform),this.rotation}},{key:"getScale",value:function(){return In.getScaling(this.scaling,this.worldTransform),this.scaling}}]),L}(T);Lc.DIRTY=1<<0;var Sf=M(84879),nc,wf,Cu,ic,Mf,Rc,ac=(nc=(0,O.b2)(),wf=(0,O.f3)(D.RenderEngine),nc(Cu=(ic=(Rc=function(){function b(){(0,B.Z)(this,b),S(this,"engine",Mf,this),this.resourcePool={}}return(0,N.Z)(b,[{key:"getOrCreateResource",value:function(L){if(!this.resourcePool[L.name]){var X=L.descriptor,K=X.width,ve=X.height,Ce=X.usage;this.resourcePool[L.name]=this.engine.createFramebuffer({color:this.engine.createTexture2D({width:K,height:ve,wrapS:bt.CLAMP_TO_EDGE,wrapT:bt.CLAMP_TO_EDGE,usage:Ce})})}return this.resourcePool[L.name]}},{key:"clean",value:function(){this.resourcePool={}}}]),b}(),Rc),Mf=E(ic.prototype,"engine",[wf],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ic))||Cu);function oc(b){var q=Oa();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function Oa(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var kc=function(b){(0,V.Z)(L,b);var q=oc(L);function L(X){var K;return(0,B.Z)(this,L),K=q.call(this,X),K.name=void 0,K.name=X.name||"",K}return L}(T),Tu,sc,yl,Au=(Tu=(0,O.b2)(),Tu(sc=(yl=function(){function b(){(0,B.Z)(this,b),this.config=void 0}return(0,N.Z)(b,[{key:"get",value:function(){return this.config}},{key:"set",value:function(L){this.config=L}}]),b}(),yl))||sc),$a,Qa,Us;(function(b){b.PANSTART="PANSTART",b.PANEND="PANEND",b.PANMOVE="PANMOVE",b.PINCH="PINCH",b.KEYDOWN="KEYDOWN",b.KEYUP="KEYUP",b.HOVER="HOVER"})(Us||(Us={}));var ml=($a=(0,O.b2)(),$a(Qa=function(){function b(){(0,B.Z)(this,b)}return(0,N.Z)(b,[{key:"listen",value:function(L){}},{key:"on",value:function(L,X){}},{key:"connect",value:function(){}},{key:"disconnect",value:function(){}},{key:"destroy",value:function(){}}]),b}())||Qa);function Cf(b){var q=0;switch(b){case"vec2":case"ivec2":q=2;break;case"vec3":case"ivec3":q=3;break;case"vec4":case"ivec4":case"mat2":q=4;break;case"mat3":q=9;break;case"mat4":q=16;break;default:}return q}var Tf=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g;function fu(b){var q={};return b=b.replace(Tf,function(L,X,K){var ve=K.split(":"),Ce=ve[0].trim(),Ue="";switch(ve.length>1&&(Ue=ve[1].trim()),X){case"bool":Ue=Ue==="true";break;case"float":case"int":Ue=Number(Ue);break;case"vec2":case"vec3":case"vec4":case"ivec2":case"ivec3":case"ivec4":case"mat2":case"mat3":case"mat4":Ue?Ue=Ue.replace("[","").replace("]","").split(",").reduce(function(nt,vt){return nt.push(Number(vt.trim())),nt},[]):Ue=new Array(Cf(X)).fill(0);break;default:}return q[Ce]=Ue,"uniform ".concat(X," ").concat(Ce,`;
  249. `)}),{content:b,uniforms:q}}function bl(b){return b.filter(function(q,L,X){return X.indexOf(q)===L})}var Af,as,Sa;function Bc(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function ws(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?Bc(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):Bc(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}var Go=`varying vec4 v_PickingResult;
  250. uniform vec4 u_HighlightColor : [0, 0, 0, 0];
  251. uniform float u_PickingStage : 0.0;
  252. #define PICKING_ENCODE 1.0
  253. #define PICKING_HIGHLIGHT 2.0
  254. #define COLOR_SCALE 1. / 255.
  255. /*
  256. * Returns highlight color if this item is selected.
  257. */
  258. vec4 filterHighlightColor(vec4 color) {
  259. bool selected = bool(v_PickingResult.a);
  260. if (selected) {
  261. vec4 highLightColor = u_HighlightColor * COLOR_SCALE;
  262. float highLightAlpha = highLightColor.a;
  263. float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));
  264. vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);
  265. return vec4(resultRGB, color.a);
  266. } else {
  267. return color;
  268. }
  269. }
  270. /*
  271. * Returns picking color if picking enabled else unmodified argument.
  272. */
  273. vec4 filterPickingColor(vec4 color) {
  274. vec3 pickingColor = v_PickingResult.rgb;
  275. if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {
  276. discard;
  277. }
  278. return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;
  279. }
  280. /*
  281. * Returns picking color if picking is enabled if not
  282. * highlight color if this item is selected, otherwise unmodified argument.
  283. */
  284. vec4 filterColor(vec4 color) {
  285. return filterPickingColor(filterHighlightColor(color));
  286. }
  287. `,If=`attribute vec3 a_PickingColor;
  288. varying vec4 v_PickingResult;
  289. uniform vec3 u_PickingColor : [0, 0, 0];
  290. uniform vec4 u_HighlightColor : [0, 0, 0, 0];
  291. uniform float u_PickingStage : 0.0;
  292. uniform float u_PickingThreshold : 1.0;
  293. uniform float u_PickingBuffer: 0.0;
  294. #define PICKING_ENCODE 1.0
  295. #define PICKING_HIGHLIGHT 2.0
  296. #define COLOR_SCALE 1. / 255.
  297. bool isVertexPicked(vec3 vertexColor) {
  298. return
  299. abs(vertexColor.r - u_PickingColor.r) < u_PickingThreshold &&
  300. abs(vertexColor.g - u_PickingColor.g) < u_PickingThreshold &&
  301. abs(vertexColor.b - u_PickingColor.b) < u_PickingThreshold;
  302. }
  303. void setPickingColor(vec3 pickingColor) {
  304. // compares only in highlight stage
  305. v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && isVertexPicked(pickingColor));
  306. // Stores the picking color so that the fragment shader can render it during picking
  307. v_PickingResult.rgb = pickingColor * COLOR_SCALE;
  308. }
  309. float setPickingSize(float x) {
  310. return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;
  311. }`,Pf=`/**
  312. * 2D signed distance field functions
  313. * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
  314. */
  315. float ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; }
  316. float sdCircle(vec2 p, float r) {
  317. return length(p) - r;
  318. }
  319. float sdEquilateralTriangle(vec2 p) {
  320. float k = sqrt(3.0);
  321. p.x = abs(p.x) - 1.0;
  322. p.y = p.y + 1.0/k;
  323. if( p.x + k*p.y > 0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;
  324. p.x -= clamp( p.x, -2.0, 0.0 );
  325. return -length(p)*sign(p.y);
  326. }
  327. float sdBox(vec2 p, vec2 b) {
  328. vec2 d = abs(p)-b;
  329. return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0);
  330. }
  331. float sdPentagon(vec2 p, float r) {
  332. vec3 k = vec3(0.809016994,0.587785252,0.726542528);
  333. p.x = abs(p.x);
  334. p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);
  335. p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);
  336. p -= vec2(clamp(p.x,-r*k.z,r*k.z),r);
  337. return length(p)*sign(p.y);
  338. }
  339. float sdHexagon(vec2 p, float r) {
  340. vec3 k = vec3(-0.866025404,0.5,0.577350269);
  341. p = abs(p);
  342. p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
  343. p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
  344. return length(p)*sign(p.y);
  345. }
  346. float sdOctogon(vec2 p, float r) {
  347. vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 );
  348. p = abs(p);
  349. p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);
  350. p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);
  351. p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
  352. return length(p)*sign(p.y);
  353. }
  354. float sdHexagram(vec2 p, float r) {
  355. vec4 k=vec4(-0.5,0.8660254038,0.5773502692,1.7320508076);
  356. p = abs(p);
  357. p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
  358. p -= 2.0*min(dot(k.yx,p),0.0)*k.yx;
  359. p -= vec2(clamp(p.x,r*k.z,r*k.w),r);
  360. return length(p)*sign(p.y);
  361. }
  362. float sdRhombus(vec2 p, vec2 b) {
  363. vec2 q = abs(p);
  364. float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0);
  365. float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );
  366. return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );
  367. }
  368. float sdVesica(vec2 p, float r, float d) {
  369. p = abs(p);
  370. float b = sqrt(r*r-d*d); // can delay this sqrt
  371. return ((p.y-b)*d>p.x*b)
  372. ? length(p-vec2(0.0,b))
  373. : length(p-vec2(-d,0.0))-r;
  374. }`,Gc=/precision\s+(high|low|medium)p\s+float/,Fc=`#ifdef GL_FRAGMENT_PRECISION_HIGH
  375. precision highp float;
  376. #else
  377. precision mediump float;
  378. #endif
  379. `,El=/#pragma include (["^+"]?["\ "[a-zA-Z_0-9](.*)"]*?)/g,uc=(Af=(0,O.b2)(),Af(as=(Sa=function(){function b(){(0,B.Z)(this,b),this.moduleCache={},this.rawContentCache={}}return(0,N.Z)(b,[{key:"registerBuiltinModules",value:function(){this.destroy(),this.registerModule("picking",{vs:If,fs:Go}),this.registerModule("sdf2d",{vs:"",fs:Pf})}},{key:"registerModule",value:function(L,X){if(!this.rawContentCache[L]){var K=X.vs,ve=K===void 0?"":K,Ce=X.fs,Ue=Ce===void 0?"":Ce,nt=X.uniforms,vt=fu(ve),_t=vt.content,rr=vt.uniforms,Mr=fu(Ue),Rr=Mr.content,Cr=Mr.uniforms;this.rawContentCache[L]={fs:Rr,uniforms:ws(ws(ws({},rr),Cr),nt),vs:_t}}}},{key:"destroy",value:function(){this.moduleCache={},this.rawContentCache={}}},{key:"getModule",value:function(L){var X=this;if(this.moduleCache[L])return this.moduleCache[L];var K=this.rawContentCache[L].vs||"",ve=this.rawContentCache[L].fs||"",Ce=this.processModule(K,[],"vs"),Ue=Ce.content,nt=Ce.includeList,vt=this.processModule(ve,[],"fs"),_t=vt.content,rr=vt.includeList,Mr=_t,Rr=bl(nt.concat(rr).concat(L)).reduce(function(Cr,Dr){return ws(ws({},Cr),X.rawContentCache[Dr].uniforms)},{});return Gc.test(_t)||(Mr=Fc+_t),this.moduleCache[L]={fs:Mr.trim(),uniforms:Rr,vs:Ue.trim()},this.moduleCache[L]}},{key:"processModule",value:function(L,X,K){var ve=this,Ce=L.replace(El,function(Ue,nt){var vt=nt.split(" "),_t=vt[0].replace(/"/g,"");if(X.indexOf(_t)>-1)return"";var rr=ve.rawContentCache[_t][K];X.push(_t);var Mr=ve.processModule(rr||"",X,K),Rr=Mr.content;return Rr});return{content:Ce,includeList:X}}}]),b}(),Sa))||as),Io=new O.W2,Uc=(0,Sf.Z)(Io,!1),zs=function(q){var L=Uc.lazyInject(q);return function(X,K,ve){L.call(this,X,K),ve&&(ve.initializer=function(){return X[K]})}},_l=function(q){var L=Uc.lazyMultiInject(q);return function(X,K,ve){L.call(this,X,K),ve&&(ve.initializer=function(){return X[K]})}};Io.bind(D.ShaderModuleService).to(uc).inSingletonScope(),Io.bind(D.NameComponentManager).toConstantValue(new m(kc)),Io.bind(D.HierarchyComponentManager).toConstantValue(new m(dl)),Io.bind(D.TransformComponentManager).toConstantValue(new m(Lc)),Io.bind(D.MeshComponentManager).toConstantValue(new m(pt)),Io.bind(D.CullableComponentManager).toConstantValue(new m(lt)),Io.bind(D.GeometryComponentManager).toConstantValue(new m(Un)),Io.bind(D.MaterialComponentManager).toConstantValue(new m(fr));function xl(){var b=new O.W2;return b.parent=Io,b.bind(D.Systems).to(Nc).inSingletonScope().whenTargetNamed(D.SceneGraphSystem),b.bind(D.Systems).to(nr).inSingletonScope().whenTargetNamed(D.FrameGraphSystem),b.bind(D.Systems).to(vo).inSingletonScope().whenTargetNamed(D.MeshSystem),b.bind(D.Systems).to(Ne).inSingletonScope().whenTargetNamed(D.GeometrySystem),b.bind(D.Systems).to(yr).inSingletonScope().whenTargetNamed(D.MaterialSystem),b.bind(D.Systems).to(ll).inSingletonScope().whenTargetNamed(D.RendererSystem),b.bind(D.ResourcePool).to(ac).inSingletonScope(),b.bind(D.ConfigService).to(Au).inSingletonScope(),b.bind(D.InteractorService).to(ml).inSingletonScope(),b.bind(D.RenderPass).to(ca).inSingletonScope().whenTargetNamed(ca.IDENTIFIER),b.bind(D.RenderPass).to(xu).inSingletonScope().whenTargetNamed(xu.IDENTIFIER),b.bind(D.RenderPass).to(mo).inSingletonScope().whenTargetNamed(mo.IDENTIFIER),b.bind(D.RenderPassFactory).toFactory(function(q){return function(L){return q.container.getNamed(D.RenderPass,L)}}),b}function Ms(b){for(var q=new Ae,L=ke.fromValues(b[0],b[1],b[2]),X=ke.fromValues(b[0],b[1],b[2]),K=3;K<b.length;){var ve=b[K++],Ce=b[K++],Ue=b[K++];ve<L[0]&&(L[0]=ve),Ce<L[1]&&(L[1]=Ce),Ue<L[2]&&(L[2]=Ue),ve>X[0]&&(X[0]=ve),Ce>X[1]&&(X[1]=Ce),Ue>X[2]&&(X[2]=Ue)}return q.setMinMax(L,X),q}var wa=typeof navigator!="undefined"&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent),rd=ke.create(),yn=null,cc=ke.create(),gi=ke.create(),fc=ke.create(),Sl=ke.create(),lu=ke.create(),Of=null,zc=M(59518),Df=M(26199),wl=M(14156),Nf=M(71468),Fo=M(48871),Ml=M(9871),Wc;(function(b){b.Normal="normal",b.PostProcessing="post-processing"})(Wc||(Wc={}));var Da=M(25612),Lf=M(92777),Iu=M(20159),Rf=M(61622),kf=M(20499),nd=M(64851),Ws;(function(b){b.Void="Void",b.Boolean="Boolean",b.Float="Float",b.Uint32="Uint32",b.Int32="Int32",b.Vector="Vector",b.Vector2Float="vec2<f32>",b.Vector3Float="vec3<f32>",b.Vector4Float="vec4<f32>",b.Vector2Boolean="vec2<bool>",b.Vector3Boolean="vec3<bool>",b.Vector4Boolean="vec4<bool>",b.Vector2Uint="vec2<u32>",b.Vector3Uint="vec3<u32>",b.Vector4Uint="vec4<u32>",b.Vector2Int="vec2<i32>",b.Vector3Int="vec3<i32>",b.Vector4Int="vec4<i32>",b.Matrix="Matrix",b.Matrix3x3Float="mat3x3<f32>",b.Matrix4x4Float="mat4x4<i32>",b.Struct="Struct",b.FloatArray="Float[]",b.Vector4FloatArray="vec4<f32>[]"})(Ws||(Ws={}));var Bf;(function(b){b.Program="Program",b.Identifier="Identifier",b.VariableDeclaration="VariableDeclaration",b.BlockStatement="BlockStatement",b.ReturnStatement="ReturnStatement",b.FunctionDeclaration="FunctionDeclaration",b.VariableDeclarator="VariableDeclarator",b.AssignmentExpression="AssignmentExpression",b.LogicalExpression="LogicalExpression",b.BinaryExpression="BinaryExpression",b.ArrayExpression="ArrayExpression",b.UnaryExpression="UnaryExpression",b.UpdateExpression="UpdateExpression",b.FunctionExpression="FunctionExpression",b.MemberExpression="MemberExpression",b.ConditionalExpression="ConditionalExpression",b.ExpressionStatement="ExpressionStatement",b.CallExpression="CallExpression",b.NumThreadStatement="NumThreadStatement",b.StorageStatement="StorageStatement",b.DoWhileStatement="DoWhileStatement",b.WhileStatement="WhileStatement",b.ForStatement="ForStatement",b.BreakStatement="BreakStatement",b.ContinueStatement="ContinueStatement",b.IfStatement="IfStatement",b.ImportedFunctionStatement="ImportedFunctionStatement"})(Bf||(Bf={}));var Uo;(function(b){b.Input="Input",b.Output="Output",b.Uniform="Uniform",b.Workgroup="Workgroup",b.UniformConstant="UniformConstant",b.Image="Image",b.StorageBuffer="StorageBuffer",b.Private="Private",b.Function="Function"})(Uo||(Uo={}));var Pu;(function(b){b.GLSL100="GLSL100",b.GLSL450="GLSL450",b.WGSL="WGSL"})(Pu||(Pu={}));var lc="__DefineValuePlaceholder__";function jc(b){return typeof b=="number"}function zo(b){return b===void 0?0:b>360||b<-360?b%360:b}function so(b,q,L){return jc(b)?ke.fromValues(b,q,L):b.length===3?ke.clone(b):ke.fromValues(b[0],b[1],b[2])}var Cl=function(){function b(q,L){(0,B.Z)(this,b),this.name=void 0,this.matrix=void 0,this.right=void 0,this.up=void 0,this.forward=void 0,this.position=void 0,this.focalPoint=void 0,this.distanceVector=void 0,this.distance=void 0,this.dollyingStep=void 0,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.name=q,this.matrix=In.clone(L.matrix),this.right=ke.clone(L.right),this.up=ke.clone(L.up),this.forward=ke.clone(L.forward),this.position=ke.clone(L.position),this.focalPoint=ke.clone(L.focalPoint),this.distanceVector=ke.clone(L.distanceVector),this.azimuth=L.azimuth,this.elevation=L.elevation,this.roll=L.roll,this.relAzimuth=L.relAzimuth,this.relElevation=L.relElevation,this.relRoll=L.relRoll,this.dollyingStep=L.dollyingStep,this.distance=L.distance}return(0,N.Z)(b,[{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getRoll",value:function(){return this.roll}},{key:"retrieve",value:function(L){L.matrix=In.copy(L.matrix,this.matrix),L.right=ke.copy(L.right,this.right),L.up=ke.copy(L.up,this.up),L.forward=ke.copy(L.forward,this.forward),L.position=ke.copy(L.position,this.position),L.focalPoint=ke.copy(L.focalPoint,this.focalPoint),L.distanceVector=ke.copy(L.distanceVector,this.distanceVector),L.azimuth=this.azimuth,L.elevation=this.elevation,L.roll=this.roll,L.relAzimuth=this.relAzimuth,L.relElevation=this.relElevation,L.relRoll=this.relRoll,L.dollyingStep=this.dollyingStep,L.distance=this.distance}}]),b}(),Po,Vc,Cs,Ts,Gf,Ou,js,Ri;(function(b){b.ORBITING="ORBITING",b.EXPLORING="EXPLORING",b.TRACKING="TRACKING"})(Ri||(Ri={}));var Xc;(function(b){b.DEFAULT="DEFAULT",b.ROTATIONAL="ROTATIONAL",b.TRANSLATIONAL="TRANSLATIONAL",b.CINEMATIC="CINEMATIC"})(Xc||(Xc={}));var os;(function(b){b.ORTHOGRAPHIC="ORTHOGRAPHIC",b.PERSPECTIVE="PERSPECTIVE"})(os||(os={}));var Wo=Math.PI/180,ss=180/Math.PI,Yc=(Po=(0,O.b2)(),Vc=(0,O.f3)(D.InteractorService),Po(Cs=(Ts=(js=Ou=function(){function b(){(0,B.Z)(this,b),this.matrix=In.create(),this.right=ke.fromValues(1,0,0),this.up=ke.fromValues(0,1,0),this.forward=ke.fromValues(0,0,1),this.position=ke.fromValues(0,0,1),this.focalPoint=ke.fromValues(0,0,0),this.distanceVector=ke.fromValues(0,0,0),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=Infinity,this.minDistance=-Infinity,this.rotateWorld=!1,S(this,"interactor",Gf,this),this.fov=30,this.near=.1,this.far=1e4,this.aspect=1,this.left=void 0,this.rright=void 0,this.top=void 0,this.bottom=void 0,this.zoom=1,this.perspective=In.create(),this.view=void 0,this.following=void 0,this.type=Ri.EXPLORING,this.trackingMode=Xc.DEFAULT,this.projectionMode=os.PERSPECTIVE,this.frustum=new jr,this.landmarks=[],this.landmarkAnimationID=void 0}return(0,N.Z)(b,[{key:"clone",value:function(){var L=new b;return L.setType(this.type,void 0),L.interactor=this.interactor,L}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.perspective}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"setType",value:function(L,X){return this.type=L,this.type===Ri.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===Ri.TRACKING&&X!==void 0&&this.setTrackingMode(X),this}},{key:"setProjectionMode",value:function(L){return this.projectionMode=L,this}},{key:"setTrackingMode",value:function(L){if(this.type!==Ri.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=L,this}},{key:"setWorldRotation",value:function(L){this.rotateWorld=L,this._getAngles()}},{key:"getViewTransform",value:function(){return In.invert(In.create(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"setMatrix",value:function(L){return this.matrix=L,this._update(),this}},{key:"setAspect",value:function(L){return this.setPerspective(this.near,this.far,this.fov,L),this}},{key:"setViewOffset",value:function(L,X,K,ve,Ce,Ue){return this.aspect=L/X,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=L,this.view.fullHeight=X,this.view.offsetX=K,this.view.offsetY=ve,this.view.width=Ce,this.view.height=Ue,this.projectionMode===os.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===os.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setPerspective",value:function(L,X,K,ve){return this.projectionMode=os.PERSPECTIVE,this.fov=K,this.near=L,this.far=X,this.aspect=ve,In.perspective(this.perspective,this.fov*Wo,this.aspect,this.near,this.far),this}},{key:"setOrthographic",value:function(L,X,K,ve,Ce,Ue){this.projectionMode=os.ORTHOGRAPHIC,this.rright=X,this.left=L,this.top=K,this.bottom=ve,this.near=Ce,this.far=Ue;var nt=(this.rright-this.left)/(2*this.zoom),vt=(this.top-this.bottom)/(2*this.zoom),_t=(this.rright+this.left)/2,rr=(this.top+this.bottom)/2,Mr=_t-nt,Rr=_t+nt,Cr=rr+vt,Dr=rr-vt;if(this.view!==void 0&&this.view.enabled){var an=(this.rright-this.left)/this.view.fullWidth/this.zoom,_n=(this.top-this.bottom)/this.view.fullHeight/this.zoom;Mr+=an*this.view.offsetX,Rr=Mr+an*this.view.width,Cr-=_n*this.view.offsetY,Dr=Cr-_n*this.view.height}return In.ortho(this.perspective,Mr,Rr,Cr,Dr,Ce,Ue),this}},{key:"setPosition",value:function(L,X,K){return this._setPosition(L,X,K),this.setFocalPoint(this.focalPoint),this}},{key:"setFocalPoint",value:function(L,X,K){var ve=ke.fromValues(0,1,0);if(this.focalPoint=so(L,X,K),this.trackingMode===Xc.CINEMATIC){var Ce=ke.subtract(ke.create(),this.focalPoint,this.position);L=Ce[0],X=Ce[1],K=Ce[2];var Ue=ke.length(Ce),nt=Math.asin(X/Ue)*ss,vt=90+Math.atan2(K,L)*ss,_t=In.create();In.rotateY(_t,_t,vt*Wo),In.rotateX(_t,_t,nt*Wo),ve=ke.transformMat4(ke.create(),[0,1,0],_t)}return In.invert(this.matrix,In.lookAt(In.create(),this.position,this.focalPoint,ve)),this._getAxes(),this._getDistance(),this._getAngles(),this}},{key:"setDistance",value:function(L){if(!(this.distance===L||L<0)){this.distance=L,this.distance<2e-4&&(this.distance=2e-4),this.dollyingStep=this.distance/100;var X=ke.create();L=this.distance;var K=this.forward,ve=this.focalPoint;return X[0]=L*K[0]+ve[0],X[1]=L*K[1]+ve[1],X[2]=L*K[2]+ve[2],this._setPosition(X),this}}},{key:"setMaxDistance",value:function(L){return this.maxDistance=L,this}},{key:"setMinDistance",value:function(L){return this.minDistance=L,this}},{key:"changeAzimuth",value:function(L){return this.setAzimuth(this.azimuth+L),this}},{key:"changeElevation",value:function(L){return this.setElevation(this.elevation+L),this}},{key:"changeRoll",value:function(L){return this.setRoll(this.roll+L),this}},{key:"setAzimuth",value:function(L){return this.azimuth=zo(L),this.computeMatrix(),this._getAxes(),this.type===Ri.ORBITING||this.type===Ri.EXPLORING?this._getPosition():this.type===Ri.TRACKING&&this._getFocalPoint(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(L){return this.elevation=zo(L),this.computeMatrix(),this._getAxes(),this.type===Ri.ORBITING||this.type===Ri.EXPLORING?this._getPosition():this.type===Ri.TRACKING&&this._getFocalPoint(),this}},{key:"setRoll",value:function(L){return this.roll=zo(L),this.computeMatrix(),this._getAxes(),this.type===Ri.ORBITING||this.type===Ri.EXPLORING?this._getPosition():this.type===Ri.TRACKING&&this._getFocalPoint(),this}},{key:"rotate",value:function(L,X,K){if(this.type===Ri.EXPLORING){L=zo(L),X=zo(X),K=zo(K);var ve=zn.setAxisAngle(zn.create(),[1,0,0],(this.rotateWorld?1:-1)*X*Wo),Ce=zn.setAxisAngle(zn.create(),[0,1,0],(this.rotateWorld?1:-1)*L*Wo),Ue=zn.setAxisAngle(zn.create(),[0,0,1],K*Wo),nt=zn.multiply(zn.create(),Ce,ve);nt=zn.multiply(zn.create(),nt,Ue);var vt=In.fromQuat(In.create(),nt);In.translate(this.matrix,this.matrix,[0,0,-this.distance]),In.multiply(this.matrix,this.matrix,vt),In.translate(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation+X)>90)return;this.relElevation=zo(X),this.relAzimuth=zo(L),this.relRoll=zo(K),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.computeMatrix()}return this._getAxes(),this.type===Ri.ORBITING||this.type===Ri.EXPLORING?this._getPosition():this.type===Ri.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(L,X){var K=so(L,X,0),ve=ke.clone(this.position);return ke.add(ve,ve,ke.scale(ke.create(),this.right,K[0])),ke.add(ve,ve,ke.scale(ke.create(),this.up,K[1])),this._setPosition(ve),this}},{key:"dolly",value:function(L){var X=this.forward,K=ke.clone(this.position),ve=L*this.dollyingStep,Ce=this.distance+L*this.dollyingStep;return ve=Math.max(Math.min(Ce,this.maxDistance),this.minDistance)-this.distance,K[0]+=ve*X[0],K[1]+=ve*X[1],K[2]+=ve*X[2],this._setPosition(K),this.type===Ri.ORBITING||this.type===Ri.EXPLORING?this._getDistance():this.type===Ri.TRACKING&&ke.add(this.focalPoint,K,this.distanceVector),this}},{key:"createLandmark",value:function(L,X){var K=this.clone();K.setPosition(X.position),K.setFocalPoint(X.focalPoint),X.roll!==void 0&&K.setRoll(X.roll);var ve=new Cl(L,K);return this.landmarks.push(ve),ve}},{key:"setLandmark",value:function(L){var X=new Cl(L,this);return this.landmarks.push(X),this}},{key:"gotoLandmark",value:function(L){var X=this,K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e3,ve=this.landmarks.find(function(rr){return rr.name===L});if(ve){if(K===0){ve.retrieve(this);return}this.landmarkAnimationID!==void 0&&window.cancelAnimationFrame(this.landmarkAnimationID),this.interactor.disconnect();var Ce=ve.getPosition(),Ue=ve.getFocalPoint(),nt=ve.getRoll(),vt,_t=function rr(Mr){vt===void 0&&(vt=Mr);var Rr=Mr-vt,Cr=(1-Math.cos(Rr/K*Math.PI))/2,Dr=ke.create(),an=ke.create(),_n=0;ke.lerp(Dr,X.focalPoint,Ue,Cr),ke.lerp(an,X.position,Ce,Cr),_n=X.roll*(1-Cr)+nt*Cr,X.setFocalPoint(Dr),X.setPosition(an),X.setRoll(_n),X.computeMatrix();var An=ke.dist(Dr,Ue)+ke.dist(an,Ce);if(!(An>.01)){X.setFocalPoint(Dr),X.setPosition(an),X.setRoll(_n),X.computeMatrix(),X.interactor.connect();return}Rr<K&&(X.landmarkAnimationID=window.requestAnimationFrame(rr))};window.requestAnimationFrame(_t)}}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles()}},{key:"computeMatrix",value:function(){var L,X,K=zn.setAxisAngle(zn.create(),[0,0,1],this.roll*Wo);In.identity(this.matrix),L=zn.setAxisAngle(zn.create(),[1,0,0],(this.rotateWorld&&this.type!==Ri.TRACKING||this.type===Ri.TRACKING?1:-1)*this.elevation*Wo),X=zn.setAxisAngle(zn.create(),[0,1,0],(this.rotateWorld&&this.type!==Ri.TRACKING||this.type===Ri.TRACKING?1:-1)*this.azimuth*Wo);var ve=zn.multiply(zn.create(),X,L);ve=zn.multiply(zn.create(),ve,K);var Ce=In.fromQuat(In.create(),ve);this.type===Ri.ORBITING||this.type===Ri.EXPLORING?(In.translate(this.matrix,this.matrix,this.focalPoint),In.multiply(this.matrix,this.matrix,Ce),In.translate(this.matrix,this.matrix,[0,0,this.distance])):this.type===Ri.TRACKING&&(In.translate(this.matrix,this.matrix,this.position),In.multiply(this.matrix,this.matrix,Ce))}},{key:"_setPosition",value:function(L,X,K){this.position=so(L,X,K);var ve=this.matrix;ve[12]=this.position[0],ve[13]=this.position[1],ve[14]=this.position[2],ve[15]=1}},{key:"_getAxes",value:function(){ke.copy(this.right,so($t.transformMat4($t.create(),[1,0,0,0],this.matrix))),ke.copy(this.up,so($t.transformMat4($t.create(),[0,1,0,0],this.matrix))),ke.copy(this.forward,so($t.transformMat4($t.create(),[0,0,1,0],this.matrix))),ke.normalize(this.right,this.right),ke.normalize(this.up,this.up),ke.normalize(this.forward,this.forward)}},{key:"_getAngles",value:function(){var L=this.distanceVector[0],X=this.distanceVector[1],K=this.distanceVector[2],ve=ke.length(this.distanceVector);if(ve===0){this.elevation=0,this.azimuth=0;return}this.type===Ri.TRACKING?(this.elevation=Math.asin(X/ve)*ss,this.azimuth=Math.atan2(-L,-K)*ss):this.rotateWorld?(this.elevation=Math.asin(X/ve)*ss,this.azimuth=Math.atan2(-L,-K)*ss):(this.elevation=-Math.asin(X/ve)*ss,this.azimuth=-Math.atan2(-L,-K)*ss)}},{key:"_getPosition",value:function(){ke.copy(this.position,so($t.transformMat4($t.create(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){ke.transformMat3(this.distanceVector,[0,0,-this.distance],Ar.fromMat4(Ar.create(),this.matrix)),ke.add(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=ke.subtract(ke.create(),this.focalPoint,this.position),this.distance=ke.length(this.distanceVector),this.dollyingStep=this.distance/100}}]),b}(),Ou.ProjectionMode={ORTHOGRAPHIC:"ORTHOGRAPHIC",PERSPECTIVE:"PERSPECTIVE"},js),Gf=E(Ts.prototype,"interactor",[Vc],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ts))||Cs),dc,hc,Tl,Ff,Uf,us,Al,cs=(dc=(0,O.b2)(),hc=(0,O.f3)(D.GeometryComponentManager),dc(Tl=(Ff=(Al=us=function(){function b(){(0,B.Z)(this,b),this.config=void 0,S(this,"geometry",Uf,this),this.entity=void 0,this.component=void 0}return(0,N.Z)(b,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(L){this.config=L}},{key:"setEntity",value:function(L){this.entity=L,this.component=this.geometry.create(L),this.component.entity=L,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),b}(),us.BOX="box",us.SPHERE="sphere",us.PLANE="plane",us.MERGED="merged",Al),Uf=E(Ff.prototype,"geometry",[hc],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ff))||Tl),on=M(49469);function jo(){if(typeof document!="undefined")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}var id={}.toString,Zc=function(q,L){return id.call(q)==="[object "+L+"]"},ad=Zc,Eo=function(b){return Array.isArray?Array.isArray(b):ad(b,"Array")},Il=9007199254740991,Pl="[object Arguments]",od="[object Array]",Du="[object Boolean]",Vo="[object Date]",vc="[object Error]",sd="[object Function]",du="[object Map]",ln="[object Number]",ud="[object Object]",Nu="[object RegExp]",fs="[object Set]",ls="[object String]",zf="[object WeakMap]",hu="[object ArrayBuffer]",Wf="[object DataView]",Lu="[object Float32Array]",Ru="[object Float64Array]",pc="[object Int8Array]",Ol="[object Int16Array]",Dl="[object Int32Array]",Nl="[object Uint8Array]",jf="[object Uint8ClampedArray]",Vf="[object Uint16Array]",Xf="[object Uint32Array]",Wi={};Wi[Lu]=Wi[Ru]=Wi[pc]=Wi[Ol]=Wi[Dl]=Wi[Nl]=Wi[jf]=Wi[Vf]=Wi[Xf]=!0,Wi[Pl]=Wi[od]=Wi[hu]=Wi[Du]=Wi[Wf]=Wi[Vo]=Wi[vc]=Wi[sd]=Wi[du]=Wi[ln]=Wi[ud]=Wi[Nu]=Wi[fs]=Wi[ls]=Wi[zf]=!1;function Ll(b){return function(q){return b(q)}}var Yf=Object.prototype,gc=Yf.toString;function vu(b){return Bt(b)&&ka(b.length)&&!!Wi[gc.call(b)]}function ka(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=Il}function Bt(b){return!!b&&(0,Oe.Z)(b)==="object"}var Rl=vu,ku,Hc,kl,Zf,Kc,Bl,yc,$c;function Hf(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function Qc(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?Hf(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):Hf(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}var ha=(ku=(0,O.b2)(),Hc=(0,O.f3)(D.RenderEngine),kl=(0,O.f3)(D.ConfigService),ku(Zf=(Kc=($c=function(){function b(){(0,B.Z)(this,b),S(this,"engine",Bl,this),S(this,"configService",yc,this),this.entity=l(),this.model=void 0,this.dirty=!0,this.compiledBundle=void 0,this.initPromise=void 0}return(0,N.Z)(b,[{key:"init",value:function(){var L=this.configService.get(),X=L.canvas,K=L.engineOptions;this.initPromise=this.engine.init(Qc({canvas:X||jo(),swapChainFormat:on.EV.BGRA8Unorm,antialiasing:!1},K))}},{key:"setBundle",value:function(L){this.compiledBundle=JSON.parse(JSON.stringify(L))}},{key:"setDispatch",value:function(L){return this.compiledBundle.context&&(this.compiledBundle.context.dispatch=L),this}},{key:"setMaxIteration",value:function(L){return this.compiledBundle.context&&(this.compiledBundle.context.maxIteration=L),this}},{key:"setBinding",value:function(L,X){var K=this;if(typeof L=="string"){var ve=jc(X)||Rl(X)||Eo(X);if(this.compiledBundle&&this.compiledBundle.context){var Ce=this.compiledBundle.context.defines.find(function(nt){return nt.name===L});if(Ce)return Ce.value=X,this;var Ue=this.compiledBundle.context.uniforms.find(function(nt){return nt.name===L});Ue&&(ve?(Ue.data=X,Ue.isReferer=!1,Ue.storageClass===Uo.Uniform?this.model&&this.model.updateUniform(L,X):this.model&&this.model.updateBuffer(L,X)):(Ue.isReferer=!0,Ue.data=X))}}else Object.keys(L).forEach(function(nt){K.setBinding(nt,L[nt])});return this}},{key:"execute",value:function(){var q=(0,p.Z)(v().mark(function X(){var K=this,ve,Ce,Ue=arguments;return v().wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:if(ve=Ue.length>0&&Ue[0]!==void 0?Ue[0]:1,!this.dirty){vt.next=6;break}return this.compiledBundle.context&&(ve>1?this.compiledBundle.context.maxIteration=ve:this.compiledBundle.context.maxIteration++),vt.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(_t){var rr=_t.isReferer;return rr}).forEach(function(_t){var rr=_t.data,Mr=_t.name;K.model.confirmInput(rr.model,Mr)}),Ce=0;Ce<ve;Ce++)this.model.run();return this.engine.endFrame(),vt.abrupt("return",this);case 12:case"end":return vt.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"getOutput",value:function(){var q=(0,p.Z)(v().mark(function X(){return v().wrap(function(ve){for(;;)switch(ve.prev=ve.next){case 0:return ve.abrupt("return",this.model.readData());case 1:case"end":return ve.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"compile",value:function(){var q=(0,p.Z)(v().mark(function X(){var K,ve,Ce;return v().wrap(function(nt){for(;;)switch(nt.prev=nt.next){case 0:return nt.next=2,this.initPromise;case 2:return K=Qc({},this.compiledBundle.context),ve=this.engine.supportWebGPU?this.engine.useWGSL?Pu.WGSL:Pu.GLSL450:Pu.GLSL100,Ce=this.compiledBundle.shaders[ve],K.defines.filter(function(vt){return vt.runtime}).forEach(function(vt){var _t="".concat(lc).concat(vt.name);Ce=Ce.replace(_t,"".concat(vt.value))}),K.shader=Ce,K.uniforms.forEach(function(vt){if(!vt.data&&vt.storageClass===Uo.StorageBuffer){var _t=1;vt.type===Ws.FloatArray?_t=1:vt.type===Ws.Vector4FloatArray&&(_t=4),vt.data=new Float32Array(K.output.length*_t).fill(0)}}),this.compiledBundle.context=K,nt.next=11,this.engine.createComputeModel(this.compiledBundle.context);case 11:this.model=nt.sent;case 12:case"end":return nt.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()}]),b}(),$c),Bl=E(Kc.prototype,"engine",[Hc],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),yc=E(Kc.prototype,"configService",[kl],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Kc))||Zf),Bu,ia,Gu,Oo,As,Vs,Is,Xs=(Bu=(0,O.b2)(),ia=(0,O.f3)(D.MaterialComponentManager),Bu(Gu=(Oo=(Is=Vs=function(){function b(){(0,B.Z)(this,b),this.config=void 0,S(this,"material",As,this),this.entity=void 0,this.component=void 0}return(0,N.Z)(b,[{key:"getEntity",value:function(){return this.entity}},{key:"getComponent",value:function(){return this.component}},{key:"setConfig",value:function(L){this.config=L}},{key:"setEntity",value:function(L,X){this.entity=L,this.component=this.material.create(L),this.component.entity=L,this.component.type=X,this.onEntityCreated()}},{key:"onEntityCreated",value:function(){}}]),b}(),Vs.BASIC="basic",Is),As=E(Oo.prototype,"material",[ia],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Oo))||Gu),Ps,ai,uo,Os,mc,Fu,Jc,Ys,ti,_o,pu,qc,gu,ef,Xo=(Ps=(0,O.b2)(),ai=(0,O.f3)(D.MeshComponentManager),uo=(0,O.f3)(D.CullableComponentManager),Os=(0,O.f3)(D.TransformComponentManager),mc=(0,O.f3)(D.Systems),Fu=(0,O.t6)(D.SceneGraphSystem),Ps(Jc=(Ys=(ef=gu=function(){function b(){(0,B.Z)(this,b),this.attributes={},this.config=void 0,S(this,"mesh",ti,this),S(this,"cullable",_o,this),S(this,"transform",pu,this),S(this,"sceneGraphSystem",qc,this),this.meshComponent=void 0,this.transformComponent=void 0,this.entity=void 0}return(0,N.Z)(b,[{key:"getEntity",value:function(){return this.entity}},{key:"getTransformComponent",value:function(){return this.transformComponent}},{key:"getMeshComponent",value:function(){return this.meshComponent}},{key:"setConfig",value:function(L){this.config=L}},{key:"setEntity",value:function(L){this.entity=L,this.cullable.create(L),this.meshComponent=this.mesh.create(L),this.transformComponent=this.transform.create(L),this.onEntityCreated()}},{key:"setMaterial",value:function(L){return this.meshComponent.material=L,this}},{key:"setGeometry",value:function(L){return this.meshComponent.geometry=L,this}},{key:"setAttributes",value:function(L){var X=this;Object.keys(L).forEach(function(K){L[K]!==void 0&&L[K]!==X.attributes[K]&&(X.onAttributeChanged({name:K,data:L[K]}),X.attributes[K]=L[K])})}},{key:"setVisible",value:function(L){var X=this;return this.meshComponent.visible=L,this.meshComponent.children.forEach(function(K){var ve=X.mesh.getComponentByEntity(K);ve&&(ve.visible=L)}),this}},{key:"isVisible",value:function(){return this.meshComponent.visible}},{key:"attach",value:function(L){return this.sceneGraphSystem.attach(this.entity,L.entity),this}},{key:"detach",value:function(){return this.sceneGraphSystem.detach(this.entity),this}},{key:"detachChildren",value:function(){return this.sceneGraphSystem.detachChildren(this.entity),this}},{key:"onEntityCreated",value:function(){}},{key:"onAttributeChanged",value:function(L){var X=L.name,K=L.data;this.meshComponent&&this.meshComponent.material&&this.meshComponent.material.setUniform(this.convertAttributeName2UniformName(X),K)}},{key:"convertAttributeName2UniformName",value:function(L){return L}}]),b}(),gu.POINT="point",gu.LINE="line",gu.GRID="grid",ef),ti=E(Ys.prototype,"mesh",[ai],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),_o=E(Ys.prototype,"cullable",[uo],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),pu=E(Ys.prototype,"transform",[Os],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),qc=E(Ys.prototype,"sceneGraphSystem",[mc,Fu],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ys))||Jc),Gl=M(81550),yu=M.n(Gl),Fl=function(){function b(q,L){(0,B.Z)(this,b),this.attribute=void 0,this.buffer=void 0;var X=L.buffer,K=L.offset,ve=L.stride,Ce=L.normalized,Ue=L.size,nt=L.divisor;this.buffer=X,this.attribute={buffer:X.get(),offset:K||0,stride:ve||0,normalized:Ce||!1,divisor:nt||0},Ue&&(this.attribute.size=Ue)}return(0,N.Z)(b,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(L){this.buffer.subData(L)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),b}(),ds,Uu,hs,va,bc,Ds,zu,tf,Yo,Zs,Ba,Ja,co,Ns,Ec=(ds={},(0,Fe.Z)(ds,bt.POINTS,"points"),(0,Fe.Z)(ds,bt.LINES,"lines"),(0,Fe.Z)(ds,bt.LINE_LOOP,"line loop"),(0,Fe.Z)(ds,bt.LINE_STRIP,"line strip"),(0,Fe.Z)(ds,bt.TRIANGLES,"triangles"),(0,Fe.Z)(ds,bt.TRIANGLE_FAN,"triangle fan"),(0,Fe.Z)(ds,bt.TRIANGLE_STRIP,"triangle strip"),ds),Hs=(Uu={},(0,Fe.Z)(Uu,bt.STATIC_DRAW,"static"),(0,Fe.Z)(Uu,bt.DYNAMIC_DRAW,"dynamic"),(0,Fe.Z)(Uu,bt.STREAM_DRAW,"stream"),Uu),Wu=(hs={},(0,Fe.Z)(hs,bt.BYTE,"int8"),(0,Fe.Z)(hs,bt.UNSIGNED_INT,"int16"),(0,Fe.Z)(hs,bt.INT,"int32"),(0,Fe.Z)(hs,bt.UNSIGNED_BYTE,"uint8"),(0,Fe.Z)(hs,bt.UNSIGNED_SHORT,"uint16"),(0,Fe.Z)(hs,bt.UNSIGNED_INT,"uint32"),(0,Fe.Z)(hs,bt.FLOAT,"float"),hs),Kf=(va={},(0,Fe.Z)(va,bt.ALPHA,"alpha"),(0,Fe.Z)(va,bt.LUMINANCE,"luminance"),(0,Fe.Z)(va,bt.LUMINANCE_ALPHA,"luminance alpha"),(0,Fe.Z)(va,bt.RGB,"rgb"),(0,Fe.Z)(va,bt.RGBA,"rgba"),(0,Fe.Z)(va,bt.RGBA4,"rgba4"),(0,Fe.Z)(va,bt.RGB5_A1,"rgb5 a1"),(0,Fe.Z)(va,bt.RGB565,"rgb565"),(0,Fe.Z)(va,bt.DEPTH_COMPONENT,"depth"),(0,Fe.Z)(va,bt.DEPTH_STENCIL,"depth stencil"),va),rf=(bc={},(0,Fe.Z)(bc,bt.DONT_CARE,"dont care"),(0,Fe.Z)(bc,bt.NICEST,"nice"),(0,Fe.Z)(bc,bt.FASTEST,"fast"),bc),_c=(Ds={},(0,Fe.Z)(Ds,bt.NEAREST,"nearest"),(0,Fe.Z)(Ds,bt.LINEAR,"linear"),(0,Fe.Z)(Ds,bt.LINEAR_MIPMAP_LINEAR,"mipmap"),(0,Fe.Z)(Ds,bt.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),(0,Fe.Z)(Ds,bt.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),(0,Fe.Z)(Ds,bt.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),Ds),Ks=(zu={},(0,Fe.Z)(zu,bt.REPEAT,"repeat"),(0,Fe.Z)(zu,bt.CLAMP_TO_EDGE,"clamp"),(0,Fe.Z)(zu,bt.MIRRORED_REPEAT,"mirror"),zu),$f=(tf={},(0,Fe.Z)(tf,bt.NONE,"none"),(0,Fe.Z)(tf,bt.BROWSER_DEFAULT_WEBGL,"browser"),tf),nf=(Yo={},(0,Fe.Z)(Yo,bt.NEVER,"never"),(0,Fe.Z)(Yo,bt.ALWAYS,"always"),(0,Fe.Z)(Yo,bt.LESS,"less"),(0,Fe.Z)(Yo,bt.LEQUAL,"lequal"),(0,Fe.Z)(Yo,bt.GREATER,"greater"),(0,Fe.Z)(Yo,bt.GEQUAL,"gequal"),(0,Fe.Z)(Yo,bt.EQUAL,"equal"),(0,Fe.Z)(Yo,bt.NOTEQUAL,"notequal"),Yo),xc=(Zs={},(0,Fe.Z)(Zs,bt.FUNC_ADD,"add"),(0,Fe.Z)(Zs,bt.MIN_EXT,"min"),(0,Fe.Z)(Zs,bt.MAX_EXT,"max"),(0,Fe.Z)(Zs,bt.FUNC_SUBTRACT,"subtract"),(0,Fe.Z)(Zs,bt.FUNC_REVERSE_SUBTRACT,"reverse subtract"),Zs),Di=(Ba={},(0,Fe.Z)(Ba,bt.ZERO,"zero"),(0,Fe.Z)(Ba,bt.ONE,"one"),(0,Fe.Z)(Ba,bt.SRC_COLOR,"src color"),(0,Fe.Z)(Ba,bt.ONE_MINUS_SRC_COLOR,"one minus src color"),(0,Fe.Z)(Ba,bt.SRC_ALPHA,"src alpha"),(0,Fe.Z)(Ba,bt.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),(0,Fe.Z)(Ba,bt.DST_COLOR,"dst color"),(0,Fe.Z)(Ba,bt.ONE_MINUS_DST_COLOR,"one minus dst color"),(0,Fe.Z)(Ba,bt.DST_ALPHA,"dst alpha"),(0,Fe.Z)(Ba,bt.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),(0,Fe.Z)(Ba,bt.CONSTANT_COLOR,"constant color"),(0,Fe.Z)(Ba,bt.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),(0,Fe.Z)(Ba,bt.CONSTANT_ALPHA,"constant alpha"),(0,Fe.Z)(Ba,bt.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),(0,Fe.Z)(Ba,bt.SRC_ALPHA_SATURATE,"src alpha saturate"),Ba),ju=(Ja={},(0,Fe.Z)(Ja,bt.NEVER,"never"),(0,Fe.Z)(Ja,bt.ALWAYS,"always"),(0,Fe.Z)(Ja,bt.LESS,"less"),(0,Fe.Z)(Ja,bt.LEQUAL,"lequal"),(0,Fe.Z)(Ja,bt.GREATER,"greater"),(0,Fe.Z)(Ja,bt.GEQUAL,"gequal"),(0,Fe.Z)(Ja,bt.EQUAL,"equal"),(0,Fe.Z)(Ja,bt.NOTEQUAL,"notequal"),Ja),vs=(co={},(0,Fe.Z)(co,bt.ZERO,"zero"),(0,Fe.Z)(co,bt.KEEP,"keep"),(0,Fe.Z)(co,bt.REPLACE,"replace"),(0,Fe.Z)(co,bt.INVERT,"invert"),(0,Fe.Z)(co,bt.INCR,"increment"),(0,Fe.Z)(co,bt.DECR,"decrement"),(0,Fe.Z)(co,bt.INCR_WRAP,"increment wrap"),(0,Fe.Z)(co,bt.DECR_WRAP,"decrement wrap"),co),Vu=(Ns={},(0,Fe.Z)(Ns,bt.FRONT,"front"),(0,Fe.Z)(Ns,bt.BACK,"back"),Ns),Xu=function(){function b(q,L){(0,B.Z)(this,b),this.buffer=void 0;var X=L.data,K=L.usage,ve=L.type;this.buffer=q.buffer({data:X,usage:Hs[K||bt.STATIC_DRAW],type:Wu[ve||bt.UNSIGNED_BYTE]})}return(0,N.Z)(b,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(L){var X=L.data,K=L.offset;this.buffer.subdata(X,K)}}]),b}(),Yi=M(85061),Ul=9007199254740991,Sc="[object Arguments]",mu="[object Array]",Qn="[object Boolean]",af="[object Date]",fo="[object Error]",cd="[object Function]",zl="[object Map]",$s="[object Number]",Wl="[object Object]",jl="[object RegExp]",Yu="[object Set]",fd="[object String]",Vl="[object WeakMap]",ld="[object ArrayBuffer]",Ua="[object DataView]",of="[object Float32Array]",bu="[object Float64Array]",Qs="[object Int8Array]",Xl="[object Int16Array]",Qf="[object Int32Array]",sf="[object Uint8Array]",Jf="[object Uint8ClampedArray]",ro="[object Uint16Array]",Js="[object Uint32Array]",oi={};oi[of]=oi[bu]=oi[Qs]=oi[Xl]=oi[Qf]=oi[sf]=oi[Jf]=oi[ro]=oi[Js]=!0,oi[Sc]=oi[mu]=oi[ld]=oi[Qn]=oi[Ua]=oi[af]=oi[fo]=oi[cd]=oi[zl]=oi[$s]=oi[Wl]=oi[jl]=oi[Yu]=oi[fd]=oi[Vl]=!1;function Ji(b){return function(q){return b(q)}}var uf=Object.prototype,Yl=uf.toString;function Zl(b){return hd(b)&&dd(b.length)&&!!oi[Yl.call(b)]}function dd(b){return typeof b=="number"&&b>-1&&b%1==0&&b<=Ul}function hd(b){return!!b&&(0,Oe.Z)(b)==="object"}var Zu=Zl;function wc(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function qf(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?wc(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):wc(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}var vd=`attribute vec3 a_Position;
  380. attribute vec2 a_TexCoord;
  381. varying vec2 v_TexCoord;
  382. void main() {
  383. gl_Position = vec4(a_Position, 1.0);
  384. v_TexCoord = a_TexCoord;
  385. }`,Hl=0,Mc=!1,cf=function(){function b(q,L){var X=this;(0,B.Z)(this,b),this.reGl=q,this.context=L,this.entity=l(),this.texFBO=void 0,this.computeCommand=void 0,this.textureCache={},this.outputTextureName=void 0,this.swapOutputTextureName=void 0,this.compiledPingpong=void 0,this.dynamicPingpong=void 0;var K={};this.context.uniforms.forEach(function(vt){var _t=vt.name,rr=vt.type,Mr=vt.data,Rr=vt.isReferer,Cr=vt.storageClass;if(Cr===Uo.StorageBuffer){if(Rr)X.textureCache[_t]={data:void 0},K["".concat(_t,"Size")]=function(){return Mr.compiledBundle.context.output.textureSize};else{X.textureCache[_t]=X.calcDataTexture(_t,rr,Mr);var Dr=X.textureCache[_t],an=Dr.textureWidth,_n=Dr.isOutput;K["".concat(_t,"Size")]=[an,an],_n&&(X.outputTextureName=_t,X.context.needPingpong&&(X.outputTextureName="".concat(_t,"Output"),X.textureCache[X.outputTextureName]=X.calcDataTexture(_t,rr,Mr)))}K[_t]=function(){return Mc&&console.log("[".concat(X.entity,"]: ").concat(_t," ").concat(X.textureCache[_t].id)),X.textureCache[_t].texture}}else if(Cr===Uo.Uniform){if(Mr&&(Array.isArray(Mr)||Zu(Mr))&&Mr.length>16)throw new Error("invalid data type ".concat(rr));K[_t]=function(){return vt.data}}});var ve=this.getOuputDataTexture(),Ce=ve.textureWidth,Ue=ve.texelCount;K.u_OutputTextureSize=[Ce,Ce],K.u_OutputTexelCount=Ue,this.context.output.textureSize=[Ce,Ce];var nt={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
  386. precision highp float;
  387. #else
  388. precision mediump float;
  389. #endif
  390. `.concat(this.context.shader),uniforms:K,vert:vd,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(nt)}return(0,N.Z)(b,[{key:"run",value:function(){var L=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(){L.computeCommand()}),Mc&&console.log("[".concat(this.entity,"]: output ").concat(this.getOuputDataTexture().id))}},{key:"readData",value:function(){var q=(0,p.Z)(v().mark(function X(){var K=this,ve,Ce,Ue,nt,vt,_t,rr,Mr;return v().wrap(function(Cr){for(;;)switch(Cr.prev=Cr.next){case 0:if(this.reGl({framebuffer:this.texFBO})(function(){ve=K.reGl.read()}),!ve){Cr.next=6;break}if(Ce=this.getOuputDataTexture(),Ue=Ce.originalDataLength,nt=Ce.elementsPerTexel,vt=Ce.typedArrayConstructor,_t=vt===void 0?Float32Array:vt,rr=[],nt!==4)for(Mr=0;Mr<ve.length;Mr+=4)nt===1?rr.push(ve[Mr]):nt===2?rr.push(ve[Mr],ve[Mr+1]):rr.push(ve[Mr],ve[Mr+1],ve[Mr+2]);else rr=ve;return Cr.abrupt("return",new _t(rr.slice(0,Ue)));case 6:return Cr.abrupt("return",new Float32Array);case 7:case"end":return Cr.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"confirmInput",value:function(L,X){var K;this.entity===L.entity?(this.dynamicPingpong=!0,K=this):K=L,this.textureCache[X].id=K.getOuputDataTexture().id,this.textureCache[X].texture=K.getOuputDataTexture().texture,Mc&&console.log("[".concat(this.entity,"]: confirm input ").concat(X," from model ").concat(K.entity,", ").concat(K.getOuputDataTexture().id))}},{key:"updateUniform",value:function(){}},{key:"updateBuffer",value:function(L,X){var K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,ve=this.context.uniforms.find(function(vt){var _t=vt.name;return _t===L});if(ve){var Ce=this.calcDataTexture(L,ve.type,X),Ue=Ce.texture,nt=Ce.data;this.textureCache[L].data=nt,this.textureCache[L].texture=Ue}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var L=this.context.output.name;this.textureCache[L].id=this.getOuputDataTexture().id,this.textureCache[L].texture=this.getOuputDataTexture().texture}var X=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=X,Mc&&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 L=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=L}},{key:"cloneDataTexture",value:function(L){var X=L.data,K=L.textureWidth;return qf(qf({},L),{},{id:Hl++,texture:this.reGl.texture({width:K,height:K,data:X,type:"float"})})}},{key:"calcDataTexture",value:function(L,X,K){var ve=1;X===Ws.Vector4FloatArray&&(ve=4);for(var Ce=[],Ue=0;Ue<K.length;Ue+=ve)ve===1?Ce.push(K[Ue],0,0,0):ve===2?Ce.push(K[Ue],K[Ue+1],0,0):ve===3?Ce.push(K[Ue],K[Ue+1],K[Ue+2],0):ve===4&&Ce.push(K[Ue],K[Ue+1],K[Ue+2],K[Ue+3]);var nt=K.length,vt=Math.ceil(nt/ve),_t=Math.ceil(Math.sqrt(vt)),rr=_t*_t;vt<rr&&Ce.push.apply(Ce,(0,Yi.Z)(new Array((rr-vt)*4).fill(0)));var Mr=this.reGl.texture({width:_t,height:_t,data:Ce,type:"float"});return{id:Hl++,data:Ce,originalDataLength:nt,typedArrayConstructor:Zu(K)?K.constructor:void 0,textureWidth:_t,texture:Mr,texelCount:vt,elementsPerTexel:ve,isOutput:L===this.context.output.name}}}]),b}(),ff=function(){function b(q,L){(0,B.Z)(this,b),this.elements=void 0;var X=L.data,K=L.usage,ve=L.type,Ce=L.count;this.elements=q.elements({data:X,usage:Hs[K||bt.STATIC_DRAW],type:Wu[ve||bt.UNSIGNED_BYTE],count:Ce})}return(0,N.Z)(b,[{key:"get",value:function(){return this.elements}},{key:"subData",value:function(L){var X=L.data;this.elements.subdata(X)}},{key:"destroy",value:function(){this.elements.destroy()}}]),b}(),Kl=function(){function b(q,L){(0,B.Z)(this,b),this.framebuffer=void 0;var X=L.width,K=L.height,ve=L.color,Ce=L.colors,Ue=L.depth,nt=L.stencil,vt={width:X,height:K};Array.isArray(Ce)&&(vt.colors=Ce.map(function(_t){return _t.get()})),ve&&typeof ve!="boolean"&&(vt.color=ve.get()),this.framebuffer=q.framebuffer(vt)}return(0,N.Z)(b,[{key:"get",value:function(){return this.framebuffer}},{key:"destroy",value:function(){this.framebuffer.destroy()}},{key:"resize",value:function(L){var X=L.width,K=L.height;this.framebuffer.resize(X,K)}}]),b}();function pd(b){var q=(0,Oe.Z)(b);return b!=null&&(q==="object"||q==="function")}function Hu(b){var q={};return Object.keys(b).forEach(function(L){lf(L,b[L],q,"")}),q}function lf(b,q,L,X){if(q===null||typeof q=="number"||typeof q=="boolean"||Array.isArray(q)&&typeof q[0]=="number"||Zu(q)||q===""||q.resize!==void 0){L["".concat(X&&X+".").concat(b)]=q;return}pd(q)&&Object.keys(q).forEach(function(K){lf(K,q[K],L,"".concat(X&&X+".").concat(b))}),Array.isArray(q)&&q.forEach(function(K,ve){Object.keys(K).forEach(function(Ce){lf(Ce,K[Ce],L,"".concat(X&&X+".").concat(b,"[").concat(ve,"]"))})})}function Cc(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function ge(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?Cc(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):Cc(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}var tt=function(){function b(q,L){(0,B.Z)(this,b),this.reGl=void 0,this.drawCommand=void 0,this.uniforms={},this.reGl=q;var X=L.vs,K=L.fs,ve=L.defines,Ce=L.attributes,Ue=L.uniforms,nt=L.primitive,vt=L.count,_t=L.elements,rr=L.depth,Mr=L.blend,Rr=L.stencil,Cr=L.cull,Dr=L.instances,an=L.scissor,_n=L.viewport,An={};Ue&&(this.uniforms=Hu(Ue),Object.keys(Ue).forEach(function(mi){An[mi]=q.prop(mi)}));var vn={};Object.keys(Ce).forEach(function(mi){vn[mi]=Ce[mi].get()});var ei=ve&&this.generateDefines(ve)||"",Gn={attributes:vn,frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH
  391. precision highp float;
  392. #else
  393. precision mediump float;
  394. #endif
  395. `.concat(ei,`
  396. `).concat(K),uniforms:An,vert:`
  397. `.concat(ei,`
  398. `).concat(X),primitive:Ec[nt===void 0?bt.TRIANGLES:nt]};Dr&&(Gn.instances=Dr),vt&&(Gn.count=vt),_t&&(Gn.elements=_t.get()),an&&(Gn.scissor=an),_n&&(Gn.viewport=_n),this.initDepthDrawParams({depth:rr},Gn),this.initBlendDrawParams({blend:Mr},Gn),this.initStencilDrawParams({stencil:Rr},Gn),this.initCullDrawParams({cull:Cr},Gn),this.drawCommand=q(Gn)}return(0,N.Z)(b,[{key:"addUniforms",value:function(L){this.uniforms=ge(ge({},this.uniforms),Hu(L))}},{key:"draw",value:function(L){var X=ge(ge({},this.uniforms),Hu(L.uniforms||{})),K={};Object.keys(X).forEach(function(ve){var Ce=(0,Oe.Z)(X[ve]);Ce==="boolean"||Ce==="number"||Array.isArray(X[ve])||X[ve].BYTES_PER_ELEMENT?K[ve]=X[ve]:Ce==="string"||(K[ve]=X[ve].get())}),this.drawCommand(K)}},{key:"destroy",value:function(){}},{key:"initDepthDrawParams",value:function(L,X){var K=L.depth;K&&(X.depth={enable:K.enable===void 0?!0:!!K.enable,mask:K.mask===void 0?!0:!!K.mask,func:nf[K.func||bt.LESS],range:K.range||[0,1]})}},{key:"initBlendDrawParams",value:function(L,X){var K=L.blend;if(K){var ve=K.enable,Ce=K.func,Ue=K.equation,nt=K.color,vt=nt===void 0?[0,0,0,0]:nt;X.blend={enable:!!ve,func:{srcRGB:Di[Ce&&Ce.srcRGB||bt.SRC_ALPHA],srcAlpha:Di[Ce&&Ce.srcAlpha||bt.SRC_ALPHA],dstRGB:Di[Ce&&Ce.dstRGB||bt.ONE_MINUS_SRC_ALPHA],dstAlpha:Di[Ce&&Ce.dstAlpha||bt.ONE_MINUS_SRC_ALPHA]},equation:{rgb:xc[Ue&&Ue.rgb||bt.FUNC_ADD],alpha:xc[Ue&&Ue.alpha||bt.FUNC_ADD]},color:vt}}}},{key:"initStencilDrawParams",value:function(L,X){var K=L.stencil;if(K){var ve=K.enable,Ce=K.mask,Ue=Ce===void 0?-1:Ce,nt=K.func,vt=nt===void 0?{cmp:bt.ALWAYS,ref:0,mask:-1}:nt,_t=K.opFront,rr=_t===void 0?{fail:bt.KEEP,zfail:bt.KEEP,zpass:bt.KEEP}:_t,Mr=K.opBack,Rr=Mr===void 0?{fail:bt.KEEP,zfail:bt.KEEP,zpass:bt.KEEP}:Mr;X.stencil={enable:!!ve,mask:Ue,func:ge(ge({},vt),{},{cmp:ju[vt.cmp]}),opFront:{fail:vs[rr.fail],zfail:vs[rr.zfail],zpass:vs[rr.zpass]},opBack:{fail:vs[Rr.fail],zfail:vs[Rr.zfail],zpass:vs[Rr.zpass]}}}}},{key:"initCullDrawParams",value:function(L,X){var K=L.cull;if(K){var ve=K.enable,Ce=K.face,Ue=Ce===void 0?bt.BACK:Ce;X.cull={enable:!!ve,face:Vu[Ue]}}}},{key:"generateDefines",value:function(L){return Object.keys(L).map(function(X){return"#define ".concat(X," ").concat(Number(L[X]))}).join(`
  399. `)}}]),b}(),Et=function(){function b(q,L){(0,B.Z)(this,b),this.texture=void 0,this.width=void 0,this.height=void 0;var X=L.data,K=L.type,ve=K===void 0?bt.UNSIGNED_BYTE:K,Ce=L.width,Ue=L.height,nt=L.flipY,vt=nt===void 0?!1:nt,_t=L.format,rr=_t===void 0?bt.RGBA:_t,Mr=L.mipmap,Rr=Mr===void 0?!1:Mr,Cr=L.wrapS,Dr=Cr===void 0?bt.CLAMP_TO_EDGE:Cr,an=L.wrapT,_n=an===void 0?bt.CLAMP_TO_EDGE:an,An=L.aniso,vn=An===void 0?0:An,ei=L.alignment,Gn=ei===void 0?1:ei,mi=L.premultiplyAlpha,si=mi===void 0?!1:mi,ni=L.mag,oa=ni===void 0?bt.NEAREST:ni,Ma=L.min,Na=Ma===void 0?bt.NEAREST:Ma,$i=L.colorSpace,Ca=$i===void 0?bt.BROWSER_DEFAULT_WEBGL:$i;this.width=Ce,this.height=Ue;var sa={width:Ce,height:Ue,type:Wu[ve],format:Kf[rr],wrapS:Ks[Dr],wrapT:Ks[_n],mag:_c[oa],min:_c[Na],alignment:Gn,flipY:vt,colorSpace:$f[Ca],premultiplyAlpha:si,aniso:vn};X&&(sa.data=X),typeof Rr=="number"?sa.mipmap=rf[Rr]:typeof Rr=="boolean"&&(sa.mipmap=Rr),this.texture=q.texture(sa)}return(0,N.Z)(b,[{key:"get",value:function(){return this.texture}},{key:"update",value:function(){this.texture._texture.bind()}},{key:"resize",value:function(L){var X=L.width,K=L.height;this.texture.resize(X,K),this.width=X,this.height=K}},{key:"destroy",value:function(){this.texture.destroy()}}]),b}(),gr,Nr,pr,_r=(gr=(0,O.b2)(),gr(Nr=(pr=function(){function b(){var q=this;(0,B.Z)(this,b),this.supportWebGPU=!1,this.useWGSL=!1,this.$canvas=void 0,this.gl=void 0,this.inited=void 0,this.createModel=function(){var L=(0,p.Z)(v().mark(function X(K){return v().wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:if(!K.uniforms){Ce.next=3;break}return Ce.next=3,Promise.all(Object.keys(K.uniforms).map(function(){var Ue=(0,p.Z)(v().mark(function nt(vt){var _t;return v().wrap(function(Mr){for(;;)switch(Mr.prev=Mr.next){case 0:if(!(K.uniforms[vt]&&K.uniforms[vt].load!==void 0)){Mr.next=5;break}return Mr.next=3,K.uniforms[vt].load();case 3:_t=Mr.sent,K.uniforms[vt]=_t;case 5:case"end":return Mr.stop()}},nt)}));return function(nt){return Ue.apply(this,arguments)}}()));case 3:return Ce.abrupt("return",new tt(q.gl,K));case 4:case"end":return Ce.stop()}},X)}));return function(X){return L.apply(this,arguments)}}(),this.createAttribute=function(L){return new Fl(q.gl,L)},this.createBuffer=function(L){return new Xu(q.gl,L)},this.createElements=function(L){return new ff(q.gl,L)},this.createTexture2D=function(L){return new Et(q.gl,L)},this.createFramebuffer=function(L){return new Kl(q.gl,L)},this.useFramebuffer=function(L,X){q.gl({framebuffer:L?L.get():null})(X)},this.createComputeModel=function(){var L=(0,p.Z)(v().mark(function X(K){return v().wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:return Ce.abrupt("return",new cf(q.gl,K));case 1:case"end":return Ce.stop()}},X)}));return function(X){return L.apply(this,arguments)}}(),this.clear=function(L){var X=L.color,K=L.depth,ve=L.stencil,Ce=L.framebuffer,Ue=Ce===void 0?null:Ce,nt={color:X,depth:K,stencil:ve};nt.framebuffer=Ue===null?Ue:Ue.get(),q.gl.clear(nt)},this.setScissor=function(L){q.gl&&q.gl._gl&&(L.enable&&L.box?(q.gl._gl.enable(bt.SCISSOR_TEST),q.gl._gl.scissor(L.box.x,L.box.y,L.box.width,L.box.height)):q.gl._gl.disable(bt.SCISSOR_TEST),q.gl._refresh())},this.viewport=function(L){var X=L.x,K=L.y,ve=L.width,Ce=L.height;q.gl&&q.gl._gl&&(q.gl._gl.viewport(X,K,ve,Ce),q.gl._refresh())},this.readPixels=function(L){var X=L.framebuffer,K=L.x,ve=L.y,Ce=L.width,Ue=L.height,nt={x:K,y:ve,width:Ce,height:Ue};return X&&(nt.framebuffer=X.get()),q.gl.read(nt)},this.getCanvas=function(){return q.$canvas},this.getGLContext=function(){return q.gl._gl},this.destroy=function(){q.gl&&(q.gl.destroy(),q.inited=!1)}}return(0,N.Z)(b,[{key:"init",value:function(){var q=(0,p.Z)(v().mark(function X(K){return v().wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:if(!this.inited){Ce.next=2;break}return Ce.abrupt("return");case 2:return this.$canvas=K.canvas,Ce.next=5,new Promise(function(Ue,nt){yu()({canvas:K.canvas,attributes:{alpha:!0,antialias:K.antialias,premultipliedAlpha:!0},pixelRatio:1,extensions:["OES_element_index_uint","OES_texture_float","OES_standard_derivatives","angle_instanced_arrays"],optionalExtensions:["EXT_texture_filter_anisotropic","EXT_blend_minmax","WEBGL_depth_texture"],profile:!0,onDone:function(_t,rr){(_t||!rr)&&nt(_t),Ue(rr)}})});case 5:this.gl=Ce.sent,this.inited=!0;case 7:case"end":return Ce.stop()}},X,this)}));function L(X){return q.apply(this,arguments)}return L}()},{key:"isFloatSupported",value:function(){return this.gl.limits.readFloat}},{key:"beginFrame",value:function(){}},{key:"endFrame",value:function(){}}]),b}(),pr))||Nr);function Wr(){return typeof window!="undefined"}function Zr(b,q,L,X){if(!!Wr()){var K=document.getElementsByTagName("head")[0],ve=document.createElement("script");ve.setAttribute("type","text/javascript"),ve.setAttribute("src",b),X&&(ve.id=X),ve.onload=function(){q&&q()},ve.onerror=function(Ce){L&&L("Unable to load script '".concat(b,"'"),Ce)},K.appendChild(ve)}}function Hr(b,q){return new Promise(function(L,X){Zr(b,function(){L()},function(K,ve){X(ve)})})}var zr;function qr(){return u.apply(this,arguments)}function u(){return u=(0,p.Z)(v().mark(function b(){return v().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(!zr){L.next=2;break}return L.abrupt("return",zr);case 2:return L.next=4,Hr("https://preview.babylonjs.com/glslang/glslang.js");case 4:return zr=window.glslang("https://preview.babylonjs.com/glslang/glslang.wasm"),L.abrupt("return",zr);case 6:case"end":return L.stop()}},b)})),u.apply(this,arguments)}var P=function(){function b(q,L){(0,B.Z)(this,b),this.engine=q,this.options=L,this.attribute=void 0,this.buffer=void 0;var X=L,K=X.buffer,ve=X.offset,Ce=X.stride,Ue=X.normalized,nt=X.size,vt=X.divisor,_t=X.arrayStride,rr=X.attributes,Mr=X.stepMode;this.buffer=K,this.attribute={buffer:K.get(),offset:ve||0,stride:Ce||0,normalized:Ue||!1,divisor:vt||0,arrayStride:_t||0,attributes:rr,stepMode:Mr||"vertex"},nt&&(this.attribute.size=nt)}return(0,N.Z)(b,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(L){this.buffer.subData(L)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),b}(),W=function(){function b(q,L){(0,B.Z)(this,b),this.engine=q,this.options=L,this.buffer=void 0;var X=L,K=X.data,ve=X.usage,Ce=X.type;this.buffer=this.createBuffer(K instanceof Array?new Float32Array(K):K,ve||on.FB.Vertex|on.FB.CopyDst)}return(0,N.Z)(b,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){this.buffer.destroy()}},{key:"subData",value:function(L){var X=L.data,K=L.offset;this.setSubData(this.buffer,K,X instanceof Array?new Float32Array(X):X)}},{key:"createBuffer",value:function(L,X){var K=L.byteLength%4,ve={size:L.byteLength+K,usage:X},Ce=this.engine.device.createBuffer(ve);return this.setSubData(Ce,0,L),Ce}},{key:"setSubData",value:function(L,X,K){var ve=wa?this.engine.device.getQueue():this.engine.device.defaultQueue;ve.writeBuffer(L,X,K)}}]),b}();function $(b){return typeof b=="number"}var oe=function(){function b(q,L){(0,B.Z)(this,b),this.engine=q,this.context=L,this.entity=l(),this.uniformGPUBufferLayout=[],this.uniformBuffer=void 0,this.vertexBuffers={},this.outputBuffer=void 0,this.bindGroupEntries=void 0,this.bindGroup=void 0,this.computePipeline=void 0}return(0,N.Z)(b,[{key:"init",value:function(){var q=(0,p.Z)(v().mark(function X(){var K=this,ve,Ce,Ue,nt,vt,_t,rr;return v().wrap(function(Rr){for(;;)switch(Rr.prev=Rr.next){case 0:return Rr.next=2,this.compileComputePipelineStageDescriptor(this.context.shader);case 2:ve=Rr.sent,Ce=ve.computeStage,Ue=this.context.uniforms.filter(function(Cr){return Cr.storageClass===Uo.StorageBuffer}),nt=this.context.uniforms.filter(function(Cr){return Cr.storageClass===Uo.Uniform}),vt=nt.length?1:0,this.bindGroupEntries=[],vt&&(_t=0,rr=[],nt.forEach(function(Cr){if($(Cr.data))K.uniformGPUBufferLayout.push({name:Cr.name,offset:_t}),_t+=4,rr.push(Cr.data);else{var Dr,an=((Dr=Cr.data)===null||Dr===void 0?void 0:Dr.length)||1;an===3&&(an=4,Cr.data.push(0));var _n=_t/4%4;if(_n>0){var An=4-_n;if(an>1&&an<=An)an===2&&(An===3&&(_t+=4,rr.push(0)),rr.push.apply(rr,(0,Yi.Z)(Cr.data)),K.uniformGPUBufferLayout.push({name:Cr.name,offset:_t}));else{for(var vn=0;vn<An;vn++)_t+=4,rr.push(0);rr.push.apply(rr,(0,Yi.Z)(Cr.data)),K.uniformGPUBufferLayout.push({name:Cr.name,offset:_t})}}_t+=4*an}}),this.uniformBuffer=new W(this.engine,{data:rr instanceof Array?new Float32Array(rr):rr,usage:on.FB.Uniform|on.FB.CopyDst}),this.bindGroupEntries.push({binding:0,resource:{buffer:this.uniformBuffer.get()}})),Ue.forEach(function(Cr){if(Cr.data!==null&&(Cr.type===Ws.Vector4FloatArray||Cr.type===Ws.FloatArray)){var Dr;Cr.name===K.context.output.name?(Dr=new W(K.engine,{data:isFinite(Number(Cr.data))?[Cr.data]:Cr.data,usage:on.FB.Storage|on.FB.CopyDst|on.FB.CopySrc}),K.outputBuffer=Dr,K.context.output={name:Cr.name,length:isFinite(Number(Cr.data))?1:Cr.data.length,typedArrayConstructor:Float32Array,gpuBuffer:Dr.get()}):Cr.isReferer?Cr.data.model&&Cr.data.model.outputBuffer&&(Dr=Cr.data.model.outputBuffer):Dr=new W(K.engine,{data:isFinite(Number(Cr.data))?[Cr.data]:Cr.data,usage:on.FB.Storage|on.FB.CopyDst|on.FB.CopySrc}),K.vertexBuffers[Cr.name]=Dr,K.bindGroupEntries.push({binding:vt,resource:{name:Cr.name,refer:Dr?void 0:Cr.data,buffer:Dr?Dr.get():void 0}}),vt++}}),this.computePipeline=this.engine.device.createComputePipeline({computeStage:Ce}),console.log(this.bindGroupEntries),this.bindGroup=this.engine.device.createBindGroup({layout:this.computePipeline.getBindGroupLayout(0),entries:this.bindGroupEntries});case 13:case"end":return Rr.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"destroy",value:function(){var L=this;this.uniformBuffer&&this.uniformBuffer.destroy(),Object.keys(this.vertexBuffers).forEach(function(X){return L.vertexBuffers[X].destroy()})}},{key:"readData",value:function(){var q=(0,p.Z)(v().mark(function X(){var K,ve,Ce,Ue,nt,vt,_t,rr,Mr,Rr;return v().wrap(function(Dr){for(;;)switch(Dr.prev=Dr.next){case 0:if(K=this.context.output,!K){Dr.next=16;break}if(ve=K.length,Ce=K.typedArrayConstructor,Ue=K.gpuBuffer,!Ue){Dr.next=16;break}return nt=ve*Ce.BYTES_PER_ELEMENT,vt=this.engine.device.createBuffer({size:nt,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),_t=this.engine.device.createCommandEncoder(),_t.copyBufferToBuffer(Ue,0,vt,0,nt),rr=wa?this.engine.device.getQueue():this.engine.device.defaultQueue,rr.submit([_t.finish()]),Dr.next=12,vt.mapAsync(on.gc.Read);case 12:return Mr=vt.getMappedRange(),Rr=new Ce(Mr.slice(0)),vt.unmap(),Dr.abrupt("return",Rr);case 16:return Dr.abrupt("return",new Float32Array);case 17:case"end":return Dr.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"run",value:function(){if(this.engine.currentComputePass){var L;this.engine.currentComputePass.setPipeline(this.computePipeline),this.engine.currentComputePass.setBindGroup(0,this.bindGroup),(L=this.engine.currentComputePass).dispatch.apply(L,(0,Yi.Z)(this.context.dispatch))}}},{key:"updateBuffer",value:function(L,X){var K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,ve=this.vertexBuffers[L];ve&&ve.subData({data:X,offset:K})}},{key:"updateUniform",value:function(L,X){var K=this.uniformGPUBufferLayout.find(function(ve){return ve.name===L});K&&this.uniformBuffer.subData({data:Number.isFinite(X)?new Float32Array([X]):new Float32Array(X),offset:K.offset})}},{key:"confirmInput",value:function(L,X){var K=this.vertexBuffers[X],ve=L.outputBuffer;if(K&&ve&&K!==ve){var Ce=this.engine.device.createCommandEncoder(),Ue=L.context.output,nt=Ue.length,vt=Ue.typedArrayConstructor,_t=nt*vt.BYTES_PER_ELEMENT;Ce.copyBufferToBuffer(ve.get(),0,K.get(),0,_t);var rr=wa?this.engine.device.getQueue():this.engine.device.defaultQueue;rr.submit([Ce.finish()])}}},{key:"compileShaderToSpirV",value:function(L,X,K){return this.compileRawShaderToSpirV(K+L,X)}},{key:"compileRawShaderToSpirV",value:function(L,X){return this.engine.glslang.compileGLSL(L,X)}},{key:"compileComputePipelineStageDescriptor",value:function(){var q=(0,p.Z)(v().mark(function X(K){var ve,Ce;return v().wrap(function(nt){for(;;)switch(nt.prev=nt.next){case 0:if(ve=K,Ce=`#version 450
  400. `,this.engine.options.useWGSL){nt.next=6;break}return nt.next=5,this.compileShaderToSpirV(K,"compute",Ce);case 5:ve=nt.sent;case 6:return nt.abrupt("return",{computeStage:{module:this.engine.device.createShaderModule({code:ve,isWHLSL:wa}),entryPoint:"main"}});case 7:case"end":return nt.stop()}},X,this)}));function L(X){return q.apply(this,arguments)}return L}()}]),b}(),ue=function(){function b(q,L){(0,B.Z)(this,b),this.engine=q,this.options=L,this.indexCount=void 0,this.buffer=void 0;var X=L,K=X.data,ve=X.usage,Ce=X.type,Ue=X.count;this.indexCount=Ue||0,this.buffer=new W(q,{data:K instanceof Array?new Uint16Array(K):K,usage:on.FB.Index|on.FB.CopyDst})}return(0,N.Z)(b,[{key:"get",value:function(){return this.buffer}},{key:"subData",value:function(L){this.buffer.subData(L)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),b}(),pe=function(){function b(q,L){(0,B.Z)(this,b),this.engine=q,this.options=L,this.colorTexture=void 0,this.depthTexture=void 0,this.width=0,this.height=0;var X=L,K=X.width,ve=X.height,Ce=X.color,Ue=X.colors,nt=X.depth,vt=X.stencil;Ce&&(this.colorTexture=Ce),nt&&(this.depthTexture=nt)}return(0,N.Z)(b,[{key:"get",value:function(){var L,X;return{color:(L=this.colorTexture)===null||L===void 0?void 0:L.get(),depth:(X=this.depthTexture)===null||X===void 0?void 0:X.get()}}},{key:"destroy",value:function(){var L,X;(L=this.colorTexture)===null||L===void 0||L.destroy(),(X=this.depthTexture)===null||X===void 0||X.destroy()}},{key:"resize",value:function(L){var X=L.width,K=L.height;if(X!==this.width||K!==this.height){var ve,Ce;(ve=this.colorTexture)===null||ve===void 0||ve.resize({width:X,height:K}),(Ce=this.depthTexture)===null||Ce===void 0||Ce.resize({width:X,height:K})}this.width=X,this.height=K}}]),b}(),_e,Te,Re,Ze,je,ht,zt,wr=(_e={},(0,Fe.Z)(_e,bt.POINTS,on.YV.PointList),(0,Fe.Z)(_e,bt.LINES,on.YV.LineList),(0,Fe.Z)(_e,bt.LINE_LOOP,on.YV.LineList),(0,Fe.Z)(_e,bt.LINE_STRIP,on.YV.LineStrip),(0,Fe.Z)(_e,bt.TRIANGLES,on.YV.TriangleList),(0,Fe.Z)(_e,bt.TRIANGLE_FAN,on.YV.TriangleList),(0,Fe.Z)(_e,bt.TRIANGLE_STRIP,on.YV.TriangleStrip),_e),Kt=(Te={},(0,Fe.Z)(Te,bt.NEVER,on.wb.Never),(0,Fe.Z)(Te,bt.ALWAYS,on.wb.Always),(0,Fe.Z)(Te,bt.LESS,on.wb.Less),(0,Fe.Z)(Te,bt.LEQUAL,on.wb.LessEqual),(0,Fe.Z)(Te,bt.GREATER,on.wb.Greater),(0,Fe.Z)(Te,bt.GEQUAL,on.wb.GreaterEqual),(0,Fe.Z)(Te,bt.EQUAL,on.wb.Equal),(0,Fe.Z)(Te,bt.NOTEQUAL,on.wb.NotEqual),Te),qt=(Re={},(0,Fe.Z)(Re,bt.FUNC_ADD,on.db.Add),(0,Fe.Z)(Re,bt.MIN_EXT,on.db.Min),(0,Fe.Z)(Re,bt.MAX_EXT,on.db.Max),(0,Fe.Z)(Re,bt.FUNC_SUBTRACT,on.db.Subtract),(0,Fe.Z)(Re,bt.FUNC_REVERSE_SUBTRACT,on.db.ReverseSubtract),Re),Qt=(Ze={},(0,Fe.Z)(Ze,bt.ZERO,on.zi.Zero),(0,Fe.Z)(Ze,bt.ONE,on.zi.One),(0,Fe.Z)(Ze,bt.SRC_COLOR,on.zi.SrcColor),(0,Fe.Z)(Ze,bt.ONE_MINUS_SRC_COLOR,on.zi.OneMinusSrcColor),(0,Fe.Z)(Ze,bt.SRC_ALPHA,on.zi.SrcAlpha),(0,Fe.Z)(Ze,bt.ONE_MINUS_SRC_ALPHA,on.zi.OneMinusSrcAlpha),(0,Fe.Z)(Ze,bt.DST_COLOR,on.zi.DstColor),(0,Fe.Z)(Ze,bt.ONE_MINUS_DST_COLOR,on.zi.OneMinusDstColor),(0,Fe.Z)(Ze,bt.DST_ALPHA,on.zi.DstAlpha),(0,Fe.Z)(Ze,bt.ONE_MINUS_DST_ALPHA,on.zi.OneMinusDstAlpha),(0,Fe.Z)(Ze,bt.CONSTANT_COLOR,on.zi.BlendColor),(0,Fe.Z)(Ze,bt.ONE_MINUS_CONSTANT_COLOR,on.zi.OneMinusBlendColor),(0,Fe.Z)(Ze,bt.SRC_ALPHA_SATURATE,on.zi.SrcAlphaSaturated),Ze),Xr=(je={},(0,Fe.Z)(je,bt.ALPHA,"r8unorm"),(0,Fe.Z)(je,bt.RGBA,"rgba8unorm"),(0,Fe.Z)(je,bt.DEPTH_COMPONENT,"depth32float"),(0,Fe.Z)(je,bt.DEPTH_STENCIL,"depth24plus-stencil8"),je),Yr=(ht={},(0,Fe.Z)(ht,bt.NEAREST,"nearest"),(0,Fe.Z)(ht,bt.LINEAR,"linear"),ht),Kr=(zt={},(0,Fe.Z)(zt,bt.REPEAT,"repeat"),(0,Fe.Z)(zt,bt.CLAMP_TO_EDGE,"clamp-to-edge"),(0,Fe.Z)(zt,bt.MIRRORED_REPEAT,"mirror-repeat"),zt);function Cn(b){var q=b.cull;if(!q||!q.enable)return on.Wf.None;if(q.face)return q.face===bt.FRONT?on.Wf.Front:on.Wf.Back}function Sn(b){var q=b.depth,L=b.stencil,X={compare:on.wb.Always,depthFailOp:on.xS.Keep,failOp:on.xS.Keep,passOp:on.xS.Keep};return{depthWriteEnabled:q&&q.enable,depthCompare:Kt[(q==null?void 0:q.func)||bt.ALWAYS],format:on.EV.Depth24PlusStencil8,stencilFront:X,stencilBack:X,stencilReadMask:4294967295,stencilWriteMask:4294967295}}function Rn(b,q){var L=b.blend;return[{format:q,alphaBlend:{srcFactor:Qt[L&&L.func&&L.func.srcAlpha||bt.ONE],dstFactor:Qt[L&&L.func&&L.func.dstAlpha||bt.ZERO],operation:qt[L&&L.equation&&L.equation.alpha||bt.FUNC_ADD]},colorBlend:{srcFactor:Qt[L&&L.func&&L.func.srcRGB||bt.ONE],dstFactor:Qt[L&&L.func&&L.func.dstRGB||bt.ZERO],operation:qt[L&&L.equation&&L.equation.rgb||bt.FUNC_ADD]},writeMask:on.Yw.All}]}function jn(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function kn(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?jn(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):jn(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}function Bi(b){for(var q=0,L=arguments.length,X=new Array(L>1?L-1:0),K=1;K<L;K++)X[K-1]=arguments[K];for(var ve=0,Ce=X;ve<Ce.length;ve++){var Ue=Ce[ve];q+=Ue.length}for(var nt=new b(q),vt=0,_t=0,rr=X;_t<rr.length;_t++){var Mr=rr[_t];nt.set(Mr,vt),vt+=Mr.length}return nt}var Xn=function(){function b(q,L){(0,B.Z)(this,b),this.engine=q,this.options=L,this.pipelineLayout=void 0,this.renderPipeline=void 0,this.uniformsBindGroupLayout=void 0,this.uniformBindGroup=void 0,this.uniformBuffer=void 0,this.uniforms={},this.uniformGPUBufferLayout=[],this.attributeCache={},this.indexBuffer=void 0,this.indexCount=void 0}return(0,N.Z)(b,[{key:"init",value:function(){var q=(0,p.Z)(v().mark(function X(){var K=this,ve,Ce,Ue,nt,vt,_t,rr,Mr,Rr,Cr,Dr,an,_n,An,vn,ei,Gn,mi;return v().wrap(function(ni){for(;;)switch(ni.prev=ni.next){case 0:return ve=this.options,Ce=ve.vs,Ue=ve.fs,nt=ve.attributes,vt=ve.uniforms,_t=ve.primitive,rr=ve.count,Mr=ve.elements,Rr=ve.depth,Cr=ve.blend,Dr=ve.stencil,an=ve.cull,_n=ve.instances,ni.next=3,this.compilePipelineStageDescriptor(Ce,Ue,null);case 3:An=ni.sent,vn=An.vertexStage,ei=An.fragmentStage,vt&&this.buildUniformBindGroup(vt),Mr&&(this.indexBuffer=Mr.get(),this.indexCount=Mr.indexCount),Gn={vertexBuffers:Object.keys(nt).map(function(oa,Ma){var Na=nt[oa],$i=Na.get(),Ca=$i.arrayStride,sa=$i.stepMode,Ls=$i.attributes;return K.attributeCache[oa]=Na,{arrayStride:Ca,stepMode:sa,attributes:Ls}})},mi={sampleCount:this.engine.mainPassSampleCount,primitiveTopology:wr[_t||bt.TRIANGLES],rasterizationState:kn(kn({},this.getDefaultRasterizationStateDescriptor()),{},{cullMode:Cn({cull:an})}),depthStencilState:Sn({depth:Rr,stencil:Dr}),colorStates:Rn({blend:Cr},this.engine.options.swapChainFormat),layout:this.pipelineLayout,vertexStage:vn,fragmentStage:ei,vertexState:Gn},this.renderPipeline=this.engine.device.createRenderPipeline(mi);case 11:case"end":return ni.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"addUniforms",value:function(L){this.uniforms=kn(kn({},this.uniforms),Hu(L))}},{key:"draw",value:function(L){var X=this,K=this.engine.getCurrentRenderPass(),ve=kn(kn({},this.uniforms),Hu(L.uniforms||{})),Ce=[];Object.keys(ve).forEach(function(Ue){var nt=(0,Oe.Z)(ve[Ue]);if(nt==="boolean"||nt==="number"||Array.isArray(ve[Ue])||ve[Ue].BYTES_PER_ELEMENT){var vt,_t=(vt=X.uniformGPUBufferLayout.find(function(_n){var An=_n.name;return An===Ue}))===null||vt===void 0?void 0:vt.offset;_t!==null&&X.uniformBuffer.subData({data:ve[Ue],offset:_t})}else{var rr,Mr=(rr=X.uniformGPUBufferLayout.find(function(_n){var An=_n.name;return An===Ue}))===null||rr===void 0?void 0:rr.offset;if(Mr!==null){var Rr=ve[Ue].get(),Cr=Rr.color||Rr,Dr=Cr.texture,an=Cr.sampler;an&&(Ce.push({binding:Mr,resource:an}),Mr++),Ce.push({binding:Mr,resource:Dr.createView()})}}}),this.uniformBuffer&&(Ce[0]={binding:0,resource:{buffer:this.uniformBuffer.get()}}),this.uniformBindGroup=this.engine.device.createBindGroup({layout:this.uniformsBindGroupLayout,entries:Ce}),this.renderPipeline&&K.setPipeline(this.renderPipeline),K.setBindGroup(0,this.uniformBindGroup),this.indexBuffer&&K.setIndexBuffer(this.indexBuffer.get(),on.iD.Uint32,0),Object.keys(this.attributeCache).forEach(function(Ue,nt){K.setVertexBuffer(0+nt,X.attributeCache[Ue].get().buffer,0)}),this.indexBuffer?K.drawIndexed(this.indexCount,this.options.instances||1,0,0,0):K.draw(this.options.count||0,this.options.instances||0,0,0)}},{key:"destroy",value:function(){throw new Error("Method not implemented.")}},{key:"compilePipelineStageDescriptor",value:function(){var q=(0,p.Z)(v().mark(function X(K,ve,Ce){var Ue,nt,vt;return v().wrap(function(rr){for(;;)switch(rr.prev=rr.next){case 0:if(Ue=`#version 450
  401. `,nt=K,vt=ve,this.engine.options.useWGSL){rr.next=10;break}return rr.next=6,this.compileShaderToSpirV(K,"vertex",Ue);case 6:return nt=rr.sent,rr.next=9,this.compileShaderToSpirV(ve,"fragment",Ue);case 9:vt=rr.sent;case 10:return rr.abrupt("return",this.createPipelineStageDescriptor(nt,vt));case 11:case"end":return rr.stop()}},X,this)}));function L(X,K,ve){return q.apply(this,arguments)}return L}()},{key:"compileShaderToSpirV",value:function(L,X,K){return this.compileRawShaderToSpirV(K+L,X)}},{key:"compileRawShaderToSpirV",value:function(L,X){return this.engine.glslang.compileGLSL(L,X)}},{key:"createPipelineStageDescriptor",value:function(L,X){return{vertexStage:{module:this.engine.device.createShaderModule({code:L,isWHLSL:wa}),entryPoint:"main"},fragmentStage:{module:this.engine.device.createShaderModule({code:X,isWHLSL:wa}),entryPoint:"main"}}}},{key:"getDefaultRasterizationStateDescriptor",value:function(){return{frontFace:on.zX.CCW,cullMode:on.Wf.None,depthBias:0,depthBiasSlopeScale:0,depthBiasClamp:0}}},{key:"buildUniformBindGroup",value:function(L){var X=this,K=0,ve=Bi.apply(void 0,[Float32Array].concat((0,Yi.Z)(Object.keys(L).map(function(nt){return L[nt]?(X.uniformGPUBufferLayout.push({name:nt,offset:K}),K+=(L[nt].length||1)*4,L[nt]):[]})))),Ce=[],Ue=!1;ve.length&&(Ue=!0,Ce.push({binding:0,visibility:on.$X.Fragment|on.$X.Vertex,type:on.$l.UniformBuffer})),Object.keys(L).filter(function(nt){return L[nt]===null}).forEach(function(nt,vt){X.uniformGPUBufferLayout.push({name:nt,offset:vt*2+(Ue?1:0)}),Ce.push({binding:vt*2+(Ue?1:0),visibility:on.$X.Fragment,type:on.$l.Sampler},{binding:vt*2+(Ue?1:0)+1,visibility:on.$X.Fragment,type:on.$l.SampledTexture})}),this.uniformsBindGroupLayout=this.engine.device.createBindGroupLayout({entries:Ce}),this.pipelineLayout=this.engine.device.createPipelineLayout({bindGroupLayouts:[this.uniformsBindGroupLayout]}),Ue&&(this.uniformBuffer=new W(this.engine,{data:ve instanceof Array?new Float32Array(ve):ve,usage:on.FB.Uniform|on.FB.CopyDst}))}}]),b}(),qi=function(){function b(q,L){(0,B.Z)(this,b),this.engine=q,this.options=L,this.texture=void 0,this.sampler=void 0,this.width=void 0,this.height=void 0,this.createTexture()}return(0,N.Z)(b,[{key:"get",value:function(){return{texture:this.texture,sampler:this.sampler}}},{key:"update",value:function(){}},{key:"resize",value:function(L){var X=L.width,K=L.height;(X!==this.width||K!==this.height)&&(this.destroy(),this.createTexture()),this.width=X,this.height=K}},{key:"destroy",value:function(){this.texture&&this.texture.destroy()}},{key:"createTexture",value:function(){var L=this.options,X=L.data,K=L.type,ve=K===void 0?bt.UNSIGNED_BYTE:K,Ce=L.width,Ue=L.height,nt=L.flipY,vt=nt===void 0?!1:nt,_t=L.format,rr=_t===void 0?bt.RGBA:_t,Mr=L.mipmap,Rr=Mr===void 0?!1:Mr,Cr=L.wrapS,Dr=Cr===void 0?bt.CLAMP_TO_EDGE:Cr,an=L.wrapT,_n=an===void 0?bt.CLAMP_TO_EDGE:an,An=L.aniso,vn=An===void 0?0:An,ei=L.alignment,Gn=ei===void 0?1:ei,mi=L.premultiplyAlpha,si=mi===void 0?!1:mi,ni=L.mag,oa=ni===void 0?bt.NEAREST:ni,Ma=L.min,Na=Ma===void 0?bt.NEAREST:Ma,$i=L.colorSpace,Ca=$i===void 0?bt.BROWSER_DEFAULT_WEBGL:$i,sa=L.usage;this.width=Ce,this.height=Ue,this.texture=this.engine.device.createTexture({size:[Ce,Ue,1],mipLevelCount:1,sampleCount:1,dimension:on.kd.E2d,format:Xr[rr],usage:sa||on.v2.Sampled|on.v2.CopyDst}),(!sa||sa&on.v2.Sampled)&&(this.sampler=this.engine.device.createSampler({addressModeU:Kr[Dr],addressModeV:Kr[_n],addressModeW:Kr[Dr],magFilter:Yr[oa],minFilter:Yr[Na],maxAnisotropy:vn}))}}]),b}(),Oi,Kn,Zi,Ki=(Oi=(0,O.b2)(),Oi(Kn=(Zi=function(){function b(){var q=this;(0,B.Z)(this,b),this.supportWebGPU=!0,this.useWGSL=!1,this.options=void 0,this.canvas=void 0,this.context=void 0,this.glslang=void 0,this.adapter=void 0,this.device=void 0,this.swapChain=void 0,this.mainPassSampleCount=void 0,this.mainTexture=void 0,this.depthTexture=void 0,this.mainColorAttachments=void 0,this.mainTextureExtends=void 0,this.mainDepthAttachment=void 0,this.uploadEncoder=void 0,this.renderEncoder=void 0,this.computeEncoder=void 0,this.renderTargetEncoder=void 0,this.commandBuffers=new Array(4).fill(void 0),this.currentRenderPass=null,this.mainRenderPass=null,this.currentRenderTargetViewDescriptor=void 0,this.currentComputePass=null,this.bundleEncoder=void 0,this.tempBuffers=[],this.currentRenderTarget=null,this.uploadEncoderDescriptor={label:"upload"},this.renderEncoderDescriptor={label:"render"},this.renderTargetEncoderDescriptor={label:"renderTarget"},this.computeEncoderDescriptor={label:"compute"},this.pipelines={},this.computePipelines={},this.defaultSampleCount=4,this.clearDepthValue=1,this.clearStencilValue=0,this.transientViewport={x:Infinity,y:0,width:0,height:0},this.cachedViewport={x:0,y:0,width:0,height:0},this.clear=function(L){var X=L.framebuffer,K=L.color,ve=L.depth,Ce=L.stencil;q.options.supportCompute&&q.startComputePass(),q.currentRenderTarget?(q.currentRenderPass&&q.endRenderTargetRenderPass(),q.startRenderTargetRenderPass(q.currentRenderTarget,K||null,!!ve,!!Ce)):(q.mainColorAttachments[0].loadValue=K||on.Ws.Load,q.mainDepthAttachment.depthLoadValue=ve||on.Ws.Load,q.mainDepthAttachment.stencilLoadValue=Ce?q.clearStencilValue:on.Ws.Load,q.mainRenderPass&&q.endMainRenderPass(),q.startMainRenderPass())},this.createModel=function(){var L=(0,p.Z)(v().mark(function X(K){var ve;return v().wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:return ve=new Xn(q,K),Ue.next=3,ve.init();case 3:return Ue.abrupt("return",ve);case 4:case"end":return Ue.stop()}},X)}));return function(X){return L.apply(this,arguments)}}(),this.createAttribute=function(L){return new P(q,L)},this.createBuffer=function(L){return new W(q,L)},this.createElements=function(L){return new ue(q,L)},this.createTexture2D=function(L){return new qi(q,L)},this.createFramebuffer=function(L){return new pe(q,L)},this.useFramebuffer=function(L,X){q.currentRenderTarget&&q.unbindFramebuffer(q.currentRenderTarget),q.currentRenderTarget=L,q.currentRenderTargetViewDescriptor={dimension:on.p_.E2d,arrayLayerCount:1,aspect:on.H7.All},q.currentRenderPass=null,X()},this.createComputeModel=function(){var L=(0,p.Z)(v().mark(function X(K){var ve;return v().wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:return ve=new oe(q,K),Ue.next=3,ve.init();case 3:return Ue.abrupt("return",ve);case 4:case"end":return Ue.stop()}},X)}));return function(X){return L.apply(this,arguments)}}(),this.getCanvas=function(){return q.canvas},this.getGLContext=function(){throw new Error("Method not implemented.")},this.viewport=function(L){var X=L.x,K=L.y,ve=L.width,Ce=L.height;if(!q.currentRenderPass)q.transientViewport={x:X,y:K,width:ve,height:Ce};else if(q.transientViewport.x!==Infinity){var Ue=q.getCurrentRenderPass();Ue.setViewport(q.transientViewport.x,q.transientViewport.y,q.transientViewport.width,q.transientViewport.height,0,1)}else if(X!==q.cachedViewport.x||K!==q.cachedViewport.y||ve!==q.cachedViewport.width||Ce!==q.cachedViewport.height){q.cachedViewport={x:X,y:K,width:ve,height:Ce};var nt=q.getCurrentRenderPass();nt.setViewport(X,K,ve,Ce,0,1)}},this.readPixels=function(L){throw new Error("Method not implemented.")}}return(0,N.Z)(b,[{key:"isFloatSupported",value:function(){return!0}},{key:"init",value:function(){var q=(0,p.Z)(v().mark(function X(K){return v().wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:return this.canvas=K.canvas,this.options=K,this.useWGSL=!!K.useWGSL,this.mainPassSampleCount=K.antialiasing?this.defaultSampleCount:1,Ce.next=6,this.initGlslang();case 6:this.initContextAndSwapChain(),this.initMainAttachments();case 8:case"end":return Ce.stop()}},X,this)}));function L(X){return q.apply(this,arguments)}return L}()},{key:"setScissor",value:function(L){throw new Error("Method not implemented.")}},{key:"destroy",value:function(){this.mainTexture&&this.mainTexture.destroy(),this.depthTexture&&this.depthTexture.destroy(),this.tempBuffers.forEach(function(L){return L.destroy()}),this.tempBuffers=[]}},{key:"beginFrame",value:function(){this.uploadEncoder=this.device.createCommandEncoder(this.uploadEncoderDescriptor),this.renderEncoder=this.device.createCommandEncoder(this.renderEncoderDescriptor),this.renderTargetEncoder=this.device.createCommandEncoder(this.renderTargetEncoderDescriptor),this.options.supportCompute&&(this.computeEncoder=this.device.createCommandEncoder(this.computeEncoderDescriptor))}},{key:"endFrame",value:function(){this.options.supportCompute&&this.endComputePass(),this.endMainRenderPass(),this.commandBuffers[0]=this.uploadEncoder.finish(),this.commandBuffers[1]=this.renderEncoder.finish(),this.options.supportCompute&&(this.commandBuffers[2]=this.computeEncoder.finish()),this.commandBuffers[3]=this.renderTargetEncoder.finish(),wa?this.device.getQueue().submit(this.commandBuffers.filter(function(L){return L})):this.device.defaultQueue.submit(this.commandBuffers.filter(function(L){return L}))}},{key:"getCurrentRenderPass",value:function(){return this.currentRenderTarget&&!this.currentRenderPass?this.startRenderTargetRenderPass(this.currentRenderTarget,null,!1,!1):this.currentRenderPass||this.startMainRenderPass(),this.currentRenderPass}},{key:"initGlslang",value:function(){var q=(0,p.Z)(v().mark(function X(){var K,ve;return v().wrap(function(Ue){for(;;)switch(Ue.prev=Ue.next){case 0:return Ue.next=2,qr();case 2:return this.glslang=Ue.sent,Ue.next=5,(K=navigator)===null||K===void 0||(ve=K.gpu)===null||ve===void 0?void 0:ve.requestAdapter();case 5:return this.adapter=Ue.sent,Ue.next=8,this.adapter.requestDevice();case 8:this.device=Ue.sent;case 9:case"end":return Ue.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"initContextAndSwapChain",value:function(){this.context=this.canvas.getContext(wa?"gpu":"gpupresent"),this.swapChain=this.context.configureSwapChain({device:this.device,format:this.options.swapChainFormat,usage:on.v2.OutputAttachment|on.v2.CopySrc})}},{key:"initMainAttachments",value:function(){if(this.mainTextureExtends={width:this.canvas.width,height:this.canvas.height,depth:1},this.options.antialiasing){var L={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:on.kd.E2d,format:on.EV.BGRA8Unorm,usage:on.v2.OutputAttachment};this.mainTexture&&this.mainTexture.destroy(),this.mainTexture=this.device.createTexture(L),this.mainColorAttachments=[{attachment:wa?this.mainTexture.createDefaultView():this.mainTexture.createView(),loadValue:[0,0,0,1],storeOp:on.EG.Store}]}else this.mainColorAttachments=[{attachment:wa?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),loadValue:[0,0,0,1],storeOp:on.EG.Store}];var X={size:this.mainTextureExtends,mipLevelCount:1,sampleCount:this.mainPassSampleCount,dimension:on.kd.E2d,format:wa?"depth32float-stencil8":on.EV.Depth24PlusStencil8,usage:on.v2.OutputAttachment};this.depthTexture&&this.depthTexture.destroy(),this.depthTexture=this.device.createTexture(X),this.mainDepthAttachment={attachment:wa?this.depthTexture.createDefaultView():this.depthTexture.createView(),depthLoadValue:this.clearDepthValue,depthStoreOp:on.EG.Store,stencilLoadValue:this.clearStencilValue,stencilStoreOp:on.EG.Store}}},{key:"startComputePass",value:function(){this.currentComputePass&&this.endComputePass(),this.currentComputePass=this.computeEncoder.beginComputePass()}},{key:"startMainRenderPass",value:function(){this.currentRenderPass&&!this.currentRenderTarget&&this.endMainRenderPass(),this.options.antialiasing?this.mainColorAttachments[0].resolveTarget=wa?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView():this.mainColorAttachments[0].attachment=wa?this.swapChain.getCurrentTexture().createDefaultView():this.swapChain.getCurrentTexture().createView(),this.currentRenderPass=this.renderEncoder.beginRenderPass({colorAttachments:this.mainColorAttachments,depthStencilAttachment:this.mainDepthAttachment}),this.mainRenderPass=this.currentRenderPass,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"startRenderTargetRenderPass",value:function(L,X,K){var ve,Ce,Ue=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,nt=(ve=L.get().color)===null||ve===void 0?void 0:ve.texture,vt;nt&&(vt=nt.createView(this.currentRenderTargetViewDescriptor));var _t=(Ce=L.get().depth)===null||Ce===void 0?void 0:Ce.texture,rr;_t&&(rr=_t.createView());var Mr=this.renderTargetEncoder.beginRenderPass({colorAttachments:[{attachment:vt,loadValue:X!==null?X:on.Ws.Load,storeOp:on.EG.Store}],depthStencilAttachment:_t&&rr?{attachment:rr,depthLoadValue:K?this.clearDepthValue:on.Ws.Load,depthStoreOp:on.EG.Store,stencilLoadValue:Ue?this.clearStencilValue:on.Ws.Load,stencilStoreOp:on.EG.Store}:void 0});this.currentRenderPass=Mr,this.cachedViewport&&this.viewport(this.cachedViewport)}},{key:"endMainRenderPass",value:function(){this.currentRenderPass===this.mainRenderPass&&this.currentRenderPass!==null&&(this.currentRenderPass.endPass(),this.resetCachedViewport(),this.currentRenderPass=null,this.mainRenderPass=null)}},{key:"endComputePass",value:function(){this.currentComputePass&&(this.currentComputePass.endPass(),this.currentComputePass=null)}},{key:"endRenderTargetRenderPass",value:function(){this.currentRenderPass&&(this.currentRenderPass.endPass(),this.resetCachedViewport())}},{key:"resetCachedViewport",value:function(){this.cachedViewport={x:0,y:0,width:0,height:0}}},{key:"unbindFramebuffer",value:function(L){this.currentRenderPass&&this.currentRenderPass!==this.mainRenderPass&&this.endRenderTargetRenderPass(),this.transientViewport.x=Infinity,this.currentRenderTarget=null,this.currentRenderPass=this.mainRenderPass}}]),b}(),Zi))||Kn),ri,za;function pa(b){var q=Jn();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function Jn(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var Ga=4/64,Mi=1-Ga*2,Bn=(ri=(0,O.b2)(),ri(za=function(b){(0,V.Z)(L,b);var q=pa(L);function L(){return(0,B.Z)(this,L),q.apply(this,arguments)}return(0,N.Z)(L,[{key:"onEntityCreated",value:function(){var K=this.config,ve=K.widthSegments,Ce=ve===void 0?1:ve,Ue=K.heightSegments,nt=Ue===void 0?1:Ue,vt=K.depthSegments,_t=vt===void 0?1:vt,rr=K.halfExtents,Mr=rr===void 0?ke.fromValues(.5,.5,.5):rr,Rr=Ce,Cr=nt,Dr=_t,an=(0,w.Z)(Mr,3),_n=an[0],An=an[1],vn=an[2],ei=[ke.fromValues(-_n,-An,vn),ke.fromValues(_n,-An,vn),ke.fromValues(_n,An,vn),ke.fromValues(-_n,An,vn),ke.fromValues(_n,-An,-vn),ke.fromValues(-_n,-An,-vn),ke.fromValues(-_n,An,-vn),ke.fromValues(_n,An,-vn)],Gn=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],mi=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],si={FRONT:0,BACK:1,TOP:2,BOTTOM:3,RIGHT:4,LEFT:5},ni=[],oa=[],Ma=[],Na=[],$i=[],Ca=0,sa=function(ea,Pd,hf){var al,ps,ed,qa;for(ed=0;ed<=Pd;ed++)for(qa=0;qa<=hf;qa++){var Od=ke.create(),Dd=ke.create(),Hh=ke.create(),vf=ke.create();ke.lerp(Od,ei[Gn[ea][0]],ei[Gn[ea][1]],ed/Pd),ke.lerp(Dd,ei[Gn[ea][0]],ei[Gn[ea][2]],qa/hf),ke.sub(Hh,Dd,ei[Gn[ea][0]]),ke.add(vf,Od,Hh),al=ed/Pd,ps=qa/hf,ni.push(vf[0],vf[1],vf[2]),oa.push(mi[ea][0],mi[ea][1],mi[ea][2]),Ma.push(al,ps),al/=3,ps/=3,al=al*Mi+Ga,ps=ps*Mi+Ga,al+=ea%3/3,ps+=Math.floor(ea/3)/3,Na.push(al,ps),ed<Pd&&qa<hf&&($i.push(Ca+hf+1,Ca+1,Ca),$i.push(Ca+hf+1,Ca+hf+2,Ca+1)),Ca++}};sa(si.FRONT,Rr,Cr),sa(si.BACK,Rr,Cr),sa(si.TOP,Rr,Dr),sa(si.BOTTOM,Rr,Dr),sa(si.RIGHT,Dr,Cr),sa(si.LEFT,Dr,Cr);var Ls=Ms(ni),Ac=this.getComponent();Ac.indices=Uint32Array.from($i),Ac.aabb=Ls,Ac.vertexCount=Ca,Ac.attributes=[{dirty:!0,name:"position",data:Float32Array.from(ni),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(oa),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(Ma),arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),L}(cs))||za);function hi(b,q){if(!b&&!q)throw new Error("Please specify valid arguments for parameters a and b.");if(!q||q.length===0)return b;if(!b||b.length===0)return q;if(Object.prototype.toString.call(b)!==Object.prototype.toString.call(q))throw new Error("The types of the two arguments passed for parameters a and b do not match.");var L=new b.constructor(b.length+q.length);return L.set(b),L.set(q,b.length),L}var yi,aa;function qs(b){var q=Tc();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function Tc(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var yt=(yi=(0,O.b2)(),yi(aa=function(b){(0,V.Z)(L,b);var q=qs(L);function L(){return(0,B.Z)(this,L),q.apply(this,arguments)}return(0,N.Z)(L,[{key:"onEntityCreated",value:function(){var K=this.config.geometries,ve=K===void 0?[]:K,Ce=this.getComponent();Ce.aabb=new Ae;var Ue=[],nt=[],vt=0;ve.forEach(function(_t){var rr=_t.aabb,Mr=_t.indices,Rr=_t.vertexCount,Cr=_t.attributes;Ce.aabb.add(rr),Ce.vertexCount+=Rr,Mr&&nt.push.apply(nt,(0,Yi.Z)(Mr.map(function(Dr){return Dr+vt}))),vt+=Rr,Cr.forEach(function(Dr,an){Ue[an]?Dr.data&&(jc(Dr.data)?Ue[an].push(Dr.data):Rl(Dr.data)?Ue[an].data=hi(Ue[an].data,Dr.data):Ue[an].data=Ue[an].data.concat(Dr.data)):(Ue[an]=Dr,Ue[an].dirty=!0)})}),Ce.attributes=Ue,Ce.indices=Uint32Array.from(nt),Ce.dirty=!0}}]),L}(cs))||aa),br,hr;function mn(b){var q=fi();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function fi(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var ot=(br=(0,O.b2)(),br(hr=function(b){(0,V.Z)(L,b);var q=mn(L);function L(){return(0,B.Z)(this,L),q.apply(this,arguments)}return(0,N.Z)(L,[{key:"onEntityCreated",value:function(){for(var K=this.config,ve=K.halfExtents,Ce=ve===void 0?[.5,.5]:ve,Ue=K.widthSegments,nt=Ue===void 0?5:Ue,vt=K.lengthSegments,_t=vt===void 0?5:vt,rr=[],Mr=[],Rr=[],Cr=[],Dr=0,an=0;an<=nt;an++)for(var _n=0;_n<=_t;_n++){var An=-Ce[0]+2*Ce[0]*an/nt,vn=0,ei=-(-Ce[1]+2*Ce[1]*_n/_t),Gn=an/nt,mi=_n/_t;rr.push(An,vn,ei),Mr.push(0,1,0),Rr.push(Gn,mi),an<nt&&_n<_t&&(Cr.push(Dr+_t+1,Dr+1,Dr),Cr.push(Dr+_t+1,Dr+_t+2,Dr+1)),Dr++}var si=Ms(rr),ni=this.getComponent();ni.indices=Uint32Array.from(Cr),ni.aabb=si,ni.vertexCount=Dr,ni.attributes=[{dirty:!0,name:"position",data:Float32Array.from(rr),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(Mr),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(Rr),arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),L}(cs))||hr),Xe,Gt;function tr(b){var q=or();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function or(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var Wt=(Xe=(0,O.b2)(),Xe(Gt=function(b){(0,V.Z)(L,b);var q=tr(L);function L(){return(0,B.Z)(this,L),q.apply(this,arguments)}return(0,N.Z)(L,[{key:"onEntityCreated",value:function(){for(var K=this.config,ve=K.radius,Ce=ve===void 0?.5:ve,Ue=K.latitudeBands,nt=Ue===void 0?16:Ue,vt=K.longitudeBands,_t=vt===void 0?16:vt,rr=[],Mr=[],Rr=[],Cr=[],Dr=0;Dr<=nt;Dr++)for(var an=Dr*Math.PI/nt,_n=Math.sin(an),An=Math.cos(an),vn=0;vn<=_t;vn++){var ei=vn*2*Math.PI/_t-Math.PI/2,Gn=Math.sin(ei),mi=Math.cos(ei),si=mi*_n,ni=An,oa=Gn*_n,Ma=1-vn/_t,Na=1-Dr/nt;rr.push(si*Ce,ni*Ce,oa*Ce),Mr.push(si,ni,oa),Rr.push(Ma,Na)}for(var $i=0;$i<nt;++$i)for(var Ca=0;Ca<_t;++Ca){var sa=$i*(_t+1)+Ca,Ls=sa+_t+1;Cr.push(sa+1,Ls,sa),Cr.push(sa+1,Ls+1,Ls)}var Ac=Ms(rr),df=this.getComponent();df.indices=Uint32Array.from(Cr),df.aabb=Ac,df.vertexCount=rr.length/3,df.attributes=[{dirty:!0,name:"position",data:Float32Array.from(rr),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float3"}]},{dirty:!0,name:"normal",data:Float32Array.from(Mr),arrayStride:4*3,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float3"}]},{dirty:!0,name:"uv",data:Float32Array.from(Rr),arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float2"}]}]}}]),L}(cs))||Gt),Ft,Xt,st,Ot,it,Jt,cr,Lr;function Br(b){var q=Tr();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function Tr(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var $r=`varying vec4 fragColor;
  402. #pragma include "uv.frag.declaration"
  403. #pragma include "map.frag.declaration"
  404. void main() {
  405. vec4 diffuseColor = fragColor;
  406. #pragma include "map.frag.main"
  407. gl_FragColor = diffuseColor;
  408. }`,Pn=`attribute vec3 position;
  409. attribute vec3 normal;
  410. uniform mat4 projectionMatrix;
  411. uniform mat4 modelViewMatrix;
  412. uniform vec4 color;
  413. varying vec4 fragColor;
  414. #pragma include "uv.vert.declaration"
  415. void main() {
  416. gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
  417. fragColor = color;
  418. #pragma include "uv.vert.main"
  419. }`,qn=`// layout(set = 0, binding = 1) uniform WireframeUniforms {
  420. // float lineWidth;
  421. // vec4 lineColor;
  422. // } wireframe;
  423. layout(location = 0) in vec4 fragColor;
  424. // layout(location = 1) in vec3 v_Barycentric;
  425. layout(location = 0) out vec4 outColor;
  426. // wireframe
  427. // float edgeFactor() {
  428. // vec3 d = fwidth(v_Barycentric);
  429. // vec3 a3 = smoothstep(vec3(0.0), d * wireframe.lineWidth, v_Barycentric);
  430. // return min(min(a3.x, a3.y), a3.z);
  431. // }
  432. void main() {
  433. // outColor = mix(fragColor, wireframe.lineColor, (1.0 - edgeFactor()));
  434. outColor = fragColor;
  435. }`,En=`layout(set = 0, binding = 0) uniform Uniforms {
  436. vec4 color;
  437. mat4 projectionMatrix;
  438. mat4 modelViewMatrix;
  439. } uniforms;
  440. layout(location = 0) in vec3 position;
  441. // layout(location = 1) in vec3 barycentric;
  442. layout(location = 0) out vec4 fragColor;
  443. // layout(location = 1) out vec3 v_Barycentric;
  444. void main() {
  445. gl_Position = uniforms.projectionMatrix * uniforms.modelViewMatrix * vec4(position, 1.0);
  446. fragColor = uniforms.color;
  447. // v_Barycentric = barycentric;
  448. }`,Fn=(Ft=(0,O.b2)(),Xt=(0,O.f3)(D.RenderEngine),st=(0,O.f3)(D.ShaderModuleService),Ft(Ot=(it=(Lr=function(b){(0,V.Z)(L,b);var q=Br(L);function L(){var X;(0,B.Z)(this,L);for(var K=arguments.length,ve=new Array(K),Ce=0;Ce<K;Ce++)ve[Ce]=arguments[Ce];return X=q.call.apply(q,[this].concat(ve)),S(X,"engine",Jt,(0,Vt.Z)(X)),S(X,"shaderModuleService",cr,(0,Vt.Z)(X)),X}return(0,N.Z)(L,[{key:"onEntityCreated",value:function(){var K=this.getComponent(),ve=this.engine.supportWebGPU?En:Pn,Ce=this.engine.supportWebGPU?qn:$r;this.shaderModuleService.registerModule("material-basic",{vs:ve,fs:Ce});var Ue=this.shaderModuleService.getModule("material-basic"),nt=Ue.vs,vt=Ue.fs,_t=Ue.uniforms;K.vertexShaderGLSL=nt,K.fragmentShaderGLSL=vt,K.setUniform(_t),this.config.map&&(K.setDefines({USE_UV:1,USE_MAP:1}),K.setUniform({map:this.config.map,uvTransform:Ar.create()}))}}]),L}(Xs),Lr),Jt=E(it.prototype,"engine",[Xt],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),cr=E(it.prototype,"shaderModuleService",[st],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),it))||Ot),Yn,_i,ra,lo,$l,Zo,gd,xo,yd,ah,ga,oh;function Qh(b){var q=Jh();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function Jh(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var qh=`// generate grid, borrow from clay.gl viewer
  449. // @see https://github.com/pissang/clay-viewer/blob/master/src/graphic/ground.glsl
  450. #extension GL_OES_standard_derivatives : enable
  451. varying vec3 v_Position;
  452. // varying vec3 v_Normal;
  453. uniform float u_GridSize : 5;
  454. uniform float u_GridSize2 : .5;
  455. uniform vec4 u_GridColor : [0, 0, 0, 1];
  456. uniform vec4 u_GridColor2 : [0.3, 0.3, 0.3, 1];
  457. uniform bool u_GridEnabled : true;
  458. // uniform vec3 u_LightDirection;
  459. // uniform vec3 u_LightColor;
  460. // uniform vec3 u_Camera;
  461. void main() {
  462. // vec3 n = v_Normal;
  463. // vec3 l = normalize(u_LightDirection);
  464. // float NdotL = clamp(dot(n, l), 0.001, 1.0);
  465. gl_FragColor = vec4(1.);
  466. if (u_GridEnabled) {
  467. float wx = v_Position.x;
  468. float wz = v_Position.z;
  469. // float x0 = abs(fract(wx / u_GridSize - 0.5) - 0.5) / fwidth(wx) * u_GridSize / 2.0;
  470. // float z0 = abs(fract(wz / u_GridSize - 0.5) - 0.5) / fwidth(wz) * u_GridSize / 2.0;
  471. float x1 = abs(fract(wx / u_GridSize2 - 0.5) - 0.5) / fwidth(wx) * u_GridSize2;
  472. float z1 = abs(fract(wz / u_GridSize2 - 0.5) - 0.5) / fwidth(wz) * u_GridSize2;
  473. // float v0 = 1.0 - clamp(min(x0, z0), 0.0, 1.0);
  474. float v1 = 1.0 - clamp(min(x1, z1), 0.0, 1.0);
  475. // if (v0 > 0.1) {
  476. // gl_FragColor = mix(gl_FragColor, u_GridColor, v0);
  477. // }
  478. // else {
  479. gl_FragColor = mix(gl_FragColor, u_GridColor2, v1);
  480. // }
  481. }
  482. // float shadowFactor = calcShadow(u_ShadowMap, v_PositionFromLight, l, n);
  483. // vec3 diffuseColor = u_LightColor * NdotL * shadowFactor;
  484. // gl_FragColor.rgb *= diffuseColor;
  485. }`,eu=`attribute vec3 a_Position;
  486. varying vec3 v_Position;
  487. uniform mat4 projectionMatrix;
  488. uniform mat4 modelViewMatrix;
  489. void main() {
  490. v_Position = a_Position;
  491. gl_Position = projectionMatrix * modelViewMatrix * vec4(a_Position, 1.);
  492. }`,sh=(Yn=(0,O.b2)(),_i=(0,O.f3)(D.Systems),ra=(0,O.t6)(D.MaterialSystem),lo=(0,O.f3)(D.Systems),$l=(0,O.t6)(D.GeometrySystem),Zo=(0,O.f3)(D.ShaderModuleService),Yn(gd=(xo=(oh=function(b){(0,V.Z)(L,b);var q=Qh(L);function L(){var X;(0,B.Z)(this,L);for(var K=arguments.length,ve=new Array(K),Ce=0;Ce<K;Ce++)ve[Ce]=arguments[Ce];return X=q.call.apply(q,[this].concat(ve)),S(X,"materialSystem",yd,(0,Vt.Z)(X)),S(X,"geometrySystem",ah,(0,Vt.Z)(X)),S(X,"shaderModuleService",ga,(0,Vt.Z)(X)),X}return(0,N.Z)(L,[{key:"onAttributeChanged",value:function(K){var ve=K.name,Ce=K.data,Ue=this.getMeshComponent();Ue&&Ue.material&&(ve==="gridColor"?(Ue.material.setUniform("u_GridColor",Ce),Ue.material.setUniform("u_GridColor2",Ce)):ve==="gridSize"&&(Ue.material.setUniform("u_GridSize",Ce),Ue.material.setUniform("u_GridSize2",Ce)))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:eu,fs:qh});var K=this.shaderModuleService.getModule("grid"),ve=K.vs,Ce=K.fs,Ue=K.uniforms,nt=this.materialSystem.createShaderMaterial({vertexShader:ve,fragmentShader:Ce});this.setMaterial(nt);var vt=this.geometrySystem.createBufferGeometry({vertexCount:4});this.setGeometry(vt),nt.setCull({enable:!1,face:bt.BACK}).setDepth({enable:!0,func:bt.LESS}),nt.setUniform(Ue),this.setAttributes({gridColor:this.config.gridColor,gridSize:this.config.gridSize}),vt.setIndex([0,3,2,2,1,0]),vt.setAttribute("a_Position",Float32Array.from([-4,-1,-4,4,-1,-4,4,-1,4,-4,-1,4]),{arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]})}}]),L}(Xo),oh),yd=E(xo.prototype,"materialSystem",[_i,ra],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ah=E(xo.prototype,"geometrySystem",[lo,$l],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ga=E(xo.prototype,"shaderModuleService",[Zo],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),xo))||gd),xd=M(32644),el=M(40582);function Sd(b,q,L,X,K){tl(q,X,-K),tl(q,X,K),b.push(L),b.push(L)}function tl(b,q,L){b.push([[q[0],q[1]],L])}function rl(b,q,L){var X=[0,0],K=[0,0],ve=[0,0],Ce=[0,0],Ue=-1,nt=!1,vt=null,_t=(0,xd.create)(),rr=L||0,Mr=3,Rr=[],Cr=[],Dr=[],an=[0,0];q&&(b=b.slice(),b.push(b[0]));for(var _n=b.length,An=1;An<_n;An++){var vn=rr,ei=b[An-1],Gn=b[An],mi=An<b.length-1?b[An+1]:null;if(an.push(An/_n,An/_n),(0,el.o7)(X,Gn,ei),vt||(vt=[0,0],(0,el.mJ)(vt,X)),nt||(nt=!0,Sd(Cr,Rr,ei,vt,1)),Dr.push([vn+0,vn+1,vn+2]),!mi)(0,el.mJ)(vt,X),Sd(Cr,Rr,Gn,vt,1),Dr.push(Ue===1?[vn,vn+2,vn+3]:[vn+2,vn+1,vn+3]),rr+=2;else{(0,el.o7)(K,mi,Gn);var si=(0,el.x7)(ve,Ce,X,K,1),ni=(0,xd.dot)(ve,vt)<0?-1:1,oa=si>Mr;if(!isFinite(si)){(0,el.mJ)(vt,X),Sd(Cr,Rr,Gn,vt,1),Dr.push(Ue===1?[vn,vn+2,vn+3]:[vn+2,vn+1,vn+3]),rr+=2,Ue=ni;continue}oa?(si=Mr,an.push(An/_n),tl(Rr,vt,-ni),Cr.push(Gn),tl(Rr,Ce,si*ni),Cr.push(Gn),Dr.push(Ue!==-ni?[vn,vn+2,vn+3]:[vn+2,vn+1,vn+3]),Dr.push([vn+2,vn+3,vn+4]),(0,el.mJ)(_t,K),(0,xd.copy)(vt,_t),tl(Rr,vt,-ni),Cr.push(Gn),rr+=3):(Sd(Cr,Rr,Gn,Ce,si),Dr.push(Ue===1?[vn,vn+2,vn+3]:[vn+2,vn+1,vn+3]),ni=-1,(0,xd.copy)(vt,Ce),rr+=2),Ue=ni}}return{normals:Rr,attrIndex:Dr,attrPos:Cr,attrCounters:an}}var uh,ch,Wa,Ql,md,fh,ev,nl,Rd,tv,bd,lh;function kd(b){var q=dh();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function dh(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var Bd=`uniform float u_dash_array : 0.02;
  493. uniform float u_dash_offset : 0;
  494. uniform float u_dash_ratio : 0;
  495. uniform float u_thickness : 0.02;
  496. varying vec4 v_color;
  497. varying vec2 v_normal;
  498. varying float v_counters;
  499. void main() {
  500. float blur = 1. - smoothstep(0.98, 1., length(v_normal));
  501. gl_FragColor = v_color;
  502. gl_FragColor.a *= blur * ceil(mod(v_counters + u_dash_offset, u_dash_array) - (u_dash_array * u_dash_ratio));
  503. }`,wd=`attribute vec2 a_pos;
  504. attribute vec4 a_color;
  505. attribute float a_line_miter;
  506. attribute vec2 a_line_normal;
  507. attribute float a_counters;
  508. uniform mat4 projectionMatrix;
  509. uniform mat4 modelViewMatrix;
  510. uniform float u_thickness : 0.02;
  511. uniform vec2 u_viewport;
  512. varying vec4 v_color;
  513. varying vec2 v_normal;
  514. varying float v_counters;
  515. void main() {
  516. v_color = a_color;
  517. v_counters = a_counters;
  518. vec3 normal = normalize(vec3(a_line_normal, 0.0));
  519. vec4 offset = vec4(normal * u_thickness / 2.0 * a_line_miter, 0.0);
  520. v_normal = vec2(normal * sign(a_line_miter));
  521. gl_Position = projectionMatrix * modelViewMatrix * vec4(a_pos, 0.0, 1.0) + offset;
  522. }
  523. `,rv=(uh=(0,O.b2)(),ch=(0,O.f3)(D.Systems),Wa=(0,O.t6)(D.MaterialSystem),Ql=(0,O.f3)(D.Systems),md=(0,O.t6)(D.GeometrySystem),fh=(0,O.f3)(D.ShaderModuleService),uh(ev=(nl=(lh=function(b){(0,V.Z)(L,b);var q=kd(L);function L(){var X;(0,B.Z)(this,L);for(var K=arguments.length,ve=new Array(K),Ce=0;Ce<K;Ce++)ve[Ce]=arguments[Ce];return X=q.call.apply(q,[this].concat(ve)),S(X,"materialSystem",Rd,(0,Vt.Z)(X)),S(X,"geometrySystem",tv,(0,Vt.Z)(X)),S(X,"shaderModuleService",bd,(0,Vt.Z)(X)),X.vertexCount=void 0,X}return(0,N.Z)(L,[{key:"onAttributeChanged",value:function(K){var ve=K.name,Ce=K.data,Ue=this.getMeshComponent();if(Ue&&Ue.material)switch(ve){case"dashArray":Ue.material.setUniform("u_dash_array",Ce);break;case"dashOffset":Ue.material.setUniform("u_dash_offset",Ce);break;case"dashRatio":Ue.material.setUniform("u_dash_ratio",Ce);break;case"thickness":Ue.material.setUniform("u_thickness",Ce);break;case"color":var nt=new Array(this.vertexCount).fill(void 0).map(function(){return Ce}).reduce(function(vt,_t){return[].concat((0,Yi.Z)(vt),(0,Yi.Z)(_t))},[]);Ue.geometry.setAttribute("a_color",Float32Array.from(nt),{arrayStride:4*4,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]});break}}},{key:"onEntityCreated",value:function(){var K=this;this.shaderModuleService.registerModule("line",{vs:wd,fs:Bd});var ve=this.shaderModuleService.getModule("line"),Ce=ve.vs,Ue=ve.fs,nt=ve.uniforms,vt=this.materialSystem.createShaderMaterial({vertexShader:Ce,fragmentShader:Ue}),_t=rl(this.config.points,!1),rr=_t.normals,Mr=_t.attrIndex,Rr=_t.attrPos,Cr=_t.attrCounters,Dr=Rr.length;this.vertexCount=Dr;var an=this.geometrySystem.createBufferGeometry({vertexCount:Dr});this.setMaterial(vt),this.setGeometry(an),vt.setCull({enable:!1,face:bt.BACK}).setUniform(nt),this.setAttributes({dashArray:this.config.dashArray,dashOffset:this.config.dashOffset,dashRatio:this.config.dashRatio,thickness:this.config.thickness});var _n=[],An=[];rr.forEach(function(ei){var Gn=ei[0],mi=ei[1];_n.push([Gn[0],Gn[1]]),An.push(mi)}),an.setIndex(Mr.reduce(function(ei,Gn){return[].concat((0,Yi.Z)(ei),(0,Yi.Z)(Gn))},[])),an.setAttribute("a_pos",Float32Array.from(Rr.reduce(function(ei,Gn){return[].concat((0,Yi.Z)(ei),(0,Yi.Z)(Gn))},[])),{arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]});var vn=new Array(Dr).fill(void 0).map(function(){return(0,Yi.Z)(K.config.color)}).reduce(function(ei,Gn){return[].concat((0,Yi.Z)(ei),(0,Yi.Z)(Gn))},[]);an.setAttribute("a_color",Float32Array.from(vn),{arrayStride:4*4,stepMode:"vertex",attributes:[{shaderLocation:1,offset:0,format:"float4"}]}),an.setAttribute("a_line_miter",Float32Array.from(An),{arrayStride:4*1,stepMode:"vertex",attributes:[{shaderLocation:2,offset:0,format:"float"}]}),an.setAttribute("a_line_normal",Float32Array.from(_n.reduce(function(ei,Gn){return[].concat((0,Yi.Z)(ei),(0,Yi.Z)(Gn))},[])),{arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:3,offset:0,format:"float2"}]}),an.setAttribute("a_counters",Float32Array.from(Cr),{arrayStride:4*1,stepMode:"vertex",attributes:[{shaderLocation:4,offset:0,format:"float"}]})}}]),L}(Xo),lh),Rd=E(nl.prototype,"materialSystem",[ch,Wa],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),tv=E(nl.prototype,"geometrySystem",[Ql,md],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),bd=E(nl.prototype,"shaderModuleService",[fh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),nl))||ev);function nv(b){return[b+1&255,b+1>>8&255,b+1>>8>>8&255]}var hh,Jl,vh,Gd,ph,gh,Ed,il,yh,mh,bh,Eh;function Fd(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function _h(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?Fd(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):Fd(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}function iv(b){var q=av();return function(){var X=(0,Z.Z)(b),K;if(q){var ve=(0,Z.Z)(this).constructor;K=Reflect.construct(X,arguments,ve)}else K=X.apply(this,arguments);return(0,z.Z)(this,K)}}function av(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(b){return!1}}var ov=`uniform float u_blur : 0.05;
  524. uniform float u_opacity : 0.7;
  525. uniform float u_stroke_width : 0.01;
  526. uniform vec4 u_stroke_color : [0, 0, 0, 0];
  527. uniform float u_stroke_opacity : 1;
  528. varying vec4 v_color;
  529. varying vec4 v_data;
  530. varying float v_radius;
  531. #pragma include "sdf2d"
  532. #pragma include "picking"
  533. void main() {
  534. int shape = int(floor(v_data.w + 0.5));
  535. float antialiasblur = v_data.z;
  536. float antialiased_blur = -max(u_blur, antialiasblur);
  537. float r = v_radius / (v_radius + u_stroke_width);
  538. float outer_df;
  539. float inner_df;
  540. // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'
  541. // if (shape == 0) {
  542. outer_df = sdCircle(v_data.xy, 1.0);
  543. inner_df = sdCircle(v_data.xy, r);
  544. // } else if (shape == 1) {
  545. // outer_df = sdEquilateralTriangle(1.1 * v_data.xy);
  546. // inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);
  547. // } else if (shape == 2) {
  548. // outer_df = sdBox(v_data.xy, vec2(1.));
  549. // inner_df = sdBox(v_data.xy, vec2(r));
  550. // } else if (shape == 3) {
  551. // outer_df = sdPentagon(v_data.xy, 0.8);
  552. // inner_df = sdPentagon(v_data.xy, r * 0.8);
  553. // } else if (shape == 4) {
  554. // outer_df = sdHexagon(v_data.xy, 0.8);
  555. // inner_df = sdHexagon(v_data.xy, r * 0.8);
  556. // } else if (shape == 5) {
  557. // outer_df = sdOctogon(v_data.xy, 1.0);
  558. // inner_df = sdOctogon(v_data.xy, r);
  559. // } else if (shape == 6) {
  560. // outer_df = sdHexagram(v_data.xy, 0.52);
  561. // inner_df = sdHexagram(v_data.xy, r * 0.52);
  562. // } else if (shape == 7) {
  563. // outer_df = sdRhombus(v_data.xy, vec2(1.0));
  564. // inner_df = sdRhombus(v_data.xy, vec2(r));
  565. // } else if (shape == 8) {
  566. // outer_df = sdVesica(v_data.xy, 1.1, 0.8);
  567. // inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);
  568. // }
  569. float opacity_t = smoothstep(0.0, antialiased_blur, outer_df);
  570. float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(
  571. antialiased_blur,
  572. 0.0,
  573. inner_df
  574. );
  575. vec4 strokeColor = u_stroke_color == vec4(0) ? v_color : u_stroke_color;
  576. gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);
  577. gl_FragColor.a = gl_FragColor.a * opacity_t;
  578. gl_FragColor = filterColor(gl_FragColor);
  579. }`,sv=`attribute vec2 position;
  580. attribute vec4 color;
  581. attribute float shape;
  582. attribute vec2 offset;
  583. attribute float size;
  584. uniform mat4 projectionMatrix;
  585. uniform mat4 modelViewMatrix;
  586. uniform float u_stroke_width : 0.01;
  587. uniform float u_device_pixel_ratio;
  588. uniform vec2 u_viewport;
  589. varying vec4 v_color;
  590. varying vec4 v_data;
  591. varying float v_radius;
  592. #pragma include "picking"
  593. void main() {
  594. v_color = color;
  595. v_radius = size;
  596. lowp float antialiasblur = 1.0 / u_device_pixel_ratio * (size + u_stroke_width);
  597. // construct point coords
  598. v_data = vec4(position, antialiasblur, shape);
  599. gl_Position = projectionMatrix * modelViewMatrix
  600. * vec4(position * size + offset, 0.0, 1.0);
  601. setPickingColor(a_PickingColor);
  602. }`,uv=["circle","triangle","square","pentagon","hexagon","octogon","hexagram","rhombus","vesica"],xv=(hh=(0,O.b2)(),Jl=(0,O.f3)(D.Systems),vh=(0,O.t6)(D.MaterialSystem),Gd=(0,O.f3)(D.Systems),ph=(0,O.t6)(D.GeometrySystem),gh=(0,O.f3)(D.ShaderModuleService),hh(Ed=(il=(Eh=function(b){(0,V.Z)(L,b);var q=iv(L);function L(){var X;(0,B.Z)(this,L);for(var K=arguments.length,ve=new Array(K),Ce=0;Ce<K;Ce++)ve[Ce]=arguments[Ce];return X=q.call.apply(q,[this].concat(ve)),S(X,"materialSystem",yh,(0,Vt.Z)(X)),S(X,"geometrySystem",mh,(0,Vt.Z)(X)),S(X,"shaderModuleService",bh,(0,Vt.Z)(X)),X}return(0,N.Z)(L,[{key:"onAttributeChanged",value:function(K){var ve=K.name,Ce=K.data,Ue=this.getMeshComponent();Ue&&Ue.material&&(ve==="strokeWidth"?Ue.material.setUniform("u_stroke_width",Ce):ve==="strokeColor"?Ue.material.setUniform("u_stroke_color",Ce):ve==="strokeOpacity"?Ue.material.setUniform("u_stroke_opacity",Ce):ve==="opacity"?Ue.material.setUniform("u_opacity",Ce):ve==="blur"&&Ue.material.setUniform("u_blur",Ce))}},{key:"onEntityCreated",value:function(){this.shaderModuleService.registerModule("grid",{vs:sv,fs:ov});var K=this.shaderModuleService.getModule("grid"),ve=K.vs,Ce=K.fs,Ue=K.uniforms,nt=this.materialSystem.createShaderMaterial({vertexShader:ve,fragmentShader:Ce,cull:{enable:!1},depth:{enable:!1},blend:{enable:!0,func:{srcRGB:bt.SRC_ALPHA,dstRGB:bt.ONE_MINUS_SRC_ALPHA,srcAlpha:1,dstAlpha:1}}});nt.setUniform(_h({u_device_pixel_ratio:window.devicePixelRatio},Ue));var vt=this.buildAttributes(),_t=this.geometrySystem.createInstancedBufferGeometry({maxInstancedCount:vt.instancedOffsets.length/2,vertexCount:6});_t.setIndex([0,2,1,0,3,2]),_t.setAttribute("position",Float32Array.from(vt.positions),{arrayStride:4*2,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float2"}]}),_t.setAttribute("offset",Float32Array.from(vt.instancedOffsets),{arrayStride:4*2,stepMode:"instance",attributes:[{shaderLocation:1,offset:0,format:"float2"}]}),_t.setAttribute("color",Float32Array.from(vt.instancedColors),{arrayStride:4*4,stepMode:"instance",attributes:[{shaderLocation:2,offset:0,format:"float4"}]}),_t.setAttribute("size",Float32Array.from(vt.instancedSizes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:3,offset:0,format:"float"}]}),_t.setAttribute("shape",Float32Array.from(vt.instancedShapes),{arrayStride:4,stepMode:"instance",attributes:[{shaderLocation:4,offset:0,format:"float"}]}),_t.setAttribute("a_PickingColor",Float32Array.from(vt.instancedPickingColors),{arrayStride:4*3,stepMode:"instance",attributes:[{shaderLocation:6,offset:0,format:"float3"}]}),this.setMaterial(nt),this.setGeometry(_t)}},{key:"buildAttribute",value:function(K,ve,Ce){var Ue,nt,vt,_t;(Ue=ve.instancedPickingColors).push.apply(Ue,(0,Yi.Z)(nv(K.id||Ce))),ve.instancedShapes.push(uv.indexOf(K.shape||"circle")),(nt=ve.instancedColors).push.apply(nt,(0,Yi.Z)(K.color||[1,0,0,1])),(vt=ve.instancedOffsets).push.apply(vt,(0,Yi.Z)(K.position||[0,0])),(_t=ve.instancedSizes).push.apply(_t,(0,Yi.Z)(K.size||[.2,.2]))}},{key:"buildAttributes",value:function(){var K=this,ve={positions:[1,1,1,-1,-1,-1,-1,1],instancedOffsets:[],instancedColors:[],instancedSizes:[],instancedShapes:[],instancedPickingColors:[]};return Array.isArray(this.config)?this.config.forEach(function(Ce,Ue){K.buildAttribute(Ce,ve,Ue)}):this.buildAttribute(this.config,ve,0),ve}}]),L}(Xo),Eh),yh=E(il.prototype,"materialSystem",[Jl,vh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),mh=E(il.prototype,"geometrySystem",[Gd,ph],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),bh=E(il.prototype,"shaderModuleService",[gh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),il))||Ed),Ku,xh,Md,Ud,zd,ql,Cd,Sh,wh,Wd;function jd(b,q){var L;if(typeof Symbol=="undefined"||b[Symbol.iterator]==null){if(Array.isArray(b)||(L=Mh(b))||q&&b&&typeof b.length=="number"){L&&(b=L);var X=0,K=function(){};return{s:K,n:function(){return X>=b.length?{done:!0}:{done:!1,value:b[X++]}},e:function(vt){throw vt},f:K}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
  603. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ve=!0,Ce=!1,Ue;return{s:function(){L=b[Symbol.iterator]()},n:function(){var vt=L.next();return ve=vt.done,vt},e:function(vt){Ce=!0,Ue=vt},f:function(){try{!ve&&L.return!=null&&L.return()}finally{if(Ce)throw Ue}}}}function Mh(b,q){if(!!b){if(typeof b=="string")return Ch(b,q);var L=Object.prototype.toString.call(b).slice(8,-1);if(L==="Object"&&b.constructor&&(L=b.constructor.name),L==="Map"||L==="Set")return Array.from(b);if(L==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(L))return Ch(b,q)}}function Ch(b,q){(q==null||q>b.length)&&(q=b.length);for(var L=0,X=new Array(q);L<q;L++)X[L]=b[L];return X}var cv=`#ifdef USE_MAP
  604. uniform sampler2D map;
  605. #endif`,fv=`#ifdef USE_MAP
  606. vec4 texelColor = texture2D(map, vUv);
  607. // texelColor = mapTexelToLinear(texelColor);
  608. diffuseColor *= texelColor;
  609. #endif`,lv=`#if (defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ))
  610. varying vec2 vUv;
  611. #endif`,dv=`#ifdef USE_UV
  612. attribute vec2 uv;
  613. #ifdef UVS_VERTEX_ONLY
  614. vec2 vUv;
  615. #else
  616. varying vec2 vUv;
  617. #endif
  618. uniform mat3 uvTransform;
  619. #endif`,Td=`#ifdef USE_UV
  620. vUv = (uvTransform * vec3(uv, 1)).xy;
  621. #endif`,Vd=(Ku=(0,O.b2)(),xh=(0,O.f3)(D.RenderEngine),Md=(0,O.f3)(D.ShaderModuleService),Ud=(0,O.f3)(D.ConfigService),Ku(zd=(ql=(Wd=function(){function b(){(0,B.Z)(this,b),this.container=void 0,S(this,"engine",Cd,this),S(this,"shaderModule",Sh,this),S(this,"configService",wh,this),this.inited=!1,this.rendering=!1,this.pendings=[],this.views=[],this.size=void 0}return(0,N.Z)(b,[{key:"init",value:function(){var q=(0,p.Z)(v().mark(function X(){var K,ve,Ce,Ue,nt;return v().wrap(function(_t){for(;;)switch(_t.prev=_t.next){case 0:if(this.shaderModule.registerBuiltinModules(),this.shaderModule.registerModule("uv.vert.declaration",{vs:dv}),this.shaderModule.registerModule("uv.vert.main",{vs:Td}),this.shaderModule.registerModule("uv.frag.declaration",{fs:lv}),this.shaderModule.registerModule("map.frag.declaration",{fs:cv}),this.shaderModule.registerModule("map.frag.main",{fs:fv}),K=this.container.getAll(D.Systems),ve=this.configService.get(),!ve.canvas){_t.next=30;break}return _t.next=11,this.engine.init({canvas:ve.canvas,swapChainFormat:on.EV.BGRA8Unorm,antialiasing:!1});case 11:Ce=jd(K),_t.prev=12,Ce.s();case 14:if((Ue=Ce.n()).done){_t.next=21;break}if(nt=Ue.value,!nt.initialize){_t.next=19;break}return _t.next=19,nt.initialize();case 19:_t.next=14;break;case 21:_t.next=26;break;case 23:_t.prev=23,_t.t0=_t.catch(12),Ce.e(_t.t0);case 26:return _t.prev=26,Ce.f(),_t.finish(26);case 29:this.inited=!0;case 30:case"end":return _t.stop()}},X,this,[[12,23,26,29]])}));function L(){return q.apply(this,arguments)}return L}()},{key:"render",value:function(){var q=(0,p.Z)(v().mark(function X(){var K,ve,Ce,Ue,nt,vt,_t,rr=arguments;return v().wrap(function(Rr){for(;;)switch(Rr.prev=Rr.next){case 0:if(!(!this.inited||this.rendering)){Rr.next=2;break}return Rr.abrupt("return");case 2:for(this.pendings.length&&this.pendings.forEach(function(Cr){Cr()}),this.rendering=!0,this.engine.beginFrame(),K=this.container.getAll(D.Systems),ve=rr.length,Ce=new Array(ve),Ue=0;Ue<ve;Ue++)Ce[Ue]=rr[Ue];nt=jd(K),Rr.prev=8,nt.s();case 10:if((vt=nt.n()).done){Rr.next=17;break}if(_t=vt.value,!_t.execute){Rr.next=15;break}return Rr.next=15,_t.execute(Ce);case 15:Rr.next=10;break;case 17:Rr.next=22;break;case 19:Rr.prev=19,Rr.t0=Rr.catch(8),nt.e(Rr.t0);case 22:return Rr.prev=22,nt.f(),Rr.finish(22);case 25:this.engine.endFrame(),this.rendering=!1;case 27:case"end":return Rr.stop()}},X,this,[[8,19,22,25]])}));function L(){return q.apply(this,arguments)}return L}()},{key:"clear",value:function(L){var X=this;return this.inited?this.engine.clear(L):this.pendings.unshift(function(){X.engine.clear(L),X.pendings.shift()}),this}},{key:"setSize",value:function(L){var X=L.width,K=L.height,ve=this.engine.getCanvas();return this.size={width:X,height:K},ve.width=X,ve.height=K,this}},{key:"getSize",value:function(){return this.size}}]),b}(),Wd),Cd=E(ql.prototype,"engine",[xh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Sh=E(ql.prototype,"shaderModule",[Md],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),wh=E(ql.prototype,"configService",[Ud],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),ql))||zd),Xd,Yd,Th,Ah=(Xd=(0,O.b2)(),Xd(Yd=(Th=function(){function b(){(0,B.Z)(this,b),this.entities=[]}return(0,N.Z)(b,[{key:"getEntities",value:function(){return this.entities}},{key:"addRenderable",value:function(L){return this.addEntity(L.getEntity()),this}},{key:"removeRenderable",value:function(L){return this.removeEntity(L.getEntity()),this}},{key:"addLight",value:function(){}},{key:"addEntity",value:function(L){return this.entities.indexOf(L)===-1&&this.entities.push(L),this}},{key:"removeEntity",value:function(L){var X=this.entities.indexOf(L);return this.entities.splice(X,1),this}}]),b}(),Th))||Yd),Zd,Ih,Ph,Oh=(Zd=(0,O.b2)(),Zd(Ih=(Ph=function(){function b(){(0,B.Z)(this,b),this.cache={}}return(0,N.Z)(b,[{key:"get",value:function(L){return this.cache[L]}},{key:"set",value:function(L,X){this.cache[L]=X}}]),b}(),Ph))||Ih),Hd,Dh,Kd,Nh,Ad,$d,Lh,Rh;function kh(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function Bh(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?kh(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):kh(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}var Gh=(Hd=(0,O.b2)(),Dh=(0,O.f3)(Oh),Kd=(0,O.f3)(D.RenderEngine),Hd(Nh=(Ad=(Rh=function(){function b(){(0,B.Z)(this,b),S(this,"textureCache",$d,this),S(this,"engine",Lh,this),this.config=void 0,this.loaded=!1,this.texture=void 0}return(0,N.Z)(b,[{key:"setConfig",value:function(L){this.config=L}},{key:"isLoaded",value:function(){return this.loaded}},{key:"load",value:function(){var q=(0,p.Z)(v().mark(function X(){var K=this;return v().wrap(function(Ce){for(;;)switch(Ce.prev=Ce.next){case 0:if(!this.config.url){Ce.next=4;break}return Ce.abrupt("return",new Promise(function(Ue,nt){var vt=K.textureCache.get(K.config.url);if(vt)Ue(vt);else{var _t=new Image;_t.crossOrigin="Anonymous",_t.src=K.config.url,_t.onload=function(){var rr=K.engine.createTexture2D(Bh(Bh({},K.config),{},{data:_t,width:_t.width,height:_t.height,flipY:!0}));K.textureCache.set(K.config.url,rr),K.texture=rr,K.loaded=!0,Ue(rr)},_t.onerror=function(){nt()}}}));case 4:return this.loaded=!0,this.texture=this.engine.createTexture2D(this.config),Ce.abrupt("return",this.texture);case 7:case"end":return Ce.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()}]),b}(),Rh),$d=E(Ad.prototype,"textureCache",[Dh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Lh=E(Ad.prototype,"engine",[Kd],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Ad))||Nh),Qd,Fh,Uh,zh,Jd,qd,Wh,jh=(Qd=(0,O.b2)(),Fh=(0,O.f3)(D.Systems),Uh=(0,O.t6)(D.RendererSystem),Qd(zh=(Jd=(Wh=function(){function b(){(0,B.Z)(this,b),S(this,"rendererSystem",qd,this),this.camera=void 0,this.scene=void 0,this.viewport={x:0,y:0,width:0,height:0},this.clearColor=[1,1,1,1]}return(0,N.Z)(b,[{key:"getCamera",value:function(){return this.camera}},{key:"getScene",value:function(){return this.scene}},{key:"getViewport",value:function(){return this.viewport}},{key:"getClearColor",value:function(){return this.clearColor}},{key:"setCamera",value:function(L){return this.camera=L,this}},{key:"setScene",value:function(L){return this.scene=L,this}},{key:"setViewport",value:function(L){return this.viewport=L,this}},{key:"setClearColor",value:function(L){return this.clearColor=L,this}},{key:"pick",value:function(L){return this.rendererSystem.pick(L,this)}}]),b}(),Wh),qd=E(Jd.prototype,"rendererSystem",[Fh,Uh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Jd))||zh),Vh,eh,Xh,Id,Yh,Zh;function th(b,q){var L=Object.keys(b);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(b);q&&(X=X.filter(function(K){return Object.getOwnPropertyDescriptor(b,K).enumerable})),L.push.apply(L,X)}return L}function hv(b){for(var q=1;q<arguments.length;q++){var L=arguments[q]!=null?arguments[q]:{};q%2?th(Object(L),!0).forEach(function(X){(0,Fe.Z)(b,X,L[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(L)):th(Object(L)).forEach(function(X){Object.defineProperty(b,X,Object.getOwnPropertyDescriptor(L,X))})}return b}var vv=(Vh=(0,O.b2)(),eh=(0,O.f3)(D.ConfigService),Vh(Xh=(Id=(Zh=function(){function b(){(0,B.Z)(this,b),S(this,"configService",Yh,this),this.container=void 0}return(0,N.Z)(b,[{key:"getEngine",value:function(){var q=(0,p.Z)(v().mark(function X(){var K,ve,Ce,Ue;return v().wrap(function(vt){for(;;)switch(vt.prev=vt.next){case 0:return K=this.container.get(D.RenderEngine),ve=this.configService.get(),Ce=ve.canvas,Ue=ve.engineOptions,vt.next=4,K.init(hv({canvas:Ce||jo(),swapChainFormat:on.EV.BGRA8Unorm,antialiasing:!1},Ue));case 4:return vt.abrupt("return",K);case 5:case"end":return vt.stop()}},X,this)}));function L(){return q.apply(this,arguments)}return L}()},{key:"getTransformComponent",value:function(L){var X=this.container.get(D.TransformComponentManager);return X.getComponentByEntity(L)}},{key:"getMeshComponent",value:function(L){var X=this.container.get(D.MeshComponentManager);return X.getComponentByEntity(L)}},{key:"setConfig",value:function(L){this.configService.set(L)}},{key:"setContainer",value:function(L){this.container=L}},{key:"getContainer",value:function(){return this.container}},{key:"createEntity",value:function(){return l()}},{key:"createScene",value:function(){return this.container.get(Ah)}},{key:"createCamera",value:function(){return this.container.get(Yc)}},{key:"createView",value:function(){return this.container.get(jh)}},{key:"createRenderable",value:function(L,X){var K=L?this.container.getNamed(D.Renderable,L):this.container.get(Xo),ve=l();return K.setConfig(X||{}),K.setEntity(ve),K}},{key:"createGeometry",value:function(L,X){var K=this.container.getNamed(D.Geometry,L),ve=l();return K.setConfig(X||{}),K.setEntity(ve),K.getComponent()}},{key:"createMaterial",value:function(L,X){var K=this.container.getNamed(D.Material,L),ve=l();return K.setConfig(X||{}),K.setEntity(ve,L),K.getComponent()}},{key:"createTexture2D",value:function(L){var X=this.container.get(Gh);return X.setConfig(L),X}},{key:"createBufferGeometry",value:function(L){var X=this.container.getNamed(D.Systems,D.GeometrySystem);return X.createBufferGeometry(L)}},{key:"createInstancedBufferGeometry",value:function(L){var X=this.container.getNamed(D.Systems,D.GeometrySystem);return X.createInstancedBufferGeometry(L)}},{key:"createShaderMaterial",value:function(L){var X=this.container.getNamed(D.Systems,D.MaterialSystem);return X.createShaderMaterial(L)}},{key:"createKernel",value:function(L){var X=this.container.get(ha);return typeof L=="string"?X.setBundle(JSON.parse(L)):X.setBundle(L),X.init(),X}},{key:"createRenderer",value:function(){var L=this.container.get(Vd);return L.container=this.container,L.init(),L}},{key:"destroy",value:function(){var L=this.container.getAll(D.Systems);L.forEach(function(ve){ve.tearDown&&ve.tearDown()});var X=this.container.get(D.RenderEngine);X.destroy();var K=this.container.get(D.InteractorService);K.destroy()}}],[{key:"create",value:function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=xl(),K=navigator.gpu?Ki:_r;X.isBound(D.RenderEngine)||X.bind(D.RenderEngine).to(K).inSingletonScope(),X.bind(Vd).toSelf(),X.bind(ha).toSelf(),X.bind(Xo).toSelf(),X.bind(jh).toSelf(),X.bind(Yc).toSelf(),X.bind(Ah).toSelf(),X.bind(b).toSelf(),X.bind(Oh).toSelf(),X.bind(Gh).toSelf(),X.bind(D.Geometry).to(Bn).whenTargetNamed(cs.BOX),X.bind(D.Geometry).to(Wt).whenTargetNamed(cs.SPHERE),X.bind(D.Geometry).to(ot).whenTargetNamed(cs.PLANE),X.bind(D.Geometry).to(yt).whenTargetNamed(cs.MERGED),X.bind(D.Material).to(Fn).whenTargetNamed(Xs.BASIC),X.bind(D.Renderable).to(xv).whenTargetNamed(Xo.POINT),X.bind(D.Renderable).to(rv).whenTargetNamed(Xo.LINE),X.bind(D.Renderable).to(sh).whenTargetNamed(Xo.GRID);var ve=X.get(b);return ve.setContainer(X),ve.setConfig(L),ve}}]),b}(),Zh),Yh=E(Id.prototype,"configService",[eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),Id))||Xh)},67320:function(dt,x,M){"use strict";var S=this&&this.__createBinding||(Object.create?function(E,I,A,v){v===void 0&&(v=A);var p=Object.getOwnPropertyDescriptor(I,A);(!p||("get"in p?!I.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return I[A]}}),Object.defineProperty(E,v,p)}:function(E,I,A,v){v===void 0&&(v=A),E[v]=I[A]}),B=this&&this.__exportStar||function(E,I){for(var A in E)A!=="default"&&!Object.prototype.hasOwnProperty.call(I,A)&&S(I,E,A)};Object.defineProperty(x,"__esModule",{value:!0}),x.getLayoutByName=x.unRegisterLayout=x.registerLayout=void 0;var N=M(39464);Object.defineProperty(x,"registerLayout",{enumerable:!0,get:function(){return N.registerLayout}}),Object.defineProperty(x,"unRegisterLayout",{enumerable:!0,get:function(){return N.unRegisterLayout}}),Object.defineProperty(x,"getLayoutByName",{enumerable:!0,get:function(){return N.getLayoutByName}}),B(M(64649),x)},46253:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.Base=void 0;var M=function(){function S(){this.nodes=[],this.edges=[],this.combos=[],this.comboEdges=[],this.hiddenNodes=[],this.hiddenEdges=[],this.hiddenCombos=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=function(){}}return S.prototype.layout=function(B){return this.init(B),this.execute(!0)},S.prototype.init=function(B){this.nodes=B.nodes||[],this.edges=B.edges||[],this.combos=B.combos||[],this.comboEdges=B.comboEdges||[],this.hiddenNodes=B.hiddenNodes||[],this.hiddenEdges=B.hiddenEdges||[],this.hiddenCombos=B.hiddenCombos||[]},S.prototype.execute=function(B){},S.prototype.executeWithWorker=function(){},S.prototype.getDefaultCfg=function(){return{}},S.prototype.updateCfg=function(B){B&&Object.assign(this,B)},S.prototype.getType=function(){return"base"},S.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},S}();x.Base=M},93959:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var p=function(c,f){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,T){l.__proto__=T}||function(l,T){for(var m in T)Object.prototype.hasOwnProperty.call(T,m)&&(l[m]=T[m])},p(c,f)};return function(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");p(c,f);function l(){this.constructor=c}c.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.CircularLayout=void 0;var B=M(46253),N=M(8273);function E(p,c,f,l){p.forEach(function(T,m){p[m].children=[],p[m].parent=[]}),l?c.forEach(function(T){var m=(0,N.getEdgeTerminal)(T,"source"),w=(0,N.getEdgeTerminal)(T,"target"),O=0;m&&(O=f[m]);var D=0;w&&(D=f[w]);var g=p[O].children,_=p[D].parent;g.push(p[D].id),_.push(p[O].id)}):c.forEach(function(T){var m=(0,N.getEdgeTerminal)(T,"source"),w=(0,N.getEdgeTerminal)(T,"target"),O=0;m&&(O=f[m]);var D=0;w&&(D=f[w]);var g=p[O].children,_=p[D].children;g.push(p[D].id),_.push(p[O].id)})}function I(p,c,f){for(var l=f.length,T=0;T<l;T++){var m=(0,N.getEdgeTerminal)(f[T],"source"),w=(0,N.getEdgeTerminal)(f[T],"target");if(p.id===m&&c.id===w||c.id===m&&p.id===w)return!0}return!1}function A(p,c){var f=p.degree,l=c.degree;return f<l?-1:f>l?1:0}var v=function(p){S(c,p);function c(f){var l=p.call(this)||this;return l.radius=null,l.nodeSize=void 0,l.startRadius=null,l.endRadius=null,l.startAngle=0,l.endAngle=2*Math.PI,l.clockwise=!0,l.divisions=1,l.ordering=null,l.angleRatio=1,l.nodes=[],l.edges=[],l.nodeMap={},l.degrees=[],l.width=300,l.height=300,l.updateCfg(f),l}return c.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},c.prototype.execute=function(){var f,l=this,T=l.nodes,m=l.edges,w=T.length;if(w===0){l.onLayoutEnd&&l.onLayoutEnd();return}!l.width&&typeof window!="undefined"&&(l.width=window.innerWidth),!l.height&&typeof window!="undefined"&&(l.height=window.innerHeight),l.center||(l.center=[l.width/2,l.height/2]);var O=l.center;if(w===1){T[0].x=O[0],T[0].y=O[1],l.onLayoutEnd&&l.onLayoutEnd();return}var D=l.radius,g=l.startRadius,_=l.endRadius,Y=l.divisions,V=l.startAngle,z=l.endAngle,Z=l.angleRatio,J=l.ordering,ee=l.clockwise,Q=l.nodeSpacing,re=l.nodeSize,fe=(z-V)/w,me={};T.forEach(function($t,Ar){me[$t.id]=Ar}),l.nodeMap=me;var ae=(0,N.getDegree)(T.length,me,m);if(l.degrees=ae,Q){var Ee=(0,N.getFuncByUnknownType)(10,Q),Le=(0,N.getFuncByUnknownType)(10,re),De=-Infinity;T.forEach(function($t){var Ar=Le($t);De<Ar&&(De=Ar)});var Ve=0;T.forEach(function($t,Ar){Ar===0?Ve+=De||10:Ve+=(Ee($t)||0)+(De||10)}),D=Ve/(2*Math.PI)}else!D&&!g&&!_?D=l.height>l.width?l.width/2:l.height/2:!g&&_?g=_:g&&!_&&(_=g);var et=fe*Z,It=[];J==="topology"?It=l.topologyOrdering():J==="topology-directed"?It=l.topologyOrdering(!0):J==="degree"?It=l.degreeOrdering():It=T;for(var er=Math.ceil(w/Y),nr=0;nr<w;++nr){var Fe=D;!Fe&&g!==null&&_!==null&&(Fe=g+nr*(_-g)/(w-1)),Fe||(Fe=10+nr*100/(w-1));var Vt=V+nr%er*et+2*Math.PI/Y*Math.floor(nr/er);ee||(Vt=z-nr%er*et-2*Math.PI/Y*Math.floor(nr/er)),It[nr].x=O[0]+Math.cos(Vt)*Fe,It[nr].y=O[1]+Math.sin(Vt)*Fe,It[nr].weight=ae[nr].all}return(f=l.onLayoutEnd)===null||f===void 0||f.call(l),{nodes:It,edges:this.edges}},c.prototype.topologyOrdering=function(f){f===void 0&&(f=!1);var l=this,T=l.degrees,m=l.edges,w=l.nodes,O=(0,N.clone)(w),D=l.nodeMap,g=[O[0]],_=[w[0]],Y=[],V=w.length;Y[0]=!0,E(O,m,D,f);var z=0;return O.forEach(function(Z,J){if(J!==0)if((J===V-1||T[J].all!==T[J+1].all||I(g[z],Z,m))&&!Y[J])g.push(Z),_.push(w[D[Z.id]]),Y[J]=!0,z++;else{for(var ee=g[z].children,Q=!1,re=0;re<ee.length;re++){var fe=D[ee[re]];if(T[fe].all===T[J].all&&!Y[fe]){g.push(O[fe]),_.push(w[D[O[fe].id]]),Y[fe]=!0,Q=!0;break}}for(var me=0;!Q&&(Y[me]||(g.push(O[me]),_.push(w[D[O[me].id]]),Y[me]=!0,Q=!0),me++,me!==V););}}),_},c.prototype.degreeOrdering=function(){var f=this,l=f.nodes,T=[],m=f.degrees;return l.forEach(function(w,O){w.degree=m[O].all,T.push(w)}),T.sort(A),T},c.prototype.getType=function(){return"circular"},c}(B.Base);x.CircularLayout=v},6412:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var p=function(c,f){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,T){l.__proto__=T}||function(l,T){for(var m in T)Object.prototype.hasOwnProperty.call(T,m)&&(l[m]=T[m])},p(c,f)};return function(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");p(c,f);function l(){this.constructor=c}c.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}}(),B=this&&this.__assign||function(){return B=Object.assign||function(p){for(var c,f=1,l=arguments.length;f<l;f++){c=arguments[f];for(var T in c)Object.prototype.hasOwnProperty.call(c,T)&&(p[T]=c[T])}return p},B.apply(this,arguments)};Object.defineProperty(x,"__esModule",{value:!0}),x.ComboCombinedLayout=void 0;var N=M(24979),E=M(46253),I=M(8273),A=M(64649),v=function(p){S(c,p);function c(f){var l=p.call(this)||this;return l.center=[0,0],l.nodes=[],l.edges=[],l.combos=[],l.comboEdges=[],l.comboPadding=10,l.comboTrees=[],l.updateCfg(f),l}return c.prototype.getDefaultCfg=function(){return{}},c.prototype.execute=function(){var f=this,l=f.nodes,T=f.center;if(!l||l.length===0){f.onLayoutEnd&&f.onLayoutEnd();return}if(l.length===1){l[0].x=T[0],l[0].y=T[1],f.onLayoutEnd&&f.onLayoutEnd();return}f.initVals(),f.run(),f.onLayoutEnd&&f.onLayoutEnd()},c.prototype.run=function(){var f,l=this,T=l.nodes,m=l.edges,w=l.combos,O=l.comboEdges,D=l.center,g={};T.forEach(function(De){g[De.id]=De});var _={};w.forEach(function(De){_[De.id]=De});var Y=l.getInnerGraphs(g),V=[],z=[],Z={},J=!0;this.comboTrees.forEach(function(De){var Ve=Y[De.id],et=B(B({},De),{x:Ve.x||_[De.id].x,y:Ve.y||_[De.id].y,fx:Ve.fx||_[De.id].fx,fy:Ve.fy||_[De.id].fy,mass:Ve.mass||_[De.id].mass,size:Ve.size});z.push(et),!isNaN(et.x)&&et.x!==0&&!isNaN(et.y)&&et.y!==0?J=!1:(et.x=Math.random()*100,et.y=Math.random()*100),V.push(De.id),(0,I.traverseTreeUp)(De,function(It){return It.id!==De.id&&(Z[It.id]=De.id),!0})}),T.forEach(function(De){if(!(De.comboId&&_[De.comboId])){var Ve=B({},De);z.push(Ve),!isNaN(Ve.x)&&Ve.x!==0&&!isNaN(Ve.y)&&Ve.y!==0?J=!1:(Ve.x=Math.random()*100,Ve.y=Math.random()*100),V.push(De.id)}});var ee=[];if(m.concat(O).forEach(function(De){var Ve=Z[De.source]||De.source,et=Z[De.target]||De.target;Ve!==et&&V.includes(Ve)&&V.includes(et)&&ee.push({source:Ve,target:et})}),z==null?void 0:z.length){if(z.length===1)z[0].x=D[0],z[0].y=D[1];else{var Q={nodes:z,edges:ee},re=this.outerLayout||new A.GForceLayout({gravity:1,factor:2,linkDistance:function(De,Ve,et){var It,er,nr=((((It=Ve.size)===null||It===void 0?void 0:It[0])||30)+(((er=et.size)===null||er===void 0?void 0:er[0])||30))/2;return Math.min(nr*1.5,700)}}),fe=(f=re.getType)===null||f===void 0?void 0:f.call(re);if(re.updateCfg({center:D,kg:5,preventOverlap:!0,animate:!1}),J&&N.FORCE_LAYOUT_TYPE_MAP[fe]){var me=z.length<100?new A.MDSLayout:new A.GridLayout;me.layout(Q)}re.layout(Q)}z.forEach(function(De){var Ve=Y[De.id];if(!Ve){var et=g[De.id];et&&(et.x=De.x,et.y=De.y);return}Ve.visited=!0,Ve.x=De.x,Ve.y=De.y,Ve.nodes.forEach(function(It){It.x+=De.x,It.y+=De.y})})}for(var ae=Object.keys(Y),Ee=function(De){var Ve=ae[De],et=Y[Ve];if(!et)return"continue";et.nodes.forEach(function(It){et.visited||(It.x+=et.x||0,It.y+=et.y||0),g[It.id]&&(g[It.id].x=It.x,g[It.id].y=It.y)}),_[Ve]&&(_[Ve].x=et.x,_[Ve].y=et.y)},Le=ae.length-1;Le>=0;Le--)Ee(Le);return{nodes:T,edges:m,combos:w,comboEdges:O}},c.prototype.getInnerGraphs=function(f){var l=this,T=l.comboTrees,m=l.nodeSize,w=l.edges,O=l.comboPadding,D=l.spacing,g={},_=this.innerLayout||new A.ConcentricLayout({sortBy:"id"});return _.center=[0,0],_.preventOverlap=!0,_.nodeSpacing=D,(T||[]).forEach(function(Y){(0,I.traverseTreeUp)(Y,function(V){var z,Z=(O==null?void 0:O(V))||10;if((0,I.isArray)(Z)&&(Z=Math.max.apply(Math,Z)),(z=V.children)===null||z===void 0?void 0:z.length){var ee=V.children.map(function(et){if(et.itemType==="combo")return g[et.id];var It=f[et.id]||{};return B(B({},It),et)}),Q=ee.map(function(et){return et.id}),re={nodes:ee,edges:w.filter(function(et){return Q.includes(et.source)&&Q.includes(et.target)})},fe=Infinity;ee.forEach(function(et){var It;et.size||(et.size=((It=g[et.id])===null||It===void 0?void 0:It.size)||(m==null?void 0:m(et))||[30,30]),(0,I.isNumber)(et.size)&&(et.size=[et.size,et.size]),fe>et.size[0]&&(fe=et.size[0]),fe>et.size[1]&&(fe=et.size[1])}),_.layout(re);var me=(0,I.findMinMaxNodeXY)(ee),ae=me.minX,Ee=me.minY,Le=me.maxX,De=me.maxY,Ve=Math.max(Le-ae,De-Ee,fe)+Z*2;g[V.id]={id:V.id,nodes:ee,size:[Ve,Ve]}}else if(V.itemType==="combo"){var J=Z?[Z*2,Z*2]:[30,30];g[V.id]={id:V.id,nodes:[],size:J}}return!0})}),g},c.prototype.initVals=function(){var f=this,l=f.nodeSize,T=f.spacing,m,w;if((0,I.isNumber)(T)?w=function(){return T}:(0,I.isFunction)(T)?w=T:w=function(){return 0},this.spacing=w,!l)m=function(V){var z=w(V);if(V.size){if((0,I.isArray)(V.size)){var Z=V.size[0]>V.size[1]?V.size[0]:V.size[1];return(Z+z)/2}if((0,I.isObject)(V.size)){var Z=V.size.width>V.size.height?V.size.width:V.size.height;return(Z+z)/2}return(V.size+z)/2}return 10+z/2};else if((0,I.isFunction)(l))m=function(V){var z=l(V),Z=w(V);if((0,I.isArray)(V.size)){var J=V.size[0]>V.size[1]?V.size[0]:V.size[1];return(J+Z)/2}return((z||10)+Z)/2};else if((0,I.isArray)(l)){var O=l[0]>l[1]?l[0]:l[1],D=O/2;m=function(V){return D+w(V)/2}}else{var g=l/2;m=function(V){return g+w(V)/2}}this.nodeSize=m;var _=f.comboPadding,Y;(0,I.isNumber)(_)?Y=function(){return _}:(0,I.isArray)(_)?Y=function(){return Math.max.apply(null,_)}:(0,I.isFunction)(_)?Y=_:Y=function(){return 0},this.comboPadding=Y},c.prototype.getType=function(){return"comboCombined"},c}(E.Base);x.ComboCombinedLayout=v},48133:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var I=function(A,v){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,c){p.__proto__=c}||function(p,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(p[f]=c[f])},I(A,v)};return function(A,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");I(A,v);function p(){this.constructor=A}A.prototype=v===null?Object.create(v):(p.prototype=v.prototype,new p)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.ComboForceLayout=void 0;var B=M(46253),N=M(8273),E=function(I){S(A,I);function A(v){var p=I.call(this)||this;return p.center=[0,0],p.maxIteration=100,p.gravity=10,p.comboGravity=10,p.linkDistance=10,p.alpha=1,p.alphaMin=.001,p.alphaDecay=1-Math.pow(p.alphaMin,1/300),p.alphaTarget=0,p.velocityDecay=.6,p.edgeStrength=.6,p.nodeStrength=30,p.preventOverlap=!1,p.preventNodeOverlap=!1,p.preventComboOverlap=!1,p.collideStrength=void 0,p.nodeCollideStrength=.5,p.comboCollideStrength=.5,p.comboSpacing=20,p.comboPadding=10,p.optimizeRangeFactor=1,p.onTick=function(){},p.onLayoutEnd=function(){},p.depthAttractiveForceScale=1,p.depthRepulsiveForceScale=2,p.nodes=[],p.edges=[],p.combos=[],p.comboTrees=[],p.width=300,p.height=300,p.bias=[],p.nodeMap={},p.oriComboMap={},p.indexMap={},p.comboMap={},p.previousLayouted=!1,p.updateCfg(v),p}return A.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}},A.prototype.execute=function(){var v=this,p=v.nodes,c=v.center;if(v.comboTree={id:"comboTreeRoot",depth:-1,children:v.comboTrees},!p||p.length===0){v.onLayoutEnd&&v.onLayoutEnd();return}if(p.length===1){p[0].x=c[0],p[0].y=c[1],v.onLayoutEnd&&v.onLayoutEnd();return}v.initVals(),v.run(),v.onLayoutEnd&&v.onLayoutEnd()},A.prototype.run=function(){var v=this,p=v.nodes,c=v.previousLayouted?v.maxIteration/5:v.maxIteration;!v.width&&typeof window!="undefined"&&(v.width=window.innerWidth),!v.height&&typeof window!="undefined"&&(v.height=window.innerHeight);var f=v.center,l=v.velocityDecay,T=v.comboMap;v.previousLayouted||v.initPos(T);for(var m=function(g){var _=[];p.forEach(function(Y,V){_[V]={x:0,y:0}}),v.applyCalculate(_),v.applyComboCenterForce(_),p.forEach(function(Y,V){!(0,N.isNumber)(Y.x)||!(0,N.isNumber)(Y.y)||(Y.x+=_[V].x*l,Y.y+=_[V].y*l)}),v.alpha+=(v.alphaTarget-v.alpha)*v.alphaDecay,v.onTick()},w=0;w<c;w++)m(w);var O=[0,0];p.forEach(function(g){!(0,N.isNumber)(g.x)||!(0,N.isNumber)(g.y)||(O[0]+=g.x,O[1]+=g.y)}),O[0]/=p.length,O[1]/=p.length;var D=[f[0]-O[0],f[1]-O[1]];p.forEach(function(g,_){!(0,N.isNumber)(g.x)||!(0,N.isNumber)(g.y)||(g.x+=D[0],g.y+=D[1])}),v.combos.forEach(function(g){var _=T[g.id];_&&_.empty&&(g.x=_.cx||g.x,g.y=_.cy||g.y)}),v.previousLayouted=!0},A.prototype.initVals=function(){var v=this,p=v.edges,c=v.nodes,f=v.combos,l={},T={},m={};c.forEach(function(Fe,Vt){T[Fe.id]=Fe,m[Fe.id]=Vt}),v.nodeMap=T,v.indexMap=m;var w={};f.forEach(function(Fe){w[Fe.id]=Fe}),v.oriComboMap=w,v.comboMap=v.getComboMap();var O=v.preventOverlap;v.preventComboOverlap=v.preventComboOverlap||O,v.preventNodeOverlap=v.preventNodeOverlap||O;var D=v.collideStrength;D&&(v.comboCollideStrength=D,v.nodeCollideStrength=D),v.comboCollideStrength=v.comboCollideStrength?v.comboCollideStrength:0,v.nodeCollideStrength=v.nodeCollideStrength?v.nodeCollideStrength:0;for(var g=0;g<p.length;++g){var _=(0,N.getEdgeTerminal)(p[g],"source"),Y=(0,N.getEdgeTerminal)(p[g],"target");l[_]?l[_]++:l[_]=1,l[Y]?l[Y]++:l[Y]=1}for(var V=[],g=0;g<p.length;++g){var _=(0,N.getEdgeTerminal)(p[g],"source"),Y=(0,N.getEdgeTerminal)(p[g],"target");V[g]=l[_]/(l[_]+l[Y])}this.bias=V;var z=v.nodeSize,Z=v.nodeSpacing,J,ee;if((0,N.isNumber)(Z)?ee=function(){return Z}:(0,N.isFunction)(Z)?ee=Z:ee=function(){return 0},this.nodeSpacing=ee,!z)J=function(Fe){if(Fe.size){if((0,N.isArray)(Fe.size)){var Vt=Fe.size[0]>Fe.size[1]?Fe.size[0]:Fe.size[1];return Vt/2}if((0,N.isObject)(Fe.size)){var Vt=Fe.size.width>Fe.size.height?Fe.size.width:Fe.size.height;return Vt/2}return Fe.size/2}return 10};else if((0,N.isFunction)(z))J=function(Fe){return z(Fe)};else if((0,N.isArray)(z)){var Q=z[0]>z[1]?z[0]:z[1],re=Q/2;J=function(Fe){return re}}else{var fe=z/2;J=function(Fe){return fe}}this.nodeSize=J;var me=v.comboSpacing,ae;(0,N.isNumber)(me)?ae=function(){return me}:(0,N.isFunction)(me)?ae=me:ae=function(){return 0},this.comboSpacing=ae;var Ee=v.comboPadding,Le;(0,N.isNumber)(Ee)?Le=function(){return Ee}:(0,N.isArray)(Ee)?Le=function(){return Math.max.apply(null,Ee)}:(0,N.isFunction)(Ee)?Le=Ee:Le=function(){return 0},this.comboPadding=Le;var De=this.linkDistance,Ve;De||(De=10),(0,N.isNumber)(De)?Ve=function(Fe){return De}:Ve=De,this.linkDistance=Ve;var et=this.edgeStrength,It;et||(et=1),(0,N.isNumber)(et)?It=function(Fe){return et}:It=et,this.edgeStrength=It;var er=this.nodeStrength,nr;er||(er=30),(0,N.isNumber)(er)?nr=function(Fe){return er}:nr=er,this.nodeStrength=nr},A.prototype.initPos=function(v){var p=this,c=p.nodes;c.forEach(function(f,l){var T=f.comboId,m=v[T];T&&m?(f.x=m.cx+100/(l+1),f.y=m.cy+100/(l+1)):(f.x=100/(l+1),f.y=100/(l+1))})},A.prototype.getComboMap=function(){var v=this,p=v.nodeMap,c=v.comboTrees,f=v.oriComboMap,l={};return(c||[]).forEach(function(T){var m=[];(0,N.traverseTreeUp)(T,function(w){if(w.itemType==="node"||!f[w.id])return!0;if(l[w.id]===void 0){var O={id:w.id,name:w.id,cx:0,cy:0,count:0,depth:v.oriComboMap[w.id].depth||0,children:[]};l[w.id]=O}var D=w.children;D&&D.forEach(function(Y){if(!l[Y.id]&&!p[Y.id])return!0;m.push(Y)});var g=l[w.id];if(g.cx=0,g.cy=0,m.length===0){g.empty=!0;var _=f[w.id];g.cx=_.x,g.cy=_.y}return m.forEach(function(Y){if(g.count++,Y.itemType!=="node"){var V=l[Y.id];(0,N.isNumber)(V.cx)&&(g.cx+=V.cx),(0,N.isNumber)(V.cy)&&(g.cy+=V.cy);return}var z=p[Y.id];!z||((0,N.isNumber)(z.x)&&(g.cx+=z.x),(0,N.isNumber)(z.y)&&(g.cy+=z.y))}),g.cx/=g.count||1,g.cy/=g.count||1,g.children=m,!0})}),l},A.prototype.applyComboCenterForce=function(v){var p=this,c=p.gravity,f=p.comboGravity||c,l=this.alpha,T=p.comboTrees,m=p.indexMap,w=p.nodeMap,O=p.comboMap;(T||[]).forEach(function(D){(0,N.traverseTreeUp)(D,function(g){if(g.itemType==="node")return!0;var _=O[g.id];if(!_)return!0;var Y=O[g.id],V=(Y.depth+1)/10*.5,z=Y.cx,Z=Y.cy;return Y.cx=0,Y.cy=0,Y.children.forEach(function(J){if(J.itemType!=="node"){var ee=O[J.id];ee&&(0,N.isNumber)(ee.cx)&&(Y.cx+=ee.cx),ee&&(0,N.isNumber)(ee.cy)&&(Y.cy+=ee.cy);return}var Q=w[J.id],re=Q.x-z||.005,fe=Q.y-Z||.005,me=Math.sqrt(re*re+fe*fe),ae=m[Q.id],Ee=f*l/me*V;v[ae].x-=re*Ee,v[ae].y-=fe*Ee,(0,N.isNumber)(Q.x)&&(Y.cx+=Q.x),(0,N.isNumber)(Q.y)&&(Y.cy+=Q.y)}),Y.cx/=Y.count||1,Y.cy/=Y.count||1,!0})})},A.prototype.applyCalculate=function(v){var p=this,c=p.comboMap,f=p.nodes,l={};f.forEach(function(m,w){f.forEach(function(O,D){if(!(w<D)){var g=m.x-O.x||.005,_=m.y-O.y||.005,Y=g*g+_*_,V=Math.sqrt(Y);Y<1&&(Y=V),l["".concat(m.id,"-").concat(O.id)]={vx:g,vy:_,vl2:Y,vl:V},l["".concat(O.id,"-").concat(m.id)]={vl2:Y,vl:V,vx:-g,vy:-_}}})}),p.updateComboSizes(c),p.calRepulsive(v,l),p.calAttractive(v,l);var T=p.preventComboOverlap;T&&p.comboNonOverlapping(v,c)},A.prototype.updateComboSizes=function(v){var p=this,c=p.comboTrees,f=p.nodeMap,l=p.nodeSize,T=p.comboSpacing,m=p.comboPadding;(c||[]).forEach(function(w){var O=[];(0,N.traverseTreeUp)(w,function(D){if(D.itemType==="node")return!0;var g=v[D.id];if(!g)return!1;var _=D.children;_&&_.forEach(function(z){!v[z.id]&&!f[z.id]||O.push(z)}),g.minX=Infinity,g.minY=Infinity,g.maxX=-Infinity,g.maxY=-Infinity,O.forEach(function(z){if(z.itemType!=="node")return!0;var Z=f[z.id];if(!Z)return!0;var J=l(Z),ee=Z.x-J,Q=Z.y-J,re=Z.x+J,fe=Z.y+J;g.minX>ee&&(g.minX=ee),g.minY>Q&&(g.minY=Q),g.maxX<re&&(g.maxX=re),g.maxY<fe&&(g.maxY=fe)});var Y=p.oriComboMap[D.id].size||10;(0,N.isArray)(Y)&&(Y=Y[0]);var V=Math.max(g.maxX-g.minX,g.maxY-g.minY,Y);return g.r=V/2+T(g)/2+m(g),!0})})},A.prototype.comboNonOverlapping=function(v,p){var c=this,f=c.comboTree,l=c.comboCollideStrength,T=c.indexMap,m=c.nodeMap;(0,N.traverseTreeUp)(f,function(w){if(!p[w.id]&&!m[w.id]&&w.id!=="comboTreeRoot")return!1;var O=w.children;return O&&O.length>1&&O.forEach(function(D,g){if(D.itemType==="node")return!1;var _=p[D.id];!_||O.forEach(function(Y,V){if(g<=V||Y.itemType==="node")return!1;var z=p[Y.id];if(!z)return!1;var Z=_.cx-z.cx||.005,J=_.cy-z.cy||.005,ee=Z*Z+J*J,Q=_.r||1,re=z.r||1,fe=Q+re,me=re*re,ae=Q*Q;if(ee<fe*fe){var Ee=D.children;if(!Ee||Ee.length===0)return!1;var Le=Y.children;if(!Le||Le.length===0)return!1;var De=Math.sqrt(ee),Ve=(fe-De)/De*l,et=Z*Ve,It=J*Ve,er=me/(ae+me),nr=1-er;Ee.forEach(function(Fe){if(Fe.itemType!=="node")return!1;if(!!m[Fe.id]){var Vt=T[Fe.id];Le.forEach(function($t){if($t.itemType!=="node"||!m[$t.id])return!1;var Ar=T[$t.id];v[Vt].x+=et*er,v[Vt].y+=It*er,v[Ar].x-=et*nr,v[Ar].y-=It*nr})}})}})}),!0})},A.prototype.calRepulsive=function(v,p){var c=this,f=c.nodes,l=c.width*c.optimizeRangeFactor,T=c.nodeStrength,m=c.alpha,w=c.nodeCollideStrength,O=c.preventNodeOverlap,D=c.nodeSize,g=c.nodeSpacing,_=c.depthRepulsiveForceScale,Y=c.center;f.forEach(function(V,z){if(!(!V.x||!V.y)){if(Y){var Z=c.gravity,J=V.x-Y[0]||.005,ee=V.y-Y[1]||.005,Q=Math.sqrt(J*J+ee*ee);v[z].x-=J*Z*m/Q,v[z].y-=ee*Z*m/Q}f.forEach(function(re,fe){if(z!==fe&&!(!re.x||!re.y)){var me=p["".concat(V.id,"-").concat(re.id)],ae=me.vl2,Ee=me.vl;if(!(Ee>l)){var Le=p["".concat(V.id,"-").concat(re.id)],De=Le.vx,Ve=Le.vy,et=Math.log(Math.abs(re.depth-V.depth)/10)+1||1;et=et<1?1:et,re.comboId!==V.comboId&&(et+=1);var It=et?Math.pow(_,et):1,er=T(re)*m/ae*It;if(v[z].x+=De*er,v[z].y+=Ve*er,z<fe&&O){var nr=D(V)+g(V)||1,Fe=D(re)+g(re)||1,Vt=nr+Fe;if(ae<Vt*Vt){var $t=(Vt-Ee)/Ee*w,Ar=Fe*Fe,ke=Ar/(nr*nr+Ar),Oe=De*$t,we=Ve*$t;v[z].x+=Oe*ke,v[z].y+=we*ke,ke=1-ke,v[fe].x-=Oe*ke,v[fe].y-=we*ke}}}}})}})},A.prototype.calAttractive=function(v,p){var c=this,f=c.edges,l=c.linkDistance,T=c.alpha,m=c.edgeStrength,w=c.bias,O=c.depthAttractiveForceScale;f.forEach(function(D,g){var _=(0,N.getEdgeTerminal)(D,"source"),Y=(0,N.getEdgeTerminal)(D,"target");if(!(!_||!Y||_===Y)){var V=c.indexMap[_],z=c.indexMap[Y],Z=c.nodeMap[_],J=c.nodeMap[Y];if(!(!Z||!J)){var ee=Z.depth===J.depth?0:Math.log(Math.abs(Z.depth-J.depth)/10);Z.comboId===J.comboId&&(ee=ee/2);var Q=ee?Math.pow(O,ee):1;if(Z.comboId!==J.comboId&&Q===1?Q=O/2:Z.comboId===J.comboId&&(Q=2),!(!(0,N.isNumber)(J.x)||!(0,N.isNumber)(Z.x)||!(0,N.isNumber)(J.y)||!(0,N.isNumber)(Z.y))){var re=p["".concat(Y,"-").concat(_)],fe=re.vl,me=re.vx,ae=re.vy,Ee=(fe-l(D))/fe*T*m(D)*Q,Le=me*Ee,De=ae*Ee,Ve=w[g];v[z].x-=Le*Ve,v[z].y-=De*Ve,v[V].x+=Le*(1-Ve),v[V].y+=De*(1-Ve)}}}})},A.prototype.getType=function(){return"comboForce"},A}(B.Base);x.ComboForceLayout=E},98162:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var I=function(A,v){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,c){p.__proto__=c}||function(p,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(p[f]=c[f])},I(A,v)};return function(A,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");I(A,v);function p(){this.constructor=A}A.prototype=v===null?Object.create(v):(p.prototype=v.prototype,new p)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.ConcentricLayout=void 0;var B=M(8273),N=M(46253),E=function(I){S(A,I);function A(v){var p=I.call(this)||this;return p.nodeSize=30,p.minNodeSpacing=10,p.nodeSpacing=10,p.preventOverlap=!1,p.equidistant=!1,p.startAngle=3/2*Math.PI,p.clockwise=!0,p.sortBy="degree",p.nodes=[],p.edges=[],p.width=300,p.height=300,p.onLayoutEnd=function(){},p.updateCfg(v),p}return A.prototype.getDefaultCfg=function(){return{nodeSize:30,minNodeSpacing:10,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"}},A.prototype.execute=function(){var v,p,c=this,f=c.nodes,l=c.edges,T=f.length;if(T===0){(v=c.onLayoutEnd)===null||v===void 0||v.call(c);return}!c.width&&typeof window!="undefined"&&(c.width=window.innerWidth),!c.height&&typeof window!="undefined"&&(c.height=window.innerHeight),c.center||(c.center=[c.width/2,c.height/2]);var m=c.center;if(T===1){f[0].x=m[0],f[0].y=m[1],(p=c.onLayoutEnd)===null||p===void 0||p.call(c);return}var w=c.nodeSize,O=c.nodeSpacing,D=[],g,_=0;(0,B.isArray)(w)?g=Math.max(w[0],w[1]):g=w,(0,B.isArray)(O)?_=Math.max(O[0],O[1]):(0,B.isNumber)(O)&&(_=O),f.forEach(function(et){D.push(et);var It=g;(0,B.isArray)(et.size)?It=Math.max(et.size[0],et.size[1]):(0,B.isNumber)(et.size)?It=et.size:(0,B.isObject)(et.size)&&(It=Math.max(et.size.width,et.size.height)),g=Math.max(g,It),(0,B.isFunction)(O)&&(_=Math.max(O(et),_))}),c.clockwise=c.counterclockwise!==void 0?!c.counterclockwise:c.clockwise;var Y={},V={};if(D.forEach(function(et,It){Y[et.id]=et,V[et.id]=It}),(c.sortBy==="degree"||!(0,B.isString)(c.sortBy)||D[0][c.sortBy]===void 0)&&(c.sortBy="degree",!(0,B.isNumber)(f[0].degree))){var z=(0,B.getDegree)(f.length,V,l);D.forEach(function(et,It){et.degree=z[It].all})}D.sort(function(et,It){return It[c.sortBy]-et[c.sortBy]}),c.maxValueNode=D[0],c.maxLevelDiff=c.maxLevelDiff||c.maxValueNode[c.sortBy]/4;var Z=[[]],J=Z[0];D.forEach(function(et){if(J.length>0){var It=Math.abs(J[0][c.sortBy]-et[c.sortBy]);c.maxLevelDiff&&It>=c.maxLevelDiff&&(J=[],Z.push(J))}J.push(et)});var ee=g+(_||c.minNodeSpacing);if(!c.preventOverlap){var Q=Z.length>0&&Z[0].length>1,re=Math.min(c.width,c.height)/2-ee,fe=re/(Z.length+(Q?1:0));ee=Math.min(ee,fe)}var me=0;if(Z.forEach(function(et){var It=c.sweep;It===void 0&&(It=2*Math.PI-2*Math.PI/et.length);var er=et.dTheta=It/Math.max(1,et.length-1);if(et.length>1&&c.preventOverlap){var nr=Math.cos(er)-Math.cos(0),Fe=Math.sin(er)-Math.sin(0),Vt=Math.sqrt(ee*ee/(nr*nr+Fe*Fe));me=Math.max(Vt,me)}et.r=me,me+=ee}),c.equidistant){for(var ae=0,Ee=0,Le=0;Le<Z.length;Le++){var De=Z[Le],Ve=De.r-Ee;ae=Math.max(ae,Ve)}Ee=0,Z.forEach(function(et,It){It===0&&(Ee=et.r),et.r=Ee,Ee+=ae})}return Z.forEach(function(et){var It=et.dTheta,er=et.r;et.forEach(function(nr,Fe){var Vt=c.startAngle+(c.clockwise?1:-1)*It*Fe;nr.x=m[0]+er*Math.cos(Vt),nr.y=m[1]+er*Math.sin(Vt)})}),c.onLayoutEnd&&c.onLayoutEnd(),{nodes:f,edges:l}},A.prototype.getType=function(){return"concentric"},A}(N.Base);x.ConcentricLayout=E},24979:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.FORCE_LAYOUT_TYPE_MAP=x.LAYOUT_MESSAGE=void 0,x.LAYOUT_MESSAGE={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"},x.FORCE_LAYOUT_TYPE_MAP={gForce:!0,force2:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0}},2:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var p=function(c,f){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,T){l.__proto__=T}||function(l,T){for(var m in T)Object.prototype.hasOwnProperty.call(T,m)&&(l[m]=T[m])},p(c,f)};return function(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");p(c,f);function l(){this.constructor=c}c.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}}(),B=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(x,"__esModule",{value:!0}),x.DagreLayout=void 0;var N=B(M(53186)),E=M(8273),I=M(46253),A=M(67858),v=function(p){S(c,p);function c(f){var l=p.call(this)||this;return l.rankdir="TB",l.nodesep=50,l.ranksep=50,l.controlPoints=!1,l.sortByCombo=!1,l.edgeLabelSpace=!0,l.radial=!1,l.nodes=[],l.edges=[],l.onLayoutEnd=function(){},l.layoutNode=function(T){var m=l,w=m.nodes,O=w.find(function(g){return g.id===T});if(O){var D=O.layout!==!1;return D}return!0},l.updateCfg(f),l}return c.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,nodeSize:void 0,nodesepFunc:void 0,ranksepFunc:void 0,nodesep:50,ranksep:50,controlPoints:!1,radial:!1,focusNode:null}},c.prototype.execute=function(){var f=this,l,T,m=this,w=m.nodes,O=m.nodeSize,D=m.rankdir,g=m.combos,_=m.begin,Y=m.radial;if(!!w){var V=m.edges||[],z=new A.Graph({multigraph:!0,compound:!0}),Z;O?(0,E.isArray)(O)?Z=function(){return O}:Z=function(){return[O,O]}:Z=function(Ge){return Ge.size?(0,E.isArray)(Ge.size)?Ge.size:(0,E.isObject)(Ge.size)?[Ge.size.width||40,Ge.size.height||40]:[Ge.size,Ge.size]:[40,40]};var J=(0,E.getFunc)(m.ranksep,50,m.ranksepFunc),ee=(0,E.getFunc)(m.nodesep,50,m.nodesepFunc),Q=ee,re=J;(D==="LR"||D==="RL")&&(Q=J,re=ee),z.setDefaultEdgeLabel(function(){return{}}),z.setGraph(m);var fe={};this.sortByCombo&&g&&g.forEach(function(Ge){!Ge.parentId||(fe[Ge.parentId]||(fe[Ge.parentId]=!0,z.setNode(Ge.parentId,{})),z.setParent(Ge.id,Ge.parentId))}),w.filter(function(Ge){return Ge.layout!==!1}).forEach(function(Ge){var ut=Z(Ge),U=re(Ge),he=Q(Ge),Qe=ut[0]+2*he,le=ut[1]+2*U,ct=Ge.layer;(0,E.isNumber)(ct)?z.setNode(Ge.id,{width:Qe,height:le,layer:ct}):z.setNode(Ge.id,{width:Qe,height:le}),f.sortByCombo&&Ge.comboId&&(fe[Ge.comboId]||(fe[Ge.comboId]=!0,z.setNode(Ge.comboId,{})),z.setParent(Ge.id,Ge.comboId))}),V.forEach(function(Ge){var ut=(0,E.getEdgeTerminal)(Ge,"source"),U=(0,E.getEdgeTerminal)(Ge,"target");f.layoutNode(ut)&&f.layoutNode(U)&&z.setEdge(ut,U,{weight:Ge.weight||1})});var me=void 0;((l=m.preset)===null||l===void 0?void 0:l.nodes)&&(me=new A.Graph({multigraph:!0,compound:!0}),m.preset.nodes.forEach(function(Ge){me==null||me.setNode(Ge.id,Ge)})),N.default.layout(z,{prevGraph:me,edgeLabelSpace:m.edgeLabelSpace,keepNodeOrder:Boolean(!!m.nodeOrder),nodeOrder:m.nodeOrder});var ae=[0,0];if(_){var Ee=Infinity,Le=Infinity;z.nodes().forEach(function(Ge){var ut=z.node(Ge);Ee>ut.x&&(Ee=ut.x),Le>ut.y&&(Le=ut.y)}),z.edges().forEach(function(Ge){var ut,U=z.edge(Ge);(ut=U.points)===null||ut===void 0||ut.forEach(function(he){Ee>he.x&&(Ee=he.x),Le>he.y&&(Le=he.y)})}),ae[0]=_[0]-Ee,ae[1]=_[1]-Le}if(Y){var De=this,Ve=De.focusNode,et=De.ranksep,It=De.getRadialPos,er=(0,E.isString)(Ve)?Ve:Ve==null?void 0:Ve.id,nr=er?(T=z.node(er))===null||T===void 0?void 0:T._rank:0,Fe=[],Vt=D==="LR"||D==="RL",$t=Vt?"y":"x",Ar=Vt?"height":"width",ke=Infinity,Oe=-Infinity;z.nodes().forEach(function(Ge){var ut=z.node(Ge),U=w.findIndex(function(jt){return jt.id===Ge});if(!!w[U]){var he=ee(w[U]);if(nr===0)Fe[ut._rank]||(Fe[ut._rank]={nodes:[],totalWidth:0,maxSize:-Infinity}),Fe[ut._rank].nodes.push(Ge),Fe[ut._rank].totalWidth+=he*2+ut[Ar],Fe[ut._rank].maxSize<Math.max(ut.width,ut.height)&&(Fe[ut._rank].maxSize=Math.max(ut.width,ut.height));else{var Qe=ut._rank-nr;if(Qe===0)Fe[Qe]||(Fe[Qe]={nodes:[],totalWidth:0,maxSize:-Infinity}),Fe[Qe].nodes.push(Ge),Fe[Qe].totalWidth+=he*2+ut[Ar],Fe[Qe].maxSize<Math.max(ut.width,ut.height)&&(Fe[Qe].maxSize=Math.max(ut.width,ut.height));else{var le=Math.abs(Qe);Fe[le]||(Fe[le]={left:[],right:[],totalWidth:0,maxSize:-Infinity}),Fe[le].totalWidth+=he*2+ut[Ar],Fe[le].maxSize<Math.max(ut.width,ut.height)&&(Fe[le].maxSize=Math.max(ut.width,ut.height)),Qe<0?Fe[le].left.push(Ge):Fe[le].right.push(Ge)}}var ct=ut[$t]-ut[Ar]/2-he,ft=ut[$t]+ut[Ar]/2+he;ct<ke&&(ke=ct),ft>Oe&&(Oe=ft)}});var we=et||50,Be={},We=(Oe-ke)/.9,He=[(ke+Oe-We)*.5,(ke+Oe+We)*.5],St=function(Ge,ut,U,he){U===void 0&&(U=-Infinity),he===void 0&&(he=[0,1]);var Qe=U;return Ge.forEach(function(le){var ct=z.node(le);Be[le]=ut;var ft=It(ct[$t],He,We,ut,he),jt=ft.x,Lt=ft.y,Ht=w.findIndex(function(rt){return rt.id===le});if(!!w[Ht]){w[Ht].x=jt+ae[0],w[Ht].y=Lt+ae[1],w[Ht]._order=ct._order;var vr=J(w[Ht]);Qe<vr&&(Qe=vr)}}),Qe},Mt=!0,sr=0;Fe.forEach(function(Ge){var ut,U,he,Qe,le,ct,ft;if(!(!((ut=Ge==null?void 0:Ge.nodes)===null||ut===void 0?void 0:ut.length)&&!((U=Ge==null?void 0:Ge.left)===null||U===void 0?void 0:U.length)&&!((he=Ge==null?void 0:Ge.right)===null||he===void 0?void 0:he.length))){if(Mt&&Ge.nodes.length===1){var jt=w.findIndex(function(vr){return vr.id===Ge.nodes[0]});w[jt].x=ae[0],w[jt].y=ae[1],Be[Ge.nodes[0]]=0,we=J(w[jt]),Mt=!1;return}we=Math.max(we,Ge.totalWidth/(2*Math.PI));var Lt=-Infinity;if(nr===0||((Qe=Ge.nodes)===null||Qe===void 0?void 0:Qe.length))Lt=St(Ge.nodes,we,Lt,[0,1]);else{var Ht=((le=Ge.left)===null||le===void 0?void 0:le.length)/(((ct=Ge.left)===null||ct===void 0?void 0:ct.length)+((ft=Ge.right)===null||ft===void 0?void 0:ft.length));Lt=St(Ge.left,we,Lt,[0,Ht]),Lt=St(Ge.right,we,Lt,[Ht+.05,1])}we+=Lt,Mt=!1,sr-Ge.maxSize}}),z.edges().forEach(function(Ge){var ut,U,he,Qe=z.edge(Ge),le=V.findIndex(function(at){var Pt=(0,E.getEdgeTerminal)(at,"source"),gt=(0,E.getEdgeTerminal)(at,"target");return Pt===Ge.v&&gt===Ge.w});if(m.edgeLabelSpace&&m.controlPoints&&V[le].type!=="loop"){var ct=$t==="x"?"y":"x",ft=(ut=Qe==null?void 0:Qe.points)===null||ut===void 0?void 0:ut.slice(1,Qe.points.length-1),jt=[],Lt=(U=z.node(Ge.v))===null||U===void 0?void 0:U[ct],Ht=Lt-((he=z.node(Ge.w))===null||he===void 0?void 0:he[ct]),vr=Be[Ge.v],rt=vr-Be[Ge.w];ft==null||ft.forEach(function(at){var Pt=(at[ct]-Lt)/Ht*rt+vr,gt=It(at[$t],He,We,Pt);jt.push({x:gt.x+ae[0],y:gt.y+ae[1]})}),V[le].controlPoints=jt}})}else z.nodes().forEach(function(Ge){var ut=z.node(Ge),U=w.findIndex(function(he){return he.id===Ge});!w[U]||(w[U].x=ut.x+ae[0],w[U].y=ut.y+ae[1],w[U]._order=ut._order)}),z.edges().forEach(function(Ge){var ut,U=z.edge(Ge),he=V.findIndex(function(Qe){var le=(0,E.getEdgeTerminal)(Qe,"source"),ct=(0,E.getEdgeTerminal)(Qe,"target");return le===Ge.v&&ct===Ge.w});m.edgeLabelSpace&&m.controlPoints&&V[he].type!=="loop"&&(V[he].controlPoints=(ut=U==null?void 0:U.points)===null||ut===void 0?void 0:ut.slice(1,U.points.length-1),V[he].controlPoints.forEach(function(Qe){Qe.x+=ae[0],Qe.y+=ae[1]}))});return m.onLayoutEnd&&m.onLayoutEnd(),{nodes:w,edges:V}}},c.prototype.getRadialPos=function(f,l,T,m,w){w===void 0&&(w=[0,1]);var O=(f-l[0])/T;O=O*(w[1]-w[0])+w[0];var D=O*2*Math.PI;return{x:Math.cos(D)*m,y:Math.sin(D)*m}},c.prototype.getType=function(){return"dagre"},c}(I.Base);x.DagreLayout=v},77620:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var p=function(c,f){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,T){l.__proto__=T}||function(l,T){for(var m in T)Object.prototype.hasOwnProperty.call(T,m)&&(l[m]=T[m])},p(c,f)};return function(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");p(c,f);function l(){this.constructor=c}c.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}}(),B=this&&this.__assign||function(){return B=Object.assign||function(p){for(var c,f=1,l=arguments.length;f<l;f++){c=arguments[f];for(var T in c)Object.prototype.hasOwnProperty.call(c,T)&&(p[T]=c[T])}return p},B.apply(this,arguments)},N=this&&this.__spreadArray||function(p,c,f){if(f||arguments.length===2)for(var l=0,T=c.length,m;l<T;l++)(m||!(l in c))&&(m||(m=Array.prototype.slice.call(c,0,l)),m[l]=c[l]);return p.concat(m||Array.prototype.slice.call(c))};Object.defineProperty(x,"__esModule",{value:!0}),x.DagreCompoundLayout=void 0;var E=M(46253),I=M(31969),A=M(8273),v=function(p){S(c,p);function c(f){var l=p.call(this)||this;return l.rankdir="TB",l.nodesep=50,l.edgesep=5,l.ranksep=50,l.controlPoints=!0,l.anchorPoint=!0,l.nodes=[],l.edges=[],l.combos=[],l.onLayoutEnd=function(){},l.updateCfg(f),l}return c.prototype.getDefaultCfg=function(){return{rankdir:"TB",align:void 0,begin:void 0,nodeSize:void 0,nodesep:50,ranksep:50,controlPoints:!0,anchorPoint:!0}},c.prototype.init=function(f){var l=f.hiddenNodes||[],T=f.hiddenEdges||[],m=f.hiddenCombos||[];this.nodes=this.getDataByOrder((f.nodes||[]).concat(l)),this.edges=this.getDataByOrder((f.edges||[]).concat(T)),this.combos=(f.combos||[]).concat(m.map(function(w){return B(B({},w),{collapsed:!0})}))},c.prototype.execute=function(){var f=this,l=f.nodes,T=f.edges;if(!!l){var m=f.getLayoutConfig(),w=m.graphDef,O=m.graphOption,D=m.graphSettings,g=(0,I.buildGraph)(w,O,D),_=(0,I.flatGraph)(g,!0);return this.updatePosition(_),f.onLayoutEnd&&f.onLayoutEnd(),{nodes:l,edges:T}}},c.prototype.getNodePath=function(f){var l=this,T=l.nodes,m=l.combos,w=T.find(function(D){return D.id===f}),O=function(D,g){g===void 0&&(g=[]);var _=m.find(function(Y){return Y.id===D});return _?(g.unshift(D),_.parentId?O(_.parentId,g):g):g};return w&&w.comboId?O(w.comboId,[f]):[f]},c.prototype.getLayoutConfig=function(){var f,l,T,m=this,w=m.nodes,O=m.edges,D=m.combos,g=m.nodeSize,_=m.rankdir,Y=m.align,V=m.edgesep,z=m.nodesep,Z=m.ranksep,J=m.settings,ee=(D||[]).reduce(function($t,Ar){var ke=w.filter(function(we){return we.comboId===Ar.id}).map(function(we){return we.id}),Oe=(D||[]).filter(function(we){return we.parentId===Ar.id}).map(function(we){return we.id});return(ke.length||Oe.length)&&($t[Ar.id]=N(N([],ke,!0),Oe,!0)),$t},{}),Q;g?(0,A.isArray)(g)?Q=function(){return g}:Q=function(){return[g,g]}:Q=function($t){return $t&&$t.size?(0,A.isArray)($t.size)?$t.size:(0,A.isObject)($t.size)?[$t.size.width||40,$t.size.height||40]:[$t.size,$t.size]:[40,40]};var re=function($t){return $t&&$t.size?(0,A.isArray)($t.size)?$t.size:[$t.size,$t.size]:[80,40]},fe=re(D==null?void 0:D[0]),me=fe[0],ae=fe[1],Ee=(l=(f=m.graphSettings)===null||f===void 0?void 0:f.subScene)===null||l===void 0?void 0:l.meta,Le=((T=D.find(function($t){return!$t.collapsed}))===null||T===void 0?void 0:T.padding)||[20,20,20,20],De=Le[0],Ve=Le[1],et=Le[2],It=Le[3],er={compound:ee,nodes:N([],(w||[]).map(function($t){var Ar=Q($t),ke=Ar[0],Oe=Ar[1];return B(B({},$t),{width:ke,height:Oe})}),!0),edges:N([],(O||[]).map(function($t){return B(B({},$t),{v:$t.source,w:$t.target})}),!0)},nr={expanded:(D||[]).filter(function($t){return!$t.collapsed}).map(function($t){return $t.id})},Fe={graph:{meta:{align:Y,rankDir:_,nodeSep:z,edgeSep:V,rankSep:Z}},subScene:{meta:{paddingTop:De||(Ee==null?void 0:Ee.paddingTop)||20,paddingRight:Ve||(Ee==null?void 0:Ee.paddingRight)||20,paddingBottom:et||(Ee==null?void 0:Ee.paddingBottom)||20,paddingLeft:It||(Ee==null?void 0:Ee.paddingLeft)||20,labelHeight:0}},nodeSize:{meta:{width:me,height:ae}}},Vt=(0,I.mergeConfig)(J,B({},(0,I.mergeConfig)(Fe,I.LAYOUT_CONFIG)));return m.graphSettings=Vt,{graphDef:er,graphOption:nr,graphSettings:Vt}},c.prototype.updatePosition=function(f){var l=f.nodes,T=f.edges;this.updateNodePosition(l,T),this.updateEdgePosition(l,T)},c.prototype.getBegin=function(f,l){var T=this,m=T.begin,w=[0,0];if(m){var O=Infinity,D=Infinity;f.forEach(function(g){O>g.x&&(O=g.x),D>g.y&&(D=g.y)}),l.forEach(function(g){g.points.forEach(function(_){O>_.x&&(O=_.x),D>_.y&&(D=_.y)})}),w[0]=m[0]-O,w[1]=m[1]-D}return w},c.prototype.updateNodePosition=function(f,l){var T=this,m=T.combos,w=T.nodes,O=T.edges,D=T.anchorPoint,g=T.graphSettings,_=this.getBegin(f,l);f.forEach(function(Y){var V,z=Y.x,Z=Y.y,J=Y.id,ee=Y.type,Q=Y.coreBox;if(ee===I.HierarchyNodeType.META&&J!==I.ROOT_NAME){var re=m.findIndex(function(Le){return Le.id===J}),fe=(V=g==null?void 0:g.subScene)===null||V===void 0?void 0:V.meta;m[re].offsetX=z+_[0],m[re].offsetY=Z+_[1],m[re].fixSize=[Q.width,Q.height],m[re].fixCollapseSize=[Q.width,Q.height],Y.expanded?m[re].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]:m[re].padding=[0,0,0,0]}else if(ee===I.HierarchyNodeType.OP){var re=w.findIndex(function(De){return De.id===J});if(w[re].x=z+_[0],w[re].y=Z+_[1],D){var me=[],ae=l.filter(function(De){return De.v===J}),Ee=l.filter(function(De){return De.w===J});ae.length>0&&ae.forEach(function(De){var Ve=De.points[0],et=(Ve.x-z)/Y.width+.5,It=(Ve.y-Z)/Y.height+.5;me.push([et,It]),De.baseEdgeList.forEach(function(er){var nr=O.find(function(Fe){return Fe.source===er.v&&Fe.target===er.w});nr&&(nr.sourceAnchor=me.length-1)})}),Ee.length>0&&Ee.forEach(function(De){var Ve=De.points[De.points.length-1],et=(Ve.x-z)/Y.width+.5,It=(Ve.y-Z)/Y.height+.5;me.push([et,It]),De.baseEdgeList.forEach(function(er){var nr=O.find(function(Fe){return Fe.source===er.v&&Fe.target===er.w});nr&&(nr.targetAnchor=me.length-1)})}),w[re].anchorPoints=me.length>0?me:w[re].anchorPoints||[]}}})},c.prototype.updateEdgePosition=function(f,l){var T=this,m=T.combos,w=T.edges,O=T.controlPoints,D=this.getBegin(f,l);O&&(m.forEach(function(g){g.inEdges=[],g.outEdges=[]}),w.forEach(function(g){var _,Y,V,z,Z=f.find(function(Le){return Le.id===g.source}),J=f.find(function(Le){return Le.id===g.target}),ee=[],Q=[];if(Z&&J)Q=(0,I.getEdges)(Z==null?void 0:Z.id,J==null?void 0:J.id,f);else if(!Z||!J){var re=T.getNodePath(g.source),fe=T.getNodePath(g.target),me=re.reverse().slice(Z?0:1).find(function(Le){return f.find(function(De){return De.id===Le})}),ae=fe.reverse().slice(J?0:1).find(function(Le){return f.find(function(De){return De.id===Le})});Z=f.find(function(Le){return Le.id===me}),J=f.find(function(Le){return Le.id===ae}),Q=(0,I.getEdges)(Z==null?void 0:Z.id,J==null?void 0:J.id,f,{v:g.source,w:g.target})}if(ee=Q.reduce(function(Le,De){return N(N([],Le,!0),De.points.map(function(Ve){return B(B({},Ve),{x:Ve.x+D[0],y:Ve.y+D[1]})}),!0)},[]),ee=ee.slice(1,-1),g.controlPoints=ee,(J==null?void 0:J.type)===I.NodeType.META){var Ee=m.findIndex(function(Le){return Le.id===(J==null?void 0:J.id)});if(!m[Ee]||((_=m[Ee].inEdges)===null||_===void 0?void 0:_.some(function(Le){return Le.source===Z.id&&Le.target===J.id})))return;(Y=m[Ee].inEdges)===null||Y===void 0||Y.push({source:Z.id,target:J.id,controlPoints:ee})}if((Z==null?void 0:Z.type)===I.NodeType.META){var Ee=m.findIndex(function(De){return De.id===(Z==null?void 0:Z.id)});if(!m[Ee]||((V=m[Ee].outEdges)===null||V===void 0?void 0:V.some(function(De){return De.source===Z.id&&De.target===J.id})))return;(z=m[Ee].outEdges)===null||z===void 0||z.push({source:Z.id,target:J.id,controlPoints:ee})}}))},c.prototype.getType=function(){return"dagreCompound"},c.prototype.getDataByOrder=function(f){return f.every(function(l){return l.layoutOrder!==void 0})||f.forEach(function(l,T){l.layoutOrder=T}),f.sort(function(l,T){return l.layoutOrder-T.layoutOrder})},c}(E.Base);x.DagreCompoundLayout=v},67858:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var E=function(I,A){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,p){v.__proto__=p}||function(v,p){for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(v[c]=p[c])},E(I,A)};return function(I,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");E(I,A);function v(){this.constructor=I}I.prototype=A===null?Object.create(A):(v.prototype=A.prototype,new v)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.Graph=void 0;var B=M(69787),N=function(E){S(I,E);function I(){return E!==null&&E.apply(this,arguments)||this}return I}(B.Graph);x.Graph=N},53186:function(dt,x,M){"use strict";var S=this&&this.__importDefault||function(E){return E&&E.__esModule?E:{default:E}};Object.defineProperty(x,"__esModule",{value:!0});var B=S(M(86282)),N=M(95869);x.default={layout:B.default,util:{time:N.time,notime:N.notime}}},65721:function(dt,x,M){"use strict";var S=this&&this.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(x,"__esModule",{value:!0});var B=S(M(81628)),N=function(A){var v=function(c){return function(f){var l;return((l=c.edge(f))===null||l===void 0?void 0:l.weight)||1}},p=A.graph().acyclicer==="greedy"?(0,B.default)(A,v(A)):E(A);p==null||p.forEach(function(c){var f=A.edge(c);A.removeEdgeObj(c),f.forwardName=c.name,f.reversed=!0,A.setEdge(c.w,c.v,f,"rev-".concat(Math.random()))})},E=function(A){var v=[],p={},c={},f=function(l){var T;c[l]||(c[l]=!0,p[l]=!0,(T=A.outEdges(l))===null||T===void 0||T.forEach(function(m){p[m.w]?v.push(m):f(m.w)}),delete p[l])};return A.nodes().forEach(f),v},I=function(A){A.edges().forEach(function(v){var p=A.edge(v);if(p.reversed){A.removeEdgeObj(v);var c=p.forwardName;delete p.reversed,delete p.forwardName,A.setEdge(v.w,v.v,p,c)}})};x.default={run:N,undo:I}},88597:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var S=M(95869),B=function(E){var I,A=function(v){var p=E.children(v),c=E.node(v);if((p==null?void 0:p.length)&&p.forEach(function(T){return A(T)}),c.hasOwnProperty("minRank")){c.borderLeft=[],c.borderRight=[];for(var f=c.minRank,l=c.maxRank+1;f<l;f+=1)N(E,"borderLeft","_bl",v,c,f),N(E,"borderRight","_br",v,c,f)}};(I=E.children())===null||I===void 0||I.forEach(function(v){return A(v)})},N=function(E,I,A,v,p,c){var f={rank:c,borderType:I,width:0,height:0},l=p[I][c-1],T=(0,S.addDummyNode)(E,"border",f,A);p[I][c]=T,E.setParent(T,v),l&&E.setEdge(l,T,{weight:1})};x.default=B},85374:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(p){var c,f=(c=p.graph().rankdir)===null||c===void 0?void 0:c.toLowerCase();(f==="lr"||f==="rl")&&B(p)},S=function(p){var c,f=(c=p.graph().rankdir)===null||c===void 0?void 0:c.toLowerCase();(f==="bt"||f==="rl")&&E(p),(f==="lr"||f==="rl")&&(A(p),B(p))},B=function(p){p.nodes().forEach(function(c){N(p.node(c))}),p.edges().forEach(function(c){N(p.edge(c))})},N=function(p){var c=p.width;p.width=p.height,p.height=c},E=function(p){p.nodes().forEach(function(c){I(p.node(c))}),p.edges().forEach(function(c){var f,l=p.edge(c);(f=l.points)===null||f===void 0||f.forEach(function(T){return I(T)}),l.hasOwnProperty("y")&&I(l)})},I=function(p){(p==null?void 0:p.y)&&(p.y=-p.y)},A=function(p){p.nodes().forEach(function(c){v(p.node(c))}),p.edges().forEach(function(c){var f,l=p.edge(c);(f=l.points)===null||f===void 0||f.forEach(function(T){return v(T)}),l.hasOwnProperty("x")&&v(l)})},v=function(p){var c=p.x;p.x=p.y,p.y=c};x.default={adjust:M,undo:S}},49174:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(N,E){if(N!=="next"&&N!=="prev")return E},S=function(N){N.prev.next=N.next,N.next.prev=N.prev,delete N.next,delete N.prev},B=function(){function N(){var E={};E.prev=E,E.next=E.prev,this.shortcut=E}return N.prototype.dequeue=function(){var E=this.shortcut,I=E.prev;if(I&&I!==E)return S(I),I},N.prototype.enqueue=function(E){var I=this.shortcut;E.prev&&E.next&&S(E),E.next=I.next,I.next.prev=E,I.next=E,E.prev=I},N.prototype.toString=function(){for(var E=[],I=this.shortcut,A=I.prev;A!==I;)E.push(JSON.stringify(A,M)),A=A==null?void 0:A.prev;return"[".concat(E.join(", "),"]")},N}();x.default=B},81628:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var m=function(w,O){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(D,g){D.__proto__=g}||function(D,g){for(var _ in g)Object.prototype.hasOwnProperty.call(g,_)&&(D[_]=g[_])},m(w,O)};return function(w,O){if(typeof O!="function"&&O!==null)throw new TypeError("Class extends value "+String(O)+" is not a constructor or null");m(w,O);function D(){this.constructor=w}w.prototype=O===null?Object.create(O):(D.prototype=O.prototype,new D)}}(),B=this&&this.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(x,"__esModule",{value:!0});var N=B(M(49174)),E=M(69787),I=function(m){S(w,m);function w(){return m!==null&&m.apply(this,arguments)||this}return w}(N.default),A=function(m){S(w,m);function w(){return m!==null&&m.apply(this,arguments)||this}return w}(E.Graph),v=function(){return 1},p=function(m,w){var O;if(m.nodeCount()<=1)return[];var D=l(m,w||v),g=c(D.graph,D.buckets,D.zeroIdx);return(O=g.map(function(_){return m.outEdges(_.v,_.w)}))===null||O===void 0?void 0:O.flat()},c=function(m,w,O){for(var D=[],g=w[w.length-1],_=w[0],Y;m.nodeCount();){for(;Y=_.dequeue();)f(m,w,O,Y);for(;Y=g.dequeue();)f(m,w,O,Y);if(m.nodeCount()){for(var V=w.length-2;V>0;--V)if(Y=w[V].dequeue(),Y){D=D.concat(f(m,w,O,Y,!0));break}}}return D},f=function(m,w,O,D,g){var _,Y,V=[];return(_=m.inEdges(D.v))===null||_===void 0||_.forEach(function(z){var Z=m.edge(z),J=m.node(z.v);g&&V.push({v:z.v,w:z.w,in:0,out:0}),J.out===void 0&&(J.out=0),J.out-=Z,T(w,O,J)}),(Y=m.outEdges(D.v))===null||Y===void 0||Y.forEach(function(z){var Z=m.edge(z),J=z.w,ee=m.node(J);ee.in===void 0&&(ee.in=0),ee.in-=Z,T(w,O,ee)}),m.removeNode(D.v),g?V:void 0},l=function(m,w){var O=new A,D=0,g=0;m.nodes().forEach(function(Z){O.setNode(Z,{v:Z,in:0,out:0})}),m.edges().forEach(function(Z){var J=O.edge(Z)||0,ee=(w==null?void 0:w(Z))||1,Q=J+ee;O.setEdge(Z.v,Z.w,Q),g=Math.max(g,O.node(Z.v).out+=ee),D=Math.max(D,O.node(Z.w).in+=ee)});for(var _=[],Y=g+D+3,V=0;V<Y;V++)_.push(new I);var z=D+1;return O.nodes().forEach(function(Z){T(_,z,O.node(Z))}),{buckets:_,zeroIdx:z,graph:O}},T=function(m,w,O){O.out?O.in?m[O.out-O.in+w].enqueue(O):m[m.length-1].enqueue(O):m[0].enqueue(O)};x.default=p},86282:function(dt,x,M){"use strict";var S=this&&this.__assign||function(){return S=Object.assign||function(ke){for(var Oe,we=1,Be=arguments.length;we<Be;we++){Oe=arguments[we];for(var We in Oe)Object.prototype.hasOwnProperty.call(Oe,We)&&(ke[We]=Oe[We])}return ke},S.apply(this,arguments)},B=this&&this.__importDefault||function(ke){return ke&&ke.__esModule?ke:{default:ke}};Object.defineProperty(x,"__esModule",{value:!0});var N=B(M(65721)),E=B(M(32778)),I=B(M(68976)),A=M(95869),v=B(M(99946)),p=B(M(54794)),c=B(M(88597)),f=B(M(85374)),l=B(M(15113)),T=B(M(90829)),m=B(M(27910)),w=M(67858),O=function(ke,Oe){var we=Oe&&Oe.debugTiming?A.time:A.notime;we("layout",function(){Oe&&!Oe.keepNodeOrder&&Oe.prevGraph&&we(" inheritOrder",function(){g(ke,Oe.prevGraph)});var Be=we(" buildLayoutGraph",function(){return fe(ke)});Oe&&Oe.edgeLabelSpace===!1||we(" makeSpaceForEdgeLabels",function(){me(Be)});try{we(" runLayout",function(){D(Be,we,Oe)})}catch(We){if(We.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:
  622. `,We);return}throw We}we(" updateInputGraph",function(){_(ke,Be)})})},D=function(ke,Oe,we){Oe(" removeSelfEdges",function(){nr(ke)}),Oe(" acyclic",function(){N.default.run(ke)}),Oe(" nestingGraph.run",function(){p.default.run(ke)}),Oe(" rank",function(){(0,I.default)((0,A.asNonCompoundGraph)(ke))}),Oe(" injectEdgeLabelProxies",function(){ae(ke)}),Oe(" removeEmptyRanks",function(){(0,A.removeEmptyRanks)(ke)}),Oe(" nestingGraph.cleanup",function(){p.default.cleanup(ke)}),Oe(" normalizeRanks",function(){(0,A.normalizeRanks)(ke)}),Oe(" assignRankMinMax",function(){Ee(ke)}),Oe(" removeEdgeLabelProxies",function(){Le(ke)}),Oe(" normalize.run",function(){E.default.run(ke)}),Oe(" parentDummyChains",function(){(0,v.default)(ke)}),Oe(" addBorderSegments",function(){(0,c.default)(ke)}),we&&we.keepNodeOrder&&Oe(" initDataOrder",function(){(0,m.default)(ke,we.nodeOrder)}),Oe(" order",function(){(0,l.default)(ke)}),Oe(" insertSelfEdges",function(){Fe(ke)}),Oe(" adjustCoordinateSystem",function(){f.default.adjust(ke)}),Oe(" position",function(){(0,T.default)(ke)}),Oe(" positionSelfEdges",function(){Vt(ke)}),Oe(" removeBorderNodes",function(){er(ke)}),Oe(" normalize.undo",function(){E.default.undo(ke)}),Oe(" fixupEdgeLabelCoords",function(){et(ke)}),Oe(" undoCoordinateSystem",function(){f.default.undo(ke)}),Oe(" translateGraph",function(){De(ke)}),Oe(" assignNodeIntersects",function(){Ve(ke)}),Oe(" reversePoints",function(){It(ke)}),Oe(" acyclic.undo",function(){N.default.undo(ke)})},g=function(ke,Oe){ke.nodes().forEach(function(we){var Be=ke.node(we),We=Oe.node(we);We!==void 0?(Be.fixorder=We._order,delete We._order):delete Be.fixorder})},_=function(ke,Oe){ke.nodes().forEach(function(we){var Be,We=ke.node(we);if(We){var He=Oe.node(we);We.x=He.x,We.y=He.y,We._order=He.order,We._rank=He.rank,((Be=Oe.children(we))===null||Be===void 0?void 0:Be.length)&&(We.width=He.width,We.height=He.height)}}),ke.edges().forEach(function(we){var Be=ke.edge(we),We=Oe.edge(we);Be.points=We.points,We.hasOwnProperty("x")&&(Be.x=We.x,Be.y=We.y)}),ke.graph().width=Oe.graph().width,ke.graph().height=Oe.graph().height},Y=["nodesep","edgesep","ranksep","marginx","marginy"],V={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},z=["acyclicer","ranker","rankdir","align"],Z=["width","height","layer","fixorder"],J={width:0,height:0},ee=["minlen","weight","width","height","labeloffset"],Q={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},re=["labelpos"],fe=function(ke){var Oe=new w.Graph({multigraph:!0,compound:!0}),we=Ar(ke.graph()),Be={};return z==null||z.forEach(function(We){we[We]!==void 0&&(Be[We]=we[We])}),Oe.setGraph(Object.assign({},V,$t(we,Y),Be)),ke.nodes().forEach(function(We){var He=Ar(ke.node(We)),St=S(S({},J),He),Mt=$t(St,Z);Oe.setNode(We,Mt),Oe.setParent(We,ke.parent(We))}),ke.edges().forEach(function(We){var He=Ar(ke.edge(We)),St={};re==null||re.forEach(function(Mt){He[Mt]!==void 0&&(St[Mt]=He[Mt])}),Oe.setEdgeObj(We,Object.assign({},Q,$t(He,ee),St))}),Oe},me=function(ke){var Oe=ke.graph();Oe.ranksep||(Oe.ranksep=0),Oe.ranksep/=2,ke.nodes().forEach(function(we){var Be=ke.node(we);isNaN(Be.layer)||Be.layer||(Be.layer=0)}),ke.edges().forEach(function(we){var Be,We=ke.edge(we);We.minlen*=2,((Be=We.labelpos)===null||Be===void 0?void 0:Be.toLowerCase())!=="c"&&(Oe.rankdir==="TB"||Oe.rankdir==="BT"?We.width+=We.labeloffset:We.height+=We.labeloffset)})},ae=function(ke){ke.edges().forEach(function(Oe){var we=ke.edge(Oe);if(we.width&&we.height){var Be=ke.node(Oe.v),We=ke.node(Oe.w),He={e:Oe,rank:(We.rank-Be.rank)/2+Be.rank};(0,A.addDummyNode)(ke,"edge-proxy",He,"_ep")}})},Ee=function(ke){var Oe=0;ke.nodes().forEach(function(we){var Be,We,He=ke.node(we);He.borderTop&&(He.minRank=(Be=ke.node(He.borderTop))===null||Be===void 0?void 0:Be.rank,He.maxRank=(We=ke.node(He.borderBottom))===null||We===void 0?void 0:We.rank,Oe=Math.max(Oe,He.maxRank||-Infinity))}),ke.graph().maxRank=Oe},Le=function(ke){ke.nodes().forEach(function(Oe){var we=ke.node(Oe);we.dummy==="edge-proxy"&&(ke.edge(we.e).labelRank=we.rank,ke.removeNode(Oe))})},De=function(ke){var Oe,we=0,Be,We=0,He=ke.graph(),St=He.marginx||0,Mt=He.marginy||0,sr=function(Ge){if(!!Ge){var ut=Ge.x,U=Ge.y,he=Ge.width,Qe=Ge.height;!isNaN(ut)&&!isNaN(he)&&(Oe===void 0&&(Oe=ut-he/2),Oe=Math.min(Oe,ut-he/2),we=Math.max(we,ut+he/2)),!isNaN(U)&&!isNaN(Qe)&&(Be===void 0&&(Be=U-Qe/2),Be=Math.min(Be,U-Qe/2),We=Math.max(We,U+Qe/2))}};ke.nodes().forEach(function(Ge){sr(ke.node(Ge))}),ke.edges().forEach(function(Ge){var ut=ke.edge(Ge);(ut==null?void 0:ut.hasOwnProperty("x"))&&sr(ut)}),Oe-=St,Be-=Mt,ke.nodes().forEach(function(Ge){var ut=ke.node(Ge);ut&&(ut.x-=Oe,ut.y-=Be)}),ke.edges().forEach(function(Ge){var ut,U=ke.edge(Ge);(ut=U.points)===null||ut===void 0||ut.forEach(function(he){he.x-=Oe,he.y-=Be}),U.hasOwnProperty("x")&&(U.x-=Oe),U.hasOwnProperty("y")&&(U.y-=Be)}),He.width=we-Oe+St,He.height=We-Be+Mt},Ve=function(ke){ke.edges().forEach(function(Oe){var we=ke.edge(Oe),Be=ke.node(Oe.v),We=ke.node(Oe.w),He,St;we.points?(He=we.points[0],St=we.points[we.points.length-1]):(we.points=[],He=We,St=Be),we.points.unshift((0,A.intersectRect)(Be,He)),we.points.push((0,A.intersectRect)(We,St))})},et=function(ke){ke.edges().forEach(function(Oe){var we=ke.edge(Oe);if(we==null?void 0:we.hasOwnProperty("x"))switch((we.labelpos==="l"||we.labelpos==="r")&&(we.width-=we.labeloffset),we.labelpos){case"l":we.x-=we.width/2+we.labeloffset;break;case"r":we.x+=we.width/2+we.labeloffset;break}})},It=function(ke){ke.edges().forEach(function(Oe){var we,Be=ke.edge(Oe);Be.reversed&&((we=Be.points)===null||we===void 0||we.reverse())})},er=function(ke){ke.nodes().forEach(function(Oe){var we,Be,We;if((we=ke.children(Oe))===null||we===void 0?void 0:we.length){var He=ke.node(Oe),St=ke.node(He.borderTop),Mt=ke.node(He.borderBottom),sr=ke.node(He.borderLeft[((Be=He.borderLeft)===null||Be===void 0?void 0:Be.length)-1]),Ge=ke.node(He.borderRight[((We=He.borderRight)===null||We===void 0?void 0:We.length)-1]);He.width=Math.abs((Ge==null?void 0:Ge.x)-(sr==null?void 0:sr.x))||10,He.height=Math.abs((Mt==null?void 0:Mt.y)-(St==null?void 0:St.y))||10,He.x=((sr==null?void 0:sr.x)||0)+He.width/2,He.y=((St==null?void 0:St.y)||0)+He.height/2}}),ke.nodes().forEach(function(Oe){var we;((we=ke.node(Oe))===null||we===void 0?void 0:we.dummy)==="border"&&ke.removeNode(Oe)})},nr=function(ke){ke.edges().forEach(function(Oe){if(Oe.v===Oe.w){var we=ke.node(Oe.v);we.selfEdges||(we.selfEdges=[]),we.selfEdges.push({e:Oe,label:ke.edge(Oe)}),ke.removeEdgeObj(Oe)}})},Fe=function(ke){var Oe=(0,A.buildLayerMatrix)(ke);Oe==null||Oe.forEach(function(we){var Be=0;we==null||we.forEach(function(We,He){var St,Mt=ke.node(We);Mt.order=He+Be,(St=Mt.selfEdges)===null||St===void 0||St.forEach(function(sr){(0,A.addDummyNode)(ke,"selfedge",{width:sr.label.width,height:sr.label.height,rank:Mt.rank,order:He+ ++Be,e:sr.e,label:sr.label},"_se")}),delete Mt.selfEdges})})},Vt=function(ke){ke.nodes().forEach(function(Oe){var we=ke.node(Oe);if(we.dummy==="selfedge"){var Be=ke.node(we.e.v),We=Be.x+Be.width/2,He=Be.y,St=we.x-We,Mt=Be.height/2;ke.setEdgeObj(we.e,we.label),ke.removeNode(Oe),we.label.points=[{x:We+2*St/3,y:He-Mt},{x:We+5*St/6,y:He-Mt},{y:He,x:We+St},{x:We+5*St/6,y:He+Mt},{x:We+2*St/3,y:He+Mt}],we.label.x=we.x,we.label.y=we.y}})},$t=function(ke,Oe){var we={};return Oe==null||Oe.forEach(function(Be){ke[Be]!==void 0&&(we[Be]=+ke[Be])}),we},Ar=function(ke){ke===void 0&&(ke={});var Oe={};return Object.keys(ke).forEach(function(we){Oe[we.toLowerCase()]=ke[we]}),Oe};x.default=O},54794:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var S=M(95869),B=function(v){var p,c=(0,S.addDummyNode)(v,"root",{},"_root"),f=E(v),l=Math.max.apply(Math,Object.values(f));Math.abs(l)===Infinity&&(l=1);var T=l-1,m=2*T+1;v.graph().nestingRoot=c,v.edges().forEach(function(O){v.edge(O).minlen*=m});var w=I(v)+1;(p=v.children())===null||p===void 0||p.forEach(function(O){N(v,c,m,w,T,f,O)}),v.graph().nodeRankFactor=m},N=function(v,p,c,f,l,T,m){var w=v.children(m);if(!(w==null?void 0:w.length)){m!==p&&v.setEdge(p,m,{weight:0,minlen:c});return}var O=(0,S.addBorderNode)(v,"_bt"),D=(0,S.addBorderNode)(v,"_bb"),g=v.node(m);v.setParent(O,m),g.borderTop=O,v.setParent(D,m),g.borderBottom=D,w==null||w.forEach(function(_){N(v,p,c,f,l,T,_);var Y=v.node(_),V=Y.borderTop?Y.borderTop:_,z=Y.borderBottom?Y.borderBottom:_,Z=Y.borderTop?f:2*f,J=V!==z?1:l-T[m]+1;v.setEdge(O,V,{minlen:J,weight:Z,nestingEdge:!0}),v.setEdge(z,D,{minlen:J,weight:Z,nestingEdge:!0})}),v.parent(m)||v.setEdge(p,O,{weight:0,minlen:l+T[m]})},E=function(v){var p,c={},f=function(l,T){var m=v.children(l);m==null||m.forEach(function(w){return f(w,T+1)}),c[l]=T};return(p=v.children())===null||p===void 0||p.forEach(function(l){return f(l,1)}),c},I=function(v){var p=0;return v.edges().forEach(function(c){p+=v.edge(c).weight}),p},A=function(v){var p=v.graph();p.nestingRoot&&v.removeNode(p.nestingRoot),delete p.nestingRoot,v.edges().forEach(function(c){var f=v.edge(c);f.nestingEdge&&v.removeEdgeObj(c)})};x.default={run:B,cleanup:A}},32778:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var S=M(95869),B=function(I){I.graph().dummyChains=[],I.edges().forEach(function(A){return N(I,A)})},N=function(I,A){var v=A.v,p=I.node(v).rank,c=A.w,f=I.node(c).rank,l=A.name,T=I.edge(A),m=T.labelRank;if(f!==p+1){I.removeEdgeObj(A);var w=I.graph(),O,D,g;for(g=0,++p;p<f;++g,++p)T.points=[],D={edgeLabel:T,width:0,height:0,edgeObj:A,rank:p},O=(0,S.addDummyNode)(I,"edge",D,"_d"),p===m&&(D.width=T.width,D.height=T.height,D.dummy="edge-label",D.labelpos=T.labelpos),I.setEdge(v,O,{weight:T.weight},l),g===0&&(w.dummyChains||(w.dummyChains=[]),w.dummyChains.push(O)),v=O;I.setEdge(v,c,{weight:T.weight},l)}},E=function(I){var A;(A=I.graph().dummyChains)===null||A===void 0||A.forEach(function(v){var p=I.node(v),c=p.edgeLabel,f;p.edgeObj&&I.setEdgeObj(p.edgeObj,c);for(var l=v;p.dummy;)f=I.successors(l)[0],I.removeNode(l),c.points.push({x:p.x,y:p.y}),p.dummy==="edge-label"&&(c.x=p.x,c.y=p.y,c.width=p.width,c.height=p.height),l=f,p=I.node(l)})};x.default={run:B,undo:E}},99388:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(S,B,N){var E={},I;N==null||N.forEach(function(A){for(var v=S.parent(A),p,c;v;){if(p=S.parent(v),p?(c=E[p],E[p]=v):(c=I,I=v),c&&c!==v){B.setEdge(c,v);return}v=p}})};x.default=M},38937:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(S,B){return B.map(function(N){var E=S.inEdges(N);if(!(E==null?void 0:E.length))return{v:N};{var I={sum:0,weight:0};return E==null||E.forEach(function(A){var v=S.edge(A),p=S.node(A.v);I.sum+=v.weight*p.order,I.weight+=v.weight}),{v:N,barycenter:I.sum/I.weight,weight:I.weight}}})};x.default=M},74798:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var S=M(67858),B=function(E,I,A){var v=N(E),p=new S.Graph({compound:!0}).setGraph({root:v}).setDefaultNodeLabel(function(c){return E.node(c)});return E.nodes().forEach(function(c){var f,l=E.node(c),T=E.parent(c);(l.rank===I||l.minRank<=I&&I<=l.maxRank)&&(p.setNode(c),p.setParent(c,T||v),(f=E[A](c))===null||f===void 0||f.forEach(function(m){var w=m.v===c?m.w:m.v,O=p.edgeFromArgs(w,c),D=O!==void 0?O.weight:0;p.setEdge(w,c,{weight:E.edge(m).weight+D})}),l.hasOwnProperty("minRank")&&p.setNode(c,{borderLeft:l.borderLeft[I],borderRight:l.borderRight[I]}))}),p},N=function(E){for(var I;E.hasNode(I="_root".concat(Math.random())););return I};x.default=B},14842:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var S=M(95869),B=function(E,I,A){for(var v=(0,S.zipObject)(A,A.map(function(w,O){return O})),p=I.map(function(w){var O,D=(O=E.outEdges(w))===null||O===void 0?void 0:O.map(function(g){return{pos:v[g.w]||0,weight:E.edge(g).weight}});return D==null?void 0:D.sort(function(g,_){return g.pos-_.pos})}),c=p.flat().filter(function(w){return w!==void 0}),f=1;f<A.length;)f<<=1;var l=2*f-1;f-=1;var T=Array(l).fill(0,0,l),m=0;return c==null||c.forEach(function(w){if(w){var O=w.pos+f;T[O]+=w.weight;for(var D=0;O>0;)O%2&&(D+=T[O+1]),O=O-1>>1,T[O]+=w.weight;m+=w.weight*D}}),m},N=function(E,I){for(var A=0,v=1;v<(I==null?void 0:I.length);v+=1)A+=B(E,I[v-1],I[v]);return A};x.default=N},15113:function(dt,x,M){"use strict";var S=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(x,"__esModule",{value:!0});var B=S(M(19722)),N=S(M(14842)),E=S(M(74798)),I=S(M(99388)),A=S(M(69563)),v=M(8273),p=M(67858),c=M(95869),f=function(w){for(var O=(0,c.maxRank)(w),D=[],g=[],_=1;_<O+1;_++)D.push(_);for(var _=O-1;_>-1;_--)g.push(_);var Y=l(w,D,"inEdges"),V=l(w,g,"outEdges"),z=(0,B.default)(w);m(w,z);for(var Z=Number.POSITIVE_INFINITY,J,_=0,ee=0;ee<4;++_,++ee){T(_%2?Y:V,_%4>=2),z=(0,c.buildLayerMatrix)(w);var Q=(0,N.default)(w,z);Q<Z&&(ee=0,J=(0,v.clone)(z),Z=Q)}z=(0,B.default)(w),m(w,z);for(var _=0,ee=0;ee<4;++_,++ee){T(_%2?Y:V,_%4>=2,!0),z=(0,c.buildLayerMatrix)(w);var Q=(0,N.default)(w,z);Q<Z&&(ee=0,J=(0,v.clone)(z),Z=Q)}m(w,J)},l=function(w,O,D){return O.map(function(g){return(0,E.default)(w,g,D)})},T=function(w,O,D){var g=new p.Graph;w==null||w.forEach(function(_){for(var Y,V=_.graph().root,z=(0,A.default)(_,V,g,O,D),Z=0;Z<((Y=z.vs)===null||Y===void 0?void 0:Y.length);Z++){var J=_.node(z.vs[Z]);J&&(J.order=Z)}(0,I.default)(_,g,z.vs)})},m=function(w,O){O==null||O.forEach(function(D){D==null||D.forEach(function(g,_){w.node(g).order=_})})};x.default=f},27910:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(S,B){var N=S.nodes().filter(function(v){var p;return!((p=S.children(v))===null||p===void 0?void 0:p.length)}),E=N.map(function(v){return S.node(v).rank}),I=Math.max.apply(Math,E),A=Array(I+1).fill([]);B==null||B.forEach(function(v){var p=S.node(v);!p||(p==null?void 0:p.dummy)||isNaN(p.rank)||(p.fixorder=A[p.rank].length,A[p.rank].push(v))})};x.default=M},19722:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(S){for(var B={},N=S.nodes().filter(function(T){var m;return!((m=S.children(T))===null||m===void 0?void 0:m.length)}),E=N.map(function(T){return S.node(T).rank}),I=Math.max.apply(Math,E),A=[],v=0;v<I+1;v++)A.push([]);var p=function(T){var m;if(!B.hasOwnProperty(T)){B[T]=!0;var w=S.node(T);isNaN(w.rank)||A[w.rank].push(T),(m=S.successors(T))===null||m===void 0||m.forEach(function(O){return p(O)})}},c=N.sort(function(T,m){return S.node(T).rank-S.node(m).rank}),f=c.filter(function(T){return S.node(T).fixorder!==void 0}),l=f.sort(function(T,m){return S.node(T).fixorder-S.node(m).fixorder});return l==null||l.forEach(function(T){isNaN(S.node(T).rank)||A[S.node(T).rank].push(T),B[T]=!0}),c==null||c.forEach(p),A};x.default=M},73792:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(N,E){var I,A,v,p={};N==null||N.forEach(function(f,l){p[f.v]={i:l,indegree:0,in:[],out:[],vs:[f.v]};var T=p[f.v];f.barycenter!==void 0&&(T.barycenter=f.barycenter,T.weight=f.weight)}),(I=E.edges())===null||I===void 0||I.forEach(function(f){var l=p[f.v],T=p[f.w];l!==void 0&&T!==void 0&&(T.indegree++,l.out.push(p[f.w]))});var c=(v=(A=Object.values(p)).filter)===null||v===void 0?void 0:v.call(A,function(f){return!f.indegree});return S(c)},S=function(N){for(var E,I,A=[],v=function(T){return function(m){m.merged||(m.barycenter===void 0||T.barycenter===void 0||m.barycenter>=T.barycenter)&&B(T,m)}},p=function(T){return function(m){m.in.push(T),--m.indegree==0&&N.push(m)}},c=function(){var T=N.pop();A.push(T),(E=T.in.reverse())===null||E===void 0||E.forEach(function(m){return v(T)(m)}),(I=T.out)===null||I===void 0||I.forEach(function(m){return p(T)(m)})};N==null?void 0:N.length;)c();var f=A.filter(function(T){return!T.merged}),l=["vs","i","barycenter","weight"];return f.map(function(T){var m={};return l==null||l.forEach(function(w){T[w]!==void 0&&(m[w]=T[w])}),m})},B=function(N,E){var I,A=0,v=0;N.weight&&(A+=N.barycenter*N.weight,v+=N.weight),E.weight&&(A+=E.barycenter*E.weight,v+=E.weight),N.vs=(I=E.vs)===null||I===void 0?void 0:I.concat(N.vs),N.barycenter=A/v,N.weight=v,N.i=Math.min(E.i,N.i),E.merged=!0};x.default=M},69563:function(dt,x,M){"use strict";var S=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(x,"__esModule",{value:!0});var B=S(M(38937)),N=S(M(73792)),E=S(M(17457)),I=function(p,c,f,l,T){var m,w,O,D,g=p.children(c),_=p.node(c),Y=_?_.borderLeft:void 0,V=_?_.borderRight:void 0,z={};Y&&(g=g==null?void 0:g.filter(function(fe){return fe!==Y&&fe!==V}));var Z=(0,B.default)(p,g||[]);Z==null||Z.forEach(function(fe){var me;if((me=p.children(fe.v))===null||me===void 0?void 0:me.length){var ae=I(p,fe.v,f,l);z[fe.v]=ae,ae.hasOwnProperty("barycenter")&&v(fe,ae)}});var J=(0,N.default)(Z,f);A(J,z),(m=J.filter(function(fe){return fe.vs.length>0}))===null||m===void 0||m.forEach(function(fe){var me=p.node(fe.vs[0]);me&&(fe.fixorder=me.fixorder,fe.order=me.order)});var ee=(0,E.default)(J,l,T);if(Y&&(ee.vs=[Y,ee.vs,V].flat(),(w=p.predecessors(Y))===null||w===void 0?void 0:w.length)){var Q=p.node(((O=p.predecessors(Y))===null||O===void 0?void 0:O[0])||""),re=p.node(((D=p.predecessors(V))===null||D===void 0?void 0:D[0])||"");ee.hasOwnProperty("barycenter")||(ee.barycenter=0,ee.weight=0),ee.barycenter=(ee.barycenter*ee.weight+Q.order+re.order)/(ee.weight+2),ee.weight+=2}return ee},A=function(p,c){p==null||p.forEach(function(f){var l,T=(l=f.vs)===null||l===void 0?void 0:l.map(function(m){return c[m]?c[m].vs:m});f.vs=T.flat()})},v=function(p,c){p.barycenter!==void 0?(p.barycenter=(p.barycenter*p.weight+c.barycenter*c.weight)/(p.weight+c.weight),p.weight+=c.weight):(p.barycenter=c.barycenter,p.weight=c.weight)};x.default=I},17457:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var S=M(95869),B=function(I,A,v){var p=(0,S.partition)(I,function(D){return D.hasOwnProperty("fixorder")&&!isNaN(D.fixorder)||D.hasOwnProperty("barycenter")}),c=p.lhs,f=p.rhs.sort(function(D,g){return-D.i- -g.i}),l=[],T=0,m=0,w=0;c==null||c.sort(E(!!A,!!v)),w=N(l,f,w),c==null||c.forEach(function(D){var g;w+=(g=D.vs)===null||g===void 0?void 0:g.length,l.push(D.vs),T+=D.barycenter*D.weight,m+=D.weight,w=N(l,f,w)});var O={vs:l.flat()};return m&&(O.barycenter=T/m,O.weight=m),O},N=function(I,A,v){for(var p=v,c;A.length&&(c=A[A.length-1]).i<=p;)A.pop(),I==null||I.push(c.vs),p++;return p},E=function(I,A){return function(v,p){if(v.fixorder!==void 0&&p.fixorder!==void 0)return v.fixorder-p.fixorder;if(v.barycenter<p.barycenter)return-1;if(v.barycenter>p.barycenter)return 1;if(A&&v.order!==void 0&&p.order!==void 0){if(v.order<p.order)return-1;if(v.order>p.order)return 1}return I?p.i-v.i:v.i-p.i}};x.default=B},99946:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(N){var E,I={},A=0,v=function(p){var c,f=A;(c=N.children(p))===null||c===void 0||c.forEach(v),I[p]={low:f,lim:A++}};return(E=N.children())===null||E===void 0||E.forEach(v),I},S=function(N,E,I,A){var v=[],p=[],c=Math.min(E[I].low,E[A].low),f=Math.max(E[I].lim,E[A].lim),l,T;l=I;do l=N.parent(l),v.push(l);while(l&&(E[l].low>c||f>E[l].lim));for(T=l,l=A;l&&l!==T;)p.push(l),l=N.parent(l);return{lca:T,path:v.concat(p.reverse())}},B=function(N){var E,I=M(N);(E=N.graph().dummyChains)===null||E===void 0||E.forEach(function(A){var v,p,c=A,f=N.node(c),l=f.edgeObj;if(!!l)for(var T=S(N,I,l.v,l.w),m=T.path,w=T.lca,O=0,D=m[O],g=!0;c!==l.w;){if(f=N.node(c),g){for(;D!==w&&((v=N.node(D))===null||v===void 0?void 0:v.maxRank)<f.rank;)O++,D=m[O];D===w&&(g=!1)}if(!g){for(;O<m.length-1&&((p=N.node(m[O+1]))===null||p===void 0?void 0:p.minRank)<=f.rank;)O++;D=m[O]}N.setParent(c,D),c=N.successors(c)[0]}})};x.default=B},50075:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var Y=function(V,z){return Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Z,J){Z.__proto__=J}||function(Z,J){for(var ee in J)Object.prototype.hasOwnProperty.call(J,ee)&&(Z[ee]=J[ee])},Y(V,z)};return function(V,z){if(typeof z!="function"&&z!==null)throw new TypeError("Class extends value "+String(z)+" is not a constructor or null");Y(V,z);function Z(){this.constructor=V}V.prototype=z===null?Object.create(z):(Z.prototype=z.prototype,new Z)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.width=x.sep=x.positionX=x.balance=x.alignCoordinates=x.findSmallestWidthAlignment=x.buildBlockGraph=x.horizontalCompaction=x.verticalAlignment=x.hasConflict=x.addConflict=x.findOtherInnerSegmentNode=x.findType2Conflicts=x.findType1Conflicts=void 0;var B=M(69787),N=M(95869),E=function(Y){S(V,Y);function V(){return Y!==null&&Y.apply(this,arguments)||this}return V}(B.Graph),I=function(Y,V){var z={},Z=function(J,ee){var Q=0,re=0,fe=J.length,me=ee==null?void 0:ee[(ee==null?void 0:ee.length)-1];return ee==null||ee.forEach(function(ae,Ee){var Le,De=(0,x.findOtherInnerSegmentNode)(Y,ae),Ve=De?Y.node(De).order:fe;(De||ae===me)&&((Le=ee.slice(re,Ee+1))===null||Le===void 0||Le.forEach(function(et){var It;(It=Y.predecessors(et))===null||It===void 0||It.forEach(function(er){var nr,Fe=Y.node(er),Vt=Fe.order;(Vt<Q||Ve<Vt)&&!(Fe.dummy&&((nr=Y.node(et))===null||nr===void 0?void 0:nr.dummy))&&(0,x.addConflict)(z,er,et)})}),re=Ee+1,Q=Ve)}),ee};return(V==null?void 0:V.length)&&V.reduce(Z),z};x.findType1Conflicts=I;var A=function(Y,V){var z={},Z=function(ee,Q,re,fe,me){for(var ae,Ee=[],Le=Q;Le<re;Le++)Ee.push(Le);Ee.forEach(function(De){var Ve,et;ae=ee[De],((Ve=Y.node(ae))===null||Ve===void 0?void 0:Ve.dummy)&&((et=Y.predecessors(ae))===null||et===void 0||et.forEach(function(It){var er=Y.node(It);er.dummy&&(er.order<fe||er.order>me)&&(0,x.addConflict)(z,It,ae)}))})},J=function(ee,Q){var re=-1,fe,me=0;return Q==null||Q.forEach(function(ae,Ee){var Le;if(((Le=Y.node(ae))===null||Le===void 0?void 0:Le.dummy)==="border"){var De=Y.predecessors(ae)||[];De.length&&(fe=Y.node(De[0]).order,Z(Q,me,Ee,re,fe),me=Ee,re=fe)}Z(Q,me,Q.length,fe,ee.length)}),Q};return(V==null?void 0:V.length)&&V.reduce(J),z};x.findType2Conflicts=A;var v=function(Y,V){var z,Z;if((z=Y.node(V))===null||z===void 0?void 0:z.dummy)return(Z=Y.predecessors(V))===null||Z===void 0?void 0:Z.find(function(J){return Y.node(J).dummy})};x.findOtherInnerSegmentNode=v;var p=function(Y,V,z){var Z=V,J=z;if(Z>J){var ee=Z;Z=J,J=ee}var Q=Y[Z];Q||(Y[Z]=Q={}),Q[J]=!0};x.addConflict=p;var c=function(Y,V,z){var Z=V,J=z;if(Z>J){var ee=V;Z=J,J=ee}return!!Y[Z]};x.hasConflict=c;var f=function(Y,V,z,Z){var J={},ee={},Q={};return V==null||V.forEach(function(re){re==null||re.forEach(function(fe,me){J[fe]=fe,ee[fe]=fe,Q[fe]=me})}),V==null||V.forEach(function(re){var fe=-1;re==null||re.forEach(function(me){var ae=Z(me);if(ae.length){ae=ae.sort(function(et,It){return Q[et]-Q[It]});for(var Ee=(ae.length-1)/2,Le=Math.floor(Ee),De=Math.ceil(Ee);Le<=De;++Le){var Ve=ae[Le];ee[me]===me&&fe<Q[Ve]&&!(0,x.hasConflict)(z,me,Ve)&&(ee[Ve]=me,ee[me]=J[me]=J[Ve],fe=Q[Ve])}}})}),{root:J,align:ee}};x.verticalAlignment=f;var l=function(Y,V,z,Z,J){var ee,Q={},re=(0,x.buildBlockGraph)(Y,V,z,J),fe=J?"borderLeft":"borderRight",me=function(Le,De){for(var Ve=re.nodes(),et=Ve.pop(),It={};et;)It[et]?Le(et):(It[et]=!0,Ve.push(et),Ve=Ve.concat(De(et))),et=Ve.pop()},ae=function(Le){Q[Le]=(re.inEdges(Le)||[]).reduce(function(De,Ve){return Math.max(De,(Q[Ve.v]||0)+re.edge(Ve))},0)},Ee=function(Le){var De=(re.outEdges(Le)||[]).reduce(function(et,It){return Math.min(et,(Q[It.w]||0)-re.edge(It))},Number.POSITIVE_INFINITY),Ve=Y.node(Le);De!==Number.POSITIVE_INFINITY&&Ve.borderType!==fe&&(Q[Le]=Math.max(Q[Le],De))};return me(ae,re.predecessors.bind(re)),me(Ee,re.successors.bind(re)),(ee=Object.values(Z))===null||ee===void 0||ee.forEach(function(Le){Q[Le]=Q[z[Le]]}),Q};x.horizontalCompaction=l;var T=function(Y,V,z,Z){var J=new E,ee=Y.graph(),Q=(0,x.sep)(ee.nodesep,ee.edgesep,Z);return V==null||V.forEach(function(re){var fe;re==null||re.forEach(function(me){var ae=z[me];if(J.setNode(ae),fe){var Ee=z[fe],Le=J.edgeFromArgs(Ee,ae);J.setEdge(Ee,ae,Math.max(Q(Y,me,fe),Le||0))}fe=me})}),J};x.buildBlockGraph=T;var m=function(Y,V){return(0,N.minBy)(Object.values(V),function(z){var Z,J=Number.NEGATIVE_INFINITY,ee=Number.POSITIVE_INFINITY;return(Z=Object.keys(z))===null||Z===void 0||Z.forEach(function(Q){var re=z[Q],fe=(0,x.width)(Y,Q)/2;J=Math.max(re+fe,J),ee=Math.min(re-fe,ee)}),J-ee})};x.findSmallestWidthAlignment=m;function w(Y,V){var z=Object.values(V),Z=Math.min.apply(Math,z),J=Math.max.apply(Math,z);["u","d"].forEach(function(ee){["l","r"].forEach(function(Q){var re=ee+Q,fe=Y[re],me;if(fe!==V){var ae=Object.values(fe);me=Q==="l"?Z-Math.min.apply(Math,ae):J-Math.max.apply(Math,ae),me&&(Y[re]={},Object.keys(fe).forEach(function(Ee){Y[re][Ee]=fe[Ee]+me}))}})})}x.alignCoordinates=w;var O=function(Y,V){var z={};return Object.keys(Y.ul).forEach(function(Z){if(V)z[Z]=Y[V.toLowerCase()][Z];else{var J=Object.values(Y).map(function(ee){return ee[Z]});z[Z]=(J[0]+J[1])/2}}),z};x.balance=O;var D=function(Y){var V=(0,N.buildLayerMatrix)(Y),z=Object.assign((0,x.findType1Conflicts)(Y,V),(0,x.findType2Conflicts)(Y,V)),Z={},J;["u","d"].forEach(function(Q){J=Q==="u"?V:Object.values(V).reverse(),["l","r"].forEach(function(re){re==="r"&&(J=J.map(function(Ee){return Object.values(Ee).reverse()}));var fe=(Q==="u"?Y.predecessors:Y.successors).bind(Y),me=(0,x.verticalAlignment)(Y,J,z,fe),ae=(0,x.horizontalCompaction)(Y,J,me.root,me.align,re==="r");re==="r"&&Object.keys(ae).forEach(function(Ee){ae[Ee]=-ae[Ee]}),Z[Q+re]=ae})});var ee=(0,x.findSmallestWidthAlignment)(Y,Z);return w(Z,ee),(0,x.balance)(Z,Y.graph().align)};x.positionX=D;var g=function(Y,V,z){return function(Z,J,ee){var Q=Z.node(J),re=Z.node(ee),fe=0,me;if(fe+=Q.width/2,Q.hasOwnProperty("labelpos"))switch((Q.labelpos||"").toLowerCase()){case"l":me=-Q.width/2;break;case"r":me=Q.width/2;break}if(me&&(fe+=z?me:-me),me=0,fe+=(Q.dummy?V:Y)/2,fe+=(re.dummy?V:Y)/2,fe+=re.width/2,re.labelpos)switch((re.labelpos||"").toLowerCase()){case"l":me=re.width/2;break;case"r":me=-re.width/2;break}return me&&(fe+=z?me:-me),me=0,fe}};x.sep=g;var _=function(Y,V){return Y.node(V).width||0};x.width=_},90829:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var S=M(95869),B=M(50075),N=function(A){var v=(0,S.buildLayerMatrix)(A),p=A.graph().ranksep,c=0;v==null||v.forEach(function(f){var l=f.map(function(m){return A.node(m).height}),T=Math.max.apply(Math,l);f==null||f.forEach(function(m){A.node(m).y=c+T/2}),c+=T+p})},E=function(A){var v=(0,S.buildLayerMatrix)(A),p=Object.assign((0,B.findType1Conflicts)(A,v),(0,B.findType2Conflicts)(A,v)),c={},f=[];["u","d"].forEach(function(T){f=T==="u"?v:Object.values(v).reverse(),["l","r"].forEach(function(m){m==="r"&&(f=f.map(function(g){return Object.values(g).reverse()}));var w=(T==="u"?A.predecessors:A.successors).bind(A),O=(0,B.verticalAlignment)(A,f,p,w),D=(0,B.horizontalCompaction)(A,f,O.root,O.align,m==="r");m==="r"&&Object.keys(D).forEach(function(g){return D[g]=-D[g]}),c[T+m]=D})});var l=(0,B.findSmallestWidthAlignment)(A,c);return l&&(0,B.alignCoordinates)(c,l),(0,B.balance)(c,A.graph().align)},I=function(A){var v,p=(0,S.asNonCompoundGraph)(A);N(p);var c=E(p);(v=Object.keys(c))===null||v===void 0||v.forEach(function(f){p.node(f).x=c[f]})};x.default=I},85003:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.feasibleTreeWithLayer=x.feasibleTree=void 0;var S=M(76783),B=M(95869),N=M(67858),E=function(f){var l=new N.Graph({directed:!1}),T=f.nodes()[0],m=f.nodeCount();l.setNode(T,{});for(var w,O;I(l,f)<m;)w=p(l,f),O=l.hasNode(w.v)?(0,S.slack)(f,w):-(0,S.slack)(f,w),c(l,f,O);return l};x.feasibleTree=E;var I=function(f,l){var T=function(m){l.nodeEdges(m).forEach(function(w){var O=w.v,D=m===O?w.w:O;!f.hasNode(D)&&!(0,S.slack)(l,w)&&(f.setNode(D,{}),f.setEdge(m,D,{}),T(D))})};return f.nodes().forEach(T),f.nodeCount()},A=function(f){var l=new N.Graph({directed:!1}),T=f.nodes()[0],m=f.nodeCount();l.setNode(T,{});for(var w,O;v(l,f)<m;)w=p(l,f),O=l.hasNode(w.v)?(0,S.slack)(f,w):-(0,S.slack)(f,w),c(l,f,O);return l};x.feasibleTreeWithLayer=A;var v=function(f,l){var T=function(m){var w;(w=l.nodeEdges(m))===null||w===void 0||w.forEach(function(O){var D=O.v,g=m===D?O.w:D;!f.hasNode(g)&&(l.node(g).layer!==void 0||!(0,S.slack)(l,O))&&(f.setNode(g,{}),f.setEdge(m,g,{}),T(g))})};return f.nodes().forEach(T),f.nodeCount()},p=function(f,l){return(0,B.minBy)(l.edges(),function(T){return f.hasNode(T.v)!==f.hasNode(T.w)?(0,S.slack)(l,T):Infinity})},c=function(f,l,T){f.nodes().forEach(function(m){l.node(m).rank||(l.node(m).rank=0),l.node(m).rank+=T})};x.default={feasibleTree:E,feasibleTreeWithLayer:A}},68976:function(dt,x,M){"use strict";var S=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(x,"__esModule",{value:!0});var B=M(76783),N=M(85003),E=S(M(5574)),I=function(c){switch(c.graph().ranker){case"network-simplex":p(c);break;case"tight-tree":v(c);break;case"longest-path":A(c);break;default:v(c)}},A=B.longestPath,v=function(c){(0,B.longestPathWithLayer)(c),(0,N.feasibleTreeWithLayer)(c)},p=function(c){(0,E.default)(c)};x.default=I},5574:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.exchangeEdges=x.enterEdge=x.leaveEdge=x.initLowLimValues=x.calcCutValue=x.initCutValues=void 0;var S=M(85003),B=M(76783),N=M(95869),E=M(69787),I=E.algorithm.preorder,A=E.algorithm.postorder,v=function(Y){var V=(0,N.simplify)(Y);(0,B.longestPath)(V);var z=(0,S.feasibleTree)(V);(0,x.initLowLimValues)(z),(0,x.initCutValues)(z,V);for(var Z,J;Z=(0,x.leaveEdge)(z);)J=(0,x.enterEdge)(z,V,Z),(0,x.exchangeEdges)(z,V,Z,J)},p=function(Y,V){var z=A(Y,Y.nodes());z=z==null?void 0:z.slice(0,(z==null?void 0:z.length)-1),z==null||z.forEach(function(Z){c(Y,V,Z)})};x.initCutValues=p;var c=function(Y,V,z){var Z=Y.node(z),J=Z.parent;Y.edgeFromArgs(z,J).cutvalue=(0,x.calcCutValue)(Y,V,z)},f=function(Y,V,z){var Z,J=Y.node(z),ee=J.parent,Q=!0,re=V.edgeFromArgs(z,ee),fe=0;return re||(Q=!1,re=V.edgeFromArgs(ee,z)),fe=re.weight,(Z=V.nodeEdges(z))===null||Z===void 0||Z.forEach(function(me){var ae=me.v===z,Ee=ae?me.w:me.v;if(Ee!==ee){var Le=ae===Q,De=V.edge(me).weight;if(fe+=Le?De:-De,g(Y,z,Ee)){var Ve=Y.edgeFromArgs(z,Ee).cutvalue;fe+=Le?-Ve:Ve}}}),fe};x.calcCutValue=f;var l=function(Y,V){V===void 0&&(V=Y.nodes()[0]),T(Y,{},1,V)};x.initLowLimValues=l;var T=function(Y,V,z,Z,J){var ee,Q=z,re=z,fe=Y.node(Z);return V[Z]=!0,(ee=Y.neighbors(Z))===null||ee===void 0||ee.forEach(function(me){V[me]||(re=T(Y,V,re,me,Z))}),fe.low=Q,fe.lim=re++,J?fe.parent=J:delete fe.parent,re},m=function(Y){return Y.edges().find(function(V){return Y.edge(V).cutvalue<0})};x.leaveEdge=m;var w=function(Y,V,z){var Z=z.v,J=z.w;V.hasEdge(Z,J)||(Z=z.w,J=z.v);var ee=Y.node(Z),Q=Y.node(J),re=ee,fe=!1;ee.lim>Q.lim&&(re=Q,fe=!0);var me=V.edges().filter(function(ae){return fe===_(Y,Y.node(ae.v),re)&&fe!==_(Y,Y.node(ae.w),re)});return(0,N.minBy)(me,function(ae){return(0,B.slack)(V,ae)})};x.enterEdge=w;var O=function(Y,V,z,Z){var J=z.v,ee=z.w;Y.removeEdge(J,ee),Y.setEdge(Z.v,Z.w,{}),(0,x.initLowLimValues)(Y),(0,x.initCutValues)(Y,V),D(Y,V)};x.exchangeEdges=O;var D=function(Y,V){var z=Y.nodes().find(function(J){var ee;return!((ee=V.node(J))===null||ee===void 0?void 0:ee.parent)}),Z=I(Y,z);Z=Z==null?void 0:Z.slice(1),Z==null||Z.forEach(function(J){var ee=Y.node(J).parent,Q=V.edgeFromArgs(J,ee),re=!1;Q||(Q=V.edgeFromArgs(ee,J),re=!0),V.node(J).rank=V.node(ee).rank+(re?Q.minlen:-Q.minlen)})},g=function(Y,V,z){return Y.hasEdge(V,z)},_=function(Y,V,z){return z.low<=V.lim&&V.lim<=z.lim};x.default=v},76783:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.slack=x.longestPathWithLayer=x.longestPath=void 0;var M=function(N){var E,I={},A=function(v){var p,c=N.node(v);if(I[v])return c.rank;I[v]=!0;var f;return(p=N.outEdges(v))===null||p===void 0||p.forEach(function(l){var T=A(l.w),m=N.edge(l).minlen,w=T-m;w&&(f===void 0||w<f)&&(f=w)}),f||(f=0),c.rank=f,f};(E=N.sources())===null||E===void 0||E.forEach(function(v){return A(v)})};x.longestPath=M;var S=function(N){var E,I={},A,v=function(c){var f,l=N.node(c);if(I[c])return l.rank;I[c]=!0;var T;return(f=N.outEdges(c))===null||f===void 0||f.forEach(function(m){var w=v(m.w),O=N.edge(m).minlen,D=w-O;D&&(T===void 0||D<T)&&(T=D)}),T||(T=0),(A===void 0||T<A)&&(A=T),l.rank=T,T};(E=N.sources())===null||E===void 0||E.forEach(function(c){return v(c)}),A===void 0&&(A=0);var p=function(c,f){var l,T=N.node(c),m=isNaN(T.layer)?f:T.layer;(T.rank===void 0||T.rank<m)&&(T.rank=m),(l=N.outEdges(c))===null||l===void 0||l.map(function(w){p(w.w,m+N.edge(w).minlen)})};N.nodes().forEach(function(c){var f=N.node(c);isNaN(f.layer)?f.rank-=A:p(c,f.layer)})};x.longestPathWithLayer=S;var B=function(N,E){return N.node(E.w).rank-N.node(E.v).rank-N.edge(E).minlen};x.slack=B,x.default={longestPath:M,longestPathWithLayer:S,slack:B}},95869:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.minBy=x.notime=x.time=x.partition=x.maxRank=x.addBorderNode=x.removeEmptyRanks=x.normalizeRanks=x.buildLayerMatrix=x.intersectRect=x.predecessorWeights=x.successorWeights=x.zipObject=x.asNonCompoundGraph=x.simplify=x.addDummyNode=void 0;var S=M(8273),B=M(67858),N=function(V,z){return Number(V)-Number(z)},E=function(V,z,Z,J){var ee;do ee="".concat(J).concat(Math.random());while(V.hasNode(ee));return Z.dummy=z,V.setNode(ee,Z),ee};x.addDummyNode=E;var I=function(V){var z=new B.Graph().setGraph(V.graph());return V.nodes().forEach(function(Z){z.setNode(Z,V.node(Z))}),V.edges().forEach(function(Z){var J=z.edgeFromArgs(Z.v,Z.w)||{weight:0,minlen:1},ee=V.edge(Z);z.setEdge(Z.v,Z.w,{weight:J.weight+ee.weight,minlen:Math.max(J.minlen,ee.minlen)})}),z};x.simplify=I;var A=function(V){var z=new B.Graph({multigraph:V.isMultigraph()}).setGraph(V.graph());return V.nodes().forEach(function(Z){var J;((J=V.children(Z))===null||J===void 0?void 0:J.length)||z.setNode(Z,V.node(Z))}),V.edges().forEach(function(Z){z.setEdgeObj(Z,V.edge(Z))}),z};x.asNonCompoundGraph=A;var v=function(V,z){return V==null?void 0:V.reduce(function(Z,J,ee){return Z[J]=z[ee],Z},{})};x.zipObject=v;var p=function(V){var z={};return V.nodes().forEach(function(Z){var J,ee={};(J=V.outEdges(Z))===null||J===void 0||J.forEach(function(Q){var re;ee[Q.w]=(ee[Q.w]||0)+(((re=V.edge(Q))===null||re===void 0?void 0:re.weight)||0)}),z[Z]=ee}),z};x.successorWeights=p;var c=function(V){var z=V.nodes(),Z=z.map(function(J){var ee,Q={};return(ee=V.inEdges(J))===null||ee===void 0||ee.forEach(function(re){Q[re.v]=(Q[re.v]||0)+V.edge(re).weight}),Q});return(0,x.zipObject)(z,Z)};x.predecessorWeights=c;var f=function(V,z){var Z=Number(V.x),J=Number(V.y),ee=Number(z.x)-Z,Q=Number(z.y)-J,re=Number(V.width)/2,fe=Number(V.height)/2;if(!ee&&!Q)return{x:0,y:0};var me,ae;return Math.abs(Q)*re>Math.abs(ee)*fe?(Q<0&&(fe=-fe),me=fe*ee/Q,ae=fe):(ee<0&&(re=-re),me=re,ae=re*Q/ee),{x:Z+me,y:J+ae}};x.intersectRect=f;var l=function(V){for(var z=[],Z=(0,x.maxRank)(V)+1,J=0;J<Z;J++)z.push([]);V.nodes().forEach(function(ee){var Q=V.node(ee),re=Q.rank;re!==void 0&&z[re]&&z[re].push(ee)});for(var J=0;J<Z;J++)z[J]=z[J].sort(function(Q,re){var fe,me;return N((fe=V.node(Q))===null||fe===void 0?void 0:fe.order,(me=V.node(re))===null||me===void 0?void 0:me.order)});return z};x.buildLayerMatrix=l;var T=function(V){var z=V.nodes().filter(function(J){var ee;return((ee=V.node(J))===null||ee===void 0?void 0:ee.rank)!==void 0}).map(function(J){return V.node(J).rank}),Z=Math.min.apply(Math,z);V.nodes().forEach(function(J){var ee=V.node(J);ee.hasOwnProperty("rank")&&Z!==Infinity&&(ee.rank-=Z)})};x.normalizeRanks=T;var m=function(V){var z=V.nodes(),Z=z.filter(function(ae){var Ee;return((Ee=V.node(ae))===null||Ee===void 0?void 0:Ee.rank)!==void 0}).map(function(ae){return V.node(ae).rank}),J=Math.min.apply(Math,Z),ee=[];z.forEach(function(ae){var Ee,Le=(((Ee=V.node(ae))===null||Ee===void 0?void 0:Ee.rank)||0)-J;ee[Le]||(ee[Le]=[]),ee[Le].push(ae)});for(var Q=0,re=V.graph().nodeRankFactor||0,fe=0;fe<ee.length;fe++){var me=ee[fe];me===void 0?fe%re!=0&&(Q-=1):Q&&(me==null||me.forEach(function(ae){var Ee=V.node(ae);Ee&&(Ee.rank=Ee.rank||0,Ee.rank+=Q)}))}};x.removeEmptyRanks=m;var w=function(V,z,Z,J){var ee={width:0,height:0};return(0,S.isNumber)(Z)&&(0,S.isNumber)(J)&&(ee.rank=Z,ee.order=J),(0,x.addDummyNode)(V,"border",ee,z)};x.addBorderNode=w;var O=function(V){var z;return V.nodes().forEach(function(Z){var J,ee=(J=V.node(Z))===null||J===void 0?void 0:J.rank;ee!==void 0&&(z===void 0||ee>z)&&(z=ee)}),z||(z=0),z};x.maxRank=O;var D=function(V,z){var Z={lhs:[],rhs:[]};return V==null||V.forEach(function(J){z(J)?Z.lhs.push(J):Z.rhs.push(J)}),Z};x.partition=D;var g=function(V,z){var Z=Date.now();try{return z()}finally{console.log("".concat(V," time: ").concat(Date.now()-Z,"ms"))}};x.time=g;var _=function(V,z){return z()};x.notime=_;var Y=function(V,z){return V.reduce(function(Z,J){var ee=z(Z),Q=z(J);return ee>Q?J:Z})};x.minBy=Y},29279:function(dt,x,M){"use strict";var S=this&&this.__assign||function(){return S=Object.assign||function(l){for(var T,m=1,w=arguments.length;m<w;m++){T=arguments[m];for(var O in T)Object.prototype.hasOwnProperty.call(T,O)&&(l[O]=T[O])}return l},S.apply(this,arguments)},B=this&&this.__createBinding||(Object.create?function(l,T,m,w){w===void 0&&(w=m);var O=Object.getOwnPropertyDescriptor(T,m);(!O||("get"in O?!T.__esModule:O.writable||O.configurable))&&(O={enumerable:!0,get:function(){return T[m]}}),Object.defineProperty(l,w,O)}:function(l,T,m,w){w===void 0&&(w=m),l[w]=T[m]}),N=this&&this.__setModuleDefault||(Object.create?function(l,T){Object.defineProperty(l,"default",{enumerable:!0,value:T})}:function(l,T){l.default=T}),E=this&&this.__importStar||function(l){if(l&&l.__esModule)return l;var T={};if(l!=null)for(var m in l)m!=="default"&&Object.prototype.hasOwnProperty.call(l,m)&&B(T,l,m);return N(T,l),T},I=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(x,"__esModule",{value:!0});var A=E(M(41685)),v=I(M(28563)),p=I(M(77280)),c=M(2);function f(l,T){var m=l.nodes,w=l.edges,O=T.width,D=T.height;if(!(m==null?void 0:m.length))return Promise.resolve();var g=[];m.forEach(function(Q){var re=w.filter(function(me){return me.source===Q.id||me.target===Q.id});if(re.length>1){var fe=S({},Q);delete fe.size,g.push(fe)}});var _=[];w.forEach(function(Q){var re=g.find(function(me){return me.id===Q.source}),fe=g.find(function(me){return me.id===Q.target});re&&fe&&_.push(Q)});var Y=new c.DagreLayout({type:"dagre",ranksep:T.nodeMinGap,nodesep:T.nodeMinGap}),V=Y.layout({nodes:g,edges:_}).nodes;m.forEach(function(Q){var re=(V||[]).find(function(fe){return fe.id===Q.id});Q.x=(re==null?void 0:re.x)||O/2,Q.y=(re==null?void 0:re.y)||D/2});var z=JSON.parse(JSON.stringify(m)),Z=JSON.parse(JSON.stringify(w)),J=A.forceSimulation().nodes(z).force("link",A.forceLink(Z).id(function(Q){return Q.id}).distance(function(Q){var re=_.find(function(fe){return fe.source===Q.source&&fe.target===Q.target});return re?30:20})).force("charge",A.forceManyBody()).force("center",A.forceCenter(O/2,D/2)).force("x",A.forceX(O/2)).force("y",A.forceY(D/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),ee=new Promise(function(Q){J.on("end",function(){m.forEach(function(De){var Ve=z.find(function(et){return et.id===De.id});Ve&&(De.x=Ve.x,De.y=Ve.y)});var re=Math.min.apply(Math,m.map(function(De){return De.x})),fe=Math.max.apply(Math,m.map(function(De){return De.x})),me=Math.min.apply(Math,m.map(function(De){return De.y})),ae=Math.max.apply(Math,m.map(function(De){return De.y})),Ee=O/(fe-re),Le=D/(ae-me);m.forEach(function(De){De.x!==void 0&&Ee<1&&(De.x=(De.x-re)*Ee),De.y!==void 0&&Le<1&&(De.y=(De.y-me)*Le)}),m.forEach(function(De){De.sizeTemp=De.size,De.size=[10,10]}),(0,p.default)(m,w),m.forEach(function(De){De.size=De.sizeTemp||[],delete De.sizeTemp}),(0,v.default)({nodes:m,edges:w},T),Q()})});return ee}x.default=f},28563:function(dt,x,M){"use strict";var S=this&&this.__importDefault||function(E){return E&&E.__esModule?E:{default:E}};Object.defineProperty(x,"__esModule",{value:!0});var B=S(M(62120));function N(E,I){if(!E.nodes||E.nodes.length===0)return E;var A=I.width,v=I.height,p=I.nodeMinGap,c=1e4,f=1e4;E.nodes.forEach(function(Z){var J=Z.size[0]||50,ee=Z.size[1]||50;c=Math.min(J,c),f=Math.min(ee,f)});var l=new B.default;l.init(A,v,{CELL_H:f,CELL_W:c}),E.nodes.forEach(function(Z){var J=l.occupyNearest(Z);J&&(J.node={id:Z.id,size:Z.size},Z.x=J.x,Z.y=J.y,Z.dx=J.dx,Z.dy=J.dy)});for(var T=0;T<E.nodes.length;T++){var m=E.nodes[T],w=l.findGridByNodeId(m.id);if(!w)throw new Error("can not find node cell");var O=w.column,D=w.row;if(m.size[0]+p>c){for(var g=Math.ceil((m.size[0]+p)/c)-1,_=g,Y=0;Y<g;Y++){var V=l.additionColumn.indexOf(O+Y+1)>-1;if(V&&!l.cells[O+Y+1][D].node)_--;else break}l.insertColumn(O,_)}if(m.size[1]+p>f){for(var g=Math.ceil((m.size[1]+p)/f)-1,_=g,Y=0;Y<g;Y++){var V=l.additionRow.indexOf(D+Y+1)>-1;if(V&&!l.cells[O][D+Y+1].node)_--;else break}l.insertRow(D,_)}}for(var T=0;T<l.columnNum;T++)for(var z=function(J){var ee=l.cells[T][J];if(ee.node){var Q=E.nodes.find(function(re){var fe;return re.id===((fe=ee==null?void 0:ee.node)===null||fe===void 0?void 0:fe.id)});Q&&(Q.x=ee.x+Q.size[0]/2,Q.y=ee.y+Q.size[1]/2)}},Y=0;Y<l.rowNum;Y++)z(Y)}x.default=N},62120:function(dt,x){"use strict";var M=this&&this.__assign||function(){return M=Object.assign||function(B){for(var N,E=1,I=arguments.length;E<I;E++){N=arguments[E];for(var A in N)Object.prototype.hasOwnProperty.call(N,A)&&(B[A]=N[A])}return B},M.apply(this,arguments)};Object.defineProperty(x,"__esModule",{value:!0});var S=function(){function B(){this.cells=[],this.columnNum=0,this.rowNum=0,this.additionColumn=[],this.additionRow=[]}return B.prototype.init=function(N,E,I){this.cells=[],this.CELL_W=I.CELL_W||B.DEFAULT_CELL_W,this.CELL_H=I.CELL_H||B.DEFAULT_CELL_H,this.columnNum=Math.ceil(N/this.CELL_W),this.rowNum=Math.ceil(E/this.CELL_H),B.MIN_DIST=Math.pow(N,2)+Math.pow(E,2);for(var A=0;A<this.columnNum;A++){for(var v=[],p=0;p<this.rowNum;p++){var c={dx:A,dy:p,x:A*this.CELL_W,y:p*this.CELL_H,occupied:!1};v.push(c)}this.cells.push(v)}},B.prototype.findGridByNodeId=function(N){for(var E,I,A=0;A<this.columnNum;A++)for(var v=0;v<this.rowNum;v++)if(this.cells[A][v].node&&((I=(E=this.cells[A][v])===null||E===void 0?void 0:E.node)===null||I===void 0?void 0:I.id)===N)return{column:A,row:v};return null},B.prototype.sqdist=function(N,E){return Math.pow(N.x-E.x,2)+Math.pow(N.y-E.y,2)},B.prototype.occupyNearest=function(N){for(var E=B.MIN_DIST,I,A=null,v=0;v<this.columnNum;v++)for(var p=0;p<this.rowNum;p++)!this.cells[v][p].occupied&&(I=this.sqdist(N,this.cells[v][p]))<E&&(E=I,A=this.cells[v][p]);return A&&(A.occupied=!0),A},B.prototype.insertColumn=function(N,E){if(!(E<=0)){for(var I=0;I<E;I++){this.cells[I+this.columnNum]=[];for(var A=0;A<this.rowNum;A++)this.cells[I+this.columnNum][A]={dx:I,dy:A,x:I*this.CELL_W,y:A*this.CELL_H,occupied:!1,node:null}}for(var I=this.columnNum-1;I>N;I--)for(var A=0;A<this.rowNum;A++)this.cells[I+E][A]=M(M({},this.cells[I][A]),{x:(I+E)*this.CELL_W,y:A*this.CELL_H}),this.cells[I][A]={x:I*this.CELL_W,y:A*this.CELL_H,occupied:!0,node:null};for(var A=0;A<this.additionColumn.length;A++)this.additionColumn[A]>=N&&(this.additionColumn[A]+=E);for(var I=0;I<E;I++)this.additionColumn.push(N+I+1);this.columnNum+=E}},B.prototype.insertRow=function(N,E){if(!(E<=0)){for(var I=0;I<E;I++)for(var A=0;A<this.columnNum;A++)this.cells[A][I+this.rowNum]={dx:A,dy:I,x:A*this.CELL_W,y:I*this.CELL_H,occupied:!1,node:null};for(var A=0;A<this.columnNum;A++)for(var I=this.rowNum-1;I>N;I--)this.cells[A][I+E]=M(M({},this.cells[A][I]),{dx:A,dy:I+E,x:A*this.CELL_W,y:(I+E)*this.CELL_H}),this.cells[A][I]={dx:A,dy:I,x:A*this.CELL_W,y:I*this.CELL_H,occupied:!1,node:null};for(var I=0;I<this.additionRow.length;I++)this.additionRow[I]>=N&&(this.additionRow[I]+=E);for(var A=0;A<E;A++)this.additionRow.push(N+A+1);this.rowNum+=E}},B.prototype.getNodes=function(){for(var N=[],E=0;E<this.columnNum;E++)for(var I=0;I<this.rowNum;I++)this.cells[E][I].node&&N.push(this.cells[E][I]);return N},B.MIN_DIST=50,B.DEFAULT_CELL_W=80,B.DEFAULT_CELL_H=80,B}();x.default=S},40311:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var A=function(v,p){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(c[l]=f[l])},A(v,p)};return function(v,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");A(v,p);function c(){this.constructor=v}v.prototype=p===null?Object.create(p):(c.prototype=p.prototype,new c)}}(),B=this&&this.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(x,"__esModule",{value:!0}),x.ERLayout=void 0;var N=M(46253),E=B(M(29279)),I=function(A){S(v,A);function v(p){var c=A.call(this)||this;return c.width=300,c.height=300,c.nodeMinGap=50,c.onLayoutEnd=function(){},p&&c.updateCfg(p),c}return v.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},v.prototype.execute=function(){var p=this,c=p.nodes,f=p.edges;return c==null||c.forEach(function(l){l.size||(l.size=[50,50])}),(0,E.default)({nodes:c,edges:f},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then(function(){p.onLayoutEnd&&p.onLayoutEnd()})},v.prototype.getType=function(){return"er"},v}(N.Base);x.ERLayout=I},77280:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=1200,S=800,B=1e7,N=10,E=3.141592653589793,I=1.5707963267948966,A=E*.375,v=E*.625,p=new Map,c=10,f=10,l=.8,T=.1,m=.5;function w(z,Z,J){var ee=z.x-z.size[0]/2,Q=z.y-z.size[1]/2,re=z.x+z.size[0]/2,fe=z.y+z.size[1]/2,me=Z.x-Z.size[0]/2,ae=Z.y-Z.size[1]/2,Ee=Z.x+Z.size[0]/2,Le=Z.y+Z.size[1]/2,De=z.x,Ve=z.y,et=Z.x,It=Z.y,er=et-De,nr=Math.atan2(er,It-Ve),Fe=0,Vt=0,$t=0,Ar=0;nr>I?(Vt=Q-Le,Fe=me-re,$t=parseFloat(Vt?(Vt/Math.cos(nr)).toFixed(2):Fe.toFixed(2)),Ar=parseFloat(Fe?(Fe/Math.sin(nr)).toFixed(2):Vt.toFixed(2))):0<nr&&nr<=I?(Vt=ae-fe,Fe=me-re,Vt>Fe?$t=Ar=parseFloat(Vt?(Vt/Math.cos(nr)).toFixed(2):Fe.toFixed(2)):$t=Ar=parseFloat(Fe?(Fe/Math.sin(nr)).toFixed(2):Vt.toFixed(2))):nr<-I?(Vt=Q-Le,Fe=-(Ee-ee),Vt>Fe?$t=Ar=parseFloat(Vt?(Vt/Math.cos(nr)).toFixed(2):Fe.toFixed(2)):$t=Ar=parseFloat(Fe?(Fe/Math.sin(nr)).toFixed(2):Vt.toFixed(2))):(Vt=ae-fe,Math.abs(er)>(re-ee)/2?Fe=ee-Ee:Fe=er,Vt>Fe?$t=Ar=parseFloat(Vt?(Vt/Math.cos(nr)).toFixed(2):Fe.toFixed(2)):$t=Ar=parseFloat(Fe&&nr!==0?(Fe/Math.sin(nr)).toFixed(2):Vt.toFixed(2)));var ke=parseFloat(nr.toFixed(2)),Oe=J;return J&&(Oe=A<ke&&ke<v),{distance:Math.abs($t<Ar?$t:Ar),isHoriz:Oe}}function O(z,Z){var J=p.get(z.id)||[],ee=J.find(function(U){return U.source===Z.id||U.target===Z.id}),Q=z.size[0]*z.size[1],re=Z.size[0]*Z.size[1],fe=Q>re?Z:z,me=Q>re?z:Z,ae=fe.x-fe.size[0]/2,Ee=fe.y-fe.size[1]/2,Le=fe.x+fe.size[0]/2,De=fe.y+fe.size[1]/2,Ve=me.x-me.size[0]/2,et=me.y-me.size[1]/2,It=me.x+me.size[0]/2,er=me.y+me.size[1]/2,nr=fe.x,Fe=fe.y,Vt=me.x,$t=me.y,Ar=Le>=Ve&&It>=ae&&De>=et&&er>=Ee,ke=0,Oe=0;if(Ar){Oe=Math.sqrt(Math.pow(Vt-nr,2)+Math.pow($t-Fe,2));var we=ae>Ve?ae:Ve,Be=Ee>et?Ee:et,We=Le<It?Le:It,He=De<er?De:er,St=We-we,Mt=He-Be,sr=St*Mt;Oe===0&&(Oe=1e-7),ke=N*1/Oe*100+sr,ke*=B}else{var Ge=!1,ut=w(fe,me,Ge);Oe=ut.distance,Ge=ut.isHoriz,Oe<=N?Oe!==0?ee?ke+=N+B*1/Oe:ke+=N+B*N/Oe:ke+=B:(ke+=Oe,ee&&(ke+=Oe*Oe))}return ke}function D(z){for(var Z=0,J=0;J<z.length;J++){var ee=z[J];(ee.x<0||ee.y<0||ee.x>M||ee.y>S)&&(Z+=1e12);for(var Q=J+1;Q<z.length;Q++)Z+=O(ee,z[Q])}return Z}function g(z,Z,J,ee){var Q=new Map;J.forEach(function(nr,Fe){Q.set(nr.id,nr)});var re=ee.filter(function(nr){return nr.source===z.id||nr.target===z.id})||[],fe=[];re.forEach(function(nr){var Fe=nr.source===z.id?nr.target:nr.source,Vt=Q.get(Fe);Vt&&fe.push(Vt)});for(var me=!0,ae=0;ae<fe.length;ae++){var Ee=fe[ae],Le=Math.atan((z.y-Ee.y)/(Ee.x-z.y))*180,De=Math.atan((Z.y-Ee.y)/(Ee.x-Z.y))*180,Ve=Le<30||Le>150,et=De<30||De>150,It=Le>70&&Le<110,er=De>70&&De<110;if(Ve&&!et||Le*De<0){me=!1;break}else if(It&&!er||Le*De<0){me=!1;break}else if((Ee.x-z.x)*(Ee.x-Z.x)<0){me=!1;break}else if((Ee.y-z.y)*(Ee.y-Z.y)<0){me=!1;break}}return me}function _(z,Z){for(var J=!1,ee=1,Q=c*ee,re=f*ee,fe=[Q,-Q,0,0],me=[0,0,re,-re],ae=0;ae<z.length;++ae)for(var Ee=z[ae],Le=Y(Ee,z),De=0;De<fe.length;De++){var Ve=g(Ee,{x:Ee.x+fe[De],y:Ee.y+me[De]},z,Z);if(Ve){Ee.x+=fe[De],Ee.y+=me[De];var et=Y(Ee,z),It=Math.random();et<Le||It<l&&It>T?(Le=et,J=!0):(Ee.x-=fe[De],Ee.y-=me[De])}}return l>T&&(l*=m),J?D(z):0}function Y(z,Z){var J=0;(z.x<0||z.y<0||z.x+z.size[0]+20>M||z.y+z.size[1]+20>S)&&(J+=1e12);for(var ee=0;ee<Z.length;++ee)z.id!==Z[ee].id&&(J+=O(z,Z[ee]));return J}function V(z,Z){if(z.length===0)return{nodes:z,edges:Z};z.forEach(function(Ee){var Le=Z.filter(function(De){return De.source===Ee.id||De.target===Ee.id});p.set(Ee,Le)}),z.sort(function(Ee,Le){var De,Ve;return((De=p.get(Ee.id))===null||De===void 0?void 0:De.length)-((Ve=p.get(Le.id))===null||Ve===void 0?void 0:Ve.length)});for(var J=D(z),ee=20,Q=1,re=0,fe=50,me=0;ee>0&&(me++,!(me>=fe));){var ae=_(z,Z);ae!==0&&(re=ae),Q=re-J,J=re,Q===0?--ee:ee=20}return z.forEach(function(Ee){Ee.x=Ee.x-Ee.size[0]/2,Ee.y=Ee.y-Ee.size[1]/2}),{nodes:z,edges:Z}}x.default=V},26961:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.forceNBody=void 0;var S=M(71829),B=.81,N=.1;function E(p,c,f,l,T){var m=f/l,w=p.map(function(D,g){var _=c[D.id],Y=_.data,V=_.x,z=_.y,Z=_.size,J=Y.layout.force.nodeStrength;return{x:V,y:z,size:Z,index:g,vx:0,vy:0,weight:m*J}}),O=(0,S.quadtree)(w,function(D){return D.x},function(D){return D.y}).visitAfter(I);return w.forEach(function(D){v(D,O)}),w.map(function(D,g){var _=c[p[g].id],Y=_.data.layout.force.mass,V=Y===void 0?1:Y;T[2*g]=D.vx/V,T[2*g+1]=D.vy/V}),T}x.forceNBody=E;function I(p){var c=0,f=0,l=0;if(p.length){for(var T=0;T<4;T++){var m=p[T];m&&m.weight&&(c+=m.weight,f+=m.x*m.weight,l+=m.y*m.weight)}p.x=f/c,p.y=l/c,p.weight=c}else{var m=p;p.x=m.data.x,p.y=m.data.y,p.weight=m.data.weight}}var A=function(p,c,f,l,T,m){var w=m.x-p.x||N,O=m.y-p.y||N,D=l-c,g=w*w+O*O,_=Math.sqrt(g)*g;if(D*D*B<g){var Y=p.weight/_;return m.vx+=w*Y,m.vy+=O*Y,!0}if(p.length)return!1;if(p.data!==m){var Y=p.data.weight/_;m.vx+=w*Y,m.vy+=O*Y}};function v(p,c){c.visit(function(f,l,T,m,w){return A(f,l,T,m,w,p)})}},38129:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var p=function(c,f){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,T){l.__proto__=T}||function(l,T){for(var m in T)Object.prototype.hasOwnProperty.call(T,m)&&(l[m]=T[m])},p(c,f)};return function(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");p(c,f);function l(){this.constructor=c}c.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}}(),B=this&&this.__assign||function(){return B=Object.assign||function(p){for(var c,f=1,l=arguments.length;f<l;f++){c=arguments[f];for(var T in c)Object.prototype.hasOwnProperty.call(c,T)&&(p[T]=c[T])}return p},B.apply(this,arguments)};Object.defineProperty(x,"__esModule",{value:!0}),x.Force2Layout=void 0;var N=M(46253),E=M(8273),I=M(26961),A=function(p,c){var f;return p?(0,E.isNumber)(p)?f=function(l){return p}:f=p:f=function(l){return c||1},f},v=function(p){S(c,p);function c(f){var l=p.call(this)||this;l.maxIteration=1e3,l.workerEnabled=!1,l.edgeStrength=200,l.nodeStrength=1e3,l.coulombDisScale=.005,l.damping=.9,l.maxSpeed=1e3,l.minMovement=.4,l.interval=.02,l.factor=1,l.linkDistance=200,l.gravity=0,l.clusterNodeStrength=20,l.preventOverlap=!0,l.distanceThresholdMode="mean",l.tick=function(){},l.nodes=[],l.edges=[],l.width=300,l.height=300,l.nodeMap={},l.nodeIdxMap={},l.judgingDistance=0,l.centripetalOptions={leaf:2,single:2,others:1,center:function(m){return{x:l.width/2,y:l.height/2}}};var T=f.getMass;return l.propsGetMass=T,l.updateCfg(f),l}return c.prototype.getCentripetalOptions=function(){var f=this,l=f.leafCluster,T=f.clustering,m=f.nodeClusterBy,w=f.nodes,O=f.nodeMap,D=f.clusterNodeStrength,g=function(fe){return typeof D=="function"?D(fe):D},_={},Y;if(l){Y=this.getSameTypeLeafMap()||{};var V=Array.from(new Set(w==null?void 0:w.map(function(fe){return fe[m]})))||[];_={single:100,leaf:function(fe,me,ae){var Ee=Y[fe.id]||{},Le=Ee.relativeLeafNodes,De=Ee.sameTypeLeafNodes;return(De==null?void 0:De.length)===(Le==null?void 0:Le.length)||(V==null?void 0:V.length)===1?1:g(fe)},others:1,center:function(fe,me,ae){var Ee,Le=(((Ee=fe.data)===null||Ee===void 0?void 0:Ee.layout)||{}).degree;if(!Le)return{x:100,y:100};var De;if(Le===1){var Ve=(Y[fe.id]||{}).sameTypeLeafNodes,et=Ve===void 0?[]:Ve;et.length===1?De=void 0:et.length>1&&(De=(0,E.getAvgNodePosition)(et))}else De=void 0;return{x:De==null?void 0:De.x,y:De==null?void 0:De.y}}}}if(T){Y||(Y=this.getSameTypeLeafMap());var z=Array.from(new Set(w.map(function(fe,me){return fe[m]}))).filter(function(fe){return fe!==void 0}),Z={};z.forEach(function(fe){var me=w.filter(function(ae){return ae[m]===fe}).map(function(ae){return O[ae.id]});Z[fe]=(0,E.getAvgNodePosition)(me)}),_={single:function(fe){return g(fe)},leaf:function(fe){return g(fe)},others:function(fe){return g(fe)},center:function(fe,me,ae){var Ee=Z[fe[m]];return{x:Ee==null?void 0:Ee.x,y:Ee==null?void 0:Ee.y}}}}this.centripetalOptions=B(B({},this.centripetalOptions),_);var J=this.centripetalOptions,ee=J.leaf,Q=J.single,re=J.others;ee&&typeof ee!="function"&&(this.centripetalOptions.leaf=function(){return ee}),Q&&typeof Q!="function"&&(this.centripetalOptions.single=function(){return Q}),re&&typeof re!="function"&&(this.centripetalOptions.others=function(){return re})},c.prototype.updateCfg=function(f){f&&Object.assign(this,f)},c.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},c.prototype.execute=function(){var f=this;f.stop();var l=f.nodes,T=f.edges,m=f.defSpringLen;if(f.judgingDistance=0,!l||l.length===0){f.onLayoutEnd([]);return}!f.width&&typeof window!="undefined"&&(f.width=window.innerWidth),!f.height&&typeof window!="undefined"&&(f.height=window.innerHeight),f.center||(f.center=[f.width/2,f.height/2]);var w=f.center;if(l.length===1){l[0].x=w[0],l[0].y=w[1],f.onLayoutEnd([B({},l[0])]);return}f.degreesMap=(0,E.getDegreeMap)(l,T),f.propsGetMass?f.getMass=f.propsGetMass:f.getMass=function(z){var Z=1;(0,E.isNumber)(z.mass)&&(Z=z.mass);var J=f.degreesMap[z.id].all;return!J||J<5?Z:J*5*Z};var O=f.nodeSize,D;if(f.preventOverlap){var g=f.nodeSpacing,_;(0,E.isNumber)(g)?_=function(){return g}:(0,E.isFunction)(g)?_=g:_=function(){return 0},O?(0,E.isArray)(O)?D=function(z){return Math.max(O[0],O[1])+_(z)}:D=function(z){return O+_(z)}:D=function(z){return z.size?(0,E.isArray)(z.size)?Math.max(z.size[0],z.size[1])+_(z):(0,E.isObject)(z.size)?Math.max(z.size.width,z.size.height)+_(z):z.size+_(z):10+_(z)}}f.nodeSize=D,f.linkDistance=A(f.linkDistance,1),f.nodeStrength=A(f.nodeStrength,1),f.edgeStrength=A(f.edgeStrength,1);var Y={},V={};l.forEach(function(z,Z){(0,E.isNumber)(z.x)||(z.x=Math.random()*f.width),(0,E.isNumber)(z.y)||(z.y=Math.random()*f.height);var J=f.degreesMap[z.id];Y[z.id]=B(B({},z),{data:B(B({},z.data),{size:f.nodeSize(z)||30,layout:{inDegree:J.in,outDegree:J.out,degree:J.all,tDegree:J.in,sDegree:J.out,force:{mass:f.getMass(z),nodeStrength:f.nodeStrength(z)}}})}),V[z.id]=Z}),f.nodeMap=Y,f.nodeIdxMap=V,f.edgeInfos=[],T==null||T.forEach(function(z){var Z=Y[z.source],J=Y[z.target];!Z||!J?elf.edgeInfos.push({}):f.edgeInfos.push({edgeStrength:f.edgeStrength(z),linkDistance:m?m(B(B({},z),{source:Z,target:J}),Z,J):f.linkDistance(z,Z,J)||1+(O(Z)+O(Z)||0)/2})}),this.getCentripetalOptions(),f.onLayoutEnd=f.onLayoutEnd||function(){},f.run()},c.prototype.run=function(){var f=this,l=f.maxIteration,T=f.nodes,m=f.workerEnabled,w=f.minMovement,O=f.animate,D=f.nodeMap;if(!!T){var g=[];T.forEach(function(J,ee){g[2*ee]=0,g[2*ee+1]=0});var _=l,Y=!O;if(m||Y){for(var V=0,z=0;(f.judgingDistance>w||z<1)&&z<_;z++)V=z,f.runOneStep(z,g);f.onLayoutEnd(Object.values(D))}else{if(typeof window=="undefined")return;var Z=0;this.timeInterval=window.setInterval(function(){!T||(f.runOneStep(Z,g),Z++,(Z>=_||f.judgingDistance<w)&&(f.onLayoutEnd(Object.values(D)),window.clearInterval(f.timeInterval)))},0)}}},c.prototype.runOneStep=function(f,l){var T,m=this,w=m.nodes,O=m.edges,D=m.nodeMap,g=m.monitor,_=[];if(!!(w==null?void 0:w.length)){m.calRepulsive(_),O&&m.calAttractive(_),m.calGravity(_);var Y=m.interval;if(m.updateVelocity(_,l,Y),m.updatePosition(l,Y),(T=m.tick)===null||T===void 0||T.call(m),g){var V=this.calTotalEnergy(_);g({energy:V,nodes:w,edges:O,iterations:f})}}},c.prototype.calTotalEnergy=function(f){var l=this,T=l.nodes,m=l.nodeMap;if(!(T==null?void 0:T.length))return 0;var w=0;return T.forEach(function(O,D){var g=f[2*D],_=f[2*D+1],Y=g*g+_*_,V=m[O.id].data.layout.force.mass,z=V===void 0?1:V;w+=z*Y*.5}),w},c.prototype.calRepulsive=function(f){var l=this,T=l.nodes,m=l.nodeMap,w=l.factor,O=l.coulombDisScale,D=l.nodeSize;(0,I.forceNBody)(T,m,w,O*O,f)},c.prototype.calAttractive=function(f){var l=this,T=l.edges,m=l.nodeMap,w=l.nodeIdxMap,O=l.edgeInfos,D=l.nodeSize;T.forEach(function(g,_){var Y=(0,E.getEdgeTerminal)(g,"source"),V=(0,E.getEdgeTerminal)(g,"target"),z=m[Y],Z=m[V];if(!(!z||!Z)){var J=Z.x-z.x,ee=Z.y-z.y;!J&&!ee&&(J=Math.random()*.01,ee=Math.random()*.01);var Q=Math.sqrt(J*J+ee*ee),re=J/Q,fe=ee/Q,me=O[_]||{},ae=me.linkDistance,Ee=ae===void 0?200:ae,Le=me.edgeStrength,De=Le===void 0?200:Le,Ve=Ee-Q,et=Ve*De,It=z.data.layout.force.mass||1,er=Z.data.layout.force.mass||1,nr=1/It,Fe=1/er,Vt=re*et,$t=fe*et,Ar=2*w[Y],ke=2*w[V];f[Ar]-=Vt*nr,f[Ar+1]-=$t*nr,f[ke]+=Vt*Fe,f[ke+1]+=$t*Fe}})},c.prototype.calGravity=function(f){var l,T=this,m=T.nodes,w=T.edges,O=w===void 0?[]:w,D=T.nodeMap,g=T.width,_=T.height,Y=T.center,V=T.gravity,z=T.degreesMap,Z=T.centripetalOptions;if(!!m)for(var J=m.length,ee=0;ee<J;ee++){var Q=2*ee,re=D[m[ee].id],fe=re.data.layout.force.mass,me=fe===void 0?1:fe,ae=0,Ee=0,Le=V,De=z[re.id],Ve=De.in,et=De.out,It=De.all,er=(l=T.getCenter)===null||l===void 0?void 0:l.call(T,re,It);if(er){var nr=er[0],Fe=er[1],Vt=er[2];ae=re.x-nr,Ee=re.y-Fe,Le=Vt}else ae=re.x-Y[0],Ee=re.y-Y[1];if(Le&&(f[Q]-=Le*ae/me,f[Q+1]-=Le*Ee/me),Z){var $t=Z.leaf,Ar=Z.single,ke=Z.others,Oe=Z.center,we=(Oe==null?void 0:Oe(re,m,O,g,_))||{x:0,y:0,centerStrength:0},Be=we.x,We=we.y,He=we.centerStrength;if(!(0,E.isNumber)(Be)||!(0,E.isNumber)(We))continue;var St=(re.x-Be)/me,Mt=(re.y-We)/me;if(He&&(f[Q]-=He*St,f[Q+1]-=He*Mt),It===0){var sr=Ar(re);if(!sr)continue;f[Q]-=sr*St,f[Q+1]-=sr*Mt;continue}if(Ve===0||et===0){var Ge=$t(re,m,O);if(!Ge)continue;f[Q]-=Ge*St,f[Q+1]-=Ge*Mt;continue}var ut=ke(re);if(!ut)continue;f[Q]-=ut*St,f[Q+1]-=ut*Mt}}},c.prototype.updateVelocity=function(f,l,T){var m=this,w=m.nodes,O=m.damping,D=m.maxSpeed;!(w==null?void 0:w.length)||w.forEach(function(g,_){var Y=(l[2*_]+f[2*_]*T)*O||.01,V=(l[2*_+1]+f[2*_+1]*T)*O||.01,z=Math.sqrt(Y*Y+V*V);if(z>D){var Z=D/z;Y=Z*Y,V=Z*V}l[2*_]=Y,l[2*_+1]=V})},c.prototype.updatePosition=function(f,l){var T=this,m=T.nodes,w=T.distanceThresholdMode,O=T.nodeMap;if(!(m==null?void 0:m.length)){this.judgingDistance=0;return}var D=0;w==="max"?T.judgingDistance=-Infinity:w==="min"&&(T.judgingDistance=Infinity),m.forEach(function(g,_){var Y=O[g.id];if((0,E.isNumber)(g.fx)&&(0,E.isNumber)(g.fy)){g.x=g.fx,g.y=g.fy,Y.x=g.x,Y.y=g.y;return}var V=f[2*_]*l,z=f[2*_+1]*l;g.x+=V,g.y+=z,Y.x=g.x,Y.y=g.y;var Z=Math.sqrt(V*V+z*z);switch(w){case"max":T.judgingDistance<Z&&(T.judgingDistance=Z);break;case"min":T.judgingDistance>Z&&(T.judgingDistance=Z);break;default:D=D+Z;break}}),(!w||w==="mean")&&(T.judgingDistance=D/m.length)},c.prototype.stop=function(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)},c.prototype.destroy=function(){var f=this;f.stop(),f.tick=null,f.nodes=null,f.edges=null,f.destroyed=!0},c.prototype.getType=function(){return"force2"},c.prototype.getSameTypeLeafMap=function(){var f=this,l=f.nodeClusterBy,T=f.nodes,m=f.edges,w=f.nodeMap,O=f.degreesMap;if(!!(T==null?void 0:T.length)){var D={};return T.forEach(function(g,_){var Y=O[g.id].all;Y===1&&(D[g.id]=(0,E.getCoreNodeAndRelativeLeafNodes)("leaf",g,m,l,O,w))}),D}},c}(N.Base);x.Force2Layout=v},20039:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(){function S(B){this.id=B.id||0,this.rx=B.rx,this.ry=B.ry,this.fx=0,this.fy=0,this.mass=B.mass,this.degree=B.degree,this.g=B.g||0}return S.prototype.distanceTo=function(B){var N=this.rx-B.rx,E=this.ry-B.ry;return Math.hypot(N,E)},S.prototype.setPos=function(B,N){this.rx=B,this.ry=N},S.prototype.resetForce=function(){this.fx=0,this.fy=0},S.prototype.addForce=function(B){var N=B.rx-this.rx,E=B.ry-this.ry,I=Math.hypot(N,E);I=I<1e-4?1e-4:I;var A=this.g*(this.degree+1)*(B.degree+1)/I;this.fx+=A*N/I,this.fy+=A*E/I},S.prototype.in=function(B){return B.contains(this.rx,this.ry)},S.prototype.add=function(B){var N=this.mass+B.mass,E=(this.rx*this.mass+B.rx*B.mass)/N,I=(this.ry*this.mass+B.ry*B.mass)/N,A=this.degree+B.degree,v={rx:E,ry:I,mass:N,degree:A};return new S(v)},S}();x.default=M},16919:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var c=function(f,l){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,m){T.__proto__=m}||function(T,m){for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&(T[w]=m[w])},c(f,l)};return function(f,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");c(f,l);function T(){this.constructor=f}f.prototype=l===null?Object.create(l):(T.prototype=l.prototype,new T)}}(),B=this&&this.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(x,"__esModule",{value:!0}),x.ForceAtlas2Layout=void 0;var N=M(46253),E=M(8273),I=B(M(20039)),A=B(M(78150)),v=B(M(58979)),p=function(c){S(f,c);function f(l){var T=c.call(this)||this;return T.center=[0,0],T.width=300,T.height=300,T.nodes=[],T.edges=[],T.kr=5,T.kg=1,T.mode="normal",T.preventOverlap=!1,T.dissuadeHubs=!1,T.barnesHut=void 0,T.maxIteration=0,T.ks=.1,T.ksmax=10,T.tao=.1,T.onLayoutEnd=function(){},T.prune=void 0,T.updateCfg(l),T}return f.prototype.getDefaultCfg=function(){return{}},f.prototype.execute=function(){var l=this,T=l.nodes,m=l.onLayoutEnd,w=l.prune,O=l.maxIteration;!l.width&&typeof window!="undefined"&&(l.width=window.innerWidth),!l.height&&typeof window!="undefined"&&(l.height=window.innerHeight);for(var D=[],g=T.length,_=0;_<g;_+=1){var Y=T[_],V=10,z=10;(0,E.isNumber)(Y.size)&&(V=Y.size,z=Y.size),(0,E.isArray)(Y.size)?(isNaN(Y.size[0])||(V=Y.size[0]),isNaN(Y.size[1])||(z=Y.size[1])):(0,E.isObject)(Y.size)&&(V=Y.size.width,z=Y.size.height),l.getWidth&&!isNaN(l.getWidth(Y))&&(z=l.getWidth(Y)),l.getHeight&&!isNaN(l.getHeight(Y))&&(V=l.getHeight(Y));var Z=Math.max(V,z);D.push(Z)}l.barnesHut===void 0&&g>250&&(l.barnesHut=!0),l.prune===void 0&&g>100&&(l.prune=!0),this.maxIteration===0&&!l.prune?(O=250,g<=200&&g>100?O=1e3:g>200&&(O=1200),this.maxIteration=O):this.maxIteration===0&&w&&(O=100,g<=200&&g>100?O=500:g>200&&(O=950),this.maxIteration=O),l.kr||(l.kr=50,g>100&&g<=500?l.kr=20:g>500&&(l.kr=1)),l.kg||(l.kg=20,g>100&&g<=500?l.kg=10:g>500&&(l.kg=1)),this.nodes=l.updateNodesByForces(D),m()},f.prototype.updateNodesByForces=function(l){for(var T=this,m=T.edges,w=T.maxIteration,O=T.nodes,D=m.filter(function(De){var Ve=(0,E.getEdgeTerminal)(De,"source"),et=(0,E.getEdgeTerminal)(De,"target");return Ve!==et}),g=O.length,_=D.length,Y=[],V={},z={},Z=[],J=0;J<g;J+=1)V[O[J].id]=J,Y[J]=0,(O[J].x===void 0||isNaN(O[J].x))&&(O[J].x=Math.random()*1e3),(O[J].y===void 0||isNaN(O[J].y))&&(O[J].y=Math.random()*1e3),Z.push({x:O[J].x,y:O[J].y});for(var J=0;J<_;J+=1){for(var ee=void 0,Q=void 0,re=0,fe=0,me=0;me<g;me+=1){var ae=(0,E.getEdgeTerminal)(D[J],"source"),Ee=(0,E.getEdgeTerminal)(D[J],"target");O[me].id===ae?(ee=O[me],re=me):O[me].id===Ee&&(Q=O[me],fe=me),z[J]={sourceIdx:re,targetIdx:fe}}ee&&(Y[V[ee.id]]+=1),Q&&(Y[V[Q.id]]+=1)}var Le=w;if(O=this.iterate(Le,V,z,_,Y,l),T.prune){for(var me=0;me<_;me+=1)Y[z[me].sourceIdx]<=1?(O[z[me].sourceIdx].x=O[z[me].targetIdx].x,O[z[me].sourceIdx].y=O[z[me].targetIdx].y):Y[z[me].targetIdx]<=1&&(O[z[me].targetIdx].x=O[z[me].sourceIdx].x,O[z[me].targetIdx].y=O[z[me].sourceIdx].y);T.prune=!1,T.barnesHut=!1,Le=100,O=this.iterate(Le,V,z,_,Y,l)}return O},f.prototype.iterate=function(l,T,m,w,O,D){for(var g=this,_=g.nodes,Y=g.kr,V=g.preventOverlap,z=g.barnesHut,Z=_.length,J=0,ee=100,Q=l,re=50,fe=[],me=[],ae=[],Ee=0;Ee<Z;Ee+=1)if(fe[2*Ee]=0,fe[2*Ee+1]=0,z){var Le={id:Ee,rx:_[Ee].x,ry:_[Ee].y,mass:1,g:Y,degree:O[Ee]};ae[Ee]=new I.default(Le)}for(;Q>0;){for(var Ee=0;Ee<Z;Ee+=1)me[2*Ee]=fe[2*Ee],me[2*Ee+1]=fe[2*Ee+1],fe[2*Ee]=0,fe[2*Ee+1]=0;fe=this.getAttrForces(Q,re,w,T,m,O,D,fe),z&&(V&&Q>re||!V)?fe=this.getOptRepGraForces(fe,ae,O):fe=this.getRepGraForces(Q,re,fe,ee,D,O);var De=this.updatePos(fe,me,J,O);_=De.nodes,J=De.sg,Q--,g.tick&&g.tick()}return _},f.prototype.getAttrForces=function(l,T,m,w,O,D,g,_){for(var Y=this,V=Y.nodes,z=Y.preventOverlap,Z=Y.dissuadeHubs,J=Y.mode,ee=Y.prune,Q=0;Q<m;Q+=1){var re=V[O[Q].sourceIdx],fe=O[Q].sourceIdx,me=V[O[Q].targetIdx],ae=O[Q].targetIdx;if(!(ee&&(D[fe]<=1||D[ae]<=1))){var Ee=[me.x-re.x,me.y-re.y],Le=Math.hypot(Ee[0],Ee[1]);Le=Le<1e-4?1e-4:Le,Ee[0]=Ee[0]/Le,Ee[1]=Ee[1]/Le,z&&l<T&&(Le=Le-g[fe]-g[ae]);var De=Le,Ve=De;J==="linlog"&&(De=Math.log(1+Le),Ve=De),Z&&(De=Le/D[fe],Ve=Le/D[ae]),z&&l<T&&Le<=0?(De=0,Ve=0):z&&l<T&&Le>0&&(De=Le,Ve=Le),_[2*w[re.id]]+=De*Ee[0],_[2*w[me.id]]-=Ve*Ee[0],_[2*w[re.id]+1]+=De*Ee[1],_[2*w[me.id]+1]-=Ve*Ee[1]}}return _},f.prototype.getRepGraForces=function(l,T,m,w,O,D){for(var g=this,_=g.nodes,Y=g.preventOverlap,V=g.kr,z=g.kg,Z=g.center,J=g.prune,ee=_.length,Q=0;Q<ee;Q+=1){for(var re=Q+1;re<ee;re+=1)if(!(J&&(D[Q]<=1||D[re]<=1))){var fe=[_[re].x-_[Q].x,_[re].y-_[Q].y],me=Math.hypot(fe[0],fe[1]);me=me<1e-4?1e-4:me,fe[0]=fe[0]/me,fe[1]=fe[1]/me,Y&&l<T&&(me=me-O[Q]-O[re]);var ae=V*(D[Q]+1)*(D[re]+1)/me;Y&&l<T&&me<0?ae=w*(D[Q]+1)*(D[re]+1):Y&&l<T&&me===0?ae=0:Y&&l<T&&me>0&&(ae=V*(D[Q]+1)*(D[re]+1)/me),m[2*Q]-=ae*fe[0],m[2*re]+=ae*fe[0],m[2*Q+1]-=ae*fe[1],m[2*re+1]+=ae*fe[1]}var Ee=[_[Q].x-Z[0],_[Q].y-Z[1]],Le=Math.hypot(Ee[0],Ee[1]);Ee[0]=Ee[0]/Le,Ee[1]=Ee[1]/Le;var De=z*(D[Q]+1);m[2*Q]-=De*Ee[0],m[2*Q+1]-=De*Ee[1]}return m},f.prototype.getOptRepGraForces=function(l,T,m){for(var w=this,O=w.nodes,D=w.kg,g=w.center,_=w.prune,Y=O.length,V=9e10,z=-9e10,Z=9e10,J=-9e10,ee=0;ee<Y;ee+=1)_&&m[ee]<=1||(T[ee].setPos(O[ee].x,O[ee].y),O[ee].x>=z&&(z=O[ee].x),O[ee].x<=V&&(V=O[ee].x),O[ee].y>=J&&(J=O[ee].y),O[ee].y<=Z&&(Z=O[ee].y));for(var Q=Math.max(z-V,J-Z),re={xmid:(z+V)/2,ymid:(J+Z)/2,length:Q,massCenter:g,mass:Y},fe=new A.default(re),me=new v.default(fe),ee=0;ee<Y;ee+=1)_&&m[ee]<=1||T[ee].in(fe)&&me.insert(T[ee]);for(var ee=0;ee<Y;ee+=1)if(!(_&&m[ee]<=1)){T[ee].resetForce(),me.updateForce(T[ee]),l[2*ee]-=T[ee].fx,l[2*ee+1]-=T[ee].fy;var ae=[O[ee].x-g[0],O[ee].y-g[1]],Ee=Math.hypot(ae[0],ae[1]);Ee=Ee<1e-4?1e-4:Ee,ae[0]=ae[0]/Ee,ae[1]=ae[1]/Ee;var Le=D*(m[ee]+1);l[2*ee]-=Le*ae[0],l[2*ee+1]-=Le*ae[1]}return l},f.prototype.updatePos=function(l,T,m,w){for(var O=this,D=O.nodes,g=O.ks,_=O.tao,Y=O.prune,V=O.ksmax,z=D.length,Z=[],J=[],ee=0,Q=0,re=0;re<z;re+=1)if(!(Y&&w[re]<=1)){var fe=[l[2*re]-T[2*re],l[2*re+1]-T[2*re+1]],me=Math.hypot(fe[0],fe[1]),ae=[l[2*re]+T[2*re],l[2*re+1]+T[2*re+1]],Ee=Math.hypot(ae[0],ae[1]);Z[re]=me,J[re]=Ee/2,ee+=(w[re]+1)*Z[re],Q+=(w[re]+1)*J[re]}var Le=m;m=_*Q/ee,Le!==0&&(m=m>1.5*Le?1.5*Le:m);for(var re=0;re<z;re+=1)if(!(Y&&w[re]<=1)&&!((0,E.isNumber)(D[re].fx)&&(0,E.isNumber)(D[re].fy))){var De=g*m/(1+m*Math.sqrt(Z[re])),Ve=Math.hypot(l[2*re],l[2*re+1]);Ve=Ve<1e-4?1e-4:Ve;var et=V/Ve;De=De>et?et:De;var It=De*l[2*re],er=De*l[2*re+1];D[re].x+=It,D[re].y+=er}return{nodes:D,sg:m}},f}(N.Base);x.ForceAtlas2Layout=p},78150:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(){function S(B){this.xmid=B.xmid,this.ymid=B.ymid,this.length=B.length,this.massCenter=B.massCenter||[0,0],this.mass=B.mass||1}return S.prototype.getLength=function(){return this.length},S.prototype.contains=function(B,N){var E=this.length/2;return B<=this.xmid+E&&B>=this.xmid-E&&N<=this.ymid+E&&N>=this.ymid-E},S.prototype.NW=function(){var B=this.xmid-this.length/4,N=this.ymid+this.length/4,E=this.length/2,I={xmid:B,ymid:N,length:E},A=new S(I);return A},S.prototype.NE=function(){var B=this.xmid+this.length/4,N=this.ymid+this.length/4,E=this.length/2,I={xmid:B,ymid:N,length:E},A=new S(I);return A},S.prototype.SW=function(){var B=this.xmid-this.length/4,N=this.ymid-this.length/4,E=this.length/2,I={xmid:B,ymid:N,length:E},A=new S(I);return A},S.prototype.SE=function(){var B=this.xmid+this.length/4,N=this.ymid-this.length/4,E=this.length/2,I={xmid:B,ymid:N,length:E},A=new S(I);return A},S}();x.default=M},58979:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=function(){function S(B){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,B!=null&&(this.quad=B)}return S.prototype.insert=function(B){if(this.body==null){this.body=B;return}this._isExternal()?(this.quad&&(this.NW=new S(this.quad.NW()),this.NE=new S(this.quad.NE()),this.SW=new S(this.quad.SW()),this.SE=new S(this.quad.SE())),this._putBody(this.body),this._putBody(B),this.body=this.body.add(B)):(this.body=this.body.add(B),this._putBody(B))},S.prototype._putBody=function(B){!this.quad||(B.in(this.quad.NW())&&this.NW?this.NW.insert(B):B.in(this.quad.NE())&&this.NE?this.NE.insert(B):B.in(this.quad.SW())&&this.SW?this.SW.insert(B):B.in(this.quad.SE())&&this.SE&&this.SE.insert(B))},S.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},S.prototype.updateForce=function(B){if(!(this.body==null||B===this.body))if(this._isExternal())B.addForce(this.body);else{var N=this.quad?this.quad.getLength():0,E=this.body.distanceTo(B);N/E<this.theta?B.addForce(this.body):(this.NW&&this.NW.updateForce(B),this.NE&&this.NE.updateForce(B),this.SW&&this.SW.updateForce(B),this.SE&&this.SE.updateForce(B))}},S}();x.default=M},92681:function(dt,x,M){"use strict";var S=this&&this.__createBinding||(Object.create?function(v,p,c,f){f===void 0&&(f=c);var l=Object.getOwnPropertyDescriptor(p,c);(!l||("get"in l?!p.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return p[c]}}),Object.defineProperty(v,f,l)}:function(v,p,c,f){f===void 0&&(f=c),v[f]=p[c]}),B=this&&this.__setModuleDefault||(Object.create?function(v,p){Object.defineProperty(v,"default",{enumerable:!0,value:p})}:function(v,p){v.default=p}),N=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var p={};if(v!=null)for(var c in v)c!=="default"&&Object.prototype.hasOwnProperty.call(v,c)&&S(p,v,c);return B(p,v),p};Object.defineProperty(x,"__esModule",{value:!0});var E=N(M(41685)),I=M(8273);function A(){function v(He){return function(){return He}}var p=function(He){return He.cluster},c=v(1),f=v(-1),l=v(100),T=v(.1),m=[0,0],w=[],O={},D=[],g=100,_=100,Y={none:{x:0,y:0}},V=[],z,Z="force",J=!0,ee=.1;function Q(He){if(!J)return Q;z.tick(),Le();for(var St=0,Mt=w.length,sr=void 0,Ge=He*ee;St<Mt;++St)sr=w[St],sr.vx+=(Y[p(sr)].x-sr.x)*Ge,sr.vy+=(Y[p(sr)].y-sr.y)*Ge}function re(){!w||fe()}function fe(){if(!(!w||!w.length)){if(p(w[0])===void 0)throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy('clusterAttr') before calling .links()");var He=me();z=E.forceSimulation(He.nodes).force("x",E.forceX(g).strength(.1)).force("y",E.forceY(_).strength(.1)).force("collide",E.forceCollide(function(St){return St.r}).iterations(4)).force("charge",E.forceManyBody().strength(f)).force("links",E.forceLink(He.nodes.length?He.links:[]).distance(l).strength(T)),V=z.nodes(),Le()}}function me(){var He=[],St=[],Mt={},sr=[],Ge={},ut=[];return Ge=ae(w),ut=Ee(D),sr=Object.keys(Ge),sr.forEach(function(U,he){var Qe=Ge[U];He.push({id:U,size:Qe.count,r:Math.sqrt(Qe.sumforceNodeSize/Math.PI)}),Mt[U]=he}),ut.forEach(function(U){var he=(0,I.getEdgeTerminal)(U,"source"),Qe=(0,I.getEdgeTerminal)(U,"target"),le=Mt[he],ct=Mt[Qe];le!==void 0&&ct!==void 0&&St.push({source:le,target:ct,count:U.count})}),{nodes:He,links:St}}function ae(He){var St={};return He.forEach(function(Mt){var sr=p(Mt);St[sr]||(St[sr]={count:0,sumforceNodeSize:0})}),He.forEach(function(Mt){var sr=p(Mt),Ge=c(Mt),ut=St[sr];ut.count=ut.count+1,ut.sumforceNodeSize=ut.sumforceNodeSize+Math.PI*(Ge*Ge)*1.3,St[sr]=ut}),St}function Ee(He){var St={},Mt=[];He.forEach(function(Ge){var ut=De(Ge),U=0;St[ut]!==void 0&&(U=St[ut]),U+=1,St[ut]=U});var sr=Object.entries(St);return sr.forEach(function(Ge){var ut=Ge[0],U=Ge[1],he=ut.split("~")[0],Qe=ut.split("~")[1];he!==void 0&&Qe!==void 0&&Mt.push({source:he,target:Qe,count:U})}),Mt}function Le(){return Y={none:{x:0,y:0}},V.forEach(function(He){Y[He.id]={x:He.x-m[0],y:He.y-m[1]}}),Y}function De(He){var St=(0,I.getEdgeTerminal)(He,"source"),Mt=(0,I.getEdgeTerminal)(He,"target"),sr=p(O[St]),Ge=p(O[Mt]);return sr<=Ge?"".concat(sr,"~").concat(Ge):"".concat(Ge,"~").concat(sr)}function Ve(He){O={},He.forEach(function(St){O[St.id]=St})}function et(He){return arguments.length?(Z=He,re(),Q):Z}function It(He){return arguments.length?typeof He=="string"?(p=function(St){return St[He]},Q):(p=He,Q):p}function er(He){return arguments.length?(J=He,Q):J}function nr(He){return arguments.length?(ee=He,Q):ee}function Fe(He){return arguments.length?(g=He,Q):g}function Vt(He){return arguments.length?(_=He,Q):_}function $t(He){return arguments.length?(Ve(He||[]),w=He||[],Q):w}function Ar(He){return arguments.length?(D=He||[],re(),Q):D}function ke(He){return arguments.length?(typeof He=="function"?c=He:c=v(+He),re(),Q):c}function Oe(He){return arguments.length?(typeof He=="function"?f=He:f=v(+He),re(),Q):f}function we(He){return arguments.length?(typeof He=="function"?l=He:l=v(+He),re(),Q):l}function Be(He){return arguments.length?(typeof He=="function"?T=He:T=v(+He),re(),Q):T}function We(He){return arguments.length?(m=He,Q):m}return Q.initialize=function(He){w=He,re()},Q.template=et,Q.groupBy=It,Q.enableGrouping=er,Q.strength=nr,Q.centerX=Fe,Q.centerY=Vt,Q.nodes=$t,Q.links=Ar,Q.forceNodeSize=ke,Q.nodeSize=Q.forceNodeSize,Q.forceCharge=Oe,Q.forceLinkDistance=we,Q.forceLinkStrength=Be,Q.offset=We,Q.getFocis=Le,Q}x.default=A},68553:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var w=function(O,D){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,_){g.__proto__=_}||function(g,_){for(var Y in _)Object.prototype.hasOwnProperty.call(_,Y)&&(g[Y]=_[Y])},w(O,D)};return function(O,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");w(O,D);function g(){this.constructor=O}O.prototype=D===null?Object.create(D):(g.prototype=D.prototype,new g)}}(),B=this&&this.__createBinding||(Object.create?function(w,O,D,g){g===void 0&&(g=D);var _=Object.getOwnPropertyDescriptor(O,D);(!_||("get"in _?!O.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return O[D]}}),Object.defineProperty(w,g,_)}:function(w,O,D,g){g===void 0&&(g=D),w[g]=O[D]}),N=this&&this.__setModuleDefault||(Object.create?function(w,O){Object.defineProperty(w,"default",{enumerable:!0,value:O})}:function(w,O){w.default=O}),E=this&&this.__importStar||function(w){if(w&&w.__esModule)return w;var O={};if(w!=null)for(var D in w)D!=="default"&&Object.prototype.hasOwnProperty.call(w,D)&&B(O,w,D);return N(O,w),O},I=this&&this.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(x,"__esModule",{value:!0}),x.ForceLayout=void 0;var A=E(M(41685)),v=I(M(92681)),p=M(8273),c=M(46253),f=M(24979),l=function(w){S(O,w);function O(D){var g=w.call(this)||this;return g.center=[0,0],g.nodeStrength=null,g.edgeStrength=null,g.preventOverlap=!1,g.clusterNodeStrength=null,g.clusterEdgeStrength=null,g.clusterEdgeDistance=null,g.clusterNodeSize=null,g.clusterFociStrength=null,g.linkDistance=50,g.alphaDecay=.028,g.alphaMin=.001,g.alpha=.3,g.collideStrength=1,g.workerEnabled=!1,g.tick=function(){},g.onLayoutEnd=function(){},g.ticking=void 0,D&&g.updateCfg(D),g}return O.prototype.getDefaultCfg=function(){return{center:[0,0],nodeStrength:null,edgeStrength:null,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,linkDistance:50,forceSimulation:null,alphaDecay:.028,alphaMin:.001,alpha:.3,collideStrength:1,clustering:!1,clusterNodeStrength:-1,clusterEdgeStrength:.1,clusterEdgeDistance:100,clusterFociStrength:.8,clusterNodeSize:10,tick:function(){},onLayoutEnd:function(){},workerEnabled:!1}},O.prototype.init=function(D){var g=this;g.nodes=D.nodes||[];var _=D.edges||[];g.edges=_.map(function(Y){var V={},z=["targetNode","sourceNode","startPoint","endPoint"];return Object.keys(Y).forEach(function(Z){z.indexOf(Z)>-1||(V[Z]=Y[Z])}),V}),g.ticking=!1},O.prototype.execute=function(D){var g=this,_=g.nodes,Y=g.edges;if(!g.ticking){var V=g.forceSimulation,z=g.alphaMin,Z=g.alphaDecay,J=g.alpha;if(V){if(D){if(g.clustering&&g.clusterForce&&(g.clusterForce.nodes(_),g.clusterForce.links(Y)),V.nodes(_),Y&&g.edgeForce)g.edgeForce.links(Y);else if(Y&&!g.edgeForce){var re=A.forceLink().id(function(Ee){return Ee.id}).links(Y);g.edgeStrength&&re.strength(g.edgeStrength),g.linkDistance&&re.distance(g.linkDistance),g.edgeForce=re,V.force("link",re)}}g.preventOverlap&&g.overlapProcess(V),V.alpha(J).restart(),this.ticking=!0}else try{var ee=A.forceManyBody();if(g.nodeStrength&&ee.strength(g.nodeStrength),V=A.forceSimulation().nodes(_),g.clustering){var Q=(0,v.default)();Q.centerX(g.center[0]).centerY(g.center[1]).template("force").strength(g.clusterFociStrength),Y&&Q.links(Y),_&&Q.nodes(_),Q.forceLinkDistance(g.clusterEdgeDistance).forceLinkStrength(g.clusterEdgeStrength).forceCharge(g.clusterNodeStrength).forceNodeSize(g.clusterNodeSize),g.clusterForce=Q,V.force("group",Q)}if(V.force("center",A.forceCenter(g.center[0],g.center[1])).force("charge",ee).alpha(J).alphaDecay(Z).alphaMin(z),g.preventOverlap&&g.overlapProcess(V),Y){var re=A.forceLink().id(function(ae){return ae.id}).links(Y);g.edgeStrength&&re.strength(g.edgeStrength),g.linkDistance&&re.distance(g.linkDistance),g.edgeForce=re,V.force("link",re)}if(g.workerEnabled&&!m()&&(g.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),!g.workerEnabled)V.on("tick",function(){g.tick()}).on("end",function(){g.ticking=!1,g.onLayoutEnd&&g.onLayoutEnd()}),g.ticking=!0;else{V.stop();for(var fe=T(V),me=1;me<=fe;me++)V.tick(),postMessage({nodes:_,currentTick:me,totalTicks:fe,type:f.LAYOUT_MESSAGE.TICK},void 0);g.ticking=!1}g.forceSimulation=V,g.ticking=!0}catch(ae){g.ticking=!1,console.warn(ae)}}},O.prototype.overlapProcess=function(D){var g=this,_=g.nodeSize,Y=g.nodeSpacing,V,z,Z=g.collideStrength;if((0,p.isNumber)(Y)?z=function(){return Y}:(0,p.isFunction)(Y)?z=Y:z=function(){return 0},!_)V=function(re){if(re.size){if((0,p.isArray)(re.size)){var fe=re.size[0]>re.size[1]?re.size[0]:re.size[1];return fe/2+z(re)}if((0,p.isObject)(re.size)){var fe=re.size.width>re.size.height?re.size.width:re.size.height;return fe/2+z(re)}return re.size/2+z(re)}return 10+z(re)};else if((0,p.isFunction)(_))V=function(re){var fe=_(re);return fe+z(re)};else if((0,p.isArray)(_)){var J=_[0]>_[1]?_[0]:_[1],ee=J/2;V=function(re){return ee+z(re)}}else if((0,p.isNumber)(_)){var Q=_/2;V=function(re){return Q+z(re)}}else V=function(){return 10};D.force("collisionForce",A.forceCollide(V).strength(Z))},O.prototype.updateCfg=function(D){var g=this;g.ticking&&(g.forceSimulation.stop(),g.ticking=!1),g.forceSimulation=null,Object.assign(g,D)},O.prototype.destroy=function(){var D=this;D.ticking&&(D.forceSimulation.stop(),D.ticking=!1),D.nodes=null,D.edges=null,D.destroyed=!0},O}(c.Base);x.ForceLayout=l;function T(w){var O=w.alphaMin(),D=w.alphaTarget(),g=w.alpha(),_=Math.log((O-D)/(g-D))/Math.log(1-w.alphaDecay()),Y=Math.ceil(_);return Y}function m(){return typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope}},64180:function(dt,x,M){"use strict";var S=this&&this.__createBinding||(Object.create?function(N,E,I,A){A===void 0&&(A=I);var v=Object.getOwnPropertyDescriptor(E,I);(!v||("get"in v?!E.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return E[I]}}),Object.defineProperty(N,A,v)}:function(N,E,I,A){A===void 0&&(A=I),N[A]=E[I]}),B=this&&this.__exportStar||function(N,E){for(var I in N)I!=="default"&&!Object.prototype.hasOwnProperty.call(E,I)&&S(E,N,I)};Object.defineProperty(x,"__esModule",{value:!0}),B(M(68553),x)},23826:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var A=function(v,p){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(c[l]=f[l])},A(v,p)};return function(v,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");A(v,p);function c(){this.constructor=v}v.prototype=p===null?Object.create(p):(c.prototype=p.prototype,new c)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.FruchtermanLayout=void 0;var B=M(46253),N=M(8273),E=800,I=function(A){S(v,A);function v(p){var c=A.call(this)||this;return c.maxIteration=1e3,c.workerEnabled=!1,c.gravity=10,c.speed=5,c.clustering=!1,c.clusterGravity=10,c.nodes=[],c.edges=[],c.width=300,c.height=300,c.nodeMap={},c.nodeIdxMap={},c.onLayoutEnd=function(){},c.tick=function(){},c.animate=!0,c.updateCfg(p),c}return v.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},v.prototype.execute=function(){var p=this,c,f,l=this,T=l.nodes;if(l.timeInterval!==void 0&&typeof window!="undefined"&&window.clearInterval(l.timeInterval),!T||T.length===0){(c=l.onLayoutEnd)===null||c===void 0||c.call(l);return}!l.width&&typeof window!="undefined"&&(l.width=window.innerWidth),!l.height&&typeof window!="undefined"&&(l.height=window.innerHeight),l.center||(l.center=[l.width/2,l.height/2]);var m=l.center;if(T.length===1){T[0].x=m[0],T[0].y=m[1],(f=l.onLayoutEnd)===null||f===void 0||f.call(l);return}var w={},O={};return T.forEach(function(D,g){(0,N.isNumber)(D.x)||(D.x=Math.random()*p.width),(0,N.isNumber)(D.y)||(D.y=Math.random()*p.height),w[D.id]=D,O[D.id]=g}),l.nodeMap=w,l.nodeIdxMap=O,l.run()},v.prototype.run=function(){var p,c=this,f=c.nodes;if(!!f){var l=c.edges,T=c.maxIteration,m=c.workerEnabled,w=c.clustering,O=c.animate,D={};if(w&&f.forEach(function(Y){D[Y.cluster]===void 0&&(D[Y.cluster]={name:Y.cluster,cx:0,cy:0,count:0})}),m||!O){for(var g=0;g<T;g++)c.runOneStep(D);(p=c.onLayoutEnd)===null||p===void 0||p.call(c)}else{if(typeof window=="undefined")return;var _=0;this.timeInterval=window.setInterval(function(){var Y;c.runOneStep(D),_++,_>=T&&((Y=c.onLayoutEnd)===null||Y===void 0||Y.call(c),window.clearInterval(c.timeInterval))},0)}return{nodes:f,edges:l}}},v.prototype.runOneStep=function(p){var c,f=this,l=f.nodes;if(!!l){var T=f.edges,m=f.center,w=f.gravity,O=f.speed,D=f.clustering,g=f.height*f.width,_=Math.sqrt(g)/10,Y=g/(l.length+1),V=Math.sqrt(Y),z=[];if(l.forEach(function(ee,Q){z[Q]={x:0,y:0}}),f.applyCalculate(l,T,z,V,Y),D){for(var Z in p)p[Z].cx=0,p[Z].cy=0,p[Z].count=0;l.forEach(function(ee){var Q=p[ee.cluster];(0,N.isNumber)(ee.x)&&(Q.cx+=ee.x),(0,N.isNumber)(ee.y)&&(Q.cy+=ee.y),Q.count++});for(var Z in p)p[Z].cx/=p[Z].count,p[Z].cy/=p[Z].count;var J=f.clusterGravity||w;l.forEach(function(ee,Q){if(!(!(0,N.isNumber)(ee.x)||!(0,N.isNumber)(ee.y))){var re=p[ee.cluster],fe=Math.sqrt((ee.x-re.cx)*(ee.x-re.cx)+(ee.y-re.cy)*(ee.y-re.cy)),me=V*J;z[Q].x-=me*(ee.x-re.cx)/fe,z[Q].y-=me*(ee.y-re.cy)/fe}})}l.forEach(function(ee,Q){if(!(!(0,N.isNumber)(ee.x)||!(0,N.isNumber)(ee.y))){var re=.01*V*w;z[Q].x-=re*(ee.x-m[0]),z[Q].y-=re*(ee.y-m[1])}}),l.forEach(function(ee,Q){if((0,N.isNumber)(ee.fx)&&(0,N.isNumber)(ee.fy)){ee.x=ee.fx,ee.y=ee.fy;return}if(!(!(0,N.isNumber)(ee.x)||!(0,N.isNumber)(ee.y))){var re=Math.sqrt(z[Q].x*z[Q].x+z[Q].y*z[Q].y);if(re>0){var fe=Math.min(_*(O/E),re);ee.x+=z[Q].x/re*fe,ee.y+=z[Q].y/re*fe}}}),(c=f.tick)===null||c===void 0||c.call(f)}},v.prototype.applyCalculate=function(p,c,f,l,T){var m=this;m.calRepulsive(p,f,T),c&&m.calAttractive(c,f,l)},v.prototype.calRepulsive=function(p,c,f){p.forEach(function(l,T){c[T]={x:0,y:0},p.forEach(function(m,w){if(T!==w&&!(!(0,N.isNumber)(l.x)||!(0,N.isNumber)(m.x)||!(0,N.isNumber)(l.y)||!(0,N.isNumber)(m.y))){var O=l.x-m.x,D=l.y-m.y,g=O*O+D*D;if(g===0){g=1;var _=T>w?1:-1;O=.01*_,D=.01*_}var Y=f/g;c[T].x+=O*Y,c[T].y+=D*Y}})})},v.prototype.calAttractive=function(p,c,f){var l=this;p.forEach(function(T){var m=(0,N.getEdgeTerminal)(T,"source"),w=(0,N.getEdgeTerminal)(T,"target");if(!(!m||!w)){var O=l.nodeIdxMap[m],D=l.nodeIdxMap[w];if(O!==D){var g=l.nodeMap[m],_=l.nodeMap[w];if(!(!(0,N.isNumber)(_.x)||!(0,N.isNumber)(g.x)||!(0,N.isNumber)(_.y)||!(0,N.isNumber)(g.y))){var Y=_.x-g.x,V=_.y-g.y,z=Math.sqrt(Y*Y+V*V),Z=z*z/f;c[D].x-=Y/z*Z,c[D].y-=V/z*Z,c[O].x+=Y/z*Z,c[O].y+=V/z*Z}}}})},v.prototype.stop=function(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)},v.prototype.destroy=function(){var p=this;p.stop(),p.tick=null,p.nodes=null,p.edges=null,p.destroyed=!0},v.prototype.getType=function(){return"fruchterman"},v}(B.Base);x.FruchtermanLayout=I},46260:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var A=function(v,p){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(c[l]=f[l])},A(v,p)};return function(v,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");A(v,p);function c(){this.constructor=v}v.prototype=p===null?Object.create(p):(c.prototype=p.prototype,new c)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.GForceLayout=void 0;var B=M(46253),N=M(8273),E=function(A,v){var p;return A?(0,N.isNumber)(A)?p=function(c){return A}:p=A:p=function(c){return v||1},p},I=function(A){S(v,A);function v(p){var c=A.call(this)||this;return c.maxIteration=500,c.workerEnabled=!1,c.edgeStrength=200,c.nodeStrength=1e3,c.coulombDisScale=.005,c.damping=.9,c.maxSpeed=1e3,c.minMovement=.5,c.interval=.02,c.factor=1,c.linkDistance=1,c.gravity=10,c.preventOverlap=!0,c.collideStrength=1,c.tick=function(){},c.nodes=[],c.edges=[],c.width=300,c.height=300,c.nodeMap={},c.nodeIdxMap={},c.animate=!0,c.updateCfg(p),c}return v.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},v.prototype.execute=function(){var p,c,f=this,l=f.nodes;if(f.timeInterval!==void 0&&typeof window!="undefined"&&window.clearInterval(f.timeInterval),!l||l.length===0){(p=f.onLayoutEnd)===null||p===void 0||p.call(f);return}!f.width&&typeof window!="undefined"&&(f.width=window.innerWidth),!f.height&&typeof window!="undefined"&&(f.height=window.innerHeight),f.center||(f.center=[f.width/2,f.height/2]);var T=f.center;if(l.length===1){l[0].x=T[0],l[0].y=T[1],(c=f.onLayoutEnd)===null||c===void 0||c.call(f);return}var m={},w={};l.forEach(function(V,z){(0,N.isNumber)(V.x)||(V.x=Math.random()*f.width),(0,N.isNumber)(V.y)||(V.y=Math.random()*f.height),m[V.id]=V,w[V.id]=z}),f.nodeMap=m,f.nodeIdxMap=w,f.linkDistance=E(f.linkDistance,1),f.nodeStrength=E(f.nodeStrength,1),f.edgeStrength=E(f.edgeStrength,1);var O=f.nodeSize,D;if(f.preventOverlap){var g=f.nodeSpacing,_;(0,N.isNumber)(g)?_=function(){return g}:(0,N.isFunction)(g)?_=g:_=function(){return 0},O?(0,N.isArray)(O)?D=function(V){return Math.max(O[0],O[1])+_(V)}:D=function(V){return O+_(V)}:D=function(V){return V.size?(0,N.isArray)(V.size)?Math.max(V.size[0],V.size[1])+_(V):(0,N.isObject)(V.size)?Math.max(V.size.width,V.size.height)+_(V):V.size+_(V):10+_(V)}}f.nodeSize=D;var Y=f.edges;f.degrees=(0,N.getDegree)(l.length,f.nodeIdxMap,Y),f.getMass||(f.getMass=function(V){var z=V.mass||f.degrees[f.nodeIdxMap[V.id]].all||1;return z}),f.run()},v.prototype.run=function(){var p,c=this,f=c.maxIteration,l=c.nodes,T=c.workerEnabled,m=c.minMovement,w=c.animate;if(!!l)if(T||!w){for(var O=0;O<f;O++){var D=c.runOneStep(O);if(c.reachMoveThreshold(l,D,m))break}(p=c.onLayoutEnd)===null||p===void 0||p.call(c)}else{if(typeof window=="undefined")return;var g=0;this.timeInterval=window.setInterval(function(){var _,Y;if(!!l){var V=c.runOneStep(g)||[];c.reachMoveThreshold(l,V,m)&&((_=c.onLayoutEnd)===null||_===void 0||_.call(c),window.clearInterval(c.timeInterval)),g++,g>=f&&((Y=c.onLayoutEnd)===null||Y===void 0||Y.call(c),window.clearInterval(c.timeInterval))}},0)}},v.prototype.reachMoveThreshold=function(p,c,f){var l=0;return p.forEach(function(T,m){var w=T.x-c[m].x,O=T.y-c[m].y;l+=Math.sqrt(w*w+O*O)}),l/=p.length,l<f},v.prototype.runOneStep=function(p){var c,f=this,l=f.nodes,T=f.edges,m=[],w=[];if(!!l){l.forEach(function(g,_){m[2*_]=0,m[2*_+1]=0,w[2*_]=0,w[2*_+1]=0}),f.calRepulsive(m,l),T&&f.calAttractive(m,T),f.calGravity(m,l);var O=Math.max(.02,f.interval-p*.002);f.updateVelocity(m,w,O,l);var D=[];return l.forEach(function(g){D.push({x:g.x,y:g.y})}),f.updatePosition(w,O,l),(c=f.tick)===null||c===void 0||c.call(f),D}},v.prototype.calRepulsive=function(p,c){var f=this,l=f.getMass,T=f.factor,m=f.coulombDisScale,w=f.preventOverlap,O=f.collideStrength,D=O===void 0?1:O,g=f.nodeStrength,_=f.nodeSize;c.forEach(function(Y,V){var z=l?l(Y):1;c.forEach(function(Z,J){if(!(V>=J)){var ee=Y.x-Z.x,Q=Y.y-Z.y;ee===0&&Q===0&&(ee=Math.random()*.01,Q=Math.random()*.01);var re=ee*ee+Q*Q,fe=Math.sqrt(re),me=(fe+.1)*m,ae=ee/fe,Ee=Q/fe,Le=(g(Y)+g(Z))*.5*T/(me*me),De=l?l(Z):1;if(p[2*V]+=ae*Le,p[2*V+1]+=Ee*Le,p[2*J]-=ae*Le,p[2*J+1]-=Ee*Le,w&&(_(Y)+_(Z))/2>fe){var Ve=D*(g(Y)+g(Z))*.5/re;p[2*V]+=ae*Ve/z,p[2*V+1]+=Ee*Ve/z,p[2*J]-=ae*Ve/De,p[2*J+1]-=Ee*Ve/De}}})})},v.prototype.calAttractive=function(p,c){var f=this,l=f.nodeMap,T=f.nodeIdxMap,m=f.linkDistance,w=f.edgeStrength,O=f.nodeSize,D=f.getMass;c.forEach(function(g,_){var Y=(0,N.getEdgeTerminal)(g,"source"),V=(0,N.getEdgeTerminal)(g,"target"),z=l[Y],Z=l[V],J=Z.x-z.x,ee=Z.y-z.y;J===0&&ee===0&&(J=Math.random()*.01,ee=Math.random()*.01);var Q=Math.sqrt(J*J+ee*ee),re=J/Q,fe=ee/Q,me=m(g,z,Z)||1+(O(z)+O(z)||0)/2,ae=me-Q,Ee=ae*w(g),Le=T[Y],De=T[V],Ve=D?D(z):1,et=D?D(Z):1;p[2*Le]-=re*Ee/Ve,p[2*Le+1]-=fe*Ee/Ve,p[2*De]+=re*Ee/et,p[2*De+1]+=fe*Ee/et})},v.prototype.calGravity=function(p,c){for(var f=this,l=f.center,T=f.gravity,m=f.degrees,w=c.length,O=0;O<w;O++){var D=c[O],g=D.x-l[0],_=D.y-l[1],Y=T;if(f.getCenter){var V=f.getCenter(D,m[O].all);V&&(0,N.isNumber)(V[0])&&(0,N.isNumber)(V[1])&&(0,N.isNumber)(V[2])&&(g=D.x-V[0],_=D.y-V[1],Y=V[2])}!Y||(p[2*O]-=Y*g,p[2*O+1]-=Y*_)}},v.prototype.updateVelocity=function(p,c,f,l){var T=this,m=f*T.damping;l.forEach(function(w,O){var D=p[2*O]*m||.01,g=p[2*O+1]*m||.01,_=Math.sqrt(D*D+g*g);if(_>T.maxSpeed){var Y=T.maxSpeed/_;D=Y*D,g=Y*g}c[2*O]=D,c[2*O+1]=g})},v.prototype.updatePosition=function(p,c,f){f.forEach(function(l,T){if((0,N.isNumber)(l.fx)&&(0,N.isNumber)(l.fy)){l.x=l.fx,l.y=l.fy;return}var m=p[2*T]*c,w=p[2*T+1]*c;l.x+=m,l.y+=w})},v.prototype.stop=function(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)},v.prototype.destroy=function(){var p=this;p.stop(),p.tick=null,p.nodes=null,p.edges=null,p.destroyed=!0},v.prototype.getType=function(){return"gForce"},v}(B.Base);x.GForceLayout=I},81822:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var l=function(T,m){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,O){w.__proto__=O}||function(w,O){for(var D in O)Object.prototype.hasOwnProperty.call(O,D)&&(w[D]=O[D])},l(T,m)};return function(T,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");l(T,m);function w(){this.constructor=T}T.prototype=m===null?Object.create(m):(w.prototype=m.prototype,new w)}}(),B=this&&this.__awaiter||function(l,T,m,w){function O(D){return D instanceof m?D:new m(function(g){g(D)})}return new(m||(m=Promise))(function(D,g){function _(z){try{V(w.next(z))}catch(Z){g(Z)}}function Y(z){try{V(w.throw(z))}catch(Z){g(Z)}}function V(z){z.done?D(z.value):O(z.value).then(_,Y)}V((w=w.apply(l,T||[])).next())})},N=this&&this.__generator||function(l,T){var m={label:0,sent:function(){if(D[0]&1)throw D[1];return D[1]},trys:[],ops:[]},w,O,D,g;return g={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g;function _(V){return function(z){return Y([V,z])}}function Y(V){if(w)throw new TypeError("Generator is already executing.");for(;m;)try{if(w=1,O&&(D=V[0]&2?O.return:V[0]?O.throw||((D=O.return)&&D.call(O),0):O.next)&&!(D=D.call(O,V[1])).done)return D;switch(O=0,D&&(V=[V[0]&2,D.value]),V[0]){case 0:case 1:D=V;break;case 4:return m.label++,{value:V[1],done:!1};case 5:m.label++,O=V[1],V=[0];continue;case 7:V=m.ops.pop(),m.trys.pop();continue;default:if(D=m.trys,!(D=D.length>0&&D[D.length-1])&&(V[0]===6||V[0]===2)){m=0;continue}if(V[0]===3&&(!D||V[1]>D[0]&&V[1]<D[3])){m.label=V[1];break}if(V[0]===6&&m.label<D[1]){m.label=D[1],D=V;break}if(D&&m.label<D[2]){m.label=D[2],m.ops.push(V);break}D[2]&&m.ops.pop(),m.trys.pop();continue}V=T.call(l,m)}catch(z){V=[6,z],O=0}finally{w=D=0}if(V[0]&5)throw V[1];return{value:V[0]?V[1]:void 0,done:!0}}};Object.defineProperty(x,"__esModule",{value:!0}),x.FruchtermanGPULayout=void 0;var E=M(46253),I=M(8273),A=M(75866),v=M(38342),p=M(41713),c=M(24979),f=function(l){S(T,l);function T(m){var w=l.call(this)||this;return w.maxIteration=1e3,w.gravity=10,w.speed=1,w.clustering=!1,w.clusterField="cluster",w.clusterGravity=10,w.workerEnabled=!1,w.nodes=[],w.edges=[],w.width=300,w.height=300,w.nodeMap={},w.nodeIdxMap={},w.updateCfg(m),w}return T.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10}},T.prototype.execute=function(){return B(this,void 0,void 0,function(){var m,w,O,D,g,_=this;return N(this,function(Y){switch(Y.label){case 0:return m=this,w=m.nodes,!w||w.length===0?(m.onLayoutEnd&&m.onLayoutEnd(),[2]):(!m.width&&typeof window!="undefined"&&(m.width=window.innerWidth),!m.height&&typeof window!="undefined"&&(m.height=window.innerHeight),m.center||(m.center=[m.width/2,m.height/2]),O=m.center,w.length===1?(w[0].x=O[0],w[0].y=O[1],m.onLayoutEnd&&m.onLayoutEnd(),[2]):(D={},g={},w.forEach(function(V,z){(0,I.isNumber)(V.x)||(V.x=Math.random()*_.width),(0,I.isNumber)(V.y)||(V.y=Math.random()*_.height),D[V.id]=V,g[V.id]=z}),m.nodeMap=D,m.nodeIdxMap=g,[4,m.run()]));case 1:return Y.sent(),[2]}})})},T.prototype.executeWithWorker=function(m,w){return B(this,void 0,void 0,function(){var O,D,g,_,Y,V=this;return N(this,function(z){switch(z.label){case 0:return O=this,D=O.nodes,g=O.center,!D||D.length===0?[2]:D.length===1?(D[0].x=g[0],D[0].y=g[1],[2]):(_={},Y={},D.forEach(function(Z,J){(0,I.isNumber)(Z.x)||(Z.x=Math.random()*V.width),(0,I.isNumber)(Z.y)||(Z.y=Math.random()*V.height),_[Z.id]=Z,Y[Z.id]=J}),O.nodeMap=_,O.nodeIdxMap=Y,[4,O.run(m,w)]);case 1:return z.sent(),[2]}})})},T.prototype.run=function(m,w){return B(this,void 0,void 0,function(){var O,D,g,_,Y,V,z,Z,J,ee,Q,re,fe,me,ae,Ee,Le,De,Ve,et,It,er,nr,Fe,Vt,$t,Ar=this;return N(this,function(ke){switch(ke.label){case 0:for(O=this,D=O.nodes,g=O.edges,_=O.maxIteration,Y=O.center,V=O.height*O.width,z=Math.sqrt(V)/10,Z=V/(D.length+1),J=Math.sqrt(Z),ee=O.speed,Q=O.clustering,re=(0,v.attributesToTextureData)([O.clusterField],D),fe=re.array,me=re.count,D.forEach(function(Oe,we){var Be=0,We=0;(0,I.isNumber)(Oe.fx)&&(0,I.isNumber)(Oe.fy)&&(Be=Oe.fx||.001,We=Oe.fy||.001),fe[4*we+1]=Be,fe[4*we+2]=We}),ae=D.length,Ee=(0,v.buildTextureData)(D,g),Le=Ee.maxEdgePerVetex,De=Ee.array,Ve=O.workerEnabled,Ve?et=A.World.create({canvas:m,engineOptions:{supportCompute:!0}}):et=A.World.create({engineOptions:{supportCompute:!0}}),It=O.onLayoutEnd,er=[],nr=0;nr<me;nr++)er.push(0,0,0,0);return Fe=et.createKernel(p.fruchtermanBundle).setDispatch([ae,1,1]).setBinding({u_Data:De,u_K:J,u_K2:Z,u_Gravity:O.gravity,u_ClusterGravity:O.clusterGravity||O.gravity||1,u_Speed:ee,u_MaxDisplace:z,u_Clustering:Q?1:0,u_Center:Y,u_AttributeArray:fe,u_ClusterCenters:er,MAX_EDGE_PER_VERTEX:Le,VERTEX_COUNT:ae}),Q&&(Vt=et.createKernel(p.clusterBundle).setDispatch([me,1,1]).setBinding({u_Data:De,u_NodeAttributes:fe,u_ClusterCenters:er,VERTEX_COUNT:ae,CLUSTER_COUNT:me})),$t=function(){return B(Ar,void 0,void 0,function(){var Oe,we;return N(this,function(Be){switch(Be.label){case 0:Oe=0,Be.label=1;case 1:return Oe<_?[4,Fe.execute()]:[3,6];case 2:return Be.sent(),Q?(Vt.setBinding({u_Data:Fe}),[4,Vt.execute()]):[3,4];case 3:Be.sent(),Fe.setBinding({u_ClusterCenters:Vt}),Be.label=4;case 4:Fe.setBinding({u_MaxDisplace:z*=.99}),Be.label=5;case 5:return Oe++,[3,1];case 6:return[4,Fe.getOutput()];case 7:return we=Be.sent(),m?w.postMessage({type:c.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:we}):D.forEach(function(We,He){var St=we[4*He],Mt=we[4*He+1];We.x=St,We.y=Mt}),It&&It(),[2]}})})},[4,$t()];case 1:return ke.sent(),[2]}})})},T.prototype.getType=function(){return"fruchterman-gpu"},T}(E.Base);x.FruchtermanGPULayout=f},41713:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.clusterBundle=x.clusterCode=x.fruchtermanBundle=x.fruchtermanCode=void 0,x.fruchtermanCode=`
  623. import { globalInvocationID } from 'g-webgpu';
  624. const MAX_EDGE_PER_VERTEX;
  625. const VERTEX_COUNT;
  626. @numthreads(1, 1, 1)
  627. class Fruchterman {
  628. @in @out
  629. u_Data: vec4[];
  630. @in
  631. u_K: float;
  632. @in
  633. u_K2: float;
  634. @in
  635. u_Center: vec2;
  636. @in
  637. u_Gravity: float;
  638. @in
  639. u_ClusterGravity: float;
  640. @in
  641. u_Speed: float;
  642. @in
  643. u_MaxDisplace: float;
  644. @in
  645. u_Clustering: float;
  646. @in
  647. u_AttributeArray: vec4[];
  648. @in
  649. u_ClusterCenters: vec4[];
  650. calcRepulsive(i: int, currentNode: vec4): vec2 {
  651. let dx = 0, dy = 0;
  652. for (let j = 0; j < VERTEX_COUNT; j++) {
  653. if (i != j) {
  654. const nextNode = this.u_Data[j];
  655. const xDist = currentNode[0] - nextNode[0];
  656. const yDist = currentNode[1] - nextNode[1];
  657. const dist = (xDist * xDist + yDist * yDist) + 0.01;
  658. let param = this.u_K2 / dist;
  659. if (dist > 0.0) {
  660. dx += param * xDist;
  661. dy += param * yDist;
  662. if (xDist == 0 && yDist == 0) {
  663. const sign = i < j ? 1 : -1;
  664. dx += param * sign;
  665. dy += param * sign;
  666. }
  667. }
  668. }
  669. }
  670. return [dx, dy];
  671. }
  672. calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { //
  673. let dx = 0, dy = 0;
  674. const vx = currentNode[0] - this.u_Center[0];
  675. const vy = currentNode[1] - this.u_Center[1];
  676. const gf = 0.01 * this.u_K * this.u_Gravity;
  677. dx = gf * vx;
  678. dy = gf * vy;
  679. if (this.u_Clustering == 1) {
  680. const clusterIdx = int(nodeAttributes[0]);
  681. const center = this.u_ClusterCenters[clusterIdx];
  682. const cvx = currentNode[0] - center[0];
  683. const cvy = currentNode[1] - center[1];
  684. const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01;
  685. const parma = this.u_K * this.u_ClusterGravity / dist;
  686. dx += parma * cvx;
  687. dy += parma * cvy;
  688. }
  689. return [dx, dy];
  690. }
  691. calcAttractive(i: int, currentNode: vec4): vec2 {
  692. let dx = 0, dy = 0;
  693. const arr_offset = int(floor(currentNode[2] + 0.5));
  694. const length = int(floor(currentNode[3] + 0.5));
  695. const node_buffer: vec4;
  696. for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) {
  697. if (p >= length) break;
  698. const arr_idx = arr_offset + p;
  699. // when arr_idx % 4 == 0 update currentNodedx_buffer
  700. const buf_offset = arr_idx - arr_idx / 4 * 4;
  701. if (p == 0 || buf_offset == 0) {
  702. node_buffer = this.u_Data[int(arr_idx / 4)];
  703. }
  704. const float_j = buf_offset == 0 ? node_buffer[0] :
  705. buf_offset == 1 ? node_buffer[1] :
  706. buf_offset == 2 ? node_buffer[2] :
  707. node_buffer[3];
  708. const nextNode = this.u_Data[int(float_j)];
  709. const xDist = currentNode[0] - nextNode[0];
  710. const yDist = currentNode[1] - nextNode[1];
  711. const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01;
  712. let attractiveF = dist / this.u_K;
  713. if (dist > 0.0) {
  714. dx -= xDist * attractiveF;
  715. dy -= yDist * attractiveF;
  716. if (xDist == 0 && yDist == 0) {
  717. const sign = i < int(float_j) ? 1 : -1;
  718. dx -= sign * attractiveF;
  719. dy -= sign * attractiveF;
  720. }
  721. }
  722. }
  723. return [dx, dy];
  724. }
  725. @main
  726. compute() {
  727. const i = globalInvocationID.x;
  728. const currentNode = this.u_Data[i];
  729. let dx = 0, dy = 0;
  730. if (i >= VERTEX_COUNT) {
  731. this.u_Data[i] = currentNode;
  732. return;
  733. }
  734. // [gravity, fx, fy, 0]
  735. const nodeAttributes = this.u_AttributeArray[i];
  736. if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) {
  737. // the node is fixed
  738. this.u_Data[i] = [
  739. nodeAttributes[1],
  740. nodeAttributes[2],
  741. currentNode[2],
  742. currentNode[3]
  743. ];
  744. return;
  745. }
  746. // repulsive
  747. const repulsive = this.calcRepulsive(i, currentNode);
  748. dx += repulsive[0];
  749. dy += repulsive[1];
  750. // attractive
  751. const attractive = this.calcAttractive(i, currentNode);
  752. dx += attractive[0];
  753. dy += attractive[1];
  754. // gravity
  755. const gravity = this.calcGravity(currentNode, nodeAttributes);
  756. dx -= gravity[0];
  757. dy -= gravity[1];
  758. // speed
  759. dx *= this.u_Speed;
  760. dy *= this.u_Speed;
  761. // move
  762. const distLength = sqrt(dx * dx + dy * dy);
  763. if (distLength > 0.0) {
  764. const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength);
  765. this.u_Data[i] = [
  766. currentNode[0] + dx / distLength * limitedDist,
  767. currentNode[1] + dy / distLength * limitedDist,
  768. currentNode[2],
  769. currentNode[3]
  770. ];
  771. }
  772. }
  773. }
  774. `,x.fruchtermanBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_K : f32;\\n [[offset 4]] u_K2 : f32;\\n [[offset 8]] u_Center : vec2<f32>;\\n [[offset 16]] u_Gravity : f32;\\n [[offset 20]] u_ClusterGravity : f32;\\n [[offset 24]] u_Speed : f32;\\n [[offset 28]] u_MaxDisplace : f32;\\n [[offset 32]] u_Clustering : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AttributeArray : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar param : f32 = gWebGPUUniformParams.u_K2 / dist;\\nif (dist > 0.0) {dx = dx + param * xDist;\\ndy = dy + param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < j);\\ndx = dx + param * std::sign;\\ndy = dy + param * std::sign;}}}}\\nreturn vec2<f32>(dx, dy);}\\nfn calcGravity(currentNode : vec4<f32>, nodeAttributes : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar vx : f32 = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nvar vy : f32 = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nvar gf : f32 = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {var clusterIdx : i32 = i32(nodeAttributes.x);\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[clusterIdx];\\nvar cvx : f32 = currentNode.x - center.x;\\nvar cvy : f32 = currentNode.y - center.y;\\nvar dist : f32 = std::sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nvar parma : f32 = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx = dx + parma * cvx;\\ndy = dy + parma * cvy;}\\nreturn vec2<f32>(dx, dy);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nvar arr_offset : i32 = i32(std::floor(currentNode.z + 0.5));\\nvar length : i32 = i32(std::floor(currentNode.w + 0.5));\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + i32(p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = select(node_buffer.x, select(node_buffer.y, select(node_buffer.z, node_buffer.w, buf_offset == 2), buf_offset == 1), buf_offset == 0);\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar xDist : f32 = currentNode.x - nextNode.x;\\nvar yDist : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nvar attractiveF : f32 = dist / gWebGPUUniformParams.u_K;\\nif (dist > 0.0) {dx = dx - xDist * attractiveF;\\ndy = dy - yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {var sign : f32 = select(1.0, -1.0, i < i32(float_j));\\ndx = dx - std::sign * attractiveF;\\ndy = dy - std::sign * attractiveF;}}}\\nreturn vec2<f32>(dx, dy);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar dx : f32 = 0.0;\\nvar dy : f32 = 0.0;\\nif (i >= __DefineValuePlaceholder__VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes : vec4<f32> = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w);\\nreturn ;}\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\ndx = dx + repulsive.x;\\ndy = dy + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode);\\ndx = dx + attractive.x;\\ndy = dy + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(currentNode, nodeAttributes);\\ndx = dx - gravity.x;\\ndy = dy - gravity.y;\\ndx = dx * gWebGPUUniformParams.u_Speed;\\ndy = dy * gWebGPUUniformParams.u_Speed;\\nvar distLength : f32 = std::sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {var limitedDist : f32 = std::min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_K;\\n float u_K2;\\n vec2 u_Center;\\n float u_Gravity;\\n float u_ClusterGravity;\\n float u_Speed;\\n float u_MaxDisplace;\\n float u_Clustering;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AttributeArray[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nvec2 calcRepulsive(int i, vec4 currentNode) {float dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_Data[j];\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = gWebGPUUniformParams.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) {float dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - gWebGPUUniformParams.u_Center.x;\\nfloat vy = currentNode.y - gWebGPUUniformParams.u_Center.y;\\nfloat gf = (0.01 * gWebGPUUniformParams.u_K) * gWebGPUUniformParams.u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (gWebGPUUniformParams.u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = gWebGPUBuffer2.u_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 = (gWebGPUUniformParams.u_K * gWebGPUUniformParams.u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {float 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 = gWebGPUBuffer0.u_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 = gWebGPUBuffer0.u_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 / gWebGPUUniformParams.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() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes = gWebGPUBuffer1.u_AttributeArray[i];\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gWebGPUBuffer0.u_Data[i] = 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 *= gWebGPUUniformParams.u_Speed;\\ndy *= gWebGPUUniformParams.u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(gWebGPUUniformParams.u_MaxDisplace * gWebGPUUniformParams.u_Speed, distLength);\\ngWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w);}}\\n","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<f32>[]","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<f32>","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<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',x.clusterCode=`
  775. import { globalInvocationID } from 'g-webgpu';
  776. const VERTEX_COUNT;
  777. const CLUSTER_COUNT;
  778. @numthreads(1, 1, 1)
  779. class CalcCenter {
  780. @in
  781. u_Data: vec4[];
  782. @in
  783. u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...]
  784. @in @out
  785. u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...]
  786. @main
  787. compute() {
  788. const i = globalInvocationID.x;
  789. const center = this.u_ClusterCenters[i];
  790. let sumx = 0;
  791. let sumy = 0;
  792. let count = 0;
  793. for (let j = 0; j < VERTEX_COUNT; j++) {
  794. const attributes = this.u_NodeAttributes[j];
  795. const clusterIdx = int(attributes[0]);
  796. const vertex = this.u_Data[j];
  797. if (clusterIdx == i) {
  798. sumx += vertex.x;
  799. sumy += vertex.y;
  800. count += 1;
  801. }
  802. }
  803. this.u_ClusterCenters[i] = [
  804. sumx / count,
  805. sumy / count,
  806. count,
  807. i
  808. ];
  809. }
  810. }
  811. `,x.clusterBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\n\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 0, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_NodeAttributes : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_ClusterCenters : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar center : vec4<f32> = gWebGPUBuffer2.u_ClusterCenters[i];\\nvar sumx : f32 = 0.0;\\nvar sumy : f32 = 0.0;\\nvar count : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var attributes : vec4<f32> = gWebGPUBuffer1.u_NodeAttributes[j];\\nvar clusterIdx : i32 = i32(attributes.x);\\nvar vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx = sumx + vertex.x;\\nsumy = sumy + vertex.y;\\ncount = count + 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4<f32>(sumx / count, sumy / count, count, i);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\n\\nlayout(std430, set = 0, binding = 0) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer1 {\\n vec4 u_NodeAttributes[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer2 {\\n vec4 u_ClusterCenters[];\\n} gWebGPUBuffer2;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {int i = globalInvocationID.x;\\nvec4 center = gWebGPUBuffer2.u_ClusterCenters[i];\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = gWebGPUBuffer1.u_NodeAttributes[j];\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = gWebGPUBuffer0.u_Data[j];\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngWebGPUBuffer2.u_ClusterCenters[i] = vec4(sumx / count, sumy / count, count, i);}\\n","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<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}'},86043:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var T=function(m,w){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(O,D){O.__proto__=D}||function(O,D){for(var g in D)Object.prototype.hasOwnProperty.call(D,g)&&(O[g]=D[g])},T(m,w)};return function(m,w){if(typeof w!="function"&&w!==null)throw new TypeError("Class extends value "+String(w)+" is not a constructor or null");T(m,w);function O(){this.constructor=m}m.prototype=w===null?Object.create(w):(O.prototype=w.prototype,new O)}}(),B=this&&this.__awaiter||function(T,m,w,O){function D(g){return g instanceof w?g:new w(function(_){_(g)})}return new(w||(w=Promise))(function(g,_){function Y(Z){try{z(O.next(Z))}catch(J){_(J)}}function V(Z){try{z(O.throw(Z))}catch(J){_(J)}}function z(Z){Z.done?g(Z.value):D(Z.value).then(Y,V)}z((O=O.apply(T,m||[])).next())})},N=this&&this.__generator||function(T,m){var w={label:0,sent:function(){if(g[0]&1)throw g[1];return g[1]},trys:[],ops:[]},O,D,g,_;return _={next:Y(0),throw:Y(1),return:Y(2)},typeof Symbol=="function"&&(_[Symbol.iterator]=function(){return this}),_;function Y(z){return function(Z){return V([z,Z])}}function V(z){if(O)throw new TypeError("Generator is already executing.");for(;w;)try{if(O=1,D&&(g=z[0]&2?D.return:z[0]?D.throw||((g=D.return)&&g.call(D),0):D.next)&&!(g=g.call(D,z[1])).done)return g;switch(D=0,g&&(z=[z[0]&2,g.value]),z[0]){case 0:case 1:g=z;break;case 4:return w.label++,{value:z[1],done:!1};case 5:w.label++,D=z[1],z=[0];continue;case 7:z=w.ops.pop(),w.trys.pop();continue;default:if(g=w.trys,!(g=g.length>0&&g[g.length-1])&&(z[0]===6||z[0]===2)){w=0;continue}if(z[0]===3&&(!g||z[1]>g[0]&&z[1]<g[3])){w.label=z[1];break}if(z[0]===6&&w.label<g[1]){w.label=g[1],g=z;break}if(g&&w.label<g[2]){w.label=g[2],w.ops.push(z);break}g[2]&&w.ops.pop(),w.trys.pop();continue}z=m.call(T,w)}catch(Z){z=[6,Z],D=0}finally{O=g=0}if(z[0]&5)throw z[1];return{value:z[0]?z[1]:void 0,done:!0}}};Object.defineProperty(x,"__esModule",{value:!0}),x.GForceGPULayout=void 0;var E=M(46253),I=M(8273),A=M(75866),v=M(38342),p=M(64446),c=M(53733),f=M(24979),l=function(T){S(m,T);function m(w){var O=T.call(this)||this;return O.maxIteration=1e3,O.edgeStrength=200,O.nodeStrength=1e3,O.coulombDisScale=.005,O.damping=.9,O.maxSpeed=1e3,O.minMovement=.5,O.interval=.02,O.factor=1,O.linkDistance=1,O.gravity=10,O.workerEnabled=!1,O.nodes=[],O.edges=[],O.width=300,O.height=300,O.nodeMap={},O.nodeIdxMap={},O.updateCfg(w),O}return m.prototype.getDefaultCfg=function(){return{maxIteration:2e3,gravity:10,clustering:!1,clusterGravity:10}},m.prototype.execute=function(){return B(this,void 0,void 0,function(){var w,O,D,g,_;return N(this,function(Y){switch(Y.label){case 0:return w=this,O=w.nodes,!O||O.length===0?(w.onLayoutEnd&&w.onLayoutEnd(),[2]):(!w.width&&typeof window!="undefined"&&(w.width=window.innerWidth),!w.height&&typeof window!="undefined"&&(w.height=window.innerHeight),w.center||(w.center=[w.width/2,w.height/2]),D=w.center,O.length===1?(O[0].x=D[0],O[0].y=D[1],w.onLayoutEnd&&w.onLayoutEnd(),[2]):(g={},_={},O.forEach(function(V,z){(0,I.isNumber)(V.x)||(V.x=Math.random()*w.width),(0,I.isNumber)(V.y)||(V.y=Math.random()*w.height),g[V.id]=V,_[V.id]=z}),w.nodeMap=g,w.nodeIdxMap=_,w.nodeStrength=(0,v.proccessToFunc)(w.nodeStrength,1),w.edgeStrength=(0,v.proccessToFunc)(w.edgeStrength,1),[4,w.run()]));case 1:return Y.sent(),[2]}})})},m.prototype.executeWithWorker=function(w,O){var D=this,g=D.nodes,_=D.center;if(!(!g||g.length===0)){if(g.length===1){g[0].x=_[0],g[0].y=_[1];return}var Y={},V={};g.forEach(function(z,Z){(0,I.isNumber)(z.x)||(z.x=Math.random()*D.width),(0,I.isNumber)(z.y)||(z.y=Math.random()*D.height),Y[z.id]=z,V[z.id]=Z}),D.nodeMap=Y,D.nodeIdxMap=V,D.nodeStrength=(0,v.proccessToFunc)(D.nodeStrength,1),D.edgeStrength=(0,v.proccessToFunc)(D.edgeStrength,1),D.run(w,O)}},m.prototype.run=function(w,O){return B(this,void 0,void 0,function(){var D,g,_,Y,V,z,Z,J,ee,Q,re,fe,me,ae,Ee,Le,De,Ve,et,It,er,nr,Fe,Vt,$t,Ar,ke,Oe=this;return N(this,function(we){switch(we.label){case 0:for(D=this,g=D.nodes,_=D.edges,Y=D.maxIteration,!D.width&&typeof window!="undefined"&&(D.width=window.innerWidth),!D.height&&typeof window!="undefined"&&(D.height=window.innerHeight),V=g.length,D.linkDistance=(0,v.proccessToFunc)(D.linkDistance),D.edgeStrength=(0,v.proccessToFunc)(D.edgeStrength),z=(0,v.buildTextureDataWithTwoEdgeAttr)(g,_,D.linkDistance,D.edgeStrength),Z=z.maxEdgePerVetex,J=z.array,D.degrees=(0,p.getDegree)(g.length,D.nodeIdxMap,_).map(function(Be){return Be.all}),ee=[],Q=[],re=[],fe=[],me=[],ae=[],Ee=[],D.getMass||(D.getMass=function(Be){return D.degrees[D.nodeIdxMap[Be.id]]||1}),Le=D.gravity,De=D.center,g.forEach(function(Be,We){ee.push(D.getMass(Be)),Q.push(D.nodeStrength(Be)),D.degrees[We]||(D.degrees[We]=0);var He=[De[0],De[1],Le];if(D.getCenter){var St=D.getCenter(Be,D.degrees[We]);St&&(0,I.isNumber)(St[0])&&(0,I.isNumber)(St[1])&&(0,I.isNumber)(St[2])&&(He=St)}re.push(He[0]),fe.push(He[1]),me.push(He[2]),(0,I.isNumber)(Be.fx)&&(0,I.isNumber)(Be.fy)?(ae.push(Be.fx||.001),Ee.push(Be.fy||.001)):(ae.push(0),Ee.push(0))}),Ve=(0,v.arrayToTextureData)([ee,D.degrees,Q,ae]),et=(0,v.arrayToTextureData)([re,fe,me,Ee]),It=D.workerEnabled,It?er=A.World.create({canvas:w,engineOptions:{supportCompute:!0}}):er=A.World.create({engineOptions:{supportCompute:!0}}),nr=D.onLayoutEnd,Fe=[],J.forEach(function(Be){Fe.push(Be)}),Vt=0;Vt<4;Vt++)Fe.push(0);return $t=er.createKernel(c.gForceBundle).setDispatch([V,1,1]).setBinding({u_Data:J,u_damping:D.damping,u_maxSpeed:D.maxSpeed,u_minMovement:D.minMovement,u_coulombDisScale:D.coulombDisScale,u_factor:D.factor,u_NodeAttributeArray1:Ve,u_NodeAttributeArray2:et,MAX_EDGE_PER_VERTEX:Z,VERTEX_COUNT:V,u_AveMovement:Fe,u_interval:D.interval}),Ar=er.createKernel(c.aveMovementBundle).setDispatch([1,1,1]).setBinding({u_Data:J,VERTEX_COUNT:V,u_AveMovement:[0,0,0,0]}),ke=function(){return B(Oe,void 0,void 0,function(){var Be,We,He;return N(this,function(St){switch(St.label){case 0:Be=0,St.label=1;case 1:return Be<Y?[4,$t.execute()]:[3,5];case 2:return St.sent(),Ar.setBinding({u_Data:$t}),[4,Ar.execute()];case 3:St.sent(),We=Math.max(.02,D.interval-Be*.002),$t.setBinding({u_interval:We,u_AveMovement:Ar}),St.label=4;case 4:return Be++,[3,1];case 5:return[4,$t.getOutput()];case 6:return He=St.sent(),w?O.postMessage({type:f.LAYOUT_MESSAGE.GPUEND,vertexEdgeData:He}):g.forEach(function(Mt,sr){var Ge=He[4*sr],ut=He[4*sr+1];Mt.x=Ge,Mt.y=ut}),nr&&nr(),[2]}})})},[4,ke()];case 1:return we.sent(),[2]}})})},m.prototype.getType=function(){return"gForce-gpu"},m}(E.Base);x.GForceGPULayout=l},53733:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.aveMovementBundle=x.aveMovementCode=x.gForceBundle=x.gForceCode=void 0,x.gForceCode=`
  812. import { globalInvocationID } from 'g-webgpu';
  813. const MAX_EDGE_PER_VERTEX;
  814. const VERTEX_COUNT;
  815. const SHIFT_20 = 1048576;
  816. @numthreads(1, 1, 1)
  817. class GGForce {
  818. @in @out
  819. u_Data: vec4[];
  820. @in
  821. u_damping: float;
  822. @in
  823. u_maxSpeed: float;
  824. @in
  825. u_minMovement: float;
  826. @in
  827. u_AveMovement: vec4[];
  828. @in
  829. u_coulombDisScale: float;
  830. @in
  831. u_factor: float;
  832. @in
  833. u_NodeAttributeArray1: vec4[];
  834. @in
  835. u_NodeAttributeArray2: vec4[];
  836. @in
  837. u_interval: float;
  838. unpack_float(packedValue: float): ivec2 {
  839. const packedIntValue = int(packedValue);
  840. const v0 = packedIntValue / SHIFT_20;
  841. return [v0, packedIntValue - v0 * SHIFT_20];
  842. }
  843. calcRepulsive(i: int, currentNode: vec4): vec2 {
  844. let ax = 0, ay = 0;
  845. for (let j: int = 0; j < VERTEX_COUNT; j++) {
  846. if (i != j) {
  847. const nextNode = this.u_Data[j];
  848. const vx = currentNode[0] - nextNode[0];
  849. const vy = currentNode[1] - nextNode[1];
  850. const dist = sqrt(vx * vx + vy * vy) + 0.01;
  851. const n_dist = (dist + 0.1) * this.u_coulombDisScale;
  852. const direx = vx / dist;
  853. const direy = vy / dist;
  854. const attributesi = this.u_NodeAttributeArray1[i];
  855. const attributesj = this.u_NodeAttributeArray1[j];
  856. const massi = attributesi[0];
  857. const nodeStrengthi = attributesi[2];
  858. const nodeStrengthj = attributesj[2];
  859. const nodeStrength = (nodeStrengthi + nodeStrengthj) / 2;
  860. // const param = nodeStrength * this.u_factor / (n_dist * n_dist * massi);
  861. const param = nodeStrength * this.u_factor / (n_dist * n_dist);
  862. ax += direx * param;
  863. ay += direy * param;
  864. }
  865. }
  866. return [ax, ay];
  867. }
  868. calcGravity(i: int, currentNode: vec4, attributes2: vec4): vec2 {
  869. // note: attributes2 = [centerX, centerY, gravity, 0]
  870. const vx = currentNode[0] - attributes2[0];
  871. const vy = currentNode[1] - attributes2[1];
  872. const ax = vx * attributes2[2];
  873. const ay = vy * attributes2[2];
  874. return [ax, ay];
  875. }
  876. calcAttractive(i: int, currentNode: vec4, attributes1: vec4): vec2 {
  877. // note: attributes1 = [mass, degree, nodeSterngth, 0]
  878. const mass = attributes1[0];
  879. let ax = 0, ay = 0;
  880. // const arr_offset = int(floor(currentNode[2] + 0.5));
  881. // const length = int(floor(currentNode[3] + 0.5));
  882. const compressed = this.unpack_float(currentNode[2]);
  883. const length = compressed[0];
  884. const arr_offset = compressed[1];
  885. const node_buffer: vec4;
  886. for (let p: int = 0; p < MAX_EDGE_PER_VERTEX; p++) {
  887. if (p >= length) break;
  888. const arr_idx = arr_offset + 4 * p; // i \u8282\u70B9\u7684\u7B2C p \u6761\u8FB9\u5F00\u59CB\u7684\u5C0F\u683C\u5B50\u4F4D\u7F6E
  889. const buf_offset = arr_idx - arr_idx / 4 * 4;
  890. if (p == 0 || buf_offset == 0) {
  891. 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
  892. }
  893. let float_j: float = node_buffer[0];
  894. const nextNode = this.u_Data[int(float_j)];
  895. const vx = nextNode[0] - currentNode[0];
  896. const vy = nextNode[1] - currentNode[1];
  897. const dist = sqrt(vx * vx + vy * vy) + 0.01;
  898. const direx = vx / dist;
  899. const direy = vy / dist;
  900. const edgeLength = node_buffer[1];
  901. const edgeStrength = node_buffer[2];
  902. const diff: float = edgeLength - dist;//edgeLength
  903. // const param = diff * this.u_stiffness / mass; //
  904. const param = diff * edgeStrength / mass; //
  905. ax -= direx * param;
  906. ay -= direy * param;
  907. }
  908. return [ax, ay];
  909. }
  910. @main
  911. compute() {
  912. const i = globalInvocationID.x;
  913. const currentNode = this.u_Data[i];
  914. const movement = u_AveMovement[0];
  915. let ax = 0, ay = 0;
  916. if (i >= VERTEX_COUNT || movement.x < u_minMovement) {
  917. this.u_Data[i] = currentNode;
  918. return;
  919. }
  920. // \u6BCF\u4E2A\u8282\u70B9\u5C5E\u6027\u5360\u4E24\u4E2A\u6570\u7EC4\u4E2D\u5404\u4E00\u683C
  921. // [mass, degree, nodeStrength, fx]
  922. const nodeAttributes1 = this.u_NodeAttributeArray1[i];
  923. // [centerX, centerY, centerGravity, fy]
  924. const nodeAttributes2 = this.u_NodeAttributeArray2[i];
  925. // repulsive
  926. const repulsive = this.calcRepulsive(i, currentNode);
  927. ax += repulsive[0];
  928. ay += repulsive[1];
  929. // attractive
  930. const attractive = this.calcAttractive(i, currentNode, nodeAttributes1);
  931. ax += attractive[0];
  932. ay += attractive[1];
  933. // gravity
  934. const gravity = this.calcGravity(i, currentNode, nodeAttributes2);
  935. ax -= gravity[0];
  936. ay -= gravity[1];
  937. // speed
  938. const param = this.u_interval * this.u_damping;
  939. let vx = ax * param;
  940. let vy = ay * param;
  941. const vlength = sqrt(vx * vx + vy * vy) + 0.0001;
  942. if (vlength > this.u_maxSpeed) {
  943. const param2 = this.u_maxSpeed / vlength;
  944. vx = param2 * vx;
  945. vy = param2 * vy;
  946. }
  947. // move
  948. if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) {
  949. this.u_Data[i] = [
  950. nodeAttributes1[3],
  951. nodeAttributes2[3],
  952. currentNode[2],
  953. 0
  954. ];
  955. } else {
  956. const distx = vx * this.u_interval;
  957. const disty = vy * this.u_interval;
  958. const distLength = sqrt(distx * distx + disty * disty);
  959. this.u_Data[i] = [
  960. currentNode[0] + distx,
  961. currentNode[1] + disty,
  962. currentNode[2],
  963. distLength
  964. ];
  965. }
  966. // the avarage move distance
  967. // need to share memory
  968. }
  969. }
  970. `,x.gForceBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_damping : f32;\\n [[offset 4]] u_maxSpeed : f32;\\n [[offset 8]] u_minMovement : f32;\\n \\n [[offset 12]] u_coulombDisScale : f32;\\n [[offset 16]] u_factor : f32;\\n \\n \\n [[offset 20]] u_interval : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\ntype GWebGPUBuffer2 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray1 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 3, set 0]] var<storage_buffer> gWebGPUBuffer2 : GWebGPUBuffer2;\\ntype GWebGPUBuffer3 = [[block]] struct {\\n [[offset 0]] u_NodeAttributeArray2 : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 4, set 0]] var<storage_buffer> gWebGPUBuffer3 : GWebGPUBuffer3;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nfn unpack_float(packedValue : f32) -> vec2<i32> {var packedIntValue : i32 = i32(packedValue);\\nvar v0 : i32 = packedIntValue / 1048576;\\nreturn vec2<i32>(v0, packedIntValue - (v0 * 1048576));}\\nfn calcRepulsive(i : i32, currentNode : vec4<f32>) -> vec2<f32> {var ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {if (i != j) {var nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nvar vx : f32 = currentNode.x - nextNode.x;\\nvar vy : f32 = currentNode.y - nextNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar n_dist : f32 = (dist + 0.1) * gWebGPUUniformParams.u_coulombDisScale;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar attributesi : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar attributesj : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nvar massi : f32 = attributesi.x;\\nvar nodeStrengthi : f32 = attributesi.z;\\nvar nodeStrengthj : f32 = attributesj.z;\\nvar nodeStrength : f32 = (nodeStrengthi + nodeStrengthj) / 2.0;\\nvar param : f32 = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax = ax + direx * param;\\nay = ay + direy * param;}}\\nreturn vec2<f32>(ax, ay);}\\nfn calcGravity(i : i32, currentNode : vec4<f32>, attributes2 : vec4<f32>) -> vec2<f32> {var vx : f32 = currentNode.x - attributes2.x;\\nvar vy : f32 = currentNode.y - attributes2.y;\\nvar ax : f32 = vx * attributes2.z;\\nvar ay : f32 = vy * attributes2.z;\\nreturn vec2<f32>(ax, ay);}\\nfn calcAttractive(i : i32, currentNode : vec4<f32>, attributes1 : vec4<f32>) -> vec2<f32> {var mass : f32 = attributes1.x;\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nvar compressed : vec2<i32> = unpack_float(currentNode.z);\\nvar length : i32 = compressed.x;\\nvar arr_offset : i32 = compressed.y;\\nvar node_buffer : vec4<f32>;\\nfor (var p : i32 = 0; p < __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX; p = p + 1) {if (p >= length) {break;}\\nvar arr_idx : i32 = arr_offset + (4 * p);\\nvar buf_offset : i32 = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = gWebGPUBuffer0.u_Data[i32(arr_idx / 4)];}\\nvar float_j : f32 = node_buffer.x;\\nvar nextNode : vec4<f32> = gWebGPUBuffer0.u_Data[i32(float_j)];\\nvar vx : f32 = nextNode.x - currentNode.x;\\nvar vy : f32 = nextNode.y - currentNode.y;\\nvar dist : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.01;\\nvar direx : f32 = vx / dist;\\nvar direy : f32 = vy / dist;\\nvar edgeLength : f32 = node_buffer.y;\\nvar edgeStrength : f32 = node_buffer.z;\\nvar diff : f32 = edgeLength - dist;\\nvar param : f32 = (diff * edgeStrength) / mass;\\nax = ax - direx * param;\\nay = ay - direy * param;}\\nreturn vec2<f32>(ax, ay);}\\nfn main() -> void {var i : i32 = globalInvocationID.x;\\nvar currentNode : vec4<f32> = gWebGPUBuffer0.u_Data[i];\\nvar movement : vec4<f32> = gWebGPUBuffer1.u_AveMovement[0];\\nvar ax : f32 = 0.0;\\nvar ay : f32 = 0.0;\\nif ((i >= __DefineValuePlaceholder__VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvar nodeAttributes1 : vec4<f32> = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvar nodeAttributes2 : vec4<f32> = gWebGPUBuffer3.u_NodeAttributeArray2[i];\\nvar repulsive : vec2<f32> = calcRepulsive(i, currentNode);\\nax = ax + repulsive.x;\\nay = ay + repulsive.y;\\nvar attractive : vec2<f32> = calcAttractive(i, currentNode, nodeAttributes1);\\nax = ax + attractive.x;\\nay = ay + attractive.y;\\nvar gravity : vec2<f32> = calcGravity(i, currentNode, nodeAttributes2);\\nax = ax - gravity.x;\\nay = ay - gravity.y;\\nvar param : f32 = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nvar vx : f32 = ax * param;\\nvar vy : f32 = ay * param;\\nvar vlength : f32 = std::sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {var param2 : f32 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nvar distx : f32 = vx * gWebGPUUniformParams.u_interval;\\nvar disty : f32 = vy * gWebGPUUniformParams.u_interval;\\nvar distLength : f32 = std::sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4<f32>(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4<f32>(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_damping;\\n float u_maxSpeed;\\n float u_minMovement;\\n \\n float u_coulombDisScale;\\n float u_factor;\\n \\n \\n float u_interval;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer readonly GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\nlayout(std430, set = 0, binding = 3) buffer readonly GWebGPUBuffer2 {\\n vec4 u_NodeAttributeArray1[];\\n} gWebGPUBuffer2;\\n\\nlayout(std430, set = 0, binding = 4) buffer readonly GWebGPUBuffer3 {\\n vec4 u_NodeAttributeArray2[];\\n} gWebGPUBuffer3;\\n\\n\\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\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\nivec2 unpack_float(float packedValue) {int packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {float ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = gWebGPUBuffer0.u_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) * gWebGPUUniformParams.u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 attributesj = gWebGPUBuffer2.u_NodeAttributeArray1[j];\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * gWebGPUUniformParams.u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {float 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) {float 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 = gWebGPUBuffer0.u_Data[int(arr_idx / 4)];}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = gWebGPUBuffer0.u_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() {int i = globalInvocationID.x;\\nvec4 currentNode = gWebGPUBuffer0.u_Data[i];\\nvec4 movement = gWebGPUBuffer1.u_AveMovement[0];\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < gWebGPUUniformParams.u_minMovement)) {gWebGPUBuffer0.u_Data[i] = currentNode;\\nreturn ;}\\nvec4 nodeAttributes1 = gWebGPUBuffer2.u_NodeAttributeArray1[i];\\nvec4 nodeAttributes2 = gWebGPUBuffer3.u_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 = gWebGPUUniformParams.u_interval * gWebGPUUniformParams.u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > gWebGPUUniformParams.u_maxSpeed) {float param2 = gWebGPUUniformParams.u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nfloat distx = vx * gWebGPUUniformParams.u_interval;\\nfloat disty = vy * gWebGPUUniformParams.u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gWebGPUBuffer0.u_Data[i] = vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0);}else {gWebGPUBuffer0.u_Data[i] = vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength);}}\\n","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;}\\nfloat distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {gl_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<f32>[]","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<f32>[]","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<f32>[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4<f32>[]","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}}',x.aveMovementCode=`
  971. const VERTEX_COUNT;
  972. @numthreads(1, 1, 1)
  973. class CalcAveMovement {
  974. @in
  975. u_Data: vec4[];
  976. @in
  977. u_iter: float;
  978. @in @out
  979. u_AveMovement: vec4[];
  980. @main
  981. compute() {
  982. let movement = 0;
  983. for (let j: int = 0; j < VERTEX_COUNT; j++) {
  984. const vertex = this.u_Data[j];
  985. movement += vertex[3];
  986. }
  987. movement = movement / float(VERTEX_COUNT);
  988. this.u_AveMovement[0] = [movement, 0, 0, 0];
  989. }
  990. }
  991. `,x.aveMovementBundle='{"shaders":{"WGSL":"import \\"GLSL.std.450\\" as std;\\n\\n\\n# var gWebGPUDebug : bool = false;\\n# var gWebGPUDebugOutput : vec4<f32> = vec4<f32>(0.0);\\n\\n[[builtin global_invocation_id]] var<in> globalInvocationID : vec3<u32>;\\n# [[builtin work_group_size]] var<in> workGroupSize : vec3<u32>;\\n# [[builtin work_group_id]] var<in> workGroupID : vec3<u32>;\\n[[builtin local_invocation_id]] var<in> localInvocationID : vec3<u32>;\\n# [[builtin num_work_groups]] var<in> numWorkGroups : vec3<u32>;\\n[[builtin local_invocation_idx]] var<in> localInvocationIndex : u32;\\n\\ntype GWebGPUParams = [[block]] struct {\\n [[offset 0]] u_iter : f32;\\n};\\n[[binding 0, set 0]] var<uniform> gWebGPUUniformParams : GWebGPUParams;\\ntype GWebGPUBuffer0 = [[block]] struct {\\n [[offset 0]] u_Data : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 1, set 0]] var<storage_buffer> gWebGPUBuffer0 : GWebGPUBuffer0;\\ntype GWebGPUBuffer1 = [[block]] struct {\\n [[offset 0]] u_AveMovement : [[stride 16]] array<vec4<f32>>;\\n};\\n[[binding 2, set 0]] var<storage_buffer> gWebGPUBuffer1 : GWebGPUBuffer1;\\n\\n\\n\\n\\n\\n\\n\\n\\nfn main() -> void {var movement : f32 = 0.0;\\nfor (var j : i32 = 0; j < __DefineValuePlaceholder__VERTEX_COUNT; j = j + 1) {var vertex : vec4<f32> = gWebGPUBuffer0.u_Data[j];\\nmovement = movement + vertex.w;}\\nmovement = movement / f32(__DefineValuePlaceholder__VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4<f32>(movement, 0.0, 0.0, 0.0);\\nreturn;}\\n\\nentry_point compute as \\"main\\" = main;\\n","GLSL450":"\\n\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\nivec3 globalInvocationID = ivec3(gl_GlobalInvocationID);\\nivec3 workGroupSize = ivec3(1,1,1);\\nivec3 workGroupID = ivec3(gl_WorkGroupID);\\nivec3 localInvocationID = ivec3(gl_LocalInvocationID);\\nivec3 numWorkGroups = ivec3(gl_NumWorkGroups);\\nint localInvocationIndex = int(gl_LocalInvocationIndex);\\n\\nlayout(std140, set = 0, binding = 0) uniform GWebGPUParams {\\n float u_iter;\\n} gWebGPUUniformParams;\\nlayout(std430, set = 0, binding = 1) buffer readonly GWebGPUBuffer0 {\\n vec4 u_Data[];\\n} gWebGPUBuffer0;\\n\\nlayout(std430, set = 0, binding = 2) buffer GWebGPUBuffer1 {\\n vec4 u_AveMovement[];\\n} gWebGPUBuffer1;\\n\\n\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\nlayout (\\n local_size_x = 1,\\n local_size_y = 1,\\n local_size_z = 1\\n) in;\\n\\n\\n\\nvoid main() {float movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = gWebGPUBuffer0.u_Data[j];\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngWebGPUBuffer1.u_AveMovement[0] = vec4(movement, 0.0, 0.0, 0.0);}\\n","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<f32>[]","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<f32>[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}'},74294:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var I=function(A,v){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,c){p.__proto__=c}||function(p,c){for(var f in c)Object.prototype.hasOwnProperty.call(c,f)&&(p[f]=c[f])},I(A,v)};return function(A,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");I(A,v);function p(){this.constructor=A}A.prototype=v===null?Object.create(v):(p.prototype=v.prototype,new p)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.GridLayout=void 0;var B=M(8273),N=M(46253),E=function(I){S(A,I);function A(v){var p=I.call(this)||this;return p.begin=[0,0],p.preventOverlap=!0,p.preventOverlapPadding=10,p.condense=!1,p.sortBy="degree",p.nodes=[],p.edges=[],p.width=300,p.height=300,p.row=0,p.col=0,p.cellWidth=0,p.cellHeight=0,p.cellUsed={},p.id2manPos={},p.onLayoutEnd=function(){},p.updateCfg(v),p}return A.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}},A.prototype.execute=function(){var v=this,p=v.nodes,c=v.edges,f=v.begin,l=p.length;if(l===0)return v.onLayoutEnd&&v.onLayoutEnd(),{nodes:p,edges:c};if(l===1)return p[0].x=f[0],p[0].y=f[1],v.onLayoutEnd&&v.onLayoutEnd(),{nodes:p,edges:c};var T=v.sortBy,m=v.width,w=v.height,O=v.condense,D=v.preventOverlapPadding,g=v.preventOverlap,_=v.nodeSpacing,Y=v.nodeSize,V=[];p.forEach(function(Ve){V.push(Ve)});var z={};if(V.forEach(function(Ve,et){z[Ve.id]=et}),(T==="degree"||!(0,B.isString)(T)||V[0][T]===void 0)&&(T="degree",(0,B.isNaN)(p[0].degree))){var Z=(0,B.getDegree)(V.length,z,c);V.forEach(function(Ve,et){Ve.degree=Z[et].all})}V.sort(function(Ve,et){return et[T]-Ve[T]}),!m&&typeof window!="undefined"&&(m=window.innerWidth),!w&&typeof window!="undefined"&&(w=window.innerHeight);var J=v.rows,ee=v.cols!=null?v.cols:v.columns;if(v.cells=l,J!=null&&ee!=null?(v.rows=J,v.cols=ee):J!=null&&ee==null?(v.rows=J,v.cols=Math.ceil(v.cells/v.rows)):J==null&&ee!=null?(v.cols=ee,v.rows=Math.ceil(v.cells/v.cols)):(v.splits=Math.sqrt(v.cells*v.height/v.width),v.rows=Math.round(v.splits),v.cols=Math.round(v.width/v.height*v.splits)),v.rows=Math.max(v.rows,1),v.cols=Math.max(v.cols,1),v.cols*v.rows>v.cells){var Q=v.small(),re=v.large();(Q-1)*re>=v.cells?v.small(Q-1):(re-1)*Q>=v.cells&&v.large(re-1)}else for(;v.cols*v.rows<v.cells;){var Q=v.small(),re=v.large();(re+1)*Q>=v.cells?v.large(re+1):v.small(Q+1)}if(v.cellWidth=m/v.cols,v.cellHeight=w/v.rows,O&&(v.cellWidth=0,v.cellHeight=0),g||_){var fe=(0,B.getFuncByUnknownType)(10,_),me=(0,B.getFuncByUnknownType)(30,Y,!1);V.forEach(function(Ve){(!Ve.x||!Ve.y)&&(Ve.x=0,Ve.y=0);var et=me(Ve)||30,It,er;(0,B.isArray)(et)?(It=et[0],er=et[1]):(It=et,er=et);var nr=fe!==void 0?fe(Ve):D,Fe=It+nr,Vt=er+nr;v.cellWidth=Math.max(v.cellWidth,Fe),v.cellHeight=Math.max(v.cellHeight,Vt)})}v.cellUsed={},v.row=0,v.col=0,v.id2manPos={};for(var ae=0;ae<V.length;ae++){var Ee=V[ae],Le=void 0;if(v.position&&(Le=v.position(Ee)),Le&&(Le.row!==void 0||Le.col!==void 0)){var De={row:Le.row,col:Le.col};if(De.col===void 0)for(De.col=0;v.used(De.row,De.col);)De.col++;else if(De.row===void 0)for(De.row=0;v.used(De.row,De.col);)De.row++;v.id2manPos[Ee.id]=De,v.use(De.row,De.col)}v.getPos(Ee)}return v.onLayoutEnd&&v.onLayoutEnd(),{edges:c,nodes:V}},A.prototype.small=function(v){var p=this,c,f=p.rows||5,l=p.cols||5;if(v==null)c=Math.min(f,l);else{var T=Math.min(f,l);T===p.rows?p.rows=v:p.cols=v}return c},A.prototype.large=function(v){var p=this,c,f=p.rows||5,l=p.cols||5;if(v==null)c=Math.max(f,l);else{var T=Math.max(f,l);T===p.rows?p.rows=v:p.cols=v}return c},A.prototype.used=function(v,p){var c=this;return c.cellUsed["c-".concat(v,"-").concat(p)]||!1},A.prototype.use=function(v,p){var c=this;c.cellUsed["c-".concat(v,"-").concat(p)]=!0},A.prototype.moveToNextCell=function(){var v=this,p=v.cols||5;v.col++,v.col>=p&&(v.col=0,v.row++)},A.prototype.getPos=function(v){var p=this,c=p.begin,f=p.cellWidth,l=p.cellHeight,T,m,w=p.id2manPos[v.id];if(w)T=w.col*f+f/2+c[0],m=w.row*l+l/2+c[1];else{for(;p.used(p.row,p.col);)p.moveToNextCell();T=p.col*f+f/2+c[0],m=p.row*l+l/2+c[1],p.use(p.row,p.col),p.moveToNextCell()}v.x=T,v.y=m},A.prototype.getType=function(){return"grid"},A}(N.Base);x.GridLayout=E},64649:function(dt,x,M){"use strict";var S=this&&this.__createBinding||(Object.create?function(Z,J,ee,Q){Q===void 0&&(Q=ee);var re=Object.getOwnPropertyDescriptor(J,ee);(!re||("get"in re?!J.__esModule:re.writable||re.configurable))&&(re={enumerable:!0,get:function(){return J[ee]}}),Object.defineProperty(Z,Q,re)}:function(Z,J,ee,Q){Q===void 0&&(Q=ee),Z[Q]=J[ee]}),B=this&&this.__exportStar||function(Z,J){for(var ee in Z)ee!=="default"&&!Object.prototype.hasOwnProperty.call(J,ee)&&S(J,Z,ee)};Object.defineProperty(x,"__esModule",{value:!0}),x.ERLayout=x.ForceAtlas2Layout=x.ComboCombinedLayout=x.ComboForceLayout=x.GForceGPULayout=x.FruchtermanGPULayout=x.FruchtermanLayout=x.MDSLayout=x.ConcentricLayout=x.RadialLayout=x.DagreCompoundLayout=x.DagreLayout=x.CircularLayout=x.ForceLayout=x.Force2Layout=x.GForceLayout=x.RandomLayout=x.GridLayout=x.Layouts=x.Layout=void 0;var N=M(74294);Object.defineProperty(x,"GridLayout",{enumerable:!0,get:function(){return N.GridLayout}});var E=M(26729);Object.defineProperty(x,"RandomLayout",{enumerable:!0,get:function(){return E.RandomLayout}});var I=M(46260);Object.defineProperty(x,"GForceLayout",{enumerable:!0,get:function(){return I.GForceLayout}});var A=M(38129);Object.defineProperty(x,"Force2Layout",{enumerable:!0,get:function(){return A.Force2Layout}});var v=M(64180);Object.defineProperty(x,"ForceLayout",{enumerable:!0,get:function(){return v.ForceLayout}});var p=M(93959);Object.defineProperty(x,"CircularLayout",{enumerable:!0,get:function(){return p.CircularLayout}});var c=M(2);Object.defineProperty(x,"DagreLayout",{enumerable:!0,get:function(){return c.DagreLayout}});var f=M(77620);Object.defineProperty(x,"DagreCompoundLayout",{enumerable:!0,get:function(){return f.DagreCompoundLayout}});var l=M(90106);Object.defineProperty(x,"RadialLayout",{enumerable:!0,get:function(){return l.RadialLayout}});var T=M(98162);Object.defineProperty(x,"ConcentricLayout",{enumerable:!0,get:function(){return T.ConcentricLayout}});var m=M(98204);Object.defineProperty(x,"MDSLayout",{enumerable:!0,get:function(){return m.MDSLayout}});var w=M(23826);Object.defineProperty(x,"FruchtermanLayout",{enumerable:!0,get:function(){return w.FruchtermanLayout}});var O=M(81822);Object.defineProperty(x,"FruchtermanGPULayout",{enumerable:!0,get:function(){return O.FruchtermanGPULayout}});var D=M(86043);Object.defineProperty(x,"GForceGPULayout",{enumerable:!0,get:function(){return D.GForceGPULayout}});var g=M(48133);Object.defineProperty(x,"ComboForceLayout",{enumerable:!0,get:function(){return g.ComboForceLayout}});var _=M(6412);Object.defineProperty(x,"ComboCombinedLayout",{enumerable:!0,get:function(){return _.ComboCombinedLayout}});var Y=M(16919);Object.defineProperty(x,"ForceAtlas2Layout",{enumerable:!0,get:function(){return Y.ForceAtlas2Layout}});var V=M(40311);Object.defineProperty(x,"ERLayout",{enumerable:!0,get:function(){return V.ERLayout}});var z=M(99745);Object.defineProperty(x,"Layout",{enumerable:!0,get:function(){return z.Layout}}),Object.defineProperty(x,"Layouts",{enumerable:!0,get:function(){return z.Layouts}}),B(M(2230),x)},99745:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.Layouts=x.Layout=void 0;var S=M(39464),B=M(74294),N=M(26729),E=M(38129),I=M(46260),A=M(64180),v=M(93959),p=M(2),c=M(90106),f=M(98162),l=M(98204),T=M(23826),m=M(81822),w=M(86043),O=M(48133),D=M(6412),g=M(16919),_=M(40311),Y=M(77620),V=function(){function z(Z){var J=(0,S.getLayoutByName)(Z.type);this.layoutInstance=new J(Z)}return z.prototype.layout=function(Z){return this.layoutInstance.layout(Z)},z.prototype.updateCfg=function(Z){this.layoutInstance.updateCfg(Z)},z.prototype.init=function(Z){this.layoutInstance.init(Z)},z.prototype.execute=function(){this.layoutInstance.execute()},z.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},z.prototype.destroy=function(){return this.layoutInstance.destroy()},z}();x.Layout=V,x.Layouts={force:A.ForceLayout,fruchterman:T.FruchtermanLayout,forceAtlas2:g.ForceAtlas2Layout,gForce:I.GForceLayout,force2:E.Force2Layout,dagre:p.DagreLayout,dagreCompound:Y.DagreCompoundLayout,circular:v.CircularLayout,radial:c.RadialLayout,concentric:f.ConcentricLayout,grid:B.GridLayout,mds:l.MDSLayout,comboForce:O.ComboForceLayout,comboCombined:D.ComboCombinedLayout,random:N.RandomLayout,"gForce-gpu":w.GForceGPULayout,"fruchterman-gpu":m.FruchtermanGPULayout,er:_.ERLayout}},98204:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var A=function(v,p){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(c[l]=f[l])},A(v,p)};return function(v,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");A(v,p);function c(){this.constructor=v}v.prototype=p===null?Object.create(p):(c.prototype=p.prototype,new c)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.MDSLayout=void 0;var B=M(52710),N=M(8273),E=M(46253),I=function(A){S(v,A);function v(p){var c=A.call(this)||this;return c.center=[0,0],c.linkDistance=50,c.nodes=[],c.edges=[],c.onLayoutEnd=function(){},c.updateCfg(p),c}return v.prototype.getDefaultCfg=function(){return{center:[0,0],linkDistance:50}},v.prototype.execute=function(){var p=this,c=p.nodes,f=p.edges,l=f===void 0?[]:f,T=p.center;if(!c||c.length===0){p.onLayoutEnd&&p.onLayoutEnd();return}if(c.length===1){c[0].x=T[0],c[0].y=T[1],p.onLayoutEnd&&p.onLayoutEnd();return}var m=p.linkDistance,w=(0,N.getAdjMatrix)({nodes:c,edges:l},!1),O=(0,N.floydWarshall)(w);p.handleInfinity(O);var D=(0,N.scaleMatrix)(O,m);p.scaledDistances=D;var g=p.runMDS();return p.positions=g,g.forEach(function(_,Y){c[Y].x=_[0]+T[0],c[Y].y=_[1]+T[1]}),p.onLayoutEnd&&p.onLayoutEnd(),{nodes:c,edges:l}},v.prototype.runMDS=function(){var p=this,c=2,f=p.scaledDistances,l=B.Matrix.mul(B.Matrix.pow(f,2),-.5),T=l.mean("row"),m=l.mean("column"),w=l.mean();l.add(w).subRowVector(T).subColumnVector(m);var O=new B.SingularValueDecomposition(l),D=B.Matrix.sqrt(O.diagonalMatrix).diagonal();return O.leftSingularVectors.toJSON().map(function(g){return B.Matrix.mul([g],[D]).toJSON()[0].splice(0,c)})},v.prototype.handleInfinity=function(p){var c=-999999;p.forEach(function(f){f.forEach(function(l){l!==Infinity&&c<l&&(c=l)})}),p.forEach(function(f,l){f.forEach(function(T,m){T===Infinity&&(p[l][m]=c)})})},v.prototype.getType=function(){return"mds"},v}(E.Base);x.MDSLayout=I},90106:function(dt,x,M){"use strict";var S=this&&this.__createBinding||(Object.create?function(N,E,I,A){A===void 0&&(A=I);var v=Object.getOwnPropertyDescriptor(E,I);(!v||("get"in v?!E.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return E[I]}}),Object.defineProperty(N,A,v)}:function(N,E,I,A){A===void 0&&(A=I),N[A]=E[I]}),B=this&&this.__exportStar||function(N,E){for(var I in N)I!=="default"&&!Object.prototype.hasOwnProperty.call(E,I)&&S(E,N,I)};Object.defineProperty(x,"__esModule",{value:!0}),B(M(54652),x)},87e3:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var S=M(52710),B=function(){function N(E){this.distances=E.distances,this.dimension=E.dimension||2,this.linkDistance=E.linkDistance}return N.prototype.layout=function(){var E=this,I=E.dimension,A=E.distances,v=E.linkDistance;try{var p=S.Matrix.mul(S.Matrix.pow(A,2),-.5),c=p.mean("row"),f=p.mean("column"),l=p.mean();p.add(l).subRowVector(c).subColumnVector(f);var T=new S.SingularValueDecomposition(p),m=S.Matrix.sqrt(T.diagonalMatrix).diagonal();return T.leftSingularVectors.toJSON().map(function(_){return S.Matrix.mul([_],[m]).toJSON()[0].splice(0,I)})}catch(_){for(var w=[],O=0;O<A.length;O++){var D=Math.random()*v,g=Math.random()*v;w.push([D,g])}return w}},N}();x.default=B},54652:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var l=function(T,m){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(w,O){w.__proto__=O}||function(w,O){for(var D in O)Object.prototype.hasOwnProperty.call(O,D)&&(w[D]=O[D])},l(T,m)};return function(T,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");l(T,m);function w(){this.constructor=T}T.prototype=m===null?Object.create(m):(w.prototype=m.prototype,new w)}}(),B=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(x,"__esModule",{value:!0}),x.RadialLayout=void 0;var N=M(8273),E=M(46253),I=B(M(87e3)),A=B(M(78614));function v(l){for(var T=l.length,m=l[0].length,w=[],O=0;O<T;O++){for(var D=[],g=0;g<m;g++)l[O][g]!==0?D.push(1/(l[O][g]*l[O][g])):D.push(0);w.push(D)}return w}function p(l,T){var m=-1;return l.forEach(function(w,O){w.id===T&&(m=O)}),m}function c(l,T){return Math.sqrt((l[0]-T[0])*(l[0]-T[0])+(l[1]-T[1])*(l[1]-T[1]))}var f=function(l){S(T,l);function T(m){var w=l.call(this)||this;return w.maxIteration=1e3,w.focusNode=null,w.unitRadius=null,w.linkDistance=50,w.preventOverlap=!1,w.strictRadial=!0,w.maxPreventOverlapIteration=200,w.sortStrength=10,w.nodes=[],w.edges=[],w.updateCfg(m),w}return T.prototype.getDefaultCfg=function(){return{maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,nodeSize:void 0,nodeSpacing:void 0,strictRadial:!0,maxPreventOverlapIteration:200,sortBy:void 0,sortStrength:10}},T.prototype.execute=function(){var m=this,w=m.nodes,O=m.edges||[];if(!w||w.length===0){m.onLayoutEnd&&m.onLayoutEnd();return}!m.width&&typeof window!="undefined"&&(m.width=window.innerWidth),!m.height&&typeof window!="undefined"&&(m.height=window.innerHeight),m.center||(m.center=[m.width/2,m.height/2]);var D=m.center;if(w.length===1){w[0].x=D[0],w[0].y=D[1],m.onLayoutEnd&&m.onLayoutEnd();return}var g=m.linkDistance,_=null;if((0,N.isString)(m.focusNode)){for(var Y=!1,V=0;V<w.length;V++)w[V].id===m.focusNode&&(_=w[V],m.focusNode=_,Y=!0,V=w.length);Y||(_=null)}else _=m.focusNode;_||(_=w[0],m.focusNode=_);var z=p(w,_.id);z<0&&(z=0),m.focusIndex=z;var Z=(0,N.getAdjMatrix)({nodes:w,edges:O},!1),J=(0,N.floydWarshall)(Z),ee=m.maxToFocus(J,z);m.handleInfinity(J,z,ee+1),m.distances=J;var Q=J[z],re=m.width||500,fe=m.height||500,me=re-D[0]>D[0]?D[0]:re-D[0],ae=fe-D[1]>D[1]?D[1]:fe-D[1];me===0&&(me=re/2),ae===0&&(ae=fe/2);var Ee=ae>me?me:ae,Le=Math.max.apply(Math,Q),De=[];Q.forEach(function(Be,We){m.unitRadius||(m.unitRadius=Ee/Le),De[We]=Be*m.unitRadius}),m.radii=De;var Ve=m.eIdealDisMatrix();m.eIdealDistances=Ve;var et=v(Ve);m.weights=et;var It=new I.default({linkDistance:g,distances:Ve}),er=It.layout();er.forEach(function(Be){(0,N.isNaN)(Be[0])&&(Be[0]=Math.random()*g),(0,N.isNaN)(Be[1])&&(Be[1]=Math.random()*g)}),m.positions=er,er.forEach(function(Be,We){w[We].x=Be[0]+D[0],w[We].y=Be[1]+D[1]}),er.forEach(function(Be){Be[0]-=er[z][0],Be[1]-=er[z][1]}),m.run();var nr=m.preventOverlap,Fe=m.nodeSize,Vt,$t=m.strictRadial;if(nr){var Ar=m.nodeSpacing,ke;(0,N.isNumber)(Ar)?ke=function(){return Ar}:(0,N.isFunction)(Ar)?ke=Ar:ke=function(){return 0},Fe?(0,N.isArray)(Fe)?Vt=function(Be){var We=Fe[0]>Fe[1]?Fe[0]:Fe[1];return We+ke(Be)}:Vt=function(Be){return Fe+ke(Be)}:Vt=function(Be){if(Be.size){if((0,N.isArray)(Be.size)){var We=Be.size[0]>Be.size[1]?Be.size[0]:Be.size[1];return We+ke(Be)}if((0,N.isObject)(Be.size)){var We=Be.size.width>Be.size.height?Be.size.width:Be.size.height;return We+ke(Be)}return Be.size+ke(Be)}return 10+ke(Be)};var Oe={nodes:w,nodeSizeFunc:Vt,adjMatrix:Z,positions:er,radii:De,height:fe,width:re,strictRadial:$t,focusID:z,iterations:m.maxPreventOverlapIteration||200,k:er.length/4.5},we=new A.default(Oe);er=we.layout()}return er.forEach(function(Be,We){w[We].x=Be[0]+D[0],w[We].y=Be[1]+D[1]}),m.onLayoutEnd&&m.onLayoutEnd(),{nodes:w,edges:O}},T.prototype.run=function(){for(var m=this,w=m.maxIteration,O=m.positions||[],D=m.weights||[],g=m.eIdealDistances||[],_=m.radii||[],Y=0;Y<=w;Y++){var V=Y/w;m.oneIteration(V,O,_,g,D)}},T.prototype.oneIteration=function(m,w,O,D,g){var _=this,Y=1-m,V=_.focusIndex;w.forEach(function(z,Z){var J=c(z,[0,0]),ee=J===0?0:1/J;if(Z!==V){var Q=0,re=0,fe=0;w.forEach(function(ae,Ee){if(Z!==Ee){var Le=c(z,ae),De=Le===0?0:1/Le,Ve=D[Ee][Z];fe+=g[Z][Ee],Q+=g[Z][Ee]*(ae[0]+Ve*(z[0]-ae[0])*De),re+=g[Z][Ee]*(ae[1]+Ve*(z[1]-ae[1])*De)}});var me=O[Z]===0?0:1/O[Z];fe*=Y,fe+=m*me*me,Q*=Y,Q+=m*me*z[0]*ee,z[0]=Q/fe,re*=Y,re+=m*me*z[1]*ee,z[1]=re/fe}})},T.prototype.eIdealDisMatrix=function(){var m=this,w=m.nodes;if(!w)return[];var O=m.distances,D=m.linkDistance,g=m.radii||[],_=m.unitRadius||50,Y=[];return O&&O.forEach(function(V,z){var Z=[];V.forEach(function(J,ee){if(z===ee)Z.push(0);else if(g[z]===g[ee])if(m.sortBy==="data")Z.push(J*(Math.abs(z-ee)*m.sortStrength)/(g[z]/_));else if(m.sortBy){var Q=w[z][m.sortBy]||0,re=w[ee][m.sortBy]||0;(0,N.isString)(Q)&&(Q=Q.charCodeAt(0)),(0,N.isString)(re)&&(re=re.charCodeAt(0)),Z.push(J*(Math.abs(Q-re)*m.sortStrength)/(g[z]/_))}else Z.push(J*D/(g[z]/_));else{var fe=(D+_)/2;Z.push(J*fe)}}),Y.push(Z)}),Y},T.prototype.handleInfinity=function(m,w,O){for(var D=m.length,g=0;g<D;g++)if(m[w][g]===Infinity){m[w][g]=O,m[g][w]=O;for(var _=0;_<D;_++)m[g][_]!==Infinity&&m[w][_]===Infinity&&(m[w][_]=O+m[g][_],m[_][w]=O+m[g][_])}for(var g=0;g<D;g++)if(g!==w){for(var _=0;_<D;_++)if(m[g][_]===Infinity){var Y=Math.abs(m[w][g]-m[w][_]);Y=Y===0?1:Y,m[g][_]=Y}}},T.prototype.maxToFocus=function(m,w){for(var O=0,D=0;D<m[w].length;D++)m[w][D]!==Infinity&&(O=m[w][D]>O?m[w][D]:O);return O},T.prototype.getType=function(){return"radial"},T}(E.Base);x.RadialLayout=f},78614:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=800,S=function(){function B(N){this.disp=[],this.positions=N.positions,this.adjMatrix=N.adjMatrix,this.focusID=N.focusID,this.radii=N.radii,this.iterations=N.iterations||10,this.height=N.height||10,this.width=N.width||10,this.speed=N.speed||100,this.gravity=N.gravity||10,this.nodeSizeFunc=N.nodeSizeFunc,this.k=N.k||5,this.strictRadial=N.strictRadial,this.nodes=N.nodes}return B.prototype.layout=function(){var N=this,E=N.positions,I=[],A=N.iterations,v=N.width/10;N.maxDisplace=v,N.disp=I;for(var p=0;p<A;p++)E.forEach(function(c,f){I[f]={x:0,y:0}}),N.getRepulsion(),N.updatePositions();return E},B.prototype.getRepulsion=function(){var N=this,E=N.positions,I=N.nodes,A=N.disp,v=N.k,p=N.radii||[];E.forEach(function(c,f){A[f]={x:0,y:0},E.forEach(function(l,T){if(f!==T&&p[f]===p[T]){var m=c[0]-l[0],w=c[1]-l[1],O=Math.sqrt(m*m+w*w);if(O===0){O=1;var D=f>T?1:-1;m=.01*D,w=.01*D}if(O<N.nodeSizeFunc(I[f])/2+N.nodeSizeFunc(I[T])/2){var g=v*v/O;A[f].x+=m/O*g,A[f].y+=w/O*g}}})})},B.prototype.updatePositions=function(){var N=this,E=N.positions,I=N.disp,A=N.speed,v=N.strictRadial,p=N.focusID,c=N.maxDisplace||N.width/10;v&&I.forEach(function(l,T){var m=E[T][0]-E[p][0],w=E[T][1]-E[p][1],O=Math.sqrt(m*m+w*w),D=w/O,g=-m/O,_=Math.sqrt(l.x*l.x+l.y*l.y),Y=Math.acos((D*l.x+g*l.y)/_);Y>Math.PI/2&&(Y-=Math.PI/2,D*=-1,g*=-1);var V=Math.cos(Y)*_;l.x=D*V,l.y=g*V});var f=N.radii;E.forEach(function(l,T){if(T!==p){var m=Math.sqrt(I[T].x*I[T].x+I[T].y*I[T].y);if(m>0&&T!==p){var w=Math.min(c*(A/M),m);if(l[0]+=I[T].x/m*w,l[1]+=I[T].y/m*w,v){var O=l[0]-E[p][0],D=l[1]-E[p][1],g=Math.sqrt(O*O+D*D);O=O/g*f[T],D=D/g*f[T],l[0]=E[p][0]+O,l[1]=E[p][1]+D}}}})},B}();x.default=S},26729:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var E=function(I,A){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,p){v.__proto__=p}||function(v,p){for(var c in p)Object.prototype.hasOwnProperty.call(p,c)&&(v[c]=p[c])},E(I,A)};return function(I,A){if(typeof A!="function"&&A!==null)throw new TypeError("Class extends value "+String(A)+" is not a constructor or null");E(I,A);function v(){this.constructor=I}I.prototype=A===null?Object.create(A):(v.prototype=A.prototype,new v)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.RandomLayout=void 0;var B=M(46253),N=function(E){S(I,E);function I(A){var v=E.call(this)||this;return v.center=[0,0],v.width=300,v.height=300,v.nodes=[],v.edges=[],v.onLayoutEnd=function(){},v.updateCfg(A),v}return I.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},I.prototype.execute=function(){var A=this,v=A.nodes,p=.9,c=A.center;return!A.width&&typeof window!="undefined"&&(A.width=window.innerWidth),!A.height&&typeof window!="undefined"&&(A.height=window.innerHeight),v&&v.forEach(function(f){f.x=(Math.random()-.5)*p*A.width+c[0],f.y=(Math.random()-.5)*p*A.height+c[1]}),A.onLayoutEnd&&A.onLayoutEnd(),{nodes:v,edges:this.edges}},I.prototype.getType=function(){return"random"},I}(B.Base);x.RandomLayout=N},2230:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0})},39464:function(dt,x,M){"use strict";var S=this&&this.__extends||function(){var p=function(c,f){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,T){l.__proto__=T}||function(l,T){for(var m in T)Object.prototype.hasOwnProperty.call(T,m)&&(l[m]=T[m])},p(c,f)};return function(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");p(c,f);function l(){this.constructor=c}c.prototype=f===null?Object.create(f):(l.prototype=f.prototype,new l)}}();Object.defineProperty(x,"__esModule",{value:!0}),x.getLayoutByName=x.unRegisterLayout=x.registerLayout=void 0;var B=M(46253),N=M(8273),E=new Map,I=function(p,c){if(E.get(p)&&console.warn("The layout with the name ".concat(p," exists already, it will be overridden")),(0,N.isObject)(c)){var f=function(l){S(T,l);function T(m){var w=l.call(this)||this,O=w,D={},g=O.getDefaultCfg();return Object.assign(D,g,c,m),Object.keys(D).forEach(function(_){var Y=D[_];O[_]=Y}),w}return T}(B.Base);E.set(p,f)}else E.set(p,c);return E.get(p)};x.registerLayout=I;var A=function(p){E.has(p)&&E.delete(p)};x.unRegisterLayout=A;var v=function(p){return E.has(p)?E.get(p):null};x.getLayoutByName=v},92272:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.isArray=void 0,x.isArray=Array.isArray},72612:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.getFuncByUnknownType=x.getFunc=x.isFunction=void 0;var S=M(8273),B=M(5049),N=function(A){return typeof A=="function"};x.isFunction=N;var E=function(A,v,p){var c;return p?c=p:(0,B.isNumber)(A)?c=function(){return A}:c=function(){return v},c};x.getFunc=E;var I=function(A,v,p){return p===void 0&&(p=!0),!v&&v!==0?function(c){return c.size?(0,S.isArray)(c.size)?c.size[0]>c.size[1]?c.size[0]:c.size[1]:(0,S.isObject)(c.size)?c.size.width>c.size.height?c.size.width:c.size.height:c.size:A}:(0,x.isFunction)(v)?v:(0,B.isNumber)(v)?function(){return v}:(0,S.isArray)(v)?function(){if(p){var c=Math.max.apply(Math,v);return isNaN(c)?A:c}return v}:(0,S.isObject)(v)?function(){if(p){var c=Math.max(v.width,v.height);return isNaN(c)?A:c}return[v.width,v.height]}:function(){return A}};x.getFuncByUnknownType=I},38342:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.arrayToTextureData=x.attributesToTextureData=x.buildTextureDataWithTwoEdgeAttr=x.buildTextureData=x.proccessToFunc=void 0;var S=M(8273),B=M(64446),N=function(p,c){var f;return p?(0,S.isNumber)(p)?f=function(){return p}:f=p:f=function(){return c||1},f};x.proccessToFunc=N;var E=function(p,c){var f=[],l=[],T={},m=0;for(m=0;m<p.length;m++){var w=p[m];T[w.id]=m,f.push(w.x),f.push(w.y),f.push(0),f.push(0),l.push([])}for(m=0;m<c.length;m++){var O=c[m],D=(0,B.getEdgeTerminal)(O,"source"),g=(0,B.getEdgeTerminal)(O,"target");!isNaN(T[D])&&!isNaN(T[g])&&(l[T[D]].push(T[g]),l[T[g]].push(T[D]))}var _=0;for(m=0;m<p.length;m++){var Y=f.length,V=l[m],z=V.length;console.log("dests",V,z),f[m*4+2]=Y,f[m*4+3]=z,_=Math.max(_,z);for(var Z=0;Z<z;++Z){var J=V[Z];f.push(+J)}}for(;f.length%4!=0;)f.push(0);return{maxEdgePerVetex:_,array:new Float32Array(f)}};x.buildTextureData=E;var I=function(p,c,f,l){var T=[],m=[],w={},O=0;for(O=0;O<p.length;O++){var D=p[O];w[D.id]=O,T.push(D.x),T.push(D.y),T.push(0),T.push(0),m.push([])}for(O=0;O<c.length;O++){var g=c[O],_=(0,B.getEdgeTerminal)(g,"source"),Y=(0,B.getEdgeTerminal)(g,"target");m[w[_]].push(w[Y]),m[w[_]].push(f(g)),m[w[_]].push(l(g)),m[w[_]].push(0),m[w[Y]].push(w[_]),m[w[Y]].push(f(g)),m[w[Y]].push(l(g)),m[w[Y]].push(0)}var V=0;for(O=0;O<p.length;O++){var z=T.length,Z=m[O],J=Z.length;T[O*4+2]=z+1048576*J/4,T[O*4+3]=0,V=Math.max(V,J/4);for(var ee=0;ee<J;++ee){var Q=Z[ee];T.push(+Q)}}for(;T.length%4!=0;)T.push(0);return{maxEdgePerVetex:V,array:new Float32Array(T)}};x.buildTextureDataWithTwoEdgeAttr=I;var A=function(p,c){var f=[],l=p.length,T={};return c.forEach(function(m){p.forEach(function(w,O){if(T[m[w]]===void 0&&(T[m[w]]=Object.keys(T).length),f.push(T[m[w]]),O===l-1)for(;f.length%4!=0;)f.push(0)})}),{array:new Float32Array(f),count:Object.keys(T).length}};x.attributesToTextureData=A;var v=function(p){for(var c=[],f=p.length,l=p[0].length,T=function(w){p.forEach(function(O,D){if(c.push(O[w]),D===f-1)for(;c.length%4!=0;)c.push(0)})},m=0;m<l;m++)T(m);return new Float32Array(c)};x.arrayToTextureData=v},8273:function(dt,x,M){"use strict";var S=this&&this.__createBinding||(Object.create?function(N,E,I,A){A===void 0&&(A=I);var v=Object.getOwnPropertyDescriptor(E,I);(!v||("get"in v?!E.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:function(){return E[I]}}),Object.defineProperty(N,A,v)}:function(N,E,I,A){A===void 0&&(A=I),N[A]=E[I]}),B=this&&this.__exportStar||function(N,E){for(var I in N)I!=="default"&&!Object.prototype.hasOwnProperty.call(E,I)&&S(E,N,I)};Object.defineProperty(x,"__esModule",{value:!0}),B(M(42761),x),B(M(92272),x),B(M(5049),x),B(M(64446),x),B(M(98857),x),B(M(72612),x)},64446:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.getCoreNodeAndRelativeLeafNodes=x.getAvgNodePosition=x.findMinMaxNodeXY=x.traverseTreeUp=x.scaleMatrix=x.getAdjMatrix=x.floydWarshall=x.getDegreeMap=x.getDegree=x.getEdgeTerminal=void 0;var S=M(98857),B=function(D,g){var _=D[g];return(0,S.isObject)(_)?_.cell:_};x.getEdgeTerminal=B;var N=function(D,g,_){for(var Y=[],V=0;V<D;V++)Y[V]={in:0,out:0,all:0};return _&&_.forEach(function(z){var Z=(0,x.getEdgeTerminal)(z,"source"),J=(0,x.getEdgeTerminal)(z,"target");Z&&Y[g[Z]]&&(Y[g[Z]].out+=1,Y[g[Z]].all+=1),J&&Y[g[J]]&&(Y[g[J]].in+=1,Y[g[J]].all+=1)}),Y};x.getDegree=N;var E=function(D,g){var _={};return D.forEach(function(Y){_[Y.id]={in:0,out:0,all:0}}),g&&g.forEach(function(Y){var V=(0,x.getEdgeTerminal)(Y,"source"),z=(0,x.getEdgeTerminal)(Y,"target");V&&(_[V].out+=1,_[V].all+=1),z&&(_[z].in+=1,_[z].all+=1)}),_};x.getDegreeMap=E;var I=function(D){for(var g=[],_=D.length,Y=0;Y<_;Y+=1){g[Y]=[];for(var V=0;V<_;V+=1)Y===V?g[Y][V]=0:D[Y][V]===0||!D[Y][V]?g[Y][V]=Infinity:g[Y][V]=D[Y][V]}for(var z=0;z<_;z+=1)for(var Y=0;Y<_;Y+=1)for(var V=0;V<_;V+=1)g[Y][V]>g[Y][z]+g[z][V]&&(g[Y][V]=g[Y][z]+g[z][V]);return g};x.floydWarshall=I;var A=function(D,g){var _=D.nodes,Y=D.edges,V=[],z={};if(!_)throw new Error("invalid nodes data!");return _&&_.forEach(function(Z,J){z[Z.id]=J;var ee=[];V.push(ee)}),Y&&Y.forEach(function(Z){var J=(0,x.getEdgeTerminal)(Z,"source"),ee=(0,x.getEdgeTerminal)(Z,"target"),Q=z[J],re=z[ee];V[Q][re]=1,g||(V[re][Q]=1)}),V};x.getAdjMatrix=A;var v=function(D,g){var _=[];return D.forEach(function(Y){var V=[];Y.forEach(function(z){V.push(z*g)}),_.push(V)}),_};x.scaleMatrix=v;var p=function(D,g){if(D&&D.children){for(var _=D.children.length-1;_>=0;_--)if(!p(D.children[_],g))return}return!!g(D)},c=function(D,g){typeof g=="function"&&p(D,g)};x.traverseTreeUp=c;var f=function(D){var g=Infinity,_=Infinity,Y=-Infinity,V=-Infinity;return D.forEach(function(z){g>z.x&&(g=z.x),_>z.y&&(_=z.y),Y<z.x&&(Y=z.x),V<z.y&&(V=z.y)}),{minX:g,minY:_,maxX:Y,maxY:V}};x.findMinMaxNodeXY=f;var l=function(D){var g={x:0,y:0};D.forEach(function(Y){g.x+=Y.x||0,g.y+=Y.y||0});var _=D.length||1;return{x:g.x/_,y:g.y/_}};x.getAvgNodePosition=l;var T=function(D,g,_){var Y,V;return D==="source"?((Y=_==null?void 0:_.find(function(z){return z.target===g.id}))===null||Y===void 0?void 0:Y.source)||{}:((V=_==null?void 0:_.find(function(z){return z.source===g.id}))===null||V===void 0?void 0:V.target)||{}},m=function(D,g,_){var Y=[];switch(D){case"source":Y=_==null?void 0:_.filter(function(z){return z.source===g.id}).map(function(z){return z.target});break;case"target":Y=_==null?void 0:_.filter(function(z){return z.target===g.id}).map(function(z){return z.source});break;case"both":Y=_==null?void 0:_.filter(function(z){return z.source===g.id}).map(function(z){return z.target}).concat(_==null?void 0:_.filter(function(z){return z.target===g.id}).map(function(z){return z.source}));break;default:break}var V=new Set(Y);return Array.from(V)},w=function(D,g,_,Y,V){var z=_[g]||"",Z=(Y==null?void 0:Y.filter(function(J){return J[g]===z}))||[];return D==="leaf"&&(Z=Z.filter(function(J){var ee,Q;return((ee=V[J.id])===null||ee===void 0?void 0:ee.in)===0||((Q=V[J.id])===null||Q===void 0?void 0:Q.out)===0})),Z},O=function(D,g,_,Y,V,z){var Z=V[g.id],J=Z.in,ee=Z.out,Q=g,re=[];J===0?(Q=T("source",g,_),re=m("both",Q,_).map(function(me){return z[me]})):ee===0&&(Q=T("target",g,_),re=m("both",Q,_).map(function(me){return z[me]})),re=re.filter(function(me){return V[me.id]&&(V[me.id].in===0||V[me.id].out===0)});var fe=w(D,Y,g,re,V);return{coreNode:Q,relativeLeafNodes:re,sameTypeLeafNodes:fe}};x.getCoreNodeAndRelativeLeafNodes=O},5049:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.toNumber=x.isNaN=x.isNumber=void 0;var M=function(N){return typeof N=="number"};x.isNumber=M;var S=function(N){return Number.isNaN(Number(N))};x.isNaN=S;var B=function(N){var E=parseFloat(N);return(0,x.isNaN)(E)?N:E};x.toNumber=B},98857:function(dt,x){"use strict";var M=this&&this.__assign||function(){return M=Object.assign||function(N){for(var E,I=1,A=arguments.length;I<A;I++){E=arguments[I];for(var v in E)Object.prototype.hasOwnProperty.call(E,v)&&(N[v]=E[v])}return N},M.apply(this,arguments)};Object.defineProperty(x,"__esModule",{value:!0}),x.clone=x.isObject=void 0;var S=function(N){return N!==null&&typeof N=="object"};x.isObject=S;var B=function(N){if(N===null)return N;if(N instanceof Date)return new Date(N.getTime());if(N instanceof Array){var E=[];return N.forEach(function(A){E.push(A)}),E.map(function(A){return(0,x.clone)(A)})}if(typeof N=="object"&&N!=={}){var I=M({},N);return Object.keys(I).forEach(function(A){I[A]=(0,x.clone)(I[A])}),I}return N};x.clone=B},42761:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.camelize=x.isString=void 0;var M=function(N){return typeof N=="string"};x.isString=M;var S=function(N){var E=Object.create(null);return function(I){var A=E[I];return A||(E[I]=N(I))}},B=/-(\w)/g;x.camelize=S(function(N){return N.replace(B,function(E,I){return I?I.toUpperCase():""})})},69787:function(dt,x,M){"use strict";M.r(x),M.d(x,{Graph:function(){return J},GraphWithEvent:function(){return nr},algorithm:function(){return S},comparision:function(){return N},essence:function(){return B},generate:function(){return E}});var S={};M.r(S),M.d(S,{components:function(){return Be},dfs:function(){return St},dijkstra:function(){return ft},dijkstraAll:function(){return Lt},findCycles:function(){return at},floydWarshall:function(){return Ne},isAcyclic:function(){return Mn},postorder:function(){return Se},preorder:function(){return R},prim:function(){return Oe},tarjan:function(){return vr},topsort:function(){return Un}});var B={};M.r(B),M.d(B,{hasSelfLoop:function(){return Gr},isGraph:function(){return lr},isNullGraph:function(){return yr},isSimpleGraph:function(){return dr}});var N={};M.r(N),M.d(N,{containAllSameEdges:function(){return ur},containAllSameNodes:function(){return kr},containSameEdges:function(){return Ke},containSameNodes:function(){return Pe},getSameEdges:function(){return Rt},getSameNodes:function(){return Ut},isGraphComplement:function(){return Jr},isGraphContainsAnother:function(){return On},isGraphOptionSame:function(){return fr},isGraphSame:function(){return rn}});var E={};M.r(E),M.d(E,{getGraphComplement:function(){return Sr}});var I;(function(lt){lt.DEFAULT_EDGE_NAME="\0",lt.GRAPH_NODE="\0",lt.EDGE_KEY_DELIM=""})(I||(I={}));function A(lt,Ae){var Ye=lt.get(Ae)||0;lt.set(Ae,Ye+1)}function v(lt,Ae){var Ye=lt.get(Ae);Ye!==void 0&&(Ye=Ye-1,Ye>0?lt.set(Ae,Ye):lt.delete(Ae))}function p(lt,Ae,Ye,Tt){var pt=String(Ae),kt=String(Ye);if(!lt&&pt>kt){var ar=pt;pt=kt,kt=ar}return pt+I.EDGE_KEY_DELIM+kt+I.EDGE_KEY_DELIM+(Tt===void 0?I.DEFAULT_EDGE_NAME:Tt)}function c(lt,Ae,Ye,Tt){var pt=String(Ae),kt=String(Ye),ar={v:Ae,w:Ye};if(!lt&&pt>kt){var jr=ar.v;ar.v=ar.w,ar.w=jr}return Tt!==void 0&&(ar.name=Tt),ar}function f(lt,Ae){return p(lt,Ae.v,Ae.w,Ae.name)}function l(lt){return typeof lt=="function"}var T=function(Ae){return Ae.nodes().map(function(Ye){var Tt=Ae.node(Ye),pt=Ae.parent(Ye),kt={id:Ye,value:Tt,parent:pt};return kt.value===void 0&&delete kt.value,kt.parent===void 0&&delete kt.parent,kt})},m=function(Ae){return Ae.edges().map(function(Ye){var Tt=Ae.edge(Ye),pt={v:Ye.v,w:Ye.w,value:Tt,name:Ye.name};return pt.name===void 0&&delete pt.name,pt.value===void 0&&delete pt.value,pt})},w=function(Ae){var Ye={options:{directed:Ae.isDirected(),multigraph:Ae.isMultigraph(),compound:Ae.isCompound()},nodes:T(Ae),edges:m(Ae),value:Ae.graph()};return Ye.value===void 0&&delete Ye.value,Ye},O=function(Ae){var Ye=new J(Ae.options);return Ae.value!==void 0&&Ye.setGraph(Ae.value),Ae.nodes.forEach(function(Tt){Ye.setNode(Tt.id,Tt.value),Tt.parent&&Ye.setParent(Tt.id,Tt.parent)}),Ae.edges.forEach(function(Tt){Ye.setEdge(Tt.v,Tt.w,Tt.value,Tt.name)}),Ye};function D(lt,Ae){var Ye=Object.keys(lt);if(Object.getOwnPropertySymbols){var Tt=Object.getOwnPropertySymbols(lt);Ae&&(Tt=Tt.filter(function(pt){return Object.getOwnPropertyDescriptor(lt,pt).enumerable})),Ye.push.apply(Ye,Tt)}return Ye}function g(lt){for(var Ae=1;Ae<arguments.length;Ae++){var Ye=arguments[Ae]!=null?arguments[Ae]:{};Ae%2?D(Object(Ye),!0).forEach(function(Tt){_(lt,Tt,Ye[Tt])}):Object.getOwnPropertyDescriptors?Object.defineProperties(lt,Object.getOwnPropertyDescriptors(Ye)):D(Object(Ye)).forEach(function(Tt){Object.defineProperty(lt,Tt,Object.getOwnPropertyDescriptor(Ye,Tt))})}return lt}function _(lt,Ae,Ye){return Ae in lt?Object.defineProperty(lt,Ae,{value:Ye,enumerable:!0,configurable:!0,writable:!0}):lt[Ae]=Ye,lt}function Y(lt,Ae){if(!(lt instanceof Ae))throw new TypeError("Cannot call a class as a function")}function V(lt,Ae){for(var Ye=0;Ye<Ae.length;Ye++){var Tt=Ae[Ye];Tt.enumerable=Tt.enumerable||!1,Tt.configurable=!0,"value"in Tt&&(Tt.writable=!0),Object.defineProperty(lt,Tt.key,Tt)}}function z(lt,Ae,Ye){return Ae&&V(lt.prototype,Ae),Ye&&V(lt,Ye),Object.defineProperty(lt,"prototype",{writable:!1}),lt}var Z={compound:!1,multigraph:!1,directed:!0},J=function(){function lt(){var Ae=this,Ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Y(this,lt),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=I.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 Ae.directed},this.isMultigraph=function(){return Ae.multigraph},this.isCompound=function(){return Ae.compound},this.setGraph=function(pt){return Ae.label=pt,Ae},this.graph=function(){return Ae.label},this.setDefaultNodeLabel=function(pt){return l(pt)?Ae.defaultNodeLabelFn=pt:Ae.defaultNodeLabelFn=function(){return pt},Ae},this.nodeCount=function(){return Ae.nodeCountNum},this.node=function(pt){return Ae.nodesLabelMap.get(pt)},this.nodes=function(){return Array.from(Ae.nodesLabelMap.keys())},this.sources=function(){return Ae.nodes().filter(function(pt){var kt;return!((kt=Ae.inEdgesMap.get(pt))===null||kt===void 0?void 0:kt.size)})},this.sinks=function(){return Ae.nodes().filter(function(pt){var kt;return!((kt=Ae.outEdgesMap.get(pt))===null||kt===void 0?void 0:kt.size)})},this.setNodes=function(pt,kt){return pt.map(function(ar){return Ae.setNode(ar,kt)}),Ae},this.hasNode=function(pt){return Ae.nodesLabelMap.has(pt)},this.checkCompound=function(){if(!Ae.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(pt){if(Ae.isCompound()){var kt,ar=(kt=Ae.parentMap)===null||kt===void 0?void 0:kt.get(pt);if(ar!==Ae.GRAPH_NODE)return ar}},this.removeFromParentsChildList=function(pt){var kt=Ae.parentMap.get(pt);Ae.childrenMap.get(kt).delete(pt)},this.setParent=function(pt,kt){var ar,jr;Ae.checkCompound();for(var tn=kt===void 0?Ae.GRAPH_NODE:kt,Ln=Ae.parent(tn);Ln;){if(pt===Ln)throw new Error("Setting "+kt+" as parent of "+pt+" would create a cycle");Ln=Ae.parent(Ln)}kt&&Ae.setNode(kt),Ae.setNode(pt),Ae.removeFromParentsChildList(pt),(ar=Ae.parentMap)===null||ar===void 0||ar.set(pt,tn);var Dn=Ae.childrenMap.get(tn);return Dn.set(pt,!0),(jr=Ae.childrenMap)===null||jr===void 0||jr.set(tn,Dn),Ae},this.children=function(pt){var kt=pt===void 0?Ae.GRAPH_NODE:pt;if(Ae.isCompound()){var ar,jr=(ar=Ae.childrenMap)===null||ar===void 0?void 0:ar.get(kt);return jr?Array.from(jr.keys()):void 0}if(kt===Ae.GRAPH_NODE)return Ae.nodes();if(pt&&Ae.hasNode(pt))return[]},this.predecessors=function(pt){var kt=Ae.predecessorsMap.get(pt);return kt?Array.from(kt.keys()):void 0},this.successors=function(pt){var kt=Ae.successorsMap.get(pt);return kt?Array.from(kt.keys()):void 0},this.neighbors=function(pt){var kt;if(!!Ae.hasNode(pt))return Array.from(new Set((kt=Ae.predecessors(pt))===null||kt===void 0?void 0:kt.concat(Ae.successors(pt))))},this.isLeaf=function(pt){var kt;if(Ae.isDirected()){var ar;return!((ar=Ae.successors(pt))===null||ar===void 0?void 0:ar.length)}return!((kt=Ae.neighbors(pt))===null||kt===void 0?void 0:kt.length)},this.filterNodes=function(pt){var kt=Ae.directed,ar=Ae.multigraph,jr=Ae.compound,tn=new lt({directed:kt,multigraph:ar,compound:jr});if(tn.setGraph(Ae.graph()),Ae.nodes().forEach(function(Dn){pt(Dn)&&tn.setNode(Dn,Ae.node(Dn))}),Ae.edges().forEach(function(Dn){tn.hasNode(Dn.v)&&tn.hasNode(Dn.w)&&tn.setEdgeObj(Dn,Ae.edge(Dn))}),jr){var Ln=function($n){for(var ci=Ae.parent($n);ci!==void 0&&!tn.hasNode(ci);)ci=Ae.parent(ci);return ci};tn.nodes().forEach(function(Dn){tn.setParent(Dn,Ln(Dn))})}return tn},this.setDefaultEdgeLabel=function(pt){return l(pt)?Ae.defaultEdgeLabelFn=pt:Ae.defaultEdgeLabelFn=function(){return pt},Ae},this.edgeCount=function(){return Ae.edgeCountNum},this.setEdgeObj=function(pt,kt){return Ae.setEdge(pt.v,pt.w,kt,pt.name)},this.setPath=function(pt,kt){return pt.reduce(function(ar,jr){return Ae.setEdge(ar,jr,kt),jr}),Ae},this.edgeFromArgs=function(pt,kt,ar){return Ae.edge({v:pt,w:kt,name:ar})},this.edge=function(pt){return Ae.edgesLabelsMap.get(f(Ae.isDirected(),pt))},this.hasEdge=function(pt,kt,ar){return Ae.edgesLabelsMap.has(f(Ae.isDirected(),{v:pt,w:kt,name:ar}))},this.removeEdgeObj=function(pt){var kt=pt.v,ar=pt.w,jr=pt.name;return Ae.removeEdge(kt,ar,jr)},this.edges=function(){return Array.from(Ae.edgesMap.values())},this.inEdges=function(pt,kt){var ar=Ae.inEdgesMap.get(pt);if(ar)return Array.from(ar.values()).filter(function(jr){return!kt||jr.v===kt})},this.outEdges=function(pt,kt){var ar=Ae.outEdgesMap.get(pt);if(ar)return Array.from(ar.values()).filter(function(jr){return!kt||jr.w===kt})},this.nodeEdges=function(pt,kt){var ar;if(!!Ae.hasNode(pt))return(ar=Ae.inEdges(pt,kt))===null||ar===void 0?void 0:ar.concat(Ae.outEdges(pt,kt))},this.toJSON=function(){return w(Ae)},this.nodeInDegree=function(pt){var kt=Ae.inEdgesMap.get(pt);return kt?kt.size:0},this.nodeOutDegree=function(pt){var kt=Ae.outEdgesMap.get(pt);return kt?kt.size:0},this.nodeDegree=function(pt){return Ae.nodeInDegree(pt)+Ae.nodeOutDegree(pt)},this.source=function(pt){return pt.v},this.target=function(pt){return pt.w};var Tt=g(g({},Z),Ye);this.compound=Tt.compound,this.directed=Tt.directed,this.multigraph=Tt.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return z(lt,[{key:"setNode",value:function(Ye,Tt){var pt=this.nodesLabelMap,kt=this.defaultNodeLabelFn,ar=this.isCompound,jr=this.parentMap,tn=this.childrenMap,Ln=this.inEdgesMap,Dn=this.outEdgesMap,$n=this.predecessorsMap,ci=this.successorsMap;if(pt.has(Ye))return Tt!==void 0&&pt.set(Ye,Tt),this;if(pt.set(Ye,Tt||kt(Ye)),ar()){var Ii;jr==null||jr.set(Ye,this.GRAPH_NODE),tn==null||tn.set(Ye,new Map),(tn==null?void 0:tn.has(this.GRAPH_NODE))||tn==null||tn.set(this.GRAPH_NODE,new Map),tn==null||(Ii=tn.get(this.GRAPH_NODE))===null||Ii===void 0||Ii.set(Ye,!0)}return[Ln,Dn,$n,ci].forEach(function(ki){return ki.set(Ye,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(Ye){var Tt=this;if(this.hasNode(Ye)){var pt=function(Hn){Tt.removeEdge(Hn.v,Hn.w,Hn.name)},kt=this.inEdgesMap,ar=this.outEdgesMap,jr=this.predecessorsMap,tn=this.successorsMap,Ln=this.nodesLabelMap;if(this.isCompound()){var Dn,$n,ci;this.removeFromParentsChildList(Ye),(Dn=this.parentMap)===null||Dn===void 0||Dn.delete(Ye),($n=this.children(Ye))===null||$n===void 0||$n.forEach(function(zi){return Tt.setParent(zi)}),(ci=this.childrenMap)===null||ci===void 0||ci.delete(Ye)}var Ii=kt.get(Ye),ki=ar.get(Ye);Array.from(Ii.values()).forEach(function(zi){return pt(zi)}),Array.from(ki.values()).forEach(function(zi){return pt(zi)}),Ln.delete(Ye),kt.delete(Ye),ar.delete(Ye),jr.delete(Ye),tn.delete(Ye),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(Ye,Tt,pt,kt){var ar,jr,tn=c(this.isDirected(),Ye,Tt,kt),Ln=f(this.isDirected(),tn),Dn=tn.v,$n=tn.w;if(this.edgesLabelsMap.has(Ln))return this.edgesLabelsMap.set(Ln,pt),this;if(kt!==void 0&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(Dn),this.setNode($n),this.edgesLabelsMap.set(Ln,pt||this.defaultEdgeLabelFn(Dn,$n,kt)),Object.freeze(tn),this.edgesMap.set(Ln,tn);var ci=this.predecessorsMap.get($n),Ii=this.successorsMap.get(Dn);return A(ci,Dn),A(Ii,$n),(ar=this.inEdgesMap.get($n))===null||ar===void 0||ar.set(Ln,tn),(jr=this.outEdgesMap.get(Dn))===null||jr===void 0||jr.set(Ln,tn),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(Ye,Tt,pt){var kt=p(this.isDirected(),Ye,Tt,pt),ar=this.edgesMap.get(kt);if(ar){var jr=c(this.isDirected(),Ye,Tt,pt),tn=jr.v,Ln=jr.w;this.edgesLabelsMap.delete(kt),this.edgesMap.delete(kt);var Dn=this.predecessorsMap.get(Ln),$n=this.successorsMap.get(tn);v(Dn,tn),v($n,Ln),this.inEdgesMap.get(Ln).delete(kt),this.outEdgesMap.get(tn).delete(kt),this.edgeCountNum-=1}return this}}]),lt}();J.fromJSON=O;function ee(lt){return ee=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Ae){return typeof Ae}:function(Ae){return Ae&&typeof Symbol=="function"&&Ae.constructor===Symbol&&Ae!==Symbol.prototype?"symbol":typeof Ae},ee(lt)}function Q(lt,Ae){if(!(lt instanceof Ae))throw new TypeError("Cannot call a class as a function")}function re(lt,Ae){for(var Ye=0;Ye<Ae.length;Ye++){var Tt=Ae[Ye];Tt.enumerable=Tt.enumerable||!1,Tt.configurable=!0,"value"in Tt&&(Tt.writable=!0),Object.defineProperty(lt,Tt.key,Tt)}}function fe(lt,Ae,Ye){return Ae&&re(lt.prototype,Ae),Ye&&re(lt,Ye),Object.defineProperty(lt,"prototype",{writable:!1}),lt}function me(){return typeof Reflect!="undefined"&&Reflect.get?me=Reflect.get:me=function(Ae,Ye,Tt){var pt=ae(Ae,Ye);if(!!pt){var kt=Object.getOwnPropertyDescriptor(pt,Ye);return kt.get?kt.get.call(arguments.length<3?Ae:Tt):kt.value}},me.apply(this,arguments)}function ae(lt,Ae){for(;!Object.prototype.hasOwnProperty.call(lt,Ae)&&(lt=er(lt),lt!==null););return lt}function Ee(lt,Ae){if(typeof Ae!="function"&&Ae!==null)throw new TypeError("Super expression must either be null or a function");lt.prototype=Object.create(Ae&&Ae.prototype,{constructor:{value:lt,writable:!0,configurable:!0}}),Object.defineProperty(lt,"prototype",{writable:!1}),Ae&&Le(lt,Ae)}function Le(lt,Ae){return Le=Object.setPrototypeOf||function(Tt,pt){return Tt.__proto__=pt,Tt},Le(lt,Ae)}function De(lt){var Ae=It();return function(){var Tt=er(lt),pt;if(Ae){var kt=er(this).constructor;pt=Reflect.construct(Tt,arguments,kt)}else pt=Tt.apply(this,arguments);return Ve(this,pt)}}function Ve(lt,Ae){if(Ae&&(ee(Ae)==="object"||typeof Ae=="function"))return Ae;if(Ae!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return et(lt)}function et(lt){if(lt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return lt}function It(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(lt){return!1}}function er(lt){return er=Object.setPrototypeOf?Object.getPrototypeOf:function(Ye){return Ye.__proto__||Object.getPrototypeOf(Ye)},er(lt)}var nr=function(lt){Ee(Ye,lt);var Ae=De(Ye);function Ye(){var Tt;Q(this,Ye);for(var pt=arguments.length,kt=new Array(pt),ar=0;ar<pt;ar++)kt[ar]=arguments[ar];return Tt=Ae.call.apply(Ae,[this].concat(kt)),Tt.eventPool={},Tt}return fe(Ye,[{key:"appendEvent",value:function(pt,kt){this.eventPool[pt]||(this.eventPool[pt]=[]),this.eventPool[pt].push(kt)}},{key:"removeEvent",value:function(pt,kt){if(!!this.eventPool[pt]){var ar=this.eventPool[pt].indexOf(kt);ar>-1&&this.eventPool[pt].splice(ar,1)}}},{key:"emitEvent",value:function(pt){for(var kt=arguments.length,ar=new Array(kt>1?kt-1:0),jr=1;jr<kt;jr++)ar[jr-1]=arguments[jr];!this.eventPool[pt]||this.eventPool[pt].forEach(function(tn){tn.apply(void 0,ar)})}},{key:"setNode",value:function(pt,kt){return me(er(Ye.prototype),"setNode",this).call(this,pt,kt),this.emitEvent("nodeAdd",pt,kt),this}},{key:"removeNode",value:function(pt){return me(er(Ye.prototype),"removeNode",this).call(this,pt),this.emitEvent("nodeRemove",pt),this}},{key:"setEdge",value:function(pt,kt,ar,jr){return me(er(Ye.prototype),"setEdge",this).call(this,pt,kt,ar,jr),this.emitEvent("edgeAdd",pt,kt,ar,jr),this}},{key:"removeEdge",value:function(pt,kt,ar){return me(er(Ye.prototype),"removeEdge",this).call(this,pt,kt,ar),this.emitEvent("edgeRemove",pt,kt,ar),this}}]),Ye}(J);function Fe(lt,Ae){for(var Ye=0;Ye<Ae.length;Ye++){var Tt=Ae[Ye];Tt.enumerable=Tt.enumerable||!1,Tt.configurable=!0,"value"in Tt&&(Tt.writable=!0),Object.defineProperty(lt,Tt.key,Tt)}}function Vt(lt,Ae,Ye){return Ae&&Fe(lt.prototype,Ae),Ye&&Fe(lt,Ye),Object.defineProperty(lt,"prototype",{writable:!1}),lt}function $t(lt,Ae){if(!(lt instanceof Ae))throw new TypeError("Cannot call a class as a function")}var Ar=Vt(function lt(){var Ae=this;$t(this,lt),this.arr=[],this.keyIndice=new Map,this.size=function(){return Ae.arr.length},this.keys=function(){return Ae.arr.map(function(Ye){return Ye.key})},this.has=function(Ye){return Ae.keyIndice.has(Ye)},this.priority=function(Ye){var Tt=Ae.keyIndice.get(Ye);if(Tt!==void 0)return Ae.arr[Tt].priority},this.swap=function(Ye,Tt){var pt=Ae.arr,kt=Ae.keyIndice,ar=[pt[Ye],pt[Tt]],jr=ar[0],tn=ar[1];pt[Ye]=tn,pt[Tt]=jr,kt.set(jr.key,Tt),kt.set(tn.key,Ye)},this.innerDecrease=function(Ye){for(var Tt=Ae.arr,pt=Tt[Ye].priority,kt,ar=Ye;ar!==0;){var jr;if(kt=ar>>1,((jr=Tt[kt])===null||jr===void 0?void 0:jr.priority)<pt)break;Ae.swap(ar,kt),ar=kt}},this.heapify=function(Ye){var Tt=Ae.arr,pt=Ye<<1,kt=pt+1,ar=Ye;pt<Tt.length&&(ar=Tt[pt].priority<Tt[ar].priority?pt:ar,kt<Tt.length&&(ar=Tt[kt].priority<Tt[ar].priority?kt:ar),ar!==Ye&&(Ae.swap(Ye,ar),Ae.heapify(ar)))},this.min=function(){if(Ae.size()===0)throw new Error("Queue underflow");return Ae.arr[0].key},this.add=function(Ye,Tt){var pt=Ae.keyIndice,kt=Ae.arr;if(!pt.has(Ye)){var ar=kt.length;return pt.set(Ye,ar),kt.push({key:Ye,priority:Tt}),Ae.innerDecrease(ar),!0}return!1},this.removeMin=function(){Ae.swap(0,Ae.arr.length-1);var Ye=Ae.arr.pop();return Ae.keyIndice.delete(Ye.key),Ae.heapify(0),Ye.key},this.decrease=function(Ye,Tt){if(!Ae.has(Ye))throw new Error("There's no key named ".concat(Ye));var pt=Ae.keyIndice.get(Ye);if(Tt>Ae.arr[pt].priority)throw new Error("New priority is greater than current priority.Key: ".concat(Ye," Old: + ").concat(Ae.arr[pt].priority," New: ").concat(Tt));Ae.arr[pt].priority=Tt,Ae.innerDecrease(pt)}}),ke=function(Ae,Ye){var Tt=new J,pt=new Map,kt=new Ar,ar;function jr(Dn){var $n=Dn.v===ar?Dn.w:Dn.v,ci=kt.priority($n);if(ci!==void 0){var Ii=Ye(Dn);Ii<ci&&(pt.set($n,ar),kt.decrease($n,Ii))}}if(Ae.nodeCount()===0)return Tt;Ae.nodes().forEach(function(Dn){kt.add(Dn,Number.POSITIVE_INFINITY),Tt.setNode(Dn)}),kt.decrease(Ae.nodes()[0],0);for(var tn=!1;kt.size()>0;){var Ln;if(ar=kt.removeMin(),pt.has(ar))Tt.setEdge(ar,pt.get(ar));else{if(tn)throw new Error("Input graph is not connected: "+Ae.graph());tn=!0}(Ln=Ae.nodeEdges(ar))===null||Ln===void 0||Ln.forEach(jr)}return Tt},Oe=ke,we=function(Ae){var Ye=new Set,Tt=[],pt=Ae.nodes();return pt.forEach(function(kt){for(var ar=[],jr=[kt];jr.length>0;){var tn=jr.pop();if(!Ye.has(tn)){var Ln,Dn;Ye.add(tn),ar.push(tn),(Ln=Ae.successors(tn))===null||Ln===void 0||Ln.forEach(function($n){return jr.push($n)}),(Dn=Ae.predecessors(tn))===null||Dn===void 0||Dn.forEach(function($n){return jr.push($n)})}}ar.length&&Tt.push(ar)}),Tt},Be=we,We=function lt(Ae,Ye,Tt,pt,kt,ar){pt.includes(Ye)||(pt.push(Ye),Tt||ar.push(Ye),kt(Ye).forEach(function(jr){return lt(Ae,jr,Tt,pt,kt,ar)}),Tt&&ar.push(Ye))},He=function(Ae,Ye,Tt){var pt=Array.isArray(Ye)?Ye:[Ye],kt=function(Ln){return Ae.isDirected()?Ae.successors(Ln):Ae.neighbors(Ln)},ar=[],jr=[];return pt.forEach(function(tn){if(Ae.hasNode(tn))We(Ae,tn,Tt==="post",jr,kt,ar);else throw new Error("Graph does not have node: "+tn)}),ar},St=He;function Mt(lt,Ae){return he(lt)||U(lt,Ae)||Ge(lt,Ae)||sr()}function sr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
  992. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ge(lt,Ae){if(!!lt){if(typeof lt=="string")return ut(lt,Ae);var Ye=Object.prototype.toString.call(lt).slice(8,-1);if(Ye==="Object"&&lt.constructor&&(Ye=lt.constructor.name),Ye==="Map"||Ye==="Set")return Array.from(lt);if(Ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ye))return ut(lt,Ae)}}function ut(lt,Ae){(Ae==null||Ae>lt.length)&&(Ae=lt.length);for(var Ye=0,Tt=new Array(Ae);Ye<Ae;Ye++)Tt[Ye]=lt[Ye];return Tt}function U(lt,Ae){var Ye=lt==null?null:typeof Symbol!="undefined"&&lt[Symbol.iterator]||lt["@@iterator"];if(Ye!=null){var Tt=[],pt=!0,kt=!1,ar,jr;try{for(Ye=Ye.call(lt);!(pt=(ar=Ye.next()).done)&&(Tt.push(ar.value),!(Ae&&Tt.length===Ae));pt=!0);}catch(tn){kt=!0,jr=tn}finally{try{!pt&&Ye.return!=null&&Ye.return()}finally{if(kt)throw jr}}return Tt}}function he(lt){if(Array.isArray(lt))return lt}var Qe=function(){return 1},le=function(Ae,Ye,Tt,pt){return ct(Ae,Ye,Tt||Qe,pt||function(kt){return Ae.outEdges(kt)})},ct=function(Ae,Ye,Tt,pt){var kt=new Map,ar=new Ar,jr,tn,Ln=function(ci){var Ii=ci.v!==jr?ci.v:ci.w,ki=kt.get(Ii),zi=Tt(ci),Hn=tn.distance+zi;if(zi<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+ci+" Weight: "+zi);Hn<ki.distance&&(ki.distance=Hn,ki.predecessor=jr,ar.decrease(Ii,Hn))};for(Ae.nodes().forEach(function($n){var ci=$n===Ye?0:Number.POSITIVE_INFINITY;kt.set($n,{distance:ci}),ar.add($n,ci)});ar.size()>0&&(jr=ar.removeMin(),tn=kt.get(jr),!(tn&&tn.distance===Number.POSITIVE_INFINITY));)pt(jr).forEach(Ln);var Dn={};return Array.from(kt.entries()).forEach(function($n){var ci=Mt($n,2),Ii=ci[0],ki=ci[1];return Dn[String(Ii)]=ki,Dn}),Dn},ft=le,jt=function(Ae,Ye,Tt){var pt={};return Ae.nodes().forEach(function(kt){return pt[String(kt)]=ft(Ae,kt,Ye,Tt),pt}),pt},Lt=jt,Ht=function(Ae){var Ye=0,Tt=[],pt=new Map,kt=[];function ar(jr){var tn,Ln={onStack:!0,lowlink:Ye,index:Ye};if(pt.set(jr,Ln),Ye+=1,Tt.push(jr),(tn=Ae.successors(jr))===null||tn===void 0||tn.forEach(function(Ii){var ki;if(pt.has(Ii)){if((ki=pt.get(Ii))===null||ki===void 0?void 0:ki.onStack){var Hn=pt.get(Ii);Ln.lowlink=Math.min(Ln.lowlink,Hn.index)}}else{ar(Ii);var zi=pt.get(Ii);Ln.lowlink=Math.min(Ln.lowlink,zi.lowlink)}}),Ln.lowlink===Ln.index){var Dn=[],$n;do{$n=Tt.pop();var ci=pt.get($n);ci.onStack=!1,Dn.push($n)}while(jr!==$n);kt.push(Dn)}}return Ae.nodes().forEach(function(jr){pt.has(jr)||ar(jr)}),kt},vr=Ht,rt=function(Ae){return vr(Ae).filter(function(Ye){return Ye.length>1||Ye.length===1&&Ae.hasEdge(Ye[0],Ye[0])})},at=rt;function Pt(lt){return Pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(Ae){return typeof Ae}:function(Ae){return Ae&&typeof Symbol=="function"&&Ae.constructor===Symbol&&Ae!==Symbol.prototype?"symbol":typeof Ae},Pt(lt)}function gt(lt,Ae){for(var Ye=0;Ye<Ae.length;Ye++){var Tt=Ae[Ye];Tt.enumerable=Tt.enumerable||!1,Tt.configurable=!0,"value"in Tt&&(Tt.writable=!0),Object.defineProperty(lt,Tt.key,Tt)}}function Dt(lt,Ae,Ye){return Ae&&gt(lt.prototype,Ae),Ye&&gt(lt,Ye),Object.defineProperty(lt,"prototype",{writable:!1}),lt}function ir(lt,Ae){if(!(lt instanceof Ae))throw new TypeError("Cannot call a class as a function")}function At(lt,Ae){if(typeof Ae!="function"&&Ae!==null)throw new TypeError("Super expression must either be null or a function");lt.prototype=Object.create(Ae&&Ae.prototype,{constructor:{value:lt,writable:!0,configurable:!0}}),Object.defineProperty(lt,"prototype",{writable:!1}),Ae&&cn(lt,Ae)}function xr(lt){var Ae=dn();return function(){var Tt=wn(lt),pt;if(Ae){var kt=wn(this).constructor;pt=Reflect.construct(Tt,arguments,kt)}else pt=Tt.apply(this,arguments);return Pr(this,pt)}}function Pr(lt,Ae){if(Ae&&(Pt(Ae)==="object"||typeof Ae=="function"))return Ae;if(Ae!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qr(lt)}function Qr(lt){if(lt===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return lt}function Vr(lt){var Ae=typeof Map=="function"?new Map:void 0;return Vr=function(Tt){if(Tt===null||!Vn(Tt))return Tt;if(typeof Tt!="function")throw new TypeError("Super expression must either be null or a function");if(typeof Ae!="undefined"){if(Ae.has(Tt))return Ae.get(Tt);Ae.set(Tt,pt)}function pt(){return nn(Tt,arguments,wn(this).constructor)}return pt.prototype=Object.create(Tt.prototype,{constructor:{value:pt,enumerable:!1,writable:!0,configurable:!0}}),cn(pt,Tt)},Vr(lt)}function nn(lt,Ae,Ye){return dn()?nn=Reflect.construct:nn=function(pt,kt,ar){var jr=[null];jr.push.apply(jr,kt);var tn=Function.bind.apply(pt,jr),Ln=new tn;return ar&&cn(Ln,ar.prototype),Ln},nn.apply(null,arguments)}function dn(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(lt){return!1}}function Vn(lt){return Function.toString.call(lt).indexOf("[native code]")!==-1}function cn(lt,Ae){return cn=Object.setPrototypeOf||function(Tt,pt){return Tt.__proto__=pt,Tt},cn(lt,Ae)}function wn(lt){return wn=Object.setPrototypeOf?Object.getPrototypeOf:function(Ye){return Ye.__proto__||Object.getPrototypeOf(Ye)},wn(lt)}var xn=function(lt){At(Ye,lt);var Ae=xr(Ye);function Ye(){return ir(this,Ye),Ae.apply(this,arguments)}return Dt(Ye)}(Vr(Error));function gn(lt){var Ae=new Set,Ye=new Set,Tt=[];function pt(kt){if(Ye.has(kt))throw new xn;if(!Ae.has(kt)){var ar;Ye.add(kt),Ae.add(kt),(ar=lt.predecessors(kt))===null||ar===void 0||ar.forEach(pt),Ye.delete(kt),Tt.push(kt)}}if(lt.sinks().forEach(pt),Ae.size!==lt.nodeCount())throw new xn;return Tt}var Un=gn,bt=function(Ae){try{Un(Ae)}catch(Ye){if(Ye instanceof xn)return!1;throw Ye}return!0},Mn=bt,be=function(Ae,Ye){return St(Ae,Ye,"post")},Se=be,j=function(Ae,Ye){return St(Ae,Ye,"pre")},R=j,k=function(){return 1};function te(lt,Ae,Ye){return Me(lt,Ae||k,Ye||function(Tt){return lt.outEdges(Tt)})}function Me(lt,Ae,Ye){var Tt={},pt=lt.nodes();return pt.forEach(function(kt){var ar=String(kt);Tt[ar]={},Tt[ar][ar]={distance:0},pt.forEach(function(jr){kt!==jr&&(Tt[ar][String(jr)]={distance:Number.POSITIVE_INFINITY})}),Ye(kt).forEach(function(jr){var tn=jr.v===kt?jr.w:jr.v,Ln=Ae(jr);Tt[ar][String(tn)]={distance:Ln,predecessor:kt}})}),pt.forEach(function(kt){var ar=String(kt),jr=Tt[ar];pt.forEach(function(tn){var Ln=String(tn),Dn=Tt[Ln];pt.forEach(function($n){var ci=String($n),Ii=Dn[ar],ki=jr[ci],zi=Dn[ci],Hn=Ii.distance+ki.distance;Hn<zi.distance&&(zi.distance=Hn,zi.predecessor=ki.predecessor)})})}),Tt}var Ne=te,Pe=function(Ae,Ye){for(var Tt=Ae.nodes(),pt=0;pt<Tt.length;pt++){var kt=Tt[pt];if(Ye.hasNode(kt))return!0}return!1},Ke=function(Ae,Ye){for(var Tt=Ae.edges(),pt=0;pt<Tt.length;pt++){var kt=Tt[pt];if(Ye.hasEdge(kt.v,kt.w,kt.name))return!0}return!1},Ut=function(Ae,Ye){var Tt=Ae.nodes(),pt=Tt.filter(function(kt){return Ye.hasNode(kt)});return pt},Rt=function(Ae,Ye){var Tt=Ae.edges(),pt=Tt.filter(function(kt){return Ye.hasEdge(kt.v,kt.w,kt.name)});return pt},fr=function(Ae,Ye){return Ae.isCompound()===Ye.isCompound()&&Ae.isDirected()===Ye.isDirected()&&Ae.isMultigraph()===Ye.isMultigraph()},kr=function(Ae,Ye){var Tt=Ut(Ae,Ye);return Tt.length===Ae.nodes().length},ur=function(Ae,Ye){var Tt=Rt(Ae,Ye);return Tt.length===Ae.edges().length},rn=function(Ae,Ye){return fr(Ae,Ye)&&Ae.nodeCount()===Ye.nodeCount()&&kr(Ae,Ye)&&Ae.edgeCount()===Ye.edgeCount()&&ur(Ae,Ye)},On=function(Ae,Ye){return kr(Ae,Ye)&&ur(Ae,Ye)};function ne(lt,Ae){return mr(lt)||Nt(lt,Ae)||Je(lt,Ae)||ye()}function ye(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
  993. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Je(lt,Ae){if(!!lt){if(typeof lt=="string")return Ct(lt,Ae);var Ye=Object.prototype.toString.call(lt).slice(8,-1);if(Ye==="Object"&&lt.constructor&&(Ye=lt.constructor.name),Ye==="Map"||Ye==="Set")return Array.from(lt);if(Ye==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(Ye))return Ct(lt,Ae)}}function Ct(lt,Ae){(Ae==null||Ae>lt.length)&&(Ae=lt.length);for(var Ye=0,Tt=new Array(Ae);Ye<Ae;Ye++)Tt[Ye]=lt[Ye];return Tt}function Nt(lt,Ae){var Ye=lt==null?null:typeof Symbol!="undefined"&&lt[Symbol.iterator]||lt["@@iterator"];if(Ye!=null){var Tt=[],pt=!0,kt=!1,ar,jr;try{for(Ye=Ye.call(lt);!(pt=(ar=Ye.next()).done)&&(Tt.push(ar.value),!(Ae&&Tt.length===Ae));pt=!0);}catch(tn){kt=!0,jr=tn}finally{try{!pt&&Ye.return!=null&&Ye.return()}finally{if(kt)throw jr}}return Tt}}function mr(lt){if(Array.isArray(lt))return lt}function lr(lt){return lt instanceof J}function dr(lt){if(lt.isMultigraph())return!1;for(var Ae=lt.edges(),Ye=new Map,Tt=0;Tt<Ae.length;Tt++){var pt=Ae[Tt];if(pt.v===pt.w)return!1;var kt=[pt.v,pt.w].sort(),ar=ne(kt,2),jr=ar[0],tn=ar[1],Ln="".concat(jr,"-").concat(tn);if(Ye.has(Ln))return!1;Ye.set(Ln,!0)}return!0}function yr(lt){return lt.nodes().length===0}function Gr(lt){for(var Ae=lt.edges(),Ye=0;Ye<Ae.length;Ye++){var Tt=Ae[Ye];if(Tt.v===Tt.w)return!0}return!1}var Jr=function(Ae,Ye){if(!dr(Ae)||!dr(Ye)||!kr(Ae,Ye)||Ke(Ae,Ye))return!1;var Tt=Ae.nodeCount();return Ae.edgeCount()+Ye.edgeCount()===Tt*(Tt-1)/2},Sr=function(Ae){if(!dr(Ae))return null;for(var Ye=Ae.nodeCount(),Tt=new J({compound:Ae.isCompound(),directed:Ae.isDirected(),multigraph:Ae.isMultigraph()}),pt=Ae.nodes(),kt=0;kt<Ye;kt++){var ar=pt[kt];Tt.setNode(ar,Ae.node(ar));for(var jr=kt+1;jr<Ye;jr++){var tn=pt[jr];Ae.hasEdge(ar,tn)||Tt.setEdge(ar,tn)}}return Tt}},81746:function(dt){(function(M,S){dt.exports=S()})(typeof self!="undefined"?self:this,function(){return function(x){var M={};function S(B){if(M[B])return M[B].exports;var N=M[B]={i:B,l:!1,exports:{}};return x[B].call(N.exports,N,N.exports,S),N.l=!0,N.exports}return S.m=x,S.c=M,S.d=function(B,N,E){S.o(B,N)||Object.defineProperty(B,N,{configurable:!1,enumerable:!0,get:E})},S.n=function(B){var N=B&&B.__esModule?function(){return B.default}:function(){return B};return S.d(N,"a",N),N},S.o=function(B,N){return Object.prototype.hasOwnProperty.call(B,N)},S.p="",S(S.s=31)}([function(x,M,S){"use strict";var B=S(4);M.a=function(N){return Array.isArray?Array.isArray(N):Object(B.a)(N,"Array")}},function(x,M,S){"use strict";var B=function(N){return N!==null&&typeof N!="function"&&isFinite(N.length)};M.a=B},function(x,M,S){"use strict";var B=S(0),N=S(13);function E(I,A){if(!!I){var v;if(Object(B.a)(I))for(var p=0,c=I.length;p<c&&(v=A(I[p],p),v!==!1);p++);else if(Object(N.a)(I)){for(var f in I)if(I.hasOwnProperty(f)&&(v=A(I[f],f),v===!1))break}}}M.a=E},function(x,M,S){"use strict";var B=S(4);M.a=function(N){return Object(B.a)(N,"Function")}},function(x,M,S){"use strict";var B={}.toString,N=function(E,I){return B.call(E)==="[object "+I+"]"};M.a=N},function(x,M,S){"use strict";var B=S(4),N=function(E){return Object(B.a)(E,"Number")};M.a=N},function(x,M,S){"use strict";var B=function(N){return N==null};M.a=B},function(x,M,S){var B=S(33),N=B.mix;x.exports={assign:N}},function(x,M,S){"use strict";var B=S(4);M.a=function(N){return Object(B.a)(N,"String")}},function(x,M,S){"use strict";var B=S(15),N=S(4),E=function(I){if(!Object(B.a)(I)||!Object(N.a)(I,"Object"))return!1;if(Object.getPrototypeOf(I)===null)return!0;for(var A=I;Object.getPrototypeOf(A)!==null;)A=Object.getPrototypeOf(A);return Object.getPrototypeOf(I)===A};M.a=E},function(x,M,S){"use strict";var B=S(6);M.a=function(N){return Object(B.a)(N)?"":N.toString()}},function(x,M,S){var B=S(18),N=function(){function E(A,v){v===void 0&&(v={});var p=this;p.options=v,p.rootNode=B(A,v)}var I=E.prototype;return I.execute=function(){throw new Error("please override this method")},E}();x.exports=N},function(x,M,S){"use strict";var B=S(1),N=function(E,I){return Object(B.a)(E)?E.indexOf(I)>-1:!1};M.a=N},function(x,M,S){"use strict";M.a=function(B){var N=typeof B;return B!==null&&N==="object"||N==="function"}},function(x,M,S){"use strict";var B=S(2),N=S(1),E=function(I,A){if(!Object(N.a)(I))return I;var v=[];return Object(B.a)(I,function(p,c){A(p,c)&&v.push(p)}),v};M.a=E},function(x,M,S){"use strict";var B=function(N){return typeof N=="object"&&N!==null};M.a=B},function(x,M,S){"use strict";M.a=N;function B(E,I){for(var A in I)I.hasOwnProperty(A)&&A!=="constructor"&&I[A]!==void 0&&(E[A]=I[A])}function N(E,I,A,v){return I&&B(E,I),A&&B(E,A),v&&B(E,v),E}},function(x,M,S){var B=S(30),N=["LR","RL","TB","BT","H","V"],E=["LR","RL","H"],I=function(p){return E.indexOf(p)>-1},A=N[0];x.exports=function(v,p,c){var f=p.direction||A;if(p.isHorizontal=I(f),f&&N.indexOf(f)===-1)throw new TypeError("Invalid direction: "+f);if(f===N[0])c(v,p);else if(f===N[1])c(v,p),v.right2left();else if(f===N[2])c(v,p);else if(f===N[3])c(v,p),v.bottom2top();else if(f===N[4]||f===N[5]){var l=B(v,p),T=l.left,m=l.right;c(T,p),c(m,p),p.isHorizontal?T.right2left():T.bottom2top(),m.translate(T.x-m.x,T.y-m.y),v.x=T.x,v.y=m.y;var w=v.getBoundingBox();p.isHorizontal?w.top<0&&v.translate(0,-w.top):w.left<0&&v.translate(-w.left,0)}var O=p.fixedRoot;return O===void 0&&(O=!0),O&&v.translate(-(v.x+v.width/2+v.hgap),-(v.y+v.height/2+v.vgap)),v}},function(x,M,S){var B=S(7),N=18,E=N*2,I=N,A={getId:function(f){return f.id||f.name},getPreH:function(f){return f.preH||0},getPreV:function(f){return f.preV||0},getHGap:function(f){return f.hgap||I},getVGap:function(f){return f.vgap||I},getChildren:function(f){return f.children},getHeight:function(f){return f.height||E},getWidth:function(f){var l=f.label||" ";return f.width||l.split("").length*N}};function v(c,f){var l=this;if(l.vgap=l.hgap=0,c instanceof v)return c;l.data=c;var T=f.getHGap(c),m=f.getVGap(c);return l.preH=f.getPreH(c),l.preV=f.getPreV(c),l.width=f.getWidth(c),l.height=f.getHeight(c),l.width+=l.preH,l.height+=l.preV,l.id=f.getId(c),l.x=l.y=0,l.depth=0,l.children||(l.children=[]),l.addGap(T,m),l}B.assign(v.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(f,l){var T=this;T.hgap+=f,T.vgap+=l,T.width+=2*f,T.height+=2*l},eachNode:function(f){for(var l=this,T=[l],m;m=T.shift();)f(m),T=m.children.concat(T)},DFTraverse:function(f){this.eachNode(f)},BFTraverse:function(f){for(var l=this,T=[l],m;m=T.shift();)f(m),T=T.concat(m.children)},getBoundingBox:function(){var f={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(l){f.left=Math.min(f.left,l.x),f.top=Math.min(f.top,l.y),f.width=Math.max(f.width,l.x+l.width),f.height=Math.max(f.height,l.y+l.height)}),f},translate:function(f,l){f===void 0&&(f=0),l===void 0&&(l=0),this.eachNode(function(T){T.x+=f,T.y+=l,T.x+=T.preH,T.y+=T.preV})},right2left:function(){var f=this,l=f.getBoundingBox();f.eachNode(function(T){T.x=T.x-(T.x-l.left)*2-T.width}),f.translate(l.width,0)},bottom2top:function(){var f=this,l=f.getBoundingBox();f.eachNode(function(T){T.y=T.y-(T.y-l.top)*2-T.height}),f.translate(0,l.height)}});function p(c,f,l){f===void 0&&(f={}),f=B.assign({},A,f);var T=new v(c,f),m=[T],w;if(!l&&!c.collapsed){for(;w=m.shift();)if(!w.data.collapsed){var O=f.getChildren(w.data),D=O?O.length:0;if(w.children=new Array(D),O&&D)for(var g=0;g<D;g++){var _=new v(O[g],f);w.children[g]=_,m.push(_),_.parent=w,_.depth=w.depth+1}}}return T}x.exports=p},function(x,M,S){"use strict";var B=S(6),N=S(20);function E(I,A){var v=Object(N.a)(A),p=v.length;if(Object(B.a)(I))return!p;for(var c=0;c<p;c+=1){var f=v[c];if(A[f]!==I[f]||!(f in I))return!1}return!0}M.a=E},function(x,M,S){"use strict";var B=S(2),N=S(3),E=Object.keys?function(I){return Object.keys(I)}:function(I){var A=[];return Object(B.a)(I,function(v,p){Object(N.a)(I)&&p==="prototype"||A.push(p)}),A};M.a=E},function(x,M,S){"use strict";var B=S(1),N=Array.prototype.splice,E=function(A,v){if(!Object(B.a)(A))return[];for(var p=A?v.length:0,c=p-1;p--;){var f=void 0,l=v[p];(p===c||l!==f)&&(f=l,N.call(A,l,1))}return A};M.a=E},function(x,M,S){"use strict";var B=S(12),N=S(2),E=function(I){var A=[];return Object(N.a)(I,function(v){Object(B.a)(A,v)||A.push(v)}),A};M.a=E},function(x,M,S){"use strict";var B=S(0),N=S(3),E=S(24),I=function(A,v){if(!v)return{0:A};if(!Object(N.a)(v)){var p=Object(B.a)(v)?v:v.replace(/\s+/g,"").split("*");v=function(f){for(var l="_",T=0,m=p.length;T<m;T++)l+=f[p[T]]&&f[p[T]].toString();return l}}var c=Object(E.a)(A,v);return c};M.a=I},function(x,M,S){"use strict";var B=S(2),N=S(0),E=S(3),I=Object.prototype.hasOwnProperty;function A(v,p){if(!p||!Object(N.a)(v))return{};var c={},f=Object(E.a)(p)?p:function(T){return T[p]},l;return Object(B.a)(v,function(T){l=f(T),I.call(c,l)?c[l].push(T):c[l]=[T]}),c}M.a=A},function(x,M,S){"use strict";M.a=function(B,N){return B.hasOwnProperty(N)}},function(x,M,S){"use strict";var B=S(2),N=S(3),E=Object.values?function(I){return Object.values(I)}:function(I){var A=[];return Object(B.a)(I,function(v,p){Object(N.a)(I)&&p==="prototype"||A.push(v)}),A};M.a=E},function(x,M,S){"use strict";var B={}.toString,N=function(E){return B.call(E).replace(/^\[object /,"").replace(/]$/,"")};M.a=N},function(x,M,S){"use strict";var B=Object.prototype,N=function(E){var I=E&&E.constructor,A=typeof I=="function"&&I.prototype||B;return E===A};M.a=N},function(x,M,S){"use strict";var B=S(15),N=S(1),E=S(8),I=function(A,v){if(A===v)return!0;if(!A||!v||Object(E.a)(A)||Object(E.a)(v))return!1;if(Object(N.a)(A)||Object(N.a)(v)){if(A.length!==v.length)return!1;for(var p=!0,c=0;c<A.length&&(p=I(A[c],v[c]),!!p);c++);return p}if(Object(B.a)(A)||Object(B.a)(v)){var f=Object.keys(A),l=Object.keys(v);if(f.length!==l.length)return!1;for(var p=!0,c=0;c<f.length&&(p=I(A[f[c]],v[f[c]]),!!p);c++);return p}return!1};M.a=I},function(x,M,S){var B=S(18);x.exports=function(N,E){for(var I=B(N.data,E,!0),A=B(N.data,E,!0),v=N.children.length,p=Math.round(v/2),c=E.getSide||function(m,w){return w<p?"right":"left"},f=0;f<v;f++){var l=N.children[f],T=c(l,f);T==="right"?A.children.push(l):I.children.push(l)}return I.eachNode(function(m){m.isRoot()||(m.side="left")}),A.eachNode(function(m){m.isRoot()||(m.side="right")}),{left:I,right:A}}},function(x,M,S){var B={compactBox:S(32),dendrogram:S(114),indented:S(116),mindmap:S(118)};x.exports=B},function(x,M,S){function B(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,f.__proto__=l}var N=S(11),E=S(113),I=S(17),A=S(7),v=function(f){B(l,f);function l(){return f.apply(this,arguments)||this}var T=l.prototype;return T.execute=function(){var w=this;return I(w.rootNode,w.options,E)},l}(N),p={};function c(f,l){return l=A.assign({},p,l),new v(f,l).execute()}x.exports=c},function(x,M,S){"use strict";Object.defineProperty(M,"__esModule",{value:!0});var B=S(12);S.d(M,"contains",function(){return B.a}),S.d(M,"includes",function(){return B.a});var N=S(34);S.d(M,"difference",function(){return N.a});var E=S(35);S.d(M,"find",function(){return E.a});var I=S(36);S.d(M,"findIndex",function(){return I.a});var A=S(37);S.d(M,"firstValue",function(){return A.a});var v=S(38);S.d(M,"flatten",function(){return v.a});var p=S(39);S.d(M,"flattenDeep",function(){return p.a});var c=S(40);S.d(M,"getRange",function(){return c.a});var f=S(41);S.d(M,"pull",function(){return f.a});var l=S(21);S.d(M,"pullAt",function(){return l.a});var T=S(42);S.d(M,"reduce",function(){return T.a});var m=S(43);S.d(M,"remove",function(){return m.a});var w=S(44);S.d(M,"sortBy",function(){return w.a});var O=S(45);S.d(M,"union",function(){return O.a});var D=S(22);S.d(M,"uniq",function(){return D.a});var g=S(46);S.d(M,"valuesOfKey",function(){return g.a});var _=S(47);S.d(M,"head",function(){return _.a});var Y=S(48);S.d(M,"last",function(){return Y.a});var V=S(49);S.d(M,"startsWith",function(){return V.a});var z=S(50);S.d(M,"endsWith",function(){return z.a});var Z=S(14);S.d(M,"filter",function(){return Z.a});var J=S(51);S.d(M,"every",function(){return J.a});var ee=S(52);S.d(M,"some",function(){return ee.a});var Q=S(53);S.d(M,"group",function(){return Q.a});var re=S(24);S.d(M,"groupBy",function(){return re.a});var fe=S(23);S.d(M,"groupToMap",function(){return fe.a});var me=S(54);S.d(M,"getWrapBehavior",function(){return me.a});var ae=S(55);S.d(M,"wrapBehavior",function(){return ae.a});var Ee=S(56);S.d(M,"number2color",function(){return Ee.a});var Le=S(57);S.d(M,"parseRadius",function(){return Le.a});var De=S(58);S.d(M,"clamp",function(){return De.a});var Ve=S(59);S.d(M,"fixedBase",function(){return Ve.a});var et=S(60);S.d(M,"isDecimal",function(){return et.a});var It=S(61);S.d(M,"isEven",function(){return It.a});var er=S(62);S.d(M,"isInteger",function(){return er.a});var nr=S(63);S.d(M,"isNegative",function(){return nr.a});var Fe=S(64);S.d(M,"isNumberEqual",function(){return Fe.a});var Vt=S(65);S.d(M,"isOdd",function(){return Vt.a});var $t=S(66);S.d(M,"isPositive",function(){return $t.a});var Ar=S(67);S.d(M,"maxBy",function(){return Ar.a});var ke=S(68);S.d(M,"minBy",function(){return ke.a});var Oe=S(69);S.d(M,"mod",function(){return Oe.a});var we=S(70);S.d(M,"toDegree",function(){return we.a});var Be=S(71);S.d(M,"toInteger",function(){return Be.a});var We=S(72);S.d(M,"toRadian",function(){return We.a});var He=S(73);S.d(M,"forIn",function(){return He.a});var St=S(25);S.d(M,"has",function(){return St.a});var Mt=S(74);S.d(M,"hasKey",function(){return Mt.a});var sr=S(75);S.d(M,"hasValue",function(){return sr.a});var Ge=S(20);S.d(M,"keys",function(){return Ge.a});var ut=S(19);S.d(M,"isMatch",function(){return ut.a});var U=S(26);S.d(M,"values",function(){return U.a});var he=S(76);S.d(M,"lowerCase",function(){return he.a});var Qe=S(77);S.d(M,"lowerFirst",function(){return Qe.a});var le=S(78);S.d(M,"substitute",function(){return le.a});var ct=S(79);S.d(M,"upperCase",function(){return ct.a});var ft=S(80);S.d(M,"upperFirst",function(){return ft.a});var jt=S(27);S.d(M,"getType",function(){return jt.a});var Lt=S(81);S.d(M,"isArguments",function(){return Lt.a});var Ht=S(0);S.d(M,"isArray",function(){return Ht.a});var vr=S(1);S.d(M,"isArrayLike",function(){return vr.a});var rt=S(82);S.d(M,"isBoolean",function(){return rt.a});var at=S(83);S.d(M,"isDate",function(){return at.a});var Pt=S(84);S.d(M,"isError",function(){return Pt.a});var gt=S(3);S.d(M,"isFunction",function(){return gt.a});var Dt=S(85);S.d(M,"isFinite",function(){return Dt.a});var ir=S(6);S.d(M,"isNil",function(){return ir.a});var At=S(86);S.d(M,"isNull",function(){return At.a});var xr=S(5);S.d(M,"isNumber",function(){return xr.a});var Pr=S(13);S.d(M,"isObject",function(){return Pr.a});var Qr=S(15);S.d(M,"isObjectLike",function(){return Qr.a});var Vr=S(9);S.d(M,"isPlainObject",function(){return Vr.a});var nn=S(28);S.d(M,"isPrototype",function(){return nn.a});var dn=S(87);S.d(M,"isRegExp",function(){return dn.a});var Vn=S(8);S.d(M,"isString",function(){return Vn.a});var cn=S(4);S.d(M,"isType",function(){return cn.a});var wn=S(88);S.d(M,"isUndefined",function(){return wn.a});var xn=S(89);S.d(M,"isElement",function(){return xn.a});var gn=S(90);S.d(M,"requestAnimationFrame",function(){return gn.a});var Un=S(91);S.d(M,"clearAnimationFrame",function(){return Un.a});var bt=S(92);S.d(M,"augment",function(){return bt.a});var Mn=S(93);S.d(M,"clone",function(){return Mn.a});var be=S(94);S.d(M,"debounce",function(){return be.a});var Se=S(95);S.d(M,"memoize",function(){return Se.a});var j=S(96);S.d(M,"deepMix",function(){return j.a});var R=S(2);S.d(M,"each",function(){return R.a});var k=S(97);S.d(M,"extend",function(){return k.a});var te=S(98);S.d(M,"indexOf",function(){return te.a});var Me=S(99);S.d(M,"isEmpty",function(){return Me.a});var Ne=S(29);S.d(M,"isEqual",function(){return Ne.a});var Pe=S(100);S.d(M,"isEqualWith",function(){return Pe.a});var Ke=S(101);S.d(M,"map",function(){return Ke.a});var Ut=S(102);S.d(M,"mapValues",function(){return Ut.a});var Rt=S(16);S.d(M,"mix",function(){return Rt.a}),S.d(M,"assign",function(){return Rt.a});var fr=S(103);S.d(M,"get",function(){return fr.a});var kr=S(104);S.d(M,"set",function(){return kr.a});var ur=S(105);S.d(M,"pick",function(){return ur.a});var rn=S(106);S.d(M,"throttle",function(){return rn.a});var On=S(107);S.d(M,"toArray",function(){return On.a});var ne=S(10);S.d(M,"toString",function(){return ne.a});var ye=S(108);S.d(M,"uniqueId",function(){return ye.a});var Je=S(109);S.d(M,"noop",function(){return Je.a});var Ct=S(110);S.d(M,"identity",function(){return Ct.a});var Nt=S(111);S.d(M,"size",function(){return Nt.a});var mr=S(112);S.d(M,"Cache",function(){return mr.a})},function(x,M,S){"use strict";var B=S(14),N=S(12),E=function(I,A){return A===void 0&&(A=[]),Object(B.a)(I,function(v){return!Object(N.a)(A,v)})};M.a=E},function(x,M,S){"use strict";var B=S(3),N=S(19),E=S(0),I=S(9);function A(v,p){if(!Object(E.a)(v))return null;var c;if(Object(B.a)(p)&&(c=p),Object(I.a)(p)&&(c=function(l){return Object(N.a)(l,p)}),c){for(var f=0;f<v.length;f+=1)if(c(v[f]))return v[f]}return null}M.a=A},function(x,M,S){"use strict";function B(N,E,I){I===void 0&&(I=0);for(var A=I;A<N.length;A++)if(E(N[A],A))return A;return-1}M.a=B},function(x,M,S){"use strict";var B=S(6),N=S(0),E=function(I,A){for(var v=null,p=0;p<I.length;p++){var c=I[p],f=c[A];if(!Object(B.a)(f)){Object(N.a)(f)?v=f[0]:v=f;break}}return v};M.a=E},function(x,M,S){"use strict";var B=S(0),N=function(E){if(!Object(B.a)(E))return[];for(var I=[],A=0;A<E.length;A++)I=I.concat(E[A]);return I};M.a=N},function(x,M,S){"use strict";var B=S(0),N=function(E,I){if(I===void 0&&(I=[]),!Object(B.a)(E))I.push(E);else for(var A=0;A<E.length;A+=1)N(E[A],I);return I};M.a=N},function(x,M,S){"use strict";var B=S(0),N=S(14),E=function(I){if(I=Object(N.a)(I,function(f){return!isNaN(f)}),!I.length)return{min:0,max:0};if(Object(B.a)(I[0])){for(var A=[],v=0;v<I.length;v++)A=A.concat(I[v]);I=A}var p=Math.max.apply(null,I),c=Math.min.apply(null,I);return{min:c,max:p}};M.a=E},function(x,M,S){"use strict";var B=Array.prototype,N=B.splice,E=B.indexOf,I=function(A){for(var v=[],p=1;p<arguments.length;p++)v[p-1]=arguments[p];for(var c=0;c<v.length;c++)for(var f=v[c],l=-1;(l=E.call(A,f))>-1;)N.call(A,l,1);return A};M.a=I},function(x,M,S){"use strict";var B=S(2),N=S(0),E=S(9),I=function(A,v,p){if(!Object(N.a)(A)&&!Object(E.a)(A))return A;var c=p;return Object(B.a)(A,function(f,l){c=v(c,f,l)}),c};M.a=I},function(x,M,S){"use strict";var B=S(1),N=S(21),E=function(I,A){var v=[];if(!Object(B.a)(I))return v;for(var p=-1,c=[],f=I.length;++p<f;){var l=I[p];A(l,p,I)&&(v.push(l),c.push(p))}return Object(N.a)(I,c),v};M.a=E},function(x,M,S){"use strict";var B=S(0),N=S(8),E=S(3);function I(A,v){var p;if(Object(E.a)(v))p=function(f,l){return v(f)-v(l)};else{var c=[];Object(N.a)(v)?c.push(v):Object(B.a)(v)&&(c=v),p=function(f,l){for(var T=0;T<c.length;T+=1){var m=c[T];if(f[m]>l[m])return 1;if(f[m]<l[m])return-1}return 0}}return A.sort(p),A}M.a=I},function(x,M,S){"use strict";var B=S(22),N=function(){for(var E=[],I=0;I<arguments.length;I++)E[I]=arguments[I];return Object(B.a)([].concat.apply([],E))};M.a=N},function(x,M,S){"use strict";var B=S(2),N=S(0),E=S(6);M.a=function(I,A){var v=[],p={};return I.forEach(function(c){var f=c[A];Object(E.a)(f)||(Object(N.a)(f)||(f=[f]),Object(B.a)(f,function(l){p[l]||(v.push(l),p[l]=!0)}))}),v}},function(x,M,S){"use strict";M.a=N;var B=S(1);function N(E){if(Object(B.a)(E))return E[0]}},function(x,M,S){"use strict";M.a=N;var B=S(1);function N(E){if(Object(B.a)(E)){var I=E;return I[I.length-1]}}},function(x,M,S){"use strict";var B=S(0),N=S(8);function E(I,A){return Object(B.a)(I)||Object(N.a)(I)?I[0]===A:!1}M.a=E},function(x,M,S){"use strict";var B=S(0),N=S(8);function E(I,A){return Object(B.a)(I)||Object(N.a)(I)?I[I.length-1]===A:!1}M.a=E},function(x,M,S){"use strict";var B=function(N,E){for(var I=0;I<N.length;I++)if(!E(N[I],I))return!1;return!0};M.a=B},function(x,M,S){"use strict";var B=function(N,E){for(var I=0;I<N.length;I++)if(E(N[I],I))return!0;return!1};M.a=B},function(x,M,S){"use strict";var B=S(23);M.a=function(N,E){if(!E)return[N];var I=Object(B.a)(N,E),A=[];for(var v in I)A.push(I[v]);return A}},function(x,M,S){"use strict";function B(N,E){return N["_wrap_"+E]}M.a=B},function(x,M,S){"use strict";function B(N,E){if(N["_wrap_"+E])return N["_wrap_"+E];var I=function(A){N[E](A)};return N["_wrap_"+E]=I,I}M.a=B},function(x,M,S){"use strict";var B={};function N(E){var I=B[E];if(!I){for(var A=E.toString(16),v=A.length;v<6;v++)A="0"+A;I="#"+A,B[E]=I}return I}M.a=N},function(x,M,S){"use strict";var B=S(0);function N(E){var I=0,A=0,v=0,p=0;return Object(B.a)(E)?E.length===1?I=A=v=p=E[0]:E.length===2?(I=v=E[0],A=p=E[1]):E.length===3?(I=E[0],A=p=E[1],v=E[2]):(I=E[0],A=E[1],v=E[2],p=E[3]):I=A=v=p=E,{r1:I,r2:A,r3:v,r4:p}}M.a=N},function(x,M,S){"use strict";var B=function(N,E,I){return N<E?E:N>I?I:N};M.a=B},function(x,M,S){"use strict";var B=function(N,E){var I=E.toString(),A=I.indexOf(".");if(A===-1)return Math.round(N);var v=I.substr(A+1).length;return v>20&&(v=20),parseFloat(N.toFixed(v))};M.a=B},function(x,M,S){"use strict";var B=S(5),N=function(E){return Object(B.a)(E)&&E%1!=0};M.a=N},function(x,M,S){"use strict";var B=S(5),N=function(E){return Object(B.a)(E)&&E%2==0};M.a=N},function(x,M,S){"use strict";var B=S(5),N=Number.isInteger?Number.isInteger:function(E){return Object(B.a)(E)&&E%1==0};M.a=N},function(x,M,S){"use strict";var B=S(5),N=function(E){return Object(B.a)(E)&&E<0};M.a=N},function(x,M,S){"use strict";M.a=N;var B=1e-5;function N(E,I,A){return A===void 0&&(A=B),Math.abs(E-I)<A}},function(x,M,S){"use strict";var B=S(5),N=function(E){return Object(B.a)(E)&&E%2!=0};M.a=N},function(x,M,S){"use strict";var B=S(5),N=function(E){return Object(B.a)(E)&&E>0};M.a=N},function(x,M,S){"use strict";var B=S(2),N=S(0),E=S(3);M.a=function(I,A){if(!!Object(N.a)(I)){var v=I[0],p;Object(E.a)(A)?p=A(I[0]):p=I[0][A];var c;return Object(B.a)(I,function(f){Object(E.a)(A)?c=A(f):c=f[A],c>p&&(v=f,p=c)}),v}}},function(x,M,S){"use strict";var B=S(2),N=S(0),E=S(3);M.a=function(I,A){if(!!Object(N.a)(I)){var v=I[0],p;Object(E.a)(A)?p=A(I[0]):p=I[0][A];var c;return Object(B.a)(I,function(f){Object(E.a)(A)?c=A(f):c=f[A],c<p&&(v=f,p=c)}),v}}},function(x,M,S){"use strict";var B=function(N,E){return(N%E+E)%E};M.a=B},function(x,M,S){"use strict";var B=180/Math.PI,N=function(E){return B*E};M.a=N},function(x,M,S){"use strict";M.a=parseInt},function(x,M,S){"use strict";var B=Math.PI/180,N=function(E){return B*E};M.a=N},function(x,M,S){"use strict";var B=S(2);M.a=B.a},function(x,M,S){"use strict";var B=S(25);M.a=B.a},function(x,M,S){"use strict";var B=S(12),N=S(26);M.a=function(E,I){return Object(B.a)(Object(N.a)(E),I)}},function(x,M,S){"use strict";var B=S(10),N=function(E){return Object(B.a)(E).toLowerCase()};M.a=N},function(x,M,S){"use strict";var B=S(10),N=function(E){var I=Object(B.a)(E);return I.charAt(0).toLowerCase()+I.substring(1)};M.a=N},function(x,M,S){"use strict";function B(N,E){return!N||!E?N:N.replace(/\\?\{([^{}]+)\}/g,function(I,A){return I.charAt(0)==="\\"?I.slice(1):E[A]===void 0?"":E[A]})}M.a=B},function(x,M,S){"use strict";var B=S(10),N=function(E){return Object(B.a)(E).toUpperCase()};M.a=N},function(x,M,S){"use strict";var B=S(10),N=function(E){var I=Object(B.a)(E);return I.charAt(0).toUpperCase()+I.substring(1)};M.a=N},function(x,M,S){"use strict";var B=S(4),N=function(E){return Object(B.a)(E,"Arguments")};M.a=N},function(x,M,S){"use strict";var B=S(4),N=function(E){return Object(B.a)(E,"Boolean")};M.a=N},function(x,M,S){"use strict";var B=S(4),N=function(E){return Object(B.a)(E,"Date")};M.a=N},function(x,M,S){"use strict";var B=S(4),N=function(E){return Object(B.a)(E,"Error")};M.a=N},function(x,M,S){"use strict";var B=S(5);M.a=function(N){return Object(B.a)(N)&&isFinite(N)}},function(x,M,S){"use strict";var B=function(N){return N===null};M.a=B},function(x,M,S){"use strict";var B=S(4),N=function(E){return Object(B.a)(E,"RegExp")};M.a=N},function(x,M,S){"use strict";var B=function(N){return N===void 0};M.a=B},function(x,M,S){"use strict";var B=function(N){return N instanceof Element||N instanceof HTMLDocument};M.a=B},function(x,M,S){"use strict";M.a=B;function B(N){var E=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(I){return setTimeout(I,16)};return E(N)}},function(x,M,S){"use strict";M.a=B;function B(N){var E=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout;E(N)}},function(x,M,S){"use strict";var B=S(16),N=S(3),E=function(){for(var I=[],A=0;A<arguments.length;A++)I[A]=arguments[A];for(var v=I[0],p=1;p<I.length;p++){var c=I[p];Object(N.a)(c)&&(c=c.prototype),Object(B.a)(v.prototype,c)}};M.a=E},function(x,M,S){"use strict";var B=S(0),N=function(E){if(typeof E!="object"||E===null)return E;var I;if(Object(B.a)(E)){I=[];for(var A=0,v=E.length;A<v;A++)typeof E[A]=="object"&&E[A]!=null?I[A]=N(E[A]):I[A]=E[A]}else{I={};for(var p in E)typeof E[p]=="object"&&E[p]!=null?I[p]=N(E[p]):I[p]=E[p]}return I};M.a=N},function(x,M,S){"use strict";function B(N,E,I){var A;return function(){var v=this,p=arguments,c=function(){A=null,I||N.apply(v,p)},f=I&&!A;clearTimeout(A),A=setTimeout(c,E),f&&N.apply(v,p)}}M.a=B},function(x,M,S){"use strict";var B=S(3);M.a=function(N,E){if(!Object(B.a)(N))throw new TypeError("Expected a function");var I=function(){for(var A=[],v=0;v<arguments.length;v++)A[v]=arguments[v];var p=E?E.apply(this,A):A[0],c=I.cache;if(c.has(p))return c.get(p);var f=N.apply(this,A);return c.set(p,f),f};return I.cache=new Map,I}},function(x,M,S){"use strict";var B=S(0),N=S(9),E=5;function I(v,p,c,f){c=c||0,f=f||E;for(var l in p)if(p.hasOwnProperty(l)){var T=p[l];T!==null&&Object(N.a)(T)?(Object(N.a)(v[l])||(v[l]={}),c<f?I(v[l],T,c+1,f):v[l]=p[l]):Object(B.a)(T)?(v[l]=[],v[l]=v[l].concat(T)):T!==void 0&&(v[l]=T)}}var A=function(v){for(var p=[],c=1;c<arguments.length;c++)p[c-1]=arguments[c];for(var f=0;f<p.length;f+=1)I(v,p[f]);return v};M.a=A},function(x,M,S){"use strict";var B=S(16),N=S(3),E=function(I,A,v,p){Object(N.a)(A)||(v=A,A=I,I=function(){});var c=Object.create?function(l,T){return Object.create(l,{constructor:{value:T}})}:function(l,T){function m(){}m.prototype=l;var w=new m;return w.constructor=T,w},f=c(A.prototype,I);return I.prototype=Object(B.a)(f,I.prototype),I.superclass=c(A.prototype,A),Object(B.a)(f,v),Object(B.a)(I,p),I};M.a=E},function(x,M,S){"use strict";var B=S(1),N=function(E,I){if(!Object(B.a)(E))return-1;var A=Array.prototype.indexOf;if(A)return A.call(E,I);for(var v=-1,p=0;p<E.length;p++)if(E[p]===I){v=p;break}return v};M.a=N},function(x,M,S){"use strict";var B=S(6),N=S(1),E=S(27),I=S(28),A=Object.prototype.hasOwnProperty;function v(p){if(Object(B.a)(p))return!0;if(Object(N.a)(p))return!p.length;var c=Object(E.a)(p);if(c==="Map"||c==="Set")return!p.size;if(Object(I.a)(p))return!Object.keys(p).length;for(var f in p)if(A.call(p,f))return!1;return!0}M.a=v},function(x,M,S){"use strict";var B=S(3),N=S(29);M.a=function(E,I,A){return Object(B.a)(A)?!!A(E,I):Object(N.a)(E,I)}},function(x,M,S){"use strict";var B=S(2),N=S(1),E=function(I,A){if(!Object(N.a)(I))return I;var v=[];return Object(B.a)(I,function(p,c){v.push(A(p,c))}),v};M.a=E},function(x,M,S){"use strict";var B=S(6),N=S(13),E=function(I){return I};M.a=function(I,A){A===void 0&&(A=E);var v={};return Object(N.a)(I)&&!Object(B.a)(I)&&Object.keys(I).forEach(function(p){v[p]=A(I[p],p)}),v}},function(x,M,S){"use strict";var B=S(8);M.a=function(N,E,I){for(var A=0,v=Object(B.a)(E)?E.split("."):E;N&&A<v.length;)N=N[v[A++]];return N===void 0||A<v.length?I:N}},function(x,M,S){"use strict";var B=S(13),N=S(8),E=S(5);M.a=function(I,A,v){var p=I,c=Object(N.a)(A)?A.split("."):A;return c.forEach(function(f,l){l<c.length-1?(Object(B.a)(p[f])||(p[f]=Object(E.a)(c[l+1])?[]:{}),p=p[f]):p[f]=v}),I}},function(x,M,S){"use strict";var B=S(2),N=S(9),E=Object.prototype.hasOwnProperty;M.a=function(I,A){if(I===null||!Object(N.a)(I))return{};var v={};return Object(B.a)(A,function(p){E.call(I,p)&&(v[p]=I[p])}),v}},function(x,M,S){"use strict";M.a=function(B,N,E){var I,A,v,p,c=0;E||(E={});var f=function(){c=E.leading===!1?0:Date.now(),I=null,p=B.apply(A,v),I||(A=v=null)},l=function(){var T=Date.now();!c&&E.leading===!1&&(c=T);var m=N-(T-c);return A=this,v=arguments,m<=0||m>N?(I&&(clearTimeout(I),I=null),c=T,p=B.apply(A,v),I||(A=v=null)):!I&&E.trailing!==!1&&(I=setTimeout(f,m)),p};return l.cancel=function(){clearTimeout(I),c=0,I=A=v=null},l}},function(x,M,S){"use strict";var B=S(1);M.a=function(N){return Object(B.a)(N)?Array.prototype.slice.call(N):[]}},function(x,M,S){"use strict";var B={};M.a=function(N){return N=N||"g",B[N]?B[N]+=1:B[N]=1,N+B[N]}},function(x,M,S){"use strict";M.a=function(){}},function(x,M,S){"use strict";M.a=function(B){return B}},function(x,M,S){"use strict";M.a=E;var B=S(6),N=S(1);function E(I){return Object(B.a)(I)?0:Object(N.a)(I)?I.length:Object.keys(I).length}},function(x,M,S){"use strict";var B=function(){function N(){this.map={}}return N.prototype.has=function(E){return this.map[E]!==void 0},N.prototype.get=function(E,I){var A=this.map[E];return A===void 0?I:A},N.prototype.set=function(E,I){this.map[E]=I},N.prototype.clear=function(){this.map={}},N.prototype.delete=function(E){delete this.map[E]},N.prototype.size=function(){return Object.keys(this.map).length},N}();M.a=B},function(x,M){function S(v,p,c,f){f===void 0&&(f=[]);var l=this;l.w=v||0,l.h=p||0,l.y=c||0,l.x=0,l.c=f||[],l.cs=f.length,l.prelim=0,l.mod=0,l.shift=0,l.change=0,l.tl=null,l.tr=null,l.el=null,l.er=null,l.msel=0,l.mser=0}S.fromNode=function(v,p){if(!v)return null;var c=[];return v.children.forEach(function(f){c.push(S.fromNode(f,p))}),p?new S(v.height,v.width,v.x,c):new S(v.width,v.height,v.y,c)};function B(v,p,c){c?v.y+=p:v.x+=p,v.children.forEach(function(f){B(f,p,c)})}function N(v,p){var c=p?v.y:v.x;return v.children.forEach(function(f){c=Math.min(N(f,p),c)}),c}function E(v,p){var c=N(v,p);B(v,-c,p)}function I(v,p,c){c?p.y=v.x:p.x=v.x,v.c.forEach(function(f,l){I(f,p.children[l],c)})}function A(v,p,c){c===void 0&&(c=0),p?(v.x=c,c+=v.width):(v.y=c,c+=v.height),v.children.forEach(function(f){A(f,p,c)})}x.exports=function(v,p){p===void 0&&(p={});var c=p.isHorizontal;function f(Q){if(Q.cs===0){l(Q);return}f(Q.c[0]);for(var re=J(D(Q.c[0].el),0,null),fe=1;fe<Q.cs;++fe){f(Q.c[fe]);var me=D(Q.c[fe].er);T(Q,fe,re),re=J(me,fe,re)}Y(Q),l(Q)}function l(Q){Q.cs===0?(Q.el=Q,Q.er=Q,Q.msel=Q.mser=0):(Q.el=Q.c[0].el,Q.msel=Q.c[0].msel,Q.er=Q.c[Q.cs-1].er,Q.mser=Q.c[Q.cs-1].mser)}function T(Q,re,fe){for(var me=Q.c[re-1],ae=me.mod,Ee=Q.c[re],Le=Ee.mod;me!==null&&Ee!==null;){D(me)>fe.low&&(fe=fe.nxt);var De=ae+me.prelim+me.w-(Le+Ee.prelim);De>0&&(Le+=De,m(Q,re,fe.index,De));var Ve=D(me),et=D(Ee);Ve<=et&&(me=O(me),me!==null&&(ae+=me.mod)),Ve>=et&&(Ee=w(Ee),Ee!==null&&(Le+=Ee.mod))}!me&&!!Ee?g(Q,re,Ee,Le):!!me&&!Ee&&_(Q,re,me,ae)}function m(Q,re,fe,me){Q.c[re].mod+=me,Q.c[re].msel+=me,Q.c[re].mser+=me,z(Q,re,fe,me)}function w(Q){return Q.cs===0?Q.tl:Q.c[0]}function O(Q){return Q.cs===0?Q.tr:Q.c[Q.cs-1]}function D(Q){return Q.y+Q.h}function g(Q,re,fe,me){var ae=Q.c[0].el;ae.tl=fe;var Ee=me-fe.mod-Q.c[0].msel;ae.mod+=Ee,ae.prelim-=Ee,Q.c[0].el=Q.c[re].el,Q.c[0].msel=Q.c[re].msel}function _(Q,re,fe,me){var ae=Q.c[re].er;ae.tr=fe;var Ee=me-fe.mod-Q.c[re].mser;ae.mod+=Ee,ae.prelim-=Ee,Q.c[re].er=Q.c[re-1].er,Q.c[re].mser=Q.c[re-1].mser}function Y(Q){Q.prelim=(Q.c[0].prelim+Q.c[0].mod+Q.c[Q.cs-1].mod+Q.c[Q.cs-1].prelim+Q.c[Q.cs-1].w)/2-Q.w/2}function V(Q,re){re+=Q.mod,Q.x=Q.prelim+re,Z(Q);for(var fe=0;fe<Q.cs;fe++)V(Q.c[fe],re)}function z(Q,re,fe,me){if(fe!==re-1){var ae=re-fe;Q.c[fe+1].shift+=me/ae,Q.c[re].shift-=me/ae,Q.c[re].change-=me-me/ae}}function Z(Q){for(var re=0,fe=0,me=0;me<Q.cs;me++)re+=Q.c[me].shift,fe+=re+Q.c[me].change,Q.c[me].mod+=fe}function J(Q,re,fe){for(;fe!==null&&Q>=fe.low;)fe=fe.nxt;return{low:Q,index:re,nxt:fe}}A(v,c);var ee=S.fromNode(v,c);return f(ee),V(ee,0),I(ee,v,c),E(v,c),v}},function(x,M,S){function B(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,f.__proto__=l}var N=S(11),E=S(115),I=S(17),A=S(7),v=function(f){B(l,f);function l(){return f.apply(this,arguments)||this}var T=l.prototype;return T.execute=function(){var w=this;return w.rootNode.width=0,I(w.rootNode,w.options,E)},l}(N),p={};function c(f,l){return l=A.assign({},p,l),new v(f,l).execute()}x.exports=c},function(x,M,S){var B=S(7);function N(A,v){A===void 0&&(A=0),v===void 0&&(v=[]);var p=this;p.x=p.y=0,p.leftChild=p.rightChild=null,p.height=0,p.children=v}var E={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function I(A,v,p){p?(v.x=A.x,v.y=A.y):(v.x=A.y,v.y=A.x),A.children.forEach(function(c,f){I(c,v.children[f],p)})}x.exports=function(A,v){v===void 0&&(v={}),v=B.assign({},E,v);var p=0;function c(w){if(!w)return null;w.width=0,w.depth&&w.depth>p&&(p=w.depth);var O=w.children,D=O.length,g=new N(w.height,[]);return O.forEach(function(_,Y){var V=c(_);g.children.push(V),Y===0&&(g.leftChild=V),Y===D-1&&(g.rightChild=V)}),g.originNode=w,g.isLeaf=w.isLeaf(),g}function f(w){if(w.isLeaf||w.children.length===0)w.drawingDepth=p;else{var O=w.children.map(function(g){return f(g)}),D=Math.min.apply(null,O);w.drawingDepth=D-1}return w.drawingDepth}var l;function T(w){w.x=w.drawingDepth*v.rankSep,w.isLeaf?(w.y=0,l&&(w.y=l.y+l.height+v.nodeSep,w.originNode.parent!==l.originNode.parent&&(w.y+=v.subTreeSep)),l=w):(w.children.forEach(function(O){T(O)}),w.y=(w.leftChild.y+w.rightChild.y)/2)}var m=c(A);return f(m),T(m),I(m,A,v.isHorizontal),A}},function(x,M,S){function B(T,m){T.prototype=Object.create(m.prototype),T.prototype.constructor=T,T.__proto__=m}var N=S(11),E=S(117),I=S(30),A=S(7),v=["LR","RL","H"],p=v[0],c=function(T){B(m,T);function m(){return T.apply(this,arguments)||this}var w=m.prototype;return w.execute=function(){var D=this,g=D.options,_=D.rootNode;g.isHorizontal=!0;var Y=g.indent,V=Y===void 0?20:Y,z=g.dropCap,Z=z===void 0?!0:z,J=g.direction||p;if(J&&v.indexOf(J)===-1)throw new TypeError("Invalid direction: "+J);if(J===v[0])E(_,V,Z);else if(J===v[1])E(_,V,Z),_.right2left();else if(J===v[2]){var ee=I(_,g),Q=ee.left,re=ee.right;E(Q,V,Z),Q.right2left(),E(re,V,Z);var fe=Q.getBoundingBox();re.translate(fe.width,0),_.x=re.x-_.width/2}return _},m}(N),f={};function l(T,m){return m=A.assign({},f,m),new c(T,m).execute()}x.exports=l},function(x,M){function S(B,N,E,I){var A=typeof E=="function"?E(B):E*B.depth;if(!I)try{if(B.id===B.parent.children[0].id){B.x+=A,B.y=N?N.y:0;return}}catch(v){}B.x+=A,B.y=N?N.y+N.height:0}x.exports=function(B,N,E){var I=null;B.eachNode(function(A){S(A,I,N,E),I=A})}},function(x,M,S){function B(f,l){f.prototype=Object.create(l.prototype),f.prototype.constructor=f,f.__proto__=l}var N=S(11),E=S(119),I=S(17),A=S(7),v=function(f){B(l,f);function l(){return f.apply(this,arguments)||this}var T=l.prototype;return T.execute=function(){var w=this;return I(w.rootNode,w.options,E)},l}(N),p={};function c(f,l){return l=A.assign({},p,l),new v(f,l).execute()}x.exports=c},function(x,M,S){var B=S(7);function N(A,v){var p=0;return A.children.length?A.children.forEach(function(c){p+=N(c,v)}):p=A.height,A._subTreeSep=v.getSubTreeSep(A.data),A.totalHeight=Math.max(A.height,p)+2*A._subTreeSep,A.totalHeight}function E(A){var v=A.children,p=v.length;if(p){v.forEach(function(w){E(w)});var c=v[0],f=v[p-1],l=f.y-c.y+f.height,T=0;if(v.forEach(function(w){T+=w.totalHeight}),l>A.height)A.y=c.y+l/2-A.height/2;else if(v.length!==1||A.height>T){var m=A.y+(A.height-l)/2-c.y;v.forEach(function(w){w.translate(0,m)})}else A.y=(c.y+c.height/2+f.y+f.height/2)/2-A.height/2}}var I={getSubTreeSep:function(){return 0}};x.exports=function(A,v){v===void 0&&(v={}),v=B.assign({},I,v),A.parent={x:0,width:0,height:0,y:0},A.BFTraverse(function(p){p.x=p.parent.x+p.parent.width}),A.parent=null,N(A,v),A.startY=0,A.y=A.totalHeight/2-A.height/2,A.eachNode(function(p){var c=p.children,f=c.length;if(f){var l=c[0];if(l.startY=p.startY+p._subTreeSep,f===1)l.y=p.y+p.height/2-l.height/2;else{l.y=l.startY+l.totalHeight/2-l.height/2;for(var T=1;T<f;T++){var m=c[T];m.startY=c[T-1].startY+c[T-1].totalHeight,m.y=m.startY+m.totalHeight/2-m.height/2}}}}),E(A)}}])})},31278:function(dt,x,M){"use strict";var S;S={value:!0};var B=M(92906);function N(l,T,m){var w=[0,0,0,0,0,0,0,0,0];return B.mat3.fromTranslation(w,m),B.mat3.multiply(l,w,T)}S=N;function E(l,T,m){var w=[0,0,0,0,0,0,0,0,0];return B.mat3.fromRotation(w,m),B.mat3.multiply(l,w,T)}S=E;function I(l,T,m){var w=[0,0,0,0,0,0,0,0,0];return B.mat3.fromScaling(w,m),B.mat3.multiply(l,w,T)}S=I;function A(l,T,m){return B.mat3.multiply(l,m,T)}function v(l,T){for(var m=l?[].concat(l):[1,0,0,0,1,0,0,0,1],w=0,O=T.length;w<O;w++){var D=T[w];switch(D[0]){case"t":N(m,m,[D[1],D[2]]);break;case"s":I(m,m,[D[1],D[2]]);break;case"r":E(m,m,D[1]);break;case"m":A(m,m,D[1]);break;default:break}}return m}x.vs=v;function p(l,T){return l[0]*T[1]-T[0]*l[1]}S=p;function c(l,T,m){var w=B.vec2.angle(l,T),O=p(l,T)>=0;return m?O?Math.PI*2-w:w:O?w:Math.PI*2-w}S=c;function f(l,T,m){return m?(l[0]=T[1],l[1]=-1*T[0]):(l[0]=-1*T[1],l[1]=T[0]),l}S=f},59591:function(dt,x,M){var S=M(50008).default;function B(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */dt.exports=B=function(){return N},dt.exports.__esModule=!0,dt.exports.default=dt.exports;var N={},E=Object.prototype,I=E.hasOwnProperty,A=typeof Symbol=="function"?Symbol:{},v=A.iterator||"@@iterator",p=A.asyncIterator||"@@asyncIterator",c=A.toStringTag||"@@toStringTag";function f(ae,Ee,Le){return Object.defineProperty(ae,Ee,{value:Le,enumerable:!0,configurable:!0,writable:!0}),ae[Ee]}try{f({},"")}catch(ae){f=function(Le,De,Ve){return Le[De]=Ve}}function l(ae,Ee,Le,De){var Ve=Ee&&Ee.prototype instanceof w?Ee:w,et=Object.create(Ve.prototype),It=new re(De||[]);return et._invoke=function(er,nr,Fe){var Vt="suspendedStart";return function($t,Ar){if(Vt==="executing")throw new Error("Generator is already running");if(Vt==="completed"){if($t==="throw")throw Ar;return me()}for(Fe.method=$t,Fe.arg=Ar;;){var ke=Fe.delegate;if(ke){var Oe=J(ke,Fe);if(Oe){if(Oe===m)continue;return Oe}}if(Fe.method==="next")Fe.sent=Fe._sent=Fe.arg;else if(Fe.method==="throw"){if(Vt==="suspendedStart")throw Vt="completed",Fe.arg;Fe.dispatchException(Fe.arg)}else Fe.method==="return"&&Fe.abrupt("return",Fe.arg);Vt="executing";var we=T(er,nr,Fe);if(we.type==="normal"){if(Vt=Fe.done?"completed":"suspendedYield",we.arg===m)continue;return{value:we.arg,done:Fe.done}}we.type==="throw"&&(Vt="completed",Fe.method="throw",Fe.arg=we.arg)}}}(ae,Le,It),et}function T(ae,Ee,Le){try{return{type:"normal",arg:ae.call(Ee,Le)}}catch(De){return{type:"throw",arg:De}}}N.wrap=l;var m={};function w(){}function O(){}function D(){}var g={};f(g,v,function(){return this});var _=Object.getPrototypeOf,Y=_&&_(_(fe([])));Y&&Y!==E&&I.call(Y,v)&&(g=Y);var V=D.prototype=w.prototype=Object.create(g);function z(ae){["next","throw","return"].forEach(function(Ee){f(ae,Ee,function(Le){return this._invoke(Ee,Le)})})}function Z(ae,Ee){function Le(Ve,et,It,er){var nr=T(ae[Ve],ae,et);if(nr.type!=="throw"){var Fe=nr.arg,Vt=Fe.value;return Vt&&S(Vt)=="object"&&I.call(Vt,"__await")?Ee.resolve(Vt.__await).then(function($t){Le("next",$t,It,er)},function($t){Le("throw",$t,It,er)}):Ee.resolve(Vt).then(function($t){Fe.value=$t,It(Fe)},function($t){return Le("throw",$t,It,er)})}er(nr.arg)}var De;this._invoke=function(Ve,et){function It(){return new Ee(function(er,nr){Le(Ve,et,er,nr)})}return De=De?De.then(It,It):It()}}function J(ae,Ee){var Le=ae.iterator[Ee.method];if(Le===void 0){if(Ee.delegate=null,Ee.method==="throw"){if(ae.iterator.return&&(Ee.method="return",Ee.arg=void 0,J(ae,Ee),Ee.method==="throw"))return m;Ee.method="throw",Ee.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var De=T(Le,ae.iterator,Ee.arg);if(De.type==="throw")return Ee.method="throw",Ee.arg=De.arg,Ee.delegate=null,m;var Ve=De.arg;return Ve?Ve.done?(Ee[ae.resultName]=Ve.value,Ee.next=ae.nextLoc,Ee.method!=="return"&&(Ee.method="next",Ee.arg=void 0),Ee.delegate=null,m):Ve:(Ee.method="throw",Ee.arg=new TypeError("iterator result is not an object"),Ee.delegate=null,m)}function ee(ae){var Ee={tryLoc:ae[0]};1 in ae&&(Ee.catchLoc=ae[1]),2 in ae&&(Ee.finallyLoc=ae[2],Ee.afterLoc=ae[3]),this.tryEntries.push(Ee)}function Q(ae){var Ee=ae.completion||{};Ee.type="normal",delete Ee.arg,ae.completion=Ee}function re(ae){this.tryEntries=[{tryLoc:"root"}],ae.forEach(ee,this),this.reset(!0)}function fe(ae){if(ae){var Ee=ae[v];if(Ee)return Ee.call(ae);if(typeof ae.next=="function")return ae;if(!isNaN(ae.length)){var Le=-1,De=function Ve(){for(;++Le<ae.length;)if(I.call(ae,Le))return Ve.value=ae[Le],Ve.done=!1,Ve;return Ve.value=void 0,Ve.done=!0,Ve};return De.next=De}}return{next:me}}function me(){return{value:void 0,done:!0}}return O.prototype=D,f(V,"constructor",D),f(D,"constructor",O),O.displayName=f(D,c,"GeneratorFunction"),N.isGeneratorFunction=function(ae){var Ee=typeof ae=="function"&&ae.constructor;return!!Ee&&(Ee===O||(Ee.displayName||Ee.name)==="GeneratorFunction")},N.mark=function(ae){return Object.setPrototypeOf?Object.setPrototypeOf(ae,D):(ae.__proto__=D,f(ae,c,"GeneratorFunction")),ae.prototype=Object.create(V),ae},N.awrap=function(ae){return{__await:ae}},z(Z.prototype),f(Z.prototype,p,function(){return this}),N.AsyncIterator=Z,N.async=function(ae,Ee,Le,De,Ve){Ve===void 0&&(Ve=Promise);var et=new Z(l(ae,Ee,Le,De),Ve);return N.isGeneratorFunction(Ee)?et:et.next().then(function(It){return It.done?It.value:et.next()})},z(V),f(V,c,"Generator"),f(V,v,function(){return this}),f(V,"toString",function(){return"[object Generator]"}),N.keys=function(ae){var Ee=[];for(var Le in ae)Ee.push(Le);return Ee.reverse(),function De(){for(;Ee.length;){var Ve=Ee.pop();if(Ve in ae)return De.value=Ve,De.done=!1,De}return De.done=!0,De}},N.values=fe,re.prototype={constructor:re,reset:function(Ee){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(Q),!Ee)for(var Le in this)Le.charAt(0)==="t"&&I.call(this,Le)&&!isNaN(+Le.slice(1))&&(this[Le]=void 0)},stop:function(){this.done=!0;var Ee=this.tryEntries[0].completion;if(Ee.type==="throw")throw Ee.arg;return this.rval},dispatchException:function(Ee){if(this.done)throw Ee;var Le=this;function De(Fe,Vt){return It.type="throw",It.arg=Ee,Le.next=Fe,Vt&&(Le.method="next",Le.arg=void 0),!!Vt}for(var Ve=this.tryEntries.length-1;Ve>=0;--Ve){var et=this.tryEntries[Ve],It=et.completion;if(et.tryLoc==="root")return De("end");if(et.tryLoc<=this.prev){var er=I.call(et,"catchLoc"),nr=I.call(et,"finallyLoc");if(er&&nr){if(this.prev<et.catchLoc)return De(et.catchLoc,!0);if(this.prev<et.finallyLoc)return De(et.finallyLoc)}else if(er){if(this.prev<et.catchLoc)return De(et.catchLoc,!0)}else{if(!nr)throw new Error("try statement without catch or finally");if(this.prev<et.finallyLoc)return De(et.finallyLoc)}}}},abrupt:function(Ee,Le){for(var De=this.tryEntries.length-1;De>=0;--De){var Ve=this.tryEntries[De];if(Ve.tryLoc<=this.prev&&I.call(Ve,"finallyLoc")&&this.prev<Ve.finallyLoc){var et=Ve;break}}et&&(Ee==="break"||Ee==="continue")&&et.tryLoc<=Le&&Le<=et.finallyLoc&&(et=null);var It=et?et.completion:{};return It.type=Ee,It.arg=Le,et?(this.method="next",this.next=et.finallyLoc,m):this.complete(It)},complete:function(Ee,Le){if(Ee.type==="throw")throw Ee.arg;return Ee.type==="break"||Ee.type==="continue"?this.next=Ee.arg:Ee.type==="return"?(this.rval=this.arg=Ee.arg,this.method="return",this.next="end"):Ee.type==="normal"&&Le&&(this.next=Le),m},finish:function(Ee){for(var Le=this.tryEntries.length-1;Le>=0;--Le){var De=this.tryEntries[Le];if(De.finallyLoc===Ee)return this.complete(De.completion,De.afterLoc),Q(De),m}},catch:function(Ee){for(var Le=this.tryEntries.length-1;Le>=0;--Le){var De=this.tryEntries[Le];if(De.tryLoc===Ee){var Ve=De.completion;if(Ve.type==="throw"){var et=Ve.arg;Q(De)}return et}}throw new Error("illegal catch attempt")},delegateYield:function(Ee,Le,De){return this.delegate={iterator:fe(Ee),resultName:Le,nextLoc:De},this.method==="next"&&(this.arg=void 0),m}},N}dt.exports=B,dt.exports.__esModule=!0,dt.exports.default=dt.exports},87757:function(dt,x,M){var S=M(59591)();dt.exports=S;try{regeneratorRuntime=S}catch(B){typeof globalThis=="object"?globalThis.regeneratorRuntime=S:Function("r","regeneratorRuntime = r")(S)}},41685:function(dt,x,M){"use strict";M.r(x),M.d(x,{forceCenter:function(){return S},forceCollide:function(){return v},forceLink:function(){return f},forceManyBody:function(){return He},forceRadial:function(){return St},forceSimulation:function(){return We},forceX:function(){return Mt},forceY:function(){return sr}});function S(Ge,ut){var U,he=1;Ge==null&&(Ge=0),ut==null&&(ut=0);function Qe(){var le,ct=U.length,ft,jt=0,Lt=0;for(le=0;le<ct;++le)ft=U[le],jt+=ft.x,Lt+=ft.y;for(jt=(jt/ct-Ge)*he,Lt=(Lt/ct-ut)*he,le=0;le<ct;++le)ft=U[le],ft.x-=jt,ft.y-=Lt}return Qe.initialize=function(le){U=le},Qe.x=function(le){return arguments.length?(Ge=+le,Qe):Ge},Qe.y=function(le){return arguments.length?(ut=+le,Qe):ut},Qe.strength=function(le){return arguments.length?(he=+le,Qe):he},Qe}var B=M(28833);function N(Ge){return function(){return Ge}}function E(Ge){return(Ge()-.5)*1e-6}function I(Ge){return Ge.x+Ge.vx}function A(Ge){return Ge.y+Ge.vy}function v(Ge){var ut,U,he,Qe=1,le=1;typeof Ge!="function"&&(Ge=N(Ge==null?1:+Ge));function ct(){for(var Lt,Ht=ut.length,vr,rt,at,Pt,gt,Dt,ir=0;ir<le;++ir)for(vr=(0,B.Z)(ut,I,A).visitAfter(ft),Lt=0;Lt<Ht;++Lt)rt=ut[Lt],gt=U[rt.index],Dt=gt*gt,at=rt.x+rt.vx,Pt=rt.y+rt.vy,vr.visit(At);function At(xr,Pr,Qr,Vr,nn){var dn=xr.data,Vn=xr.r,cn=gt+Vn;if(dn){if(dn.index>rt.index){var wn=at-dn.x-dn.vx,xn=Pt-dn.y-dn.vy,gn=wn*wn+xn*xn;gn<cn*cn&&(wn===0&&(wn=E(he),gn+=wn*wn),xn===0&&(xn=E(he),gn+=xn*xn),gn=(cn-(gn=Math.sqrt(gn)))/gn*Qe,rt.vx+=(wn*=gn)*(cn=(Vn*=Vn)/(Dt+Vn)),rt.vy+=(xn*=gn)*cn,dn.vx-=wn*(cn=1-cn),dn.vy-=xn*cn)}return}return Pr>at+cn||Vr<at-cn||Qr>Pt+cn||nn<Pt-cn}}function ft(Lt){if(Lt.data)return Lt.r=U[Lt.data.index];for(var Ht=Lt.r=0;Ht<4;++Ht)Lt[Ht]&&Lt[Ht].r>Lt.r&&(Lt.r=Lt[Ht].r)}function jt(){if(!!ut){var Lt,Ht=ut.length,vr;for(U=new Array(Ht),Lt=0;Lt<Ht;++Lt)vr=ut[Lt],U[vr.index]=+Ge(vr,Lt,ut)}}return ct.initialize=function(Lt,Ht){ut=Lt,he=Ht,jt()},ct.iterations=function(Lt){return arguments.length?(le=+Lt,ct):le},ct.strength=function(Lt){return arguments.length?(Qe=+Lt,ct):Qe},ct.radius=function(Lt){return arguments.length?(Ge=typeof Lt=="function"?Lt:N(+Lt),jt(),ct):Ge},ct}function p(Ge){return Ge.index}function c(Ge,ut){var U=Ge.get(ut);if(!U)throw new Error("node not found: "+ut);return U}function f(Ge){var ut=p,U=vr,he,Qe=N(30),le,ct,ft,jt,Lt,Ht=1;Ge==null&&(Ge=[]);function vr(Dt){return 1/Math.min(ft[Dt.source.index],ft[Dt.target.index])}function rt(Dt){for(var ir=0,At=Ge.length;ir<Ht;++ir)for(var xr=0,Pr,Qr,Vr,nn,dn,Vn,cn;xr<At;++xr)Pr=Ge[xr],Qr=Pr.source,Vr=Pr.target,nn=Vr.x+Vr.vx-Qr.x-Qr.vx||E(Lt),dn=Vr.y+Vr.vy-Qr.y-Qr.vy||E(Lt),Vn=Math.sqrt(nn*nn+dn*dn),Vn=(Vn-le[xr])/Vn*Dt*he[xr],nn*=Vn,dn*=Vn,Vr.vx-=nn*(cn=jt[xr]),Vr.vy-=dn*cn,Qr.vx+=nn*(cn=1-cn),Qr.vy+=dn*cn}function at(){if(!!ct){var Dt,ir=ct.length,At=Ge.length,xr=new Map(ct.map(function(Qr,Vr){return[ut(Qr,Vr,ct),Qr]})),Pr;for(Dt=0,ft=new Array(ir);Dt<At;++Dt)Pr=Ge[Dt],Pr.index=Dt,typeof Pr.source!="object"&&(Pr.source=c(xr,Pr.source)),typeof Pr.target!="object"&&(Pr.target=c(xr,Pr.target)),ft[Pr.source.index]=(ft[Pr.source.index]||0)+1,ft[Pr.target.index]=(ft[Pr.target.index]||0)+1;for(Dt=0,jt=new Array(At);Dt<At;++Dt)Pr=Ge[Dt],jt[Dt]=ft[Pr.source.index]/(ft[Pr.source.index]+ft[Pr.target.index]);he=new Array(At),Pt(),le=new Array(At),gt()}}function Pt(){if(!!ct)for(var Dt=0,ir=Ge.length;Dt<ir;++Dt)he[Dt]=+U(Ge[Dt],Dt,Ge)}function gt(){if(!!ct)for(var Dt=0,ir=Ge.length;Dt<ir;++Dt)le[Dt]=+Qe(Ge[Dt],Dt,Ge)}return rt.initialize=function(Dt,ir){ct=Dt,Lt=ir,at()},rt.links=function(Dt){return arguments.length?(Ge=Dt,at(),rt):Ge},rt.id=function(Dt){return arguments.length?(ut=Dt,rt):ut},rt.iterations=function(Dt){return arguments.length?(Ht=+Dt,rt):Ht},rt.strength=function(Dt){return arguments.length?(U=typeof Dt=="function"?Dt:N(+Dt),Pt(),rt):U},rt.distance=function(Dt){return arguments.length?(Qe=typeof Dt=="function"?Dt:N(+Dt),gt(),rt):Qe},rt}var l={value:function(){}};function T(){for(var Ge=0,ut=arguments.length,U={},he;Ge<ut;++Ge){if(!(he=arguments[Ge]+"")||he in U||/[\s.]/.test(he))throw new Error("illegal type: "+he);U[he]=[]}return new m(U)}function m(Ge){this._=Ge}function w(Ge,ut){return Ge.trim().split(/^|\s+/).map(function(U){var he="",Qe=U.indexOf(".");if(Qe>=0&&(he=U.slice(Qe+1),U=U.slice(0,Qe)),U&&!ut.hasOwnProperty(U))throw new Error("unknown type: "+U);return{type:U,name:he}})}m.prototype=T.prototype={constructor:m,on:function(ut,U){var he=this._,Qe=w(ut+"",he),le,ct=-1,ft=Qe.length;if(arguments.length<2){for(;++ct<ft;)if((le=(ut=Qe[ct]).type)&&(le=O(he[le],ut.name)))return le;return}if(U!=null&&typeof U!="function")throw new Error("invalid callback: "+U);for(;++ct<ft;)if(le=(ut=Qe[ct]).type)he[le]=D(he[le],ut.name,U);else if(U==null)for(le in he)he[le]=D(he[le],ut.name,null);return this},copy:function(){var ut={},U=this._;for(var he in U)ut[he]=U[he].slice();return new m(ut)},call:function(ut,U){if((le=arguments.length-2)>0)for(var he=new Array(le),Qe=0,le,ct;Qe<le;++Qe)he[Qe]=arguments[Qe+2];if(!this._.hasOwnProperty(ut))throw new Error("unknown type: "+ut);for(ct=this._[ut],Qe=0,le=ct.length;Qe<le;++Qe)ct[Qe].value.apply(U,he)},apply:function(ut,U,he){if(!this._.hasOwnProperty(ut))throw new Error("unknown type: "+ut);for(var Qe=this._[ut],le=0,ct=Qe.length;le<ct;++le)Qe[le].value.apply(U,he)}};function O(Ge,ut){for(var U=0,he=Ge.length,Qe;U<he;++U)if((Qe=Ge[U]).name===ut)return Qe.value}function D(Ge,ut,U){for(var he=0,Qe=Ge.length;he<Qe;++he)if(Ge[he].name===ut){Ge[he]=l,Ge=Ge.slice(0,he).concat(Ge.slice(he+1));break}return U!=null&&Ge.push({name:ut,value:U}),Ge}var g=T,_=0,Y=0,V=0,z=1e3,Z,J,ee=0,Q=0,re=0,fe=typeof performance=="object"&&performance.now?performance:Date,me=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(Ge){setTimeout(Ge,17)};function ae(){return Q||(me(Ee),Q=fe.now()+re)}function Ee(){Q=0}function Le(){this._call=this._time=this._next=null}Le.prototype=De.prototype={constructor:Le,restart:function(Ge,ut,U){if(typeof Ge!="function")throw new TypeError("callback is not a function");U=(U==null?ae():+U)+(ut==null?0:+ut),!this._next&&J!==this&&(J?J._next=this:Z=this,J=this),this._call=Ge,this._time=U,nr()},stop:function(){this._call&&(this._call=null,this._time=Infinity,nr())}};function De(Ge,ut,U){var he=new Le;return he.restart(Ge,ut,U),he}function Ve(){ae(),++_;for(var Ge=Z,ut;Ge;)(ut=Q-Ge._time)>=0&&Ge._call.call(null,ut),Ge=Ge._next;--_}function et(){Q=(ee=fe.now())+re,_=Y=0;try{Ve()}finally{_=0,er(),Q=0}}function It(){var Ge=fe.now(),ut=Ge-ee;ut>z&&(re-=ut,ee=Ge)}function er(){for(var Ge,ut=Z,U,he=Infinity;ut;)ut._call?(he>ut._time&&(he=ut._time),Ge=ut,ut=ut._next):(U=ut._next,ut._next=null,ut=Ge?Ge._next=U:Z=U);J=Ge,nr(he)}function nr(Ge){if(!_){Y&&(Y=clearTimeout(Y));var ut=Ge-Q;ut>24?(Ge<Infinity&&(Y=setTimeout(et,Ge-fe.now()-re)),V&&(V=clearInterval(V))):(V||(ee=fe.now(),V=setInterval(It,z)),_=1,me(et))}}var Fe=1664525,Vt=1013904223,$t=4294967296;function Ar(){var Ge=1;return function(){return(Ge=(Fe*Ge+Vt)%$t)/$t}}function ke(Ge){return Ge.x}function Oe(Ge){return Ge.y}var we=10,Be=Math.PI*(3-Math.sqrt(5));function We(Ge){var ut,U=1,he=.001,Qe=1-Math.pow(he,1/300),le=0,ct=.6,ft=new Map,jt=De(vr),Lt=g("tick","end"),Ht=Ar();Ge==null&&(Ge=[]);function vr(){rt(),Lt.call("tick",ut),U<he&&(jt.stop(),Lt.call("end",ut))}function rt(gt){var Dt,ir=Ge.length,At;gt===void 0&&(gt=1);for(var xr=0;xr<gt;++xr)for(U+=(le-U)*Qe,ft.forEach(function(Pr){Pr(U)}),Dt=0;Dt<ir;++Dt)At=Ge[Dt],At.fx==null?At.x+=At.vx*=ct:(At.x=At.fx,At.vx=0),At.fy==null?At.y+=At.vy*=ct:(At.y=At.fy,At.vy=0);return ut}function at(){for(var gt=0,Dt=Ge.length,ir;gt<Dt;++gt){if(ir=Ge[gt],ir.index=gt,ir.fx!=null&&(ir.x=ir.fx),ir.fy!=null&&(ir.y=ir.fy),isNaN(ir.x)||isNaN(ir.y)){var At=we*Math.sqrt(.5+gt),xr=gt*Be;ir.x=At*Math.cos(xr),ir.y=At*Math.sin(xr)}(isNaN(ir.vx)||isNaN(ir.vy))&&(ir.vx=ir.vy=0)}}function Pt(gt){return gt.initialize&&gt.initialize(Ge,Ht),gt}return at(),ut={tick:rt,restart:function(){return jt.restart(vr),ut},stop:function(){return jt.stop(),ut},nodes:function(Dt){return arguments.length?(Ge=Dt,at(),ft.forEach(Pt),ut):Ge},alpha:function(Dt){return arguments.length?(U=+Dt,ut):U},alphaMin:function(Dt){return arguments.length?(he=+Dt,ut):he},alphaDecay:function(Dt){return arguments.length?(Qe=+Dt,ut):+Qe},alphaTarget:function(Dt){return arguments.length?(le=+Dt,ut):le},velocityDecay:function(Dt){return arguments.length?(ct=1-Dt,ut):1-ct},randomSource:function(Dt){return arguments.length?(Ht=Dt,ft.forEach(Pt),ut):Ht},force:function(Dt,ir){return arguments.length>1?(ir==null?ft.delete(Dt):ft.set(Dt,Pt(ir)),ut):ft.get(Dt)},find:function(Dt,ir,At){var xr=0,Pr=Ge.length,Qr,Vr,nn,dn,Vn;for(At==null?At=Infinity:At*=At,xr=0;xr<Pr;++xr)dn=Ge[xr],Qr=Dt-dn.x,Vr=ir-dn.y,nn=Qr*Qr+Vr*Vr,nn<At&&(Vn=dn,At=nn);return Vn},on:function(Dt,ir){return arguments.length>1?(Lt.on(Dt,ir),ut):Lt.on(Dt)}}}function He(){var Ge,ut,U,he,Qe=N(-30),le,ct=1,ft=Infinity,jt=.81;function Lt(at){var Pt,gt=Ge.length,Dt=(0,B.Z)(Ge,ke,Oe).visitAfter(vr);for(he=at,Pt=0;Pt<gt;++Pt)ut=Ge[Pt],Dt.visit(rt)}function Ht(){if(!!Ge){var at,Pt=Ge.length,gt;for(le=new Array(Pt),at=0;at<Pt;++at)gt=Ge[at],le[gt.index]=+Qe(gt,at,Ge)}}function vr(at){var Pt=0,gt,Dt,ir=0,At,xr,Pr;if(at.length){for(At=xr=Pr=0;Pr<4;++Pr)(gt=at[Pr])&&(Dt=Math.abs(gt.value))&&(Pt+=gt.value,ir+=Dt,At+=Dt*gt.x,xr+=Dt*gt.y);at.x=At/ir,at.y=xr/ir}else{gt=at,gt.x=gt.data.x,gt.y=gt.data.y;do Pt+=le[gt.data.index];while(gt=gt.next)}at.value=Pt}function rt(at,Pt,gt,Dt){if(!at.value)return!0;var ir=at.x-ut.x,At=at.y-ut.y,xr=Dt-Pt,Pr=ir*ir+At*At;if(xr*xr/jt<Pr)return Pr<ft&&(ir===0&&(ir=E(U),Pr+=ir*ir),At===0&&(At=E(U),Pr+=At*At),Pr<ct&&(Pr=Math.sqrt(ct*Pr)),ut.vx+=ir*at.value*he/Pr,ut.vy+=At*at.value*he/Pr),!0;if(at.length||Pr>=ft)return;(at.data!==ut||at.next)&&(ir===0&&(ir=E(U),Pr+=ir*ir),At===0&&(At=E(U),Pr+=At*At),Pr<ct&&(Pr=Math.sqrt(ct*Pr)));do at.data!==ut&&(xr=le[at.data.index]*he/Pr,ut.vx+=ir*xr,ut.vy+=At*xr);while(at=at.next)}return Lt.initialize=function(at,Pt){Ge=at,U=Pt,Ht()},Lt.strength=function(at){return arguments.length?(Qe=typeof at=="function"?at:N(+at),Ht(),Lt):Qe},Lt.distanceMin=function(at){return arguments.length?(ct=at*at,Lt):Math.sqrt(ct)},Lt.distanceMax=function(at){return arguments.length?(ft=at*at,Lt):Math.sqrt(ft)},Lt.theta=function(at){return arguments.length?(jt=at*at,Lt):Math.sqrt(jt)},Lt}function St(Ge,ut,U){var he,Qe=N(.1),le,ct;typeof Ge!="function"&&(Ge=N(+Ge)),ut==null&&(ut=0),U==null&&(U=0);function ft(Lt){for(var Ht=0,vr=he.length;Ht<vr;++Ht){var rt=he[Ht],at=rt.x-ut||1e-6,Pt=rt.y-U||1e-6,gt=Math.sqrt(at*at+Pt*Pt),Dt=(ct[Ht]-gt)*le[Ht]*Lt/gt;rt.vx+=at*Dt,rt.vy+=Pt*Dt}}function jt(){if(!!he){var Lt,Ht=he.length;for(le=new Array(Ht),ct=new Array(Ht),Lt=0;Lt<Ht;++Lt)ct[Lt]=+Ge(he[Lt],Lt,he),le[Lt]=isNaN(ct[Lt])?0:+Qe(he[Lt],Lt,he)}}return ft.initialize=function(Lt){he=Lt,jt()},ft.strength=function(Lt){return arguments.length?(Qe=typeof Lt=="function"?Lt:N(+Lt),jt(),ft):Qe},ft.radius=function(Lt){return arguments.length?(Ge=typeof Lt=="function"?Lt:N(+Lt),jt(),ft):Ge},ft.x=function(Lt){return arguments.length?(ut=+Lt,ft):ut},ft.y=function(Lt){return arguments.length?(U=+Lt,ft):U},ft}function Mt(Ge){var ut=N(.1),U,he,Qe;typeof Ge!="function"&&(Ge=N(Ge==null?0:+Ge));function le(ft){for(var jt=0,Lt=U.length,Ht;jt<Lt;++jt)Ht=U[jt],Ht.vx+=(Qe[jt]-Ht.x)*he[jt]*ft}function ct(){if(!!U){var ft,jt=U.length;for(he=new Array(jt),Qe=new Array(jt),ft=0;ft<jt;++ft)he[ft]=isNaN(Qe[ft]=+Ge(U[ft],ft,U))?0:+ut(U[ft],ft,U)}}return le.initialize=function(ft){U=ft,ct()},le.strength=function(ft){return arguments.length?(ut=typeof ft=="function"?ft:N(+ft),ct(),le):ut},le.x=function(ft){return arguments.length?(Ge=typeof ft=="function"?ft:N(+ft),ct(),le):Ge},le}function sr(Ge){var ut=N(.1),U,he,Qe;typeof Ge!="function"&&(Ge=N(Ge==null?0:+Ge));function le(ft){for(var jt=0,Lt=U.length,Ht;jt<Lt;++jt)Ht=U[jt],Ht.vy+=(Qe[jt]-Ht.y)*he[jt]*ft}function ct(){if(!!U){var ft,jt=U.length;for(he=new Array(jt),Qe=new Array(jt),ft=0;ft<jt;++ft)he[ft]=isNaN(Qe[ft]=+Ge(U[ft],ft,U))?0:+ut(U[ft],ft,U)}}return le.initialize=function(ft){U=ft,ct()},le.strength=function(ft){return arguments.length?(ut=typeof ft=="function"?ft:N(+ft),ct(),le):ut},le.y=function(ft){return arguments.length?(Ge=typeof ft=="function"?ft:N(+ft),ct(),le):Ge},le}},52710:function(dt,x,M){"use strict";M.r(x),M.d(x,{AbstractMatrix:function(){return We},CHO:function(){return bt},CholeskyDecomposition:function(){return bt},EVD:function(){return Vn},EigenvalueDecomposition:function(){return Vn},LU:function(){return rt},LuDecomposition:function(){return rt},Matrix:function(){return Mt},MatrixColumnSelectionView:function(){return ut},MatrixColumnView:function(){return Ge},MatrixFlipColumnView:function(){return U},MatrixFlipRowView:function(){return he},MatrixRowSelectionView:function(){return le},MatrixRowView:function(){return Qe},MatrixSelectionView:function(){return ct},MatrixSubView:function(){return ft},MatrixTransposeView:function(){return jt},NIPALS:function(){return Mn},Nipals:function(){return Mn},QR:function(){return Pt},QrDecomposition:function(){return Pt},SVD:function(){return gt},SingularValueDecomposition:function(){return gt},WrapperMatrix1D:function(){return Lt},WrapperMatrix2D:function(){return Ht},correlation:function(){return dn},covariance:function(){return nn},default:function(){return Mt},determinant:function(){return At},inverse:function(){return Dt},linearDependencies:function(){return Qr},pseudoInverse:function(){return Vr},solve:function(){return ir},wrap:function(){return vr}});var S=M(79320),B=M(81306),N=M(59206),E=M(69610),I=M(54941);const A=Object.prototype.toString;function v(be){return A.call(be).endsWith("Array]")}function p(be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!v(be))throw new TypeError("input must be an array");if(be.length===0)throw new TypeError("input must not be empty");var j=Se.fromIndex,R=j===void 0?0:j,k=Se.toIndex,te=k===void 0?be.length:k;if(R<0||R>=be.length||!Number.isInteger(R))throw new Error("fromIndex must be a positive integer smaller than length");if(te<=R||te>be.length||!Number.isInteger(te))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var Me=be[R],Ne=R+1;Ne<te;Ne++)be[Ne]>Me&&(Me=be[Ne]);return Me}function c(be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!v(be))throw new TypeError("input must be an array");if(be.length===0)throw new TypeError("input must not be empty");var j=Se.fromIndex,R=j===void 0?0:j,k=Se.toIndex,te=k===void 0?be.length:k;if(R<0||R>=be.length||!Number.isInteger(R))throw new Error("fromIndex must be a positive integer smaller than length");if(te<=R||te>be.length||!Number.isInteger(te))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var Me=be[R],Ne=R+1;Ne<te;Ne++)be[Ne]<Me&&(Me=be[Ne]);return Me}function f(be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(v(be)){if(be.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var j;if(Se.output!==void 0){if(!v(Se.output))throw new TypeError("output option must be an array if specified");j=Se.output}else j=new Array(be.length);var R=c(be),k=p(be);if(R===k)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var te=Se.min,Me=te===void 0?Se.autoMinMax?R:0:te,Ne=Se.max,Pe=Ne===void 0?Se.autoMinMax?k:1:Ne;if(Me>=Pe)throw new RangeError("min option must be smaller than max option");for(var Ke=(Pe-Me)/(k-R),Ut=0;Ut<be.length;Ut++)j[Ut]=(be[Ut]-R)*Ke+Me;return j}var l=" ".repeat(2),T=" ".repeat(4);function m(){return w(this)}function w(be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=Se.maxRows,R=j===void 0?15:j,k=Se.maxColumns,te=k===void 0?10:k,Me=Se.maxNumSize,Ne=Me===void 0?8:Me;return"".concat(be.constructor.name,` {
  994. `).concat(l,`[
  995. `).concat(T).concat(O(be,R,te,Ne),`
  996. `).concat(l,`]
  997. `).concat(l,"rows: ").concat(be.rows,`
  998. `).concat(l,"columns: ").concat(be.columns,`
  999. }`)}function O(be,Se,j,R){for(var k=be.rows,te=be.columns,Me=Math.min(k,Se),Ne=Math.min(te,j),Pe=[],Ke=0;Ke<Me;Ke++){for(var Ut=[],Rt=0;Rt<Ne;Rt++)Ut.push(D(be.get(Ke,Rt),R));Pe.push("".concat(Ut.join(" ")))}return Ne!==te&&(Pe[Pe.length-1]+=" ... ".concat(te-j," more columns")),Me!==k&&Pe.push("... ".concat(k-Se," more rows")),Pe.join(`
  1000. `.concat(T))}function D(be,Se){var j=String(be);if(j.length<=Se)return j.padEnd(Se," ");var R=be.toPrecision(Se-2);if(R.length<=Se)return R;var k=be.toExponential(Se-2),te=k.indexOf("e"),Me=k.slice(te);return k.slice(0,Se-Me.length)+Me}function g(be,Se){be.prototype.add=function(R){return typeof R=="number"?this.addS(R):this.addM(R)},be.prototype.addS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)+R);return this},be.prototype.addM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)+R.get(k,te));return this},be.add=function(R,k){var te=new Se(R);return te.add(k)},be.prototype.sub=function(R){return typeof R=="number"?this.subS(R):this.subM(R)},be.prototype.subS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)-R);return this},be.prototype.subM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)-R.get(k,te));return this},be.sub=function(R,k){var te=new Se(R);return te.sub(k)},be.prototype.subtract=be.prototype.sub,be.prototype.subtractS=be.prototype.subS,be.prototype.subtractM=be.prototype.subM,be.subtract=be.sub,be.prototype.mul=function(R){return typeof R=="number"?this.mulS(R):this.mulM(R)},be.prototype.mulS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)*R);return this},be.prototype.mulM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)*R.get(k,te));return this},be.mul=function(R,k){var te=new Se(R);return te.mul(k)},be.prototype.multiply=be.prototype.mul,be.prototype.multiplyS=be.prototype.mulS,be.prototype.multiplyM=be.prototype.mulM,be.multiply=be.mul,be.prototype.div=function(R){return typeof R=="number"?this.divS(R):this.divM(R)},be.prototype.divS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)/R);return this},be.prototype.divM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)/R.get(k,te));return this},be.div=function(R,k){var te=new Se(R);return te.div(k)},be.prototype.divide=be.prototype.div,be.prototype.divideS=be.prototype.divS,be.prototype.divideM=be.prototype.divM,be.divide=be.div,be.prototype.mod=function(R){return typeof R=="number"?this.modS(R):this.modM(R)},be.prototype.modS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)%R);return this},be.prototype.modM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)%R.get(k,te));return this},be.mod=function(R,k){var te=new Se(R);return te.mod(k)},be.prototype.modulus=be.prototype.mod,be.prototype.modulusS=be.prototype.modS,be.prototype.modulusM=be.prototype.modM,be.modulus=be.mod,be.prototype.and=function(R){return typeof R=="number"?this.andS(R):this.andM(R)},be.prototype.andS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)&R);return this},be.prototype.andM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)&R.get(k,te));return this},be.and=function(R,k){var te=new Se(R);return te.and(k)},be.prototype.or=function(R){return typeof R=="number"?this.orS(R):this.orM(R)},be.prototype.orS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)|R);return this},be.prototype.orM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)|R.get(k,te));return this},be.or=function(R,k){var te=new Se(R);return te.or(k)},be.prototype.xor=function(R){return typeof R=="number"?this.xorS(R):this.xorM(R)},be.prototype.xorS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)^R);return this},be.prototype.xorM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)^R.get(k,te));return this},be.xor=function(R,k){var te=new Se(R);return te.xor(k)},be.prototype.leftShift=function(R){return typeof R=="number"?this.leftShiftS(R):this.leftShiftM(R)},be.prototype.leftShiftS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)<<R);return this},be.prototype.leftShiftM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)<<R.get(k,te));return this},be.leftShift=function(R,k){var te=new Se(R);return te.leftShift(k)},be.prototype.signPropagatingRightShift=function(R){return typeof R=="number"?this.signPropagatingRightShiftS(R):this.signPropagatingRightShiftM(R)},be.prototype.signPropagatingRightShiftS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)>>R);return this},be.prototype.signPropagatingRightShiftM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)>>R.get(k,te));return this},be.signPropagatingRightShift=function(R,k){var te=new Se(R);return te.signPropagatingRightShift(k)},be.prototype.rightShift=function(R){return typeof R=="number"?this.rightShiftS(R):this.rightShiftM(R)},be.prototype.rightShiftS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)>>>R);return this},be.prototype.rightShiftM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,this.get(k,te)>>>R.get(k,te));return this},be.rightShift=function(R,k){var te=new Se(R);return te.rightShift(k)},be.prototype.zeroFillRightShift=be.prototype.rightShift,be.prototype.zeroFillRightShiftS=be.prototype.rightShiftS,be.prototype.zeroFillRightShiftM=be.prototype.rightShiftM,be.zeroFillRightShift=be.rightShift,be.prototype.not=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,~this.get(R,k));return this},be.not=function(R){var k=new Se(R);return k.not()},be.prototype.abs=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.abs(this.get(R,k)));return this},be.abs=function(R){var k=new Se(R);return k.abs()},be.prototype.acos=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.acos(this.get(R,k)));return this},be.acos=function(R){var k=new Se(R);return k.acos()},be.prototype.acosh=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.acosh(this.get(R,k)));return this},be.acosh=function(R){var k=new Se(R);return k.acosh()},be.prototype.asin=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.asin(this.get(R,k)));return this},be.asin=function(R){var k=new Se(R);return k.asin()},be.prototype.asinh=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.asinh(this.get(R,k)));return this},be.asinh=function(R){var k=new Se(R);return k.asinh()},be.prototype.atan=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.atan(this.get(R,k)));return this},be.atan=function(R){var k=new Se(R);return k.atan()},be.prototype.atanh=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.atanh(this.get(R,k)));return this},be.atanh=function(R){var k=new Se(R);return k.atanh()},be.prototype.cbrt=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.cbrt(this.get(R,k)));return this},be.cbrt=function(R){var k=new Se(R);return k.cbrt()},be.prototype.ceil=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.ceil(this.get(R,k)));return this},be.ceil=function(R){var k=new Se(R);return k.ceil()},be.prototype.clz32=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.clz32(this.get(R,k)));return this},be.clz32=function(R){var k=new Se(R);return k.clz32()},be.prototype.cos=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.cos(this.get(R,k)));return this},be.cos=function(R){var k=new Se(R);return k.cos()},be.prototype.cosh=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.cosh(this.get(R,k)));return this},be.cosh=function(R){var k=new Se(R);return k.cosh()},be.prototype.exp=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.exp(this.get(R,k)));return this},be.exp=function(R){var k=new Se(R);return k.exp()},be.prototype.expm1=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.expm1(this.get(R,k)));return this},be.expm1=function(R){var k=new Se(R);return k.expm1()},be.prototype.floor=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.floor(this.get(R,k)));return this},be.floor=function(R){var k=new Se(R);return k.floor()},be.prototype.fround=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.fround(this.get(R,k)));return this},be.fround=function(R){var k=new Se(R);return k.fround()},be.prototype.log=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.log(this.get(R,k)));return this},be.log=function(R){var k=new Se(R);return k.log()},be.prototype.log1p=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.log1p(this.get(R,k)));return this},be.log1p=function(R){var k=new Se(R);return k.log1p()},be.prototype.log10=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.log10(this.get(R,k)));return this},be.log10=function(R){var k=new Se(R);return k.log10()},be.prototype.log2=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.log2(this.get(R,k)));return this},be.log2=function(R){var k=new Se(R);return k.log2()},be.prototype.round=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.round(this.get(R,k)));return this},be.round=function(R){var k=new Se(R);return k.round()},be.prototype.sign=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.sign(this.get(R,k)));return this},be.sign=function(R){var k=new Se(R);return k.sign()},be.prototype.sin=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.sin(this.get(R,k)));return this},be.sin=function(R){var k=new Se(R);return k.sin()},be.prototype.sinh=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.sinh(this.get(R,k)));return this},be.sinh=function(R){var k=new Se(R);return k.sinh()},be.prototype.sqrt=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.sqrt(this.get(R,k)));return this},be.sqrt=function(R){var k=new Se(R);return k.sqrt()},be.prototype.tan=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.tan(this.get(R,k)));return this},be.tan=function(R){var k=new Se(R);return k.tan()},be.prototype.tanh=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.tanh(this.get(R,k)));return this},be.tanh=function(R){var k=new Se(R);return k.tanh()},be.prototype.trunc=function(){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,Math.trunc(this.get(R,k)));return this},be.trunc=function(R){var k=new Se(R);return k.trunc()},be.pow=function(R,k){var te=new Se(R);return te.pow(k)},be.prototype.pow=function(R){return typeof R=="number"?this.powS(R):this.powM(R)},be.prototype.powS=function(R){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,Math.pow(this.get(k,te),R));return this},be.prototype.powM=function(R){if(R=Se.checkMatrix(R),this.rows!==R.rows||this.columns!==R.columns)throw new RangeError("Matrices dimensions must be equal");for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.set(k,te,Math.pow(this.get(k,te),R.get(k,te)));return this}}function _(be,Se,j){var R=j?be.rows:be.rows-1;if(Se<0||Se>R)throw new RangeError("Row index out of range")}function Y(be,Se,j){var R=j?be.columns:be.columns-1;if(Se<0||Se>R)throw new RangeError("Column index out of range")}function V(be,Se){if(Se.to1DArray&&(Se=Se.to1DArray()),Se.length!==be.columns)throw new RangeError("vector size must be the same as the number of columns");return Se}function z(be,Se){if(Se.to1DArray&&(Se=Se.to1DArray()),Se.length!==be.rows)throw new RangeError("vector size must be the same as the number of rows");return Se}function Z(be,Se){if(!v(Se))throw new TypeError("row indices must be an array");for(var j=0;j<Se.length;j++)if(Se[j]<0||Se[j]>=be.rows)throw new RangeError("row indices are out of range")}function J(be,Se){if(!v(Se))throw new TypeError("column indices must be an array");for(var j=0;j<Se.length;j++)if(Se[j]<0||Se[j]>=be.columns)throw new RangeError("column indices are out of range")}function ee(be,Se,j,R,k){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(re("startRow",Se),re("endRow",j),re("startColumn",R),re("endColumn",k),Se>j||R>k||Se<0||Se>=be.rows||j<0||j>=be.rows||R<0||R>=be.columns||k<0||k>=be.columns)throw new RangeError("Submatrix indices are out of range")}function Q(be){for(var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,j=[],R=0;R<be;R++)j.push(Se);return j}function re(be,Se){if(typeof Se!="number")throw new TypeError("".concat(be," must be a number"))}function fe(be){if(be.isEmpty())throw new Error("Empty matrix has no elements to index")}function me(be){for(var Se=Q(be.rows),j=0;j<be.rows;++j)for(var R=0;R<be.columns;++R)Se[j]+=be.get(j,R);return Se}function ae(be){for(var Se=Q(be.columns),j=0;j<be.rows;++j)for(var R=0;R<be.columns;++R)Se[R]+=be.get(j,R);return Se}function Ee(be){for(var Se=0,j=0;j<be.rows;j++)for(var R=0;R<be.columns;R++)Se+=be.get(j,R);return Se}function Le(be){for(var Se=Q(be.rows,1),j=0;j<be.rows;++j)for(var R=0;R<be.columns;++R)Se[j]*=be.get(j,R);return Se}function De(be){for(var Se=Q(be.columns,1),j=0;j<be.rows;++j)for(var R=0;R<be.columns;++R)Se[R]*=be.get(j,R);return Se}function Ve(be){for(var Se=1,j=0;j<be.rows;j++)for(var R=0;R<be.columns;R++)Se*=be.get(j,R);return Se}function et(be,Se,j){for(var R=be.rows,k=be.columns,te=[],Me=0;Me<R;Me++){for(var Ne=0,Pe=0,Ke=0,Ut=0;Ut<k;Ut++)Ke=be.get(Me,Ut)-j[Me],Ne+=Ke,Pe+=Ke*Ke;Se?te.push((Pe-Ne*Ne/k)/(k-1)):te.push((Pe-Ne*Ne/k)/k)}return te}function It(be,Se,j){for(var R=be.rows,k=be.columns,te=[],Me=0;Me<k;Me++){for(var Ne=0,Pe=0,Ke=0,Ut=0;Ut<R;Ut++)Ke=be.get(Ut,Me)-j[Me],Ne+=Ke,Pe+=Ke*Ke;Se?te.push((Pe-Ne*Ne/R)/(R-1)):te.push((Pe-Ne*Ne/R)/R)}return te}function er(be,Se,j){for(var R=be.rows,k=be.columns,te=R*k,Me=0,Ne=0,Pe=0,Ke=0;Ke<R;Ke++)for(var Ut=0;Ut<k;Ut++)Pe=be.get(Ke,Ut)-j,Me+=Pe,Ne+=Pe*Pe;return Se?(Ne-Me*Me/te)/(te-1):(Ne-Me*Me/te)/te}function nr(be,Se){for(var j=0;j<be.rows;j++)for(var R=0;R<be.columns;R++)be.set(j,R,be.get(j,R)-Se[j])}function Fe(be,Se){for(var j=0;j<be.rows;j++)for(var R=0;R<be.columns;R++)be.set(j,R,be.get(j,R)-Se[R])}function Vt(be,Se){for(var j=0;j<be.rows;j++)for(var R=0;R<be.columns;R++)be.set(j,R,be.get(j,R)-Se)}function $t(be){for(var Se=[],j=0;j<be.rows;j++){for(var R=0,k=0;k<be.columns;k++)R+=Math.pow(be.get(j,k),2)/(be.columns-1);Se.push(Math.sqrt(R))}return Se}function Ar(be,Se){for(var j=0;j<be.rows;j++)for(var R=0;R<be.columns;R++)be.set(j,R,be.get(j,R)/Se[j])}function ke(be){for(var Se=[],j=0;j<be.columns;j++){for(var R=0,k=0;k<be.rows;k++)R+=Math.pow(be.get(k,j),2)/(be.rows-1);Se.push(Math.sqrt(R))}return Se}function Oe(be,Se){for(var j=0;j<be.rows;j++)for(var R=0;R<be.columns;R++)be.set(j,R,be.get(j,R)/Se[R])}function we(be){for(var Se=be.size-1,j=0,R=0;R<be.columns;R++)for(var k=0;k<be.rows;k++)j+=Math.pow(be.get(k,R),2)/Se;return Math.sqrt(j)}function Be(be,Se){for(var j=0;j<be.rows;j++)for(var R=0;R<be.columns;R++)be.set(j,R,be.get(j,R)/Se)}var We=function(){function be(){(0,E.Z)(this,be)}return(0,I.Z)(be,[{key:"size",get:function(){return this.rows*this.columns}},{key:"apply",value:function(j){if(typeof j!="function")throw new TypeError("callback must be a function");for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)j.call(this,R,k);return this}},{key:"to1DArray",value:function(){for(var j=[],R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)j.push(this.get(R,k));return j}},{key:"to2DArray",value:function(){for(var j=[],R=0;R<this.rows;R++){j.push([]);for(var k=0;k<this.columns;k++)j[R].push(this.get(R,k))}return j}},{key:"toJSON",value:function(){return this.to2DArray()}},{key:"isRowVector",value:function(){return this.rows===1}},{key:"isColumnVector",value:function(){return this.columns===1}},{key:"isVector",value:function(){return this.rows===1||this.columns===1}},{key:"isSquare",value:function(){return this.rows===this.columns}},{key:"isEmpty",value:function(){return this.rows===0||this.columns===0}},{key:"isSymmetric",value:function(){if(this.isSquare()){for(var j=0;j<this.rows;j++)for(var R=0;R<=j;R++)if(this.get(j,R)!==this.get(R,j))return!1;return!0}return!1}},{key:"isEchelonForm",value:function(){for(var j=0,R=0,k=-1,te=!0,Me=!1;j<this.rows&&te;){for(R=0,Me=!1;R<this.columns&&Me===!1;)this.get(j,R)===0?R++:this.get(j,R)===1&&R>k?(Me=!0,k=R):(te=!1,Me=!0);j++}return te}},{key:"isReducedEchelonForm",value:function(){for(var j=0,R=0,k=-1,te=!0,Me=!1;j<this.rows&&te;){for(R=0,Me=!1;R<this.columns&&Me===!1;)this.get(j,R)===0?R++:this.get(j,R)===1&&R>k?(Me=!0,k=R):(te=!1,Me=!0);for(var Ne=R+1;Ne<this.rows;Ne++)this.get(j,Ne)!==0&&(te=!1);j++}return te}},{key:"echelonForm",value:function(){for(var j=this.clone(),R=0,k=0;R<j.rows&&k<j.columns;){for(var te=R,Me=R;Me<j.rows;Me++)j.get(Me,k)>j.get(te,k)&&(te=Me);if(j.get(te,k)===0)k++;else{j.swapRows(R,te);for(var Ne=j.get(R,k),Pe=k;Pe<j.columns;Pe++)j.set(R,Pe,j.get(R,Pe)/Ne);for(var Ke=R+1;Ke<j.rows;Ke++){var Ut=j.get(Ke,k)/j.get(R,k);j.set(Ke,k,0);for(var Rt=k+1;Rt<j.columns;Rt++)j.set(Ke,Rt,j.get(Ke,Rt)-j.get(R,Rt)*Ut)}R++,k++}}return j}},{key:"reducedEchelonForm",value:function(){for(var j=this.echelonForm(),R=j.columns,k=j.rows,te=k-1;te>=0;)if(j.maxRow(te)===0)te--;else{for(var Me=0,Ne=!1;Me<k&&Ne===!1;)j.get(te,Me)===1?Ne=!0:Me++;for(var Pe=0;Pe<te;Pe++)for(var Ke=j.get(Pe,Me),Ut=Me;Ut<R;Ut++){var Rt=j.get(Pe,Ut)-Ke*j.get(te,Ut);j.set(Pe,Ut,Rt)}te--}return j}},{key:"set",value:function(){throw new Error("set method is unimplemented")}},{key:"get",value:function(){throw new Error("get method is unimplemented")}},{key:"repeat",value:function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(typeof j!="object")throw new TypeError("options must be an object");var R=j.rows,k=R===void 0?1:R,te=j.columns,Me=te===void 0?1:te;if(!Number.isInteger(k)||k<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(Me)||Me<=0)throw new TypeError("columns must be a positive integer");for(var Ne=new Mt(this.rows*k,this.columns*Me),Pe=0;Pe<k;Pe++)for(var Ke=0;Ke<Me;Ke++)Ne.setSubMatrix(this,this.rows*Pe,this.columns*Ke);return Ne}},{key:"fill",value:function(j){for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,j);return this}},{key:"neg",value:function(){return this.mulS(-1)}},{key:"getRow",value:function(j){_(this,j);for(var R=[],k=0;k<this.columns;k++)R.push(this.get(j,k));return R}},{key:"getRowVector",value:function(j){return Mt.rowVector(this.getRow(j))}},{key:"setRow",value:function(j,R){_(this,j),R=V(this,R);for(var k=0;k<this.columns;k++)this.set(j,k,R[k]);return this}},{key:"swapRows",value:function(j,R){_(this,j),_(this,R);for(var k=0;k<this.columns;k++){var te=this.get(j,k);this.set(j,k,this.get(R,k)),this.set(R,k,te)}return this}},{key:"getColumn",value:function(j){Y(this,j);for(var R=[],k=0;k<this.rows;k++)R.push(this.get(k,j));return R}},{key:"getColumnVector",value:function(j){return Mt.columnVector(this.getColumn(j))}},{key:"setColumn",value:function(j,R){Y(this,j),R=z(this,R);for(var k=0;k<this.rows;k++)this.set(k,j,R[k]);return this}},{key:"swapColumns",value:function(j,R){Y(this,j),Y(this,R);for(var k=0;k<this.rows;k++){var te=this.get(k,j);this.set(k,j,this.get(k,R)),this.set(k,R,te)}return this}},{key:"addRowVector",value:function(j){j=V(this,j);for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,this.get(R,k)+j[k]);return this}},{key:"subRowVector",value:function(j){j=V(this,j);for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,this.get(R,k)-j[k]);return this}},{key:"mulRowVector",value:function(j){j=V(this,j);for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,this.get(R,k)*j[k]);return this}},{key:"divRowVector",value:function(j){j=V(this,j);for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,this.get(R,k)/j[k]);return this}},{key:"addColumnVector",value:function(j){j=z(this,j);for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,this.get(R,k)+j[R]);return this}},{key:"subColumnVector",value:function(j){j=z(this,j);for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,this.get(R,k)-j[R]);return this}},{key:"mulColumnVector",value:function(j){j=z(this,j);for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,this.get(R,k)*j[R]);return this}},{key:"divColumnVector",value:function(j){j=z(this,j);for(var R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)this.set(R,k,this.get(R,k)/j[R]);return this}},{key:"mulRow",value:function(j,R){_(this,j);for(var k=0;k<this.columns;k++)this.set(j,k,this.get(j,k)*R);return this}},{key:"mulColumn",value:function(j,R){Y(this,j);for(var k=0;k<this.rows;k++)this.set(k,j,this.get(k,j)*R);return this}},{key:"max",value:function(j){if(this.isEmpty())return NaN;switch(j){case"row":{for(var R=new Array(this.rows).fill(Number.NEGATIVE_INFINITY),k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.get(k,te)>R[k]&&(R[k]=this.get(k,te));return R}case"column":{for(var Me=new Array(this.columns).fill(Number.NEGATIVE_INFINITY),Ne=0;Ne<this.rows;Ne++)for(var Pe=0;Pe<this.columns;Pe++)this.get(Ne,Pe)>Me[Pe]&&(Me[Pe]=this.get(Ne,Pe));return Me}case void 0:{for(var Ke=this.get(0,0),Ut=0;Ut<this.rows;Ut++)for(var Rt=0;Rt<this.columns;Rt++)this.get(Ut,Rt)>Ke&&(Ke=this.get(Ut,Rt));return Ke}default:throw new Error("invalid option: ".concat(j))}}},{key:"maxIndex",value:function(){fe(this);for(var j=this.get(0,0),R=[0,0],k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.get(k,te)>j&&(j=this.get(k,te),R[0]=k,R[1]=te);return R}},{key:"min",value:function(j){if(this.isEmpty())return NaN;switch(j){case"row":{for(var R=new Array(this.rows).fill(Number.POSITIVE_INFINITY),k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.get(k,te)<R[k]&&(R[k]=this.get(k,te));return R}case"column":{for(var Me=new Array(this.columns).fill(Number.POSITIVE_INFINITY),Ne=0;Ne<this.rows;Ne++)for(var Pe=0;Pe<this.columns;Pe++)this.get(Ne,Pe)<Me[Pe]&&(Me[Pe]=this.get(Ne,Pe));return Me}case void 0:{for(var Ke=this.get(0,0),Ut=0;Ut<this.rows;Ut++)for(var Rt=0;Rt<this.columns;Rt++)this.get(Ut,Rt)<Ke&&(Ke=this.get(Ut,Rt));return Ke}default:throw new Error("invalid option: ".concat(j))}}},{key:"minIndex",value:function(){fe(this);for(var j=this.get(0,0),R=[0,0],k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)this.get(k,te)<j&&(j=this.get(k,te),R[0]=k,R[1]=te);return R}},{key:"maxRow",value:function(j){if(_(this,j),this.isEmpty())return NaN;for(var R=this.get(j,0),k=1;k<this.columns;k++)this.get(j,k)>R&&(R=this.get(j,k));return R}},{key:"maxRowIndex",value:function(j){_(this,j),fe(this);for(var R=this.get(j,0),k=[j,0],te=1;te<this.columns;te++)this.get(j,te)>R&&(R=this.get(j,te),k[1]=te);return k}},{key:"minRow",value:function(j){if(_(this,j),this.isEmpty())return NaN;for(var R=this.get(j,0),k=1;k<this.columns;k++)this.get(j,k)<R&&(R=this.get(j,k));return R}},{key:"minRowIndex",value:function(j){_(this,j),fe(this);for(var R=this.get(j,0),k=[j,0],te=1;te<this.columns;te++)this.get(j,te)<R&&(R=this.get(j,te),k[1]=te);return k}},{key:"maxColumn",value:function(j){if(Y(this,j),this.isEmpty())return NaN;for(var R=this.get(0,j),k=1;k<this.rows;k++)this.get(k,j)>R&&(R=this.get(k,j));return R}},{key:"maxColumnIndex",value:function(j){Y(this,j),fe(this);for(var R=this.get(0,j),k=[0,j],te=1;te<this.rows;te++)this.get(te,j)>R&&(R=this.get(te,j),k[0]=te);return k}},{key:"minColumn",value:function(j){if(Y(this,j),this.isEmpty())return NaN;for(var R=this.get(0,j),k=1;k<this.rows;k++)this.get(k,j)<R&&(R=this.get(k,j));return R}},{key:"minColumnIndex",value:function(j){Y(this,j),fe(this);for(var R=this.get(0,j),k=[0,j],te=1;te<this.rows;te++)this.get(te,j)<R&&(R=this.get(te,j),k[0]=te);return k}},{key:"diag",value:function(){for(var j=Math.min(this.rows,this.columns),R=[],k=0;k<j;k++)R.push(this.get(k,k));return R}},{key:"norm",value:function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"frobenius",R=0;if(j==="max")return this.max();if(j==="frobenius"){for(var k=0;k<this.rows;k++)for(var te=0;te<this.columns;te++)R=R+this.get(k,te)*this.get(k,te);return Math.sqrt(R)}else throw new RangeError("unknown norm type: ".concat(j))}},{key:"cumulativeSum",value:function(){for(var j=0,R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)j+=this.get(R,k),this.set(R,k,j);return this}},{key:"dot",value:function(j){be.isMatrix(j)&&(j=j.to1DArray());var R=this.to1DArray();if(R.length!==j.length)throw new RangeError("vectors do not have the same size");for(var k=0,te=0;te<R.length;te++)k+=R[te]*j[te];return k}},{key:"mmul",value:function(j){j=Mt.checkMatrix(j);for(var R=this.rows,k=this.columns,te=j.columns,Me=new Mt(R,te),Ne=new Float64Array(k),Pe=0;Pe<te;Pe++){for(var Ke=0;Ke<k;Ke++)Ne[Ke]=j.get(Ke,Pe);for(var Ut=0;Ut<R;Ut++){for(var Rt=0,fr=0;fr<k;fr++)Rt+=this.get(Ut,fr)*Ne[fr];Me.set(Ut,Pe,Rt)}}return Me}},{key:"strassen2x2",value:function(j){j=Mt.checkMatrix(j);var R=new Mt(2,2),k=this.get(0,0),te=j.get(0,0),Me=this.get(0,1),Ne=j.get(0,1),Pe=this.get(1,0),Ke=j.get(1,0),Ut=this.get(1,1),Rt=j.get(1,1),fr=(k+Ut)*(te+Rt),kr=(Pe+Ut)*te,ur=k*(Ne-Rt),rn=Ut*(Ke-te),On=(k+Me)*Rt,ne=(Pe-k)*(te+Ne),ye=(Me-Ut)*(Ke+Rt),Je=fr+rn-On+ye,Ct=ur+On,Nt=kr+rn,mr=fr-kr+ur+ne;return R.set(0,0,Je),R.set(0,1,Ct),R.set(1,0,Nt),R.set(1,1,mr),R}},{key:"strassen3x3",value:function(j){j=Mt.checkMatrix(j);var R=new Mt(3,3),k=this.get(0,0),te=this.get(0,1),Me=this.get(0,2),Ne=this.get(1,0),Pe=this.get(1,1),Ke=this.get(1,2),Ut=this.get(2,0),Rt=this.get(2,1),fr=this.get(2,2),kr=j.get(0,0),ur=j.get(0,1),rn=j.get(0,2),On=j.get(1,0),ne=j.get(1,1),ye=j.get(1,2),Je=j.get(2,0),Ct=j.get(2,1),Nt=j.get(2,2),mr=(k+te+Me-Ne-Pe-Rt-fr)*ne,lr=(k-Ne)*(-ur+ne),dr=Pe*(-kr+ur+On-ne-ye-Je+Nt),yr=(-k+Ne+Pe)*(kr-ur+ne),Gr=(Ne+Pe)*(-kr+ur),Jr=k*kr,Sr=(-k+Ut+Rt)*(kr-rn+ye),lt=(-k+Ut)*(rn-ye),Ae=(Ut+Rt)*(-kr+rn),Ye=(k+te+Me-Pe-Ke-Ut-Rt)*ye,Tt=Rt*(-kr+rn+On-ne-ye-Je+Ct),pt=(-Me+Rt+fr)*(ne+Je-Ct),kt=(Me-fr)*(ne-Ct),ar=Me*Je,jr=(Rt+fr)*(-Je+Ct),tn=(-Me+Pe+Ke)*(ye+Je-Nt),Ln=(Me-Ke)*(ye-Nt),Dn=(Pe+Ke)*(-Je+Nt),$n=te*On,ci=Ke*Ct,Ii=Ne*rn,ki=Ut*ur,zi=fr*Nt,Hn=Jr+ar+$n,Mo=mr+yr+Gr+Jr+pt+ar+jr,Ia=Jr+Sr+Ae+Ye+ar+tn+Dn,vi=lr+dr+yr+Jr+ar+tn+Ln,Ya=lr+yr+Gr+Jr+ci,no=ar+tn+Ln+Dn+Ii,Co=Jr+Sr+lt+Tt+pt+kt+ar,ho=pt+kt+ar+jr+ki,Ea=Jr+Sr+lt+Ae+zi;return R.set(0,0,Hn),R.set(0,1,Mo),R.set(0,2,Ia),R.set(1,0,vi),R.set(1,1,Ya),R.set(1,2,no),R.set(2,0,Co),R.set(2,1,ho),R.set(2,2,Ea),R}},{key:"mmulStrassen",value:function(j){j=Mt.checkMatrix(j);var R=this.clone(),k=R.rows,te=R.columns,Me=j.rows,Ne=j.columns;te!==Me&&console.warn("Multiplying ".concat(k," x ").concat(te," and ").concat(Me," x ").concat(Ne," matrix: dimensions do not match."));function Pe(fr,kr,ur){var rn=fr.rows,On=fr.columns;if(rn===kr&&On===ur)return fr;var ne=be.zeros(kr,ur);return ne=ne.setSubMatrix(fr,0,0),ne}var Ke=Math.max(k,Me),Ut=Math.max(te,Ne);R=Pe(R,Ke,Ut),j=Pe(j,Ke,Ut);function Rt(fr,kr,ur,rn){if(ur<=512||rn<=512)return fr.mmul(kr);ur%2==1&&rn%2==1?(fr=Pe(fr,ur+1,rn+1),kr=Pe(kr,ur+1,rn+1)):ur%2==1?(fr=Pe(fr,ur+1,rn),kr=Pe(kr,ur+1,rn)):rn%2==1&&(fr=Pe(fr,ur,rn+1),kr=Pe(kr,ur,rn+1));var On=parseInt(fr.rows/2,10),ne=parseInt(fr.columns/2,10),ye=fr.subMatrix(0,On-1,0,ne-1),Je=kr.subMatrix(0,On-1,0,ne-1),Ct=fr.subMatrix(0,On-1,ne,fr.columns-1),Nt=kr.subMatrix(0,On-1,ne,kr.columns-1),mr=fr.subMatrix(On,fr.rows-1,0,ne-1),lr=kr.subMatrix(On,kr.rows-1,0,ne-1),dr=fr.subMatrix(On,fr.rows-1,ne,fr.columns-1),yr=kr.subMatrix(On,kr.rows-1,ne,kr.columns-1),Gr=Rt(be.add(ye,dr),be.add(Je,yr),On,ne),Jr=Rt(be.add(mr,dr),Je,On,ne),Sr=Rt(ye,be.sub(Nt,yr),On,ne),lt=Rt(dr,be.sub(lr,Je),On,ne),Ae=Rt(be.add(ye,Ct),yr,On,ne),Ye=Rt(be.sub(mr,ye),be.add(Je,Nt),On,ne),Tt=Rt(be.sub(Ct,dr),be.add(lr,yr),On,ne),pt=be.add(Gr,lt);pt.sub(Ae),pt.add(Tt);var kt=be.add(Sr,Ae),ar=be.add(Jr,lt),jr=be.sub(Gr,Jr);jr.add(Sr),jr.add(Ye);var tn=be.zeros(2*pt.rows,2*pt.columns);return tn=tn.setSubMatrix(pt,0,0),tn=tn.setSubMatrix(kt,pt.rows,0),tn=tn.setSubMatrix(ar,0,pt.columns),tn=tn.setSubMatrix(jr,pt.rows,pt.columns),tn.subMatrix(0,ur-1,0,rn-1)}return Rt(R,j,Ke,Ut)}},{key:"scaleRows",value:function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(typeof j!="object")throw new TypeError("options must be an object");var R=j.min,k=R===void 0?0:R,te=j.max,Me=te===void 0?1:te;if(!Number.isFinite(k))throw new TypeError("min must be a number");if(!Number.isFinite(Me))throw new TypeError("max must be a number");if(k>=Me)throw new RangeError("min must be smaller than max");for(var Ne=new Mt(this.rows,this.columns),Pe=0;Pe<this.rows;Pe++){var Ke=this.getRow(Pe);Ke.length>0&&f(Ke,{min:k,max:Me,output:Ke}),Ne.setRow(Pe,Ke)}return Ne}},{key:"scaleColumns",value:function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(typeof j!="object")throw new TypeError("options must be an object");var R=j.min,k=R===void 0?0:R,te=j.max,Me=te===void 0?1:te;if(!Number.isFinite(k))throw new TypeError("min must be a number");if(!Number.isFinite(Me))throw new TypeError("max must be a number");if(k>=Me)throw new RangeError("min must be smaller than max");for(var Ne=new Mt(this.rows,this.columns),Pe=0;Pe<this.columns;Pe++){var Ke=this.getColumn(Pe);Ke.length&&f(Ke,{min:k,max:Me,output:Ke}),Ne.setColumn(Pe,Ke)}return Ne}},{key:"flipRows",value:function(){for(var j=Math.ceil(this.columns/2),R=0;R<this.rows;R++)for(var k=0;k<j;k++){var te=this.get(R,k),Me=this.get(R,this.columns-1-k);this.set(R,k,Me),this.set(R,this.columns-1-k,te)}return this}},{key:"flipColumns",value:function(){for(var j=Math.ceil(this.rows/2),R=0;R<this.columns;R++)for(var k=0;k<j;k++){var te=this.get(k,R),Me=this.get(this.rows-1-k,R);this.set(k,R,Me),this.set(this.rows-1-k,R,te)}return this}},{key:"kroneckerProduct",value:function(j){j=Mt.checkMatrix(j);for(var R=this.rows,k=this.columns,te=j.rows,Me=j.columns,Ne=new Mt(R*te,k*Me),Pe=0;Pe<R;Pe++)for(var Ke=0;Ke<k;Ke++)for(var Ut=0;Ut<te;Ut++)for(var Rt=0;Rt<Me;Rt++)Ne.set(te*Pe+Ut,Me*Ke+Rt,this.get(Pe,Ke)*j.get(Ut,Rt));return Ne}},{key:"kroneckerSum",value:function(j){if(j=Mt.checkMatrix(j),!this.isSquare()||!j.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");var R=this.rows,k=j.rows,te=this.kroneckerProduct(Mt.eye(k,k)),Me=Mt.eye(R,R).kroneckerProduct(j);return te.add(Me)}},{key:"transpose",value:function(){for(var j=new Mt(this.columns,this.rows),R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)j.set(k,R,this.get(R,k));return j}},{key:"sortRows",value:function(){for(var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:He,R=0;R<this.rows;R++)this.setRow(R,this.getRow(R).sort(j));return this}},{key:"sortColumns",value:function(){for(var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:He,R=0;R<this.columns;R++)this.setColumn(R,this.getColumn(R).sort(j));return this}},{key:"subMatrix",value:function(j,R,k,te){ee(this,j,R,k,te);for(var Me=new Mt(R-j+1,te-k+1),Ne=j;Ne<=R;Ne++)for(var Pe=k;Pe<=te;Pe++)Me.set(Ne-j,Pe-k,this.get(Ne,Pe));return Me}},{key:"subMatrixRow",value:function(j,R,k){if(R===void 0&&(R=0),k===void 0&&(k=this.columns-1),R>k||R<0||R>=this.columns||k<0||k>=this.columns)throw new RangeError("Argument out of range");for(var te=new Mt(j.length,k-R+1),Me=0;Me<j.length;Me++)for(var Ne=R;Ne<=k;Ne++){if(j[Me]<0||j[Me]>=this.rows)throw new RangeError("Row index out of range: ".concat(j[Me]));te.set(Me,Ne-R,this.get(j[Me],Ne))}return te}},{key:"subMatrixColumn",value:function(j,R,k){if(R===void 0&&(R=0),k===void 0&&(k=this.rows-1),R>k||R<0||R>=this.rows||k<0||k>=this.rows)throw new RangeError("Argument out of range");for(var te=new Mt(k-R+1,j.length),Me=0;Me<j.length;Me++)for(var Ne=R;Ne<=k;Ne++){if(j[Me]<0||j[Me]>=this.columns)throw new RangeError("Column index out of range: ".concat(j[Me]));te.set(Ne-R,Me,this.get(Ne,j[Me]))}return te}},{key:"setSubMatrix",value:function(j,R,k){if(j=Mt.checkMatrix(j),j.isEmpty())return this;var te=R+j.rows-1,Me=k+j.columns-1;ee(this,R,te,k,Me);for(var Ne=0;Ne<j.rows;Ne++)for(var Pe=0;Pe<j.columns;Pe++)this.set(R+Ne,k+Pe,j.get(Ne,Pe));return this}},{key:"selection",value:function(j,R){Z(this,j),J(this,R);for(var k=new Mt(j.length,R.length),te=0;te<j.length;te++)for(var Me=j[te],Ne=0;Ne<R.length;Ne++){var Pe=R[Ne];k.set(te,Ne,this.get(Me,Pe))}return k}},{key:"trace",value:function(){for(var j=Math.min(this.rows,this.columns),R=0,k=0;k<j;k++)R+=this.get(k,k);return R}},{key:"clone",value:function(){for(var j=new Mt(this.rows,this.columns),R=0;R<this.rows;R++)for(var k=0;k<this.columns;k++)j.set(R,k,this.get(R,k));return j}},{key:"sum",value:function(j){switch(j){case"row":return me(this);case"column":return ae(this);case void 0:return Ee(this);default:throw new Error("invalid option: ".concat(j))}}},{key:"product",value:function(j){switch(j){case"row":return Le(this);case"column":return De(this);case void 0:return Ve(this);default:throw new Error("invalid option: ".concat(j))}}},{key:"mean",value:function(j){var R=this.sum(j);switch(j){case"row":{for(var k=0;k<this.rows;k++)R[k]/=this.columns;return R}case"column":{for(var te=0;te<this.columns;te++)R[te]/=this.rows;return R}case void 0:return R/this.size;default:throw new Error("invalid option: ".concat(j))}}},{key:"variance",value:function(j){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof j=="object"&&(R=j,j=void 0),typeof R!="object")throw new TypeError("options must be an object");var k=R,te=k.unbiased,Me=te===void 0?!0:te,Ne=k.mean,Pe=Ne===void 0?this.mean(j):Ne;if(typeof Me!="boolean")throw new TypeError("unbiased must be a boolean");switch(j){case"row":{if(!v(Pe))throw new TypeError("mean must be an array");return et(this,Me,Pe)}case"column":{if(!v(Pe))throw new TypeError("mean must be an array");return It(this,Me,Pe)}case void 0:{if(typeof Pe!="number")throw new TypeError("mean must be a number");return er(this,Me,Pe)}default:throw new Error("invalid option: ".concat(j))}}},{key:"standardDeviation",value:function(j,R){typeof j=="object"&&(R=j,j=void 0);var k=this.variance(j,R);if(j===void 0)return Math.sqrt(k);for(var te=0;te<k.length;te++)k[te]=Math.sqrt(k[te]);return k}},{key:"center",value:function(j){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof j=="object"&&(R=j,j=void 0),typeof R!="object")throw new TypeError("options must be an object");var k=R,te=k.center,Me=te===void 0?this.mean(j):te;switch(j){case"row":{if(!v(Me))throw new TypeError("center must be an array");return nr(this,Me),this}case"column":{if(!v(Me))throw new TypeError("center must be an array");return Fe(this,Me),this}case void 0:{if(typeof Me!="number")throw new TypeError("center must be a number");return Vt(this,Me),this}default:throw new Error("invalid option: ".concat(j))}}},{key:"scale",value:function(j){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof j=="object"&&(R=j,j=void 0),typeof R!="object")throw new TypeError("options must be an object");var k=R.scale;switch(j){case"row":{if(k===void 0)k=$t(this);else if(!v(k))throw new TypeError("scale must be an array");return Ar(this,k),this}case"column":{if(k===void 0)k=ke(this);else if(!v(k))throw new TypeError("scale must be an array");return Oe(this,k),this}case void 0:{if(k===void 0)k=we(this);else if(typeof k!="number")throw new TypeError("scale must be a number");return Be(this,k),this}default:throw new Error("invalid option: ".concat(j))}}},{key:"toString",value:function(j){return w(this,j)}}],[{key:"from1DArray",value:function(j,R,k){var te=j*R;if(te!==k.length)throw new RangeError("data length does not match given dimensions");for(var Me=new Mt(j,R),Ne=0;Ne<j;Ne++)for(var Pe=0;Pe<R;Pe++)Me.set(Ne,Pe,k[Ne*R+Pe]);return Me}},{key:"rowVector",value:function(j){for(var R=new Mt(1,j.length),k=0;k<j.length;k++)R.set(0,k,j[k]);return R}},{key:"columnVector",value:function(j){for(var R=new Mt(j.length,1),k=0;k<j.length;k++)R.set(k,0,j[k]);return R}},{key:"zeros",value:function(j,R){return new Mt(j,R)}},{key:"ones",value:function(j,R){return new Mt(j,R).fill(1)}},{key:"rand",value:function(j,R){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof k!="object")throw new TypeError("options must be an object");for(var te=k.random,Me=te===void 0?Math.random:te,Ne=new Mt(j,R),Pe=0;Pe<j;Pe++)for(var Ke=0;Ke<R;Ke++)Ne.set(Pe,Ke,Me());return Ne}},{key:"randInt",value:function(j,R){var k=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof k!="object")throw new TypeError("options must be an object");var te=k.min,Me=te===void 0?0:te,Ne=k.max,Pe=Ne===void 0?1e3:Ne,Ke=k.random,Ut=Ke===void 0?Math.random:Ke;if(!Number.isInteger(Me))throw new TypeError("min must be an integer");if(!Number.isInteger(Pe))throw new TypeError("max must be an integer");if(Me>=Pe)throw new RangeError("min must be smaller than max");for(var Rt=Pe-Me,fr=new Mt(j,R),kr=0;kr<j;kr++)for(var ur=0;ur<R;ur++){var rn=Me+Math.round(Ut()*Rt);fr.set(kr,ur,rn)}return fr}},{key:"eye",value:function(j,R,k){R===void 0&&(R=j),k===void 0&&(k=1);for(var te=Math.min(j,R),Me=this.zeros(j,R),Ne=0;Ne<te;Ne++)Me.set(Ne,Ne,k);return Me}},{key:"diag",value:function(j,R,k){var te=j.length;R===void 0&&(R=te),k===void 0&&(k=R);for(var Me=Math.min(te,R,k),Ne=this.zeros(R,k),Pe=0;Pe<Me;Pe++)Ne.set(Pe,Pe,j[Pe]);return Ne}},{key:"min",value:function(j,R){j=this.checkMatrix(j),R=this.checkMatrix(R);for(var k=j.rows,te=j.columns,Me=new Mt(k,te),Ne=0;Ne<k;Ne++)for(var Pe=0;Pe<te;Pe++)Me.set(Ne,Pe,Math.min(j.get(Ne,Pe),R.get(Ne,Pe)));return Me}},{key:"max",value:function(j,R){j=this.checkMatrix(j),R=this.checkMatrix(R);for(var k=j.rows,te=j.columns,Me=new this(k,te),Ne=0;Ne<k;Ne++)for(var Pe=0;Pe<te;Pe++)Me.set(Ne,Pe,Math.max(j.get(Ne,Pe),R.get(Ne,Pe)));return Me}},{key:"checkMatrix",value:function(j){return be.isMatrix(j)?j:new Mt(j)}},{key:"isMatrix",value:function(j){return j!=null&&j.klass==="Matrix"}}]),be}();We.prototype.klass="Matrix",typeof Symbol!="undefined"&&(We.prototype[Symbol.for("nodejs.util.inspect.custom")]=m);function He(be,Se){return be-Se}function St(be){return be.every(function(Se){return typeof Se=="number"})}We.random=We.rand,We.randomInt=We.randInt,We.diagonal=We.diag,We.prototype.diagonal=We.prototype.diag,We.identity=We.eye,We.prototype.negate=We.prototype.neg,We.prototype.tensorProduct=We.prototype.kroneckerProduct;var Mt=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R,k){var te;if((0,E.Z)(this,j),te=Se.call(this),j.isMatrix(R))return(0,S.Z)(te,R.clone());if(Number.isInteger(R)&&R>=0)if(te.data=[],Number.isInteger(k)&&k>=0)for(var Me=0;Me<R;Me++)te.data.push(new Float64Array(k));else throw new TypeError("nColumns must be a positive integer");else if(v(R)){var Ne=R;if(R=Ne.length,k=R?Ne[0].length:0,typeof k!="number")throw new TypeError("Data must be a 2D array with at least one element");te.data=[];for(var Pe=0;Pe<R;Pe++){if(Ne[Pe].length!==k)throw new RangeError("Inconsistent array dimensions");if(!St(Ne[Pe]))throw new TypeError("Input data contains non-numeric values");te.data.push(Float64Array.from(Ne[Pe]))}}else throw new TypeError("First argument must be a positive number or an array");return te.rows=R,te.columns=k,te}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.data[k][te]=Me,this}},{key:"get",value:function(k,te){return this.data[k][te]}},{key:"removeRow",value:function(k){return _(this,k),this.data.splice(k,1),this.rows-=1,this}},{key:"addRow",value:function(k,te){return te===void 0&&(te=k,k=this.rows),_(this,k,!0),te=Float64Array.from(V(this,te)),this.data.splice(k,0,te),this.rows+=1,this}},{key:"removeColumn",value:function(k){Y(this,k);for(var te=0;te<this.rows;te++){for(var Me=new Float64Array(this.columns-1),Ne=0;Ne<k;Ne++)Me[Ne]=this.data[te][Ne];for(var Pe=k+1;Pe<this.columns;Pe++)Me[Pe-1]=this.data[te][Pe];this.data[te]=Me}return this.columns-=1,this}},{key:"addColumn",value:function(k,te){typeof te=="undefined"&&(te=k,k=this.columns),Y(this,k,!0),te=z(this,te);for(var Me=0;Me<this.rows;Me++){for(var Ne=new Float64Array(this.columns+1),Pe=0;Pe<k;Pe++)Ne[Pe]=this.data[Me][Pe];for(Ne[Pe++]=te[Me];Pe<this.columns+1;Pe++)Ne[Pe]=this.data[Me][Pe-1];this.data[Me]=Ne}return this.columns+=1,this}}]),j}(We);g(We,Mt);var sr=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R,k,te){var Me;return(0,E.Z)(this,j),Me=Se.call(this),Me.matrix=R,Me.rows=k,Me.columns=te,Me}return(0,I.Z)(j)}(We),Ge=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R,k){var te;return(0,E.Z)(this,j),Y(R,k),te=Se.call(this,R,R.rows,1),te.column=k,te}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.matrix.set(k,this.column,Me),this}},{key:"get",value:function(k){return this.matrix.get(k,this.column)}}]),j}(sr),ut=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R,k){var te;return(0,E.Z)(this,j),J(R,k),te=Se.call(this,R,R.rows,k.length),te.columnIndices=k,te}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.matrix.set(k,this.columnIndices[te],Me),this}},{key:"get",value:function(k,te){return this.matrix.get(k,this.columnIndices[te])}}]),j}(sr),U=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R){return(0,E.Z)(this,j),Se.call(this,R,R.rows,R.columns)}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.matrix.set(k,this.columns-te-1,Me),this}},{key:"get",value:function(k,te){return this.matrix.get(k,this.columns-te-1)}}]),j}(sr),he=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R){return(0,E.Z)(this,j),Se.call(this,R,R.rows,R.columns)}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.matrix.set(this.rows-k-1,te,Me),this}},{key:"get",value:function(k,te){return this.matrix.get(this.rows-k-1,te)}}]),j}(sr),Qe=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R,k){var te;return(0,E.Z)(this,j),_(R,k),te=Se.call(this,R,1,R.columns),te.row=k,te}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.matrix.set(this.row,te,Me),this}},{key:"get",value:function(k,te){return this.matrix.get(this.row,te)}}]),j}(sr),le=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R,k){var te;return(0,E.Z)(this,j),Z(R,k),te=Se.call(this,R,k.length,R.columns),te.rowIndices=k,te}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.matrix.set(this.rowIndices[k],te,Me),this}},{key:"get",value:function(k,te){return this.matrix.get(this.rowIndices[k],te)}}]),j}(sr),ct=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R,k,te){var Me;return(0,E.Z)(this,j),Z(R,k),J(R,te),Me=Se.call(this,R,k.length,te.length),Me.rowIndices=k,Me.columnIndices=te,Me}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.matrix.set(this.rowIndices[k],this.columnIndices[te],Me),this}},{key:"get",value:function(k,te){return this.matrix.get(this.rowIndices[k],this.columnIndices[te])}}]),j}(sr),ft=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R,k,te,Me,Ne){var Pe;return(0,E.Z)(this,j),ee(R,k,te,Me,Ne),Pe=Se.call(this,R,te-k+1,Ne-Me+1),Pe.startRow=k,Pe.startColumn=Me,Pe}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.matrix.set(this.startRow+k,this.startColumn+te,Me),this}},{key:"get",value:function(k,te){return this.matrix.get(this.startRow+k,this.startColumn+te)}}]),j}(sr),jt=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R){return(0,E.Z)(this,j),Se.call(this,R,R.columns,R.rows)}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.matrix.set(te,k,Me),this}},{key:"get",value:function(k,te){return this.matrix.get(te,k)}}]),j}(sr),Lt=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R){var k,te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(0,E.Z)(this,j);var Me=te.rows,Ne=Me===void 0?1:Me;if(R.length%Ne!=0)throw new Error("the data length is not divisible by the number of rows");return k=Se.call(this),k.rows=Ne,k.columns=R.length/Ne,k.data=R,k}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){var Ne=this._calculateIndex(k,te);return this.data[Ne]=Me,this}},{key:"get",value:function(k,te){var Me=this._calculateIndex(k,te);return this.data[Me]}},{key:"_calculateIndex",value:function(k,te){return k*this.columns+te}}]),j}(We),Ht=function(be){(0,B.Z)(j,be);var Se=(0,N.Z)(j);function j(R){var k;return(0,E.Z)(this,j),k=Se.call(this),k.data=R,k.rows=R.length,k.columns=R[0].length,k}return(0,I.Z)(j,[{key:"set",value:function(k,te,Me){return this.data[k][te]=Me,this}},{key:"get",value:function(k,te){return this.data[k][te]}}]),j}(We);function vr(be,Se){if(v(be))return be[0]&&v(be[0])?new Ht(be):new Lt(be,Se);throw new Error("the argument is not an array")}var rt=function(){function be(Se){(0,E.Z)(this,be),Se=Ht.checkMatrix(Se);var j=Se.clone(),R=j.rows,k=j.columns,te=new Float64Array(R),Me=1,Ne,Pe,Ke,Ut,Rt,fr,kr,ur,rn;for(Ne=0;Ne<R;Ne++)te[Ne]=Ne;for(ur=new Float64Array(R),Pe=0;Pe<k;Pe++){for(Ne=0;Ne<R;Ne++)ur[Ne]=j.get(Ne,Pe);for(Ne=0;Ne<R;Ne++){for(rn=Math.min(Ne,Pe),Rt=0,Ke=0;Ke<rn;Ke++)Rt+=j.get(Ne,Ke)*ur[Ke];ur[Ne]-=Rt,j.set(Ne,Pe,ur[Ne])}for(Ut=Pe,Ne=Pe+1;Ne<R;Ne++)Math.abs(ur[Ne])>Math.abs(ur[Ut])&&(Ut=Ne);if(Ut!==Pe){for(Ke=0;Ke<k;Ke++)fr=j.get(Ut,Ke),j.set(Ut,Ke,j.get(Pe,Ke)),j.set(Pe,Ke,fr);kr=te[Ut],te[Ut]=te[Pe],te[Pe]=kr,Me=-Me}if(Pe<R&&j.get(Pe,Pe)!==0)for(Ne=Pe+1;Ne<R;Ne++)j.set(Ne,Pe,j.get(Ne,Pe)/j.get(Pe,Pe))}this.LU=j,this.pivotVector=te,this.pivotSign=Me}return(0,I.Z)(be,[{key:"isSingular",value:function(){for(var j=this.LU,R=j.columns,k=0;k<R;k++)if(j.get(k,k)===0)return!0;return!1}},{key:"solve",value:function(j){j=Mt.checkMatrix(j);var R=this.LU,k=R.rows;if(k!==j.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");var te=j.columns,Me=j.subMatrixRow(this.pivotVector,0,te-1),Ne=R.columns,Pe,Ke,Ut;for(Ut=0;Ut<Ne;Ut++)for(Pe=Ut+1;Pe<Ne;Pe++)for(Ke=0;Ke<te;Ke++)Me.set(Pe,Ke,Me.get(Pe,Ke)-Me.get(Ut,Ke)*R.get(Pe,Ut));for(Ut=Ne-1;Ut>=0;Ut--){for(Ke=0;Ke<te;Ke++)Me.set(Ut,Ke,Me.get(Ut,Ke)/R.get(Ut,Ut));for(Pe=0;Pe<Ut;Pe++)for(Ke=0;Ke<te;Ke++)Me.set(Pe,Ke,Me.get(Pe,Ke)-Me.get(Ut,Ke)*R.get(Pe,Ut))}return Me}},{key:"determinant",get:function(){var j=this.LU;if(!j.isSquare())throw new Error("Matrix must be square");for(var R=this.pivotSign,k=j.columns,te=0;te<k;te++)R*=j.get(te,te);return R}},{key:"lowerTriangularMatrix",get:function(){for(var j=this.LU,R=j.rows,k=j.columns,te=new Mt(R,k),Me=0;Me<R;Me++)for(var Ne=0;Ne<k;Ne++)Me>Ne?te.set(Me,Ne,j.get(Me,Ne)):Me===Ne?te.set(Me,Ne,1):te.set(Me,Ne,0);return te}},{key:"upperTriangularMatrix",get:function(){for(var j=this.LU,R=j.rows,k=j.columns,te=new Mt(R,k),Me=0;Me<R;Me++)for(var Ne=0;Ne<k;Ne++)Me<=Ne?te.set(Me,Ne,j.get(Me,Ne)):te.set(Me,Ne,0);return te}},{key:"pivotPermutationVector",get:function(){return Array.from(this.pivotVector)}}]),be}();function at(be,Se){var j=0;return Math.abs(be)>Math.abs(Se)?(j=Se/be,Math.abs(be)*Math.sqrt(1+j*j)):Se!==0?(j=be/Se,Math.abs(Se)*Math.sqrt(1+j*j)):0}var Pt=function(){function be(Se){(0,E.Z)(this,be),Se=Ht.checkMatrix(Se);var j=Se.clone(),R=Se.rows,k=Se.columns,te=new Float64Array(k),Me,Ne,Pe,Ke;for(Pe=0;Pe<k;Pe++){var Ut=0;for(Me=Pe;Me<R;Me++)Ut=at(Ut,j.get(Me,Pe));if(Ut!==0){for(j.get(Pe,Pe)<0&&(Ut=-Ut),Me=Pe;Me<R;Me++)j.set(Me,Pe,j.get(Me,Pe)/Ut);for(j.set(Pe,Pe,j.get(Pe,Pe)+1),Ne=Pe+1;Ne<k;Ne++){for(Ke=0,Me=Pe;Me<R;Me++)Ke+=j.get(Me,Pe)*j.get(Me,Ne);for(Ke=-Ke/j.get(Pe,Pe),Me=Pe;Me<R;Me++)j.set(Me,Ne,j.get(Me,Ne)+Ke*j.get(Me,Pe))}}te[Pe]=-Ut}this.QR=j,this.Rdiag=te}return(0,I.Z)(be,[{key:"solve",value:function(j){j=Mt.checkMatrix(j);var R=this.QR,k=R.rows;if(j.rows!==k)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");var te=j.columns,Me=j.clone(),Ne=R.columns,Pe,Ke,Ut,Rt;for(Ut=0;Ut<Ne;Ut++)for(Ke=0;Ke<te;Ke++){for(Rt=0,Pe=Ut;Pe<k;Pe++)Rt+=R.get(Pe,Ut)*Me.get(Pe,Ke);for(Rt=-Rt/R.get(Ut,Ut),Pe=Ut;Pe<k;Pe++)Me.set(Pe,Ke,Me.get(Pe,Ke)+Rt*R.get(Pe,Ut))}for(Ut=Ne-1;Ut>=0;Ut--){for(Ke=0;Ke<te;Ke++)Me.set(Ut,Ke,Me.get(Ut,Ke)/this.Rdiag[Ut]);for(Pe=0;Pe<Ut;Pe++)for(Ke=0;Ke<te;Ke++)Me.set(Pe,Ke,Me.get(Pe,Ke)-Me.get(Ut,Ke)*R.get(Pe,Ut))}return Me.subMatrix(0,Ne-1,0,te-1)}},{key:"isFullRank",value:function(){for(var j=this.QR.columns,R=0;R<j;R++)if(this.Rdiag[R]===0)return!1;return!0}},{key:"upperTriangularMatrix",get:function(){var j=this.QR,R=j.columns,k=new Mt(R,R),te,Me;for(te=0;te<R;te++)for(Me=0;Me<R;Me++)te<Me?k.set(te,Me,j.get(te,Me)):te===Me?k.set(te,Me,this.Rdiag[te]):k.set(te,Me,0);return k}},{key:"orthogonalMatrix",get:function(){var j=this.QR,R=j.rows,k=j.columns,te=new Mt(R,k),Me,Ne,Pe,Ke;for(Pe=k-1;Pe>=0;Pe--){for(Me=0;Me<R;Me++)te.set(Me,Pe,0);for(te.set(Pe,Pe,1),Ne=Pe;Ne<k;Ne++)if(j.get(Pe,Pe)!==0){for(Ke=0,Me=Pe;Me<R;Me++)Ke+=j.get(Me,Pe)*te.get(Me,Ne);for(Ke=-Ke/j.get(Pe,Pe),Me=Pe;Me<R;Me++)te.set(Me,Ne,te.get(Me,Ne)+Ke*j.get(Me,Pe))}}return te}}]),be}(),gt=function(){function be(Se){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if((0,E.Z)(this,be),Se=Ht.checkMatrix(Se),Se.isEmpty())throw new Error("Matrix must be non-empty");var R=Se.rows,k=Se.columns,te=j.computeLeftSingularVectors,Me=te===void 0?!0:te,Ne=j.computeRightSingularVectors,Pe=Ne===void 0?!0:Ne,Ke=j.autoTranspose,Ut=Ke===void 0?!1:Ke,Rt=Boolean(Me),fr=Boolean(Pe),kr=!1,ur;if(R<k)if(!Ut)ur=Se.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{ur=Se.transpose(),R=ur.rows,k=ur.columns,kr=!0;var rn=Rt;Rt=fr,fr=rn}else ur=Se.clone();for(var On=Math.min(R,k),ne=Math.min(R+1,k),ye=new Float64Array(ne),Je=new Mt(R,On),Ct=new Mt(k,k),Nt=new Float64Array(k),mr=new Float64Array(R),lr=new Float64Array(ne),dr=0;dr<ne;dr++)lr[dr]=dr;for(var yr=Math.min(R-1,k),Gr=Math.max(0,Math.min(k-2,R)),Jr=Math.max(yr,Gr),Sr=0;Sr<Jr;Sr++){if(Sr<yr){ye[Sr]=0;for(var lt=Sr;lt<R;lt++)ye[Sr]=at(ye[Sr],ur.get(lt,Sr));if(ye[Sr]!==0){ur.get(Sr,Sr)<0&&(ye[Sr]=-ye[Sr]);for(var Ae=Sr;Ae<R;Ae++)ur.set(Ae,Sr,ur.get(Ae,Sr)/ye[Sr]);ur.set(Sr,Sr,ur.get(Sr,Sr)+1)}ye[Sr]=-ye[Sr]}for(var Ye=Sr+1;Ye<k;Ye++){if(Sr<yr&&ye[Sr]!==0){for(var Tt=0,pt=Sr;pt<R;pt++)Tt+=ur.get(pt,Sr)*ur.get(pt,Ye);Tt=-Tt/ur.get(Sr,Sr);for(var kt=Sr;kt<R;kt++)ur.set(kt,Ye,ur.get(kt,Ye)+Tt*ur.get(kt,Sr))}Nt[Ye]=ur.get(Sr,Ye)}if(Rt&&Sr<yr)for(var ar=Sr;ar<R;ar++)Je.set(ar,Sr,ur.get(ar,Sr));if(Sr<Gr){Nt[Sr]=0;for(var jr=Sr+1;jr<k;jr++)Nt[Sr]=at(Nt[Sr],Nt[jr]);if(Nt[Sr]!==0){Nt[Sr+1]<0&&(Nt[Sr]=0-Nt[Sr]);for(var tn=Sr+1;tn<k;tn++)Nt[tn]/=Nt[Sr];Nt[Sr+1]+=1}if(Nt[Sr]=-Nt[Sr],Sr+1<R&&Nt[Sr]!==0){for(var Ln=Sr+1;Ln<R;Ln++)mr[Ln]=0;for(var Dn=Sr+1;Dn<R;Dn++)for(var $n=Sr+1;$n<k;$n++)mr[Dn]+=Nt[$n]*ur.get(Dn,$n);for(var ci=Sr+1;ci<k;ci++)for(var Ii=-Nt[ci]/Nt[Sr+1],ki=Sr+1;ki<R;ki++)ur.set(ki,ci,ur.get(ki,ci)+Ii*mr[ki])}if(fr)for(var zi=Sr+1;zi<k;zi++)Ct.set(zi,Sr,Nt[zi])}}var Hn=Math.min(k,R+1);if(yr<k&&(ye[yr]=ur.get(yr,yr)),R<Hn&&(ye[Hn-1]=0),Gr+1<Hn&&(Nt[Gr]=ur.get(Gr,Hn-1)),Nt[Hn-1]=0,Rt){for(var Mo=yr;Mo<On;Mo++){for(var Ia=0;Ia<R;Ia++)Je.set(Ia,Mo,0);Je.set(Mo,Mo,1)}for(var vi=yr-1;vi>=0;vi--)if(ye[vi]!==0){for(var Ya=vi+1;Ya<On;Ya++){for(var no=0,Co=vi;Co<R;Co++)no+=Je.get(Co,vi)*Je.get(Co,Ya);no=-no/Je.get(vi,vi);for(var ho=vi;ho<R;ho++)Je.set(ho,Ya,Je.get(ho,Ya)+no*Je.get(ho,vi))}for(var Ea=vi;Ea<R;Ea++)Je.set(Ea,vi,-Je.get(Ea,vi));Je.set(vi,vi,1+Je.get(vi,vi));for(var gs=0;gs<vi-1;gs++)Je.set(gs,vi,0)}else{for(var _u=0;_u<R;_u++)Je.set(_u,vi,0);Je.set(vi,vi,1)}}if(fr)for(var _a=k-1;_a>=0;_a--){if(_a<Gr&&Nt[_a]!==0)for(var $o=_a+1;$o<k;$o++){for(var Ti=0,Qo=_a+1;Qo<k;Qo++)Ti+=Ct.get(Qo,_a)*Ct.get(Qo,$o);Ti=-Ti/Ct.get(_a+1,_a);for(var vo=_a+1;vo<k;vo++)Ct.set(vo,$o,Ct.get(vo,$o)+Ti*Ct.get(vo,_a))}for(var In=0;In<k;In++)Ct.set(In,_a,0);Ct.set(_a,_a,1)}for(var Bs=Hn-1,ru=0,ys=Number.EPSILON;Hn>0;){var Nn=void 0,Do=void 0;for(Nn=Hn-2;Nn>=-1&&Nn!==-1;Nn--){var Qu=Number.MIN_VALUE+ys*Math.abs(ye[Nn]+Math.abs(ye[Nn+1]));if(Math.abs(Nt[Nn])<=Qu||Number.isNaN(Nt[Nn])){Nt[Nn]=0;break}}if(Nn===Hn-2)Do=4;else{var ua=void 0;for(ua=Hn-1;ua>=Nn&&ua!==Nn;ua--){var Jo=(ua!==Hn?Math.abs(Nt[ua]):0)+(ua!==Nn+1?Math.abs(Nt[ua-1]):0);if(Math.abs(ye[ua])<=ys*Jo){ye[ua]=0;break}}ua===Nn?Do=3:ua===Hn-1?Do=1:(Do=2,Nn=ua)}switch(Nn++,Do){case 1:{var Gs=Nt[Hn-2];Nt[Hn-2]=0;for(var Za=Hn-2;Za>=Nn;Za--){var ms=at(ye[Za],Gs),bs=ye[Za]/ms,xa=Gs/ms;if(ye[Za]=ms,Za!==Nn&&(Gs=-xa*Nt[Za-1],Nt[Za-1]=bs*Nt[Za-1]),fr)for(var Pa=0;Pa<k;Pa++)ms=bs*Ct.get(Pa,Za)+xa*Ct.get(Pa,Hn-1),Ct.set(Pa,Hn-1,-xa*Ct.get(Pa,Za)+bs*Ct.get(Pa,Hn-1)),Ct.set(Pa,Za,ms)}break}case 2:{var qo=Nt[Nn-1];Nt[Nn-1]=0;for(var eo=Nn;eo<Hn;eo++){var es=at(ye[eo],qo),ts=ye[eo]/es,nu=qo/es;if(ye[eo]=es,qo=-nu*Nt[eo],Nt[eo]=ts*Nt[eo],Rt)for(var To=0;To<R;To++)es=ts*Je.get(To,eo)+nu*Je.get(To,Nn-1),Je.set(To,Nn-1,-nu*Je.get(To,eo)+ts*Je.get(To,Nn-1)),Je.set(To,eo,es)}break}case 3:{var Es=Math.max(Math.abs(ye[Hn-1]),Math.abs(ye[Hn-2]),Math.abs(Nt[Hn-2]),Math.abs(ye[Nn]),Math.abs(Nt[Nn])),pi=ye[Hn-1]/Es,Fs=ye[Hn-2]/Es,iu=Nt[Hn-2]/Es,Ha=ye[Nn]/Es,au=Nt[Nn]/Es,po=((Fs+pi)*(Fs-pi)+iu*iu)/2,ca=pi*iu*(pi*iu),to=0;(po!==0||ca!==0)&&(po<0?to=0-Math.sqrt(po*po+ca):to=Math.sqrt(po*po+ca),to=ca/(po+to));for(var Ra=(Ha+pi)*(Ha-pi)+to,Ao=Ha*au,li=Nn;li<Hn-1;li++){var fa=at(Ra,Ao);fa===0&&(fa=Number.MIN_VALUE);var na=Ra/fa,Xi=Ao/fa;if(li!==Nn&&(Nt[li-1]=fa),Ra=na*ye[li]+Xi*Nt[li],Nt[li]=na*Nt[li]-Xi*ye[li],Ao=Xi*ye[li+1],ye[li+1]=na*ye[li+1],fr)for(var io=0;io<k;io++)fa=na*Ct.get(io,li)+Xi*Ct.get(io,li+1),Ct.set(io,li+1,-Xi*Ct.get(io,li)+na*Ct.get(io,li+1)),Ct.set(io,li,fa);if(fa=at(Ra,Ao),fa===0&&(fa=Number.MIN_VALUE),na=Ra/fa,Xi=Ao/fa,ye[li]=fa,Ra=na*Nt[li]+Xi*ye[li+1],ye[li+1]=-Xi*Nt[li]+na*ye[li+1],Ao=Xi*Nt[li+1],Nt[li+1]=na*Nt[li+1],Rt&&li<R-1)for(var go=0;go<R;go++)fa=na*Je.get(go,li)+Xi*Je.get(go,li+1),Je.set(go,li+1,-Xi*Je.get(go,li)+na*Je.get(go,li+1)),Je.set(go,li,fa)}Nt[Hn-2]=Ra,ru=ru+1;break}case 4:{if(ye[Nn]<=0&&(ye[Nn]=ye[Nn]<0?-ye[Nn]:0,fr))for(var _s=0;_s<=Bs;_s++)Ct.set(_s,Nn,-Ct.get(_s,Nn));for(;Nn<Bs&&!(ye[Nn]>=ye[Nn+1]);){var No=ye[Nn];if(ye[Nn]=ye[Nn+1],ye[Nn+1]=No,fr&&Nn<k-1)for(var yo=0;yo<k;yo++)No=Ct.get(yo,Nn+1),Ct.set(yo,Nn+1,Ct.get(yo,Nn)),Ct.set(yo,Nn,No);if(Rt&&Nn<R-1)for(var rs=0;rs<R;rs++)No=Je.get(rs,Nn+1),Je.set(rs,Nn+1,Je.get(rs,Nn)),Je.set(rs,Nn,No);Nn++}ru=0,Hn--;break}}}if(kr){var Lo=Ct;Ct=Je,Je=Lo}this.m=R,this.n=k,this.s=ye,this.U=Je,this.V=Ct}return(0,I.Z)(be,[{key:"solve",value:function(j){for(var R=j,k=this.threshold,te=this.s.length,Me=Mt.zeros(te,te),Ne=0;Ne<te;Ne++)Math.abs(this.s[Ne])<=k?Me.set(Ne,Ne,0):Me.set(Ne,Ne,1/this.s[Ne]);for(var Pe=this.U,Ke=this.rightSingularVectors,Ut=Ke.mmul(Me),Rt=Ke.rows,fr=Pe.rows,kr=Mt.zeros(Rt,fr),ur=0;ur<Rt;ur++)for(var rn=0;rn<fr;rn++){for(var On=0,ne=0;ne<te;ne++)On+=Ut.get(ur,ne)*Pe.get(rn,ne);kr.set(ur,rn,On)}return kr.mmul(R)}},{key:"solveForDiagonal",value:function(j){return this.solve(Mt.diag(j))}},{key:"inverse",value:function(){for(var j=this.V,R=this.threshold,k=j.rows,te=j.columns,Me=new Mt(k,this.s.length),Ne=0;Ne<k;Ne++)for(var Pe=0;Pe<te;Pe++)Math.abs(this.s[Pe])>R&&Me.set(Ne,Pe,j.get(Ne,Pe)/this.s[Pe]);for(var Ke=this.U,Ut=Ke.rows,Rt=Ke.columns,fr=new Mt(k,Ut),kr=0;kr<k;kr++)for(var ur=0;ur<Ut;ur++){for(var rn=0,On=0;On<Rt;On++)rn+=Me.get(kr,On)*Ke.get(ur,On);fr.set(kr,ur,rn)}return fr}},{key:"condition",get:function(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}},{key:"norm2",get:function(){return this.s[0]}},{key:"rank",get:function(){for(var j=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,R=0,k=this.s,te=0,Me=k.length;te<Me;te++)k[te]>j&&R++;return R}},{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 Mt.diag(this.s)}}]),be}();function Dt(be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return be=Ht.checkMatrix(be),Se?new gt(be).inverse():ir(be,Mt.eye(be.rows))}function ir(be,Se){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return be=Ht.checkMatrix(be),Se=Ht.checkMatrix(Se),j?new gt(be).solve(Se):be.isSquare()?new rt(be).solve(Se):new Pt(be).solve(Se)}function At(be){if(be=Mt.checkMatrix(be),be.isSquare()){if(be.columns===0)return 1;var Se,j,R,k;if(be.columns===2)return Se=be.get(0,0),j=be.get(0,1),R=be.get(1,0),k=be.get(1,1),Se*k-j*R;if(be.columns===3){var te,Me,Ne;return te=new ct(be,[1,2],[1,2]),Me=new ct(be,[1,2],[0,2]),Ne=new ct(be,[1,2],[0,1]),Se=be.get(0,0),j=be.get(0,1),R=be.get(0,2),Se*At(te)-j*At(Me)+R*At(Ne)}else return new rt(be).determinant}else throw Error("determinant can only be calculated for a square matrix")}function xr(be,Se){for(var j=[],R=0;R<be;R++)R!==Se&&j.push(R);return j}function Pr(be,Se,j){var R=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1e-9,k=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1e-9;if(be>k)return new Array(Se.rows+1).fill(0);for(var te=Se.addRow(j,[0]),Me=0;Me<te.rows;Me++)Math.abs(te.get(Me,0))<R&&te.set(Me,0,0);return te.to1DArray()}function Qr(be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=Se.thresholdValue,R=j===void 0?1e-9:j,k=Se.thresholdError,te=k===void 0?1e-9:k;be=Mt.checkMatrix(be);for(var Me=be.rows,Ne=new Mt(Me,Me),Pe=0;Pe<Me;Pe++){var Ke=Mt.columnVector(be.getRow(Pe)),Ut=be.subMatrixRow(xr(Me,Pe)).transpose(),Rt=new gt(Ut),fr=Rt.solve(Ke),kr=Mt.sub(Ke,Ut.mmul(fr)).abs().max();Ne.setRow(Pe,Pr(kr,fr,Pe,R,te))}return Ne}function Vr(be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.EPSILON;if(be=Mt.checkMatrix(be),be.isEmpty())return be.transpose();for(var j=new gt(be,{autoTranspose:!0}),R=j.leftSingularVectors,k=j.rightSingularVectors,te=j.diagonal,Me=0;Me<te.length;Me++)Math.abs(te[Me])>Se?te[Me]=1/te[Me]:te[Me]=0;return k.mmul(Mt.diag(te).mmul(R.transpose()))}function nn(be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:be,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};be=new Mt(be);var R=!1;if(typeof Se=="object"&&!Mt.isMatrix(Se)&&!v(Se)?(j=Se,Se=be,R=!0):Se=new Mt(Se),be.rows!==Se.rows)throw new TypeError("Both matrices must have the same number of rows");var k=j,te=k.center,Me=te===void 0?!0:te;Me&&(be=be.center("column"),R||(Se=Se.center("column")));for(var Ne=be.transpose().mmul(Se),Pe=0;Pe<Ne.rows;Pe++)for(var Ke=0;Ke<Ne.columns;Ke++)Ne.set(Pe,Ke,Ne.get(Pe,Ke)*(1/(be.rows-1)));return Ne}function dn(be){var Se=arguments.length>1&&arguments[1]!==void 0?arguments[1]:be,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};be=new Mt(be);var R=!1;if(typeof Se=="object"&&!Mt.isMatrix(Se)&&!v(Se)?(j=Se,Se=be,R=!0):Se=new Mt(Se),be.rows!==Se.rows)throw new TypeError("Both matrices must have the same number of rows");var k=j,te=k.center,Me=te===void 0?!0:te,Ne=k.scale,Pe=Ne===void 0?!0:Ne;Me&&(be.center("column"),R||Se.center("column")),Pe&&(be.scale("column"),R||Se.scale("column"));for(var Ke=be.standardDeviation("column",{unbiased:!0}),Ut=R?Ke:Se.standardDeviation("column",{unbiased:!0}),Rt=be.transpose().mmul(Se),fr=0;fr<Rt.rows;fr++)for(var kr=0;kr<Rt.columns;kr++)Rt.set(fr,kr,Rt.get(fr,kr)*(1/(Ke[fr]*Ut[kr]))*(1/(be.rows-1)));return Rt}var Vn=function(){function be(Se){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(0,E.Z)(this,be);var R=j.assumeSymmetric,k=R===void 0?!1:R;if(Se=Ht.checkMatrix(Se),!Se.isSquare())throw new Error("Matrix is not a square matrix");if(Se.isEmpty())throw new Error("Matrix must be non-empty");var te=Se.columns,Me=new Mt(te,te),Ne=new Float64Array(te),Pe=new Float64Array(te),Ke=Se,Ut,Rt,fr=!1;if(k?fr=!0:fr=Se.isSymmetric(),fr){for(Ut=0;Ut<te;Ut++)for(Rt=0;Rt<te;Rt++)Me.set(Ut,Rt,Ke.get(Ut,Rt));cn(te,Pe,Ne,Me),wn(te,Pe,Ne,Me)}else{var kr=new Mt(te,te),ur=new Float64Array(te);for(Rt=0;Rt<te;Rt++)for(Ut=0;Ut<te;Ut++)kr.set(Ut,Rt,Ke.get(Ut,Rt));xn(te,kr,ur,Me),gn(te,Pe,Ne,Me,kr)}this.n=te,this.e=Pe,this.d=Ne,this.V=Me}return(0,I.Z)(be,[{key:"realEigenvalues",get:function(){return Array.from(this.d)}},{key:"imaginaryEigenvalues",get:function(){return Array.from(this.e)}},{key:"eigenvectorMatrix",get:function(){return this.V}},{key:"diagonalMatrix",get:function(){var j=this.n,R=this.e,k=this.d,te=new Mt(j,j),Me,Ne;for(Me=0;Me<j;Me++){for(Ne=0;Ne<j;Ne++)te.set(Me,Ne,0);te.set(Me,Me,k[Me]),R[Me]>0?te.set(Me,Me+1,R[Me]):R[Me]<0&&te.set(Me,Me-1,R[Me])}return te}}]),be}();function cn(be,Se,j,R){var k,te,Me,Ne,Pe,Ke,Ut,Rt;for(Pe=0;Pe<be;Pe++)j[Pe]=R.get(be-1,Pe);for(Ne=be-1;Ne>0;Ne--){for(Rt=0,Me=0,Ke=0;Ke<Ne;Ke++)Rt=Rt+Math.abs(j[Ke]);if(Rt===0)for(Se[Ne]=j[Ne-1],Pe=0;Pe<Ne;Pe++)j[Pe]=R.get(Ne-1,Pe),R.set(Ne,Pe,0),R.set(Pe,Ne,0);else{for(Ke=0;Ke<Ne;Ke++)j[Ke]/=Rt,Me+=j[Ke]*j[Ke];for(k=j[Ne-1],te=Math.sqrt(Me),k>0&&(te=-te),Se[Ne]=Rt*te,Me=Me-k*te,j[Ne-1]=k-te,Pe=0;Pe<Ne;Pe++)Se[Pe]=0;for(Pe=0;Pe<Ne;Pe++){for(k=j[Pe],R.set(Pe,Ne,k),te=Se[Pe]+R.get(Pe,Pe)*k,Ke=Pe+1;Ke<=Ne-1;Ke++)te+=R.get(Ke,Pe)*j[Ke],Se[Ke]+=R.get(Ke,Pe)*k;Se[Pe]=te}for(k=0,Pe=0;Pe<Ne;Pe++)Se[Pe]/=Me,k+=Se[Pe]*j[Pe];for(Ut=k/(Me+Me),Pe=0;Pe<Ne;Pe++)Se[Pe]-=Ut*j[Pe];for(Pe=0;Pe<Ne;Pe++){for(k=j[Pe],te=Se[Pe],Ke=Pe;Ke<=Ne-1;Ke++)R.set(Ke,Pe,R.get(Ke,Pe)-(k*Se[Ke]+te*j[Ke]));j[Pe]=R.get(Ne-1,Pe),R.set(Ne,Pe,0)}}j[Ne]=Me}for(Ne=0;Ne<be-1;Ne++){if(R.set(be-1,Ne,R.get(Ne,Ne)),R.set(Ne,Ne,1),Me=j[Ne+1],Me!==0){for(Ke=0;Ke<=Ne;Ke++)j[Ke]=R.get(Ke,Ne+1)/Me;for(Pe=0;Pe<=Ne;Pe++){for(te=0,Ke=0;Ke<=Ne;Ke++)te+=R.get(Ke,Ne+1)*R.get(Ke,Pe);for(Ke=0;Ke<=Ne;Ke++)R.set(Ke,Pe,R.get(Ke,Pe)-te*j[Ke])}}for(Ke=0;Ke<=Ne;Ke++)R.set(Ke,Ne+1,0)}for(Pe=0;Pe<be;Pe++)j[Pe]=R.get(be-1,Pe),R.set(be-1,Pe,0);R.set(be-1,be-1,1),Se[0]=0}function wn(be,Se,j,R){var k,te,Me,Ne,Pe,Ke,Ut,Rt,fr,kr,ur,rn,On,ne,ye,Je,Ct;for(Me=1;Me<be;Me++)Se[Me-1]=Se[Me];Se[be-1]=0;var Nt=0,mr=0,lr=Number.EPSILON;for(Ke=0;Ke<be;Ke++){for(mr=Math.max(mr,Math.abs(j[Ke])+Math.abs(Se[Ke])),Ut=Ke;Ut<be&&!(Math.abs(Se[Ut])<=lr*mr);)Ut++;if(Ut>Ke){Ct=0;do{for(Ct=Ct+1,k=j[Ke],Rt=(j[Ke+1]-k)/(2*Se[Ke]),fr=at(Rt,1),Rt<0&&(fr=-fr),j[Ke]=Se[Ke]/(Rt+fr),j[Ke+1]=Se[Ke]*(Rt+fr),kr=j[Ke+1],te=k-j[Ke],Me=Ke+2;Me<be;Me++)j[Me]-=te;for(Nt=Nt+te,Rt=j[Ut],ur=1,rn=ur,On=ur,ne=Se[Ke+1],ye=0,Je=0,Me=Ut-1;Me>=Ke;Me--)for(On=rn,rn=ur,Je=ye,k=ur*Se[Me],te=ur*Rt,fr=at(Rt,Se[Me]),Se[Me+1]=ye*fr,ye=Se[Me]/fr,ur=Rt/fr,Rt=ur*j[Me]-ye*k,j[Me+1]=te+ye*(ur*k+ye*j[Me]),Pe=0;Pe<be;Pe++)te=R.get(Pe,Me+1),R.set(Pe,Me+1,ye*R.get(Pe,Me)+ur*te),R.set(Pe,Me,ur*R.get(Pe,Me)-ye*te);Rt=-ye*Je*On*ne*Se[Ke]/kr,Se[Ke]=ye*Rt,j[Ke]=ur*Rt}while(Math.abs(Se[Ke])>lr*mr)}j[Ke]=j[Ke]+Nt,Se[Ke]=0}for(Me=0;Me<be-1;Me++){for(Pe=Me,Rt=j[Me],Ne=Me+1;Ne<be;Ne++)j[Ne]<Rt&&(Pe=Ne,Rt=j[Ne]);if(Pe!==Me)for(j[Pe]=j[Me],j[Me]=Rt,Ne=0;Ne<be;Ne++)Rt=R.get(Ne,Me),R.set(Ne,Me,R.get(Ne,Pe)),R.set(Ne,Pe,Rt)}}function xn(be,Se,j,R){var k=0,te=be-1,Me,Ne,Pe,Ke,Ut,Rt,fr;for(Rt=k+1;Rt<=te-1;Rt++){for(fr=0,Ke=Rt;Ke<=te;Ke++)fr=fr+Math.abs(Se.get(Ke,Rt-1));if(fr!==0){for(Pe=0,Ke=te;Ke>=Rt;Ke--)j[Ke]=Se.get(Ke,Rt-1)/fr,Pe+=j[Ke]*j[Ke];for(Ne=Math.sqrt(Pe),j[Rt]>0&&(Ne=-Ne),Pe=Pe-j[Rt]*Ne,j[Rt]=j[Rt]-Ne,Ut=Rt;Ut<be;Ut++){for(Me=0,Ke=te;Ke>=Rt;Ke--)Me+=j[Ke]*Se.get(Ke,Ut);for(Me=Me/Pe,Ke=Rt;Ke<=te;Ke++)Se.set(Ke,Ut,Se.get(Ke,Ut)-Me*j[Ke])}for(Ke=0;Ke<=te;Ke++){for(Me=0,Ut=te;Ut>=Rt;Ut--)Me+=j[Ut]*Se.get(Ke,Ut);for(Me=Me/Pe,Ut=Rt;Ut<=te;Ut++)Se.set(Ke,Ut,Se.get(Ke,Ut)-Me*j[Ut])}j[Rt]=fr*j[Rt],Se.set(Rt,Rt-1,fr*Ne)}}for(Ke=0;Ke<be;Ke++)for(Ut=0;Ut<be;Ut++)R.set(Ke,Ut,Ke===Ut?1:0);for(Rt=te-1;Rt>=k+1;Rt--)if(Se.get(Rt,Rt-1)!==0){for(Ke=Rt+1;Ke<=te;Ke++)j[Ke]=Se.get(Ke,Rt-1);for(Ut=Rt;Ut<=te;Ut++){for(Ne=0,Ke=Rt;Ke<=te;Ke++)Ne+=j[Ke]*R.get(Ke,Ut);for(Ne=Ne/j[Rt]/Se.get(Rt,Rt-1),Ke=Rt;Ke<=te;Ke++)R.set(Ke,Ut,R.get(Ke,Ut)+Ne*j[Ke])}}}function gn(be,Se,j,R,k){var te=be-1,Me=0,Ne=be-1,Pe=Number.EPSILON,Ke=0,Ut=0,Rt=0,fr=0,kr=0,ur=0,rn=0,On=0,ne,ye,Je,Ct,Nt,mr,lr,dr,yr,Gr,Jr,Sr,lt,Ae,Ye;for(ne=0;ne<be;ne++)for((ne<Me||ne>Ne)&&(j[ne]=k.get(ne,ne),Se[ne]=0),ye=Math.max(ne-1,0);ye<be;ye++)Ut=Ut+Math.abs(k.get(ne,ye));for(;te>=Me;){for(Ct=te;Ct>Me&&(ur=Math.abs(k.get(Ct-1,Ct-1))+Math.abs(k.get(Ct,Ct)),ur===0&&(ur=Ut),!(Math.abs(k.get(Ct,Ct-1))<Pe*ur));)Ct--;if(Ct===te)k.set(te,te,k.get(te,te)+Ke),j[te]=k.get(te,te),Se[te]=0,te--,On=0;else if(Ct===te-1){if(lr=k.get(te,te-1)*k.get(te-1,te),Rt=(k.get(te-1,te-1)-k.get(te,te))/2,fr=Rt*Rt+lr,rn=Math.sqrt(Math.abs(fr)),k.set(te,te,k.get(te,te)+Ke),k.set(te-1,te-1,k.get(te-1,te-1)+Ke),dr=k.get(te,te),fr>=0){for(rn=Rt>=0?Rt+rn:Rt-rn,j[te-1]=dr+rn,j[te]=j[te-1],rn!==0&&(j[te]=dr-lr/rn),Se[te-1]=0,Se[te]=0,dr=k.get(te,te-1),ur=Math.abs(dr)+Math.abs(rn),Rt=dr/ur,fr=rn/ur,kr=Math.sqrt(Rt*Rt+fr*fr),Rt=Rt/kr,fr=fr/kr,ye=te-1;ye<be;ye++)rn=k.get(te-1,ye),k.set(te-1,ye,fr*rn+Rt*k.get(te,ye)),k.set(te,ye,fr*k.get(te,ye)-Rt*rn);for(ne=0;ne<=te;ne++)rn=k.get(ne,te-1),k.set(ne,te-1,fr*rn+Rt*k.get(ne,te)),k.set(ne,te,fr*k.get(ne,te)-Rt*rn);for(ne=Me;ne<=Ne;ne++)rn=R.get(ne,te-1),R.set(ne,te-1,fr*rn+Rt*R.get(ne,te)),R.set(ne,te,fr*R.get(ne,te)-Rt*rn)}else j[te-1]=dr+Rt,j[te]=dr+Rt,Se[te-1]=rn,Se[te]=-rn;te=te-2,On=0}else{if(dr=k.get(te,te),yr=0,lr=0,Ct<te&&(yr=k.get(te-1,te-1),lr=k.get(te,te-1)*k.get(te-1,te)),On===10){for(Ke+=dr,ne=Me;ne<=te;ne++)k.set(ne,ne,k.get(ne,ne)-dr);ur=Math.abs(k.get(te,te-1))+Math.abs(k.get(te-1,te-2)),dr=yr=.75*ur,lr=-.4375*ur*ur}if(On===30&&(ur=(yr-dr)/2,ur=ur*ur+lr,ur>0)){for(ur=Math.sqrt(ur),yr<dr&&(ur=-ur),ur=dr-lr/((yr-dr)/2+ur),ne=Me;ne<=te;ne++)k.set(ne,ne,k.get(ne,ne)-ur);Ke+=ur,dr=yr=lr=.964}for(On=On+1,Nt=te-2;Nt>=Ct&&(rn=k.get(Nt,Nt),kr=dr-rn,ur=yr-rn,Rt=(kr*ur-lr)/k.get(Nt+1,Nt)+k.get(Nt,Nt+1),fr=k.get(Nt+1,Nt+1)-rn-kr-ur,kr=k.get(Nt+2,Nt+1),ur=Math.abs(Rt)+Math.abs(fr)+Math.abs(kr),Rt=Rt/ur,fr=fr/ur,kr=kr/ur,!(Nt===Ct||Math.abs(k.get(Nt,Nt-1))*(Math.abs(fr)+Math.abs(kr))<Pe*(Math.abs(Rt)*(Math.abs(k.get(Nt-1,Nt-1))+Math.abs(rn)+Math.abs(k.get(Nt+1,Nt+1))))));)Nt--;for(ne=Nt+2;ne<=te;ne++)k.set(ne,ne-2,0),ne>Nt+2&&k.set(ne,ne-3,0);for(Je=Nt;Je<=te-1&&(Ae=Je!==te-1,Je!==Nt&&(Rt=k.get(Je,Je-1),fr=k.get(Je+1,Je-1),kr=Ae?k.get(Je+2,Je-1):0,dr=Math.abs(Rt)+Math.abs(fr)+Math.abs(kr),dr!==0&&(Rt=Rt/dr,fr=fr/dr,kr=kr/dr)),dr!==0);Je++)if(ur=Math.sqrt(Rt*Rt+fr*fr+kr*kr),Rt<0&&(ur=-ur),ur!==0){for(Je!==Nt?k.set(Je,Je-1,-ur*dr):Ct!==Nt&&k.set(Je,Je-1,-k.get(Je,Je-1)),Rt=Rt+ur,dr=Rt/ur,yr=fr/ur,rn=kr/ur,fr=fr/Rt,kr=kr/Rt,ye=Je;ye<be;ye++)Rt=k.get(Je,ye)+fr*k.get(Je+1,ye),Ae&&(Rt=Rt+kr*k.get(Je+2,ye),k.set(Je+2,ye,k.get(Je+2,ye)-Rt*rn)),k.set(Je,ye,k.get(Je,ye)-Rt*dr),k.set(Je+1,ye,k.get(Je+1,ye)-Rt*yr);for(ne=0;ne<=Math.min(te,Je+3);ne++)Rt=dr*k.get(ne,Je)+yr*k.get(ne,Je+1),Ae&&(Rt=Rt+rn*k.get(ne,Je+2),k.set(ne,Je+2,k.get(ne,Je+2)-Rt*kr)),k.set(ne,Je,k.get(ne,Je)-Rt),k.set(ne,Je+1,k.get(ne,Je+1)-Rt*fr);for(ne=Me;ne<=Ne;ne++)Rt=dr*R.get(ne,Je)+yr*R.get(ne,Je+1),Ae&&(Rt=Rt+rn*R.get(ne,Je+2),R.set(ne,Je+2,R.get(ne,Je+2)-Rt*kr)),R.set(ne,Je,R.get(ne,Je)-Rt),R.set(ne,Je+1,R.get(ne,Je+1)-Rt*fr)}}}if(Ut!==0){for(te=be-1;te>=0;te--)if(Rt=j[te],fr=Se[te],fr===0)for(Ct=te,k.set(te,te,1),ne=te-1;ne>=0;ne--){for(lr=k.get(ne,ne)-Rt,kr=0,ye=Ct;ye<=te;ye++)kr=kr+k.get(ne,ye)*k.get(ye,te);if(Se[ne]<0)rn=lr,ur=kr;else if(Ct=ne,Se[ne]===0?k.set(ne,te,lr!==0?-kr/lr:-kr/(Pe*Ut)):(dr=k.get(ne,ne+1),yr=k.get(ne+1,ne),fr=(j[ne]-Rt)*(j[ne]-Rt)+Se[ne]*Se[ne],mr=(dr*ur-rn*kr)/fr,k.set(ne,te,mr),k.set(ne+1,te,Math.abs(dr)>Math.abs(rn)?(-kr-lr*mr)/dr:(-ur-yr*mr)/rn)),mr=Math.abs(k.get(ne,te)),Pe*mr*mr>1)for(ye=ne;ye<=te;ye++)k.set(ye,te,k.get(ye,te)/mr)}else if(fr<0)for(Ct=te-1,Math.abs(k.get(te,te-1))>Math.abs(k.get(te-1,te))?(k.set(te-1,te-1,fr/k.get(te,te-1)),k.set(te-1,te,-(k.get(te,te)-Rt)/k.get(te,te-1))):(Ye=Un(0,-k.get(te-1,te),k.get(te-1,te-1)-Rt,fr),k.set(te-1,te-1,Ye[0]),k.set(te-1,te,Ye[1])),k.set(te,te-1,0),k.set(te,te,1),ne=te-2;ne>=0;ne--){for(Gr=0,Jr=0,ye=Ct;ye<=te;ye++)Gr=Gr+k.get(ne,ye)*k.get(ye,te-1),Jr=Jr+k.get(ne,ye)*k.get(ye,te);if(lr=k.get(ne,ne)-Rt,Se[ne]<0)rn=lr,kr=Gr,ur=Jr;else if(Ct=ne,Se[ne]===0?(Ye=Un(-Gr,-Jr,lr,fr),k.set(ne,te-1,Ye[0]),k.set(ne,te,Ye[1])):(dr=k.get(ne,ne+1),yr=k.get(ne+1,ne),Sr=(j[ne]-Rt)*(j[ne]-Rt)+Se[ne]*Se[ne]-fr*fr,lt=(j[ne]-Rt)*2*fr,Sr===0&&lt===0&&(Sr=Pe*Ut*(Math.abs(lr)+Math.abs(fr)+Math.abs(dr)+Math.abs(yr)+Math.abs(rn))),Ye=Un(dr*kr-rn*Gr+fr*Jr,dr*ur-rn*Jr-fr*Gr,Sr,lt),k.set(ne,te-1,Ye[0]),k.set(ne,te,Ye[1]),Math.abs(dr)>Math.abs(rn)+Math.abs(fr)?(k.set(ne+1,te-1,(-Gr-lr*k.get(ne,te-1)+fr*k.get(ne,te))/dr),k.set(ne+1,te,(-Jr-lr*k.get(ne,te)-fr*k.get(ne,te-1))/dr)):(Ye=Un(-kr-yr*k.get(ne,te-1),-ur-yr*k.get(ne,te),rn,fr),k.set(ne+1,te-1,Ye[0]),k.set(ne+1,te,Ye[1]))),mr=Math.max(Math.abs(k.get(ne,te-1)),Math.abs(k.get(ne,te))),Pe*mr*mr>1)for(ye=ne;ye<=te;ye++)k.set(ye,te-1,k.get(ye,te-1)/mr),k.set(ye,te,k.get(ye,te)/mr)}for(ne=0;ne<be;ne++)if(ne<Me||ne>Ne)for(ye=ne;ye<be;ye++)R.set(ne,ye,k.get(ne,ye));for(ye=be-1;ye>=Me;ye--)for(ne=Me;ne<=Ne;ne++){for(rn=0,Je=Me;Je<=Math.min(ye,Ne);Je++)rn=rn+R.get(ne,Je)*k.get(Je,ye);R.set(ne,ye,rn)}}}function Un(be,Se,j,R){var k,te;return Math.abs(j)>Math.abs(R)?(k=R/j,te=j+k*R,[(be+k*Se)/te,(Se-k*be)/te]):(k=j/R,te=R+k*j,[(k*be+Se)/te,(k*Se-be)/te])}var bt=function(){function be(Se){if((0,E.Z)(this,be),Se=Ht.checkMatrix(Se),!Se.isSymmetric())throw new Error("Matrix is not symmetric");var j=Se,R=j.rows,k=new Mt(R,R),te=!0,Me,Ne,Pe;for(Ne=0;Ne<R;Ne++){var Ke=0;for(Pe=0;Pe<Ne;Pe++){var Ut=0;for(Me=0;Me<Pe;Me++)Ut+=k.get(Pe,Me)*k.get(Ne,Me);Ut=(j.get(Ne,Pe)-Ut)/k.get(Pe,Pe),k.set(Ne,Pe,Ut),Ke=Ke+Ut*Ut}for(Ke=j.get(Ne,Ne)-Ke,te&=Ke>0,k.set(Ne,Ne,Math.sqrt(Math.max(Ke,0))),Pe=Ne+1;Pe<R;Pe++)k.set(Ne,Pe,0)}this.L=k,this.positiveDefinite=Boolean(te)}return(0,I.Z)(be,[{key:"isPositiveDefinite",value:function(){return this.positiveDefinite}},{key:"solve",value:function(j){j=Ht.checkMatrix(j);var R=this.L,k=R.rows;if(j.rows!==k)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");var te=j.columns,Me=j.clone(),Ne,Pe,Ke;for(Ke=0;Ke<k;Ke++)for(Pe=0;Pe<te;Pe++){for(Ne=0;Ne<Ke;Ne++)Me.set(Ke,Pe,Me.get(Ke,Pe)-Me.get(Ne,Pe)*R.get(Ke,Ne));Me.set(Ke,Pe,Me.get(Ke,Pe)/R.get(Ke,Ke))}for(Ke=k-1;Ke>=0;Ke--)for(Pe=0;Pe<te;Pe++){for(Ne=Ke+1;Ne<k;Ne++)Me.set(Ke,Pe,Me.get(Ke,Pe)-Me.get(Ne,Pe)*R.get(Ne,Ke));Me.set(Ke,Pe,Me.get(Ke,Pe)/R.get(Ke,Ke))}return Me}},{key:"lowerTriangularMatrix",get:function(){return this.L}}]),be}(),Mn=(0,I.Z)(function be(Se){var j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(0,E.Z)(this,be),Se=Ht.checkMatrix(Se);var R=j.Y,k=j.scaleScores,te=k===void 0?!1:k,Me=j.maxIterations,Ne=Me===void 0?1e3:Me,Pe=j.terminationCriteria,Ke=Pe===void 0?1e-10:Pe,Ut;if(R){if(v(R)&&typeof R[0]=="number"?R=Mt.columnVector(R):R=Ht.checkMatrix(R),R.rows!==Se.rows)throw new Error("Y should have the same number of rows as X");Ut=R.getColumnVector(0)}else Ut=Se.getColumnVector(0);for(var Rt=1,fr,kr,ur,rn,On=0;On<Ne&&Rt>Ke;On++)ur=Se.transpose().mmul(Ut).div(Ut.transpose().mmul(Ut).get(0,0)),ur=ur.div(ur.norm()),fr=Se.mmul(ur).div(ur.transpose().mmul(ur).get(0,0)),On>0&&(Rt=fr.clone().sub(rn).pow(2).sum()),rn=fr.clone(),R?(kr=R.transpose().mmul(fr).div(fr.transpose().mmul(fr).get(0,0)),kr=kr.div(kr.norm()),Ut=R.mmul(kr).div(kr.transpose().mmul(kr).get(0,0))):Ut=fr;if(R){var ne=Se.transpose().mmul(fr).div(fr.transpose().mmul(fr).get(0,0));ne=ne.div(ne.norm());var ye=Se.clone().sub(fr.clone().mmul(ne.transpose())),Je=Ut.transpose().mmul(fr).div(fr.transpose().mmul(fr).get(0,0)),Ct=R.clone().sub(fr.clone().mulS(Je.get(0,0)).mmul(kr.transpose()));this.t=fr,this.p=ne.transpose(),this.w=ur.transpose(),this.q=kr,this.u=Ut,this.s=fr.transpose().mmul(fr),this.xResidual=ye,this.yResidual=Ct,this.betas=Je}else this.w=ur.transpose(),this.s=fr.transpose().mmul(fr).sqrt(),te?this.t=fr.clone().div(this.s.get(0,0)):this.t=fr,this.xResidual=Se.sub(fr.mmul(ur.transpose()))})},17244:function(dt,x,M){"use strict";M.d(x,{x0:function(){return E}});var S=function(A){return crypto.getRandomValues(new Uint8Array(A))},B=function(A,v,p){var c=(2<<Math.log(A.length-1)/Math.LN2)-1,f=-~(1.6*c*v/A.length);return function(){for(var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v,T="";;)for(var m=p(f),w=f;w--;)if(T+=A[m[w]&c]||"",T.length===l)return T}},N=function(A){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:21;return B(A,v,S)},E=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:21;return crypto.getRandomValues(new Uint8Array(A)).reduce(function(v,p){return p&=63,p<36?v+=p.toString(36):p<62?v+=(p-26).toString(36).toUpperCase():p>62?v+="-":v+="_",v},"")}},49469:function(dt,x){"use strict";var M;M={value:!0};var S;(function(ae){ae.TextureCompressionBC="texture-compression-bc"})(S=x.UX||(x.UX={}));var B;(function(ae){ae.ClampToEdge="clamp-to-edge",ae.Repeat="repeat",ae.MirrorRepeat="mirror-repeat"})(B=x.OB||(x.OB={}));var N;(function(ae){ae.UniformBuffer="uniform-buffer",ae.StorageBuffer="storage-buffer",ae.ReadonlyStorageBuffer="readonly-storage-buffer",ae.Sampler="sampler",ae.ComparisonSampler="comparison-sampler",ae.SampledTexture="sampled-texture",ae.ReadonlyStorageTexture="readonly-storage-texture",ae.WriteonlyStorageTexture="writeonly-storage-texture"})(N=x.$l||(x.$l={}));var E;(function(ae){ae.Zero="zero",ae.One="one",ae.SrcColor="src-color",ae.OneMinusSrcColor="one-minus-src-color",ae.SrcAlpha="src-alpha",ae.OneMinusSrcAlpha="one-minus-src-alpha",ae.DstColor="dst-color",ae.OneMinusDstColor="one-minus-dst-color",ae.DstAlpha="dst-alpha",ae.OneMinusDstAlpha="one-minus-dst-alpha",ae.SrcAlphaSaturated="src-alpha-saturated",ae.BlendColor="blend-color",ae.OneMinusBlendColor="one-minus-blend-color"})(E=x.zi||(x.zi={}));var I;(function(ae){ae.Add="add",ae.Subtract="subtract",ae.ReverseSubtract="reverse-subtract",ae.Min="min",ae.Max="max"})(I=x.db||(x.db={}));var A;(function(ae){ae.Never="never",ae.Less="less",ae.Equal="equal",ae.LessEqual="less-equal",ae.Greater="greater",ae.NotEqual="not-equal",ae.GreaterEqual="greater-equal",ae.Always="always"})(A=x.wb||(x.wb={}));var v;(function(ae){ae.None="none",ae.Front="front",ae.Back="back"})(v=x.Wf||(x.Wf={}));var p;(function(ae){ae.Nearest="nearest",ae.Linear="linear"})(p=x.X9||(x.X9={}));var c;(function(ae){ae.CCW="ccw",ae.CW="cw"})(c=x.zX||(x.zX={}));var f;(function(ae){ae.Uint16="uint16",ae.Uint32="uint32"})(f=x.iD||(x.iD={}));var l;(function(ae){ae.Vertex="vertex",ae.Instance="instance"})(l=x.V||(x.V={}));var T;(function(ae){ae.Load="load"})(T=x.Ws||(x.Ws={}));var m;(function(ae){ae.PointList="point-list",ae.LineList="line-list",ae.LineStrip="line-strip",ae.TriangleList="triangle-list",ae.TriangleStrip="triangle-strip"})(m=x.YV||(x.YV={}));var w;(function(ae){ae.Keep="keep",ae.Zero="zero",ae.Replace="replace",ae.Invert="invert",ae.IncrementClamp="increment-clamp",ae.DecrementClamp="decrement-clamp",ae.IncrementWrap="increment-wrap",ae.DecrementWrap="decrement-wrap"})(w=x.xS||(x.xS={}));var O;(function(ae){ae.Store="store",ae.Clear="clear"})(O=x.EG||(x.EG={}));var D;(function(ae){ae.E1d="1d",ae.E2d="2d",ae.E3d="3d"})(D=x.kd||(x.kd={}));var g;(function(ae){ae.R8Unorm="r8unorm",ae.R8Snorm="r8snorm",ae.R8Uint="r8uint",ae.R8Sint="r8sint",ae.R16Uint="r16uint",ae.R16Sint="r16sint",ae.R16Float="r16float",ae.RG8Unorm="rg8unorm",ae.RG8Snorm="rg8snorm",ae.RG8Uint="rg8uint",ae.RG8Sint="rg8sint",ae.R32Uint="r32uint",ae.R32Sint="r32sint",ae.R32Float="r32float",ae.RG16Uint="rg16uint",ae.RG16Sint="rg16sint",ae.RG16Float="rg16float",ae.RGBA8Unorm="rgba8unorm",ae.RGBA8UnormSRGB="rgba8unorm-srgb",ae.RGBA8Snorm="rgba8snorm",ae.RGBA8Uint="rgba8uint",ae.RGBA8Sint="rgba8sint",ae.BGRA8Unorm="bgra8unorm",ae.BGRA8UnormSRGB="bgra8unorm-srgb",ae.RGB10A2Unorm="rgb10a2unorm",ae.RG11B10Float="rg11b10float",ae.RG32Uint="rg32uint",ae.RG32Sint="rg32sint",ae.RG32Float="rg32float",ae.RGBA16Uint="rgba16uint",ae.RGBA16Sint="rgba16sint",ae.RGBA16Float="rgba16float",ae.RGBA32Uint="rgba32uint",ae.RGBA32Sint="rgba32sint",ae.RGBA32Float="rgba32float",ae.Depth32Float="depth32float",ae.Depth24Plus="depth24plus",ae.Depth24PlusStencil8="depth24plus-stencil8"})(g=x.EV||(x.EV={}));var _;(function(ae){ae.Float="float",ae.Sint="sint",ae.Uint="uint"})(_=x.Ek||(x.Ek={}));var Y;(function(ae){ae.E1d="1d",ae.E2d="2d",ae.E2dArray="2d-array",ae.Cube="cube",ae.CubeArray="cube-array",ae.E3d="3d"})(Y=x.p_||(x.p_={}));var V;(function(ae){ae.Uchar2="uchar2",ae.Uchar4="uchar4",ae.Char2="char2",ae.Char4="char4",ae.Uchar2Norm="uchar2norm",ae.Uchar4Norm="uchar4norm",ae.Char2Norm="char2norm",ae.Char4Norm="char4norm",ae.Ushort2="ushort2",ae.Ushort4="ushort4",ae.Short2="short2",ae.Short4="short4",ae.Ushort2Norm="ushort2norm",ae.Ushort4Norm="ushort4norm",ae.Short2Norm="short2norm",ae.Short4Norm="short4norm",ae.Half2="half2",ae.Half4="half4",ae.Float="float",ae.Float2="float2",ae.Float3="float3",ae.Float4="float4",ae.Uint="uint",ae.Uint2="uint2",ae.Uint3="uint3",ae.Uint4="uint4",ae.Int="int",ae.Int2="int2",ae.Int3="int3",ae.Int4="int4"})(V=x.gB||(x.gB={}));var z;(function(ae){ae.All="all",ae.StencilOnly="stencil-only",ae.DepthOnly="depth-only"})(z=x.H7||(x.H7={}));var Z;(function(ae){ae.Error="error",ae.Warning="warning",ae.Info="info"})(Z=x.mj||(x.mj={}));var J;(function(ae){ae.Occlusion="occlusion"})(J=x.xL||(x.xL={}));var ee;(function(ae){ae[ae.MapRead=1]="MapRead",ae[ae.MapWrite=2]="MapWrite",ae[ae.CopySrc=4]="CopySrc",ae[ae.CopyDst=8]="CopyDst",ae[ae.Index=16]="Index",ae[ae.Vertex=32]="Vertex",ae[ae.Uniform=64]="Uniform",ae[ae.Storage=128]="Storage",ae[ae.Indirect=256]="Indirect",ae[ae.QueryResolve=512]="QueryResolve"})(ee=x.FB||(x.FB={}));var Q;(function(ae){ae[ae.Red=1]="Red",ae[ae.Green=2]="Green",ae[ae.Blue=4]="Blue",ae[ae.Alpha=8]="Alpha",ae[ae.All=15]="All"})(Q=x.Yw||(x.Yw={}));var re;(function(ae){ae[ae.Vertex=1]="Vertex",ae[ae.Fragment=2]="Fragment",ae[ae.Compute=4]="Compute"})(re=x.$X||(x.$X={}));var fe;(function(ae){ae[ae.CopySrc=1]="CopySrc",ae[ae.CopyDst=2]="CopyDst",ae[ae.Sampled=4]="Sampled",ae[ae.Storage=8]="Storage",ae[ae.OutputAttachment=16]="OutputAttachment"})(fe=x.v2||(x.v2={}));var me;(function(ae){ae[ae.Read=1]="Read",ae[ae.Write=2]="Write"})(me=x.gc||(x.gc={}))},48168:function(dt,x,M){var S=M(39092),B={};for(var N in S)S.hasOwnProperty(N)&&(B[S[N]]=N);var E=dt.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 I in E)if(E.hasOwnProperty(I)){if(!("channels"in E[I]))throw new Error("missing channels property: "+I);if(!("labels"in E[I]))throw new Error("missing channel labels property: "+I);if(E[I].labels.length!==E[I].channels)throw new Error("channel and label counts mismatch: "+I);var A=E[I].channels,v=E[I].labels;delete E[I].channels,delete E[I].labels,Object.defineProperty(E[I],"channels",{value:A}),Object.defineProperty(E[I],"labels",{value:v})}E.rgb.hsl=function(c){var f=c[0]/255,l=c[1]/255,T=c[2]/255,m=Math.min(f,l,T),w=Math.max(f,l,T),O=w-m,D,g,_;return w===m?D=0:f===w?D=(l-T)/O:l===w?D=2+(T-f)/O:T===w&&(D=4+(f-l)/O),D=Math.min(D*60,360),D<0&&(D+=360),_=(m+w)/2,w===m?g=0:_<=.5?g=O/(w+m):g=O/(2-w-m),[D,g*100,_*100]},E.rgb.hsv=function(c){var f,l,T,m,w,O=c[0]/255,D=c[1]/255,g=c[2]/255,_=Math.max(O,D,g),Y=_-Math.min(O,D,g),V=function(z){return(_-z)/6/Y+1/2};return Y===0?m=w=0:(w=Y/_,f=V(O),l=V(D),T=V(g),O===_?m=T-l:D===_?m=1/3+f-T:g===_&&(m=2/3+l-f),m<0?m+=1:m>1&&(m-=1)),[m*360,w*100,_*100]},E.rgb.hwb=function(c){var f=c[0],l=c[1],T=c[2],m=E.rgb.hsl(c)[0],w=1/255*Math.min(f,Math.min(l,T));return T=1-1/255*Math.max(f,Math.max(l,T)),[m,w*100,T*100]},E.rgb.cmyk=function(c){var f=c[0]/255,l=c[1]/255,T=c[2]/255,m,w,O,D;return D=Math.min(1-f,1-l,1-T),m=(1-f-D)/(1-D)||0,w=(1-l-D)/(1-D)||0,O=(1-T-D)/(1-D)||0,[m*100,w*100,O*100,D*100]};function p(c,f){return Math.pow(c[0]-f[0],2)+Math.pow(c[1]-f[1],2)+Math.pow(c[2]-f[2],2)}E.rgb.keyword=function(c){var f=B[c];if(f)return f;var l=Infinity,T;for(var m in S)if(S.hasOwnProperty(m)){var w=S[m],O=p(c,w);O<l&&(l=O,T=m)}return T},E.keyword.rgb=function(c){return S[c]},E.rgb.xyz=function(c){var f=c[0]/255,l=c[1]/255,T=c[2]/255;f=f>.04045?Math.pow((f+.055)/1.055,2.4):f/12.92,l=l>.04045?Math.pow((l+.055)/1.055,2.4):l/12.92,T=T>.04045?Math.pow((T+.055)/1.055,2.4):T/12.92;var m=f*.4124+l*.3576+T*.1805,w=f*.2126+l*.7152+T*.0722,O=f*.0193+l*.1192+T*.9505;return[m*100,w*100,O*100]},E.rgb.lab=function(c){var f=E.rgb.xyz(c),l=f[0],T=f[1],m=f[2],w,O,D;return l/=95.047,T/=100,m/=108.883,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,T=T>.008856?Math.pow(T,1/3):7.787*T+16/116,m=m>.008856?Math.pow(m,1/3):7.787*m+16/116,w=116*T-16,O=500*(l-T),D=200*(T-m),[w,O,D]},E.hsl.rgb=function(c){var f=c[0]/360,l=c[1]/100,T=c[2]/100,m,w,O,D,g;if(l===0)return g=T*255,[g,g,g];T<.5?w=T*(1+l):w=T+l-T*l,m=2*T-w,D=[0,0,0];for(var _=0;_<3;_++)O=f+1/3*-(_-1),O<0&&O++,O>1&&O--,6*O<1?g=m+(w-m)*6*O:2*O<1?g=w:3*O<2?g=m+(w-m)*(2/3-O)*6:g=m,D[_]=g*255;return D},E.hsl.hsv=function(c){var f=c[0],l=c[1]/100,T=c[2]/100,m=l,w=Math.max(T,.01),O,D;return T*=2,l*=T<=1?T:2-T,m*=w<=1?w:2-w,D=(T+l)/2,O=T===0?2*m/(w+m):2*l/(T+l),[f,O*100,D*100]},E.hsv.rgb=function(c){var f=c[0]/60,l=c[1]/100,T=c[2]/100,m=Math.floor(f)%6,w=f-Math.floor(f),O=255*T*(1-l),D=255*T*(1-l*w),g=255*T*(1-l*(1-w));switch(T*=255,m){case 0:return[T,g,O];case 1:return[D,T,O];case 2:return[O,T,g];case 3:return[O,D,T];case 4:return[g,O,T];case 5:return[T,O,D]}},E.hsv.hsl=function(c){var f=c[0],l=c[1]/100,T=c[2]/100,m=Math.max(T,.01),w,O,D;return D=(2-l)*T,w=(2-l)*m,O=l*m,O/=w<=1?w:2-w,O=O||0,D/=2,[f,O*100,D*100]},E.hwb.rgb=function(c){var f=c[0]/360,l=c[1]/100,T=c[2]/100,m=l+T,w,O,D,g;m>1&&(l/=m,T/=m),w=Math.floor(6*f),O=1-T,D=6*f-w,(w&1)!=0&&(D=1-D),g=l+D*(O-l);var _,Y,V;switch(w){default:case 6:case 0:_=O,Y=g,V=l;break;case 1:_=g,Y=O,V=l;break;case 2:_=l,Y=O,V=g;break;case 3:_=l,Y=g,V=O;break;case 4:_=g,Y=l,V=O;break;case 5:_=O,Y=l,V=g;break}return[_*255,Y*255,V*255]},E.cmyk.rgb=function(c){var f=c[0]/100,l=c[1]/100,T=c[2]/100,m=c[3]/100,w,O,D;return w=1-Math.min(1,f*(1-m)+m),O=1-Math.min(1,l*(1-m)+m),D=1-Math.min(1,T*(1-m)+m),[w*255,O*255,D*255]},E.xyz.rgb=function(c){var f=c[0]/100,l=c[1]/100,T=c[2]/100,m,w,O;return m=f*3.2406+l*-1.5372+T*-.4986,w=f*-.9689+l*1.8758+T*.0415,O=f*.0557+l*-.204+T*1.057,m=m>.0031308?1.055*Math.pow(m,1/2.4)-.055:m*12.92,w=w>.0031308?1.055*Math.pow(w,1/2.4)-.055:w*12.92,O=O>.0031308?1.055*Math.pow(O,1/2.4)-.055:O*12.92,m=Math.min(Math.max(0,m),1),w=Math.min(Math.max(0,w),1),O=Math.min(Math.max(0,O),1),[m*255,w*255,O*255]},E.xyz.lab=function(c){var f=c[0],l=c[1],T=c[2],m,w,O;return f/=95.047,l/=100,T/=108.883,f=f>.008856?Math.pow(f,1/3):7.787*f+16/116,l=l>.008856?Math.pow(l,1/3):7.787*l+16/116,T=T>.008856?Math.pow(T,1/3):7.787*T+16/116,m=116*l-16,w=500*(f-l),O=200*(l-T),[m,w,O]},E.lab.xyz=function(c){var f=c[0],l=c[1],T=c[2],m,w,O;w=(f+16)/116,m=l/500+w,O=w-T/200;var D=Math.pow(w,3),g=Math.pow(m,3),_=Math.pow(O,3);return w=D>.008856?D:(w-16/116)/7.787,m=g>.008856?g:(m-16/116)/7.787,O=_>.008856?_:(O-16/116)/7.787,m*=95.047,w*=100,O*=108.883,[m,w,O]},E.lab.lch=function(c){var f=c[0],l=c[1],T=c[2],m,w,O;return m=Math.atan2(T,l),w=m*360/2/Math.PI,w<0&&(w+=360),O=Math.sqrt(l*l+T*T),[f,O,w]},E.lch.lab=function(c){var f=c[0],l=c[1],T=c[2],m,w,O;return O=T/360*2*Math.PI,m=l*Math.cos(O),w=l*Math.sin(O),[f,m,w]},E.rgb.ansi16=function(c){var f=c[0],l=c[1],T=c[2],m=1 in arguments?arguments[1]:E.rgb.hsv(c)[2];if(m=Math.round(m/50),m===0)return 30;var w=30+(Math.round(T/255)<<2|Math.round(l/255)<<1|Math.round(f/255));return m===2&&(w+=60),w},E.hsv.ansi16=function(c){return E.rgb.ansi16(E.hsv.rgb(c),c[2])},E.rgb.ansi256=function(c){var f=c[0],l=c[1],T=c[2];if(f===l&&l===T)return f<8?16:f>248?231:Math.round((f-8)/247*24)+232;var m=16+36*Math.round(f/255*5)+6*Math.round(l/255*5)+Math.round(T/255*5);return m},E.ansi16.rgb=function(c){var f=c%10;if(f===0||f===7)return c>50&&(f+=3.5),f=f/10.5*255,[f,f,f];var l=(~~(c>50)+1)*.5,T=(f&1)*l*255,m=(f>>1&1)*l*255,w=(f>>2&1)*l*255;return[T,m,w]},E.ansi256.rgb=function(c){if(c>=232){var f=(c-232)*10+8;return[f,f,f]}c-=16;var l,T=Math.floor(c/36)/5*255,m=Math.floor((l=c%36)/6)/5*255,w=l%6/5*255;return[T,m,w]},E.rgb.hex=function(c){var f=((Math.round(c[0])&255)<<16)+((Math.round(c[1])&255)<<8)+(Math.round(c[2])&255),l=f.toString(16).toUpperCase();return"000000".substring(l.length)+l},E.hex.rgb=function(c){var f=c.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!f)return[0,0,0];var l=f[0];f[0].length===3&&(l=l.split("").map(function(D){return D+D}).join(""));var T=parseInt(l,16),m=T>>16&255,w=T>>8&255,O=T&255;return[m,w,O]},E.rgb.hcg=function(c){var f=c[0]/255,l=c[1]/255,T=c[2]/255,m=Math.max(Math.max(f,l),T),w=Math.min(Math.min(f,l),T),O=m-w,D,g;return O<1?D=w/(1-O):D=0,O<=0?g=0:m===f?g=(l-T)/O%6:m===l?g=2+(T-f)/O:g=4+(f-l)/O+4,g/=6,g%=1,[g*360,O*100,D*100]},E.hsl.hcg=function(c){var f=c[1]/100,l=c[2]/100,T=1,m=0;return l<.5?T=2*f*l:T=2*f*(1-l),T<1&&(m=(l-.5*T)/(1-T)),[c[0],T*100,m*100]},E.hsv.hcg=function(c){var f=c[1]/100,l=c[2]/100,T=f*l,m=0;return T<1&&(m=(l-T)/(1-T)),[c[0],T*100,m*100]},E.hcg.rgb=function(c){var f=c[0]/360,l=c[1]/100,T=c[2]/100;if(l===0)return[T*255,T*255,T*255];var m=[0,0,0],w=f%1*6,O=w%1,D=1-O,g=0;switch(Math.floor(w)){case 0:m[0]=1,m[1]=O,m[2]=0;break;case 1:m[0]=D,m[1]=1,m[2]=0;break;case 2:m[0]=0,m[1]=1,m[2]=O;break;case 3:m[0]=0,m[1]=D,m[2]=1;break;case 4:m[0]=O,m[1]=0,m[2]=1;break;default:m[0]=1,m[1]=0,m[2]=D}return g=(1-l)*T,[(l*m[0]+g)*255,(l*m[1]+g)*255,(l*m[2]+g)*255]},E.hcg.hsv=function(c){var f=c[1]/100,l=c[2]/100,T=f+l*(1-f),m=0;return T>0&&(m=f/T),[c[0],m*100,T*100]},E.hcg.hsl=function(c){var f=c[1]/100,l=c[2]/100,T=l*(1-f)+.5*f,m=0;return T>0&&T<.5?m=f/(2*T):T>=.5&&T<1&&(m=f/(2*(1-T))),[c[0],m*100,T*100]},E.hcg.hwb=function(c){var f=c[1]/100,l=c[2]/100,T=f+l*(1-f);return[c[0],(T-f)*100,(1-T)*100]},E.hwb.hcg=function(c){var f=c[1]/100,l=c[2]/100,T=1-l,m=T-f,w=0;return m<1&&(w=(T-m)/(1-m)),[c[0],m*100,w*100]},E.apple.rgb=function(c){return[c[0]/65535*255,c[1]/65535*255,c[2]/65535*255]},E.rgb.apple=function(c){return[c[0]/255*65535,c[1]/255*65535,c[2]/255*65535]},E.gray.rgb=function(c){return[c[0]/100*255,c[0]/100*255,c[0]/100*255]},E.gray.hsl=E.gray.hsv=function(c){return[0,0,c[0]]},E.gray.hwb=function(c){return[0,100,c[0]]},E.gray.cmyk=function(c){return[0,0,0,c[0]]},E.gray.lab=function(c){return[c[0],0,0]},E.gray.hex=function(c){var f=Math.round(c[0]/100*255)&255,l=(f<<16)+(f<<8)+f,T=l.toString(16).toUpperCase();return"000000".substring(T.length)+T},E.rgb.gray=function(c){var f=(c[0]+c[1]+c[2])/3;return[f/255*100]}},12085:function(dt,x,M){var S=M(48168),B=M(4111),N={},E=Object.keys(S);function I(v){var p=function(c){return c==null?c:(arguments.length>1&&(c=Array.prototype.slice.call(arguments)),v(c))};return"conversion"in v&&(p.conversion=v.conversion),p}function A(v){var p=function(c){if(c==null)return c;arguments.length>1&&(c=Array.prototype.slice.call(arguments));var f=v(c);if(typeof f=="object")for(var l=f.length,T=0;T<l;T++)f[T]=Math.round(f[T]);return f};return"conversion"in v&&(p.conversion=v.conversion),p}E.forEach(function(v){N[v]={},Object.defineProperty(N[v],"channels",{value:S[v].channels}),Object.defineProperty(N[v],"labels",{value:S[v].labels});var p=B(v),c=Object.keys(p);c.forEach(function(f){var l=p[f];N[v][f]=A(l),N[v][f].raw=I(l)})}),dt.exports=N},39092:function(dt){"use strict";dt.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},4111:function(dt,x,M){var S=M(48168);function B(){for(var A={},v=Object.keys(S),p=v.length,c=0;c<p;c++)A[v[c]]={distance:-1,parent:null};return A}function N(A){var v=B(),p=[A];for(v[A].distance=0;p.length;)for(var c=p.pop(),f=Object.keys(S[c]),l=f.length,T=0;T<l;T++){var m=f[T],w=v[m];w.distance===-1&&(w.distance=v[c].distance+1,w.parent=c,p.unshift(m))}return v}function E(A,v){return function(p){return v(A(p))}}function I(A,v){for(var p=[v[A].parent,A],c=S[v[A].parent][A],f=v[A].parent;v[f].parent;)p.unshift(v[f].parent),c=E(S[v[f].parent][f],c),f=v[f].parent;return c.conversion=p,c}dt.exports=function(A){for(var v=N(A),p={},c=Object.keys(v),f=c.length,l=0;l<f;l++){var T=c[l],m=v[T];m.parent!==null&&(p[T]=I(T,v))}return p}},8874:function(dt){"use strict";dt.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},19818:function(dt,x,M){var S=M(8874),B=M(86851),N=Object.hasOwnProperty,E=Object.create(null);for(var I in S)N.call(S,I)&&(E[S[I]]=I);var A=dt.exports={to:{},get:{}};A.get=function(c){var f=c.substring(0,3).toLowerCase(),l,T;switch(f){case"hsl":l=A.get.hsl(c),T="hsl";break;case"hwb":l=A.get.hwb(c),T="hwb";break;default:l=A.get.rgb(c),T="rgb";break}return l?{model:T,value:l}:null},A.get.rgb=function(c){if(!c)return null;var f=/^#([a-f0-9]{3,4})$/i,l=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,T=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,m=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,w=/^(\w+)$/,O=[0,0,0,1],D,g,_;if(D=c.match(l)){for(_=D[2],D=D[1],g=0;g<3;g++){var Y=g*2;O[g]=parseInt(D.slice(Y,Y+2),16)}_&&(O[3]=parseInt(_,16)/255)}else if(D=c.match(f)){for(D=D[1],_=D[3],g=0;g<3;g++)O[g]=parseInt(D[g]+D[g],16);_&&(O[3]=parseInt(_+_,16)/255)}else if(D=c.match(T)){for(g=0;g<3;g++)O[g]=parseInt(D[g+1],0);D[4]&&(D[5]?O[3]=parseFloat(D[4])*.01:O[3]=parseFloat(D[4]))}else if(D=c.match(m)){for(g=0;g<3;g++)O[g]=Math.round(parseFloat(D[g+1])*2.55);D[4]&&(D[5]?O[3]=parseFloat(D[4])*.01:O[3]=parseFloat(D[4]))}else return(D=c.match(w))?D[1]==="transparent"?[0,0,0,0]:N.call(S,D[1])?(O=S[D[1]],O[3]=1,O):null:null;for(g=0;g<3;g++)O[g]=v(O[g],0,255);return O[3]=v(O[3],0,1),O},A.get.hsl=function(c){if(!c)return null;var f=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,l=c.match(f);if(l){var T=parseFloat(l[4]),m=(parseFloat(l[1])%360+360)%360,w=v(parseFloat(l[2]),0,100),O=v(parseFloat(l[3]),0,100),D=v(isNaN(T)?1:T,0,1);return[m,w,O,D]}return null},A.get.hwb=function(c){if(!c)return null;var f=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,l=c.match(f);if(l){var T=parseFloat(l[4]),m=(parseFloat(l[1])%360+360)%360,w=v(parseFloat(l[2]),0,100),O=v(parseFloat(l[3]),0,100),D=v(isNaN(T)?1:T,0,1);return[m,w,O,D]}return null},A.to.hex=function(){var c=B(arguments);return"#"+p(c[0])+p(c[1])+p(c[2])+(c[3]<1?p(Math.round(c[3]*255)):"")},A.to.rgb=function(){var c=B(arguments);return c.length<4||c[3]===1?"rgb("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+")":"rgba("+Math.round(c[0])+", "+Math.round(c[1])+", "+Math.round(c[2])+", "+c[3]+")"},A.to.rgb.percent=function(){var c=B(arguments),f=Math.round(c[0]/255*100),l=Math.round(c[1]/255*100),T=Math.round(c[2]/255*100);return c.length<4||c[3]===1?"rgb("+f+"%, "+l+"%, "+T+"%)":"rgba("+f+"%, "+l+"%, "+T+"%, "+c[3]+")"},A.to.hsl=function(){var c=B(arguments);return c.length<4||c[3]===1?"hsl("+c[0]+", "+c[1]+"%, "+c[2]+"%)":"hsla("+c[0]+", "+c[1]+"%, "+c[2]+"%, "+c[3]+")"},A.to.hwb=function(){var c=B(arguments),f="";return c.length>=4&&c[3]!==1&&(f=", "+c[3]),"hwb("+c[0]+", "+c[1]+"%, "+c[2]+"%"+f+")"},A.to.keyword=function(c){return E[c.slice(0,3)]};function v(c,f,l){return Math.min(Math.max(f,c),l)}function p(c){var f=Math.round(c).toString(16).toUpperCase();return f.length<2?"0"+f:f}},6767:function(dt,x,M){"use strict";var S=M(19818),B=M(12085),N=[].slice,E=["keyword","gray","hex"],I={};Object.keys(B).forEach(function(w){I[N.call(B[w].labels).sort().join("")]=w});var A={};function v(w,O){if(!(this instanceof v))return new v(w,O);if(O&&O in E&&(O=null),O&&!(O in B))throw new Error("Unknown model: "+O);var D,g;if(w==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(w instanceof v)this.model=w.model,this.color=w.color.slice(),this.valpha=w.valpha;else if(typeof w=="string"){var _=S.get(w);if(_===null)throw new Error("Unable to parse color from string: "+w);this.model=_.model,g=B[this.model].channels,this.color=_.value.slice(0,g),this.valpha=typeof _.value[g]=="number"?_.value[g]:1}else if(w.length){this.model=O||"rgb",g=B[this.model].channels;var Y=N.call(w,0,g);this.color=m(Y,g),this.valpha=typeof w[g]=="number"?w[g]: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 V=Object.keys(w);"alpha"in w&&(V.splice(V.indexOf("alpha"),1),this.valpha=typeof w.alpha=="number"?w.alpha:0);var z=V.sort().join("");if(!(z in I))throw new Error("Unable to parse color from object: "+JSON.stringify(w));this.model=I[z];var Z=B[this.model].labels,J=[];for(D=0;D<Z.length;D++)J.push(w[Z[D]]);this.color=m(J)}if(A[this.model])for(g=B[this.model].channels,D=0;D<g;D++){var ee=A[this.model][D];ee&&(this.color[D]=ee(this.color[D]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}v.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(w){var O=this.model in S.to?this:this.rgb();O=O.round(typeof w=="number"?w:1);var D=O.valpha===1?O.color:O.color.concat(this.valpha);return S.to[O.model](D)},percentString:function(w){var O=this.rgb().round(typeof w=="number"?w:1),D=O.valpha===1?O.color:O.color.concat(this.valpha);return S.to.rgb.percent(D)},array:function(){return this.valpha===1?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var w={},O=B[this.model].channels,D=B[this.model].labels,g=0;g<O;g++)w[D[g]]=this.color[g];return this.valpha!==1&&(w.alpha=this.valpha),w},unitArray:function(){var w=this.rgb().color;return w[0]/=255,w[1]/=255,w[2]/=255,this.valpha!==1&&w.push(this.valpha),w},unitObject:function(){var w=this.rgb().object();return w.r/=255,w.g/=255,w.b/=255,this.valpha!==1&&(w.alpha=this.valpha),w},round:function(w){return w=Math.max(w||0,0),new v(this.color.map(c(w)).concat(this.valpha),this.model)},alpha:function(w){return arguments.length?new v(this.color.concat(Math.max(0,Math.min(1,w))),this.model):this.valpha},red:f("rgb",0,l(255)),green:f("rgb",1,l(255)),blue:f("rgb",2,l(255)),hue:f(["hsl","hsv","hsl","hwb","hcg"],0,function(w){return(w%360+360)%360}),saturationl:f("hsl",1,l(100)),lightness:f("hsl",2,l(100)),saturationv:f("hsv",1,l(100)),value:f("hsv",2,l(100)),chroma:f("hcg",1,l(100)),gray:f("hcg",2,l(100)),white:f("hwb",1,l(100)),wblack:f("hwb",2,l(100)),cyan:f("cmyk",0,l(100)),magenta:f("cmyk",1,l(100)),yellow:f("cmyk",2,l(100)),black:f("cmyk",3,l(100)),x:f("xyz",0,l(100)),y:f("xyz",1,l(100)),z:f("xyz",2,l(100)),l:f("lab",0,l(100)),a:f("lab",1),b:f("lab",2),keyword:function(w){return arguments.length?new v(w):B[this.model].keyword(this.color)},hex:function(w){return arguments.length?new v(w):S.to.hex(this.rgb().round().color)},rgbNumber:function(){var w=this.rgb().color;return(w[0]&255)<<16|(w[1]&255)<<8|w[2]&255},luminosity:function(){for(var w=this.rgb().color,O=[],D=0;D<w.length;D++){var g=w[D]/255;O[D]=g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4)}return .2126*O[0]+.7152*O[1]+.0722*O[2]},contrast:function(w){var O=this.luminosity(),D=w.luminosity();return O>D?(O+.05)/(D+.05):(D+.05)/(O+.05)},level:function(w){var O=this.contrast(w);return O>=7.1?"AAA":O>=4.5?"AA":""},isDark:function(){var w=this.rgb().color,O=(w[0]*299+w[1]*587+w[2]*114)/1e3;return O<128},isLight:function(){return!this.isDark()},negate:function(){for(var w=this.rgb(),O=0;O<3;O++)w.color[O]=255-w.color[O];return w},lighten:function(w){var O=this.hsl();return O.color[2]+=O.color[2]*w,O},darken:function(w){var O=this.hsl();return O.color[2]-=O.color[2]*w,O},saturate:function(w){var O=this.hsl();return O.color[1]+=O.color[1]*w,O},desaturate:function(w){var O=this.hsl();return O.color[1]-=O.color[1]*w,O},whiten:function(w){var O=this.hwb();return O.color[1]+=O.color[1]*w,O},blacken:function(w){var O=this.hwb();return O.color[2]+=O.color[2]*w,O},grayscale:function(){var w=this.rgb().color,O=w[0]*.3+w[1]*.59+w[2]*.11;return v.rgb(O,O,O)},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 O=this.hsl(),D=O.color[0];return D=(D+w)%360,D=D<0?360+D:D,O.color[0]=D,O},mix:function(w,O){if(!w||!w.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof w);var D=w.rgb(),g=this.rgb(),_=O===void 0?.5:O,Y=2*_-1,V=D.alpha()-g.alpha(),z=((Y*V==-1?Y:(Y+V)/(1+Y*V))+1)/2,Z=1-z;return v.rgb(z*D.red()+Z*g.red(),z*D.green()+Z*g.green(),z*D.blue()+Z*g.blue(),D.alpha()*_+g.alpha()*(1-_))}},Object.keys(B).forEach(function(w){if(E.indexOf(w)===-1){var O=B[w].channels;v.prototype[w]=function(){if(this.model===w)return new v(this);if(arguments.length)return new v(arguments,w);var D=typeof arguments[O]=="number"?O:this.valpha;return new v(T(B[this.model][w].raw(this.color)).concat(D),w)},v[w]=function(D){return typeof D=="number"&&(D=m(N.call(arguments),O)),new v(D,w)}}});function p(w,O){return Number(w.toFixed(O))}function c(w){return function(O){return p(O,w)}}function f(w,O,D){return w=Array.isArray(w)?w:[w],w.forEach(function(g){(A[g]||(A[g]=[]))[O]=D}),w=w[0],function(g){var _;return arguments.length?(D&&(g=D(g)),_=this[w](),_.color[O]=g,_):(_=this[w]().color[O],D&&(_=D(_)),_)}}function l(w){return function(O){return Math.max(0,Math.min(w,O))}}function T(w){return Array.isArray(w)?w:[w]}function m(w,O){for(var D=0;D<O;D++)typeof w[D]!="number"&&(w[D]=0);return w}dt.exports=v},71829:function(dt,x,M){"use strict";M.r(x),M.d(x,{quadtree:function(){return S.Z}});var S=M(28833)},28833:function(dt,x,M){"use strict";M.d(x,{Z:function(){return Y}});function S(J){const ee=+this._x.call(null,J),Q=+this._y.call(null,J);return B(this.cover(ee,Q),ee,Q,J)}function B(J,ee,Q,re){if(isNaN(ee)||isNaN(Q))return J;var fe,me=J._root,ae={data:re},Ee=J._x0,Le=J._y0,De=J._x1,Ve=J._y1,et,It,er,nr,Fe,Vt,$t,Ar;if(!me)return J._root=ae,J;for(;me.length;)if((Fe=ee>=(et=(Ee+De)/2))?Ee=et:De=et,(Vt=Q>=(It=(Le+Ve)/2))?Le=It:Ve=It,fe=me,!(me=me[$t=Vt<<1|Fe]))return fe[$t]=ae,J;if(er=+J._x.call(null,me.data),nr=+J._y.call(null,me.data),ee===er&&Q===nr)return ae.next=me,fe?fe[$t]=ae:J._root=ae,J;do fe=fe?fe[$t]=new Array(4):J._root=new Array(4),(Fe=ee>=(et=(Ee+De)/2))?Ee=et:De=et,(Vt=Q>=(It=(Le+Ve)/2))?Le=It:Ve=It;while(($t=Vt<<1|Fe)==(Ar=(nr>=It)<<1|er>=et));return fe[Ar]=me,fe[$t]=ae,J}function N(J){var ee,Q,re=J.length,fe,me,ae=new Array(re),Ee=new Array(re),Le=Infinity,De=Infinity,Ve=-Infinity,et=-Infinity;for(Q=0;Q<re;++Q)isNaN(fe=+this._x.call(null,ee=J[Q]))||isNaN(me=+this._y.call(null,ee))||(ae[Q]=fe,Ee[Q]=me,fe<Le&&(Le=fe),fe>Ve&&(Ve=fe),me<De&&(De=me),me>et&&(et=me));if(Le>Ve||De>et)return this;for(this.cover(Le,De).cover(Ve,et),Q=0;Q<re;++Q)B(this,ae[Q],Ee[Q],J[Q]);return this}function E(J,ee){if(isNaN(J=+J)||isNaN(ee=+ee))return this;var Q=this._x0,re=this._y0,fe=this._x1,me=this._y1;if(isNaN(Q))fe=(Q=Math.floor(J))+1,me=(re=Math.floor(ee))+1;else{for(var ae=fe-Q||1,Ee=this._root,Le,De;Q>J||J>=fe||re>ee||ee>=me;)switch(De=(ee<re)<<1|J<Q,Le=new Array(4),Le[De]=Ee,Ee=Le,ae*=2,De){case 0:fe=Q+ae,me=re+ae;break;case 1:Q=fe-ae,me=re+ae;break;case 2:fe=Q+ae,re=me-ae;break;case 3:Q=fe-ae,re=me-ae;break}this._root&&this._root.length&&(this._root=Ee)}return this._x0=Q,this._y0=re,this._x1=fe,this._y1=me,this}function I(){var J=[];return this.visit(function(ee){if(!ee.length)do J.push(ee.data);while(ee=ee.next)}),J}function A(J){return arguments.length?this.cover(+J[0][0],+J[0][1]).cover(+J[1][0],+J[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function v(J,ee,Q,re,fe){this.node=J,this.x0=ee,this.y0=Q,this.x1=re,this.y1=fe}function p(J,ee,Q){var re,fe=this._x0,me=this._y0,ae,Ee,Le,De,Ve=this._x1,et=this._y1,It=[],er=this._root,nr,Fe;for(er&&It.push(new v(er,fe,me,Ve,et)),Q==null?Q=Infinity:(fe=J-Q,me=ee-Q,Ve=J+Q,et=ee+Q,Q*=Q);nr=It.pop();)if(!(!(er=nr.node)||(ae=nr.x0)>Ve||(Ee=nr.y0)>et||(Le=nr.x1)<fe||(De=nr.y1)<me))if(er.length){var Vt=(ae+Le)/2,$t=(Ee+De)/2;It.push(new v(er[3],Vt,$t,Le,De),new v(er[2],ae,$t,Vt,De),new v(er[1],Vt,Ee,Le,$t),new v(er[0],ae,Ee,Vt,$t)),(Fe=(ee>=$t)<<1|J>=Vt)&&(nr=It[It.length-1],It[It.length-1]=It[It.length-1-Fe],It[It.length-1-Fe]=nr)}else{var Ar=J-+this._x.call(null,er.data),ke=ee-+this._y.call(null,er.data),Oe=Ar*Ar+ke*ke;if(Oe<Q){var we=Math.sqrt(Q=Oe);fe=J-we,me=ee-we,Ve=J+we,et=ee+we,re=er.data}}return re}function c(J){if(isNaN(Ve=+this._x.call(null,J))||isNaN(et=+this._y.call(null,J)))return this;var ee,Q=this._root,re,fe,me,ae=this._x0,Ee=this._y0,Le=this._x1,De=this._y1,Ve,et,It,er,nr,Fe,Vt,$t;if(!Q)return this;if(Q.length)for(;;){if((nr=Ve>=(It=(ae+Le)/2))?ae=It:Le=It,(Fe=et>=(er=(Ee+De)/2))?Ee=er:De=er,ee=Q,!(Q=Q[Vt=Fe<<1|nr]))return this;if(!Q.length)break;(ee[Vt+1&3]||ee[Vt+2&3]||ee[Vt+3&3])&&(re=ee,$t=Vt)}for(;Q.data!==J;)if(fe=Q,!(Q=Q.next))return this;return(me=Q.next)&&delete Q.next,fe?(me?fe.next=me:delete fe.next,this):ee?(me?ee[Vt]=me:delete ee[Vt],(Q=ee[0]||ee[1]||ee[2]||ee[3])&&Q===(ee[3]||ee[2]||ee[1]||ee[0])&&!Q.length&&(re?re[$t]=Q:this._root=Q),this):(this._root=me,this)}function f(J){for(var ee=0,Q=J.length;ee<Q;++ee)this.remove(J[ee]);return this}function l(){return this._root}function T(){var J=0;return this.visit(function(ee){if(!ee.length)do++J;while(ee=ee.next)}),J}function m(J){var ee=[],Q,re=this._root,fe,me,ae,Ee,Le;for(re&&ee.push(new v(re,this._x0,this._y0,this._x1,this._y1));Q=ee.pop();)if(!J(re=Q.node,me=Q.x0,ae=Q.y0,Ee=Q.x1,Le=Q.y1)&&re.length){var De=(me+Ee)/2,Ve=(ae+Le)/2;(fe=re[3])&&ee.push(new v(fe,De,Ve,Ee,Le)),(fe=re[2])&&ee.push(new v(fe,me,Ve,De,Le)),(fe=re[1])&&ee.push(new v(fe,De,ae,Ee,Ve)),(fe=re[0])&&ee.push(new v(fe,me,ae,De,Ve))}return this}function w(J){var ee=[],Q=[],re;for(this._root&&ee.push(new v(this._root,this._x0,this._y0,this._x1,this._y1));re=ee.pop();){var fe=re.node;if(fe.length){var me,ae=re.x0,Ee=re.y0,Le=re.x1,De=re.y1,Ve=(ae+Le)/2,et=(Ee+De)/2;(me=fe[0])&&ee.push(new v(me,ae,Ee,Ve,et)),(me=fe[1])&&ee.push(new v(me,Ve,Ee,Le,et)),(me=fe[2])&&ee.push(new v(me,ae,et,Ve,De)),(me=fe[3])&&ee.push(new v(me,Ve,et,Le,De))}Q.push(re)}for(;re=Q.pop();)J(re.node,re.x0,re.y0,re.x1,re.y1);return this}function O(J){return J[0]}function D(J){return arguments.length?(this._x=J,this):this._x}function g(J){return J[1]}function _(J){return arguments.length?(this._y=J,this):this._y}function Y(J,ee,Q){var re=new V(ee==null?O:ee,Q==null?g:Q,NaN,NaN,NaN,NaN);return J==null?re:re.addAll(J)}function V(J,ee,Q,re,fe,me){this._x=J,this._y=ee,this._x0=Q,this._y0=re,this._x1=fe,this._y1=me,this._root=void 0}function z(J){for(var ee={data:J.data},Q=ee;J=J.next;)Q=Q.next={data:J.data};return ee}var Z=Y.prototype=V.prototype;Z.copy=function(){var J=new V(this._x,this._y,this._x0,this._y0,this._x1,this._y1),ee=this._root,Q,re;if(!ee)return J;if(!ee.length)return J._root=z(ee),J;for(Q=[{source:ee,target:J._root=new Array(4)}];ee=Q.pop();)for(var fe=0;fe<4;++fe)(re=ee.source[fe])&&(re.length?Q.push({source:re,target:ee.target[fe]=new Array(4)}):ee.target[fe]=z(re));return J},Z.add=S,Z.addAll=N,Z.cover=E,Z.data=I,Z.extent=A,Z.find=p,Z.remove=c,Z.removeAll=f,Z.root=l,Z.size=T,Z.visit=m,Z.visitAfter=w,Z.x=D,Z.y=_},31969:function(dt,x,M){"use strict";M.r(x),M.d(x,{BRIDGE_GRAPH_NAME:function(){return I},GraphType:function(){return p},HierarchyNodeType:function(){return c},InclusionType:function(){return v},LAYOUT_CONFIG:function(){return S},NodeType:function(){return A},ROOT_NAME:function(){return E},buildGraph:function(){return _r},flatGraph:function(){return Wr},getEdges:function(){return Zr},mergeConfig:function(){return B}});const S={graph:{meta:{rankDir:"TB",nodeSep:50,rankSep:50,edgeSep:5,align:void 0}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};function B(u={},P=S){var W,$,oe,ue;const pe=JSON.parse(JSON.stringify(P)),_e=((W=u==null?void 0:u.graph)===null||W===void 0?void 0:W.meta)||{},Te=(($=u==null?void 0:u.subScene)===null||$===void 0?void 0:$.meta)||{},Re=((oe=u==null?void 0:u.nodeSize)===null||oe===void 0?void 0:oe.meta)||{},Ze=((ue=u==null?void 0:u.nodeSize)===null||ue===void 0?void 0:ue.node)||{},je=pe.nodeSize.bridge;return{graph:{meta:Object.assign(pe.graph.meta,_e)},subScene:{meta:Object.assign(pe.subScene.meta,Te)},nodeSize:{meta:Object.assign(pe.nodeSize.meta,Re),node:Object.assign(pe.nodeSize.node,Ze),bridge:je}}}function N(u){return`\u25EC${u}\u25EC`}const E=N("ROOT"),I=N("BRIDGE_GRAPH");var A,v,p,c;(function(u){u[u.META=0]="META",u[u.NODE=1]="NODE",u[u.BRIDGE=2]="BRIDGE"})(A||(A={})),function(u){u[u.INCLUDE=0]="INCLUDE",u[u.EXCLUDE=1]="EXCLUDE",u[u.UNSPECIFIED=2]="UNSPECIFIED"}(v||(v={})),function(u){u[u.META=0]="META",u[u.CORE=1]="CORE",u[u.BRIDGE=2]="BRIDGE"}(p||(p={})),function(u){u[u.META=0]="META",u[u.OP=1]="OP",u[u.SERIES=2]="SERIES"}(c||(c={}));var f=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof M.g!="undefined"?M.g:typeof self!="undefined"?self:{};function l(u,P){return u(P={exports:{}},P.exports),P.exports}var T=function(){this.__data__=[],this.size=0},m=function(u,P){return u===P||u!=u&&P!=P},w=function(u,P){for(var W=u.length;W--;)if(m(u[W][0],P))return W;return-1},O=Array.prototype.splice,D=function(u){var P=this.__data__,W=w(P,u);return!(W<0)&&(W==P.length-1?P.pop():O.call(P,W,1),--this.size,!0)},g=function(u){var P=this.__data__,W=w(P,u);return W<0?void 0:P[W][1]},_=function(u){return w(this.__data__,u)>-1},Y=function(u,P){var W=this.__data__,$=w(W,u);return $<0?(++this.size,W.push([u,P])):W[$][1]=P,this};function V(u){var P=-1,W=u==null?0:u.length;for(this.clear();++P<W;){var $=u[P];this.set($[0],$[1])}}V.prototype.clear=T,V.prototype.delete=D,V.prototype.get=g,V.prototype.has=_,V.prototype.set=Y;var z=V,Z=function(){this.__data__=new z,this.size=0},J=function(u){var P=this.__data__,W=P.delete(u);return this.size=P.size,W},ee=function(u){return this.__data__.get(u)},Q=function(u){return this.__data__.has(u)},re=typeof f=="object"&&f&&f.Object===Object&&f,fe=typeof self=="object"&&self&&self.Object===Object&&self,me=re||fe||Function("return this")(),ae=me.Symbol,Ee=Object.prototype,Le=Ee.hasOwnProperty,De=Ee.toString,Ve=ae?ae.toStringTag:void 0,et=function(u){var P=Le.call(u,Ve),W=u[Ve];try{u[Ve]=void 0;var $=!0}catch(ue){}var oe=De.call(u);return $&&(P?u[Ve]=W:delete u[Ve]),oe},It=Object.prototype.toString,er=function(u){return It.call(u)},nr=ae?ae.toStringTag:void 0,Fe=function(u){return u==null?u===void 0?"[object Undefined]":"[object Null]":nr&&nr in Object(u)?et(u):er(u)},Vt=function(u){var P=typeof u;return u!=null&&(P=="object"||P=="function")},$t,Ar=function(u){if(!Vt(u))return!1;var P=Fe(u);return P=="[object Function]"||P=="[object GeneratorFunction]"||P=="[object AsyncFunction]"||P=="[object Proxy]"},ke=me["__core-js_shared__"],Oe=($t=/[^.]+$/.exec(ke&&ke.keys&&ke.keys.IE_PROTO||""))?"Symbol(src)_1."+$t:"",we=function(u){return!!Oe&&Oe in u},Be=Function.prototype.toString,We=function(u){if(u!=null){try{return Be.call(u)}catch(P){}try{return u+""}catch(P){}}return""},He=/^\[object .+?Constructor\]$/,St=Function.prototype,Mt=Object.prototype,sr=St.toString,Ge=Mt.hasOwnProperty,ut=RegExp("^"+sr.call(Ge).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),U=function(u){return!(!Vt(u)||we(u))&&(Ar(u)?ut:He).test(We(u))},he=function(u,P){return u==null?void 0:u[P]},Qe=function(u,P){var W=he(u,P);return U(W)?W:void 0},le=Qe(me,"Map"),ct=Qe(Object,"create"),ft=function(){this.__data__=ct?ct(null):{},this.size=0},jt=function(u){var P=this.has(u)&&delete this.__data__[u];return this.size-=P?1:0,P},Lt=Object.prototype.hasOwnProperty,Ht=function(u){var P=this.__data__;if(ct){var W=P[u];return W==="__lodash_hash_undefined__"?void 0:W}return Lt.call(P,u)?P[u]:void 0},vr=Object.prototype.hasOwnProperty,rt=function(u){var P=this.__data__;return ct?P[u]!==void 0:vr.call(P,u)},at=function(u,P){var W=this.__data__;return this.size+=this.has(u)?0:1,W[u]=ct&&P===void 0?"__lodash_hash_undefined__":P,this};function Pt(u){var P=-1,W=u==null?0:u.length;for(this.clear();++P<W;){var $=u[P];this.set($[0],$[1])}}Pt.prototype.clear=ft,Pt.prototype.delete=jt,Pt.prototype.get=Ht,Pt.prototype.has=rt,Pt.prototype.set=at;var gt=Pt,Dt=function(){this.size=0,this.__data__={hash:new gt,map:new(le||z),string:new gt}},ir=function(u){var P=typeof u;return P=="string"||P=="number"||P=="symbol"||P=="boolean"?u!=="__proto__":u===null},At=function(u,P){var W=u.__data__;return ir(P)?W[typeof P=="string"?"string":"hash"]:W.map},xr=function(u){var P=At(this,u).delete(u);return this.size-=P?1:0,P},Pr=function(u){return At(this,u).get(u)},Qr=function(u){return At(this,u).has(u)},Vr=function(u,P){var W=At(this,u),$=W.size;return W.set(u,P),this.size+=W.size==$?0:1,this};function nn(u){var P=-1,W=u==null?0:u.length;for(this.clear();++P<W;){var $=u[P];this.set($[0],$[1])}}nn.prototype.clear=Dt,nn.prototype.delete=xr,nn.prototype.get=Pr,nn.prototype.has=Qr,nn.prototype.set=Vr;var dn=nn,Vn=function(u,P){var W=this.__data__;if(W instanceof z){var $=W.__data__;if(!le||$.length<199)return $.push([u,P]),this.size=++W.size,this;W=this.__data__=new dn($)}return W.set(u,P),this.size=W.size,this};function cn(u){var P=this.__data__=new z(u);this.size=P.size}cn.prototype.clear=Z,cn.prototype.delete=J,cn.prototype.get=ee,cn.prototype.has=Q,cn.prototype.set=Vn;var wn=cn,xn=function(u,P){for(var W=-1,$=u==null?0:u.length;++W<$&&P(u[W],W,u)!==!1;);return u},gn=function(){try{var u=Qe(Object,"defineProperty");return u({},"",{}),u}catch(P){}}(),Un=function(u,P,W){P=="__proto__"&&gn?gn(u,P,{configurable:!0,enumerable:!0,value:W,writable:!0}):u[P]=W},bt=Object.prototype.hasOwnProperty,Mn=function(u,P,W){var $=u[P];bt.call(u,P)&&m($,W)&&(W!==void 0||P in u)||Un(u,P,W)},be=function(u,P,W,$){var oe=!W;W||(W={});for(var ue=-1,pe=P.length;++ue<pe;){var _e=P[ue],Te=$?$(W[_e],u[_e],_e,W,u):void 0;Te===void 0&&(Te=u[_e]),oe?Un(W,_e,Te):Mn(W,_e,Te)}return W},Se=function(u,P){for(var W=-1,$=Array(u);++W<u;)$[W]=P(W);return $},j=function(u){return u!=null&&typeof u=="object"},R=function(u){return j(u)&&Fe(u)=="[object Arguments]"},k=Object.prototype,te=k.hasOwnProperty,Me=k.propertyIsEnumerable,Ne=R(function(){return arguments}())?R:function(u){return j(u)&&te.call(u,"callee")&&!Me.call(u,"callee")},Pe=Array.isArray,Ke=function(){return!1},Ut=l(function(u,P){var W=P&&!P.nodeType&&P,$=W&&u&&!u.nodeType&&u,oe=$&&$.exports===W?me.Buffer:void 0,ue=(oe?oe.isBuffer:void 0)||Ke;u.exports=ue}),Rt=/^(?:0|[1-9]\d*)$/,fr=function(u,P){var W=typeof u;return!!(P=P==null?9007199254740991:P)&&(W=="number"||W!="symbol"&&Rt.test(u))&&u>-1&&u%1==0&&u<P},kr=function(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=9007199254740991},ur={};ur["[object Float32Array]"]=ur["[object Float64Array]"]=ur["[object Int8Array]"]=ur["[object Int16Array]"]=ur["[object Int32Array]"]=ur["[object Uint8Array]"]=ur["[object Uint8ClampedArray]"]=ur["[object Uint16Array]"]=ur["[object Uint32Array]"]=!0,ur["[object Arguments]"]=ur["[object Array]"]=ur["[object ArrayBuffer]"]=ur["[object Boolean]"]=ur["[object DataView]"]=ur["[object Date]"]=ur["[object Error]"]=ur["[object Function]"]=ur["[object Map]"]=ur["[object Number]"]=ur["[object Object]"]=ur["[object RegExp]"]=ur["[object Set]"]=ur["[object String]"]=ur["[object WeakMap]"]=!1;var rn=function(u){return j(u)&&kr(u.length)&&!!ur[Fe(u)]},On=function(u){return function(P){return u(P)}},ne=l(function(u,P){var W=P&&!P.nodeType&&P,$=W&&u&&!u.nodeType&&u,oe=$&&$.exports===W&&re.process,ue=function(){try{var pe=$&&$.require&&$.require("util").types;return pe||oe&&oe.binding&&oe.binding("util")}catch(_e){}}();u.exports=ue}),ye=ne&&ne.isTypedArray,Je=ye?On(ye):rn,Ct=Object.prototype.hasOwnProperty,Nt=function(u,P){var W=Pe(u),$=!W&&Ne(u),oe=!W&&!$&&Ut(u),ue=!W&&!$&&!oe&&Je(u),pe=W||$||oe||ue,_e=pe?Se(u.length,String):[],Te=_e.length;for(var Re in u)!P&&!Ct.call(u,Re)||pe&&(Re=="length"||oe&&(Re=="offset"||Re=="parent")||ue&&(Re=="buffer"||Re=="byteLength"||Re=="byteOffset")||fr(Re,Te))||_e.push(Re);return _e},mr=Object.prototype,lr=function(u){var P=u&&u.constructor;return u===(typeof P=="function"&&P.prototype||mr)},dr=function(u,P){return function(W){return u(P(W))}},yr=dr(Object.keys,Object),Gr=Object.prototype.hasOwnProperty,Jr=function(u){if(!lr(u))return yr(u);var P=[];for(var W in Object(u))Gr.call(u,W)&&W!="constructor"&&P.push(W);return P},Sr=function(u){return u!=null&&kr(u.length)&&!Ar(u)},lt=function(u){return Sr(u)?Nt(u):Jr(u)},Ae=function(u,P){return u&&be(P,lt(P),u)},Ye=function(u){var P=[];if(u!=null)for(var W in Object(u))P.push(W);return P},Tt=Object.prototype.hasOwnProperty,pt=function(u){if(!Vt(u))return Ye(u);var P=lr(u),W=[];for(var $ in u)($!="constructor"||!P&&Tt.call(u,$))&&W.push($);return W},kt=function(u){return Sr(u)?Nt(u,!0):pt(u)},ar=function(u,P){return u&&be(P,kt(P),u)},jr=l(function(u,P){var W=P&&!P.nodeType&&P,$=W&&u&&!u.nodeType&&u,oe=$&&$.exports===W?me.Buffer:void 0,ue=oe?oe.allocUnsafe:void 0;u.exports=function(pe,_e){if(_e)return pe.slice();var Te=pe.length,Re=ue?ue(Te):new pe.constructor(Te);return pe.copy(Re),Re}}),tn=function(u,P){var W=-1,$=u.length;for(P||(P=Array($));++W<$;)P[W]=u[W];return P},Ln=function(u,P){for(var W=-1,$=u==null?0:u.length,oe=0,ue=[];++W<$;){var pe=u[W];P(pe,W,u)&&(ue[oe++]=pe)}return ue},Dn=function(){return[]},$n=Object.prototype.propertyIsEnumerable,ci=Object.getOwnPropertySymbols,Ii=ci?function(u){return u==null?[]:(u=Object(u),Ln(ci(u),function(P){return $n.call(u,P)}))}:Dn,ki=function(u,P){return be(u,Ii(u),P)},zi=function(u,P){for(var W=-1,$=P.length,oe=u.length;++W<$;)u[oe+W]=P[W];return u},Hn=dr(Object.getPrototypeOf,Object),Mo=Object.getOwnPropertySymbols?function(u){for(var P=[];u;)zi(P,Ii(u)),u=Hn(u);return P}:Dn,Ia=function(u,P){return be(u,Mo(u),P)},vi=function(u,P,W){var $=P(u);return Pe(u)?$:zi($,W(u))},Ya=function(u){return vi(u,lt,Ii)},no=function(u){return vi(u,kt,Mo)},Co=Qe(me,"DataView"),ho=Qe(me,"Promise"),Ea=Qe(me,"Set"),gs=Qe(me,"WeakMap"),_u=We(Co),_a=We(le),$o=We(ho),Ti=We(Ea),Qo=We(gs),vo=Fe;(Co&&vo(new Co(new ArrayBuffer(1)))!="[object DataView]"||le&&vo(new le)!="[object Map]"||ho&&vo(ho.resolve())!="[object Promise]"||Ea&&vo(new Ea)!="[object Set]"||gs&&vo(new gs)!="[object WeakMap]")&&(vo=function(u){var P=Fe(u),W=P=="[object Object]"?u.constructor:void 0,$=W?We(W):"";if($)switch($){case _u:return"[object DataView]";case _a:return"[object Map]";case $o:return"[object Promise]";case Ti:return"[object Set]";case Qo:return"[object WeakMap]"}return P});var In=vo,Bs=Object.prototype.hasOwnProperty,ru=function(u){var P=u.length,W=new u.constructor(P);return P&&typeof u[0]=="string"&&Bs.call(u,"index")&&(W.index=u.index,W.input=u.input),W},ys=me.Uint8Array,Nn=function(u){var P=new u.constructor(u.byteLength);return new ys(P).set(new ys(u)),P},Do=function(u,P){var W=P?Nn(u.buffer):u.buffer;return new u.constructor(W,u.byteOffset,u.byteLength)},Qu=/\w*$/,ua=function(u){var P=new u.constructor(u.source,Qu.exec(u));return P.lastIndex=u.lastIndex,P},Jo=ae?ae.prototype:void 0,Gs=Jo?Jo.valueOf:void 0,Za=function(u){return Gs?Object(Gs.call(u)):{}},ms=function(u,P){var W=P?Nn(u.buffer):u.buffer;return new u.constructor(W,u.byteOffset,u.length)},bs=function(u,P,W){var $=u.constructor;switch(P){case"[object ArrayBuffer]":return Nn(u);case"[object Boolean]":case"[object Date]":return new $(+u);case"[object DataView]":return Do(u,W);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ms(u,W);case"[object Map]":return new $;case"[object Number]":case"[object String]":return new $(u);case"[object RegExp]":return ua(u);case"[object Set]":return new $;case"[object Symbol]":return Za(u)}},xa=Object.create,Pa=function(){function u(){}return function(P){if(!Vt(P))return{};if(xa)return xa(P);u.prototype=P;var W=new u;return u.prototype=void 0,W}}(),qo=function(u){return typeof u.constructor!="function"||lr(u)?{}:Pa(Hn(u))},eo=function(u){return j(u)&&In(u)=="[object Map]"},es=ne&&ne.isMap,ts=es?On(es):eo,nu=function(u){return j(u)&&In(u)=="[object Set]"},To=ne&&ne.isSet,Es=To?On(To):nu,pi={};pi["[object Arguments]"]=pi["[object Array]"]=pi["[object ArrayBuffer]"]=pi["[object DataView]"]=pi["[object Boolean]"]=pi["[object Date]"]=pi["[object Float32Array]"]=pi["[object Float64Array]"]=pi["[object Int8Array]"]=pi["[object Int16Array]"]=pi["[object Int32Array]"]=pi["[object Map]"]=pi["[object Number]"]=pi["[object Object]"]=pi["[object RegExp]"]=pi["[object Set]"]=pi["[object String]"]=pi["[object Symbol]"]=pi["[object Uint8Array]"]=pi["[object Uint8ClampedArray]"]=pi["[object Uint16Array]"]=pi["[object Uint32Array]"]=!0,pi["[object Error]"]=pi["[object Function]"]=pi["[object WeakMap]"]=!1;var Fs=function u(P,W,$,oe,ue,pe){var _e,Te=1&W,Re=2&W,Ze=4&W;if($&&(_e=ue?$(P,oe,ue,pe):$(P)),_e!==void 0)return _e;if(!Vt(P))return P;var je=Pe(P);if(je){if(_e=ru(P),!Te)return tn(P,_e)}else{var ht=In(P),zt=ht=="[object Function]"||ht=="[object GeneratorFunction]";if(Ut(P))return jr(P,Te);if(ht=="[object Object]"||ht=="[object Arguments]"||zt&&!ue){if(_e=Re||zt?{}:qo(P),!Te)return Re?Ia(P,ar(_e,P)):ki(P,Ae(_e,P))}else{if(!pi[ht])return ue?P:{};_e=bs(P,ht,Te)}}pe||(pe=new wn);var wr=pe.get(P);if(wr)return wr;pe.set(P,_e),Es(P)?P.forEach(function(qt){_e.add(u(qt,W,$,qt,P,pe))}):ts(P)&&P.forEach(function(qt,Qt){_e.set(Qt,u(qt,W,$,Qt,P,pe))});var Kt=je?void 0:(Ze?Re?no:Ya:Re?kt:lt)(P);return xn(Kt||P,function(qt,Qt){Kt&&(qt=P[Qt=qt]),Mn(_e,Qt,u(qt,W,$,Qt,P,pe))}),_e},iu=function(u){return Fs(u,4)},Ha=function(u){return function(){return u}},au=function(u){return function(P,W,$){for(var oe=-1,ue=Object(P),pe=$(P),_e=pe.length;_e--;){var Te=pe[u?_e:++oe];if(W(ue[Te],Te,ue)===!1)break}return P}}(),po=function(u,P){return u&&au(u,P,lt)},ca=function(u,P){return function(W,$){if(W==null)return W;if(!Sr(W))return u(W,$);for(var oe=W.length,ue=P?oe:-1,pe=Object(W);(P?ue--:++ue<oe)&&$(pe[ue],ue,pe)!==!1;);return W}}(po),to=function(u){return u},Ra=function(u){return typeof u=="function"?u:to},Ao=function(u,P){return(Pe(u)?xn:ca)(u,Ra(P))},li=Ao,fa=function(u,P){var W=[];return ca(u,function($,oe,ue){P($,oe,ue)&&W.push($)}),W},na=function(u){return this.__data__.set(u,"__lodash_hash_undefined__"),this},Xi=function(u){return this.__data__.has(u)};function io(u){var P=-1,W=u==null?0:u.length;for(this.__data__=new dn;++P<W;)this.add(u[P])}io.prototype.add=io.prototype.push=na,io.prototype.has=Xi;var go=io,_s=function(u,P){for(var W=-1,$=u==null?0:u.length;++W<$;)if(P(u[W],W,u))return!0;return!1},No=function(u,P){return u.has(P)},yo=function(u,P,W,$,oe,ue){var pe=1&W,_e=u.length,Te=P.length;if(_e!=Te&&!(pe&&Te>_e))return!1;var Re=ue.get(u),Ze=ue.get(P);if(Re&&Ze)return Re==P&&Ze==u;var je=-1,ht=!0,zt=2&W?new go:void 0;for(ue.set(u,P),ue.set(P,u);++je<_e;){var wr=u[je],Kt=P[je];if($)var qt=pe?$(Kt,wr,je,P,u,ue):$(wr,Kt,je,u,P,ue);if(qt!==void 0){if(qt)continue;ht=!1;break}if(zt){if(!_s(P,function(Qt,Xr){if(!No(zt,Xr)&&(wr===Qt||oe(wr,Qt,W,$,ue)))return zt.push(Xr)})){ht=!1;break}}else if(wr!==Kt&&!oe(wr,Kt,W,$,ue)){ht=!1;break}}return ue.delete(u),ue.delete(P),ht},rs=function(u){var P=-1,W=Array(u.size);return u.forEach(function($,oe){W[++P]=[oe,$]}),W},Lo=function(u){var P=-1,W=Array(u.size);return u.forEach(function($){W[++P]=$}),W},Hi=ae?ae.prototype:void 0,Ju=Hi?Hi.valueOf:void 0,mf=function(u,P,W,$,oe,ue,pe){switch(W){case"[object DataView]":if(u.byteLength!=P.byteLength||u.byteOffset!=P.byteOffset)return!1;u=u.buffer,P=P.buffer;case"[object ArrayBuffer]":return!(u.byteLength!=P.byteLength||!ue(new ys(u),new ys(P)));case"[object Boolean]":case"[object Date]":case"[object Number]":return m(+u,+P);case"[object Error]":return u.name==P.name&&u.message==P.message;case"[object RegExp]":case"[object String]":return u==P+"";case"[object Map]":var _e=rs;case"[object Set]":var Te=1&$;if(_e||(_e=Lo),u.size!=P.size&&!Te)return!1;var Re=pe.get(u);if(Re)return Re==P;$|=2,pe.set(u,P);var Ze=yo(_e(u),_e(P),$,oe,ue,pe);return pe.delete(u),Ze;case"[object Symbol]":if(Ju)return Ju.call(u)==Ju.call(P)}return!1},mo=Object.prototype.hasOwnProperty,Pc=function(u,P,W,$,oe,ue){var pe=1&W,_e=Ya(u),Te=_e.length;if(Te!=Ya(P).length&&!pe)return!1;for(var Re=Te;Re--;){var Ze=_e[Re];if(!(pe?Ze in P:mo.call(P,Ze)))return!1}var je=ue.get(u),ht=ue.get(P);if(je&&ht)return je==P&&ht==u;var zt=!0;ue.set(u,P),ue.set(P,u);for(var wr=pe;++Re<Te;){var Kt=u[Ze=_e[Re]],qt=P[Ze];if($)var Qt=pe?$(qt,Kt,Ze,P,u,ue):$(Kt,qt,Ze,u,P,ue);if(!(Qt===void 0?Kt===qt||oe(Kt,qt,W,$,ue):Qt)){zt=!1;break}wr||(wr=Ze=="constructor")}if(zt&&!wr){var Xr=u.constructor,Yr=P.constructor;Xr==Yr||!("constructor"in u)||!("constructor"in P)||typeof Xr=="function"&&Xr instanceof Xr&&typeof Yr=="function"&&Yr instanceof Yr||(zt=!1)}return ue.delete(u),ue.delete(P),zt},di=Object.prototype.hasOwnProperty,bn=function(u,P,W,$,oe,ue){var pe=Pe(u),_e=Pe(P),Te=pe?"[object Array]":In(u),Re=_e?"[object Array]":In(P),Ze=(Te=Te=="[object Arguments]"?"[object Object]":Te)=="[object Object]",je=(Re=Re=="[object Arguments]"?"[object Object]":Re)=="[object Object]",ht=Te==Re;if(ht&&Ut(u)){if(!Ut(P))return!1;pe=!0,Ze=!1}if(ht&&!Ze)return ue||(ue=new wn),pe||Je(u)?yo(u,P,W,$,oe,ue):mf(u,P,Te,W,$,oe,ue);if(!(1&W)){var zt=Ze&&di.call(u,"__wrapped__"),wr=je&&di.call(P,"__wrapped__");if(zt||wr){var Kt=zt?u.value():u,qt=wr?P.value():P;return ue||(ue=new wn),oe(Kt,qt,W,$,ue)}}return!!ht&&(ue||(ue=new wn),Pc(u,P,W,$,oe,ue))},qu=function u(P,W,$,oe,ue){return P===W||(P==null||W==null||!j(P)&&!j(W)?P!=P&&W!=W:bn(P,W,$,oe,u,ue))},Ka=function(u,P,W,$){var oe=W.length,ue=oe,pe=!$;if(u==null)return!ue;for(u=Object(u);oe--;){var _e=W[oe];if(pe&&_e[2]?_e[1]!==u[_e[0]]:!(_e[0]in u))return!1}for(;++oe<ue;){var Te=(_e=W[oe])[0],Re=u[Te],Ze=_e[1];if(pe&&_e[2]){if(Re===void 0&&!(Te in u))return!1}else{var je=new wn;if($)var ht=$(Re,Ze,Te,u,P,je);if(!(ht===void 0?qu(Ze,Re,3,$,je):ht))return!1}}return!0},xs=function(u){return u==u&&!Vt(u)},ou=function(u){for(var P=lt(u),W=P.length;W--;){var $=P[W],oe=u[$];P[W]=[$,oe,xs(oe)]}return P},la=function(u,P){return function(W){return W!=null&&W[u]===P&&(P!==void 0||u in Object(W))}},da=function(u){var P=ou(u);return P.length==1&&P[0][2]?la(P[0][0],P[0][1]):function(W){return W===u||Ka(W,u,P)}},Ro=function(u){return typeof u=="symbol"||j(u)&&Fe(u)=="[object Symbol]"},cl=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,fl=/^\w*$/,Oc=function(u,P){if(Pe(u))return!1;var W=typeof u;return!(W!="number"&&W!="symbol"&&W!="boolean"&&u!=null&&!Ro(u))||fl.test(u)||!cl.test(u)||P!=null&&u in Object(P)};function xu(u,P){if(typeof u!="function"||P!=null&&typeof P!="function")throw new TypeError("Expected a function");var W=function(){var $=arguments,oe=P?P.apply(this,$):$[0],ue=W.cache;if(ue.has(oe))return ue.get(oe);var pe=u.apply(this,$);return W.cache=ue.set(oe,pe)||ue,pe};return W.cache=new(xu.Cache||dn),W}xu.Cache=dn;var Fa=xu,ao=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ec=/\\(\\)?/g,tc=function(u){var P=Fa(u,function($){return W.size===500&&W.clear(),$}),W=P.cache;return P}(function(u){var P=[];return u.charCodeAt(0)===46&&P.push(""),u.replace(ao,function(W,$,oe,ue){P.push(oe?ue.replace(ec,"$1"):$||W)}),P}),bo=function(u,P){for(var W=-1,$=u==null?0:u.length,oe=Array($);++W<$;)oe[W]=P(u[W],W,u);return oe},su=ae?ae.prototype:void 0,uu=su?su.toString:void 0,ko=function u(P){if(typeof P=="string")return P;if(Pe(P))return bo(P,u)+"";if(Ro(P))return uu?uu.call(P):"";var W=P+"";return W=="0"&&1/P==-Infinity?"-0":W},rc=function(u){return u==null?"":ko(u)},Ss=function(u,P){return Pe(u)?u:Oc(u,P)?[u]:tc(rc(u))},Bo=function(u){if(typeof u=="string"||Ro(u))return u;var P=u+"";return P=="0"&&1/u==-Infinity?"-0":P},cu=function(u,P){for(var W=0,$=(P=Ss(P,u)).length;u!=null&&W<$;)u=u[Bo(P[W++])];return W&&W==$?u:void 0},bf=function(u,P,W){var $=u==null?void 0:cu(u,P);return $===void 0?W:$},ll=function(u,P){return u!=null&&P in Object(u)},Ef=function(u,P,W){for(var $=-1,oe=(P=Ss(P,u)).length,ue=!1;++$<oe;){var pe=Bo(P[$]);if(!(ue=u!=null&&W(u,pe)))break;u=u[pe]}return ue||++$!=oe?ue:!!(oe=u==null?0:u.length)&&kr(oe)&&fr(pe,oe)&&(Pe(u)||Ne(u))},_f=function(u,P){return u!=null&&Ef(u,P,ll)},dl=function(u,P){return Oc(u)&&xs(P)?la(Bo(u),P):function(W){var $=bf(W,u);return $===void 0&&$===P?_f(W,u):qu(P,$,3)}},ns=function(u){return function(P){return P==null?void 0:P[u]}},Su=function(u){return function(P){return cu(P,u)}},Dc=function(u){return Oc(u)?ns(Bo(u)):Su(u)},oo=function(u){return typeof u=="function"?u:u==null?to:typeof u=="object"?Pe(u)?dl(u[0],u[1]):da(u):Dc(u)},is=function(u,P){return(Pe(u)?Ln:fa)(u,oo(P))},wu=Object.prototype.hasOwnProperty,hl=function(u,P){return u!=null&&wu.call(u,P)},Mu=function(u,P){return u!=null&&Ef(u,P,hl)},vl=Object.prototype.hasOwnProperty,pl=function(u){if(u==null)return!0;if(Sr(u)&&(Pe(u)||typeof u=="string"||typeof u.splice=="function"||Ut(u)||Je(u)||Ne(u)))return!u.length;var P=In(u);if(P=="[object Map]"||P=="[object Set]")return!u.size;if(lr(u))return!Jr(u).length;for(var W in u)if(vl.call(u,W))return!1;return!0},Nc=function(u){return u===void 0},zn=function(u,P){var W=-1,$=Sr(u)?Array(u.length):[];return ca(u,function(oe,ue,pe){$[++W]=P(oe,ue,pe)}),$},gl=function(u,P){return(Pe(u)?bo:zn)(u,oo(P))},xf=function(u,P,W,$){var oe=-1,ue=u==null?0:u.length;for($&&ue&&(W=u[++oe]);++oe<ue;)W=P(W,u[oe],oe,u);return W},Lc=function(u,P,W,$,oe){return oe(u,function(ue,pe,_e){W=$?($=!1,ue):P(W,ue,pe,_e)}),W},Sf=function(u,P,W){var $=Pe(u)?xf:Lc,oe=arguments.length<3;return $(u,oo(P),W,oe,ca)},nc=function(u){return typeof u=="string"||!Pe(u)&&j(u)&&Fe(u)=="[object String]"},wf=ns("length"),Cu=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),ic=function(u){return Cu.test(u)},Mf="[\\ud800-\\udfff]",Rc="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",ac="\\ud83c[\\udffb-\\udfff]",oc="[^\\ud800-\\udfff]",Oa="(?:\\ud83c[\\udde6-\\uddff]){2}",kc="[\\ud800-\\udbff][\\udc00-\\udfff]",Tu="(?:"+Rc+"|"+ac+")?",sc="[\\ufe0e\\ufe0f]?"+Tu+("(?:\\u200d(?:"+[oc,Oa,kc].join("|")+")[\\ufe0e\\ufe0f]?"+Tu+")*"),yl="(?:"+[oc+Rc+"?",Rc,Oa,kc,Mf].join("|")+")",Au=RegExp(ac+"(?="+ac+")|"+yl+sc,"g"),$a=function(u){for(var P=Au.lastIndex=0;Au.test(u);)++P;return P},Qa=function(u){return ic(u)?$a(u):wf(u)},Us=function(u){if(u==null)return 0;if(Sr(u))return nc(u)?Qa(u):u.length;var P=In(u);return P=="[object Map]"||P=="[object Set]"?u.size:Jr(u).length},ml=function(u,P,W){var $=Pe(u),oe=$||Ut(u)||Je(u);if(P=oo(P),W==null){var ue=u&&u.constructor;W=oe?$?new ue:[]:Vt(u)&&Ar(ue)?Pa(Hn(u)):{}}return(oe?xn:po)(u,function(pe,_e,Te){return P(W,pe,_e,Te)}),W},Cf=ae?ae.isConcatSpreadable:void 0,Tf=function(u){return Pe(u)||Ne(u)||!!(Cf&&u&&u[Cf])},fu=function u(P,W,$,oe,ue){var pe=-1,_e=P.length;for($||($=Tf),ue||(ue=[]);++pe<_e;){var Te=P[pe];W>0&&$(Te)?W>1?u(Te,W-1,$,oe,ue):zi(ue,Te):oe||(ue[ue.length]=Te)}return ue},bl=function(u,P,W){switch(W.length){case 0:return u.call(P);case 1:return u.call(P,W[0]);case 2:return u.call(P,W[0],W[1]);case 3:return u.call(P,W[0],W[1],W[2])}return u.apply(P,W)},Af=Math.max,as=function(u,P,W){return P=Af(P===void 0?u.length-1:P,0),function(){for(var $=arguments,oe=-1,ue=Af($.length-P,0),pe=Array(ue);++oe<ue;)pe[oe]=$[P+oe];oe=-1;for(var _e=Array(P+1);++oe<P;)_e[oe]=$[oe];return _e[P]=W(pe),bl(u,this,_e)}},Sa=gn?function(u,P){return gn(u,"toString",{configurable:!0,enumerable:!1,value:Ha(P),writable:!0})}:to,Bc=Date.now,ws=function(u){var P=0,W=0;return function(){var $=Bc(),oe=16-($-W);if(W=$,oe>0){if(++P>=800)return arguments[0]}else P=0;return u.apply(void 0,arguments)}}(Sa),Go=function(u,P){return ws(as(u,P,to),u+"")},If=function(u,P,W,$){for(var oe=u.length,ue=W+($?1:-1);$?ue--:++ue<oe;)if(P(u[ue],ue,u))return ue;return-1},Pf=function(u){return u!=u},Gc=function(u,P,W){for(var $=W-1,oe=u.length;++$<oe;)if(u[$]===P)return $;return-1},Fc=function(u,P,W){return P==P?Gc(u,P,W):If(u,Pf,W)},El=function(u,P){return!!(u==null?0:u.length)&&Fc(u,P,0)>-1},uc=function(u,P,W){for(var $=-1,oe=u==null?0:u.length;++$<oe;)if(W(P,u[$]))return!0;return!1},Io=function(){},Uc=Ea&&1/Lo(new Ea([,-0]))[1]==1/0?function(u){return new Ea(u)}:Io,zs=function(u,P,W){var $=-1,oe=El,ue=u.length,pe=!0,_e=[],Te=_e;if(W)pe=!1,oe=uc;else if(ue>=200){var Re=P?null:Uc(u);if(Re)return Lo(Re);pe=!1,oe=No,Te=new go}else Te=P?[]:_e;e:for(;++$<ue;){var Ze=u[$],je=P?P(Ze):Ze;if(Ze=W||Ze!==0?Ze:0,pe&&je==je){for(var ht=Te.length;ht--;)if(Te[ht]===je)continue e;P&&Te.push(je),_e.push(Ze)}else oe(Te,je,W)||(Te!==_e&&Te.push(je),_e.push(Ze))}return _e},_l=function(u){return j(u)&&Sr(u)},xl=Go(function(u){return zs(fu(u,1,_l,!0))}),Ms=function(u,P){return bo(P,function(W){return u[W]})},wa,rd=function(u){return u==null?[]:Ms(u,lt(u))};try{wa={clone:iu,constant:Ha,each:li,filter:is,has:Mu,isArray:Pe,isEmpty:pl,isFunction:Ar,isUndefined:Nc,keys:lt,map:gl,reduce:Sf,size:Us,transform:ml,union:xl,values:rd}}catch(u){}wa||(wa=window._);var yn=wa,cc=gi;function gi(u){this._isDirected=!yn.has(u,"directed")||u.directed,this._isMultigraph=!!yn.has(u,"multigraph")&&u.multigraph,this._isCompound=!!yn.has(u,"compound")&&u.compound,this._label=void 0,this._defaultNodeLabelFn=yn.constant(void 0),this._defaultEdgeLabelFn=yn.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function fc(u,P){u[P]?u[P]++:u[P]=1}function Sl(u,P){--u[P]||delete u[P]}function lu(u,P,W,$){var oe=""+P,ue=""+W;if(!u&&oe>ue){var pe=oe;oe=ue,ue=pe}return oe+""+ue+""+(yn.isUndefined($)?"\0":$)}function Of(u,P,W,$){var oe=""+P,ue=""+W;if(!u&&oe>ue){var pe=oe;oe=ue,ue=pe}var _e={v:oe,w:ue};return $&&(_e.name=$),_e}function zc(u,P){return lu(u,P.v,P.w,P.name)}gi.prototype._nodeCount=0,gi.prototype._edgeCount=0,gi.prototype.isDirected=function(){return this._isDirected},gi.prototype.isMultigraph=function(){return this._isMultigraph},gi.prototype.isCompound=function(){return this._isCompound},gi.prototype.setGraph=function(u){return this._label=u,this},gi.prototype.graph=function(){return this._label},gi.prototype.setDefaultNodeLabel=function(u){return yn.isFunction(u)||(u=yn.constant(u)),this._defaultNodeLabelFn=u,this},gi.prototype.nodeCount=function(){return this._nodeCount},gi.prototype.nodes=function(){return yn.keys(this._nodes)},gi.prototype.sources=function(){var u=this;return yn.filter(this.nodes(),function(P){return yn.isEmpty(u._in[P])})},gi.prototype.sinks=function(){var u=this;return yn.filter(this.nodes(),function(P){return yn.isEmpty(u._out[P])})},gi.prototype.setNodes=function(u,P){var W=arguments,$=this;return yn.each(u,function(oe){W.length>1?$.setNode(oe,P):$.setNode(oe)}),this},gi.prototype.setNode=function(u,P){return yn.has(this._nodes,u)?(arguments.length>1&&(this._nodes[u]=P),this):(this._nodes[u]=arguments.length>1?P:this._defaultNodeLabelFn(u),this._isCompound&&(this._parent[u]="\0",this._children[u]={},this._children["\0"][u]=!0),this._in[u]={},this._preds[u]={},this._out[u]={},this._sucs[u]={},++this._nodeCount,this)},gi.prototype.node=function(u){return this._nodes[u]},gi.prototype.hasNode=function(u){return yn.has(this._nodes,u)},gi.prototype.removeNode=function(u){var P=this;if(yn.has(this._nodes,u)){var W=function($){P.removeEdge(P._edgeObjs[$])};delete this._nodes[u],this._isCompound&&(this._removeFromParentsChildList(u),delete this._parent[u],yn.each(this.children(u),function($){P.setParent($)}),delete this._children[u]),yn.each(yn.keys(this._in[u]),W),delete this._in[u],delete this._preds[u],yn.each(yn.keys(this._out[u]),W),delete this._out[u],delete this._sucs[u],--this._nodeCount}return this},gi.prototype.setParent=function(u,P){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(yn.isUndefined(P))P="\0";else{for(var W=P+="";!yn.isUndefined(W);W=this.parent(W))if(W===u)throw new Error("Setting "+P+" as parent of "+u+" would create a cycle");this.setNode(P)}return this.setNode(u),this._removeFromParentsChildList(u),this._parent[u]=P,this._children[P][u]=!0,this},gi.prototype._removeFromParentsChildList=function(u){delete this._children[this._parent[u]][u]},gi.prototype.parent=function(u){if(this._isCompound){var P=this._parent[u];if(P!=="\0")return P}},gi.prototype.children=function(u){if(yn.isUndefined(u)&&(u="\0"),this._isCompound){var P=this._children[u];if(P)return yn.keys(P)}else{if(u==="\0")return this.nodes();if(this.hasNode(u))return[]}},gi.prototype.predecessors=function(u){var P=this._preds[u];if(P)return yn.keys(P)},gi.prototype.successors=function(u){var P=this._sucs[u];if(P)return yn.keys(P)},gi.prototype.neighbors=function(u){var P=this.predecessors(u);if(P)return yn.union(P,this.successors(u))},gi.prototype.isLeaf=function(u){return(this.isDirected()?this.successors(u):this.neighbors(u)).length===0},gi.prototype.filterNodes=function(u){var P=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});P.setGraph(this.graph());var W=this;yn.each(this._nodes,function(ue,pe){u(pe)&&P.setNode(pe,ue)}),yn.each(this._edgeObjs,function(ue){P.hasNode(ue.v)&&P.hasNode(ue.w)&&P.setEdge(ue,W.edge(ue))});var $={};function oe(ue){var pe=W.parent(ue);return pe===void 0||P.hasNode(pe)?($[ue]=pe,pe):pe in $?$[pe]:oe(pe)}return this._isCompound&&yn.each(P.nodes(),function(ue){P.setParent(ue,oe(ue))}),P},gi.prototype.setDefaultEdgeLabel=function(u){return yn.isFunction(u)||(u=yn.constant(u)),this._defaultEdgeLabelFn=u,this},gi.prototype.edgeCount=function(){return this._edgeCount},gi.prototype.edges=function(){return yn.values(this._edgeObjs)},gi.prototype.setPath=function(u,P){var W=this,$=arguments;return yn.reduce(u,function(oe,ue){return $.length>1?W.setEdge(oe,ue,P):W.setEdge(oe,ue),ue}),this},gi.prototype.setEdge=function(){var u,P,W,$,oe=!1,ue=arguments[0];typeof ue=="object"&&ue!==null&&"v"in ue?(u=ue.v,P=ue.w,W=ue.name,arguments.length===2&&($=arguments[1],oe=!0)):(u=ue,P=arguments[1],W=arguments[3],arguments.length>2&&($=arguments[2],oe=!0)),u=""+u,P=""+P,yn.isUndefined(W)||(W=""+W);var pe=lu(this._isDirected,u,P,W);if(yn.has(this._edgeLabels,pe))return oe&&(this._edgeLabels[pe]=$),this;if(!yn.isUndefined(W)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(u),this.setNode(P),this._edgeLabels[pe]=oe?$:this._defaultEdgeLabelFn(u,P,W);var _e=Of(this._isDirected,u,P,W);return u=_e.v,P=_e.w,Object.freeze(_e),this._edgeObjs[pe]=_e,fc(this._preds[P],u),fc(this._sucs[u],P),this._in[P][pe]=_e,this._out[u][pe]=_e,this._edgeCount++,this},gi.prototype.edge=function(u,P,W){var $=arguments.length===1?zc(this._isDirected,arguments[0]):lu(this._isDirected,u,P,W);return this._edgeLabels[$]},gi.prototype.hasEdge=function(u,P,W){var $=arguments.length===1?zc(this._isDirected,arguments[0]):lu(this._isDirected,u,P,W);return yn.has(this._edgeLabels,$)},gi.prototype.removeEdge=function(u,P,W){var $=arguments.length===1?zc(this._isDirected,arguments[0]):lu(this._isDirected,u,P,W),oe=this._edgeObjs[$];return oe&&(u=oe.v,P=oe.w,delete this._edgeLabels[$],delete this._edgeObjs[$],Sl(this._preds[P],u),Sl(this._sucs[u],P),delete this._in[P][$],delete this._out[u][$],this._edgeCount--),this},gi.prototype.inEdges=function(u,P){var W=this._in[u];if(W){var $=yn.values(W);return P?yn.filter($,function(oe){return oe.v===P}):$}},gi.prototype.outEdges=function(u,P){var W=this._out[u];if(W){var $=yn.values(W);return P?yn.filter($,function(oe){return oe.w===P}):$}},gi.prototype.nodeEdges=function(u,P){var W=this.inEdges(u,P);if(W)return W.concat(this.outEdges(u,P))};var Df={Graph:cc,version:"2.1.8"},wl={write:function(u){var P={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:Nf(u),edges:Fo(u)};return yn.isUndefined(u.graph())||(P.value=yn.clone(u.graph())),P},read:function(u){var P=new cc(u.options).setGraph(u.value);return yn.each(u.nodes,function(W){P.setNode(W.v,W.value),W.parent&&P.setParent(W.v,W.parent)}),yn.each(u.edges,function(W){P.setEdge({v:W.v,w:W.w,name:W.name},W.value)}),P}};function Nf(u){return yn.map(u.nodes(),function(P){var W=u.node(P),$=u.parent(P),oe={v:P};return yn.isUndefined(W)||(oe.value=W),yn.isUndefined($)||(oe.parent=$),oe})}function Fo(u){return yn.map(u.edges(),function(P){var W=u.edge(P),$={v:P.v,w:P.w};return yn.isUndefined(P.name)||($.name=P.name),yn.isUndefined(W)||($.value=W),$})}var Ml=function(u){var P,W={},$=[];function oe(ue){yn.has(W,ue)||(W[ue]=!0,P.push(ue),yn.each(u.successors(ue),oe),yn.each(u.predecessors(ue),oe))}return yn.each(u.nodes(),function(ue){P=[],oe(ue),P.length&&$.push(P)}),$},Wc=Da;function Da(){this._arr=[],this._keyIndices={}}Da.prototype.size=function(){return this._arr.length},Da.prototype.keys=function(){return this._arr.map(function(u){return u.key})},Da.prototype.has=function(u){return yn.has(this._keyIndices,u)},Da.prototype.priority=function(u){var P=this._keyIndices[u];if(P!==void 0)return this._arr[P].priority},Da.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},Da.prototype.add=function(u,P){var W=this._keyIndices;if(u=String(u),!yn.has(W,u)){var $=this._arr,oe=$.length;return W[u]=oe,$.push({key:u,priority:P}),this._decrease(oe),!0}return!1},Da.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var u=this._arr.pop();return delete this._keyIndices[u.key],this._heapify(0),u.key},Da.prototype.decrease=function(u,P){var W=this._keyIndices[u];if(P>this._arr[W].priority)throw new Error("New priority is greater than current priority. Key: "+u+" Old: "+this._arr[W].priority+" New: "+P);this._arr[W].priority=P,this._decrease(W)},Da.prototype._heapify=function(u){var P=this._arr,W=2*u,$=W+1,oe=u;W<P.length&&(oe=P[W].priority<P[oe].priority?W:oe,$<P.length&&(oe=P[$].priority<P[oe].priority?$:oe),oe!==u&&(this._swap(u,oe),this._heapify(oe)))},Da.prototype._decrease=function(u){for(var P,W=this._arr,$=W[u].priority;u!==0&&!(W[P=u>>1].priority<$);)this._swap(u,P),u=P},Da.prototype._swap=function(u,P){var W=this._arr,$=this._keyIndices,oe=W[u],ue=W[P];W[u]=ue,W[P]=oe,$[ue.key]=u,$[oe.key]=P};var Lf=function(u,P,W,$){return function(oe,ue,pe,_e){var Te,Re,Ze={},je=new Wc,ht=function(zt){var wr=zt.v!==Te?zt.v:zt.w,Kt=Ze[wr],qt=pe(zt),Qt=Re.distance+qt;if(qt<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+zt+" Weight: "+qt);Qt<Kt.distance&&(Kt.distance=Qt,Kt.predecessor=Te,je.decrease(wr,Qt))};for(oe.nodes().forEach(function(zt){var wr=zt===ue?0:Number.POSITIVE_INFINITY;Ze[zt]={distance:wr},je.add(zt,wr)});je.size()>0&&(Te=je.removeMin(),(Re=Ze[Te]).distance!==Number.POSITIVE_INFINITY);)_e(Te).forEach(ht);return Ze}(u,String(P),W||Iu,$||function(oe){return u.outEdges(oe)})},Iu=yn.constant(1),Rf=function(u,P,W){return yn.transform(u.nodes(),function($,oe){$[oe]=Lf(u,oe,P,W)},{})},kf=function(u){var P=0,W=[],$={},oe=[];function ue(pe){var _e=$[pe]={onStack:!0,lowlink:P,index:P++};if(W.push(pe),u.successors(pe).forEach(function(Ze){yn.has($,Ze)?$[Ze].onStack&&(_e.lowlink=Math.min(_e.lowlink,$[Ze].index)):(ue(Ze),_e.lowlink=Math.min(_e.lowlink,$[Ze].lowlink))}),_e.lowlink===_e.index){var Te,Re=[];do Te=W.pop(),$[Te].onStack=!1,Re.push(Te);while(pe!==Te);oe.push(Re)}}return u.nodes().forEach(function(pe){yn.has($,pe)||ue(pe)}),oe},nd=function(u){return yn.filter(kf(u),function(P){return P.length>1||P.length===1&&u.hasEdge(P[0],P[0])})},Ws=function(u,P,W){return function($,oe,ue){var pe={},_e=$.nodes();return _e.forEach(function(Te){pe[Te]={},pe[Te][Te]={distance:0},_e.forEach(function(Re){Te!==Re&&(pe[Te][Re]={distance:Number.POSITIVE_INFINITY})}),ue(Te).forEach(function(Re){var Ze=Re.v===Te?Re.w:Re.v,je=oe(Re);pe[Te][Ze]={distance:je,predecessor:Te}})}),_e.forEach(function(Te){var Re=pe[Te];_e.forEach(function(Ze){var je=pe[Ze];_e.forEach(function(ht){var zt=je[Te],wr=Re[ht],Kt=je[ht],qt=zt.distance+wr.distance;qt<Kt.distance&&(Kt.distance=qt,Kt.predecessor=wr.predecessor)})})}),pe}(u,P||Bf,W||function($){return u.outEdges($)})},Bf=yn.constant(1),Uo=Pu;function Pu(u){var P={},W={},$=[];if(yn.each(u.sinks(),function oe(ue){if(yn.has(W,ue))throw new lc;yn.has(P,ue)||(W[ue]=!0,P[ue]=!0,yn.each(u.predecessors(ue),oe),delete W[ue],$.push(ue))}),yn.size(P)!==u.nodeCount())throw new lc;return $}function lc(){}Pu.CycleException=lc,lc.prototype=new Error;var jc=function(u,P,W){yn.isArray(P)||(P=[P]);var $=(u.isDirected()?u.successors:u.neighbors).bind(u),oe=[],ue={};return yn.each(P,function(pe){if(!u.hasNode(pe))throw new Error("Graph does not have node: "+pe);zo(u,pe,W==="post",ue,$,oe)}),oe};function zo(u,P,W,$,oe,ue){yn.has($,P)||($[P]=!0,W||ue.push(P),yn.each(oe(P),function(pe){zo(u,pe,W,$,oe,ue)}),W&&ue.push(P))}var so,Cl={Graph:Df.Graph,json:wl,alg:{components:Ml,dijkstra:Lf,dijkstraAll:Rf,findCycles:nd,floydWarshall:Ws,isAcyclic:function(u){try{Uo(u)}catch(P){if(P instanceof Uo.CycleException)return!1;throw P}return!0},postorder:function(u,P){return jc(u,P,"post")},preorder:function(u,P){return jc(u,P,"pre")},prim:function(u,P){var W,$=new cc,oe={},ue=new Wc;function pe(Te){var Re=Te.v===W?Te.w:Te.v,Ze=ue.priority(Re);if(Ze!==void 0){var je=P(Te);je<Ze&&(oe[Re]=W,ue.decrease(Re,je))}}if(u.nodeCount()===0)return $;yn.each(u.nodes(),function(Te){ue.add(Te,Number.POSITIVE_INFINITY),$.setNode(Te)}),ue.decrease(u.nodes()[0],0);for(var _e=!1;ue.size()>0;){if(W=ue.removeMin(),yn.has(oe,W))$.setEdge(W,oe[W]);else{if(_e)throw new Error("Input graph is not connected: "+u);_e=!0}u.nodeEdges(W).forEach(pe)}return $},tarjan:kf,topsort:Uo},version:Df.version};try{so=Cl}catch(u){}so||(so=window.graphlib);var Po=so,Vc=function(u){return Fs(u,5)},Cs=function(u,P,W){if(!Vt(W))return!1;var $=typeof P;return!!($=="number"?Sr(W)&&fr(P,W.length):$=="string"&&P in W)&&m(W[P],u)},Ts=Object.prototype,Gf=Ts.hasOwnProperty,Ou=Go(function(u,P){u=Object(u);var W=-1,$=P.length,oe=$>2?P[2]:void 0;for(oe&&Cs(P[0],P[1],oe)&&($=1);++W<$;)for(var ue=P[W],pe=kt(ue),_e=-1,Te=pe.length;++_e<Te;){var Re=pe[_e],Ze=u[Re];(Ze===void 0||m(Ze,Ts[Re])&&!Gf.call(u,Re))&&(u[Re]=ue[Re])}return u}),js=function(u){return function(P,W,$){var oe=Object(P);if(!Sr(P)){var ue=oo(W);P=lt(P),W=function(_e){return ue(oe[_e],_e,oe)}}var pe=u(P,W,$);return pe>-1?oe[ue?P[pe]:pe]:void 0}},Ri=/^\s+|\s+$/g,Xc=/^[-+]0x[0-9a-f]+$/i,os=/^0b[01]+$/i,Wo=/^0o[0-7]+$/i,ss=parseInt,Yc=function(u){if(typeof u=="number")return u;if(Ro(u))return NaN;if(Vt(u)){var P=typeof u.valueOf=="function"?u.valueOf():u;u=Vt(P)?P+"":P}if(typeof u!="string")return u===0?u:+u;u=u.replace(Ri,"");var W=os.test(u);return W||Wo.test(u)?ss(u.slice(2),W?2:8):Xc.test(u)?NaN:+u},dc=function(u){return u?(u=Yc(u))===Infinity||u===-Infinity?17976931348623157e292*(u<0?-1:1):u==u?u:0:u===0?u:0},hc=function(u){var P=dc(u),W=P%1;return P==P?W?P-W:P:0},Tl=Math.max,Ff=js(function(u,P,W){var $=u==null?0:u.length;if(!$)return-1;var oe=W==null?0:hc(W);return oe<0&&(oe=Tl($+oe,0)),If(u,oo(P),oe)}),Uf=function(u){return(u==null?0:u.length)?fu(u,1):[]},us=function(u,P){return u==null?u:au(u,Ra(P),kt)},Al=function(u){var P=u==null?0:u.length;return P?u[P-1]:void 0},cs=function(u,P){var W={};return P=oo(P),po(u,function($,oe,ue){Un(W,oe,P($,oe,ue))}),W},on=function(u,P,W){for(var $=-1,oe=u.length;++$<oe;){var ue=u[$],pe=P(ue);if(pe!=null&&(_e===void 0?pe==pe&&!Ro(pe):W(pe,_e)))var _e=pe,Te=ue}return Te},jo=function(u,P){return u>P},id=function(u){return u&&u.length?on(u,to,jo):void 0},Zc=function(u,P,W){(W!==void 0&&!m(u[P],W)||W===void 0&&!(P in u))&&Un(u,P,W)},ad=Function.prototype,Eo=Object.prototype,Il=ad.toString,Pl=Eo.hasOwnProperty,od=Il.call(Object),Du=function(u){if(!j(u)||Fe(u)!="[object Object]")return!1;var P=Hn(u);if(P===null)return!0;var W=Pl.call(P,"constructor")&&P.constructor;return typeof W=="function"&&W instanceof W&&Il.call(W)==od},Vo=function(u,P){if((P!=="constructor"||typeof u[P]!="function")&&P!="__proto__")return u[P]},vc=function(u){return be(u,kt(u))},sd=function(u,P,W,$,oe,ue,pe){var _e=Vo(u,W),Te=Vo(P,W),Re=pe.get(Te);if(Re)Zc(u,W,Re);else{var Ze=ue?ue(_e,Te,W+"",u,P,pe):void 0,je=Ze===void 0;if(je){var ht=Pe(Te),zt=!ht&&Ut(Te),wr=!ht&&!zt&&Je(Te);Ze=Te,ht||zt||wr?Pe(_e)?Ze=_e:_l(_e)?Ze=tn(_e):zt?(je=!1,Ze=jr(Te,!0)):wr?(je=!1,Ze=ms(Te,!0)):Ze=[]:Du(Te)||Ne(Te)?(Ze=_e,Ne(_e)?Ze=vc(_e):Vt(_e)&&!Ar(_e)||(Ze=qo(Te))):je=!1}je&&(pe.set(Te,Ze),oe(Ze,Te,$,ue,pe),pe.delete(Te)),Zc(u,W,Ze)}},du=function u(P,W,$,oe,ue){P!==W&&au(W,function(pe,_e){if(ue||(ue=new wn),Vt(pe))sd(P,W,_e,$,u,oe,ue);else{var Te=oe?oe(Vo(P,_e),pe,_e+"",P,W,ue):void 0;Te===void 0&&(Te=pe),Zc(P,_e,Te)}},kt)},ln=function(u){return Go(function(P,W){var $=-1,oe=W.length,ue=oe>1?W[oe-1]:void 0,pe=oe>2?W[2]:void 0;for(ue=u.length>3&&typeof ue=="function"?(oe--,ue):void 0,pe&&Cs(W[0],W[1],pe)&&(ue=oe<3?void 0:ue,oe=1),P=Object(P);++$<oe;){var _e=W[$];_e&&u(P,_e,$,ue)}return P})}(function(u,P,W){du(u,P,W)}),ud=function(u,P){return u<P},Nu=function(u){return u&&u.length?on(u,to,ud):void 0},fs=function(u,P){return u&&u.length?on(u,oo(P),ud):void 0},ls=function(){return me.Date.now()},zf=function(u,P,W,$){if(!Vt(u))return u;for(var oe=-1,ue=(P=Ss(P,u)).length,pe=ue-1,_e=u;_e!=null&&++oe<ue;){var Te=Bo(P[oe]),Re=W;if(Te==="__proto__"||Te==="constructor"||Te==="prototype")return u;if(oe!=pe){var Ze=_e[Te];(Re=$?$(Ze,Te,_e):void 0)===void 0&&(Re=Vt(Ze)?Ze:fr(P[oe+1])?[]:{})}Mn(_e,Te,Re),_e=_e[Te]}return u},hu=function(u,P,W){for(var $=-1,oe=P.length,ue={};++$<oe;){var pe=P[$],_e=cu(u,pe);W(_e,pe)&&zf(ue,Ss(pe,u),_e)}return ue},Wf=function(u,P){return hu(u,P,function(W,$){return _f(u,$)})},Lu=function(u){return ws(as(u,void 0,Uf),u+"")}(function(u,P){return u==null?{}:Wf(u,P)}),Ru=Math.ceil,pc=Math.max,Ol=function(u,P,W,$){for(var oe=-1,ue=pc(Ru((P-u)/(W||1)),0),pe=Array(ue);ue--;)pe[$?ue:++oe]=u,u+=W;return pe},Dl=function(u){return function(P,W,$){return $&&typeof $!="number"&&Cs(P,W,$)&&(W=$=void 0),P=dc(P),W===void 0?(W=P,P=0):W=dc(W),$=$===void 0?P<W?1:-1:dc($),Ol(P,W,$,u)}}(),Nl=function(u,P){var W=u.length;for(u.sort(P);W--;)u[W]=u[W].value;return u},jf=function(u,P){if(u!==P){var W=u!==void 0,$=u===null,oe=u==u,ue=Ro(u),pe=P!==void 0,_e=P===null,Te=P==P,Re=Ro(P);if(!_e&&!Re&&!ue&&u>P||ue&&pe&&Te&&!_e&&!Re||$&&pe&&Te||!W&&Te||!oe)return 1;if(!$&&!ue&&!Re&&u<P||Re&&W&&oe&&!$&&!ue||_e&&W&&oe||!pe&&oe||!Te)return-1}return 0},Vf=function(u,P,W){for(var $=-1,oe=u.criteria,ue=P.criteria,pe=oe.length,_e=W.length;++$<pe;){var Te=jf(oe[$],ue[$]);if(Te)return $>=_e?Te:Te*(W[$]=="desc"?-1:1)}return u.index-P.index},Xf=function(u,P,W){P=P.length?bo(P,function(ue){return Pe(ue)?function(pe){return cu(pe,ue.length===1?ue[0]:ue)}:ue}):[to];var $=-1;P=bo(P,On(oo));var oe=zn(u,function(ue,pe,_e){return{criteria:bo(P,function(Te){return Te(ue)}),index:++$,value:ue}});return Nl(oe,function(ue,pe){return Vf(ue,pe,W)})},Wi=Go(function(u,P){if(u==null)return[];var W=P.length;return W>1&&Cs(u,P[0],P[1])?P=[]:W>2&&Cs(P[0],P[1],P[2])&&(P=[P[0]]),Xf(u,fu(P,1),[])}),Ll=0,Yf=function(u){var P=++Ll;return rc(u)+P},gc=function(u,P,W){for(var $=-1,oe=u.length,ue=P.length,pe={};++$<oe;){var _e=$<ue?P[$]:void 0;W(pe,u[$],_e)}return pe},vu,ka=function(u,P){return gc(u||[],P||[],Mn)};try{vu={cloneDeep:Vc,constant:Ha,defaults:Ou,each:li,filter:is,find:Ff,flatten:Uf,forEach:Ao,forIn:us,has:Mu,isUndefined:Nc,last:Al,map:gl,mapValues:cs,max:id,merge:ln,min:Nu,minBy:fs,now:ls,pick:Lu,range:Dl,reduce:Sf,sortBy:Wi,uniqueId:Yf,values:rd,zipObject:ka}}catch(u){}vu||(vu=window._);var Bt=vu,Rl=ku;function ku(){var u={};u._next=u._prev=u,this._sentinel=u}function Hc(u){u._prev._next=u._next,u._next._prev=u._prev,delete u._next,delete u._prev}function kl(u,P){if(u!=="_next"&&u!=="_prev")return P}ku.prototype.dequeue=function(){var u=this._sentinel,P=u._prev;if(P!==u)return Hc(P),P},ku.prototype.enqueue=function(u){var P=this._sentinel;u._prev&&u._next&&Hc(u),u._next=P._next,P._next._prev=u,P._next=u,u._prev=P},ku.prototype.toString=function(){for(var u=[],P=this._sentinel,W=P._prev;W!==P;)u.push(JSON.stringify(W,kl)),W=W._prev;return"["+u.join(", ")+"]"};var Zf=Po.Graph,Kc=function(u,P){if(u.nodeCount()<=1)return[];var W=function(oe,ue){var pe=new Zf,_e=0,Te=0;Bt.forEach(oe.nodes(),function(je){pe.setNode(je,{v:je,in:0,out:0})}),Bt.forEach(oe.edges(),function(je){var ht=pe.edge(je.v,je.w)||0,zt=ue(je),wr=ht+zt;pe.setEdge(je.v,je.w,wr),Te=Math.max(Te,pe.node(je.v).out+=zt),_e=Math.max(_e,pe.node(je.w).in+=zt)});var Re=Bt.range(Te+_e+3).map(function(){return new Rl}),Ze=_e+1;return Bt.forEach(pe.nodes(),function(je){$c(Re,Ze,pe.node(je))}),{graph:pe,buckets:Re,zeroIdx:Ze}}(u,P||Bl),$=function(oe,ue,pe){for(var _e,Te=[],Re=ue[ue.length-1],Ze=ue[0];oe.nodeCount();){for(;_e=Ze.dequeue();)yc(oe,ue,pe,_e);for(;_e=Re.dequeue();)yc(oe,ue,pe,_e);if(oe.nodeCount()){for(var je=ue.length-2;je>0;--je)if(_e=ue[je].dequeue()){Te=Te.concat(yc(oe,ue,pe,_e,!0));break}}}return Te}(W.graph,W.buckets,W.zeroIdx);return Bt.flatten(Bt.map($,function(oe){return u.outEdges(oe.v,oe.w)}),!0)},Bl=Bt.constant(1);function yc(u,P,W,$,oe){var ue=oe?[]:void 0;return Bt.forEach(u.inEdges($.v),function(pe){var _e=u.edge(pe),Te=u.node(pe.v);oe&&ue.push({v:pe.v,w:pe.w}),Te.out-=_e,$c(P,W,Te)}),Bt.forEach(u.outEdges($.v),function(pe){var _e=u.edge(pe),Te=pe.w,Re=u.node(Te);Re.in-=_e,$c(P,W,Re)}),u.removeNode($.v),ue}function $c(u,P,W){W.out?W.in?u[W.out-W.in+P].enqueue(W):u[u.length-1].enqueue(W):u[0].enqueue(W)}var Hf={run:function(u){var P=u.graph().acyclicer==="greedy"?Kc(u,function(W){return function($){return W.edge($).weight}}(u)):function(W){var $=[],oe={},ue={};function pe(_e){Bt.has(ue,_e)||(ue[_e]=!0,oe[_e]=!0,Bt.forEach(W.outEdges(_e),function(Te){Bt.has(oe,Te.w)?$.push(Te):pe(Te.w)}),delete oe[_e])}return Bt.forEach(W.nodes(),pe),$}(u);Bt.forEach(P,function(W){var $=u.edge(W);u.removeEdge(W),$.forwardName=W.name,$.reversed=!0,u.setEdge(W.w,W.v,$,Bt.uniqueId("rev"))})},undo:function(u){Bt.forEach(u.edges(),function(P){var W=u.edge(P);if(W.reversed){u.removeEdge(P);var $=W.forwardName;delete W.reversed,delete W.forwardName,u.setEdge(P.w,P.v,W,$)}})}},Qc=Po.Graph,ha={addDummyNode:Bu,simplify:function(u){var P=new Qc().setGraph(u.graph());return Bt.forEach(u.nodes(),function(W){P.setNode(W,u.node(W))}),Bt.forEach(u.edges(),function(W){var $=P.edge(W.v,W.w)||{weight:0,minlen:1},oe=u.edge(W);P.setEdge(W.v,W.w,{weight:$.weight+oe.weight,minlen:Math.max($.minlen,oe.minlen)})}),P},asNonCompoundGraph:function(u){var P=new Qc({multigraph:u.isMultigraph()}).setGraph(u.graph());return Bt.forEach(u.nodes(),function(W){u.children(W).length||P.setNode(W,u.node(W))}),Bt.forEach(u.edges(),function(W){P.setEdge(W,u.edge(W))}),P},successorWeights:function(u){var P=Bt.map(u.nodes(),function(W){var $={};return Bt.forEach(u.outEdges(W),function(oe){$[oe.w]=($[oe.w]||0)+u.edge(oe).weight}),$});return Bt.zipObject(u.nodes(),P)},predecessorWeights:function(u){var P=Bt.map(u.nodes(),function(W){var $={};return Bt.forEach(u.inEdges(W),function(oe){$[oe.v]=($[oe.v]||0)+u.edge(oe).weight}),$});return Bt.zipObject(u.nodes(),P)},intersectRect:function(u,P){var W,$,oe=u.x,ue=u.y,pe=P.x-oe,_e=P.y-ue,Te=u.width/2,Re=u.height/2;if(!pe&&!_e)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(_e)*Te>Math.abs(pe)*Re?(_e<0&&(Re=-Re),W=Re*pe/_e,$=Re):(pe<0&&(Te=-Te),W=Te,$=Te*_e/pe),{x:oe+W,y:ue+$}},buildLayerMatrix:function(u){var P=Bt.map(Bt.range(ia(u)+1),function(){return[]});return Bt.forEach(u.nodes(),function(W){var $=u.node(W),oe=$.rank;Bt.isUndefined(oe)||(P[oe][$.order]=W)}),P},normalizeRanks:function(u){var P=Bt.min(Bt.map(u.nodes(),function(W){return u.node(W).rank}));Bt.forEach(u.nodes(),function(W){var $=u.node(W);Bt.has($,"rank")&&($.rank-=P)})},removeEmptyRanks:function(u){var P=Bt.min(Bt.map(u.nodes(),function(ue){return u.node(ue).rank})),W=[];Bt.forEach(u.nodes(),function(ue){var pe=u.node(ue).rank-P;W[pe]||(W[pe]=[]),W[pe].push(ue)});var $=0,oe=u.graph().nodeRankFactor;Bt.forEach(W,function(ue,pe){Bt.isUndefined(ue)&&pe%oe!=0?--$:$&&Bt.forEach(ue,function(_e){u.node(_e).rank+=$})})},addBorderNode:function(u,P,W,$){var oe={width:0,height:0};return arguments.length>=4&&(oe.rank=W,oe.order=$),Bu(u,"border",oe,P)},maxRank:ia,partition:function(u,P){var W={lhs:[],rhs:[]};return Bt.forEach(u,function($){P($)?W.lhs.push($):W.rhs.push($)}),W},time:function(u,P){var W=Bt.now();try{return P()}finally{console.log(u+" time: "+(Bt.now()-W)+"ms")}},notime:function(u,P){return P()}};function Bu(u,P,W,$){var oe;do oe=Bt.uniqueId($);while(u.hasNode(oe));return W.dummy=P,u.setNode(oe,W),oe}function ia(u){return Bt.max(Bt.map(u.nodes(),function(P){var W=u.node(P).rank;if(!Bt.isUndefined(W))return W}))}var Gu={run:function(u){u.graph().dummyChains=[],Bt.forEach(u.edges(),function(P){(function(W,$){var oe,ue,pe,_e=$.v,Te=W.node(_e).rank,Re=$.w,Ze=W.node(Re).rank,je=$.name,ht=W.edge($),zt=ht.labelRank;if(Ze!==Te+1){for(W.removeEdge($),pe=0,++Te;Te<Ze;++pe,++Te)ht.points=[],ue={width:0,height:0,edgeLabel:ht,edgeObj:$,rank:Te},oe=ha.addDummyNode(W,"edge",ue,"_d"),Te===zt&&(ue.width=ht.width,ue.height=ht.height,ue.dummy="edge-label",ue.labelpos=ht.labelpos),W.setEdge(_e,oe,{weight:ht.weight},je),pe===0&&W.graph().dummyChains.push(oe),_e=oe;W.setEdge(_e,Re,{weight:ht.weight},je)}})(u,P)})},undo:function(u){Bt.forEach(u.graph().dummyChains,function(P){var W,$=u.node(P),oe=$.edgeLabel;for(u.setEdge($.edgeObj,oe);$.dummy;)W=u.successors(P)[0],u.removeNode(P),oe.points.push({x:$.x,y:$.y}),$.dummy==="edge-label"&&(oe.x=$.x,oe.y=$.y,oe.width=$.width,oe.height=$.height),P=W,$=u.node(P)})}},Oo=function(u){var P={};Bt.forEach(u.sources(),function W($){var oe=u.node($);if(Bt.has(P,$))return oe.rank;P[$]=!0;var ue=Bt.min(Bt.map(u.outEdges($),function(pe){return W(pe.w)-u.edge(pe).minlen}));return ue!==Number.POSITIVE_INFINITY&&ue!=null||(ue=0),oe.rank=ue})},As=function(u,P){return u.node(P.w).rank-u.node(P.v).rank-u.edge(P).minlen},Vs=Po.Graph,Is=As,Xs=function(u){var P,W,$=new Vs({directed:!1}),oe=u.nodes()[0],ue=u.nodeCount();for($.setNode(oe,{});Ps($,u)<ue;)P=ai($,u),W=$.hasNode(P.v)?Is(u,P):-Is(u,P),uo($,u,W);return $};function Ps(u,P){return Bt.forEach(u.nodes(),function W($){Bt.forEach(P.nodeEdges($),function(oe){var ue=oe.v,pe=$===ue?oe.w:ue;u.hasNode(pe)||Is(P,oe)||(u.setNode(pe,{}),u.setEdge($,pe,{}),W(pe))})}),u.nodeCount()}function ai(u,P){return Bt.minBy(P.edges(),function(W){if(u.hasNode(W.v)!==u.hasNode(W.w))return Is(P,W)})}function uo(u,P,W){Bt.forEach(u.nodes(),function($){P.node($).rank+=W})}var Os=As,mc=Oo,Fu=Po.alg.preorder,Jc=Po.alg.postorder,Ys=ha.simplify,ti=_o;function _o(u){u=Ys(u),mc(u);var P,W=Xs(u);for(gu(W),pu(W,u);P=Xo(W);)yu(W,u,P,Gl(W,u,P))}function pu(u,P){var W=Jc(u,u.nodes());W=W.slice(0,W.length-1),Bt.forEach(W,function($){(function(oe,ue,pe){var _e=oe.node(pe).parent;oe.edge(pe,_e).cutvalue=qc(oe,ue,pe)})(u,P,$)})}function qc(u,P,W){var $=u.node(W).parent,oe=!0,ue=P.edge(W,$),pe=0;return ue||(oe=!1,ue=P.edge($,W)),pe=ue.weight,Bt.forEach(P.nodeEdges(W),function(_e){var Te,Re,Ze=_e.v===W,je=Ze?_e.w:_e.v;if(je!==$){var ht=Ze===oe,zt=P.edge(_e).weight;if(pe+=ht?zt:-zt,Te=W,Re=je,u.hasEdge(Te,Re)){var wr=u.edge(W,je).cutvalue;pe+=ht?-wr:wr}}}),pe}function gu(u,P){arguments.length<2&&(P=u.nodes()[0]),ef(u,{},1,P)}function ef(u,P,W,$,oe){var ue=W,pe=u.node($);return P[$]=!0,Bt.forEach(u.neighbors($),function(_e){Bt.has(P,_e)||(W=ef(u,P,W,_e,$))}),pe.low=ue,pe.lim=W++,oe?pe.parent=oe:delete pe.parent,W}function Xo(u){return Bt.find(u.edges(),function(P){return u.edge(P).cutvalue<0})}function Gl(u,P,W){var $=W.v,oe=W.w;P.hasEdge($,oe)||($=W.w,oe=W.v);var ue=u.node($),pe=u.node(oe),_e=ue,Te=!1;ue.lim>pe.lim&&(_e=pe,Te=!0);var Re=Bt.filter(P.edges(),function(Ze){return Te===Fl(u,u.node(Ze.v),_e)&&Te!==Fl(u,u.node(Ze.w),_e)});return Bt.minBy(Re,function(Ze){return Os(P,Ze)})}function yu(u,P,W,$){var oe=W.v,ue=W.w;u.removeEdge(oe,ue),u.setEdge($.v,$.w,{}),gu(u),pu(u,P),function(pe,_e){var Te=Bt.find(pe.nodes(),function(Ze){return!_e.node(Ze).parent}),Re=Fu(pe,Te);Re=Re.slice(1),Bt.forEach(Re,function(Ze){var je=pe.node(Ze).parent,ht=_e.edge(Ze,je),zt=!1;ht||(ht=_e.edge(je,Ze),zt=!0),_e.node(Ze).rank=_e.node(je).rank+(zt?ht.minlen:-ht.minlen)})}(u,P)}function Fl(u,P,W){return W.low<=P.lim&&P.lim<=W.lim}_o.initLowLimValues=gu,_o.initCutValues=pu,_o.calcCutValue=qc,_o.leaveEdge=Xo,_o.enterEdge=Gl,_o.exchangeEdges=yu;var ds=Oo,Uu=function(u){switch(u.graph().ranker){case"network-simplex":va(u);break;case"tight-tree":(function(P){ds(P),Xs(P)})(u);break;case"longest-path":hs(u);break;default:va(u)}},hs=ds;function va(u){ti(u)}var bc=function(u){var P=function(W){var $={},oe=0;function ue(pe){var _e=oe;Bt.forEach(W.children(pe),ue),$[pe]={low:_e,lim:oe++}}return Bt.forEach(W.children(),ue),$}(u);Bt.forEach(u.graph().dummyChains,function(W){for(var $=u.node(W),oe=$.edgeObj,ue=function(je,ht,zt,wr){var Kt,qt,Qt=[],Xr=[],Yr=Math.min(ht[zt].low,ht[wr].low),Kr=Math.max(ht[zt].lim,ht[wr].lim);Kt=zt;do Kt=je.parent(Kt),Qt.push(Kt);while(Kt&&(ht[Kt].low>Yr||Kr>ht[Kt].lim));for(qt=Kt,Kt=wr;(Kt=je.parent(Kt))!==qt;)Xr.push(Kt);return{path:Qt.concat(Xr.reverse()),lca:qt}}(u,P,oe.v,oe.w),pe=ue.path,_e=ue.lca,Te=0,Re=pe[Te],Ze=!0;W!==oe.w;){if($=u.node(W),Ze){for(;(Re=pe[Te])!==_e&&u.node(Re).maxRank<$.rank;)Te++;Re===_e&&(Ze=!1)}if(!Ze){for(;Te<pe.length-1&&u.node(Re=pe[Te+1]).minRank<=$.rank;)Te++;Re=pe[Te]}u.setParent(W,Re),W=u.successors(W)[0]}})},Ds={run:function(u){var P=ha.addDummyNode(u,"root",{},"_root"),W=function(pe){var _e={};function Te(Re,Ze){var je=pe.children(Re);je&&je.length&&Bt.forEach(je,function(ht){Te(ht,Ze+1)}),_e[Re]=Ze}return Bt.forEach(pe.children(),function(Re){Te(Re,1)}),_e}(u),$=Bt.max(Bt.values(W))-1,oe=2*$+1;u.graph().nestingRoot=P,Bt.forEach(u.edges(),function(pe){u.edge(pe).minlen*=oe});var ue=function(pe){return Bt.reduce(pe.edges(),function(_e,Te){return _e+pe.edge(Te).weight},0)}(u)+1;Bt.forEach(u.children(),function(pe){zu(u,P,oe,ue,$,W,pe)}),u.graph().nodeRankFactor=oe},cleanup:function(u){var P=u.graph();u.removeNode(P.nestingRoot),delete P.nestingRoot,Bt.forEach(u.edges(),function(W){u.edge(W).nestingEdge&&u.removeEdge(W)})}};function zu(u,P,W,$,oe,ue,pe){var _e=u.children(pe);if(_e.length){var Te=ha.addBorderNode(u,"_bt"),Re=ha.addBorderNode(u,"_bb"),Ze=u.node(pe);u.setParent(Te,pe),Ze.borderTop=Te,u.setParent(Re,pe),Ze.borderBottom=Re,Bt.forEach(_e,function(je){zu(u,P,W,$,oe,ue,je);var ht=u.node(je),zt=ht.borderTop?ht.borderTop:je,wr=ht.borderBottom?ht.borderBottom:je,Kt=ht.borderTop?$:2*$,qt=zt!==wr?1:oe-ue[pe]+1;u.setEdge(Te,zt,{weight:Kt,minlen:qt,nestingEdge:!0}),u.setEdge(wr,Re,{weight:Kt,minlen:qt,nestingEdge:!0})}),u.parent(pe)||u.setEdge(P,Te,{weight:0,minlen:oe+ue[pe]})}else pe!==P&&u.setEdge(P,pe,{weight:0,minlen:W})}var tf=function(u){Bt.forEach(u.children(),function P(W){var $=u.children(W),oe=u.node(W);if($.length&&Bt.forEach($,P),Bt.has(oe,"minRank")){oe.borderLeft=[],oe.borderRight=[];for(var ue=oe.minRank,pe=oe.maxRank+1;ue<pe;++ue)Yo(u,"borderLeft","_bl",W,oe,ue),Yo(u,"borderRight","_br",W,oe,ue)}})};function Yo(u,P,W,$,oe,ue){var pe={width:0,height:0,rank:ue,borderType:P},_e=oe[P][ue-1],Te=ha.addDummyNode(u,"border",pe,W);oe[P][ue]=Te,u.setParent(Te,$),_e&&u.setEdge(_e,Te,{weight:1})}var Zs={adjust:function(u){var P=u.graph().rankdir.toLowerCase();P!=="lr"&&P!=="rl"||Ba(u)},undo:function(u){var P=u.graph().rankdir.toLowerCase();P!=="bt"&&P!=="rl"||function(W){Bt.forEach(W.nodes(),function($){co(W.node($))}),Bt.forEach(W.edges(),function($){var oe=W.edge($);Bt.forEach(oe.points,co),Bt.has(oe,"y")&&co(oe)})}(u),P!=="lr"&&P!=="rl"||(function(W){Bt.forEach(W.nodes(),function($){Ns(W.node($))}),Bt.forEach(W.edges(),function($){var oe=W.edge($);Bt.forEach(oe.points,Ns),Bt.has(oe,"x")&&Ns(oe)})}(u),Ba(u))}};function Ba(u){Bt.forEach(u.nodes(),function(P){Ja(u.node(P))}),Bt.forEach(u.edges(),function(P){Ja(u.edge(P))})}function Ja(u){var P=u.width;u.width=u.height,u.height=P}function co(u){u.y=-u.y}function Ns(u){var P=u.x;u.x=u.y,u.y=P}var Ec=function(u){var P={},W=Bt.filter(u.nodes(),function(_e){return!u.children(_e).length}),$=Bt.max(Bt.map(W,function(_e){return u.node(_e).rank})),oe=Bt.map(Bt.range($+1),function(){return[]});function ue(_e){if(!Bt.has(P,_e)){P[_e]=!0;var Te=u.node(_e);oe[Te.rank].push(_e),Bt.forEach(u.successors(_e),ue)}}var pe=Bt.sortBy(W,function(_e){return u.node(_e).rank});return Bt.forEach(pe,ue),oe},Hs=function(u,P){for(var W=0,$=1;$<P.length;++$)W+=Wu(u,P[$-1],P[$]);return W};function Wu(u,P,W){for(var $=Bt.zipObject(W,Bt.map(W,function(Re,Ze){return Ze})),oe=Bt.flatten(Bt.map(P,function(Re){return Bt.sortBy(Bt.map(u.outEdges(Re),function(Ze){return{pos:$[Ze.w],weight:u.edge(Ze).weight}}),"pos")}),!0),ue=1;ue<W.length;)ue<<=1;var pe=2*ue-1;ue-=1;var _e=Bt.map(new Array(pe),function(){return 0}),Te=0;return Bt.forEach(oe.forEach(function(Re){var Ze=Re.pos+ue;_e[Ze]+=Re.weight;for(var je=0;Ze>0;)Ze%2&&(je+=_e[Ze+1]),_e[Ze=Ze-1>>1]+=Re.weight;Te+=Re.weight*je})),Te}var Kf=function(u,P){return Bt.map(P,function(W){var $=u.inEdges(W);if($.length){var oe=Bt.reduce($,function(ue,pe){var _e=u.edge(pe),Te=u.node(pe.v);return{sum:ue.sum+_e.weight*Te.order,weight:ue.weight+_e.weight}},{sum:0,weight:0});return{v:W,barycenter:oe.sum/oe.weight,weight:oe.weight}}return{v:W}})},rf=function(u,P){var W={};return Bt.forEach(u,function($,oe){var ue=W[$.v]={indegree:0,in:[],out:[],vs:[$.v],i:oe};Bt.isUndefined($.barycenter)||(ue.barycenter=$.barycenter,ue.weight=$.weight)}),Bt.forEach(P.edges(),function($){var oe=W[$.v],ue=W[$.w];Bt.isUndefined(oe)||Bt.isUndefined(ue)||(ue.indegree++,oe.out.push(W[$.w]))}),function($){var oe=[];function ue(Te){return function(Re){Re.merged||(Bt.isUndefined(Re.barycenter)||Bt.isUndefined(Te.barycenter)||Re.barycenter>=Te.barycenter)&&function(Ze,je){var ht=0,zt=0;Ze.weight&&(ht+=Ze.barycenter*Ze.weight,zt+=Ze.weight),je.weight&&(ht+=je.barycenter*je.weight,zt+=je.weight),Ze.vs=je.vs.concat(Ze.vs),Ze.barycenter=ht/zt,Ze.weight=zt,Ze.i=Math.min(je.i,Ze.i),je.merged=!0}(Te,Re)}}function pe(Te){return function(Re){Re.in.push(Te),--Re.indegree==0&&$.push(Re)}}for(;$.length;){var _e=$.pop();oe.push(_e),Bt.forEach(_e.in.reverse(),ue(_e)),Bt.forEach(_e.out,pe(_e))}return Bt.map(Bt.filter(oe,function(Te){return!Te.merged}),function(Te){return Bt.pick(Te,["vs","i","barycenter","weight"])})}(Bt.filter(W,function($){return!$.indegree}))},_c=function(u,P){var W=ha.partition(u,function(je){return Bt.has(je,"barycenter")}),$=W.lhs,oe=Bt.sortBy(W.rhs,function(je){return-je.i}),ue=[],pe=0,_e=0,Te=0;$.sort((Re=!!P,function(je,ht){return je.barycenter<ht.barycenter?-1:je.barycenter>ht.barycenter?1:Re?ht.i-je.i:je.i-ht.i})),Te=Ks(ue,oe,Te),Bt.forEach($,function(je){Te+=je.vs.length,ue.push(je.vs),pe+=je.barycenter*je.weight,_e+=je.weight,Te=Ks(ue,oe,Te)});var Re,Ze={vs:Bt.flatten(ue,!0)};return _e&&(Ze.barycenter=pe/_e,Ze.weight=_e),Ze};function Ks(u,P,W){for(var $;P.length&&($=Bt.last(P)).i<=W;)P.pop(),u.push($.vs),W++;return W}var $f=function u(P,W,$,oe){var ue=P.children(W),pe=P.node(W),_e=pe?pe.borderLeft:void 0,Te=pe?pe.borderRight:void 0,Re={};_e&&(ue=Bt.filter(ue,function(Kt){return Kt!==_e&&Kt!==Te}));var Ze=Kf(P,ue);Bt.forEach(Ze,function(Kt){if(P.children(Kt.v).length){var qt=u(P,Kt.v,$,oe);Re[Kt.v]=qt,Bt.has(qt,"barycenter")&&(Qt=Kt,Xr=qt,Bt.isUndefined(Qt.barycenter)?(Qt.barycenter=Xr.barycenter,Qt.weight=Xr.weight):(Qt.barycenter=(Qt.barycenter*Qt.weight+Xr.barycenter*Xr.weight)/(Qt.weight+Xr.weight),Qt.weight+=Xr.weight))}var Qt,Xr});var je=rf(Ze,$);(function(Kt,qt){Bt.forEach(Kt,function(Qt){Qt.vs=Bt.flatten(Qt.vs.map(function(Xr){return qt[Xr]?qt[Xr].vs:Xr}),!0)})})(je,Re);var ht=_c(je,oe);if(_e&&(ht.vs=Bt.flatten([_e,ht.vs,Te],!0),P.predecessors(_e).length)){var zt=P.node(P.predecessors(_e)[0]),wr=P.node(P.predecessors(Te)[0]);Bt.has(ht,"barycenter")||(ht.barycenter=0,ht.weight=0),ht.barycenter=(ht.barycenter*ht.weight+zt.order+wr.order)/(ht.weight+2),ht.weight+=2}return ht},nf=Po.Graph,xc=function(u,P,W){var $=function(ue){for(var pe;ue.hasNode(pe=Bt.uniqueId("_root")););return pe}(u),oe=new nf({compound:!0}).setGraph({root:$}).setDefaultNodeLabel(function(ue){return u.node(ue)});return Bt.forEach(u.nodes(),function(ue){var pe=u.node(ue),_e=u.parent(ue);(pe.rank===P||pe.minRank<=P&&P<=pe.maxRank)&&(oe.setNode(ue),oe.setParent(ue,_e||$),Bt.forEach(u[W](ue),function(Te){var Re=Te.v===ue?Te.w:Te.v,Ze=oe.edge(Re,ue),je=Bt.isUndefined(Ze)?0:Ze.weight;oe.setEdge(Re,ue,{weight:u.edge(Te).weight+je})}),Bt.has(pe,"minRank")&&oe.setNode(ue,{borderLeft:pe.borderLeft[P],borderRight:pe.borderRight[P]}))}),oe},Di=function(u,P,W){var $,oe={};Bt.forEach(W,function(ue){for(var pe,_e,Te=u.parent(ue);Te;){if((pe=u.parent(Te))?(_e=oe[pe],oe[pe]=Te):(_e=$,$=Te),_e&&_e!==Te)return void P.setEdge(_e,Te);Te=pe}})},ju=Po.Graph,vs=function(u){var P=ha.maxRank(u),W=Vu(u,Bt.range(1,P+1),"inEdges"),$=Vu(u,Bt.range(P-1,-1,-1),"outEdges"),oe=Ec(u);Yi(u,oe);for(var ue,pe=Number.POSITIVE_INFINITY,_e=0,Te=0;Te<4;++_e,++Te){Xu(_e%2?W:$,_e%4>=2),oe=ha.buildLayerMatrix(u);var Re=Hs(u,oe);Re<pe&&(Te=0,ue=Bt.cloneDeep(oe),pe=Re)}Yi(u,ue)};function Vu(u,P,W){return Bt.map(P,function($){return xc(u,$,W)})}function Xu(u,P){var W=new ju;Bt.forEach(u,function($){var oe=$.graph().root,ue=$f($,oe,W,P);Bt.forEach(ue.vs,function(pe,_e){$.node(pe).order=_e}),Di($,W,ue.vs)})}function Yi(u,P){Bt.forEach(P,function(W){Bt.forEach(W,function($,oe){u.node($).order=oe})})}var Ul=Po.Graph,Sc=function(u){var P,W=ha.buildLayerMatrix(u),$=Bt.merge(mu(u,W),Qn(u,W)),oe={};Bt.forEach(["u","d"],function(pe){P=pe==="u"?W:Bt.values(W).reverse(),Bt.forEach(["l","r"],function(_e){_e==="r"&&(P=Bt.map(P,function(je){return Bt.values(je).reverse()}));var Te=(pe==="u"?u.predecessors:u.successors).bind(u),Re=cd(u,P,$,Te),Ze=zl(u,P,Re.root,Re.align,_e==="r");_e==="r"&&(Ze=Bt.mapValues(Ze,function(je){return-je})),oe[pe+_e]=Ze})});var ue=$s(u,oe);return Wl(oe,ue),jl(oe,u.graph().align)};function mu(u,P){var W={};return Bt.reduce(P,function($,oe){var ue=0,pe=0,_e=$.length,Te=Bt.last(oe);return Bt.forEach(oe,function(Re,Ze){var je=function(zt,wr){if(zt.node(wr).dummy)return Bt.find(zt.predecessors(wr),function(Kt){return zt.node(Kt).dummy})}(u,Re),ht=je?u.node(je).order:_e;(je||Re===Te)&&(Bt.forEach(oe.slice(pe,Ze+1),function(zt){Bt.forEach(u.predecessors(zt),function(wr){var Kt=u.node(wr),qt=Kt.order;!(qt<ue||ht<qt)||Kt.dummy&&u.node(zt).dummy||af(W,wr,zt)})}),pe=Ze+1,ue=ht)}),oe}),W}function Qn(u,P){var W={};function $(oe,ue,pe,_e,Te){var Re;Bt.forEach(Bt.range(ue,pe),function(Ze){Re=oe[Ze],u.node(Re).dummy&&Bt.forEach(u.predecessors(Re),function(je){var ht=u.node(je);ht.dummy&&(ht.order<_e||ht.order>Te)&&af(W,je,Re)})})}return Bt.reduce(P,function(oe,ue){var pe,_e=-1,Te=0;return Bt.forEach(ue,function(Re,Ze){if(u.node(Re).dummy==="border"){var je=u.predecessors(Re);je.length&&(pe=u.node(je[0]).order,$(ue,Te,Ze,_e,pe),Te=Ze,_e=pe)}$(ue,Te,ue.length,pe,oe.length)}),ue}),W}function af(u,P,W){if(P>W){var $=P;P=W,W=$}var oe=u[P];oe||(u[P]=oe={}),oe[W]=!0}function fo(u,P,W){if(P>W){var $=P;P=W,W=$}return Bt.has(u[P],W)}function cd(u,P,W,$){var oe={},ue={},pe={};return Bt.forEach(P,function(_e){Bt.forEach(_e,function(Te,Re){oe[Te]=Te,ue[Te]=Te,pe[Te]=Re})}),Bt.forEach(P,function(_e){var Te=-1;Bt.forEach(_e,function(Re){var Ze=$(Re);if(Ze.length)for(var je=((Ze=Bt.sortBy(Ze,function(Kt){return pe[Kt]})).length-1)/2,ht=Math.floor(je),zt=Math.ceil(je);ht<=zt;++ht){var wr=Ze[ht];ue[Re]===Re&&Te<pe[wr]&&!fo(W,Re,wr)&&(ue[wr]=Re,ue[Re]=oe[Re]=oe[wr],Te=pe[wr])}})}),{root:oe,align:ue}}function zl(u,P,W,$,oe){var ue={},pe=function(Re,Ze,je,ht){var zt=new Ul,wr=Re.graph(),Kt=function(qt,Qt,Xr){return function(Yr,Kr,Cn){var Sn,Rn=Yr.node(Kr),jn=Yr.node(Cn),kn=0;if(kn+=Rn.width/2,Bt.has(Rn,"labelpos"))switch(Rn.labelpos.toLowerCase()){case"l":Sn=-Rn.width/2;break;case"r":Sn=Rn.width/2}if(Sn&&(kn+=Xr?Sn:-Sn),Sn=0,kn+=(Rn.dummy?Qt:qt)/2,kn+=(jn.dummy?Qt:qt)/2,kn+=jn.width/2,Bt.has(jn,"labelpos"))switch(jn.labelpos.toLowerCase()){case"l":Sn=jn.width/2;break;case"r":Sn=-jn.width/2}return Sn&&(kn+=Xr?Sn:-Sn),Sn=0,kn}}(wr.nodesep,wr.edgesep,ht);return Bt.forEach(Ze,function(qt){var Qt;Bt.forEach(qt,function(Xr){var Yr=je[Xr];if(zt.setNode(Yr),Qt){var Kr=je[Qt],Cn=zt.edge(Kr,Yr);zt.setEdge(Kr,Yr,Math.max(Kt(Re,Xr,Qt),Cn||0))}Qt=Xr})}),zt}(u,P,W,oe),_e=oe?"borderLeft":"borderRight";function Te(Re,Ze){for(var je=pe.nodes(),ht=je.pop(),zt={};ht;)zt[ht]?Re(ht):(zt[ht]=!0,je.push(ht),je=je.concat(Ze(ht))),ht=je.pop()}return Te(function(Re){ue[Re]=pe.inEdges(Re).reduce(function(Ze,je){return Math.max(Ze,ue[je.v]+pe.edge(je))},0)},pe.predecessors.bind(pe)),Te(function(Re){var Ze=pe.outEdges(Re).reduce(function(ht,zt){return Math.min(ht,ue[zt.w]-pe.edge(zt))},Number.POSITIVE_INFINITY),je=u.node(Re);Ze!==Number.POSITIVE_INFINITY&&je.borderType!==_e&&(ue[Re]=Math.max(ue[Re],Ze))},pe.successors.bind(pe)),Bt.forEach($,function(Re){ue[Re]=ue[W[Re]]}),ue}function $s(u,P){return Bt.minBy(Bt.values(P),function(W){var $=Number.NEGATIVE_INFINITY,oe=Number.POSITIVE_INFINITY;return Bt.forIn(W,function(ue,pe){var _e=function(Te,Re){return Te.node(Re).width}(u,pe)/2;$=Math.max(ue+_e,$),oe=Math.min(ue-_e,oe)}),$-oe})}function Wl(u,P){var W=Bt.values(P),$=Bt.min(W),oe=Bt.max(W);Bt.forEach(["u","d"],function(ue){Bt.forEach(["l","r"],function(pe){var _e,Te=ue+pe,Re=u[Te];if(Re!==P){var Ze=Bt.values(Re);(_e=pe==="l"?$-Bt.min(Ze):oe-Bt.max(Ze))&&(u[Te]=Bt.mapValues(Re,function(je){return je+_e}))}})})}function jl(u,P){return Bt.mapValues(u.ul,function(W,$){if(P)return u[P.toLowerCase()][$];var oe=Bt.sortBy(Bt.map(u,$));return(oe[1]+oe[2])/2})}var Yu=Sc,fd=function(u){(function(P){var W=ha.buildLayerMatrix(P),$=P.graph().ranksep,oe=0;Bt.forEach(W,function(ue){var pe=Bt.max(Bt.map(ue,function(_e){return P.node(_e).height}));Bt.forEach(ue,function(_e){P.node(_e).y=oe+pe/2}),oe+=pe+$})})(u=ha.asNonCompoundGraph(u)),Bt.forEach(Yu(u),function(P,W){u.node(W).x=P})},Vl=ha.normalizeRanks,ld=ha.removeEmptyRanks,Ua=ha,of=Po.Graph,bu=function(u,P){var W=P&&P.debugTiming?Ua.time:Ua.notime;W("layout",function(){var $=W(" buildLayoutGraph",function(){return function(oe){var ue=new of({multigraph:!0,compound:!0}),pe=uf(oe.graph());return ue.setGraph(Bt.merge({},Xl,Ji(pe,Qs),Bt.pick(pe,Qf))),Bt.forEach(oe.nodes(),function(_e){var Te=uf(oe.node(_e));ue.setNode(_e,Bt.defaults(Ji(Te,sf),Jf)),ue.setParent(_e,oe.parent(_e))}),Bt.forEach(oe.edges(),function(_e){var Te=uf(oe.edge(_e));ue.setEdge(_e,Bt.merge({},Js,Ji(Te,ro),Bt.pick(Te,oi)))}),ue}(u)});W(" runLayout",function(){(function(oe,ue){ue(" makeSpaceForEdgeLabels",function(){(function(pe){var _e=pe.graph();_e.ranksep/=2,Bt.forEach(pe.edges(),function(Te){var Re=pe.edge(Te);Re.minlen*=2,Re.labelpos.toLowerCase()!=="c"&&(_e.rankdir==="TB"||_e.rankdir==="BT"?Re.width+=Re.labeloffset:Re.height+=Re.labeloffset)})})(oe)}),ue(" removeSelfEdges",function(){(function(pe){Bt.forEach(pe.edges(),function(_e){if(_e.v===_e.w){var Te=pe.node(_e.v);Te.selfEdges||(Te.selfEdges=[]),Te.selfEdges.push({e:_e,label:pe.edge(_e)}),pe.removeEdge(_e)}})})(oe)}),ue(" acyclic",function(){Hf.run(oe)}),ue(" nestingGraph.run",function(){Ds.run(oe)}),ue(" rank",function(){Uu(Ua.asNonCompoundGraph(oe))}),ue(" injectEdgeLabelProxies",function(){(function(pe){Bt.forEach(pe.edges(),function(_e){var Te=pe.edge(_e);if(Te.width&&Te.height){var Re=pe.node(_e.v),Ze={rank:(pe.node(_e.w).rank-Re.rank)/2+Re.rank,e:_e};Ua.addDummyNode(pe,"edge-proxy",Ze,"_ep")}})})(oe)}),ue(" removeEmptyRanks",function(){ld(oe)}),ue(" nestingGraph.cleanup",function(){Ds.cleanup(oe)}),ue(" normalizeRanks",function(){Vl(oe)}),ue(" assignRankMinMax",function(){(function(pe){var _e=0;Bt.forEach(pe.nodes(),function(Te){var Re=pe.node(Te);Re.borderTop&&(Re.minRank=pe.node(Re.borderTop).rank,Re.maxRank=pe.node(Re.borderBottom).rank,_e=Bt.max(_e,Re.maxRank))}),pe.graph().maxRank=_e})(oe)}),ue(" removeEdgeLabelProxies",function(){(function(pe){Bt.forEach(pe.nodes(),function(_e){var Te=pe.node(_e);Te.dummy==="edge-proxy"&&(pe.edge(Te.e).labelRank=Te.rank,pe.removeNode(_e))})})(oe)}),ue(" normalize.run",function(){Gu.run(oe)}),ue(" parentDummyChains",function(){bc(oe)}),ue(" addBorderSegments",function(){tf(oe)}),ue(" order",function(){vs(oe)}),ue(" insertSelfEdges",function(){(function(pe){var _e=Ua.buildLayerMatrix(pe);Bt.forEach(_e,function(Te){var Re=0;Bt.forEach(Te,function(Ze,je){var ht=pe.node(Ze);ht.order=je+Re,Bt.forEach(ht.selfEdges,function(zt){Ua.addDummyNode(pe,"selfedge",{width:zt.label.width,height:zt.label.height,rank:ht.rank,order:je+ ++Re,e:zt.e,label:zt.label},"_se")}),delete ht.selfEdges})})})(oe)}),ue(" adjustCoordinateSystem",function(){Zs.adjust(oe)}),ue(" position",function(){fd(oe)}),ue(" positionSelfEdges",function(){(function(pe){Bt.forEach(pe.nodes(),function(_e){var Te=pe.node(_e);if(Te.dummy==="selfedge"){var Re=pe.node(Te.e.v),Ze=Re.x+Re.width/2,je=Re.y,ht=Te.x-Ze,zt=Re.height/2;pe.setEdge(Te.e,Te.label),pe.removeNode(_e),Te.label.points=[{x:Ze+2*ht/3,y:je-zt},{x:Ze+5*ht/6,y:je-zt},{x:Ze+ht,y:je},{x:Ze+5*ht/6,y:je+zt},{x:Ze+2*ht/3,y:je+zt}],Te.label.x=Te.x,Te.label.y=Te.y}})})(oe)}),ue(" removeBorderNodes",function(){(function(pe){Bt.forEach(pe.nodes(),function(_e){if(pe.children(_e).length){var Te=pe.node(_e),Re=pe.node(Te.borderTop),Ze=pe.node(Te.borderBottom),je=pe.node(Bt.last(Te.borderLeft)),ht=pe.node(Bt.last(Te.borderRight));Te.width=Math.abs(ht.x-je.x),Te.height=Math.abs(Ze.y-Re.y),Te.x=je.x+Te.width/2,Te.y=Re.y+Te.height/2}}),Bt.forEach(pe.nodes(),function(_e){pe.node(_e).dummy==="border"&&pe.removeNode(_e)})})(oe)}),ue(" normalize.undo",function(){Gu.undo(oe)}),ue(" fixupEdgeLabelCoords",function(){(function(pe){Bt.forEach(pe.edges(),function(_e){var Te=pe.edge(_e);if(Bt.has(Te,"x"))switch(Te.labelpos!=="l"&&Te.labelpos!=="r"||(Te.width-=Te.labeloffset),Te.labelpos){case"l":Te.x-=Te.width/2+Te.labeloffset;break;case"r":Te.x+=Te.width/2+Te.labeloffset}})})(oe)}),ue(" undoCoordinateSystem",function(){Zs.undo(oe)}),ue(" translateGraph",function(){(function(pe){var _e=Number.POSITIVE_INFINITY,Te=0,Re=Number.POSITIVE_INFINITY,Ze=0,je=pe.graph(),ht=je.marginx||0,zt=je.marginy||0;function wr(Kt){var qt=Kt.x,Qt=Kt.y,Xr=Kt.width,Yr=Kt.height;_e=Math.min(_e,qt-Xr/2),Te=Math.max(Te,qt+Xr/2),Re=Math.min(Re,Qt-Yr/2),Ze=Math.max(Ze,Qt+Yr/2)}Bt.forEach(pe.nodes(),function(Kt){wr(pe.node(Kt))}),Bt.forEach(pe.edges(),function(Kt){var qt=pe.edge(Kt);Bt.has(qt,"x")&&wr(qt)}),_e-=ht,Re-=zt,Bt.forEach(pe.nodes(),function(Kt){var qt=pe.node(Kt);qt.x-=_e,qt.y-=Re}),Bt.forEach(pe.edges(),function(Kt){var qt=pe.edge(Kt);Bt.forEach(qt.points,function(Qt){Qt.x-=_e,Qt.y-=Re}),Bt.has(qt,"x")&&(qt.x-=_e),Bt.has(qt,"y")&&(qt.y-=Re)}),je.width=Te-_e+ht,je.height=Ze-Re+zt})(oe)}),ue(" assignNodeIntersects",function(){(function(pe){Bt.forEach(pe.edges(),function(_e){var Te,Re,Ze=pe.edge(_e),je=pe.node(_e.v),ht=pe.node(_e.w);Ze.points?(Te=Ze.points[0],Re=Ze.points[Ze.points.length-1]):(Ze.points=[],Te=ht,Re=je),Ze.points.unshift(Ua.intersectRect(je,Te)),Ze.points.push(Ua.intersectRect(ht,Re))})})(oe)}),ue(" reversePoints",function(){(function(pe){Bt.forEach(pe.edges(),function(_e){var Te=pe.edge(_e);Te.reversed&&Te.points.reverse()})})(oe)}),ue(" acyclic.undo",function(){Hf.undo(oe)})})($,W)}),W(" updateInputGraph",function(){(function(oe,ue){Bt.forEach(oe.nodes(),function(pe){var _e=oe.node(pe),Te=ue.node(pe);_e&&(_e.x=Te.x,_e.y=Te.y,ue.children(pe).length&&(_e.width=Te.width,_e.height=Te.height))}),Bt.forEach(oe.edges(),function(pe){var _e=oe.edge(pe),Te=ue.edge(pe);_e.points=Te.points,Bt.has(Te,"x")&&(_e.x=Te.x,_e.y=Te.y)}),oe.graph().width=ue.graph().width,oe.graph().height=ue.graph().height})(u,$)})})},Qs=["nodesep","edgesep","ranksep","marginx","marginy"],Xl={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Qf=["acyclicer","ranker","rankdir","align"],sf=["width","height"],Jf={width:0,height:0},ro=["minlen","weight","width","height","labeloffset"],Js={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},oi=["labelpos"];function Ji(u,P){return Bt.mapValues(Bt.pick(u,P),Number)}function uf(u){var P={};return Bt.forEach(u,function(W,$){P[$.toLowerCase()]=W}),P}var Yl=Po.Graph,Zl={graphlib:Po,layout:bu,debug:{debugOrdering:function(u){var P=ha.buildLayerMatrix(u),W=new Yl({compound:!0,multigraph:!0}).setGraph({});return Bt.forEach(u.nodes(),function($){W.setNode($,{label:$}),W.setParent($,"layer"+u.node($).rank)}),Bt.forEach(u.edges(),function($){W.setEdge($.v,$.w,{},$.name)}),Bt.forEach(P,function($,oe){var ue="layer"+oe;W.setNode(ue,{rank:"same"}),Bt.reduce($,function(pe,_e){return W.setEdge(pe,_e,{style:"invis"}),_e})}),W}},util:{time:ha.time,notime:ha.notime},version:"0.8.5"},dd=Zl.graphlib,hd=Zl.layout;class Zu{constructor(P){this.cardinality=1,this.include=v.UNSPECIFIED,this.isGroupNode=!1,this.parentNode=null,this.type=A.NODE,this.name=P.name,this.attr=P.attr||{},this.inputs=P.inputs,this.path=P.path||[],this.width=P.width,this.height=P.height}}class wc{constructor(){this.nodes={},this.edges=[],this.nodes={},this.edges=[]}}function qf(u){const P=new wc;return u.nodes.map(W=>new Zu(W)).forEach(W=>{P.nodes[W.name]=W,W.inputs.forEach($=>{(function(oe,ue,pe){pe.name!==ue.name&&oe.edges.push(Object.assign(Object.assign({},pe.attr),{v:pe.name,w:ue.name}))})(P,W,$)})}),P}class vd{constructor(P,W={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=v.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=A.META,this.path=[],this.name=P,this.metaGraph=ff(P,p.META,W)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map(P=>this.metaGraph.node(P))}leaves(){let P,W=[],$=[this];for(;$.length;){let oe=$.shift();oe.isGroupNode?(P=oe.metaGraph,P.nodes().forEach(ue=>$.push(P.node(ue)))):W.push(oe.name)}return W}}class Hl{constructor(P,W){this.v=P,this.w=W,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(P,W){this.baseEdgeList.push(P)}}function Mc(u,P={}){return new vd(u,P)}function cf(u,P){return new Hl(u,P)}function ff(u,P,W){const $=W||{},oe=new dd.Graph($);return oe.setGraph({name:u,rankdir:$.rankdir,type:P,align:$.align}),oe}class Kl{constructor(P={}){this.graphOptions=P,this.index={},this.graphOptions.compound=!0,this.root=Mc(E,this.graphOptions),this.index[E]=this.root}getNodeMap(){return this.index}node(P){return this.index[P]}setNode(P,W){this.index[P]=W}getBridgeGraph(P){const W=this.index[P];if(!W)throw Error("Could not find node in hierarchy: "+P);if(!("metaGraph"in W))return null;const $=W;if($.bridgeGraph)return $.bridgeGraph;const oe=ff(I,p.BRIDGE,this.graphOptions);if($.bridgeGraph=oe,!W.parentNode||!("metaGraph"in W.parentNode))return oe;const ue=W.parentNode;return[ue.metaGraph,this.getBridgeGraph(ue.name)].forEach(pe=>{pe.edges().filter(_e=>_e.v===P||_e.w===P).forEach(_e=>{const Te=_e.w===P;pe.edge(_e).baseEdgeList.forEach(Re=>{const[Ze,je]=Te?[Re.w,_e.v]:[Re.v,_e.w],ht=this.getChildName(P,Ze),zt={v:Te?je:ht,w:Te?ht:je};let wr=oe.edge(zt);wr||(wr=cf(zt.v,zt.w),wr.inbound=Te,oe.setEdge(zt.v,zt.w,wr)),wr.addBaseEdge(Re,this)})})}),oe}getChildName(P,W){let $=this.index[W];for(;$;){if($.parentNode&&$.parentNode.name===P)return $.name;$=$.parentNode}throw Error("Could not find immediate child for descendant: "+W)}getPredecessors(P){const W=this.index[P];if(!W)throw Error("Could not find node with name: "+P);return this.getOneWayEdges(W,!0)}getSuccessors(P){const W=this.index[P];if(!W)throw Error("Could not find node with name: "+P);return this.getOneWayEdges(W,!1)}getOneWayEdges(P,W){const $=[];if(!P.parentNode||!P.parentNode.isGroupNode)return $;const oe=P.parentNode,ue=oe.metaGraph,pe=this.getBridgeGraph(oe.name);return Hu(ue,P,W,$),Hu(pe,P,W,$),$}}function pd(u,P){const{rankDirection:W,align:$}=P,oe=new Kl({rankdir:W,align:$});return function(ue,pe){Object.keys(pe.nodes).forEach(_e=>{const Te=pe.nodes[_e],Re=Te.path;let Ze=ue.root;Ze.depth=Math.max(Re.length,Ze.depth);for(let je=0;je<Re.length&&(Ze.depth=Math.max(Ze.depth,Re.length-je),Ze.cardinality+=Te.cardinality,je!==Re.length-1);je++){const ht=Re[je];let zt=ue.node(ht);zt||(zt=Mc(ht,ue.graphOptions),zt.path=Te.path.slice(0,je+1),zt.parentNode=Ze,ue.setNode(ht,zt),Ze.metaGraph.setNode(ht,zt)),Ze=zt}ue.setNode(Te.name,Te),Te.parentNode=Ze,Ze.metaGraph.setNode(Te.name,Te)})}(oe,u),function(ue,pe){const _e=ue.getNodeMap();let Te=[],Re=[];const Ze=(je,ht)=>{let zt=0;for(;je;)ht[zt++]=je.name,je=je.parentNode;return zt-1};pe.edges.forEach(je=>{Te=[],Re=[];let ht=Ze(pe.nodes[je.v],Te),zt=Ze(pe.nodes[je.w],Re);for(;Te[ht]===Re[zt];)if(ht--,zt--,ht<0||zt<0)throw Error("No difference found between ancestor paths.");const wr=_e[Te[ht+1]],Kt=Te[ht],qt=Re[zt];let Qt=wr.metaGraph.edge(Kt,qt);Qt||(Qt=cf(Kt,qt),wr.metaGraph.setEdge(Kt,qt,Qt)),Qt.addBaseEdge(je,ue)})}(oe,u),oe}function Hu(u,P,W,$){(W?u.inEdges(P.name):u.outEdges(P.name)).forEach(oe=>{const ue=u.edge(oe);$.push(ue)})}class lf{constructor(P){this.hierarchy=P,this.index={},this.hasSubHierarchy={},this.root=new tt(this.hierarchy.root,this.hierarchy.graphOptions),this.index[P.root.name]=this.root,this.buildSubHierarchy(P.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(P){if(P in this.hasSubHierarchy)return;this.hasSubHierarchy[P]=!0;const W=this.index[P];if(W.node.type!==A.META)return;const $=W,oe=$.node.metaGraph,ue=$.coreGraph;oe.nodes().forEach(Ze=>{const je=this.getOrCreateRenderNodeByName(Ze);ue.setNode(Ze,je)}),oe.edges().forEach(Ze=>{const je=oe.edge(Ze),ht=new ge(je);ue.setEdge(Ze.v,Ze.w,ht)});const pe=$.node.parentNode;if(!pe)return;const _e=this.getRenderNodeByName(pe.name),Te=(Ze,...je)=>je.concat([Ze?"IN":"OUT"]).join("~~"),Re=this.hierarchy.getBridgeGraph(P);Re.edges().forEach(Ze=>{const je=Re.edge(Ze),ht=!!oe.node(Ze.w),[zt,wr]=ht?[Ze.w,Ze.v]:[Ze.v,Ze.w],Kt=Cn=>{const Sn=ht?{v:Cn,w:P}:{v:P,w:Cn};return _e.coreGraph.edge(Sn)};let qt=Kt(wr);qt||(qt=Kt(Te(ht,wr,pe.name)));const Qt=Te(ht,P),Xr=Te(ht,wr,P);let Yr=ue.node(Xr);if(!Yr){let Cn=ue.node(Qt);if(!Cn){const Rn={name:Qt,type:A.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:v.UNSPECIFIED,inbound:ht,attr:{}};Cn=new Cc(Rn),this.index[Qt]=Cn,ue.setNode(Qt,Cn)}const Sn={name:Xr,type:A.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:v.UNSPECIFIED,inbound:ht,attr:{}};Yr=new Cc(Sn),this.index[Xr]=Yr,ue.setNode(Xr,Yr),ue.setParent(Xr,Qt),Cn.node.cardinality++}const Kr=new ge(je);Kr.adjoiningMetaEdge=qt,ht?ue.setEdge(Xr,zt,Kr):ue.setEdge(zt,Xr,Kr)})}getOrCreateRenderNodeByName(P){if(!P)return null;if(P in this.index)return this.index[P];const W=this.getNodeByName(P);return W?(this.index[P]=W.isGroupNode?new tt(W,this.hierarchy.graphOptions):new Cc(W),this.index[P]):null}getRenderNodeByName(P){return this.index[P]}getNodeByName(P){return this.hierarchy.node(P)}}class Cc{constructor(P){this.node=P,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=P.width||0,this.height=P.height||0,this.displayName=P.name,this.attr=P.attr}}class ge{constructor(P){this.metaEdge=P,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class tt extends Cc{constructor(P,W){super(P);const $=P.metaGraph.graph();W.compound=!0,this.coreGraph=ff($.name,p.CORE,W)}}function Et(u,P){u.node.isGroupNode&&function(W,$){const oe=B($);W.coreGraph.nodes().map(ue=>W.coreGraph.node(ue)).forEach(ue=>{var pe,_e,Te,Re,Ze,je;const{height:ht,width:zt}=ue;switch(ue.node.type){case A.NODE:Object.assign(ue,oe.nodeSize.node),ue.height=ht||oe.nodeSize.node.height,ue.width=zt||oe.nodeSize.node.width;break;case A.BRIDGE:Object.assign(ue,oe.nodeSize.bridge);break;case A.META:ue.expanded?Et(ue,$):(Object.assign(ue,oe.nodeSize.meta),ue.height=oe.nodeSize.meta.height,ue.width=oe.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+ue.node.type)}if(!ue.expanded){const wr=ue.attr;(function(Kt,qt=!1){if(Kt.coreBox.width=Kt.width,Kt.coreBox.height=Kt.height,!qt){const Qt=`${Kt.displayName}`.length,Xr=3;Kt.width=Math.max(Kt.coreBox.width,Qt*Xr)}})(ue,$&&(ue.node.type===0&&!!((_e=(pe=$==null?void 0:$.nodeSize)===null||pe===void 0?void 0:pe.meta)===null||_e===void 0?void 0:_e.width)||ue.node.type===1&&(!!((Re=(Te=$==null?void 0:$.nodeSize)===null||Te===void 0?void 0:Te.node)===null||Re===void 0?void 0:Re.width)||!!wr.width)||ue.node.type===2&&!!((je=(Ze=$==null?void 0:$.nodeSize)===null||Ze===void 0?void 0:Ze.bridge)===null||je===void 0?void 0:je.width)))}})}(u,P),u.node.type===A.META&&function(W,$){const oe=B($),ue=oe.subScene.meta;Object.assign(W,ue);const{nodeSep:pe,rankSep:_e,edgeSep:Te,align:Re}=oe.graph.meta,Ze={nodesep:pe,ranksep:_e,edgesep:Te,align:Re};Object.assign(W.coreBox,function(zt,wr){const{ranksep:Kt,nodesep:qt,edgesep:Qt,align:Xr}=wr;Object.assign(zt.graph(),{ranksep:Kt,nodesep:qt,edgesep:Qt,align:Xr});const Yr=[];if(zt.nodes().forEach(jn=>{zt.node(jn).node.type!==A.BRIDGE&&Yr.push(jn)}),!Yr.length)return{width:0,height:0};hd(zt);let Kr=1/0,Cn=1/0,Sn=-1/0,Rn=-1/0;return Yr.forEach(jn=>{const kn=zt.node(jn),Bi=.5*kn.width,Xn=kn.x-Bi,qi=kn.x+Bi;Kr=Xn<Kr?Xn:Kr,Sn=qi>Sn?qi:Sn;const Oi=.5*kn.height,Kn=kn.y-Oi,Zi=kn.y+Oi;Cn=Kn<Cn?Kn:Cn,Rn=Zi>Rn?Zi:Rn}),zt.edges().forEach(jn=>{const kn=zt.edge(jn),Bi=zt.node(kn.metaEdge.v),Xn=zt.node(kn.metaEdge.w);if(kn.points.length===3&&function(Kn){let Zi=gr(Kn[0],Kn[1]);for(let Ki=1;Ki<Kn.length-1;Ki++){const ri=gr(Kn[Ki],Kn[Ki+1]);if(Math.abs(ri-Zi)>1)return!1;Zi=ri}return!0}(kn.points)){if(Bi!=null){const Kn=Bi.expanded?Bi.x:Nr(Bi);kn.points[0].x=Kn}if(Xn!=null){const Kn=Xn.expanded?Xn.x:Nr(Xn);kn.points[2].x=Kn}kn.points=[kn.points[0],kn.points[1]]}const qi=kn.points[kn.points.length-2];Xn!=null&&(kn.points[kn.points.length-1]=pr(qi,Xn));const Oi=kn.points[1];Bi!=null&&(kn.points[0]=pr(Oi,Bi)),kn.points.forEach(Kn=>{Kr=Kn.x<Kr?Kn.x:Kr,Sn=Kn.x>Sn?Kn.x:Sn,Cn=Kn.y<Cn?Kn.y:Cn,Rn=Kn.y>Rn?Kn.y:Rn})}),zt.nodes().forEach(jn=>{const kn=zt.node(jn);kn.x-=Kr,kn.y-=Cn}),zt.edges().forEach(jn=>{zt.edge(jn).points.forEach(kn=>{kn.x-=Kr,kn.y-=Cn})}),{width:Sn-Kr,height:Rn-Cn}}(W.coreGraph,Ze));let je=0;W.coreGraph.nodeCount()>0&&je++;const ht=je<=1?0:je;W.coreBox.width+=ht+ht,W.coreBox.height=ue.labelHeight+W.coreBox.height,W.width=W.coreBox.width+ue.paddingLeft+ue.paddingRight,W.height=W.paddingTop+W.coreBox.height+W.paddingBottom}(u,P)}function gr(u,P){const W=P.x-u.x,$=P.y-u.y;return 180*Math.atan($/W)/Math.PI}function Nr(u){return u.expanded?u.x:u.x-u.width/2+0+u.coreBox.width/2}function pr(u,P){const W=P.expanded?P.x:Nr(P),$=P.y,oe=u.x-W,ue=u.y-$;let pe,_e,Te=P.expanded?P.width:P.coreBox.width,Re=P.expanded?P.height:P.coreBox.height;return Math.abs(ue)*Te/2>Math.abs(oe)*Re/2?(ue<0&&(Re=-Re),pe=ue===0?0:Re/2*oe/ue,_e=Re/2):(oe<0&&(Te=-Te),pe=Te/2,_e=oe===0?0:Te/2*ue/oe),{x:W+pe,y:$+_e}}function _r(u,P,W){var $,oe,ue,pe;const _e=u.nodes.filter((je,ht,zt)=>zt.findIndex(wr=>wr.id===je.id)!==ht).map(je=>je.id);if(_e.length)throw new Error(`Duplicated ids found: ${_e.join(", ")}`);const Te=function(je){const ht={nodes:[]},zt=je.compound,wr=Object.keys(zt||{}),Kt=new Map,qt=(Xr,Yr=[])=>{if(Kt.has(Xr))return Kt.get(Xr);for(let Kr=0;Kr<wr.length;Kr++){let Cn=wr[Kr];if(zt&&zt[Cn].indexOf(Xr)!==-1)return Yr.unshift(Cn),qt(Cn,Yr)}return Yr.length===0&&Kt.set(Xr,Yr),Yr},Qt=Xr=>je.edges.filter(Yr=>Yr.w===Xr).map(Yr=>({name:Yr.v}));return je.nodes.forEach(Xr=>{const Yr=Xr.id,Kr=[...qt(Yr),Yr];let Cn=Qt(Yr);ht.nodes.push({name:Yr,path:Kr,inputs:Cn,width:Xr.width,height:Xr.height,attr:Object.assign({},Xr)})}),ht}(u),Re=function(je,ht){const zt=(Kt,qt)=>{for(let Qt of qt.values())if(Qt.includes(Kt))return!0;return!1},wr=(Kt,qt=[])=>{if(Object.keys(Kt).length===0)return[...new Set(qt)];const Qt=new Map(Object.keys(Kt).map(Yr=>[Yr,Kt[Yr]])),Xr={};for(let[Yr,Kr]of Qt)zt(Yr,Qt)?Xr[Yr]=Kr:qt=qt.concat(Yr,Kr);return wr(Xr,qt)};return wr(je).filter(Kt=>ht.includes(Kt))}(u.compound||{},(P==null?void 0:P.expanded)||[]),Ze=function(je,ht){return function(zt){return new lf(zt)}(pd(qf(je),ht))}(Te,{rankDirection:((oe=($=W==null?void 0:W.graph)===null||$===void 0?void 0:$.meta)===null||oe===void 0?void 0:oe.rankDir)||(P==null?void 0:P.rankDirection)||S.graph.meta.rankDir,align:((pe=(ue=W==null?void 0:W.graph)===null||ue===void 0?void 0:ue.meta)===null||pe===void 0?void 0:pe.align)||S.graph.meta.align});return function(je,ht){ht.forEach(zt=>{const wr=je.getRenderInfoNodes().find(Qt=>Qt.displayName===zt);let Kt=wr&&wr.node&&wr.node.name||"";const qt=je.getRenderNodeByName(Kt);if(!qt)throw new Error(`No nodes found: ${Kt}`);qt.expanded=!0,je.buildSubHierarchy(Kt)})}(Ze,Re),Et(Ze.root,W),Hr(Ze.root)}function Wr(u,P=!1){const W=JSON.parse(JSON.stringify(u)),$={nodes:[W],edges:[...W.edges]};return W.nodes.forEach(function oe(ue){(ue.type===0||ue.type===1)&&$.nodes.push(ue),ue.type===0&&($.edges=$.edges.concat(ue.edges)),Array.isArray(ue.nodes)&&ue.nodes.forEach(oe)}),P&&$.nodes.forEach(oe=>{const ue=$.nodes.find(pe=>pe.id===oe.parentNodeName);if(ue){const pe=ue.x-ue.width/2+ue.paddingLeft,_e=ue.y-ue.height/2+ue.labelHeight+ue.paddingTop;ue.id!==E&&(oe.x+=pe,oe.y+=_e),oe.type===0&&oe.edges.forEach(Te=>{Te.points.forEach(Re=>{Re.x+=oe.x-oe.width/2+oe.paddingLeft,Re.y+=oe.y-oe.height/2+oe.labelHeight+oe.paddingTop})})}}),$}function Zr(u,P,W,$){var oe,ue;let pe=[];const _e=((oe=W.find(je=>je.id===u))===null||oe===void 0?void 0:oe.path)||[],Te=((ue=W.find(je=>je.id===P))===null||ue===void 0?void 0:ue.path)||[],Re=[E,..._e].slice(0,_e.length).reverse(),Ze=[E,...Te].slice(0,Te.length);return Re.forEach(je=>{const ht=W.find(zt=>zt.id===je);pe=pe.concat(ht.edges.filter(zt=>zt.baseEdgeList.some(wr=>wr.v===(($==null?void 0:$.v)||u)&&wr.w===(($==null?void 0:$.w)||P))))}),Ze.filter(je=>!Re.includes(je)).forEach(je=>{const ht=W.find(zt=>zt.id===je);pe=pe.concat(ht.edges.filter(zt=>zt.baseEdgeList.some(wr=>wr.v===(($==null?void 0:$.v)||u)&&wr.w===(($==null?void 0:$.w)||P))))}),pe}function Hr(u){const P=u.coreGraph.nodes().map($=>u.coreGraph.node($));return Object.assign(Object.assign({},zr(u)),{expanded:u.expanded,nodes:u.expanded?(W=P,W.map($=>$.node.type===A.META?Hr($):zr($))):[],edges:u.expanded?qr(u):[]});var W}function zr(u){return{id:u.node.name,name:u.node.name,type:u.node.type,cardinality:u.node.cardinality,attr:u.attr,parentNodeName:u.node.parentNode?u.node.parentNode.name:null,coreBox:Object.assign({},u.coreBox),x:u.x,y:u.y,width:u.width,height:u.height,radius:u.radius,labelHeight:u.labelHeight,labelOffset:u.labelOffset,outboxWidth:u.outboxWidth,paddingLeft:u.paddingLeft,paddingTop:u.paddingTop,paddingRight:u.paddingRight,paddingBottom:u.paddingBottom,path:u.node.path}}function qr(u){return u.coreGraph.edges().map(P=>({renderInfoEdge:u.coreGraph.edge(P),edge:P})).filter(({renderInfoEdge:P})=>P.metaEdge).map(({edge:P,renderInfoEdge:W})=>{const $=function(oe,ue){const pe=ue.points.map(_e=>Object.assign({},_e));if(ue.adjoiningMetaEdge){const _e=ue.adjoiningMetaEdge.points,Te=ue.metaEdge.inbound,Re=Te?_e[_e.length-1]:_e[0],Ze=pe[Te?0:pe.length-1],je=oe.x-oe.width/2,ht=oe.y-oe.height/2,zt=Re.x-je,wr=Re.y-ht,Kt=-oe.paddingLeft,qt=-(oe.paddingTop+oe.labelHeight);Ze.x=zt+Kt,Ze.y=wr+qt}return pe}(u,W);return{adjoiningEdge:W.adjoiningMetaEdge?{w:W.adjoiningMetaEdge.metaEdge.w,v:W.adjoiningMetaEdge.metaEdge.v}:null,inbound:W.metaEdge.inbound,w:P.w,v:P.v,points:$,weight:W.weight,baseEdgeList:W.metaEdge.baseEdgeList,parentNodeName:u.node.name}})}},92906:function(dt,x,M){"use strict";M.r(x),M.d(x,{glMatrix:function(){return E},mat2:function(){return S},mat2d:function(){return B},mat3:function(){return le},mat4:function(){return ct},quat:function(){return ft},quat2:function(){return N},vec2:function(){return ur},vec3:function(){return rn},vec4:function(){return On}});var S={};M.r(S),M.d(S,{LDU:function(){return Z},add:function(){return J},adjoint:function(){return m},clone:function(){return A},copy:function(){return v},create:function(){return I},determinant:function(){return w},equals:function(){return re},exactEquals:function(){return Q},frob:function(){return z},fromRotation:function(){return _},fromScaling:function(){return Y},fromValues:function(){return c},identity:function(){return p},invert:function(){return T},mul:function(){return ae},multiply:function(){return O},multiplyScalar:function(){return fe},multiplyScalarAndAdd:function(){return me},rotate:function(){return D},scale:function(){return g},set:function(){return f},str:function(){return V},sub:function(){return Ee},subtract:function(){return ee},transpose:function(){return l}});var B={};M.r(B),M.d(B,{add:function(){return St},clone:function(){return De},copy:function(){return Ve},create:function(){return Le},determinant:function(){return Fe},equals:function(){return U},exactEquals:function(){return ut},frob:function(){return He},fromRotation:function(){return Oe},fromScaling:function(){return we},fromTranslation:function(){return Be},fromValues:function(){return It},identity:function(){return et},invert:function(){return nr},mul:function(){return he},multiply:function(){return Vt},multiplyScalar:function(){return sr},multiplyScalarAndAdd:function(){return Ge},rotate:function(){return $t},scale:function(){return Ar},set:function(){return er},str:function(){return We},sub:function(){return Qe},subtract:function(){return Mt},translate:function(){return ke}});var N={};M.r(N),M.d(N,{add:function(){return bt},clone:function(){return Lt},conjugate:function(){return te},copy:function(){return Dt},create:function(){return jt},dot:function(){return j},equals:function(){return kr},exactEquals:function(){return fr},fromMat4:function(){return gt},fromRotation:function(){return Pt},fromRotationTranslation:function(){return rt},fromRotationTranslationValues:function(){return vr},fromTranslation:function(){return at},fromValues:function(){return Ht},getDual:function(){return Pr},getReal:function(){return xr},getTranslation:function(){return nn},identity:function(){return ir},invert:function(){return k},len:function(){return Ne},length:function(){return Me},lerp:function(){return R},mul:function(){return be},multiply:function(){return Mn},normalize:function(){return Ut},rotateAroundAxis:function(){return Un},rotateByQuatAppend:function(){return xn},rotateByQuatPrepend:function(){return gn},rotateX:function(){return Vn},rotateY:function(){return cn},rotateZ:function(){return wn},scale:function(){return Se},set:function(){return At},setDual:function(){return Vr},setReal:function(){return Qr},sqrLen:function(){return Ke},squaredLength:function(){return Pe},str:function(){return Rt},translate:function(){return dn}});var E=M(49685);function I(){var ne=new E.ARRAY_TYPE(4);return E.ARRAY_TYPE!=Float32Array&&(ne[1]=0,ne[2]=0),ne[0]=1,ne[3]=1,ne}function A(ne){var ye=new E.ARRAY_TYPE(4);return ye[0]=ne[0],ye[1]=ne[1],ye[2]=ne[2],ye[3]=ne[3],ye}function v(ne,ye){return ne[0]=ye[0],ne[1]=ye[1],ne[2]=ye[2],ne[3]=ye[3],ne}function p(ne){return ne[0]=1,ne[1]=0,ne[2]=0,ne[3]=1,ne}function c(ne,ye,Je,Ct){var Nt=new E.ARRAY_TYPE(4);return Nt[0]=ne,Nt[1]=ye,Nt[2]=Je,Nt[3]=Ct,Nt}function f(ne,ye,Je,Ct,Nt){return ne[0]=ye,ne[1]=Je,ne[2]=Ct,ne[3]=Nt,ne}function l(ne,ye){if(ne===ye){var Je=ye[1];ne[1]=ye[2],ne[2]=Je}else ne[0]=ye[0],ne[1]=ye[2],ne[2]=ye[1],ne[3]=ye[3];return ne}function T(ne,ye){var Je=ye[0],Ct=ye[1],Nt=ye[2],mr=ye[3],lr=Je*mr-Nt*Ct;return lr?(lr=1/lr,ne[0]=mr*lr,ne[1]=-Ct*lr,ne[2]=-Nt*lr,ne[3]=Je*lr,ne):null}function m(ne,ye){var Je=ye[0];return ne[0]=ye[3],ne[1]=-ye[1],ne[2]=-ye[2],ne[3]=Je,ne}function w(ne){return ne[0]*ne[3]-ne[2]*ne[1]}function O(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=Je[0],yr=Je[1],Gr=Je[2],Jr=Je[3];return ne[0]=Ct*dr+mr*yr,ne[1]=Nt*dr+lr*yr,ne[2]=Ct*Gr+mr*Jr,ne[3]=Nt*Gr+lr*Jr,ne}function D(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=Math.sin(Je),yr=Math.cos(Je);return ne[0]=Ct*yr+mr*dr,ne[1]=Nt*yr+lr*dr,ne[2]=Ct*-dr+mr*yr,ne[3]=Nt*-dr+lr*yr,ne}function g(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=Je[0],yr=Je[1];return ne[0]=Ct*dr,ne[1]=Nt*dr,ne[2]=mr*yr,ne[3]=lr*yr,ne}function _(ne,ye){var Je=Math.sin(ye),Ct=Math.cos(ye);return ne[0]=Ct,ne[1]=Je,ne[2]=-Je,ne[3]=Ct,ne}function Y(ne,ye){return ne[0]=ye[0],ne[1]=0,ne[2]=0,ne[3]=ye[1],ne}function V(ne){return"mat2("+ne[0]+", "+ne[1]+", "+ne[2]+", "+ne[3]+")"}function z(ne){return Math.hypot(ne[0],ne[1],ne[2],ne[3])}function Z(ne,ye,Je,Ct){return ne[2]=Ct[2]/Ct[0],Je[0]=Ct[0],Je[1]=Ct[1],Je[3]=Ct[3]-ne[2]*Je[1],[ne,ye,Je]}function J(ne,ye,Je){return ne[0]=ye[0]+Je[0],ne[1]=ye[1]+Je[1],ne[2]=ye[2]+Je[2],ne[3]=ye[3]+Je[3],ne}function ee(ne,ye,Je){return ne[0]=ye[0]-Je[0],ne[1]=ye[1]-Je[1],ne[2]=ye[2]-Je[2],ne[3]=ye[3]-Je[3],ne}function Q(ne,ye){return ne[0]===ye[0]&&ne[1]===ye[1]&&ne[2]===ye[2]&&ne[3]===ye[3]}function re(ne,ye){var Je=ne[0],Ct=ne[1],Nt=ne[2],mr=ne[3],lr=ye[0],dr=ye[1],yr=ye[2],Gr=ye[3];return Math.abs(Je-lr)<=E.EPSILON*Math.max(1,Math.abs(Je),Math.abs(lr))&&Math.abs(Ct-dr)<=E.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(dr))&&Math.abs(Nt-yr)<=E.EPSILON*Math.max(1,Math.abs(Nt),Math.abs(yr))&&Math.abs(mr-Gr)<=E.EPSILON*Math.max(1,Math.abs(mr),Math.abs(Gr))}function fe(ne,ye,Je){return ne[0]=ye[0]*Je,ne[1]=ye[1]*Je,ne[2]=ye[2]*Je,ne[3]=ye[3]*Je,ne}function me(ne,ye,Je,Ct){return ne[0]=ye[0]+Je[0]*Ct,ne[1]=ye[1]+Je[1]*Ct,ne[2]=ye[2]+Je[2]*Ct,ne[3]=ye[3]+Je[3]*Ct,ne}var ae=O,Ee=ee;function Le(){var ne=new E.ARRAY_TYPE(6);return E.ARRAY_TYPE!=Float32Array&&(ne[1]=0,ne[2]=0,ne[4]=0,ne[5]=0),ne[0]=1,ne[3]=1,ne}function De(ne){var ye=new E.ARRAY_TYPE(6);return ye[0]=ne[0],ye[1]=ne[1],ye[2]=ne[2],ye[3]=ne[3],ye[4]=ne[4],ye[5]=ne[5],ye}function Ve(ne,ye){return ne[0]=ye[0],ne[1]=ye[1],ne[2]=ye[2],ne[3]=ye[3],ne[4]=ye[4],ne[5]=ye[5],ne}function et(ne){return ne[0]=1,ne[1]=0,ne[2]=0,ne[3]=1,ne[4]=0,ne[5]=0,ne}function It(ne,ye,Je,Ct,Nt,mr){var lr=new E.ARRAY_TYPE(6);return lr[0]=ne,lr[1]=ye,lr[2]=Je,lr[3]=Ct,lr[4]=Nt,lr[5]=mr,lr}function er(ne,ye,Je,Ct,Nt,mr,lr){return ne[0]=ye,ne[1]=Je,ne[2]=Ct,ne[3]=Nt,ne[4]=mr,ne[5]=lr,ne}function nr(ne,ye){var Je=ye[0],Ct=ye[1],Nt=ye[2],mr=ye[3],lr=ye[4],dr=ye[5],yr=Je*mr-Ct*Nt;return yr?(yr=1/yr,ne[0]=mr*yr,ne[1]=-Ct*yr,ne[2]=-Nt*yr,ne[3]=Je*yr,ne[4]=(Nt*dr-mr*lr)*yr,ne[5]=(Ct*lr-Je*dr)*yr,ne):null}function Fe(ne){return ne[0]*ne[3]-ne[1]*ne[2]}function Vt(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=ye[4],yr=ye[5],Gr=Je[0],Jr=Je[1],Sr=Je[2],lt=Je[3],Ae=Je[4],Ye=Je[5];return ne[0]=Ct*Gr+mr*Jr,ne[1]=Nt*Gr+lr*Jr,ne[2]=Ct*Sr+mr*lt,ne[3]=Nt*Sr+lr*lt,ne[4]=Ct*Ae+mr*Ye+dr,ne[5]=Nt*Ae+lr*Ye+yr,ne}function $t(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=ye[4],yr=ye[5],Gr=Math.sin(Je),Jr=Math.cos(Je);return ne[0]=Ct*Jr+mr*Gr,ne[1]=Nt*Jr+lr*Gr,ne[2]=Ct*-Gr+mr*Jr,ne[3]=Nt*-Gr+lr*Jr,ne[4]=dr,ne[5]=yr,ne}function Ar(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=ye[4],yr=ye[5],Gr=Je[0],Jr=Je[1];return ne[0]=Ct*Gr,ne[1]=Nt*Gr,ne[2]=mr*Jr,ne[3]=lr*Jr,ne[4]=dr,ne[5]=yr,ne}function ke(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=ye[4],yr=ye[5],Gr=Je[0],Jr=Je[1];return ne[0]=Ct,ne[1]=Nt,ne[2]=mr,ne[3]=lr,ne[4]=Ct*Gr+mr*Jr+dr,ne[5]=Nt*Gr+lr*Jr+yr,ne}function Oe(ne,ye){var Je=Math.sin(ye),Ct=Math.cos(ye);return ne[0]=Ct,ne[1]=Je,ne[2]=-Je,ne[3]=Ct,ne[4]=0,ne[5]=0,ne}function we(ne,ye){return ne[0]=ye[0],ne[1]=0,ne[2]=0,ne[3]=ye[1],ne[4]=0,ne[5]=0,ne}function Be(ne,ye){return ne[0]=1,ne[1]=0,ne[2]=0,ne[3]=1,ne[4]=ye[0],ne[5]=ye[1],ne}function We(ne){return"mat2d("+ne[0]+", "+ne[1]+", "+ne[2]+", "+ne[3]+", "+ne[4]+", "+ne[5]+")"}function He(ne){return Math.hypot(ne[0],ne[1],ne[2],ne[3],ne[4],ne[5],1)}function St(ne,ye,Je){return ne[0]=ye[0]+Je[0],ne[1]=ye[1]+Je[1],ne[2]=ye[2]+Je[2],ne[3]=ye[3]+Je[3],ne[4]=ye[4]+Je[4],ne[5]=ye[5]+Je[5],ne}function Mt(ne,ye,Je){return ne[0]=ye[0]-Je[0],ne[1]=ye[1]-Je[1],ne[2]=ye[2]-Je[2],ne[3]=ye[3]-Je[3],ne[4]=ye[4]-Je[4],ne[5]=ye[5]-Je[5],ne}function sr(ne,ye,Je){return ne[0]=ye[0]*Je,ne[1]=ye[1]*Je,ne[2]=ye[2]*Je,ne[3]=ye[3]*Je,ne[4]=ye[4]*Je,ne[5]=ye[5]*Je,ne}function Ge(ne,ye,Je,Ct){return ne[0]=ye[0]+Je[0]*Ct,ne[1]=ye[1]+Je[1]*Ct,ne[2]=ye[2]+Je[2]*Ct,ne[3]=ye[3]+Je[3]*Ct,ne[4]=ye[4]+Je[4]*Ct,ne[5]=ye[5]+Je[5]*Ct,ne}function ut(ne,ye){return ne[0]===ye[0]&&ne[1]===ye[1]&&ne[2]===ye[2]&&ne[3]===ye[3]&&ne[4]===ye[4]&&ne[5]===ye[5]}function U(ne,ye){var Je=ne[0],Ct=ne[1],Nt=ne[2],mr=ne[3],lr=ne[4],dr=ne[5],yr=ye[0],Gr=ye[1],Jr=ye[2],Sr=ye[3],lt=ye[4],Ae=ye[5];return Math.abs(Je-yr)<=E.EPSILON*Math.max(1,Math.abs(Je),Math.abs(yr))&&Math.abs(Ct-Gr)<=E.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(Gr))&&Math.abs(Nt-Jr)<=E.EPSILON*Math.max(1,Math.abs(Nt),Math.abs(Jr))&&Math.abs(mr-Sr)<=E.EPSILON*Math.max(1,Math.abs(mr),Math.abs(Sr))&&Math.abs(lr-lt)<=E.EPSILON*Math.max(1,Math.abs(lr),Math.abs(lt))&&Math.abs(dr-Ae)<=E.EPSILON*Math.max(1,Math.abs(dr),Math.abs(Ae))}var he=Vt,Qe=Mt,le=M(35600),ct=M(85975),ft=M(32945);function jt(){var ne=new E.ARRAY_TYPE(8);return E.ARRAY_TYPE!=Float32Array&&(ne[0]=0,ne[1]=0,ne[2]=0,ne[4]=0,ne[5]=0,ne[6]=0,ne[7]=0),ne[3]=1,ne}function Lt(ne){var ye=new E.ARRAY_TYPE(8);return ye[0]=ne[0],ye[1]=ne[1],ye[2]=ne[2],ye[3]=ne[3],ye[4]=ne[4],ye[5]=ne[5],ye[6]=ne[6],ye[7]=ne[7],ye}function Ht(ne,ye,Je,Ct,Nt,mr,lr,dr){var yr=new E.ARRAY_TYPE(8);return yr[0]=ne,yr[1]=ye,yr[2]=Je,yr[3]=Ct,yr[4]=Nt,yr[5]=mr,yr[6]=lr,yr[7]=dr,yr}function vr(ne,ye,Je,Ct,Nt,mr,lr){var dr=new E.ARRAY_TYPE(8);dr[0]=ne,dr[1]=ye,dr[2]=Je,dr[3]=Ct;var yr=Nt*.5,Gr=mr*.5,Jr=lr*.5;return dr[4]=yr*Ct+Gr*Je-Jr*ye,dr[5]=Gr*Ct+Jr*ne-yr*Je,dr[6]=Jr*Ct+yr*ye-Gr*ne,dr[7]=-yr*ne-Gr*ye-Jr*Je,dr}function rt(ne,ye,Je){var Ct=Je[0]*.5,Nt=Je[1]*.5,mr=Je[2]*.5,lr=ye[0],dr=ye[1],yr=ye[2],Gr=ye[3];return ne[0]=lr,ne[1]=dr,ne[2]=yr,ne[3]=Gr,ne[4]=Ct*Gr+Nt*yr-mr*dr,ne[5]=Nt*Gr+mr*lr-Ct*yr,ne[6]=mr*Gr+Ct*dr-Nt*lr,ne[7]=-Ct*lr-Nt*dr-mr*yr,ne}function at(ne,ye){return ne[0]=0,ne[1]=0,ne[2]=0,ne[3]=1,ne[4]=ye[0]*.5,ne[5]=ye[1]*.5,ne[6]=ye[2]*.5,ne[7]=0,ne}function Pt(ne,ye){return ne[0]=ye[0],ne[1]=ye[1],ne[2]=ye[2],ne[3]=ye[3],ne[4]=0,ne[5]=0,ne[6]=0,ne[7]=0,ne}function gt(ne,ye){var Je=ft.create();ct.getRotation(Je,ye);var Ct=new E.ARRAY_TYPE(3);return ct.getTranslation(Ct,ye),rt(ne,Je,Ct),ne}function Dt(ne,ye){return ne[0]=ye[0],ne[1]=ye[1],ne[2]=ye[2],ne[3]=ye[3],ne[4]=ye[4],ne[5]=ye[5],ne[6]=ye[6],ne[7]=ye[7],ne}function ir(ne){return ne[0]=0,ne[1]=0,ne[2]=0,ne[3]=1,ne[4]=0,ne[5]=0,ne[6]=0,ne[7]=0,ne}function At(ne,ye,Je,Ct,Nt,mr,lr,dr,yr){return ne[0]=ye,ne[1]=Je,ne[2]=Ct,ne[3]=Nt,ne[4]=mr,ne[5]=lr,ne[6]=dr,ne[7]=yr,ne}var xr=ft.copy;function Pr(ne,ye){return ne[0]=ye[4],ne[1]=ye[5],ne[2]=ye[6],ne[3]=ye[7],ne}var Qr=ft.copy;function Vr(ne,ye){return ne[4]=ye[0],ne[5]=ye[1],ne[6]=ye[2],ne[7]=ye[3],ne}function nn(ne,ye){var Je=ye[4],Ct=ye[5],Nt=ye[6],mr=ye[7],lr=-ye[0],dr=-ye[1],yr=-ye[2],Gr=ye[3];return ne[0]=(Je*Gr+mr*lr+Ct*yr-Nt*dr)*2,ne[1]=(Ct*Gr+mr*dr+Nt*lr-Je*yr)*2,ne[2]=(Nt*Gr+mr*yr+Je*dr-Ct*lr)*2,ne}function dn(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=Je[0]*.5,yr=Je[1]*.5,Gr=Je[2]*.5,Jr=ye[4],Sr=ye[5],lt=ye[6],Ae=ye[7];return ne[0]=Ct,ne[1]=Nt,ne[2]=mr,ne[3]=lr,ne[4]=lr*dr+Nt*Gr-mr*yr+Jr,ne[5]=lr*yr+mr*dr-Ct*Gr+Sr,ne[6]=lr*Gr+Ct*yr-Nt*dr+lt,ne[7]=-Ct*dr-Nt*yr-mr*Gr+Ae,ne}function Vn(ne,ye,Je){var Ct=-ye[0],Nt=-ye[1],mr=-ye[2],lr=ye[3],dr=ye[4],yr=ye[5],Gr=ye[6],Jr=ye[7],Sr=dr*lr+Jr*Ct+yr*mr-Gr*Nt,lt=yr*lr+Jr*Nt+Gr*Ct-dr*mr,Ae=Gr*lr+Jr*mr+dr*Nt-yr*Ct,Ye=Jr*lr-dr*Ct-yr*Nt-Gr*mr;return ft.rotateX(ne,ye,Je),Ct=ne[0],Nt=ne[1],mr=ne[2],lr=ne[3],ne[4]=Sr*lr+Ye*Ct+lt*mr-Ae*Nt,ne[5]=lt*lr+Ye*Nt+Ae*Ct-Sr*mr,ne[6]=Ae*lr+Ye*mr+Sr*Nt-lt*Ct,ne[7]=Ye*lr-Sr*Ct-lt*Nt-Ae*mr,ne}function cn(ne,ye,Je){var Ct=-ye[0],Nt=-ye[1],mr=-ye[2],lr=ye[3],dr=ye[4],yr=ye[5],Gr=ye[6],Jr=ye[7],Sr=dr*lr+Jr*Ct+yr*mr-Gr*Nt,lt=yr*lr+Jr*Nt+Gr*Ct-dr*mr,Ae=Gr*lr+Jr*mr+dr*Nt-yr*Ct,Ye=Jr*lr-dr*Ct-yr*Nt-Gr*mr;return ft.rotateY(ne,ye,Je),Ct=ne[0],Nt=ne[1],mr=ne[2],lr=ne[3],ne[4]=Sr*lr+Ye*Ct+lt*mr-Ae*Nt,ne[5]=lt*lr+Ye*Nt+Ae*Ct-Sr*mr,ne[6]=Ae*lr+Ye*mr+Sr*Nt-lt*Ct,ne[7]=Ye*lr-Sr*Ct-lt*Nt-Ae*mr,ne}function wn(ne,ye,Je){var Ct=-ye[0],Nt=-ye[1],mr=-ye[2],lr=ye[3],dr=ye[4],yr=ye[5],Gr=ye[6],Jr=ye[7],Sr=dr*lr+Jr*Ct+yr*mr-Gr*Nt,lt=yr*lr+Jr*Nt+Gr*Ct-dr*mr,Ae=Gr*lr+Jr*mr+dr*Nt-yr*Ct,Ye=Jr*lr-dr*Ct-yr*Nt-Gr*mr;return ft.rotateZ(ne,ye,Je),Ct=ne[0],Nt=ne[1],mr=ne[2],lr=ne[3],ne[4]=Sr*lr+Ye*Ct+lt*mr-Ae*Nt,ne[5]=lt*lr+Ye*Nt+Ae*Ct-Sr*mr,ne[6]=Ae*lr+Ye*mr+Sr*Nt-lt*Ct,ne[7]=Ye*lr-Sr*Ct-lt*Nt-Ae*mr,ne}function xn(ne,ye,Je){var Ct=Je[0],Nt=Je[1],mr=Je[2],lr=Je[3],dr=ye[0],yr=ye[1],Gr=ye[2],Jr=ye[3];return ne[0]=dr*lr+Jr*Ct+yr*mr-Gr*Nt,ne[1]=yr*lr+Jr*Nt+Gr*Ct-dr*mr,ne[2]=Gr*lr+Jr*mr+dr*Nt-yr*Ct,ne[3]=Jr*lr-dr*Ct-yr*Nt-Gr*mr,dr=ye[4],yr=ye[5],Gr=ye[6],Jr=ye[7],ne[4]=dr*lr+Jr*Ct+yr*mr-Gr*Nt,ne[5]=yr*lr+Jr*Nt+Gr*Ct-dr*mr,ne[6]=Gr*lr+Jr*mr+dr*Nt-yr*Ct,ne[7]=Jr*lr-dr*Ct-yr*Nt-Gr*mr,ne}function gn(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=Je[0],yr=Je[1],Gr=Je[2],Jr=Je[3];return ne[0]=Ct*Jr+lr*dr+Nt*Gr-mr*yr,ne[1]=Nt*Jr+lr*yr+mr*dr-Ct*Gr,ne[2]=mr*Jr+lr*Gr+Ct*yr-Nt*dr,ne[3]=lr*Jr-Ct*dr-Nt*yr-mr*Gr,dr=Je[4],yr=Je[5],Gr=Je[6],Jr=Je[7],ne[4]=Ct*Jr+lr*dr+Nt*Gr-mr*yr,ne[5]=Nt*Jr+lr*yr+mr*dr-Ct*Gr,ne[6]=mr*Jr+lr*Gr+Ct*yr-Nt*dr,ne[7]=lr*Jr-Ct*dr-Nt*yr-mr*Gr,ne}function Un(ne,ye,Je,Ct){if(Math.abs(Ct)<E.EPSILON)return Dt(ne,ye);var Nt=Math.hypot(Je[0],Je[1],Je[2]);Ct=Ct*.5;var mr=Math.sin(Ct),lr=mr*Je[0]/Nt,dr=mr*Je[1]/Nt,yr=mr*Je[2]/Nt,Gr=Math.cos(Ct),Jr=ye[0],Sr=ye[1],lt=ye[2],Ae=ye[3];ne[0]=Jr*Gr+Ae*lr+Sr*yr-lt*dr,ne[1]=Sr*Gr+Ae*dr+lt*lr-Jr*yr,ne[2]=lt*Gr+Ae*yr+Jr*dr-Sr*lr,ne[3]=Ae*Gr-Jr*lr-Sr*dr-lt*yr;var Ye=ye[4],Tt=ye[5],pt=ye[6],kt=ye[7];return ne[4]=Ye*Gr+kt*lr+Tt*yr-pt*dr,ne[5]=Tt*Gr+kt*dr+pt*lr-Ye*yr,ne[6]=pt*Gr+kt*yr+Ye*dr-Tt*lr,ne[7]=kt*Gr-Ye*lr-Tt*dr-pt*yr,ne}function bt(ne,ye,Je){return ne[0]=ye[0]+Je[0],ne[1]=ye[1]+Je[1],ne[2]=ye[2]+Je[2],ne[3]=ye[3]+Je[3],ne[4]=ye[4]+Je[4],ne[5]=ye[5]+Je[5],ne[6]=ye[6]+Je[6],ne[7]=ye[7]+Je[7],ne}function Mn(ne,ye,Je){var Ct=ye[0],Nt=ye[1],mr=ye[2],lr=ye[3],dr=Je[4],yr=Je[5],Gr=Je[6],Jr=Je[7],Sr=ye[4],lt=ye[5],Ae=ye[6],Ye=ye[7],Tt=Je[0],pt=Je[1],kt=Je[2],ar=Je[3];return ne[0]=Ct*ar+lr*Tt+Nt*kt-mr*pt,ne[1]=Nt*ar+lr*pt+mr*Tt-Ct*kt,ne[2]=mr*ar+lr*kt+Ct*pt-Nt*Tt,ne[3]=lr*ar-Ct*Tt-Nt*pt-mr*kt,ne[4]=Ct*Jr+lr*dr+Nt*Gr-mr*yr+Sr*ar+Ye*Tt+lt*kt-Ae*pt,ne[5]=Nt*Jr+lr*yr+mr*dr-Ct*Gr+lt*ar+Ye*pt+Ae*Tt-Sr*kt,ne[6]=mr*Jr+lr*Gr+Ct*yr-Nt*dr+Ae*ar+Ye*kt+Sr*pt-lt*Tt,ne[7]=lr*Jr-Ct*dr-Nt*yr-mr*Gr+Ye*ar-Sr*Tt-lt*pt-Ae*kt,ne}var be=Mn;function Se(ne,ye,Je){return ne[0]=ye[0]*Je,ne[1]=ye[1]*Je,ne[2]=ye[2]*Je,ne[3]=ye[3]*Je,ne[4]=ye[4]*Je,ne[5]=ye[5]*Je,ne[6]=ye[6]*Je,ne[7]=ye[7]*Je,ne}var j=ft.dot;function R(ne,ye,Je,Ct){var Nt=1-Ct;return j(ye,Je)<0&&(Ct=-Ct),ne[0]=ye[0]*Nt+Je[0]*Ct,ne[1]=ye[1]*Nt+Je[1]*Ct,ne[2]=ye[2]*Nt+Je[2]*Ct,ne[3]=ye[3]*Nt+Je[3]*Ct,ne[4]=ye[4]*Nt+Je[4]*Ct,ne[5]=ye[5]*Nt+Je[5]*Ct,ne[6]=ye[6]*Nt+Je[6]*Ct,ne[7]=ye[7]*Nt+Je[7]*Ct,ne}function k(ne,ye){var Je=Pe(ye);return ne[0]=-ye[0]/Je,ne[1]=-ye[1]/Je,ne[2]=-ye[2]/Je,ne[3]=ye[3]/Je,ne[4]=-ye[4]/Je,ne[5]=-ye[5]/Je,ne[6]=-ye[6]/Je,ne[7]=ye[7]/Je,ne}function te(ne,ye){return ne[0]=-ye[0],ne[1]=-ye[1],ne[2]=-ye[2],ne[3]=ye[3],ne[4]=-ye[4],ne[5]=-ye[5],ne[6]=-ye[6],ne[7]=ye[7],ne}var Me=ft.length,Ne=Me,Pe=ft.squaredLength,Ke=Pe;function Ut(ne,ye){var Je=Pe(ye);if(Je>0){Je=Math.sqrt(Je);var Ct=ye[0]/Je,Nt=ye[1]/Je,mr=ye[2]/Je,lr=ye[3]/Je,dr=ye[4],yr=ye[5],Gr=ye[6],Jr=ye[7],Sr=Ct*dr+Nt*yr+mr*Gr+lr*Jr;ne[0]=Ct,ne[1]=Nt,ne[2]=mr,ne[3]=lr,ne[4]=(dr-Ct*Sr)/Je,ne[5]=(yr-Nt*Sr)/Je,ne[6]=(Gr-mr*Sr)/Je,ne[7]=(Jr-lr*Sr)/Je}return ne}function Rt(ne){return"quat2("+ne[0]+", "+ne[1]+", "+ne[2]+", "+ne[3]+", "+ne[4]+", "+ne[5]+", "+ne[6]+", "+ne[7]+")"}function fr(ne,ye){return ne[0]===ye[0]&&ne[1]===ye[1]&&ne[2]===ye[2]&&ne[3]===ye[3]&&ne[4]===ye[4]&&ne[5]===ye[5]&&ne[6]===ye[6]&&ne[7]===ye[7]}function kr(ne,ye){var Je=ne[0],Ct=ne[1],Nt=ne[2],mr=ne[3],lr=ne[4],dr=ne[5],yr=ne[6],Gr=ne[7],Jr=ye[0],Sr=ye[1],lt=ye[2],Ae=ye[3],Ye=ye[4],Tt=ye[5],pt=ye[6],kt=ye[7];return Math.abs(Je-Jr)<=E.EPSILON*Math.max(1,Math.abs(Je),Math.abs(Jr))&&Math.abs(Ct-Sr)<=E.EPSILON*Math.max(1,Math.abs(Ct),Math.abs(Sr))&&Math.abs(Nt-lt)<=E.EPSILON*Math.max(1,Math.abs(Nt),Math.abs(lt))&&Math.abs(mr-Ae)<=E.EPSILON*Math.max(1,Math.abs(mr),Math.abs(Ae))&&Math.abs(lr-Ye)<=E.EPSILON*Math.max(1,Math.abs(lr),Math.abs(Ye))&&Math.abs(dr-Tt)<=E.EPSILON*Math.max(1,Math.abs(dr),Math.abs(Tt))&&Math.abs(yr-pt)<=E.EPSILON*Math.max(1,Math.abs(yr),Math.abs(pt))&&Math.abs(Gr-kt)<=E.EPSILON*Math.max(1,Math.abs(Gr),Math.abs(kt))}var ur=M(31437),rn=M(77160),On=M(98333)},85975:function(dt,x,M){"use strict";M.r(x),M.d(x,{create:function(){return B},clone:function(){return N},copy:function(){return E},fromValues:function(){return I},set:function(){return A},identity:function(){return v},transpose:function(){return p},invert:function(){return c},adjoint:function(){return f},determinant:function(){return l},multiply:function(){return T},translate:function(){return m},scale:function(){return w},rotate:function(){return O},rotateX:function(){return D},rotateY:function(){return g},rotateZ:function(){return _},fromTranslation:function(){return Y},fromScaling:function(){return V},fromRotation:function(){return z},fromXRotation:function(){return Z},fromYRotation:function(){return J},fromZRotation:function(){return ee},fromRotationTranslation:function(){return Q},fromQuat2:function(){return re},getTranslation:function(){return fe},getScaling:function(){return me},getRotation:function(){return ae},fromRotationTranslationScale:function(){return Ee},fromRotationTranslationScaleOrigin:function(){return Le},fromQuat:function(){return De},frustum:function(){return Ve},perspectiveNO:function(){return et},perspective:function(){return It},perspectiveZO:function(){return er},perspectiveFromFieldOfView:function(){return nr},orthoNO:function(){return Fe},ortho:function(){return Vt},orthoZO:function(){return $t},lookAt:function(){return Ar},targetTo:function(){return ke},str:function(){return Oe},frob:function(){return we},add:function(){return Be},subtract:function(){return We},multiplyScalar:function(){return He},multiplyScalarAndAdd:function(){return St},exactEquals:function(){return Mt},equals:function(){return sr},mul:function(){return Ge},sub:function(){return ut}});var S=M(49685);function B(){var U=new S.ARRAY_TYPE(16);return S.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 N(U){var he=new S.ARRAY_TYPE(16);return he[0]=U[0],he[1]=U[1],he[2]=U[2],he[3]=U[3],he[4]=U[4],he[5]=U[5],he[6]=U[6],he[7]=U[7],he[8]=U[8],he[9]=U[9],he[10]=U[10],he[11]=U[11],he[12]=U[12],he[13]=U[13],he[14]=U[14],he[15]=U[15],he}function E(U,he){return U[0]=he[0],U[1]=he[1],U[2]=he[2],U[3]=he[3],U[4]=he[4],U[5]=he[5],U[6]=he[6],U[7]=he[7],U[8]=he[8],U[9]=he[9],U[10]=he[10],U[11]=he[11],U[12]=he[12],U[13]=he[13],U[14]=he[14],U[15]=he[15],U}function I(U,he,Qe,le,ct,ft,jt,Lt,Ht,vr,rt,at,Pt,gt,Dt,ir){var At=new S.ARRAY_TYPE(16);return At[0]=U,At[1]=he,At[2]=Qe,At[3]=le,At[4]=ct,At[5]=ft,At[6]=jt,At[7]=Lt,At[8]=Ht,At[9]=vr,At[10]=rt,At[11]=at,At[12]=Pt,At[13]=gt,At[14]=Dt,At[15]=ir,At}function A(U,he,Qe,le,ct,ft,jt,Lt,Ht,vr,rt,at,Pt,gt,Dt,ir,At){return U[0]=he,U[1]=Qe,U[2]=le,U[3]=ct,U[4]=ft,U[5]=jt,U[6]=Lt,U[7]=Ht,U[8]=vr,U[9]=rt,U[10]=at,U[11]=Pt,U[12]=gt,U[13]=Dt,U[14]=ir,U[15]=At,U}function v(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 p(U,he){if(U===he){var Qe=he[1],le=he[2],ct=he[3],ft=he[6],jt=he[7],Lt=he[11];U[1]=he[4],U[2]=he[8],U[3]=he[12],U[4]=Qe,U[6]=he[9],U[7]=he[13],U[8]=le,U[9]=ft,U[11]=he[14],U[12]=ct,U[13]=jt,U[14]=Lt}else U[0]=he[0],U[1]=he[4],U[2]=he[8],U[3]=he[12],U[4]=he[1],U[5]=he[5],U[6]=he[9],U[7]=he[13],U[8]=he[2],U[9]=he[6],U[10]=he[10],U[11]=he[14],U[12]=he[3],U[13]=he[7],U[14]=he[11],U[15]=he[15];return U}function c(U,he){var Qe=he[0],le=he[1],ct=he[2],ft=he[3],jt=he[4],Lt=he[5],Ht=he[6],vr=he[7],rt=he[8],at=he[9],Pt=he[10],gt=he[11],Dt=he[12],ir=he[13],At=he[14],xr=he[15],Pr=Qe*Lt-le*jt,Qr=Qe*Ht-ct*jt,Vr=Qe*vr-ft*jt,nn=le*Ht-ct*Lt,dn=le*vr-ft*Lt,Vn=ct*vr-ft*Ht,cn=rt*ir-at*Dt,wn=rt*At-Pt*Dt,xn=rt*xr-gt*Dt,gn=at*At-Pt*ir,Un=at*xr-gt*ir,bt=Pt*xr-gt*At,Mn=Pr*bt-Qr*Un+Vr*gn+nn*xn-dn*wn+Vn*cn;return Mn?(Mn=1/Mn,U[0]=(Lt*bt-Ht*Un+vr*gn)*Mn,U[1]=(ct*Un-le*bt-ft*gn)*Mn,U[2]=(ir*Vn-At*dn+xr*nn)*Mn,U[3]=(Pt*dn-at*Vn-gt*nn)*Mn,U[4]=(Ht*xn-jt*bt-vr*wn)*Mn,U[5]=(Qe*bt-ct*xn+ft*wn)*Mn,U[6]=(At*Vr-Dt*Vn-xr*Qr)*Mn,U[7]=(rt*Vn-Pt*Vr+gt*Qr)*Mn,U[8]=(jt*Un-Lt*xn+vr*cn)*Mn,U[9]=(le*xn-Qe*Un-ft*cn)*Mn,U[10]=(Dt*dn-ir*Vr+xr*Pr)*Mn,U[11]=(at*Vr-rt*dn-gt*Pr)*Mn,U[12]=(Lt*wn-jt*gn-Ht*cn)*Mn,U[13]=(Qe*gn-le*wn+ct*cn)*Mn,U[14]=(ir*Qr-Dt*nn-At*Pr)*Mn,U[15]=(rt*nn-at*Qr+Pt*Pr)*Mn,U):null}function f(U,he){var Qe=he[0],le=he[1],ct=he[2],ft=he[3],jt=he[4],Lt=he[5],Ht=he[6],vr=he[7],rt=he[8],at=he[9],Pt=he[10],gt=he[11],Dt=he[12],ir=he[13],At=he[14],xr=he[15];return U[0]=Lt*(Pt*xr-gt*At)-at*(Ht*xr-vr*At)+ir*(Ht*gt-vr*Pt),U[1]=-(le*(Pt*xr-gt*At)-at*(ct*xr-ft*At)+ir*(ct*gt-ft*Pt)),U[2]=le*(Ht*xr-vr*At)-Lt*(ct*xr-ft*At)+ir*(ct*vr-ft*Ht),U[3]=-(le*(Ht*gt-vr*Pt)-Lt*(ct*gt-ft*Pt)+at*(ct*vr-ft*Ht)),U[4]=-(jt*(Pt*xr-gt*At)-rt*(Ht*xr-vr*At)+Dt*(Ht*gt-vr*Pt)),U[5]=Qe*(Pt*xr-gt*At)-rt*(ct*xr-ft*At)+Dt*(ct*gt-ft*Pt),U[6]=-(Qe*(Ht*xr-vr*At)-jt*(ct*xr-ft*At)+Dt*(ct*vr-ft*Ht)),U[7]=Qe*(Ht*gt-vr*Pt)-jt*(ct*gt-ft*Pt)+rt*(ct*vr-ft*Ht),U[8]=jt*(at*xr-gt*ir)-rt*(Lt*xr-vr*ir)+Dt*(Lt*gt-vr*at),U[9]=-(Qe*(at*xr-gt*ir)-rt*(le*xr-ft*ir)+Dt*(le*gt-ft*at)),U[10]=Qe*(Lt*xr-vr*ir)-jt*(le*xr-ft*ir)+Dt*(le*vr-ft*Lt),U[11]=-(Qe*(Lt*gt-vr*at)-jt*(le*gt-ft*at)+rt*(le*vr-ft*Lt)),U[12]=-(jt*(at*At-Pt*ir)-rt*(Lt*At-Ht*ir)+Dt*(Lt*Pt-Ht*at)),U[13]=Qe*(at*At-Pt*ir)-rt*(le*At-ct*ir)+Dt*(le*Pt-ct*at),U[14]=-(Qe*(Lt*At-Ht*ir)-jt*(le*At-ct*ir)+Dt*(le*Ht-ct*Lt)),U[15]=Qe*(Lt*Pt-Ht*at)-jt*(le*Pt-ct*at)+rt*(le*Ht-ct*Lt),U}function l(U){var he=U[0],Qe=U[1],le=U[2],ct=U[3],ft=U[4],jt=U[5],Lt=U[6],Ht=U[7],vr=U[8],rt=U[9],at=U[10],Pt=U[11],gt=U[12],Dt=U[13],ir=U[14],At=U[15],xr=he*jt-Qe*ft,Pr=he*Lt-le*ft,Qr=he*Ht-ct*ft,Vr=Qe*Lt-le*jt,nn=Qe*Ht-ct*jt,dn=le*Ht-ct*Lt,Vn=vr*Dt-rt*gt,cn=vr*ir-at*gt,wn=vr*At-Pt*gt,xn=rt*ir-at*Dt,gn=rt*At-Pt*Dt,Un=at*At-Pt*ir;return xr*Un-Pr*gn+Qr*xn+Vr*wn-nn*cn+dn*Vn}function T(U,he,Qe){var le=he[0],ct=he[1],ft=he[2],jt=he[3],Lt=he[4],Ht=he[5],vr=he[6],rt=he[7],at=he[8],Pt=he[9],gt=he[10],Dt=he[11],ir=he[12],At=he[13],xr=he[14],Pr=he[15],Qr=Qe[0],Vr=Qe[1],nn=Qe[2],dn=Qe[3];return U[0]=Qr*le+Vr*Lt+nn*at+dn*ir,U[1]=Qr*ct+Vr*Ht+nn*Pt+dn*At,U[2]=Qr*ft+Vr*vr+nn*gt+dn*xr,U[3]=Qr*jt+Vr*rt+nn*Dt+dn*Pr,Qr=Qe[4],Vr=Qe[5],nn=Qe[6],dn=Qe[7],U[4]=Qr*le+Vr*Lt+nn*at+dn*ir,U[5]=Qr*ct+Vr*Ht+nn*Pt+dn*At,U[6]=Qr*ft+Vr*vr+nn*gt+dn*xr,U[7]=Qr*jt+Vr*rt+nn*Dt+dn*Pr,Qr=Qe[8],Vr=Qe[9],nn=Qe[10],dn=Qe[11],U[8]=Qr*le+Vr*Lt+nn*at+dn*ir,U[9]=Qr*ct+Vr*Ht+nn*Pt+dn*At,U[10]=Qr*ft+Vr*vr+nn*gt+dn*xr,U[11]=Qr*jt+Vr*rt+nn*Dt+dn*Pr,Qr=Qe[12],Vr=Qe[13],nn=Qe[14],dn=Qe[15],U[12]=Qr*le+Vr*Lt+nn*at+dn*ir,U[13]=Qr*ct+Vr*Ht+nn*Pt+dn*At,U[14]=Qr*ft+Vr*vr+nn*gt+dn*xr,U[15]=Qr*jt+Vr*rt+nn*Dt+dn*Pr,U}function m(U,he,Qe){var le=Qe[0],ct=Qe[1],ft=Qe[2],jt,Lt,Ht,vr,rt,at,Pt,gt,Dt,ir,At,xr;return he===U?(U[12]=he[0]*le+he[4]*ct+he[8]*ft+he[12],U[13]=he[1]*le+he[5]*ct+he[9]*ft+he[13],U[14]=he[2]*le+he[6]*ct+he[10]*ft+he[14],U[15]=he[3]*le+he[7]*ct+he[11]*ft+he[15]):(jt=he[0],Lt=he[1],Ht=he[2],vr=he[3],rt=he[4],at=he[5],Pt=he[6],gt=he[7],Dt=he[8],ir=he[9],At=he[10],xr=he[11],U[0]=jt,U[1]=Lt,U[2]=Ht,U[3]=vr,U[4]=rt,U[5]=at,U[6]=Pt,U[7]=gt,U[8]=Dt,U[9]=ir,U[10]=At,U[11]=xr,U[12]=jt*le+rt*ct+Dt*ft+he[12],U[13]=Lt*le+at*ct+ir*ft+he[13],U[14]=Ht*le+Pt*ct+At*ft+he[14],U[15]=vr*le+gt*ct+xr*ft+he[15]),U}function w(U,he,Qe){var le=Qe[0],ct=Qe[1],ft=Qe[2];return U[0]=he[0]*le,U[1]=he[1]*le,U[2]=he[2]*le,U[3]=he[3]*le,U[4]=he[4]*ct,U[5]=he[5]*ct,U[6]=he[6]*ct,U[7]=he[7]*ct,U[8]=he[8]*ft,U[9]=he[9]*ft,U[10]=he[10]*ft,U[11]=he[11]*ft,U[12]=he[12],U[13]=he[13],U[14]=he[14],U[15]=he[15],U}function O(U,he,Qe,le){var ct=le[0],ft=le[1],jt=le[2],Lt=Math.hypot(ct,ft,jt),Ht,vr,rt,at,Pt,gt,Dt,ir,At,xr,Pr,Qr,Vr,nn,dn,Vn,cn,wn,xn,gn,Un,bt,Mn,be;return Lt<S.EPSILON?null:(Lt=1/Lt,ct*=Lt,ft*=Lt,jt*=Lt,Ht=Math.sin(Qe),vr=Math.cos(Qe),rt=1-vr,at=he[0],Pt=he[1],gt=he[2],Dt=he[3],ir=he[4],At=he[5],xr=he[6],Pr=he[7],Qr=he[8],Vr=he[9],nn=he[10],dn=he[11],Vn=ct*ct*rt+vr,cn=ft*ct*rt+jt*Ht,wn=jt*ct*rt-ft*Ht,xn=ct*ft*rt-jt*Ht,gn=ft*ft*rt+vr,Un=jt*ft*rt+ct*Ht,bt=ct*jt*rt+ft*Ht,Mn=ft*jt*rt-ct*Ht,be=jt*jt*rt+vr,U[0]=at*Vn+ir*cn+Qr*wn,U[1]=Pt*Vn+At*cn+Vr*wn,U[2]=gt*Vn+xr*cn+nn*wn,U[3]=Dt*Vn+Pr*cn+dn*wn,U[4]=at*xn+ir*gn+Qr*Un,U[5]=Pt*xn+At*gn+Vr*Un,U[6]=gt*xn+xr*gn+nn*Un,U[7]=Dt*xn+Pr*gn+dn*Un,U[8]=at*bt+ir*Mn+Qr*be,U[9]=Pt*bt+At*Mn+Vr*be,U[10]=gt*bt+xr*Mn+nn*be,U[11]=Dt*bt+Pr*Mn+dn*be,he!==U&&(U[12]=he[12],U[13]=he[13],U[14]=he[14],U[15]=he[15]),U)}function D(U,he,Qe){var le=Math.sin(Qe),ct=Math.cos(Qe),ft=he[4],jt=he[5],Lt=he[6],Ht=he[7],vr=he[8],rt=he[9],at=he[10],Pt=he[11];return he!==U&&(U[0]=he[0],U[1]=he[1],U[2]=he[2],U[3]=he[3],U[12]=he[12],U[13]=he[13],U[14]=he[14],U[15]=he[15]),U[4]=ft*ct+vr*le,U[5]=jt*ct+rt*le,U[6]=Lt*ct+at*le,U[7]=Ht*ct+Pt*le,U[8]=vr*ct-ft*le,U[9]=rt*ct-jt*le,U[10]=at*ct-Lt*le,U[11]=Pt*ct-Ht*le,U}function g(U,he,Qe){var le=Math.sin(Qe),ct=Math.cos(Qe),ft=he[0],jt=he[1],Lt=he[2],Ht=he[3],vr=he[8],rt=he[9],at=he[10],Pt=he[11];return he!==U&&(U[4]=he[4],U[5]=he[5],U[6]=he[6],U[7]=he[7],U[12]=he[12],U[13]=he[13],U[14]=he[14],U[15]=he[15]),U[0]=ft*ct-vr*le,U[1]=jt*ct-rt*le,U[2]=Lt*ct-at*le,U[3]=Ht*ct-Pt*le,U[8]=ft*le+vr*ct,U[9]=jt*le+rt*ct,U[10]=Lt*le+at*ct,U[11]=Ht*le+Pt*ct,U}function _(U,he,Qe){var le=Math.sin(Qe),ct=Math.cos(Qe),ft=he[0],jt=he[1],Lt=he[2],Ht=he[3],vr=he[4],rt=he[5],at=he[6],Pt=he[7];return he!==U&&(U[8]=he[8],U[9]=he[9],U[10]=he[10],U[11]=he[11],U[12]=he[12],U[13]=he[13],U[14]=he[14],U[15]=he[15]),U[0]=ft*ct+vr*le,U[1]=jt*ct+rt*le,U[2]=Lt*ct+at*le,U[3]=Ht*ct+Pt*le,U[4]=vr*ct-ft*le,U[5]=rt*ct-jt*le,U[6]=at*ct-Lt*le,U[7]=Pt*ct-Ht*le,U}function Y(U,he){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]=he[0],U[13]=he[1],U[14]=he[2],U[15]=1,U}function V(U,he){return U[0]=he[0],U[1]=0,U[2]=0,U[3]=0,U[4]=0,U[5]=he[1],U[6]=0,U[7]=0,U[8]=0,U[9]=0,U[10]=he[2],U[11]=0,U[12]=0,U[13]=0,U[14]=0,U[15]=1,U}function z(U,he,Qe){var le=Qe[0],ct=Qe[1],ft=Qe[2],jt=Math.hypot(le,ct,ft),Lt,Ht,vr;return jt<S.EPSILON?null:(jt=1/jt,le*=jt,ct*=jt,ft*=jt,Lt=Math.sin(he),Ht=Math.cos(he),vr=1-Ht,U[0]=le*le*vr+Ht,U[1]=ct*le*vr+ft*Lt,U[2]=ft*le*vr-ct*Lt,U[3]=0,U[4]=le*ct*vr-ft*Lt,U[5]=ct*ct*vr+Ht,U[6]=ft*ct*vr+le*Lt,U[7]=0,U[8]=le*ft*vr+ct*Lt,U[9]=ct*ft*vr-le*Lt,U[10]=ft*ft*vr+Ht,U[11]=0,U[12]=0,U[13]=0,U[14]=0,U[15]=1,U)}function Z(U,he){var Qe=Math.sin(he),le=Math.cos(he);return U[0]=1,U[1]=0,U[2]=0,U[3]=0,U[4]=0,U[5]=le,U[6]=Qe,U[7]=0,U[8]=0,U[9]=-Qe,U[10]=le,U[11]=0,U[12]=0,U[13]=0,U[14]=0,U[15]=1,U}function J(U,he){var Qe=Math.sin(he),le=Math.cos(he);return U[0]=le,U[1]=0,U[2]=-Qe,U[3]=0,U[4]=0,U[5]=1,U[6]=0,U[7]=0,U[8]=Qe,U[9]=0,U[10]=le,U[11]=0,U[12]=0,U[13]=0,U[14]=0,U[15]=1,U}function ee(U,he){var Qe=Math.sin(he),le=Math.cos(he);return U[0]=le,U[1]=Qe,U[2]=0,U[3]=0,U[4]=-Qe,U[5]=le,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 Q(U,he,Qe){var le=he[0],ct=he[1],ft=he[2],jt=he[3],Lt=le+le,Ht=ct+ct,vr=ft+ft,rt=le*Lt,at=le*Ht,Pt=le*vr,gt=ct*Ht,Dt=ct*vr,ir=ft*vr,At=jt*Lt,xr=jt*Ht,Pr=jt*vr;return U[0]=1-(gt+ir),U[1]=at+Pr,U[2]=Pt-xr,U[3]=0,U[4]=at-Pr,U[5]=1-(rt+ir),U[6]=Dt+At,U[7]=0,U[8]=Pt+xr,U[9]=Dt-At,U[10]=1-(rt+gt),U[11]=0,U[12]=Qe[0],U[13]=Qe[1],U[14]=Qe[2],U[15]=1,U}function re(U,he){var Qe=new S.ARRAY_TYPE(3),le=-he[0],ct=-he[1],ft=-he[2],jt=he[3],Lt=he[4],Ht=he[5],vr=he[6],rt=he[7],at=le*le+ct*ct+ft*ft+jt*jt;return at>0?(Qe[0]=(Lt*jt+rt*le+Ht*ft-vr*ct)*2/at,Qe[1]=(Ht*jt+rt*ct+vr*le-Lt*ft)*2/at,Qe[2]=(vr*jt+rt*ft+Lt*ct-Ht*le)*2/at):(Qe[0]=(Lt*jt+rt*le+Ht*ft-vr*ct)*2,Qe[1]=(Ht*jt+rt*ct+vr*le-Lt*ft)*2,Qe[2]=(vr*jt+rt*ft+Lt*ct-Ht*le)*2),Q(U,he,Qe),U}function fe(U,he){return U[0]=he[12],U[1]=he[13],U[2]=he[14],U}function me(U,he){var Qe=he[0],le=he[1],ct=he[2],ft=he[4],jt=he[5],Lt=he[6],Ht=he[8],vr=he[9],rt=he[10];return U[0]=Math.hypot(Qe,le,ct),U[1]=Math.hypot(ft,jt,Lt),U[2]=Math.hypot(Ht,vr,rt),U}function ae(U,he){var Qe=new S.ARRAY_TYPE(3);me(Qe,he);var le=1/Qe[0],ct=1/Qe[1],ft=1/Qe[2],jt=he[0]*le,Lt=he[1]*ct,Ht=he[2]*ft,vr=he[4]*le,rt=he[5]*ct,at=he[6]*ft,Pt=he[8]*le,gt=he[9]*ct,Dt=he[10]*ft,ir=jt+rt+Dt,At=0;return ir>0?(At=Math.sqrt(ir+1)*2,U[3]=.25*At,U[0]=(at-gt)/At,U[1]=(Pt-Ht)/At,U[2]=(Lt-vr)/At):jt>rt&&jt>Dt?(At=Math.sqrt(1+jt-rt-Dt)*2,U[3]=(at-gt)/At,U[0]=.25*At,U[1]=(Lt+vr)/At,U[2]=(Pt+Ht)/At):rt>Dt?(At=Math.sqrt(1+rt-jt-Dt)*2,U[3]=(Pt-Ht)/At,U[0]=(Lt+vr)/At,U[1]=.25*At,U[2]=(at+gt)/At):(At=Math.sqrt(1+Dt-jt-rt)*2,U[3]=(Lt-vr)/At,U[0]=(Pt+Ht)/At,U[1]=(at+gt)/At,U[2]=.25*At),U}function Ee(U,he,Qe,le){var ct=he[0],ft=he[1],jt=he[2],Lt=he[3],Ht=ct+ct,vr=ft+ft,rt=jt+jt,at=ct*Ht,Pt=ct*vr,gt=ct*rt,Dt=ft*vr,ir=ft*rt,At=jt*rt,xr=Lt*Ht,Pr=Lt*vr,Qr=Lt*rt,Vr=le[0],nn=le[1],dn=le[2];return U[0]=(1-(Dt+At))*Vr,U[1]=(Pt+Qr)*Vr,U[2]=(gt-Pr)*Vr,U[3]=0,U[4]=(Pt-Qr)*nn,U[5]=(1-(at+At))*nn,U[6]=(ir+xr)*nn,U[7]=0,U[8]=(gt+Pr)*dn,U[9]=(ir-xr)*dn,U[10]=(1-(at+Dt))*dn,U[11]=0,U[12]=Qe[0],U[13]=Qe[1],U[14]=Qe[2],U[15]=1,U}function Le(U,he,Qe,le,ct){var ft=he[0],jt=he[1],Lt=he[2],Ht=he[3],vr=ft+ft,rt=jt+jt,at=Lt+Lt,Pt=ft*vr,gt=ft*rt,Dt=ft*at,ir=jt*rt,At=jt*at,xr=Lt*at,Pr=Ht*vr,Qr=Ht*rt,Vr=Ht*at,nn=le[0],dn=le[1],Vn=le[2],cn=ct[0],wn=ct[1],xn=ct[2],gn=(1-(ir+xr))*nn,Un=(gt+Vr)*nn,bt=(Dt-Qr)*nn,Mn=(gt-Vr)*dn,be=(1-(Pt+xr))*dn,Se=(At+Pr)*dn,j=(Dt+Qr)*Vn,R=(At-Pr)*Vn,k=(1-(Pt+ir))*Vn;return U[0]=gn,U[1]=Un,U[2]=bt,U[3]=0,U[4]=Mn,U[5]=be,U[6]=Se,U[7]=0,U[8]=j,U[9]=R,U[10]=k,U[11]=0,U[12]=Qe[0]+cn-(gn*cn+Mn*wn+j*xn),U[13]=Qe[1]+wn-(Un*cn+be*wn+R*xn),U[14]=Qe[2]+xn-(bt*cn+Se*wn+k*xn),U[15]=1,U}function De(U,he){var Qe=he[0],le=he[1],ct=he[2],ft=he[3],jt=Qe+Qe,Lt=le+le,Ht=ct+ct,vr=Qe*jt,rt=le*jt,at=le*Lt,Pt=ct*jt,gt=ct*Lt,Dt=ct*Ht,ir=ft*jt,At=ft*Lt,xr=ft*Ht;return U[0]=1-at-Dt,U[1]=rt+xr,U[2]=Pt-At,U[3]=0,U[4]=rt-xr,U[5]=1-vr-Dt,U[6]=gt+ir,U[7]=0,U[8]=Pt+At,U[9]=gt-ir,U[10]=1-vr-at,U[11]=0,U[12]=0,U[13]=0,U[14]=0,U[15]=1,U}function Ve(U,he,Qe,le,ct,ft,jt){var Lt=1/(Qe-he),Ht=1/(ct-le),vr=1/(ft-jt);return U[0]=ft*2*Lt,U[1]=0,U[2]=0,U[3]=0,U[4]=0,U[5]=ft*2*Ht,U[6]=0,U[7]=0,U[8]=(Qe+he)*Lt,U[9]=(ct+le)*Ht,U[10]=(jt+ft)*vr,U[11]=-1,U[12]=0,U[13]=0,U[14]=jt*ft*2*vr,U[15]=0,U}function et(U,he,Qe,le,ct){var ft=1/Math.tan(he/2),jt;return U[0]=ft/Qe,U[1]=0,U[2]=0,U[3]=0,U[4]=0,U[5]=ft,U[6]=0,U[7]=0,U[8]=0,U[9]=0,U[11]=-1,U[12]=0,U[13]=0,U[15]=0,ct!=null&&ct!==Infinity?(jt=1/(le-ct),U[10]=(ct+le)*jt,U[14]=2*ct*le*jt):(U[10]=-1,U[14]=-2*le),U}var It=et;function er(U,he,Qe,le,ct){var ft=1/Math.tan(he/2),jt;return U[0]=ft/Qe,U[1]=0,U[2]=0,U[3]=0,U[4]=0,U[5]=ft,U[6]=0,U[7]=0,U[8]=0,U[9]=0,U[11]=-1,U[12]=0,U[13]=0,U[15]=0,ct!=null&&ct!==Infinity?(jt=1/(le-ct),U[10]=ct*jt,U[14]=ct*le*jt):(U[10]=-1,U[14]=-le),U}function nr(U,he,Qe,le){var ct=Math.tan(he.upDegrees*Math.PI/180),ft=Math.tan(he.downDegrees*Math.PI/180),jt=Math.tan(he.leftDegrees*Math.PI/180),Lt=Math.tan(he.rightDegrees*Math.PI/180),Ht=2/(jt+Lt),vr=2/(ct+ft);return U[0]=Ht,U[1]=0,U[2]=0,U[3]=0,U[4]=0,U[5]=vr,U[6]=0,U[7]=0,U[8]=-((jt-Lt)*Ht*.5),U[9]=(ct-ft)*vr*.5,U[10]=le/(Qe-le),U[11]=-1,U[12]=0,U[13]=0,U[14]=le*Qe/(Qe-le),U[15]=0,U}function Fe(U,he,Qe,le,ct,ft,jt){var Lt=1/(he-Qe),Ht=1/(le-ct),vr=1/(ft-jt);return U[0]=-2*Lt,U[1]=0,U[2]=0,U[3]=0,U[4]=0,U[5]=-2*Ht,U[6]=0,U[7]=0,U[8]=0,U[9]=0,U[10]=2*vr,U[11]=0,U[12]=(he+Qe)*Lt,U[13]=(ct+le)*Ht,U[14]=(jt+ft)*vr,U[15]=1,U}var Vt=Fe;function $t(U,he,Qe,le,ct,ft,jt){var Lt=1/(he-Qe),Ht=1/(le-ct),vr=1/(ft-jt);return U[0]=-2*Lt,U[1]=0,U[2]=0,U[3]=0,U[4]=0,U[5]=-2*Ht,U[6]=0,U[7]=0,U[8]=0,U[9]=0,U[10]=vr,U[11]=0,U[12]=(he+Qe)*Lt,U[13]=(ct+le)*Ht,U[14]=ft*vr,U[15]=1,U}function Ar(U,he,Qe,le){var ct,ft,jt,Lt,Ht,vr,rt,at,Pt,gt,Dt=he[0],ir=he[1],At=he[2],xr=le[0],Pr=le[1],Qr=le[2],Vr=Qe[0],nn=Qe[1],dn=Qe[2];return Math.abs(Dt-Vr)<S.EPSILON&&Math.abs(ir-nn)<S.EPSILON&&Math.abs(At-dn)<S.EPSILON?v(U):(rt=Dt-Vr,at=ir-nn,Pt=At-dn,gt=1/Math.hypot(rt,at,Pt),rt*=gt,at*=gt,Pt*=gt,ct=Pr*Pt-Qr*at,ft=Qr*rt-xr*Pt,jt=xr*at-Pr*rt,gt=Math.hypot(ct,ft,jt),gt?(gt=1/gt,ct*=gt,ft*=gt,jt*=gt):(ct=0,ft=0,jt=0),Lt=at*jt-Pt*ft,Ht=Pt*ct-rt*jt,vr=rt*ft-at*ct,gt=Math.hypot(Lt,Ht,vr),gt?(gt=1/gt,Lt*=gt,Ht*=gt,vr*=gt):(Lt=0,Ht=0,vr=0),U[0]=ct,U[1]=Lt,U[2]=rt,U[3]=0,U[4]=ft,U[5]=Ht,U[6]=at,U[7]=0,U[8]=jt,U[9]=vr,U[10]=Pt,U[11]=0,U[12]=-(ct*Dt+ft*ir+jt*At),U[13]=-(Lt*Dt+Ht*ir+vr*At),U[14]=-(rt*Dt+at*ir+Pt*At),U[15]=1,U)}function ke(U,he,Qe,le){var ct=he[0],ft=he[1],jt=he[2],Lt=le[0],Ht=le[1],vr=le[2],rt=ct-Qe[0],at=ft-Qe[1],Pt=jt-Qe[2],gt=rt*rt+at*at+Pt*Pt;gt>0&&(gt=1/Math.sqrt(gt),rt*=gt,at*=gt,Pt*=gt);var Dt=Ht*Pt-vr*at,ir=vr*rt-Lt*Pt,At=Lt*at-Ht*rt;return gt=Dt*Dt+ir*ir+At*At,gt>0&&(gt=1/Math.sqrt(gt),Dt*=gt,ir*=gt,At*=gt),U[0]=Dt,U[1]=ir,U[2]=At,U[3]=0,U[4]=at*At-Pt*ir,U[5]=Pt*Dt-rt*At,U[6]=rt*ir-at*Dt,U[7]=0,U[8]=rt,U[9]=at,U[10]=Pt,U[11]=0,U[12]=ct,U[13]=ft,U[14]=jt,U[15]=1,U}function Oe(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 we(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 Be(U,he,Qe){return U[0]=he[0]+Qe[0],U[1]=he[1]+Qe[1],U[2]=he[2]+Qe[2],U[3]=he[3]+Qe[3],U[4]=he[4]+Qe[4],U[5]=he[5]+Qe[5],U[6]=he[6]+Qe[6],U[7]=he[7]+Qe[7],U[8]=he[8]+Qe[8],U[9]=he[9]+Qe[9],U[10]=he[10]+Qe[10],U[11]=he[11]+Qe[11],U[12]=he[12]+Qe[12],U[13]=he[13]+Qe[13],U[14]=he[14]+Qe[14],U[15]=he[15]+Qe[15],U}function We(U,he,Qe){return U[0]=he[0]-Qe[0],U[1]=he[1]-Qe[1],U[2]=he[2]-Qe[2],U[3]=he[3]-Qe[3],U[4]=he[4]-Qe[4],U[5]=he[5]-Qe[5],U[6]=he[6]-Qe[6],U[7]=he[7]-Qe[7],U[8]=he[8]-Qe[8],U[9]=he[9]-Qe[9],U[10]=he[10]-Qe[10],U[11]=he[11]-Qe[11],U[12]=he[12]-Qe[12],U[13]=he[13]-Qe[13],U[14]=he[14]-Qe[14],U[15]=he[15]-Qe[15],U}function He(U,he,Qe){return U[0]=he[0]*Qe,U[1]=he[1]*Qe,U[2]=he[2]*Qe,U[3]=he[3]*Qe,U[4]=he[4]*Qe,U[5]=he[5]*Qe,U[6]=he[6]*Qe,U[7]=he[7]*Qe,U[8]=he[8]*Qe,U[9]=he[9]*Qe,U[10]=he[10]*Qe,U[11]=he[11]*Qe,U[12]=he[12]*Qe,U[13]=he[13]*Qe,U[14]=he[14]*Qe,U[15]=he[15]*Qe,U}function St(U,he,Qe,le){return U[0]=he[0]+Qe[0]*le,U[1]=he[1]+Qe[1]*le,U[2]=he[2]+Qe[2]*le,U[3]=he[3]+Qe[3]*le,U[4]=he[4]+Qe[4]*le,U[5]=he[5]+Qe[5]*le,U[6]=he[6]+Qe[6]*le,U[7]=he[7]+Qe[7]*le,U[8]=he[8]+Qe[8]*le,U[9]=he[9]+Qe[9]*le,U[10]=he[10]+Qe[10]*le,U[11]=he[11]+Qe[11]*le,U[12]=he[12]+Qe[12]*le,U[13]=he[13]+Qe[13]*le,U[14]=he[14]+Qe[14]*le,U[15]=he[15]+Qe[15]*le,U}function Mt(U,he){return U[0]===he[0]&&U[1]===he[1]&&U[2]===he[2]&&U[3]===he[3]&&U[4]===he[4]&&U[5]===he[5]&&U[6]===he[6]&&U[7]===he[7]&&U[8]===he[8]&&U[9]===he[9]&&U[10]===he[10]&&U[11]===he[11]&&U[12]===he[12]&&U[13]===he[13]&&U[14]===he[14]&&U[15]===he[15]}function sr(U,he){var Qe=U[0],le=U[1],ct=U[2],ft=U[3],jt=U[4],Lt=U[5],Ht=U[6],vr=U[7],rt=U[8],at=U[9],Pt=U[10],gt=U[11],Dt=U[12],ir=U[13],At=U[14],xr=U[15],Pr=he[0],Qr=he[1],Vr=he[2],nn=he[3],dn=he[4],Vn=he[5],cn=he[6],wn=he[7],xn=he[8],gn=he[9],Un=he[10],bt=he[11],Mn=he[12],be=he[13],Se=he[14],j=he[15];return Math.abs(Qe-Pr)<=S.EPSILON*Math.max(1,Math.abs(Qe),Math.abs(Pr))&&Math.abs(le-Qr)<=S.EPSILON*Math.max(1,Math.abs(le),Math.abs(Qr))&&Math.abs(ct-Vr)<=S.EPSILON*Math.max(1,Math.abs(ct),Math.abs(Vr))&&Math.abs(ft-nn)<=S.EPSILON*Math.max(1,Math.abs(ft),Math.abs(nn))&&Math.abs(jt-dn)<=S.EPSILON*Math.max(1,Math.abs(jt),Math.abs(dn))&&Math.abs(Lt-Vn)<=S.EPSILON*Math.max(1,Math.abs(Lt),Math.abs(Vn))&&Math.abs(Ht-cn)<=S.EPSILON*Math.max(1,Math.abs(Ht),Math.abs(cn))&&Math.abs(vr-wn)<=S.EPSILON*Math.max(1,Math.abs(vr),Math.abs(wn))&&Math.abs(rt-xn)<=S.EPSILON*Math.max(1,Math.abs(rt),Math.abs(xn))&&Math.abs(at-gn)<=S.EPSILON*Math.max(1,Math.abs(at),Math.abs(gn))&&Math.abs(Pt-Un)<=S.EPSILON*Math.max(1,Math.abs(Pt),Math.abs(Un))&&Math.abs(gt-bt)<=S.EPSILON*Math.max(1,Math.abs(gt),Math.abs(bt))&&Math.abs(Dt-Mn)<=S.EPSILON*Math.max(1,Math.abs(Dt),Math.abs(Mn))&&Math.abs(ir-be)<=S.EPSILON*Math.max(1,Math.abs(ir),Math.abs(be))&&Math.abs(At-Se)<=S.EPSILON*Math.max(1,Math.abs(At),Math.abs(Se))&&Math.abs(xr-j)<=S.EPSILON*Math.max(1,Math.abs(xr),Math.abs(j))}var Ge=T,ut=We},32945:function(dt,x,M){"use strict";M.r(x),M.d(x,{create:function(){return I},identity:function(){return A},setAxisAngle:function(){return v},getAxisAngle:function(){return p},getAngle:function(){return c},multiply:function(){return f},rotateX:function(){return l},rotateY:function(){return T},rotateZ:function(){return m},calculateW:function(){return w},exp:function(){return O},ln:function(){return D},pow:function(){return g},slerp:function(){return _},random:function(){return Y},invert:function(){return V},conjugate:function(){return z},fromMat3:function(){return Z},fromEuler:function(){return J},str:function(){return ee},clone:function(){return Q},fromValues:function(){return re},copy:function(){return fe},set:function(){return me},add:function(){return ae},mul:function(){return Ee},scale:function(){return Le},dot:function(){return De},lerp:function(){return Ve},length:function(){return et},len:function(){return It},squaredLength:function(){return er},sqrLen:function(){return nr},normalize:function(){return Fe},exactEquals:function(){return Vt},equals:function(){return $t},rotationTo:function(){return Ar},sqlerp:function(){return ke},setAxes:function(){return Oe}});var S=M(49685),B=M(35600),N=M(77160),E=M(98333);function I(){var we=new S.ARRAY_TYPE(4);return S.ARRAY_TYPE!=Float32Array&&(we[0]=0,we[1]=0,we[2]=0),we[3]=1,we}function A(we){return we[0]=0,we[1]=0,we[2]=0,we[3]=1,we}function v(we,Be,We){We=We*.5;var He=Math.sin(We);return we[0]=He*Be[0],we[1]=He*Be[1],we[2]=He*Be[2],we[3]=Math.cos(We),we}function p(we,Be){var We=Math.acos(Be[3])*2,He=Math.sin(We/2);return He>S.EPSILON?(we[0]=Be[0]/He,we[1]=Be[1]/He,we[2]=Be[2]/He):(we[0]=1,we[1]=0,we[2]=0),We}function c(we,Be){var We=De(we,Be);return Math.acos(2*We*We-1)}function f(we,Be,We){var He=Be[0],St=Be[1],Mt=Be[2],sr=Be[3],Ge=We[0],ut=We[1],U=We[2],he=We[3];return we[0]=He*he+sr*Ge+St*U-Mt*ut,we[1]=St*he+sr*ut+Mt*Ge-He*U,we[2]=Mt*he+sr*U+He*ut-St*Ge,we[3]=sr*he-He*Ge-St*ut-Mt*U,we}function l(we,Be,We){We*=.5;var He=Be[0],St=Be[1],Mt=Be[2],sr=Be[3],Ge=Math.sin(We),ut=Math.cos(We);return we[0]=He*ut+sr*Ge,we[1]=St*ut+Mt*Ge,we[2]=Mt*ut-St*Ge,we[3]=sr*ut-He*Ge,we}function T(we,Be,We){We*=.5;var He=Be[0],St=Be[1],Mt=Be[2],sr=Be[3],Ge=Math.sin(We),ut=Math.cos(We);return we[0]=He*ut-Mt*Ge,we[1]=St*ut+sr*Ge,we[2]=Mt*ut+He*Ge,we[3]=sr*ut-St*Ge,we}function m(we,Be,We){We*=.5;var He=Be[0],St=Be[1],Mt=Be[2],sr=Be[3],Ge=Math.sin(We),ut=Math.cos(We);return we[0]=He*ut+St*Ge,we[1]=St*ut-He*Ge,we[2]=Mt*ut+sr*Ge,we[3]=sr*ut-Mt*Ge,we}function w(we,Be){var We=Be[0],He=Be[1],St=Be[2];return we[0]=We,we[1]=He,we[2]=St,we[3]=Math.sqrt(Math.abs(1-We*We-He*He-St*St)),we}function O(we,Be){var We=Be[0],He=Be[1],St=Be[2],Mt=Be[3],sr=Math.sqrt(We*We+He*He+St*St),Ge=Math.exp(Mt),ut=sr>0?Ge*Math.sin(sr)/sr:0;return we[0]=We*ut,we[1]=He*ut,we[2]=St*ut,we[3]=Ge*Math.cos(sr),we}function D(we,Be){var We=Be[0],He=Be[1],St=Be[2],Mt=Be[3],sr=Math.sqrt(We*We+He*He+St*St),Ge=sr>0?Math.atan2(sr,Mt)/sr:0;return we[0]=We*Ge,we[1]=He*Ge,we[2]=St*Ge,we[3]=.5*Math.log(We*We+He*He+St*St+Mt*Mt),we}function g(we,Be,We){return D(we,Be),Le(we,we,We),O(we,we),we}function _(we,Be,We,He){var St=Be[0],Mt=Be[1],sr=Be[2],Ge=Be[3],ut=We[0],U=We[1],he=We[2],Qe=We[3],le,ct,ft,jt,Lt;return ct=St*ut+Mt*U+sr*he+Ge*Qe,ct<0&&(ct=-ct,ut=-ut,U=-U,he=-he,Qe=-Qe),1-ct>S.EPSILON?(le=Math.acos(ct),ft=Math.sin(le),jt=Math.sin((1-He)*le)/ft,Lt=Math.sin(He*le)/ft):(jt=1-He,Lt=He),we[0]=jt*St+Lt*ut,we[1]=jt*Mt+Lt*U,we[2]=jt*sr+Lt*he,we[3]=jt*Ge+Lt*Qe,we}function Y(we){var Be=S.RANDOM(),We=S.RANDOM(),He=S.RANDOM(),St=Math.sqrt(1-Be),Mt=Math.sqrt(Be);return we[0]=St*Math.sin(2*Math.PI*We),we[1]=St*Math.cos(2*Math.PI*We),we[2]=Mt*Math.sin(2*Math.PI*He),we[3]=Mt*Math.cos(2*Math.PI*He),we}function V(we,Be){var We=Be[0],He=Be[1],St=Be[2],Mt=Be[3],sr=We*We+He*He+St*St+Mt*Mt,Ge=sr?1/sr:0;return we[0]=-We*Ge,we[1]=-He*Ge,we[2]=-St*Ge,we[3]=Mt*Ge,we}function z(we,Be){return we[0]=-Be[0],we[1]=-Be[1],we[2]=-Be[2],we[3]=Be[3],we}function Z(we,Be){var We=Be[0]+Be[4]+Be[8],He;if(We>0)He=Math.sqrt(We+1),we[3]=.5*He,He=.5/He,we[0]=(Be[5]-Be[7])*He,we[1]=(Be[6]-Be[2])*He,we[2]=(Be[1]-Be[3])*He;else{var St=0;Be[4]>Be[0]&&(St=1),Be[8]>Be[St*3+St]&&(St=2);var Mt=(St+1)%3,sr=(St+2)%3;He=Math.sqrt(Be[St*3+St]-Be[Mt*3+Mt]-Be[sr*3+sr]+1),we[St]=.5*He,He=.5/He,we[3]=(Be[Mt*3+sr]-Be[sr*3+Mt])*He,we[Mt]=(Be[Mt*3+St]+Be[St*3+Mt])*He,we[sr]=(Be[sr*3+St]+Be[St*3+sr])*He}return we}function J(we,Be,We,He){var St=.5*Math.PI/180;Be*=St,We*=St,He*=St;var Mt=Math.sin(Be),sr=Math.cos(Be),Ge=Math.sin(We),ut=Math.cos(We),U=Math.sin(He),he=Math.cos(He);return we[0]=Mt*ut*he-sr*Ge*U,we[1]=sr*Ge*he+Mt*ut*U,we[2]=sr*ut*U-Mt*Ge*he,we[3]=sr*ut*he+Mt*Ge*U,we}function ee(we){return"quat("+we[0]+", "+we[1]+", "+we[2]+", "+we[3]+")"}var Q=E.clone,re=E.fromValues,fe=E.copy,me=E.set,ae=E.add,Ee=f,Le=E.scale,De=E.dot,Ve=E.lerp,et=E.length,It=et,er=E.squaredLength,nr=er,Fe=E.normalize,Vt=E.exactEquals,$t=E.equals,Ar=function(){var we=N.create(),Be=N.fromValues(1,0,0),We=N.fromValues(0,1,0);return function(He,St,Mt){var sr=N.dot(St,Mt);return sr<-.999999?(N.cross(we,Be,St),N.len(we)<1e-6&&N.cross(we,We,St),N.normalize(we,we),v(He,we,Math.PI),He):sr>.999999?(He[0]=0,He[1]=0,He[2]=0,He[3]=1,He):(N.cross(we,St,Mt),He[0]=we[0],He[1]=we[1],He[2]=we[2],He[3]=1+sr,Fe(He,He))}}(),ke=function(){var we=I(),Be=I();return function(We,He,St,Mt,sr,Ge){return _(we,He,sr,Ge),_(Be,St,Mt,Ge),_(We,we,Be,2*Ge*(1-Ge)),We}}(),Oe=function(){var we=B.create();return function(Be,We,He,St){return we[0]=He[0],we[3]=He[1],we[6]=He[2],we[1]=St[0],we[4]=St[1],we[7]=St[2],we[2]=-We[0],we[5]=-We[1],we[8]=-We[2],Fe(Be,Z(Be,we))}}()},98333:function(dt,x,M){"use strict";M.r(x),M.d(x,{create:function(){return B},clone:function(){return N},fromValues:function(){return E},copy:function(){return I},set:function(){return A},add:function(){return v},subtract:function(){return p},multiply:function(){return c},divide:function(){return f},ceil:function(){return l},floor:function(){return T},min:function(){return m},max:function(){return w},round:function(){return O},scale:function(){return D},scaleAndAdd:function(){return g},distance:function(){return _},squaredDistance:function(){return Y},length:function(){return V},squaredLength:function(){return z},negate:function(){return Z},inverse:function(){return J},normalize:function(){return ee},dot:function(){return Q},cross:function(){return re},lerp:function(){return fe},random:function(){return me},transformMat4:function(){return ae},transformQuat:function(){return Ee},zero:function(){return Le},str:function(){return De},exactEquals:function(){return Ve},equals:function(){return et},sub:function(){return It},mul:function(){return er},div:function(){return nr},dist:function(){return Fe},sqrDist:function(){return Vt},len:function(){return $t},sqrLen:function(){return Ar},forEach:function(){return ke}});var S=M(49685);function B(){var Oe=new S.ARRAY_TYPE(4);return S.ARRAY_TYPE!=Float32Array&&(Oe[0]=0,Oe[1]=0,Oe[2]=0,Oe[3]=0),Oe}function N(Oe){var we=new S.ARRAY_TYPE(4);return we[0]=Oe[0],we[1]=Oe[1],we[2]=Oe[2],we[3]=Oe[3],we}function E(Oe,we,Be,We){var He=new S.ARRAY_TYPE(4);return He[0]=Oe,He[1]=we,He[2]=Be,He[3]=We,He}function I(Oe,we){return Oe[0]=we[0],Oe[1]=we[1],Oe[2]=we[2],Oe[3]=we[3],Oe}function A(Oe,we,Be,We,He){return Oe[0]=we,Oe[1]=Be,Oe[2]=We,Oe[3]=He,Oe}function v(Oe,we,Be){return Oe[0]=we[0]+Be[0],Oe[1]=we[1]+Be[1],Oe[2]=we[2]+Be[2],Oe[3]=we[3]+Be[3],Oe}function p(Oe,we,Be){return Oe[0]=we[0]-Be[0],Oe[1]=we[1]-Be[1],Oe[2]=we[2]-Be[2],Oe[3]=we[3]-Be[3],Oe}function c(Oe,we,Be){return Oe[0]=we[0]*Be[0],Oe[1]=we[1]*Be[1],Oe[2]=we[2]*Be[2],Oe[3]=we[3]*Be[3],Oe}function f(Oe,we,Be){return Oe[0]=we[0]/Be[0],Oe[1]=we[1]/Be[1],Oe[2]=we[2]/Be[2],Oe[3]=we[3]/Be[3],Oe}function l(Oe,we){return Oe[0]=Math.ceil(we[0]),Oe[1]=Math.ceil(we[1]),Oe[2]=Math.ceil(we[2]),Oe[3]=Math.ceil(we[3]),Oe}function T(Oe,we){return Oe[0]=Math.floor(we[0]),Oe[1]=Math.floor(we[1]),Oe[2]=Math.floor(we[2]),Oe[3]=Math.floor(we[3]),Oe}function m(Oe,we,Be){return Oe[0]=Math.min(we[0],Be[0]),Oe[1]=Math.min(we[1],Be[1]),Oe[2]=Math.min(we[2],Be[2]),Oe[3]=Math.min(we[3],Be[3]),Oe}function w(Oe,we,Be){return Oe[0]=Math.max(we[0],Be[0]),Oe[1]=Math.max(we[1],Be[1]),Oe[2]=Math.max(we[2],Be[2]),Oe[3]=Math.max(we[3],Be[3]),Oe}function O(Oe,we){return Oe[0]=Math.round(we[0]),Oe[1]=Math.round(we[1]),Oe[2]=Math.round(we[2]),Oe[3]=Math.round(we[3]),Oe}function D(Oe,we,Be){return Oe[0]=we[0]*Be,Oe[1]=we[1]*Be,Oe[2]=we[2]*Be,Oe[3]=we[3]*Be,Oe}function g(Oe,we,Be,We){return Oe[0]=we[0]+Be[0]*We,Oe[1]=we[1]+Be[1]*We,Oe[2]=we[2]+Be[2]*We,Oe[3]=we[3]+Be[3]*We,Oe}function _(Oe,we){var Be=we[0]-Oe[0],We=we[1]-Oe[1],He=we[2]-Oe[2],St=we[3]-Oe[3];return Math.hypot(Be,We,He,St)}function Y(Oe,we){var Be=we[0]-Oe[0],We=we[1]-Oe[1],He=we[2]-Oe[2],St=we[3]-Oe[3];return Be*Be+We*We+He*He+St*St}function V(Oe){var we=Oe[0],Be=Oe[1],We=Oe[2],He=Oe[3];return Math.hypot(we,Be,We,He)}function z(Oe){var we=Oe[0],Be=Oe[1],We=Oe[2],He=Oe[3];return we*we+Be*Be+We*We+He*He}function Z(Oe,we){return Oe[0]=-we[0],Oe[1]=-we[1],Oe[2]=-we[2],Oe[3]=-we[3],Oe}function J(Oe,we){return Oe[0]=1/we[0],Oe[1]=1/we[1],Oe[2]=1/we[2],Oe[3]=1/we[3],Oe}function ee(Oe,we){var Be=we[0],We=we[1],He=we[2],St=we[3],Mt=Be*Be+We*We+He*He+St*St;return Mt>0&&(Mt=1/Math.sqrt(Mt)),Oe[0]=Be*Mt,Oe[1]=We*Mt,Oe[2]=He*Mt,Oe[3]=St*Mt,Oe}function Q(Oe,we){return Oe[0]*we[0]+Oe[1]*we[1]+Oe[2]*we[2]+Oe[3]*we[3]}function re(Oe,we,Be,We){var He=Be[0]*We[1]-Be[1]*We[0],St=Be[0]*We[2]-Be[2]*We[0],Mt=Be[0]*We[3]-Be[3]*We[0],sr=Be[1]*We[2]-Be[2]*We[1],Ge=Be[1]*We[3]-Be[3]*We[1],ut=Be[2]*We[3]-Be[3]*We[2],U=we[0],he=we[1],Qe=we[2],le=we[3];return Oe[0]=he*ut-Qe*Ge+le*sr,Oe[1]=-(U*ut)+Qe*Mt-le*St,Oe[2]=U*Ge-he*Mt+le*He,Oe[3]=-(U*sr)+he*St-Qe*He,Oe}function fe(Oe,we,Be,We){var He=we[0],St=we[1],Mt=we[2],sr=we[3];return Oe[0]=He+We*(Be[0]-He),Oe[1]=St+We*(Be[1]-St),Oe[2]=Mt+We*(Be[2]-Mt),Oe[3]=sr+We*(Be[3]-sr),Oe}function me(Oe,we){we=we||1;var Be,We,He,St,Mt,sr;do Be=S.RANDOM()*2-1,We=S.RANDOM()*2-1,Mt=Be*Be+We*We;while(Mt>=1);do He=S.RANDOM()*2-1,St=S.RANDOM()*2-1,sr=He*He+St*St;while(sr>=1);var Ge=Math.sqrt((1-Mt)/sr);return Oe[0]=we*Be,Oe[1]=we*We,Oe[2]=we*He*Ge,Oe[3]=we*St*Ge,Oe}function ae(Oe,we,Be){var We=we[0],He=we[1],St=we[2],Mt=we[3];return Oe[0]=Be[0]*We+Be[4]*He+Be[8]*St+Be[12]*Mt,Oe[1]=Be[1]*We+Be[5]*He+Be[9]*St+Be[13]*Mt,Oe[2]=Be[2]*We+Be[6]*He+Be[10]*St+Be[14]*Mt,Oe[3]=Be[3]*We+Be[7]*He+Be[11]*St+Be[15]*Mt,Oe}function Ee(Oe,we,Be){var We=we[0],He=we[1],St=we[2],Mt=Be[0],sr=Be[1],Ge=Be[2],ut=Be[3],U=ut*We+sr*St-Ge*He,he=ut*He+Ge*We-Mt*St,Qe=ut*St+Mt*He-sr*We,le=-Mt*We-sr*He-Ge*St;return Oe[0]=U*ut+le*-Mt+he*-Ge-Qe*-sr,Oe[1]=he*ut+le*-sr+Qe*-Mt-U*-Ge,Oe[2]=Qe*ut+le*-Ge+U*-sr-he*-Mt,Oe[3]=we[3],Oe}function Le(Oe){return Oe[0]=0,Oe[1]=0,Oe[2]=0,Oe[3]=0,Oe}function De(Oe){return"vec4("+Oe[0]+", "+Oe[1]+", "+Oe[2]+", "+Oe[3]+")"}function Ve(Oe,we){return Oe[0]===we[0]&&Oe[1]===we[1]&&Oe[2]===we[2]&&Oe[3]===we[3]}function et(Oe,we){var Be=Oe[0],We=Oe[1],He=Oe[2],St=Oe[3],Mt=we[0],sr=we[1],Ge=we[2],ut=we[3];return Math.abs(Be-Mt)<=S.EPSILON*Math.max(1,Math.abs(Be),Math.abs(Mt))&&Math.abs(We-sr)<=S.EPSILON*Math.max(1,Math.abs(We),Math.abs(sr))&&Math.abs(He-Ge)<=S.EPSILON*Math.max(1,Math.abs(He),Math.abs(Ge))&&Math.abs(St-ut)<=S.EPSILON*Math.max(1,Math.abs(St),Math.abs(ut))}var It=p,er=c,nr=f,Fe=_,Vt=Y,$t=V,Ar=z,ke=function(){var Oe=B();return function(we,Be,We,He,St,Mt){var sr,Ge;for(Be||(Be=4),We||(We=0),He?Ge=Math.min(He*Be+We,we.length):Ge=we.length,sr=We;sr<Ge;sr+=Be)Oe[0]=we[sr],Oe[1]=we[sr+1],Oe[2]=we[sr+2],Oe[3]=we[sr+3],St(Oe,Oe,Mt),we[sr]=Oe[0],we[sr+1]=Oe[1],we[sr+2]=Oe[2],we[sr+3]=Oe[3];return we}}()},89550:function(dt){dt.exports=x;function x(M,S,B){return M[0]=S[0]+B[0],M[1]=S[1]+B[1],M}},62189:function(dt){dt.exports=x;function x(M,S){return M[0]=Math.ceil(S[0]),M[1]=Math.ceil(S[1]),M}},76057:function(dt){dt.exports=x;function x(M){var S=new Float32Array(2);return S[0]=M[0],S[1]=M[1],S}},3492:function(dt){dt.exports=x;function x(M,S){return M[0]=S[0],M[1]=S[1],M}},61589:function(dt){dt.exports=x;function x(){var M=new Float32Array(2);return M[0]=0,M[1]=0,M}},77741:function(dt){dt.exports=x;function x(M,S,B){var N=S[0]*B[1]-S[1]*B[0];return M[0]=M[1]=0,M[2]=N,M}},80278:function(dt,x,M){dt.exports=M(27953)},27953:function(dt){dt.exports=x;function x(M,S){var B=S[0]-M[0],N=S[1]-M[1];return Math.sqrt(B*B+N*N)}},49973:function(dt,x,M){dt.exports=M(6773)},6773:function(dt){dt.exports=x;function x(M,S,B){return M[0]=S[0]/B[0],M[1]=S[1]/B[1],M}},56601:function(dt){dt.exports=x;function x(M,S){return M[0]*S[0]+M[1]*S[1]}},89936:function(dt){dt.exports=1e-6},51232:function(dt,x,M){dt.exports=B;var S=M(89936);function B(N,E){var I=N[0],A=N[1],v=E[0],p=E[1];return Math.abs(I-v)<=S*Math.max(1,Math.abs(I),Math.abs(v))&&Math.abs(A-p)<=S*Math.max(1,Math.abs(A),Math.abs(p))}},39546:function(dt){dt.exports=x;function x(M,S){return M[0]===S[0]&&M[1]===S[1]}},67744:function(dt){dt.exports=x;function x(M,S){return M[0]=Math.floor(S[0]),M[1]=Math.floor(S[1]),M}},49002:function(dt,x,M){dt.exports=B;var S=M(61589)();function B(N,E,I,A,v,p){var c,f;for(E||(E=2),I||(I=0),A?f=Math.min(A*E+I,N.length):f=N.length,c=I;c<f;c+=E)S[0]=N[c],S[1]=N[c+1],v(S,S,p),N[c]=S[0],N[c+1]=S[1];return N}},69878:function(dt){dt.exports=x;function x(M,S){var B=new Float32Array(2);return B[0]=M,B[1]=S,B}},32644:function(dt,x,M){dt.exports={EPSILON:M(89936),create:M(61589),clone:M(76057),fromValues:M(69878),copy:M(3492),set:M(68854),equals:M(51232),exactEquals:M(39546),add:M(89550),subtract:M(43650),sub:M(45222),multiply:M(79920),mul:M(23113),divide:M(6773),div:M(49973),inverse:M(83793),min:M(20676),max:M(97899),rotate:M(48677),floor:M(67744),ceil:M(62189),round:M(57074),scale:M(47838),scaleAndAdd:M(21066),distance:M(27953),dist:M(80278),squaredDistance:M(14290),sqrDist:M(79569),length:M(37781),len:M(8123),squaredLength:M(26791),sqrLen:M(1791),negate:M(90549),normalize:M(36820),dot:M(56601),cross:M(77741),lerp:M(20577),random:M(85773),transformMat2:M(904),transformMat2d:M(60736),transformMat3:M(60221),transformMat4:M(37674),forEach:M(49002),limit:M(82418)}},83793:function(dt){dt.exports=x;function x(M,S){return M[0]=1/S[0],M[1]=1/S[1],M}},8123:function(dt,x,M){dt.exports=M(37781)},37781:function(dt){dt.exports=x;function x(M){var S=M[0],B=M[1];return Math.sqrt(S*S+B*B)}},20577:function(dt){dt.exports=x;function x(M,S,B,N){var E=S[0],I=S[1];return M[0]=E+N*(B[0]-E),M[1]=I+N*(B[1]-I),M}},82418:function(dt){dt.exports=x;function x(M,S,B){var N=S[0]*S[0]+S[1]*S[1];if(N>B*B){var E=Math.sqrt(N);M[0]=S[0]/E*B,M[1]=S[1]/E*B}else M[0]=S[0],M[1]=S[1];return M}},97899:function(dt){dt.exports=x;function x(M,S,B){return M[0]=Math.max(S[0],B[0]),M[1]=Math.max(S[1],B[1]),M}},20676:function(dt){dt.exports=x;function x(M,S,B){return M[0]=Math.min(S[0],B[0]),M[1]=Math.min(S[1],B[1]),M}},23113:function(dt,x,M){dt.exports=M(79920)},79920:function(dt){dt.exports=x;function x(M,S,B){return M[0]=S[0]*B[0],M[1]=S[1]*B[1],M}},90549:function(dt){dt.exports=x;function x(M,S){return M[0]=-S[0],M[1]=-S[1],M}},36820:function(dt){dt.exports=x;function x(M,S){var B=S[0],N=S[1],E=B*B+N*N;return E>0&&(E=1/Math.sqrt(E),M[0]=S[0]*E,M[1]=S[1]*E),M}},85773:function(dt){dt.exports=x;function x(M,S){S=S||1;var B=Math.random()*2*Math.PI;return M[0]=Math.cos(B)*S,M[1]=Math.sin(B)*S,M}},48677:function(dt){dt.exports=x;function x(M,S,B){var N=Math.cos(B),E=Math.sin(B),I=S[0],A=S[1];return M[0]=I*N-A*E,M[1]=I*E+A*N,M}},57074:function(dt){dt.exports=x;function x(M,S){return M[0]=Math.round(S[0]),M[1]=Math.round(S[1]),M}},47838:function(dt){dt.exports=x;function x(M,S,B){return M[0]=S[0]*B,M[1]=S[1]*B,M}},21066:function(dt){dt.exports=x;function x(M,S,B,N){return M[0]=S[0]+B[0]*N,M[1]=S[1]+B[1]*N,M}},68854:function(dt){dt.exports=x;function x(M,S,B){return M[0]=S,M[1]=B,M}},79569:function(dt,x,M){dt.exports=M(14290)},1791:function(dt,x,M){dt.exports=M(26791)},14290:function(dt){dt.exports=x;function x(M,S){var B=S[0]-M[0],N=S[1]-M[1];return B*B+N*N}},26791:function(dt){dt.exports=x;function x(M){var S=M[0],B=M[1];return S*S+B*B}},45222:function(dt,x,M){dt.exports=M(43650)},43650:function(dt){dt.exports=x;function x(M,S,B){return M[0]=S[0]-B[0],M[1]=S[1]-B[1],M}},904:function(dt){dt.exports=x;function x(M,S,B){var N=S[0],E=S[1];return M[0]=B[0]*N+B[2]*E,M[1]=B[1]*N+B[3]*E,M}},60736:function(dt){dt.exports=x;function x(M,S,B){var N=S[0],E=S[1];return M[0]=B[0]*N+B[2]*E+B[4],M[1]=B[1]*N+B[3]*E+B[5],M}},60221:function(dt){dt.exports=x;function x(M,S,B){var N=S[0],E=S[1];return M[0]=B[0]*N+B[3]*E+B[6],M[1]=B[1]*N+B[4]*E+B[7],M}},37674:function(dt){dt.exports=x;function x(M,S,B){var N=S[0],E=S[1];return M[0]=B[0]*N+B[4]*E+B[12],M[1]=B[1]*N+B[5]*E+B[13],M}},38186:function(dt){var x=[],M=[],S="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function B(E,I){if(I=I||{},E===void 0)throw new Error(S);var A=I.prepend===!0?"prepend":"append",v=I.container!==void 0?I.container:document.querySelector("head"),p=x.indexOf(v);p===-1&&(p=x.push(v)-1,M[p]={});var c;return M[p]!==void 0&&M[p][A]!==void 0?c=M[p][A]:(c=M[p][A]=N(),A==="prepend"?v.insertBefore(c,v.childNodes[0]):v.appendChild(c)),E.charCodeAt(0)===65279&&(E=E.substr(1,E.length)),c.styleSheet?c.styleSheet.cssText+=E:c.textContent+=E,c}function N(){var E=document.createElement("style");return E.setAttribute("type","text/css"),E}dt.exports=B,dt.exports.insertCss=B},7375:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0});var M=Symbol.for("INJECTION");function S(A,v,p,c){function f(){return c&&!Reflect.hasMetadata(M,this,v)&&Reflect.defineMetadata(M,p(),this,v),Reflect.hasMetadata(M,this,v)?Reflect.getMetadata(M,this,v):p()}function l(T){Reflect.defineMetadata(M,T,this,v)}Object.defineProperty(A,v,{configurable:!0,enumerable:!0,get:f,set:l})}function B(A,v){return function(p){return function(c,f){var l=function(){return A.get(p)};S(c,f,l,v)}}}x.makePropertyInjectDecorator=B;function N(A,v){return function(p,c){return function(f,l){var T=function(){return A.getNamed(p,c)};S(f,l,T,v)}}}x.makePropertyInjectNamedDecorator=N;function E(A,v){return function(p,c,f){return function(l,T){var m=function(){return A.getTagged(p,c,f)};S(l,T,m,v)}}}x.makePropertyInjectTaggedDecorator=E;function I(A,v){return function(p){return function(c,f){var l=function(){return A.getAll(p)};S(c,f,l,v)}}}x.makePropertyMultiInjectDecorator=I},84879:function(dt,x,M){"use strict";var S;S={value:!0};var B=M(7375);function N(E,I){I===void 0&&(I=!0);var A=B.makePropertyInjectDecorator(E,I),v=B.makePropertyInjectNamedDecorator(E,I),p=B.makePropertyInjectTaggedDecorator(E,I),c=B.makePropertyMultiInjectDecorator(E,I);return{lazyInject:A,lazyInjectNamed:v,lazyInjectTagged:p,lazyMultiInject:c}}x.Z=N},99934:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.tagProperty=x.tagParameter=x.decorate=void 0;var S=M(16674),B=M(6867);function N(c,f,l,T){var m=B.TAGGED;I(m,c,f,T,l)}x.tagParameter=N;function E(c,f,l){var T=B.TAGGED_PROP;I(T,c.constructor,f,l)}x.tagProperty=E;function I(c,f,l,T,m){var w={},O=typeof m=="number",D=m!==void 0&&O?m.toString():l;if(O&&l!==void 0)throw new Error(S.INVALID_DECORATOR_OPERATION);Reflect.hasOwnMetadata(c,f)&&(w=Reflect.getMetadata(c,f));var g=w[D];if(!Array.isArray(g))g=[];else for(var _=0,Y=g;_<Y.length;_++){var V=Y[_];if(V.key===T.key)throw new Error(S.DUPLICATED_METADATA+" "+V.key.toString())}g.push(T),w[D]=g,Reflect.defineMetadata(c,w,f)}function A(c,f){Reflect.decorate(c,f)}function v(c,f){return function(l,T){f(l,T,c)}}function p(c,f,l){typeof l=="number"?A([v(l,c)],f):typeof l=="string"?Reflect.decorate([c],f,l):A([c],f)}x.decorate=p},5744:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.inject=x.LazyServiceIdentifer=void 0;var S=M(16674),B=M(6867),N=M(47738),E=M(99934),I=function(){function v(p){this._cb=p}return v.prototype.unwrap=function(){return this._cb()},v}();x.LazyServiceIdentifer=I;function A(v){return function(p,c,f){if(v===void 0)throw new Error(S.UNDEFINED_INJECT_ANNOTATION(p.name));var l=new N.Metadata(B.INJECT_TAG,v);typeof f=="number"?E.tagParameter(p,c,f,l):E.tagProperty(p,c,l)}}x.inject=A},64315:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.injectable=void 0;var S=M(16674),B=M(6867);function N(){return function(E){if(Reflect.hasOwnMetadata(B.PARAM_TYPES,E))throw new Error(S.DUPLICATED_INJECTABLE_DECORATOR);var I=Reflect.getMetadata(B.DESIGN_PARAM_TYPES,E)||[];return Reflect.defineMetadata(B.PARAM_TYPES,I,E),E}}x.injectable=N},71693:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.multiInject=void 0;var S=M(6867),B=M(47738),N=M(99934);function E(I){return function(A,v,p){var c=new B.Metadata(S.MULTI_INJECT_TAG,I);typeof p=="number"?N.tagParameter(A,v,p,c):N.tagProperty(A,v,c)}}x.multiInject=E},38085:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.named=void 0;var S=M(6867),B=M(47738),N=M(99934);function E(I){return function(A,v,p){var c=new B.Metadata(S.NAMED_TAG,I);typeof p=="number"?N.tagParameter(A,v,p,c):N.tagProperty(A,v,c)}}x.named=E},6515:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.optional=void 0;var S=M(6867),B=M(47738),N=M(99934);function E(){return function(I,A,v){var p=new B.Metadata(S.OPTIONAL_TAG,!0);typeof v=="number"?N.tagParameter(I,A,v,p):N.tagProperty(I,A,p)}}x.optional=E},7014:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.postConstruct=void 0;var S=M(16674),B=M(6867),N=M(47738);function E(){return function(I,A,v){var p=new N.Metadata(B.POST_CONSTRUCT,A);if(Reflect.hasOwnMetadata(B.POST_CONSTRUCT,I.constructor))throw new Error(S.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(B.POST_CONSTRUCT,p,I.constructor)}}x.postConstruct=E},32052:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.tagged=void 0;var S=M(47738),B=M(99934);function N(E,I){return function(A,v,p){var c=new S.Metadata(E,I);typeof p=="number"?B.tagParameter(A,v,p,c):B.tagProperty(A,v,c)}}x.tagged=N},55638:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.targetName=void 0;var S=M(6867),B=M(47738),N=M(99934);function E(I){return function(A,v,p){var c=new B.Metadata(S.NAME_TAG,I);N.tagParameter(A,v,p,c)}}x.targetName=E},86757:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.unmanaged=void 0;var S=M(6867),B=M(47738),N=M(99934);function E(){return function(I,A,v){var p=new B.Metadata(S.UNMANAGED_TAG,!0);N.tagParameter(I,A,v,p)}}x.unmanaged=E},44290:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.Binding=void 0;var S=M(28421),B=M(37791),N=function(){function E(I,A){this.id=B.id(),this.activated=!1,this.serviceIdentifier=I,this.scope=A,this.type=S.BindingTypeEnum.Invalid,this.constraint=function(v){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return E.prototype.clone=function(){var I=new E(this.serviceIdentifier,this.scope);return I.activated=I.scope===S.BindingScopeEnum.Singleton?this.activated:!1,I.implementationType=this.implementationType,I.dynamicValue=this.dynamicValue,I.scope=this.scope,I.type=this.type,I.factory=this.factory,I.provider=this.provider,I.constraint=this.constraint,I.onActivation=this.onActivation,I.cache=this.cache,I},E}();x.Binding=N},23184:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.BindingCount=void 0;var M={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};x.BindingCount=M},16674:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.STACK_OVERFLOW=x.CIRCULAR_DEPENDENCY_IN_FACTORY=x.POST_CONSTRUCT_ERROR=x.MULTIPLE_POST_CONSTRUCT_METHODS=x.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK=x.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE=x.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE=x.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT=x.ARGUMENTS_LENGTH_MISMATCH=x.INVALID_DECORATOR_OPERATION=x.INVALID_TO_SELF_VALUE=x.INVALID_FUNCTION_BINDING=x.INVALID_MIDDLEWARE_RETURN=x.NO_MORE_SNAPSHOTS_AVAILABLE=x.INVALID_BINDING_TYPE=x.NOT_IMPLEMENTED=x.CIRCULAR_DEPENDENCY=x.UNDEFINED_INJECT_ANNOTATION=x.MISSING_INJECT_ANNOTATION=x.MISSING_INJECTABLE_ANNOTATION=x.NOT_REGISTERED=x.CANNOT_UNBIND=x.AMBIGUOUS_MATCH=x.KEY_NOT_FOUND=x.NULL_ARGUMENT=x.DUPLICATED_METADATA=x.DUPLICATED_INJECTABLE_DECORATOR=void 0,x.DUPLICATED_INJECTABLE_DECORATOR="Cannot apply @injectable decorator multiple times.",x.DUPLICATED_METADATA="Metadata key was used more than once in a parameter:",x.NULL_ARGUMENT="NULL argument",x.KEY_NOT_FOUND="Key Not Found",x.AMBIGUOUS_MATCH="Ambiguous match found for serviceIdentifier:",x.CANNOT_UNBIND="Could not unbind serviceIdentifier:",x.NOT_REGISTERED="No matching bindings found for serviceIdentifier:",x.MISSING_INJECTABLE_ANNOTATION="Missing required @injectable annotation in:",x.MISSING_INJECT_ANNOTATION="Missing required @inject or @multiInject annotation in:";var M=function(E){return"@inject called with undefined this could mean that the class "+E+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."};x.UNDEFINED_INJECT_ANNOTATION=M,x.CIRCULAR_DEPENDENCY="Circular dependency found:",x.NOT_IMPLEMENTED="Sorry, this feature is not fully implemented yet.",x.INVALID_BINDING_TYPE="Invalid binding type:",x.NO_MORE_SNAPSHOTS_AVAILABLE="No snapshot available to restore.",x.INVALID_MIDDLEWARE_RETURN="Invalid return type in middleware. Middleware must return!",x.INVALID_FUNCTION_BINDING="Value provided to function binding must be a function!",x.INVALID_TO_SELF_VALUE="The toSelf function can only be applied when a constructor is used as service identifier",x.INVALID_DECORATOR_OPERATION="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.";var S=function(){for(var E=[],I=0;I<arguments.length;I++)E[I]=arguments[I];return"The number of constructor arguments in the derived class "+(E[0]+" must be >= than the number of constructor arguments of its base class.")};x.ARGUMENTS_LENGTH_MISMATCH=S,x.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.",x.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE="Invalid Container option. Default scope must be a string ('singleton' or 'transient').",x.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean",x.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean",x.MULTIPLE_POST_CONSTRUCT_METHODS="Cannot apply @postConstruct decorator multiple times in the same class";var B=function(){for(var E=[],I=0;I<arguments.length;I++)E[I]=arguments[I];return"@postConstruct error in class "+E[0]+": "+E[1]};x.POST_CONSTRUCT_ERROR=B;var N=function(){for(var E=[],I=0;I<arguments.length;I++)E[I]=arguments[I];return"It looks like there is a circular dependency "+("in one of the '"+E[0]+"' bindings. Please investigate bindings with")+("service identifier '"+E[1]+"'.")};x.CIRCULAR_DEPENDENCY_IN_FACTORY=N,x.STACK_OVERFLOW="Maximum call stack size exceeded"},28421:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.TargetTypeEnum=x.BindingTypeEnum=x.BindingScopeEnum=void 0;var M={Request:"Request",Singleton:"Singleton",Transient:"Transient"};x.BindingScopeEnum=M;var S={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};x.BindingTypeEnum=S;var B={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"};x.TargetTypeEnum=B},6867:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.NON_CUSTOM_TAG_KEYS=x.POST_CONSTRUCT=x.DESIGN_PARAM_TYPES=x.PARAM_TYPES=x.TAGGED_PROP=x.TAGGED=x.MULTI_INJECT_TAG=x.INJECT_TAG=x.OPTIONAL_TAG=x.UNMANAGED_TAG=x.NAME_TAG=x.NAMED_TAG=void 0,x.NAMED_TAG="named",x.NAME_TAG="name",x.UNMANAGED_TAG="unmanaged",x.OPTIONAL_TAG="optional",x.INJECT_TAG="inject",x.MULTI_INJECT_TAG="multi_inject",x.TAGGED="inversify:tagged",x.TAGGED_PROP="inversify:tagged_props",x.PARAM_TYPES="inversify:paramtypes",x.DESIGN_PARAM_TYPES="design:paramtypes",x.POST_CONSTRUCT="post_construct";function M(){return[x.INJECT_TAG,x.MULTI_INJECT_TAG,x.NAME_TAG,x.UNMANAGED_TAG,x.NAMED_TAG,x.OPTIONAL_TAG]}x.NON_CUSTOM_TAG_KEYS=M()},51389:function(dt,x,M){"use strict";var S=this&&this.__awaiter||function(g,_,Y,V){function z(Z){return Z instanceof Y?Z:new Y(function(J){J(Z)})}return new(Y||(Y=Promise))(function(Z,J){function ee(fe){try{re(V.next(fe))}catch(me){J(me)}}function Q(fe){try{re(V.throw(fe))}catch(me){J(me)}}function re(fe){fe.done?Z(fe.value):z(fe.value).then(ee,Q)}re((V=V.apply(g,_||[])).next())})},B=this&&this.__generator||function(g,_){var Y={label:0,sent:function(){if(Z[0]&1)throw Z[1];return Z[1]},trys:[],ops:[]},V,z,Z,J;return J={next:ee(0),throw:ee(1),return:ee(2)},typeof Symbol=="function"&&(J[Symbol.iterator]=function(){return this}),J;function ee(re){return function(fe){return Q([re,fe])}}function Q(re){if(V)throw new TypeError("Generator is already executing.");for(;Y;)try{if(V=1,z&&(Z=re[0]&2?z.return:re[0]?z.throw||((Z=z.return)&&Z.call(z),0):z.next)&&!(Z=Z.call(z,re[1])).done)return Z;switch(z=0,Z&&(re=[re[0]&2,Z.value]),re[0]){case 0:case 1:Z=re;break;case 4:return Y.label++,{value:re[1],done:!1};case 5:Y.label++,z=re[1],re=[0];continue;case 7:re=Y.ops.pop(),Y.trys.pop();continue;default:if(Z=Y.trys,!(Z=Z.length>0&&Z[Z.length-1])&&(re[0]===6||re[0]===2)){Y=0;continue}if(re[0]===3&&(!Z||re[1]>Z[0]&&re[1]<Z[3])){Y.label=re[1];break}if(re[0]===6&&Y.label<Z[1]){Y.label=Z[1],Z=re;break}if(Z&&Y.label<Z[2]){Y.label=Z[2],Y.ops.push(re);break}Z[2]&&Y.ops.pop(),Y.trys.pop();continue}re=_.call(g,Y)}catch(fe){re=[6,fe],z=0}finally{V=Z=0}if(re[0]&5)throw re[1];return{value:re[0]?re[1]:void 0,done:!0}}},N=this&&this.__spreadArray||function(g,_){for(var Y=0,V=_.length,z=g.length;Y<V;Y++,z++)g[z]=_[Y];return g};Object.defineProperty(x,"__esModule",{value:!0}),x.Container=void 0;var E=M(44290),I=M(16674),A=M(28421),v=M(6867),p=M(51377),c=M(86311),f=M(31927),l=M(51860),T=M(37791),m=M(55800),w=M(85700),O=M(80175),D=function(){function g(_){this._appliedMiddleware=[];var Y=_||{};if(typeof Y!="object")throw new Error(""+I.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(Y.defaultScope===void 0)Y.defaultScope=A.BindingScopeEnum.Transient;else if(Y.defaultScope!==A.BindingScopeEnum.Singleton&&Y.defaultScope!==A.BindingScopeEnum.Transient&&Y.defaultScope!==A.BindingScopeEnum.Request)throw new Error(""+I.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(Y.autoBindInjectable===void 0)Y.autoBindInjectable=!1;else if(typeof Y.autoBindInjectable!="boolean")throw new Error(""+I.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(Y.skipBaseClassChecks===void 0)Y.skipBaseClassChecks=!1;else if(typeof Y.skipBaseClassChecks!="boolean")throw new Error(""+I.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:Y.autoBindInjectable,defaultScope:Y.defaultScope,skipBaseClassChecks:Y.skipBaseClassChecks},this.id=T.id(),this._bindingDictionary=new O.Lookup,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new p.MetadataReader}return g.merge=function(_,Y){for(var V=[],z=2;z<arguments.length;z++)V[z-2]=arguments[z];var Z=new g,J=N([_,Y],V).map(function(re){return c.getBindingDictionary(re)}),ee=c.getBindingDictionary(Z);function Q(re,fe){re.traverse(function(me,ae){ae.forEach(function(Ee){fe.add(Ee.serviceIdentifier,Ee.clone())})})}return J.forEach(function(re){Q(re,ee)}),Z},g.prototype.load=function(){for(var _=[],Y=0;Y<arguments.length;Y++)_[Y]=arguments[Y];for(var V=this._getContainerModuleHelpersFactory(),z=0,Z=_;z<Z.length;z++){var J=Z[z],ee=V(J.id);J.registry(ee.bindFunction,ee.unbindFunction,ee.isboundFunction,ee.rebindFunction)}},g.prototype.loadAsync=function(){for(var _=[],Y=0;Y<arguments.length;Y++)_[Y]=arguments[Y];return S(this,void 0,void 0,function(){var V,z,Z,J,ee;return B(this,function(Q){switch(Q.label){case 0:V=this._getContainerModuleHelpersFactory(),z=0,Z=_,Q.label=1;case 1:return z<Z.length?(J=Z[z],ee=V(J.id),[4,J.registry(ee.bindFunction,ee.unbindFunction,ee.isboundFunction,ee.rebindFunction)]):[3,4];case 2:Q.sent(),Q.label=3;case 3:return z++,[3,1];case 4:return[2]}})})},g.prototype.unload=function(){for(var _=this,Y=[],V=0;V<arguments.length;V++)Y[V]=arguments[V];var z=function(Z){return function(J){return J.moduleId===Z}};Y.forEach(function(Z){var J=z(Z.id);_._bindingDictionary.removeByCondition(J)})},g.prototype.bind=function(_){var Y=this.options.defaultScope||A.BindingScopeEnum.Transient,V=new E.Binding(_,Y);return this._bindingDictionary.add(_,V),new l.BindingToSyntax(V)},g.prototype.rebind=function(_){return this.unbind(_),this.bind(_)},g.prototype.unbind=function(_){try{this._bindingDictionary.remove(_)}catch(Y){throw new Error(I.CANNOT_UNBIND+" "+m.getServiceIdentifierAsString(_))}},g.prototype.unbindAll=function(){this._bindingDictionary=new O.Lookup},g.prototype.isBound=function(_){var Y=this._bindingDictionary.hasKey(_);return!Y&&this.parent&&(Y=this.parent.isBound(_)),Y},g.prototype.isBoundNamed=function(_,Y){return this.isBoundTagged(_,v.NAMED_TAG,Y)},g.prototype.isBoundTagged=function(_,Y,V){var z=!1;if(this._bindingDictionary.hasKey(_)){var Z=this._bindingDictionary.get(_),J=c.createMockRequest(this,_,Y,V);z=Z.some(function(ee){return ee.constraint(J)})}return!z&&this.parent&&(z=this.parent.isBoundTagged(_,Y,V)),z},g.prototype.snapshot=function(){this._snapshots.push(w.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware))},g.prototype.restore=function(){var _=this._snapshots.pop();if(_===void 0)throw new Error(I.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=_.bindings,this._middleware=_.middleware},g.prototype.createChild=function(_){var Y=new g(_||this.options);return Y.parent=this,Y},g.prototype.applyMiddleware=function(){for(var _=[],Y=0;Y<arguments.length;Y++)_[Y]=arguments[Y];this._appliedMiddleware=this._appliedMiddleware.concat(_);var V=this._middleware?this._middleware:this._planAndResolve();this._middleware=_.reduce(function(z,Z){return Z(z)},V)},g.prototype.applyCustomMetadataReader=function(_){this._metadataReader=_},g.prototype.get=function(_){return this._get(!1,!1,A.TargetTypeEnum.Variable,_)},g.prototype.getTagged=function(_,Y,V){return this._get(!1,!1,A.TargetTypeEnum.Variable,_,Y,V)},g.prototype.getNamed=function(_,Y){return this.getTagged(_,v.NAMED_TAG,Y)},g.prototype.getAll=function(_){return this._get(!0,!0,A.TargetTypeEnum.Variable,_)},g.prototype.getAllTagged=function(_,Y,V){return this._get(!1,!0,A.TargetTypeEnum.Variable,_,Y,V)},g.prototype.getAllNamed=function(_,Y){return this.getAllTagged(_,v.NAMED_TAG,Y)},g.prototype.resolve=function(_){var Y=this.createChild();return Y.bind(_).toSelf(),this._appliedMiddleware.forEach(function(V){Y.applyMiddleware(V)}),Y.get(_)},g.prototype._getContainerModuleHelpersFactory=function(){var _=this,Y=function(ee,Q){ee._binding.moduleId=Q},V=function(ee){return function(Q){var re=_.bind.bind(_),fe=re(Q);return Y(fe,ee),fe}},z=function(ee){return function(Q){var re=_.unbind.bind(_);re(Q)}},Z=function(ee){return function(Q){var re=_.isBound.bind(_);return re(Q)}},J=function(ee){return function(Q){var re=_.rebind.bind(_),fe=re(Q);return Y(fe,ee),fe}};return function(ee){return{bindFunction:V(ee),isboundFunction:Z(ee),rebindFunction:J(ee),unbindFunction:z(ee)}}},g.prototype._get=function(_,Y,V,z,Z,J){var ee=null,Q={avoidConstraints:_,contextInterceptor:function(re){return re},isMultiInject:Y,key:Z,serviceIdentifier:z,targetType:V,value:J};if(this._middleware){if(ee=this._middleware(Q),ee==null)throw new Error(I.INVALID_MIDDLEWARE_RETURN)}else ee=this._planAndResolve()(Q);return ee},g.prototype._planAndResolve=function(){var _=this;return function(Y){var V=c.plan(_._metadataReader,_,Y.isMultiInject,Y.targetType,Y.serviceIdentifier,Y.key,Y.value,Y.avoidConstraints);V=Y.contextInterceptor(V);var z=f.resolve(V);return z}},g}();x.Container=D},33244:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.AsyncContainerModule=x.ContainerModule=void 0;var S=M(37791),B=function(){function E(I){this.id=S.id(),this.registry=I}return E}();x.ContainerModule=B;var N=function(){function E(I){this.id=S.id(),this.registry=I}return E}();x.AsyncContainerModule=N},85700:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.ContainerSnapshot=void 0;var M=function(){function S(){}return S.of=function(B,N){var E=new S;return E.bindings=B,E.middleware=N,E},S}();x.ContainerSnapshot=M},80175:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.Lookup=void 0;var S=M(16674),B=function(){function N(){this._map=new Map}return N.prototype.getMap=function(){return this._map},N.prototype.add=function(E,I){if(E==null)throw new Error(S.NULL_ARGUMENT);if(I==null)throw new Error(S.NULL_ARGUMENT);var A=this._map.get(E);A!==void 0?(A.push(I),this._map.set(E,A)):this._map.set(E,[I])},N.prototype.get=function(E){if(E==null)throw new Error(S.NULL_ARGUMENT);var I=this._map.get(E);if(I!==void 0)return I;throw new Error(S.KEY_NOT_FOUND)},N.prototype.remove=function(E){if(E==null)throw new Error(S.NULL_ARGUMENT);if(!this._map.delete(E))throw new Error(S.KEY_NOT_FOUND)},N.prototype.removeByCondition=function(E){var I=this;this._map.forEach(function(A,v){var p=A.filter(function(c){return!E(c)});p.length>0?I._map.set(v,p):I._map.delete(v)})},N.prototype.hasKey=function(E){if(E==null)throw new Error(S.NULL_ARGUMENT);return this._map.has(E)},N.prototype.clone=function(){var E=new N;return this._map.forEach(function(I,A){I.forEach(function(v){return E.add(A,v.clone())})}),E},N.prototype.traverse=function(E){this._map.forEach(function(I,A){E(A,I)})},N}();x.Lookup=B},86700:function(dt,x,M){"use strict";var S;S={value:!0},S=S=S=S=S=S=S=S=S=S=S=S=S=S=S=x.f3=x.t6=S=x.b2=S=S=S=S=S=x.W2=S=void 0;var B=M(6867);S=B;var N=M(51389);Object.defineProperty(x,"W2",{enumerable:!0,get:function(){return N.Container}});var E=M(28421);S={enumerable:!0,get:function(){return E.BindingScopeEnum}},S={enumerable:!0,get:function(){return E.BindingTypeEnum}},S={enumerable:!0,get:function(){return E.TargetTypeEnum}};var I=M(33244);S={enumerable:!0,get:function(){return I.AsyncContainerModule}},S={enumerable:!0,get:function(){return I.ContainerModule}};var A=M(64315);Object.defineProperty(x,"b2",{enumerable:!0,get:function(){return A.injectable}});var v=M(32052);S={enumerable:!0,get:function(){return v.tagged}};var p=M(38085);Object.defineProperty(x,"t6",{enumerable:!0,get:function(){return p.named}});var c=M(5744);Object.defineProperty(x,"f3",{enumerable:!0,get:function(){return c.inject}}),S={enumerable:!0,get:function(){return c.LazyServiceIdentifer}};var f=M(6515);S={enumerable:!0,get:function(){return f.optional}};var l=M(86757);S={enumerable:!0,get:function(){return l.unmanaged}};var T=M(71693);S={enumerable:!0,get:function(){return T.multiInject}};var m=M(55638);S={enumerable:!0,get:function(){return m.targetName}};var w=M(7014);S={enumerable:!0,get:function(){return w.postConstruct}};var O=M(51377);S={enumerable:!0,get:function(){return O.MetadataReader}};var D=M(37791);S={enumerable:!0,get:function(){return D.id}};var g=M(99934);S={enumerable:!0,get:function(){return g.decorate}};var _=M(80758);S={enumerable:!0,get:function(){return _.traverseAncerstors}},S={enumerable:!0,get:function(){return _.taggedConstraint}},S={enumerable:!0,get:function(){return _.namedConstraint}},S={enumerable:!0,get:function(){return _.typeConstraint}};var Y=M(55800);S={enumerable:!0,get:function(){return Y.getServiceIdentifierAsString}};var V=M(70600);S={enumerable:!0,get:function(){return V.multiBindToService}}},95228:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.Context=void 0;var S=M(37791),B=function(){function N(E){this.id=S.id(),this.container=E}return N.prototype.addPlan=function(E){this.plan=E},N.prototype.setCurrentRequest=function(E){this.currentRequest=E},N}();x.Context=B},47738:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.Metadata=void 0;var S=M(6867),B=function(){function N(E,I){this.key=E,this.value=I}return N.prototype.toString=function(){return this.key===S.NAMED_TAG?"named: "+this.value.toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+this.value+" }"},N}();x.Metadata=B},51377:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.MetadataReader=void 0;var S=M(6867),B=function(){function N(){}return N.prototype.getConstructorMetadata=function(E){var I=Reflect.getMetadata(S.PARAM_TYPES,E),A=Reflect.getMetadata(S.TAGGED,E);return{compilerGeneratedMetadata:I,userGeneratedMetadata:A||{}}},N.prototype.getPropertiesMetadata=function(E){var I=Reflect.getMetadata(S.TAGGED_PROP,E)||[];return I},N}();x.MetadataReader=B},55314:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.Plan=void 0;var M=function(){function S(B,N){this.parentContext=B,this.rootRequest=N}return S}();x.Plan=M},86311:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.getBindingDictionary=x.createMockRequest=x.plan=void 0;var S=M(23184),B=M(16674),N=M(28421),E=M(6867),I=M(85265),A=M(55800),v=M(95228),p=M(47738),c=M(55314),f=M(6e3),l=M(6748),T=M(18924);function m(z){return z._bindingDictionary}x.getBindingDictionary=m;function w(z,Z,J,ee,Q,re){var fe=z?E.MULTI_INJECT_TAG:E.INJECT_TAG,me=new p.Metadata(fe,J),ae=new T.Target(Z,ee,J,me);if(Q!==void 0){var Ee=new p.Metadata(Q,re);ae.metadata.push(Ee)}return ae}function O(z,Z,J,ee,Q){var re=_(J.container,Q.serviceIdentifier),fe=[];return re.length===S.BindingCount.NoBindingsAvailable&&J.container.options.autoBindInjectable&&typeof Q.serviceIdentifier=="function"&&z.getConstructorMetadata(Q.serviceIdentifier).compilerGeneratedMetadata&&(J.container.bind(Q.serviceIdentifier).toSelf(),re=_(J.container,Q.serviceIdentifier)),Z?fe=re:fe=re.filter(function(me){var ae=new l.Request(me.serviceIdentifier,J,ee,me,Q);return me.constraint(ae)}),D(Q.serviceIdentifier,fe,Q,J.container),fe}function D(z,Z,J,ee){switch(Z.length){case S.BindingCount.NoBindingsAvailable:if(J.isOptional())return Z;var Q=A.getServiceIdentifierAsString(z),re=B.NOT_REGISTERED;throw re+=A.listMetadataForTarget(Q,J),re+=A.listRegisteredBindingsForServiceIdentifier(ee,Q,_),new Error(re);case S.BindingCount.OnlyOneBindingAvailable:if(!J.isArray())return Z;case S.BindingCount.MultipleBindingsAvailable:default:if(J.isArray())return Z;var Q=A.getServiceIdentifierAsString(z),re=B.AMBIGUOUS_MATCH+" "+Q;throw re+=A.listRegisteredBindingsForServiceIdentifier(ee,Q,_),new Error(re)}}function g(z,Z,J,ee,Q,re){var fe,me;if(Q===null){fe=O(z,Z,ee,null,re),me=new l.Request(J,ee,null,fe,re);var ae=new c.Plan(ee,me);ee.addPlan(ae)}else fe=O(z,Z,ee,Q,re),me=Q.addChildRequest(re.serviceIdentifier,fe,re);fe.forEach(function(Ee){var Le=null;if(re.isArray())Le=me.addChildRequest(Ee.serviceIdentifier,Ee,re);else{if(Ee.cache)return;Le=me}if(Ee.type===N.BindingTypeEnum.Instance&&Ee.implementationType!==null){var De=f.getDependencies(z,Ee.implementationType);if(!ee.container.options.skipBaseClassChecks){var Ve=f.getBaseClassDependencyCount(z,Ee.implementationType);if(De.length<Ve){var et=B.ARGUMENTS_LENGTH_MISMATCH(f.getFunctionName(Ee.implementationType));throw new Error(et)}}De.forEach(function(It){g(z,!1,It.serviceIdentifier,ee,Le,It)})}})}function _(z,Z){var J=[],ee=m(z);return ee.hasKey(Z)?J=ee.get(Z):z.parent!==null&&(J=_(z.parent,Z)),J}function Y(z,Z,J,ee,Q,re,fe,me){me===void 0&&(me=!1);var ae=new v.Context(Z),Ee=w(J,ee,Q,"",re,fe);try{return g(z,me,Q,ae,null,Ee),ae}catch(Le){throw I.isStackOverflowExeption(Le)&&ae.plan&&A.circularDependencyToException(ae.plan.rootRequest),Le}}x.plan=Y;function V(z,Z,J,ee){var Q=new T.Target(N.TargetTypeEnum.Variable,"",Z,new p.Metadata(J,ee)),re=new v.Context(z),fe=new l.Request(Z,re,null,[],Q);return fe}x.createMockRequest=V},88460:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.QueryableString=void 0;var M=function(){function S(B){this.str=B}return S.prototype.startsWith=function(B){return this.str.indexOf(B)===0},S.prototype.endsWith=function(B){var N="",E=B.split("").reverse().join("");return N=this.str.split("").reverse().join(""),this.startsWith.call({str:N},E)},S.prototype.contains=function(B){return this.str.indexOf(B)!==-1},S.prototype.equals=function(B){return this.str===B},S.prototype.value=function(){return this.str},S}();x.QueryableString=M},6e3:function(dt,x,M){"use strict";var S=this&&this.__spreadArray||function(O,D){for(var g=0,_=D.length,Y=O.length;g<_;g++,Y++)O[Y]=D[g];return O};Object.defineProperty(x,"__esModule",{value:!0}),x.getFunctionName=x.getBaseClassDependencyCount=x.getDependencies=void 0;var B=M(5744),N=M(16674),E=M(28421),I=M(6867),A=M(55800);Object.defineProperty(x,"getFunctionName",{enumerable:!0,get:function(){return A.getFunctionName}});var v=M(18924);function p(O,D){var g=A.getFunctionName(D),_=c(O,g,D,!1);return _}x.getDependencies=p;function c(O,D,g,_){var Y=O.getConstructorMetadata(g),V=Y.compilerGeneratedMetadata;if(V===void 0){var z=N.MISSING_INJECTABLE_ANNOTATION+" "+D+".";throw new Error(z)}var Z=Y.userGeneratedMetadata,J=Object.keys(Z),ee=g.length===0&&J.length>0,Q=J.length>g.length,re=ee||Q?J.length:g.length,fe=l(_,D,V,Z,re),me=T(O,g),ae=S(S([],fe),me);return ae}function f(O,D,g,_,Y){var V=Y[O.toString()]||[],z=w(V),Z=z.unmanaged!==!0,J=_[O],ee=z.inject||z.multiInject;if(J=ee||J,J instanceof B.LazyServiceIdentifer&&(J=J.unwrap()),Z){var Q=J===Object,re=J===Function,fe=J===void 0,me=Q||re||fe;if(!D&&me){var ae=N.MISSING_INJECT_ANNOTATION+" argument "+O+" in class "+g+".";throw new Error(ae)}var Ee=new v.Target(E.TargetTypeEnum.ConstructorArgument,z.targetName,J);return Ee.metadata=V,Ee}return null}function l(O,D,g,_,Y){for(var V=[],z=0;z<Y;z++){var Z=z,J=f(Z,O,D,g,_);J!==null&&V.push(J)}return V}function T(O,D){for(var g=O.getPropertiesMetadata(D),_=[],Y=Object.keys(g),V=0,z=Y;V<z.length;V++){var Z=z[V],J=g[Z],ee=w(g[Z]),Q=ee.targetName||Z,re=ee.inject||ee.multiInject,fe=new v.Target(E.TargetTypeEnum.ClassProperty,Q,re);fe.metadata=J,_.push(fe)}var me=Object.getPrototypeOf(D.prototype).constructor;if(me!==Object){var ae=T(O,me);_=S(S([],_),ae)}return _}function m(O,D){var g=Object.getPrototypeOf(D.prototype).constructor;if(g!==Object){var _=A.getFunctionName(g),Y=c(O,_,g,!0),V=Y.map(function(J){return J.metadata.filter(function(ee){return ee.key===I.UNMANAGED_TAG})}),z=[].concat.apply([],V).length,Z=Y.length-z;return Z>0?Z:m(O,g)}else return 0}x.getBaseClassDependencyCount=m;function w(O){var D={};return O.forEach(function(g){D[g.key.toString()]=g.value}),{inject:D[I.INJECT_TAG],multiInject:D[I.MULTI_INJECT_TAG],targetName:D[I.NAME_TAG],unmanaged:D[I.UNMANAGED_TAG]}}},6748:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.Request=void 0;var S=M(37791),B=function(){function N(E,I,A,v,p){this.id=S.id(),this.serviceIdentifier=E,this.parentContext=I,this.parentRequest=A,this.target=p,this.childRequests=[],this.bindings=Array.isArray(v)?v:[v],this.requestScope=A===null?new Map:null}return N.prototype.addChildRequest=function(E,I,A){var v=new N(E,this.parentContext,this,I,A);return this.childRequests.push(v),v},N}();x.Request=B},18924:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.Target=void 0;var S=M(6867),B=M(37791),N=M(47738),E=M(88460),I=function(){function A(v,p,c,f){this.id=B.id(),this.type=v,this.serviceIdentifier=c,this.name=new E.QueryableString(p||""),this.metadata=new Array;var l=null;typeof f=="string"?l=new N.Metadata(S.NAMED_TAG,f):f instanceof N.Metadata&&(l=f),l!==null&&this.metadata.push(l)}return A.prototype.hasTag=function(v){for(var p=0,c=this.metadata;p<c.length;p++){var f=c[p];if(f.key===v)return!0}return!1},A.prototype.isArray=function(){return this.hasTag(S.MULTI_INJECT_TAG)},A.prototype.matchesArray=function(v){return this.matchesTag(S.MULTI_INJECT_TAG)(v)},A.prototype.isNamed=function(){return this.hasTag(S.NAMED_TAG)},A.prototype.isTagged=function(){return this.metadata.some(function(v){return S.NON_CUSTOM_TAG_KEYS.every(function(p){return v.key!==p})})},A.prototype.isOptional=function(){return this.matchesTag(S.OPTIONAL_TAG)(!0)},A.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter(function(v){return v.key===S.NAMED_TAG})[0]:null},A.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter(function(v){return S.NON_CUSTOM_TAG_KEYS.every(function(p){return v.key!==p})}):null},A.prototype.matchesNamedTag=function(v){return this.matchesTag(S.NAMED_TAG)(v)},A.prototype.matchesTag=function(v){var p=this;return function(c){for(var f=0,l=p.metadata;f<l.length;f++){var T=l[f];if(T.key===v&&T.value===c)return!0}return!1}},A}();x.Target=I},52279:function(dt,x,M){"use strict";var S=this&&this.__spreadArray||function(c,f){for(var l=0,T=f.length,m=c.length;l<T;l++,m++)c[m]=f[l];return c};Object.defineProperty(x,"__esModule",{value:!0}),x.resolveInstance=void 0;var B=M(16674),N=M(28421),E=M(6867);function I(c,f,l){var T=f.filter(function(w){return w.target!==null&&w.target.type===N.TargetTypeEnum.ClassProperty}),m=T.map(l);return T.forEach(function(w,O){var D="";D=w.target.name.value();var g=m[O];c[D]=g}),c}function A(c,f){return new(c.bind.apply(c,S([void 0],f)))}function v(c,f){if(Reflect.hasMetadata(E.POST_CONSTRUCT,c)){var l=Reflect.getMetadata(E.POST_CONSTRUCT,c);try{f[l.value]()}catch(T){throw new Error(B.POST_CONSTRUCT_ERROR(c.name,T.message))}}}function p(c,f,l){var T=null;if(f.length>0){var m=f.filter(function(O){return O.target!==null&&O.target.type===N.TargetTypeEnum.ConstructorArgument}),w=m.map(l);T=A(c,w),T=I(T,f,l)}else T=new c;return v(c,T),T}x.resolveInstance=p},31927:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.resolve=void 0;var S=M(16674),B=M(28421),N=M(85265),E=M(55800),I=M(52279),A=function(c,f,l){try{return l()}catch(T){throw N.isStackOverflowExeption(T)?new Error(S.CIRCULAR_DEPENDENCY_IN_FACTORY(c,f.toString())):T}},v=function(c){return function(f){f.parentContext.setCurrentRequest(f);var l=f.bindings,T=f.childRequests,m=f.target&&f.target.isArray(),w=!f.parentRequest||!f.parentRequest.target||!f.target||!f.parentRequest.target.matchesArray(f.target.serviceIdentifier);if(m&&w)return T.map(function(V){var z=v(c);return z(V)});var O=null;if(f.target.isOptional()&&l.length===0)return;var D=l[0],g=D.scope===B.BindingScopeEnum.Singleton,_=D.scope===B.BindingScopeEnum.Request;if(g&&D.activated)return D.cache;if(_&&c!==null&&c.has(D.id))return c.get(D.id);if(D.type===B.BindingTypeEnum.ConstantValue)O=D.cache,D.activated=!0;else if(D.type===B.BindingTypeEnum.Function)O=D.cache,D.activated=!0;else if(D.type===B.BindingTypeEnum.Constructor)O=D.implementationType;else if(D.type===B.BindingTypeEnum.DynamicValue&&D.dynamicValue!==null)O=A("toDynamicValue",D.serviceIdentifier,function(){return D.dynamicValue(f.parentContext)});else if(D.type===B.BindingTypeEnum.Factory&&D.factory!==null)O=A("toFactory",D.serviceIdentifier,function(){return D.factory(f.parentContext)});else if(D.type===B.BindingTypeEnum.Provider&&D.provider!==null)O=A("toProvider",D.serviceIdentifier,function(){return D.provider(f.parentContext)});else if(D.type===B.BindingTypeEnum.Instance&&D.implementationType!==null)O=I.resolveInstance(D.implementationType,T,v(c));else{var Y=E.getServiceIdentifierAsString(f.serviceIdentifier);throw new Error(S.INVALID_BINDING_TYPE+" "+Y)}return typeof D.onActivation=="function"&&(O=D.onActivation(f.parentContext,O)),g&&(D.cache=O,D.activated=!0),_&&c!==null&&!c.has(D.id)&&c.set(D.id,O),O}};function p(c){var f=v(c.plan.rootRequest.requestScope);return f(c.plan.rootRequest)}x.resolve=p},83366:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.BindingInSyntax=void 0;var S=M(28421),B=M(71325),N=function(){function E(I){this._binding=I}return E.prototype.inRequestScope=function(){return this._binding.scope=S.BindingScopeEnum.Request,new B.BindingWhenOnSyntax(this._binding)},E.prototype.inSingletonScope=function(){return this._binding.scope=S.BindingScopeEnum.Singleton,new B.BindingWhenOnSyntax(this._binding)},E.prototype.inTransientScope=function(){return this._binding.scope=S.BindingScopeEnum.Transient,new B.BindingWhenOnSyntax(this._binding)},E}();x.BindingInSyntax=N},99812:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.BindingInWhenOnSyntax=void 0;var S=M(83366),B=M(51811),N=M(98370),E=function(){function I(A){this._binding=A,this._bindingWhenSyntax=new N.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new B.BindingOnSyntax(this._binding),this._bindingInSyntax=new S.BindingInSyntax(A)}return I.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},I.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},I.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},I.prototype.when=function(A){return this._bindingWhenSyntax.when(A)},I.prototype.whenTargetNamed=function(A){return this._bindingWhenSyntax.whenTargetNamed(A)},I.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},I.prototype.whenTargetTagged=function(A,v){return this._bindingWhenSyntax.whenTargetTagged(A,v)},I.prototype.whenInjectedInto=function(A){return this._bindingWhenSyntax.whenInjectedInto(A)},I.prototype.whenParentNamed=function(A){return this._bindingWhenSyntax.whenParentNamed(A)},I.prototype.whenParentTagged=function(A,v){return this._bindingWhenSyntax.whenParentTagged(A,v)},I.prototype.whenAnyAncestorIs=function(A){return this._bindingWhenSyntax.whenAnyAncestorIs(A)},I.prototype.whenNoAncestorIs=function(A){return this._bindingWhenSyntax.whenNoAncestorIs(A)},I.prototype.whenAnyAncestorNamed=function(A){return this._bindingWhenSyntax.whenAnyAncestorNamed(A)},I.prototype.whenAnyAncestorTagged=function(A,v){return this._bindingWhenSyntax.whenAnyAncestorTagged(A,v)},I.prototype.whenNoAncestorNamed=function(A){return this._bindingWhenSyntax.whenNoAncestorNamed(A)},I.prototype.whenNoAncestorTagged=function(A,v){return this._bindingWhenSyntax.whenNoAncestorTagged(A,v)},I.prototype.whenAnyAncestorMatches=function(A){return this._bindingWhenSyntax.whenAnyAncestorMatches(A)},I.prototype.whenNoAncestorMatches=function(A){return this._bindingWhenSyntax.whenNoAncestorMatches(A)},I.prototype.onActivation=function(A){return this._bindingOnSyntax.onActivation(A)},I}();x.BindingInWhenOnSyntax=E},51811:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.BindingOnSyntax=void 0;var S=M(98370),B=function(){function N(E){this._binding=E}return N.prototype.onActivation=function(E){return this._binding.onActivation=E,new S.BindingWhenSyntax(this._binding)},N}();x.BindingOnSyntax=B},51860:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.BindingToSyntax=void 0;var S=M(16674),B=M(28421),N=M(99812),E=M(71325),I=function(){function A(v){this._binding=v}return A.prototype.to=function(v){return this._binding.type=B.BindingTypeEnum.Instance,this._binding.implementationType=v,new N.BindingInWhenOnSyntax(this._binding)},A.prototype.toSelf=function(){if(typeof this._binding.serviceIdentifier!="function")throw new Error(""+S.INVALID_TO_SELF_VALUE);var v=this._binding.serviceIdentifier;return this.to(v)},A.prototype.toConstantValue=function(v){return this._binding.type=B.BindingTypeEnum.ConstantValue,this._binding.cache=v,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=B.BindingScopeEnum.Singleton,new E.BindingWhenOnSyntax(this._binding)},A.prototype.toDynamicValue=function(v){return this._binding.type=B.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=v,this._binding.implementationType=null,new N.BindingInWhenOnSyntax(this._binding)},A.prototype.toConstructor=function(v){return this._binding.type=B.BindingTypeEnum.Constructor,this._binding.implementationType=v,this._binding.scope=B.BindingScopeEnum.Singleton,new E.BindingWhenOnSyntax(this._binding)},A.prototype.toFactory=function(v){return this._binding.type=B.BindingTypeEnum.Factory,this._binding.factory=v,this._binding.scope=B.BindingScopeEnum.Singleton,new E.BindingWhenOnSyntax(this._binding)},A.prototype.toFunction=function(v){if(typeof v!="function")throw new Error(S.INVALID_FUNCTION_BINDING);var p=this.toConstantValue(v);return this._binding.type=B.BindingTypeEnum.Function,this._binding.scope=B.BindingScopeEnum.Singleton,p},A.prototype.toAutoFactory=function(v){return this._binding.type=B.BindingTypeEnum.Factory,this._binding.factory=function(p){var c=function(){return p.container.get(v)};return c},this._binding.scope=B.BindingScopeEnum.Singleton,new E.BindingWhenOnSyntax(this._binding)},A.prototype.toProvider=function(v){return this._binding.type=B.BindingTypeEnum.Provider,this._binding.provider=v,this._binding.scope=B.BindingScopeEnum.Singleton,new E.BindingWhenOnSyntax(this._binding)},A.prototype.toService=function(v){this.toDynamicValue(function(p){return p.container.get(v)})},A}();x.BindingToSyntax=I},71325:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.BindingWhenOnSyntax=void 0;var S=M(51811),B=M(98370),N=function(){function E(I){this._binding=I,this._bindingWhenSyntax=new B.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new S.BindingOnSyntax(this._binding)}return E.prototype.when=function(I){return this._bindingWhenSyntax.when(I)},E.prototype.whenTargetNamed=function(I){return this._bindingWhenSyntax.whenTargetNamed(I)},E.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},E.prototype.whenTargetTagged=function(I,A){return this._bindingWhenSyntax.whenTargetTagged(I,A)},E.prototype.whenInjectedInto=function(I){return this._bindingWhenSyntax.whenInjectedInto(I)},E.prototype.whenParentNamed=function(I){return this._bindingWhenSyntax.whenParentNamed(I)},E.prototype.whenParentTagged=function(I,A){return this._bindingWhenSyntax.whenParentTagged(I,A)},E.prototype.whenAnyAncestorIs=function(I){return this._bindingWhenSyntax.whenAnyAncestorIs(I)},E.prototype.whenNoAncestorIs=function(I){return this._bindingWhenSyntax.whenNoAncestorIs(I)},E.prototype.whenAnyAncestorNamed=function(I){return this._bindingWhenSyntax.whenAnyAncestorNamed(I)},E.prototype.whenAnyAncestorTagged=function(I,A){return this._bindingWhenSyntax.whenAnyAncestorTagged(I,A)},E.prototype.whenNoAncestorNamed=function(I){return this._bindingWhenSyntax.whenNoAncestorNamed(I)},E.prototype.whenNoAncestorTagged=function(I,A){return this._bindingWhenSyntax.whenNoAncestorTagged(I,A)},E.prototype.whenAnyAncestorMatches=function(I){return this._bindingWhenSyntax.whenAnyAncestorMatches(I)},E.prototype.whenNoAncestorMatches=function(I){return this._bindingWhenSyntax.whenNoAncestorMatches(I)},E.prototype.onActivation=function(I){return this._bindingOnSyntax.onActivation(I)},E}();x.BindingWhenOnSyntax=N},98370:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.BindingWhenSyntax=void 0;var S=M(51811),B=M(80758),N=function(){function E(I){this._binding=I}return E.prototype.when=function(I){return this._binding.constraint=I,new S.BindingOnSyntax(this._binding)},E.prototype.whenTargetNamed=function(I){return this._binding.constraint=B.namedConstraint(I),new S.BindingOnSyntax(this._binding)},E.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(I){var A=I.target!==null&&!I.target.isNamed()&&!I.target.isTagged();return A},new S.BindingOnSyntax(this._binding)},E.prototype.whenTargetTagged=function(I,A){return this._binding.constraint=B.taggedConstraint(I)(A),new S.BindingOnSyntax(this._binding)},E.prototype.whenInjectedInto=function(I){return this._binding.constraint=function(A){return B.typeConstraint(I)(A.parentRequest)},new S.BindingOnSyntax(this._binding)},E.prototype.whenParentNamed=function(I){return this._binding.constraint=function(A){return B.namedConstraint(I)(A.parentRequest)},new S.BindingOnSyntax(this._binding)},E.prototype.whenParentTagged=function(I,A){return this._binding.constraint=function(v){return B.taggedConstraint(I)(A)(v.parentRequest)},new S.BindingOnSyntax(this._binding)},E.prototype.whenAnyAncestorIs=function(I){return this._binding.constraint=function(A){return B.traverseAncerstors(A,B.typeConstraint(I))},new S.BindingOnSyntax(this._binding)},E.prototype.whenNoAncestorIs=function(I){return this._binding.constraint=function(A){return!B.traverseAncerstors(A,B.typeConstraint(I))},new S.BindingOnSyntax(this._binding)},E.prototype.whenAnyAncestorNamed=function(I){return this._binding.constraint=function(A){return B.traverseAncerstors(A,B.namedConstraint(I))},new S.BindingOnSyntax(this._binding)},E.prototype.whenNoAncestorNamed=function(I){return this._binding.constraint=function(A){return!B.traverseAncerstors(A,B.namedConstraint(I))},new S.BindingOnSyntax(this._binding)},E.prototype.whenAnyAncestorTagged=function(I,A){return this._binding.constraint=function(v){return B.traverseAncerstors(v,B.taggedConstraint(I)(A))},new S.BindingOnSyntax(this._binding)},E.prototype.whenNoAncestorTagged=function(I,A){return this._binding.constraint=function(v){return!B.traverseAncerstors(v,B.taggedConstraint(I)(A))},new S.BindingOnSyntax(this._binding)},E.prototype.whenAnyAncestorMatches=function(I){return this._binding.constraint=function(A){return B.traverseAncerstors(A,I)},new S.BindingOnSyntax(this._binding)},E.prototype.whenNoAncestorMatches=function(I){return this._binding.constraint=function(A){return!B.traverseAncerstors(A,I)},new S.BindingOnSyntax(this._binding)},E}();x.BindingWhenSyntax=N},80758:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.typeConstraint=x.namedConstraint=x.taggedConstraint=x.traverseAncerstors=void 0;var S=M(6867),B=M(47738),N=function(v,p){var c=v.parentRequest;return c!==null?p(c)?!0:N(c,p):!1};x.traverseAncerstors=N;var E=function(v){return function(p){var c=function(f){return f!==null&&f.target!==null&&f.target.matchesTag(v)(p)};return c.metaData=new B.Metadata(v,p),c}};x.taggedConstraint=E;var I=E(S.NAMED_TAG);x.namedConstraint=I;var A=function(v){return function(p){var c=null;if(p!==null)if(c=p.bindings[0],typeof v=="string"){var f=c.serviceIdentifier;return f===v}else{var l=p.bindings[0].implementationType;return v===l}return!1}};x.typeConstraint=A},70600:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.multiBindToService=void 0;var M=function(S){return function(B){return function(){for(var N=[],E=0;E<arguments.length;E++)N[E]=arguments[E];return N.forEach(function(I){return S.bind(I).toService(B)})}}};x.multiBindToService=M},85265:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.isStackOverflowExeption=void 0;var S=M(16674);function B(N){return N instanceof RangeError||N.message===S.STACK_OVERFLOW}x.isStackOverflowExeption=B},37791:function(dt,x){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.id=void 0;var M=0;function S(){return M++}x.id=S},55800:function(dt,x,M){"use strict";Object.defineProperty(x,"__esModule",{value:!0}),x.circularDependencyToException=x.listMetadataForTarget=x.listRegisteredBindingsForServiceIdentifier=x.getServiceIdentifierAsString=x.getFunctionName=void 0;var S=M(16674);function B(c){if(typeof c=="function"){var f=c;return f.name}else{if(typeof c=="symbol")return c.toString();var f=c;return f}}x.getServiceIdentifierAsString=B;function N(c,f,l){var T="",m=l(c,f);return m.length!==0&&(T=`
  1001. Registered bindings:`,m.forEach(function(w){var O="Object";w.implementationType!==null&&(O=p(w.implementationType)),T=T+`
  1002. `+O,w.constraint.metaData&&(T=T+" - "+w.constraint.metaData)})),T}x.listRegisteredBindingsForServiceIdentifier=N;function E(c,f){return c.parentRequest===null?!1:c.parentRequest.serviceIdentifier===f?!0:E(c.parentRequest,f)}function I(c){function f(T,m){m===void 0&&(m=[]);var w=B(T.serviceIdentifier);return m.push(w),T.parentRequest!==null?f(T.parentRequest,m):m}var l=f(c);return l.reverse().join(" --> ")}function A(c){c.childRequests.forEach(function(f){if(E(f,f.serviceIdentifier)){var l=I(f);throw new Error(S.CIRCULAR_DEPENDENCY+" "+l)}else A(f)})}x.circularDependencyToException=A;function v(c,f){if(f.isTagged()||f.isNamed()){var l="",T=f.getNamedTag(),m=f.getCustomTags();return T!==null&&(l+=T.toString()+`
  1003. `),m!==null&&m.forEach(function(w){l+=w.toString()+`
  1004. `})," "+c+`
  1005. `+c+" - "+l}else return" "+c}x.listMetadataForTarget=v;function p(c){if(c.name)return c.name;var f=c.toString(),l=f.match(/^function\s*([^\s(]+)/);return l?l[1]:"Anonymous function: "+f}x.getFunctionName=p},40582:function(dt,x,M){var S=M(89550),B=M(68854),N=M(36820),E=M(43650),I=M(56601),A=[0,0];dt.exports.x7=function(p,c,f,l,T){return S(p,f,l),N(p,p),B(c,-p[1],p[0]),B(A,-f[1],f[0]),T/I(c,A)},dt.exports.mJ=function(p,c){return B(p,-c[1],c[0]),p},dt.exports.o7=function(p,c,f){return E(p,c,f),N(p,p),p}},28660:function(dt,x,M){var S=M(34155);/*! *****************************************************************************
  1006. Copyright (C) Microsoft. All rights reserved.
  1007. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  1008. this file except in compliance with the License. You may obtain a copy of the
  1009. License at http://www.apache.org/licenses/LICENSE-2.0
  1010. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  1011. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  1012. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  1013. MERCHANTABLITY OR NON-INFRINGEMENT.
  1014. See the Apache Version 2.0 License for specific language governing permissions
  1015. and limitations under the License.
  1016. ***************************************************************************** */var B;(function(N){(function(E){var I=typeof M.g=="object"?M.g:typeof self=="object"?self:typeof this=="object"?this:Function("return this;")(),A=v(N);typeof I.Reflect=="undefined"?I.Reflect=N:A=v(I.Reflect,A),E(A);function v(p,c){return function(f,l){typeof p[f]!="function"&&Object.defineProperty(p,f,{configurable:!0,writable:!0,value:l}),c&&c(f,l)}}})(function(E){var I=Object.prototype.hasOwnProperty,A=typeof Symbol=="function",v=A&&typeof Symbol.toPrimitive!="undefined"?Symbol.toPrimitive:"@@toPrimitive",p=A&&typeof Symbol.iterator!="undefined"?Symbol.iterator:"@@iterator",c=typeof Object.create=="function",f={__proto__:[]}instanceof Array,l=!c&&!f,T={create:c?function(){return vr(Object.create(null))}:f?function(){return vr({__proto__:null})}:function(){return vr({})},has:l?function(rt,at){return I.call(rt,at)}:function(rt,at){return at in rt},get:l?function(rt,at){return I.call(rt,at)?rt[at]:void 0}:function(rt,at){return rt[at]}},m=Object.getPrototypeOf(Function),w=typeof S=="object"&&{NODE_ENV:"production"}&&{NODE_ENV:"production"}.REFLECT_METADATA_USE_MAP_POLYFILL==="true",O=!w&&typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:jt(),D=!w&&typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Lt(),g=!w&&typeof WeakMap=="function"?WeakMap:Ht(),_=new g;function Y(rt,at,Pt,gt){if($t(Pt)){if(!Mt(rt))throw new TypeError;if(!Ge(at))throw new TypeError;return ae(rt,at)}else{if(!Mt(rt))throw new TypeError;if(!Oe(at))throw new TypeError;if(!Oe(gt)&&!$t(gt)&&!Ar(gt))throw new TypeError;return Ar(gt)&&(gt=void 0),Pt=St(Pt),Ee(rt,at,Pt,gt)}}E("decorate",Y);function V(rt,at){function Pt(gt,Dt){if(!Oe(gt))throw new TypeError;if(!$t(Dt)&&!ut(Dt))throw new TypeError;er(rt,at,gt,Dt)}return Pt}E("metadata",V);function z(rt,at,Pt,gt){if(!Oe(Pt))throw new TypeError;return $t(gt)||(gt=St(gt)),er(rt,at,Pt,gt)}E("defineMetadata",z);function Z(rt,at,Pt){if(!Oe(at))throw new TypeError;return $t(Pt)||(Pt=St(Pt)),De(rt,at,Pt)}E("hasMetadata",Z);function J(rt,at,Pt){if(!Oe(at))throw new TypeError;return $t(Pt)||(Pt=St(Pt)),Ve(rt,at,Pt)}E("hasOwnMetadata",J);function ee(rt,at,Pt){if(!Oe(at))throw new TypeError;return $t(Pt)||(Pt=St(Pt)),et(rt,at,Pt)}E("getMetadata",ee);function Q(rt,at,Pt){if(!Oe(at))throw new TypeError;return $t(Pt)||(Pt=St(Pt)),It(rt,at,Pt)}E("getOwnMetadata",Q);function re(rt,at){if(!Oe(rt))throw new TypeError;return $t(at)||(at=St(at)),nr(rt,at)}E("getMetadataKeys",re);function fe(rt,at){if(!Oe(rt))throw new TypeError;return $t(at)||(at=St(at)),Fe(rt,at)}E("getOwnMetadataKeys",fe);function me(rt,at,Pt){if(!Oe(at))throw new TypeError;$t(Pt)||(Pt=St(Pt));var gt=Le(at,Pt,!1);if($t(gt)||!gt.delete(rt))return!1;if(gt.size>0)return!0;var Dt=_.get(at);return Dt.delete(Pt),Dt.size>0||_.delete(at),!0}E("deleteMetadata",me);function ae(rt,at){for(var Pt=rt.length-1;Pt>=0;--Pt){var gt=rt[Pt],Dt=gt(at);if(!$t(Dt)&&!Ar(Dt)){if(!Ge(Dt))throw new TypeError;at=Dt}}return at}function Ee(rt,at,Pt,gt){for(var Dt=rt.length-1;Dt>=0;--Dt){var ir=rt[Dt],At=ir(at,Pt,gt);if(!$t(At)&&!Ar(At)){if(!Oe(At))throw new TypeError;gt=At}}return gt}function Le(rt,at,Pt){var gt=_.get(rt);if($t(gt)){if(!Pt)return;gt=new O,_.set(rt,gt)}var Dt=gt.get(at);if($t(Dt)){if(!Pt)return;Dt=new O,gt.set(at,Dt)}return Dt}function De(rt,at,Pt){var gt=Ve(rt,at,Pt);if(gt)return!0;var Dt=ft(at);return Ar(Dt)?!1:De(rt,Dt,Pt)}function Ve(rt,at,Pt){var gt=Le(at,Pt,!1);return $t(gt)?!1:We(gt.has(rt))}function et(rt,at,Pt){var gt=Ve(rt,at,Pt);if(gt)return It(rt,at,Pt);var Dt=ft(at);if(!Ar(Dt))return et(rt,Dt,Pt)}function It(rt,at,Pt){var gt=Le(at,Pt,!1);if(!$t(gt))return gt.get(rt)}function er(rt,at,Pt,gt){var Dt=Le(Pt,gt,!0);Dt.set(rt,at)}function nr(rt,at){var Pt=Fe(rt,at),gt=ft(rt);if(gt===null)return Pt;var Dt=nr(gt,at);if(Dt.length<=0)return Pt;if(Pt.length<=0)return Dt;for(var ir=new D,At=[],xr=0,Pr=Pt;xr<Pr.length;xr++){var Qr=Pr[xr],Vr=ir.has(Qr);Vr||(ir.add(Qr),At.push(Qr))}for(var nn=0,dn=Dt;nn<dn.length;nn++){var Qr=dn[nn],Vr=ir.has(Qr);Vr||(ir.add(Qr),At.push(Qr))}return At}function Fe(rt,at){var Pt=[],gt=Le(rt,at,!1);if($t(gt))return Pt;for(var Dt=gt.keys(),ir=he(Dt),At=0;;){var xr=le(ir);if(!xr)return Pt.length=At,Pt;var Pr=Qe(xr);try{Pt[At]=Pr}catch(Qr){try{ct(ir)}finally{throw Qr}}At++}}function Vt(rt){if(rt===null)return 1;switch(typeof rt){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return rt===null?1:6;default:return 6}}function $t(rt){return rt===void 0}function Ar(rt){return rt===null}function ke(rt){return typeof rt=="symbol"}function Oe(rt){return typeof rt=="object"?rt!==null:typeof rt=="function"}function we(rt,at){switch(Vt(rt)){case 0:return rt;case 1:return rt;case 2:return rt;case 3:return rt;case 4:return rt;case 5:return rt}var Pt=at===3?"string":at===5?"number":"default",gt=U(rt,v);if(gt!==void 0){var Dt=gt.call(rt,Pt);if(Oe(Dt))throw new TypeError;return Dt}return Be(rt,Pt==="default"?"number":Pt)}function Be(rt,at){if(at==="string"){var Pt=rt.toString;if(sr(Pt)){var gt=Pt.call(rt);if(!Oe(gt))return gt}var Dt=rt.valueOf;if(sr(Dt)){var gt=Dt.call(rt);if(!Oe(gt))return gt}}else{var Dt=rt.valueOf;if(sr(Dt)){var gt=Dt.call(rt);if(!Oe(gt))return gt}var ir=rt.toString;if(sr(ir)){var gt=ir.call(rt);if(!Oe(gt))return gt}}throw new TypeError}function We(rt){return!!rt}function He(rt){return""+rt}function St(rt){var at=we(rt,3);return ke(at)?at:He(at)}function Mt(rt){return Array.isArray?Array.isArray(rt):rt instanceof Object?rt instanceof Array:Object.prototype.toString.call(rt)==="[object Array]"}function sr(rt){return typeof rt=="function"}function Ge(rt){return typeof rt=="function"}function ut(rt){switch(Vt(rt)){case 3:return!0;case 4:return!0;default:return!1}}function U(rt,at){var Pt=rt[at];if(Pt!=null){if(!sr(Pt))throw new TypeError;return Pt}}function he(rt){var at=U(rt,p);if(!sr(at))throw new TypeError;var Pt=at.call(rt);if(!Oe(Pt))throw new TypeError;return Pt}function Qe(rt){return rt.value}function le(rt){var at=rt.next();return at.done?!1:at}function ct(rt){var at=rt.return;at&&at.call(rt)}function ft(rt){var at=Object.getPrototypeOf(rt);if(typeof rt!="function"||rt===m||at!==m)return at;var Pt=rt.prototype,gt=Pt&&Object.getPrototypeOf(Pt);if(gt==null||gt===Object.prototype)return at;var Dt=gt.constructor;return typeof Dt!="function"||Dt===rt?at:Dt}function jt(){var rt={},at=[],Pt=function(){function At(xr,Pr,Qr){this._index=0,this._keys=xr,this._values=Pr,this._selector=Qr}return At.prototype["@@iterator"]=function(){return this},At.prototype[p]=function(){return this},At.prototype.next=function(){var xr=this._index;if(xr>=0&&xr<this._keys.length){var Pr=this._selector(this._keys[xr],this._values[xr]);return xr+1>=this._keys.length?(this._index=-1,this._keys=at,this._values=at):this._index++,{value:Pr,done:!1}}return{value:void 0,done:!0}},At.prototype.throw=function(xr){throw this._index>=0&&(this._index=-1,this._keys=at,this._values=at),xr},At.prototype.return=function(xr){return this._index>=0&&(this._index=-1,this._keys=at,this._values=at),{value:xr,done:!0}},At}();return function(){function At(){this._keys=[],this._values=[],this._cacheKey=rt,this._cacheIndex=-2}return Object.defineProperty(At.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),At.prototype.has=function(xr){return this._find(xr,!1)>=0},At.prototype.get=function(xr){var Pr=this._find(xr,!1);return Pr>=0?this._values[Pr]:void 0},At.prototype.set=function(xr,Pr){var Qr=this._find(xr,!0);return this._values[Qr]=Pr,this},At.prototype.delete=function(xr){var Pr=this._find(xr,!1);if(Pr>=0){for(var Qr=this._keys.length,Vr=Pr+1;Vr<Qr;Vr++)this._keys[Vr-1]=this._keys[Vr],this._values[Vr-1]=this._values[Vr];return this._keys.length--,this._values.length--,xr===this._cacheKey&&(this._cacheKey=rt,this._cacheIndex=-2),!0}return!1},At.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=rt,this._cacheIndex=-2},At.prototype.keys=function(){return new Pt(this._keys,this._values,gt)},At.prototype.values=function(){return new Pt(this._keys,this._values,Dt)},At.prototype.entries=function(){return new Pt(this._keys,this._values,ir)},At.prototype["@@iterator"]=function(){return this.entries()},At.prototype[p]=function(){return this.entries()},At.prototype._find=function(xr,Pr){return this._cacheKey!==xr&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=xr)),this._cacheIndex<0&&Pr&&(this._cacheIndex=this._keys.length,this._keys.push(xr),this._values.push(void 0)),this._cacheIndex},At}();function gt(At,xr){return At}function Dt(At,xr){return xr}function ir(At,xr){return[At,xr]}}function Lt(){return function(){function rt(){this._map=new O}return Object.defineProperty(rt.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),rt.prototype.has=function(at){return this._map.has(at)},rt.prototype.add=function(at){return this._map.set(at,at),this},rt.prototype.delete=function(at){return this._map.delete(at)},rt.prototype.clear=function(){this._map.clear()},rt.prototype.keys=function(){return this._map.keys()},rt.prototype.values=function(){return this._map.values()},rt.prototype.entries=function(){return this._map.entries()},rt.prototype["@@iterator"]=function(){return this.keys()},rt.prototype[p]=function(){return this.keys()},rt}()}function Ht(){var rt=16,at=T.create(),Pt=gt();return function(){function Pr(){this._key=gt()}return Pr.prototype.has=function(Qr){var Vr=Dt(Qr,!1);return Vr!==void 0?T.has(Vr,this._key):!1},Pr.prototype.get=function(Qr){var Vr=Dt(Qr,!1);return Vr!==void 0?T.get(Vr,this._key):void 0},Pr.prototype.set=function(Qr,Vr){var nn=Dt(Qr,!0);return nn[this._key]=Vr,this},Pr.prototype.delete=function(Qr){var Vr=Dt(Qr,!1);return Vr!==void 0?delete Vr[this._key]:!1},Pr.prototype.clear=function(){this._key=gt()},Pr}();function gt(){var Pr;do Pr="@@WeakMap@@"+xr();while(T.has(at,Pr));return at[Pr]=!0,Pr}function Dt(Pr,Qr){if(!I.call(Pr,Pt)){if(!Qr)return;Object.defineProperty(Pr,Pt,{value:T.create()})}return Pr[Pt]}function ir(Pr,Qr){for(var Vr=0;Vr<Qr;++Vr)Pr[Vr]=Math.random()*255|0;return Pr}function At(Pr){return typeof Uint8Array=="function"?typeof crypto!="undefined"?crypto.getRandomValues(new Uint8Array(Pr)):typeof msCrypto!="undefined"?msCrypto.getRandomValues(new Uint8Array(Pr)):ir(new Uint8Array(Pr),Pr):ir(new Array(Pr),Pr)}function xr(){var Pr=At(rt);Pr[6]=Pr[6]&79|64,Pr[8]=Pr[8]&191|128;for(var Qr="",Vr=0;Vr<rt;++Vr){var nn=Pr[Vr];(Vr===4||Vr===6||Vr===8)&&(Qr+="-"),nn<16&&(Qr+="0"),Qr+=nn.toString(16).toLowerCase()}return Qr}}function vr(rt){return rt.__=void 0,delete rt.__,rt}})})(B||(B={}))},81550:function(dt){(function(x,M){dt.exports=M()})(this,function(){"use strict";var x=function(ge){return ge instanceof Uint8Array||ge instanceof Uint16Array||ge instanceof Uint32Array||ge instanceof Int8Array||ge instanceof Int16Array||ge instanceof Int32Array||ge instanceof Float32Array||ge instanceof Float64Array||ge instanceof Uint8ClampedArray},M=function(ge,tt){for(var Et=Object.keys(tt),gr=0;gr<Et.length;++gr)ge[Et[gr]]=tt[Et[gr]];return ge},S=`
  1017. `;function B(ge){return typeof atob!="undefined"?atob(ge):"base64:"+ge}function N(ge){var tt=new Error("(regl) "+ge);throw console.error(tt),tt}function E(ge,tt){ge||N(tt)}function I(ge){return ge?": "+ge:""}function A(ge,tt,Et){ge in tt||N("unknown parameter ("+ge+")"+I(Et)+". possible values: "+Object.keys(tt).join())}function v(ge,tt){x(ge)||N("invalid parameter type"+I(tt)+". must be a typed array")}function p(ge,tt){switch(tt){case"number":return typeof ge=="number";case"object":return typeof ge=="object";case"string":return typeof ge=="string";case"boolean":return typeof ge=="boolean";case"function":return typeof ge=="function";case"undefined":return typeof ge=="undefined";case"symbol":return typeof ge=="symbol"}}function c(ge,tt,Et){p(ge,tt)||N("invalid parameter type"+I(Et)+". expected "+tt+", got "+typeof ge)}function f(ge,tt){ge>=0&&(ge|0)===ge||N("invalid parameter type, ("+ge+")"+I(tt)+". must be a nonnegative integer")}function l(ge,tt,Et){tt.indexOf(ge)<0&&N("invalid value"+I(Et)+". must be one of: "+tt)}var T=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function m(ge){Object.keys(ge).forEach(function(tt){T.indexOf(tt)<0&&N('invalid regl constructor argument "'+tt+'". must be one of '+T)})}function w(ge,tt){for(ge=ge+"";ge.length<tt;)ge=" "+ge;return ge}function O(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function D(ge,tt){this.number=ge,this.line=tt,this.errors=[]}function g(ge,tt,Et){this.file=ge,this.line=tt,this.message=Et}function _(){var ge=new Error,tt=(ge.stack||ge).toString(),Et=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(tt);if(Et)return Et[1];var gr=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(tt);return gr?gr[1]:"unknown"}function Y(){var ge=new Error,tt=(ge.stack||ge).toString(),Et=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(tt);if(Et)return Et[1];var gr=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(tt);return gr?gr[1]:"unknown"}function V(ge,tt){var Et=ge.split(`
  1018. `),gr=1,Nr=0,pr={unknown:new O,0:new O};pr.unknown.name=pr[0].name=tt||_(),pr.unknown.lines.push(new D(0,""));for(var _r=0;_r<Et.length;++_r){var Wr=Et[_r],Zr=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(Wr);if(Zr)switch(Zr[1]){case"line":var Hr=/(\d+)(\s+\d+)?/.exec(Zr[2]);Hr&&(gr=Hr[1]|0,Hr[2]&&(Nr=Hr[2]|0,Nr in pr||(pr[Nr]=new O)));break;case"define":var zr=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Zr[2]);zr&&(pr[Nr].name=zr[1]?B(zr[2]):zr[2]);break}pr[Nr].lines.push(new D(gr++,Wr))}return Object.keys(pr).forEach(function(qr){var u=pr[qr];u.lines.forEach(function(P){u.index[P.number]=P})}),pr}function z(ge){var tt=[];return ge.split(`
  1019. `).forEach(function(Et){if(!(Et.length<5)){var gr=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(Et);gr?tt.push(new g(gr[1]|0,gr[2]|0,gr[3].trim())):Et.length>0&&tt.push(new g("unknown",0,Et))}}),tt}function Z(ge,tt){tt.forEach(function(Et){var gr=ge[Et.file];if(gr){var Nr=gr.index[Et.line];if(Nr){Nr.errors.push(Et),gr.hasErrors=!0;return}}ge.unknown.hasErrors=!0,ge.unknown.lines[0].errors.push(Et)})}function J(ge,tt,Et,gr,Nr){if(!ge.getShaderParameter(tt,ge.COMPILE_STATUS)){var pr=ge.getShaderInfoLog(tt),_r=gr===ge.FRAGMENT_SHADER?"fragment":"vertex";Ee(Et,"string",_r+" shader source must be a string",Nr);var Wr=V(Et,Nr),Zr=z(pr);Z(Wr,Zr),Object.keys(Wr).forEach(function(Hr){var zr=Wr[Hr];if(!zr.hasErrors)return;var qr=[""],u=[""];function P(W,$){qr.push(W),u.push($||"")}P("file number "+Hr+": "+zr.name+`
  1020. `,"color:red;text-decoration:underline;font-weight:bold"),zr.lines.forEach(function(W){if(W.errors.length>0){P(w(W.number,4)+"| ","background-color:yellow; font-weight:bold"),P(W.line+S,"color:red; background-color:yellow; font-weight:bold");var $=0;W.errors.forEach(function(oe){var ue=oe.message,pe=/^\s*'(.*)'\s*:\s*(.*)$/.exec(ue);if(pe){var _e=pe[1];switch(ue=pe[2],_e){case"assign":_e="=";break}$=Math.max(W.line.indexOf(_e,$),0)}else $=0;P(w("| ",6)),P(w("^^^",$+3)+S,"font-weight:bold"),P(w("| ",6)),P(ue+S,"font-weight:bold")}),P(w("| ",6)+S)}else P(w(W.number,4)+"| "),P(W.line+S,"color:red")}),typeof document!="undefined"&&!window.chrome?(u[0]=qr.join("%c"),console.log.apply(console,u)):console.log(qr.join(""))}),E.raise("Error compiling "+_r+" shader, "+Wr[0].name)}}function ee(ge,tt,Et,gr,Nr){if(!ge.getProgramParameter(tt,ge.LINK_STATUS)){var pr=ge.getProgramInfoLog(tt),_r=V(Et,Nr),Wr=V(gr,Nr),Zr='Error linking program with vertex shader, "'+Wr[0].name+'", and fragment shader "'+_r[0].name+'"';typeof document!="undefined"?console.log("%c"+Zr+S+"%c"+pr,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Zr+S+pr),E.raise(Zr)}}function Q(ge){ge._commandRef=_()}function re(ge,tt,Et,gr){Q(ge);function Nr(Zr){return Zr?gr.id(Zr):0}ge._fragId=Nr(ge.static.frag),ge._vertId=Nr(ge.static.vert);function pr(Zr,Hr){Object.keys(Hr).forEach(function(zr){Zr[gr.id(zr)]=!0})}var _r=ge._uniformSet={};pr(_r,tt.static),pr(_r,tt.dynamic);var Wr=ge._attributeSet={};pr(Wr,Et.static),pr(Wr,Et.dynamic),ge._hasCount="count"in ge.static||"count"in ge.dynamic||"elements"in ge.static||"elements"in ge.dynamic}function fe(ge,tt){var Et=Y();N(ge+" in command "+(tt||_())+(Et==="unknown"?"":" called from "+Et))}function me(ge,tt,Et){ge||fe(tt,Et||_())}function ae(ge,tt,Et,gr){ge in tt||fe("unknown parameter ("+ge+")"+I(Et)+". possible values: "+Object.keys(tt).join(),gr||_())}function Ee(ge,tt,Et,gr){p(ge,tt)||fe("invalid parameter type"+I(Et)+". expected "+tt+", got "+typeof ge,gr||_())}function Le(ge){ge()}function De(ge,tt,Et){ge.texture?l(ge.texture._texture.internalformat,tt,"unsupported texture format for attachment"):l(ge.renderbuffer._renderbuffer.format,Et,"unsupported renderbuffer format for attachment")}var Ve=33071,et=9728,It=9984,er=9985,nr=9986,Fe=9987,Vt=5120,$t=5121,Ar=5122,ke=5123,Oe=5124,we=5125,Be=5126,We=32819,He=32820,St=33635,Mt=34042,sr=36193,Ge={};Ge[Vt]=Ge[$t]=1,Ge[Ar]=Ge[ke]=Ge[sr]=Ge[St]=Ge[We]=Ge[He]=2,Ge[Oe]=Ge[we]=Ge[Be]=Ge[Mt]=4;function ut(ge,tt){return ge===He||ge===We||ge===St?2:ge===Mt?4:Ge[ge]*tt}function U(ge){return!(ge&ge-1)&&!!ge}function he(ge,tt,Et){var gr,Nr=tt.width,pr=tt.height,_r=tt.channels;E(Nr>0&&Nr<=Et.maxTextureSize&&pr>0&&pr<=Et.maxTextureSize,"invalid texture shape"),(ge.wrapS!==Ve||ge.wrapT!==Ve)&&E(U(Nr)&&U(pr),"incompatible wrap mode for texture, both width and height must be power of 2"),tt.mipmask===1?Nr!==1&&pr!==1&&E(ge.minFilter!==It&&ge.minFilter!==nr&&ge.minFilter!==er&&ge.minFilter!==Fe,"min filter requires mipmap"):(E(U(Nr)&&U(pr),"texture must be a square power of 2 to support mipmapping"),E(tt.mipmask===(Nr<<1)-1,"missing or incomplete mipmap data")),tt.type===Be&&(Et.extensions.indexOf("oes_texture_float_linear")<0&&E(ge.minFilter===et&&ge.magFilter===et,"filter not supported, must enable oes_texture_float_linear"),E(!ge.genMipmaps,"mipmap generation not supported with float textures"));var Wr=tt.images;for(gr=0;gr<16;++gr)if(Wr[gr]){var Zr=Nr>>gr,Hr=pr>>gr;E(tt.mipmask&1<<gr,"missing mipmap data");var zr=Wr[gr];if(E(zr.width===Zr&&zr.height===Hr,"invalid shape for mip images"),E(zr.format===tt.format&&zr.internalformat===tt.internalformat&&zr.type===tt.type,"incompatible type for mip image"),!zr.compressed)if(zr.data){var qr=Math.ceil(ut(zr.type,_r)*Zr/zr.unpackAlignment)*zr.unpackAlignment;E(zr.data.byteLength===qr*Hr,"invalid data for image, buffer size is inconsistent with image format")}else zr.element||zr.copy}else ge.genMipmaps||E((tt.mipmask&1<<gr)==0,"extra mipmap data");tt.compressed&&E(!ge.genMipmaps,"mipmap generation for compressed images not supported")}function Qe(ge,tt,Et,gr){var Nr=ge.width,pr=ge.height,_r=ge.channels;E(Nr>0&&Nr<=gr.maxTextureSize&&pr>0&&pr<=gr.maxTextureSize,"invalid texture shape"),E(Nr===pr,"cube map must be square"),E(tt.wrapS===Ve&&tt.wrapT===Ve,"wrap mode not supported by cube map");for(var Wr=0;Wr<Et.length;++Wr){var Zr=Et[Wr];E(Zr.width===Nr&&Zr.height===pr,"inconsistent cube map face shape"),tt.genMipmaps&&(E(!Zr.compressed,"can not generate mipmap for compressed textures"),E(Zr.mipmask===1,"can not specify mipmaps and generate mipmaps"));for(var Hr=Zr.images,zr=0;zr<16;++zr){var qr=Hr[zr];if(qr){var u=Nr>>zr,P=pr>>zr;E(Zr.mipmask&1<<zr,"missing mipmap data"),E(qr.width===u&&qr.height===P,"invalid shape for mip images"),E(qr.format===ge.format&&qr.internalformat===ge.internalformat&&qr.type===ge.type,"incompatible type for mip image"),qr.compressed||(qr.data?E(qr.data.byteLength===u*P*Math.max(ut(qr.type,_r),qr.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):qr.element||qr.copy)}}}}var le=M(E,{optional:Le,raise:N,commandRaise:fe,command:me,parameter:A,commandParameter:ae,constructor:m,type:c,commandType:Ee,isTypedArray:v,nni:f,oneOf:l,shaderError:J,linkError:ee,callSite:Y,saveCommandRef:Q,saveDrawInfo:re,framebufferFormat:De,guessCommand:_,texture2D:he,textureCube:Qe}),ct=0,ft=0,jt=5,Lt=6;function Ht(ge,tt){this.id=ct++,this.type=ge,this.data=tt}function vr(ge){return ge.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function rt(ge){if(ge.length===0)return[];var tt=ge.charAt(0),Et=ge.charAt(ge.length-1);if(ge.length>1&&tt===Et&&(tt==='"'||tt==="'"))return['"'+vr(ge.substr(1,ge.length-2))+'"'];var gr=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(ge);if(gr)return rt(ge.substr(0,gr.index)).concat(rt(gr[1])).concat(rt(ge.substr(gr.index+gr[0].length)));var Nr=ge.split(".");if(Nr.length===1)return['"'+vr(ge)+'"'];for(var pr=[],_r=0;_r<Nr.length;++_r)pr=pr.concat(rt(Nr[_r]));return pr}function at(ge){return"["+rt(ge).join("][")+"]"}function Pt(ge,tt){return new Ht(ge,at(tt+""))}function gt(ge){return typeof ge=="function"&&!ge._reglType||ge instanceof Ht}function Dt(ge,tt){if(typeof ge=="function")return new Ht(ft,ge);if(typeof ge=="number"||typeof ge=="boolean")return new Ht(jt,ge);if(Array.isArray(ge))return new Ht(Lt,ge.map((Et,gr)=>Dt(Et,tt+"["+gr+"]")));if(ge instanceof Ht)return ge;le(!1,"invalid option type in uniform "+tt)}var ir={DynamicVariable:Ht,define:Pt,isDynamic:gt,unbox:Dt,accessor:at},At={next:typeof requestAnimationFrame=="function"?function(ge){return requestAnimationFrame(ge)}:function(ge){return setTimeout(ge,16)},cancel:typeof cancelAnimationFrame=="function"?function(ge){return cancelAnimationFrame(ge)}:clearTimeout},xr=typeof performance!="undefined"&&performance.now?function(){return performance.now()}:function(){return+new Date};function Pr(){var ge={"":0},tt=[""];return{id:function(Et){var gr=ge[Et];return gr||(gr=ge[Et]=tt.length,tt.push(Et),gr)},str:function(Et){return tt[Et]}}}function Qr(ge,tt,Et){var gr=document.createElement("canvas");M(gr.style,{border:0,margin:0,padding:0,top:0,left:0}),ge.appendChild(gr),ge===document.body&&(gr.style.position="absolute",M(ge.style,{margin:0,padding:0}));function Nr(){var Wr=window.innerWidth,Zr=window.innerHeight;if(ge!==document.body){var Hr=ge.getBoundingClientRect();Wr=Hr.right-Hr.left,Zr=Hr.bottom-Hr.top}gr.width=Et*Wr,gr.height=Et*Zr,M(gr.style,{width:Wr+"px",height:Zr+"px"})}var pr;ge!==document.body&&typeof ResizeObserver=="function"?(pr=new ResizeObserver(function(){setTimeout(Nr)}),pr.observe(ge)):window.addEventListener("resize",Nr,!1);function _r(){pr?pr.disconnect():window.removeEventListener("resize",Nr),ge.removeChild(gr)}return Nr(),{canvas:gr,onDestroy:_r}}function Vr(ge,tt){function Et(gr){try{return ge.getContext(gr,tt)}catch(Nr){return null}}return Et("webgl")||Et("experimental-webgl")||Et("webgl-experimental")}function nn(ge){return typeof ge.nodeName=="string"&&typeof ge.appendChild=="function"&&typeof ge.getBoundingClientRect=="function"}function dn(ge){return typeof ge.drawArrays=="function"||typeof ge.drawElements=="function"}function Vn(ge){return typeof ge=="string"?ge.split():(le(Array.isArray(ge),"invalid extension array"),ge)}function cn(ge){return typeof ge=="string"?(le(typeof document!="undefined","not supported outside of DOM"),document.querySelector(ge)):ge}function wn(ge){var tt=ge||{},Et,gr,Nr,pr,_r={},Wr=[],Zr=[],Hr=typeof window=="undefined"?1:window.devicePixelRatio,zr=!1,qr=function(W){W&&le.raise(W)},u=function(){};if(typeof tt=="string"?(le(typeof document!="undefined","selector queries only supported in DOM enviroments"),Et=document.querySelector(tt),le(Et,"invalid query string for element")):typeof tt=="object"?nn(tt)?Et=tt:dn(tt)?(pr=tt,Nr=pr.canvas):(le.constructor(tt),"gl"in tt?pr=tt.gl:"canvas"in tt?Nr=cn(tt.canvas):"container"in tt&&(gr=cn(tt.container)),"attributes"in tt&&(_r=tt.attributes,le.type(_r,"object","invalid context attributes")),"extensions"in tt&&(Wr=Vn(tt.extensions)),"optionalExtensions"in tt&&(Zr=Vn(tt.optionalExtensions)),"onDone"in tt&&(le.type(tt.onDone,"function","invalid or missing onDone callback"),qr=tt.onDone),"profile"in tt&&(zr=!!tt.profile),"pixelRatio"in tt&&(Hr=+tt.pixelRatio,le(Hr>0,"invalid pixel ratio"))):le.raise("invalid arguments to regl"),Et&&(Et.nodeName.toLowerCase()==="canvas"?Nr=Et:gr=Et),!pr){if(!Nr){le(typeof document!="undefined","must manually specify webgl context outside of DOM environments");var P=Qr(gr||document.body,qr,Hr);if(!P)return null;Nr=P.canvas,u=P.onDestroy}_r.premultipliedAlpha===void 0&&(_r.premultipliedAlpha=!0),pr=Vr(Nr,_r)}return pr?{gl:pr,canvas:Nr,container:gr,extensions:Wr,optionalExtensions:Zr,pixelRatio:Hr,profile:zr,onDone:qr,onDestroy:u}:(u(),qr("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function xn(ge,tt){var Et={};function gr(_r){le.type(_r,"string","extension name must be string");var Wr=_r.toLowerCase(),Zr;try{Zr=Et[Wr]=ge.getExtension(Wr)}catch(Hr){}return!!Zr}for(var Nr=0;Nr<tt.extensions.length;++Nr){var pr=tt.extensions[Nr];if(!gr(pr))return tt.onDestroy(),tt.onDone('"'+pr+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return tt.optionalExtensions.forEach(gr),{extensions:Et,restore:function(){Object.keys(Et).forEach(function(_r){if(Et[_r]&&!gr(_r))throw new Error("(regl): error restoring extension "+_r)})}}}function gn(ge,tt){for(var Et=Array(ge),gr=0;gr<ge;++gr)Et[gr]=tt(gr);return Et}var Un=5120,bt=5121,Mn=5122,be=5123,Se=5124,j=5125,R=5126;function k(ge){for(var tt=16;tt<=1<<28;tt*=16)if(ge<=tt)return tt;return 0}function te(ge){var tt,Et;return tt=(ge>65535)<<4,ge>>>=tt,Et=(ge>255)<<3,ge>>>=Et,tt|=Et,Et=(ge>15)<<2,ge>>>=Et,tt|=Et,Et=(ge>3)<<1,ge>>>=Et,tt|=Et,tt|ge>>1}function Me(){var ge=gn(8,function(){return[]});function tt(pr){var _r=k(pr),Wr=ge[te(_r)>>2];return Wr.length>0?Wr.pop():new ArrayBuffer(_r)}function Et(pr){ge[te(pr.byteLength)>>2].push(pr)}function gr(pr,_r){var Wr=null;switch(pr){case Un:Wr=new Int8Array(tt(_r),0,_r);break;case bt:Wr=new Uint8Array(tt(_r),0,_r);break;case Mn:Wr=new Int16Array(tt(2*_r),0,_r);break;case be:Wr=new Uint16Array(tt(2*_r),0,_r);break;case Se:Wr=new Int32Array(tt(4*_r),0,_r);break;case j:Wr=new Uint32Array(tt(4*_r),0,_r);break;case R:Wr=new Float32Array(tt(4*_r),0,_r);break;default:return null}return Wr.length!==_r?Wr.subarray(0,_r):Wr}function Nr(pr){Et(pr.buffer)}return{alloc:tt,free:Et,allocType:gr,freeType:Nr}}var Ne=Me();Ne.zero=Me();var Pe=3408,Ke=3410,Ut=3411,Rt=3412,fr=3413,kr=3414,ur=3415,rn=33901,On=33902,ne=3379,ye=3386,Je=34921,Ct=36347,Nt=36348,mr=35661,lr=35660,dr=34930,yr=36349,Gr=34076,Jr=34024,Sr=7936,lt=7937,Ae=7938,Ye=35724,Tt=34047,pt=36063,kt=34852,ar=3553,jr=34067,tn=34069,Ln=33984,Dn=6408,$n=5126,ci=5121,Ii=36160,ki=36053,zi=36064,Hn=16384,Mo=function(ge,tt){var Et=1;tt.ext_texture_filter_anisotropic&&(Et=ge.getParameter(Tt));var gr=1,Nr=1;tt.webgl_draw_buffers&&(gr=ge.getParameter(kt),Nr=ge.getParameter(pt));var pr=!!tt.oes_texture_float;if(pr){var _r=ge.createTexture();ge.bindTexture(ar,_r),ge.texImage2D(ar,0,Dn,1,1,0,Dn,$n,null);var Wr=ge.createFramebuffer();if(ge.bindFramebuffer(Ii,Wr),ge.framebufferTexture2D(Ii,zi,ar,_r,0),ge.bindTexture(ar,null),ge.checkFramebufferStatus(Ii)!==ki)pr=!1;else{ge.viewport(0,0,1,1),ge.clearColor(1,0,0,1),ge.clear(Hn);var Zr=Ne.allocType($n,4);ge.readPixels(0,0,1,1,Dn,$n,Zr),ge.getError()?pr=!1:(ge.deleteFramebuffer(Wr),ge.deleteTexture(_r),pr=Zr[0]===1),Ne.freeType(Zr)}}var Hr=typeof navigator!="undefined"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),zr=!0;if(!Hr){var qr=ge.createTexture(),u=Ne.allocType(ci,36);ge.activeTexture(Ln),ge.bindTexture(jr,qr),ge.texImage2D(tn,0,Dn,3,3,0,Dn,ci,u),Ne.freeType(u),ge.bindTexture(jr,null),ge.deleteTexture(qr),zr=!ge.getError()}return{colorBits:[ge.getParameter(Ke),ge.getParameter(Ut),ge.getParameter(Rt),ge.getParameter(fr)],depthBits:ge.getParameter(kr),stencilBits:ge.getParameter(ur),subpixelBits:ge.getParameter(Pe),extensions:Object.keys(tt).filter(function(P){return!!tt[P]}),maxAnisotropic:Et,maxDrawbuffers:gr,maxColorAttachments:Nr,pointSizeDims:ge.getParameter(rn),lineWidthDims:ge.getParameter(On),maxViewportDims:ge.getParameter(ye),maxCombinedTextureUnits:ge.getParameter(mr),maxCubeMapSize:ge.getParameter(Gr),maxRenderbufferSize:ge.getParameter(Jr),maxTextureUnits:ge.getParameter(dr),maxTextureSize:ge.getParameter(ne),maxAttributes:ge.getParameter(Je),maxVertexUniforms:ge.getParameter(Ct),maxVertexTextureUnits:ge.getParameter(lr),maxVaryingVectors:ge.getParameter(Nt),maxFragmentUniforms:ge.getParameter(yr),glsl:ge.getParameter(Ye),renderer:ge.getParameter(lt),vendor:ge.getParameter(Sr),version:ge.getParameter(Ae),readFloat:pr,npotTextureCube:zr}};function Ia(ge){return!!ge&&typeof ge=="object"&&Array.isArray(ge.shape)&&Array.isArray(ge.stride)&&typeof ge.offset=="number"&&ge.shape.length===ge.stride.length&&(Array.isArray(ge.data)||x(ge.data))}var vi=function(ge){return Object.keys(ge).map(function(tt){return ge[tt]})},Ya={shape:_u,flatten:gs};function no(ge,tt,Et){for(var gr=0;gr<tt;++gr)Et[gr]=ge[gr]}function Co(ge,tt,Et,gr){for(var Nr=0,pr=0;pr<tt;++pr)for(var _r=ge[pr],Wr=0;Wr<Et;++Wr)gr[Nr++]=_r[Wr]}function ho(ge,tt,Et,gr,Nr,pr){for(var _r=pr,Wr=0;Wr<tt;++Wr)for(var Zr=ge[Wr],Hr=0;Hr<Et;++Hr)for(var zr=Zr[Hr],qr=0;qr<gr;++qr)Nr[_r++]=zr[qr]}function Ea(ge,tt,Et,gr,Nr){for(var pr=1,_r=Et+1;_r<tt.length;++_r)pr*=tt[_r];var Wr=tt[Et];if(tt.length-Et==4){var Zr=tt[Et+1],Hr=tt[Et+2],zr=tt[Et+3];for(_r=0;_r<Wr;++_r)ho(ge[_r],Zr,Hr,zr,gr,Nr),Nr+=pr}else for(_r=0;_r<Wr;++_r)Ea(ge[_r],tt,Et+1,gr,Nr),Nr+=pr}function gs(ge,tt,Et,gr){var Nr=1;if(tt.length)for(var pr=0;pr<tt.length;++pr)Nr*=tt[pr];else Nr=0;var _r=gr||Ne.allocType(Et,Nr);switch(tt.length){case 0:break;case 1:no(ge,tt[0],_r);break;case 2:Co(ge,tt[0],tt[1],_r);break;case 3:ho(ge,tt[0],tt[1],tt[2],_r,0);break;default:Ea(ge,tt,0,_r,0)}return _r}function _u(ge){for(var tt=[],Et=ge;Et.length;Et=Et[0])tt.push(Et.length);return tt}var _a={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},$o=5120,Ti=5122,Qo=5124,vo=5121,In=5123,Bs=5125,ru=5126,ys=5126,Nn={int8:$o,int16:Ti,int32:Qo,uint8:vo,uint16:In,uint32:Bs,float:ru,float32:ys},Do=35048,Qu=35040,ua={dynamic:Do,stream:Qu,static:35044},Jo=Ya.flatten,Gs=Ya.shape,Za=35044,ms=35040,bs=5121,xa=5126,Pa=[];Pa[5120]=1,Pa[5122]=2,Pa[5124]=4,Pa[5121]=1,Pa[5123]=2,Pa[5125]=4,Pa[5126]=4;function qo(ge){return _a[Object.prototype.toString.call(ge)]|0}function eo(ge,tt){for(var Et=0;Et<tt.length;++Et)ge[Et]=tt[Et]}function es(ge,tt,Et,gr,Nr,pr,_r){for(var Wr=0,Zr=0;Zr<Et;++Zr)for(var Hr=0;Hr<gr;++Hr)ge[Wr++]=tt[Nr*Zr+pr*Hr+_r]}function ts(ge,tt,Et,gr){var Nr=0,pr={};function _r($){this.id=Nr++,this.buffer=ge.createBuffer(),this.type=$,this.usage=Za,this.byteLength=0,this.dimension=1,this.dtype=bs,this.persistentData=null,Et.profile&&(this.stats={size:0})}_r.prototype.bind=function(){ge.bindBuffer(this.type,this.buffer)},_r.prototype.destroy=function(){u(this)};var Wr=[];function Zr($,oe){var ue=Wr.pop();return ue||(ue=new _r($)),ue.bind(),qr(ue,oe,ms,0,1,!1),ue}function Hr($){Wr.push($)}function zr($,oe,ue){$.byteLength=oe.byteLength,ge.bufferData($.type,oe,ue)}function qr($,oe,ue,pe,_e,Te){var Re;if($.usage=ue,Array.isArray(oe)){if($.dtype=pe||xa,oe.length>0){var Ze;if(Array.isArray(oe[0])){Re=Gs(oe);for(var je=1,ht=1;ht<Re.length;++ht)je*=Re[ht];$.dimension=je,Ze=Jo(oe,Re,$.dtype),zr($,Ze,ue),Te?$.persistentData=Ze:Ne.freeType(Ze)}else if(typeof oe[0]=="number"){$.dimension=_e;var zt=Ne.allocType($.dtype,oe.length);eo(zt,oe),zr($,zt,ue),Te?$.persistentData=zt:Ne.freeType(zt)}else x(oe[0])?($.dimension=oe[0].length,$.dtype=pe||qo(oe[0])||xa,Ze=Jo(oe,[oe.length,oe[0].length],$.dtype),zr($,Ze,ue),Te?$.persistentData=Ze:Ne.freeType(Ze)):le.raise("invalid buffer data")}}else if(x(oe))$.dtype=pe||qo(oe),$.dimension=_e,zr($,oe,ue),Te&&($.persistentData=new Uint8Array(new Uint8Array(oe.buffer)));else if(Ia(oe)){Re=oe.shape;var wr=oe.stride,Kt=oe.offset,qt=0,Qt=0,Xr=0,Yr=0;Re.length===1?(qt=Re[0],Qt=1,Xr=wr[0],Yr=0):Re.length===2?(qt=Re[0],Qt=Re[1],Xr=wr[0],Yr=wr[1]):le.raise("invalid shape"),$.dtype=pe||qo(oe.data)||xa,$.dimension=Qt;var Kr=Ne.allocType($.dtype,qt*Qt);es(Kr,oe.data,qt,Qt,Xr,Yr,Kt),zr($,Kr,ue),Te?$.persistentData=Kr:Ne.freeType(Kr)}else oe instanceof ArrayBuffer?($.dtype=bs,$.dimension=_e,zr($,oe,ue),Te&&($.persistentData=new Uint8Array(new Uint8Array(oe)))):le.raise("invalid buffer data")}function u($){tt.bufferCount--,gr($);var oe=$.buffer;le(oe,"buffer must not be deleted already"),ge.deleteBuffer(oe),$.buffer=null,delete pr[$.id]}function P($,oe,ue,pe){tt.bufferCount++;var _e=new _r(oe);pr[_e.id]=_e;function Te(je){var ht=Za,zt=null,wr=0,Kt=0,qt=1;return Array.isArray(je)||x(je)||Ia(je)||je instanceof ArrayBuffer?zt=je:typeof je=="number"?wr=je|0:je&&(le.type(je,"object","buffer arguments must be an object, a number or an array"),"data"in je&&(le(zt===null||Array.isArray(zt)||x(zt)||Ia(zt),"invalid data for buffer"),zt=je.data),"usage"in je&&(le.parameter(je.usage,ua,"invalid buffer usage"),ht=ua[je.usage]),"type"in je&&(le.parameter(je.type,Nn,"invalid buffer type"),Kt=Nn[je.type]),"dimension"in je&&(le.type(je.dimension,"number","invalid dimension"),qt=je.dimension|0),"length"in je&&(le.nni(wr,"buffer length must be a nonnegative integer"),wr=je.length|0)),_e.bind(),zt?qr(_e,zt,ht,Kt,qt,pe):(wr&&ge.bufferData(_e.type,wr,ht),_e.dtype=Kt||bs,_e.usage=ht,_e.dimension=qt,_e.byteLength=wr),Et.profile&&(_e.stats.size=_e.byteLength*Pa[_e.dtype]),Te}function Re(je,ht){le(ht+je.byteLength<=_e.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+je.byteLength+" starting from offset "+ht+" to a buffer of size "+_e.byteLength),ge.bufferSubData(_e.type,ht,je)}function Ze(je,ht){var zt=(ht||0)|0,wr;if(_e.bind(),x(je)||je instanceof ArrayBuffer)Re(je,zt);else if(Array.isArray(je)){if(je.length>0)if(typeof je[0]=="number"){var Kt=Ne.allocType(_e.dtype,je.length);eo(Kt,je),Re(Kt,zt),Ne.freeType(Kt)}else if(Array.isArray(je[0])||x(je[0])){wr=Gs(je);var qt=Jo(je,wr,_e.dtype);Re(qt,zt),Ne.freeType(qt)}else le.raise("invalid buffer data")}else if(Ia(je)){wr=je.shape;var Qt=je.stride,Xr=0,Yr=0,Kr=0,Cn=0;wr.length===1?(Xr=wr[0],Yr=1,Kr=Qt[0],Cn=0):wr.length===2?(Xr=wr[0],Yr=wr[1],Kr=Qt[0],Cn=Qt[1]):le.raise("invalid shape");var Sn=Array.isArray(je.data)?_e.dtype:qo(je.data),Rn=Ne.allocType(Sn,Xr*Yr);es(Rn,je.data,Xr,Yr,Kr,Cn,je.offset),Re(Rn,zt),Ne.freeType(Rn)}else le.raise("invalid data for buffer subdata");return Te}return ue||Te($),Te._reglType="buffer",Te._buffer=_e,Te.subdata=Ze,Et.profile&&(Te.stats=_e.stats),Te.destroy=function(){u(_e)},Te}function W(){vi(pr).forEach(function($){$.buffer=ge.createBuffer(),ge.bindBuffer($.type,$.buffer),ge.bufferData($.type,$.persistentData||$.byteLength,$.usage)})}return Et.profile&&(tt.getTotalBufferSize=function(){var $=0;return Object.keys(pr).forEach(function(oe){$+=pr[oe].stats.size}),$}),{create:P,createStream:Zr,destroyStream:Hr,clear:function(){vi(pr).forEach(u),Wr.forEach(u)},getBuffer:function($){return $&&$._buffer instanceof _r?$._buffer:null},restore:W,_initBuffer:qr}}var nu=0,To=0,Es=1,pi=1,Fs=4,iu=4,Ha={points:nu,point:To,lines:Es,line:pi,triangles:Fs,triangle:iu,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},au=0,po=1,ca=4,to=5120,Ra=5121,Ao=5122,li=5123,fa=5124,na=5125,Xi=34963,io=35040,go=35044;function _s(ge,tt,Et,gr){var Nr={},pr=0,_r={uint8:Ra,uint16:li};tt.oes_element_index_uint&&(_r.uint32=na);function Wr(W){this.id=pr++,Nr[this.id]=this,this.buffer=W,this.primType=ca,this.vertCount=0,this.type=0}Wr.prototype.bind=function(){this.buffer.bind()};var Zr=[];function Hr(W){var $=Zr.pop();return $||($=new Wr(Et.create(null,Xi,!0,!1)._buffer)),qr($,W,io,-1,-1,0,0),$}function zr(W){Zr.push(W)}function qr(W,$,oe,ue,pe,_e,Te){W.buffer.bind();var Re;if($){var Ze=Te;!Te&&(!x($)||Ia($)&&!x($.data))&&(Ze=tt.oes_element_index_uint?na:li),Et._initBuffer(W.buffer,$,oe,Ze,3)}else ge.bufferData(Xi,_e,oe),W.buffer.dtype=Re||Ra,W.buffer.usage=oe,W.buffer.dimension=3,W.buffer.byteLength=_e;if(Re=Te,!Te){switch(W.buffer.dtype){case Ra:case to:Re=Ra;break;case li:case Ao:Re=li;break;case na:case fa:Re=na;break;default:le.raise("unsupported type for element array")}W.buffer.dtype=Re}W.type=Re,le(Re!==na||!!tt.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var je=pe;je<0&&(je=W.buffer.byteLength,Re===li?je>>=1:Re===na&&(je>>=2)),W.vertCount=je;var ht=ue;if(ue<0){ht=ca;var zt=W.buffer.dimension;zt===1&&(ht=au),zt===2&&(ht=po),zt===3&&(ht=ca)}W.primType=ht}function u(W){gr.elementsCount--,le(W.buffer!==null,"must not double destroy elements"),delete Nr[W.id],W.buffer.destroy(),W.buffer=null}function P(W,$){var oe=Et.create(null,Xi,!0),ue=new Wr(oe._buffer);gr.elementsCount++;function pe(_e){if(!_e)oe(),ue.primType=ca,ue.vertCount=0,ue.type=Ra;else if(typeof _e=="number")oe(_e),ue.primType=ca,ue.vertCount=_e|0,ue.type=Ra;else{var Te=null,Re=go,Ze=-1,je=-1,ht=0,zt=0;Array.isArray(_e)||x(_e)||Ia(_e)?Te=_e:(le.type(_e,"object","invalid arguments for elements"),"data"in _e&&(Te=_e.data,le(Array.isArray(Te)||x(Te)||Ia(Te),"invalid data for element buffer")),"usage"in _e&&(le.parameter(_e.usage,ua,"invalid element buffer usage"),Re=ua[_e.usage]),"primitive"in _e&&(le.parameter(_e.primitive,Ha,"invalid element buffer primitive"),Ze=Ha[_e.primitive]),"count"in _e&&(le(typeof _e.count=="number"&&_e.count>=0,"invalid vertex count for elements"),je=_e.count|0),"type"in _e&&(le.parameter(_e.type,_r,"invalid buffer type"),zt=_r[_e.type]),"length"in _e?ht=_e.length|0:(ht=je,zt===li||zt===Ao?ht*=2:(zt===na||zt===fa)&&(ht*=4))),qr(ue,Te,Re,Ze,je,ht,zt)}return pe}return pe(W),pe._reglType="elements",pe._elements=ue,pe.subdata=function(_e,Te){return oe.subdata(_e,Te),pe},pe.destroy=function(){u(ue)},pe}return{create:P,createStream:Hr,destroyStream:zr,getElements:function(W){return typeof W=="function"&&W._elements instanceof Wr?W._elements:null},clear:function(){vi(Nr).forEach(u)}}}var No=new Float32Array(1),yo=new Uint32Array(No.buffer),rs=5123;function Lo(ge){for(var tt=Ne.allocType(rs,ge.length),Et=0;Et<ge.length;++Et)if(isNaN(ge[Et]))tt[Et]=65535;else if(ge[Et]===Infinity)tt[Et]=31744;else if(ge[Et]===-Infinity)tt[Et]=64512;else{No[0]=ge[Et];var gr=yo[0],Nr=gr>>>31<<15,pr=(gr<<1>>>24)-127,_r=gr>>13&(1<<10)-1;if(pr<-24)tt[Et]=Nr;else if(pr<-14){var Wr=-14-pr;tt[Et]=Nr+(_r+(1<<10)>>Wr)}else pr>15?tt[Et]=Nr+31744:tt[Et]=Nr+(pr+15<<10)+_r}return tt}function Hi(ge){return Array.isArray(ge)||x(ge)}var Ju=function(ge){return!(ge&ge-1)&&!!ge},mf=34467,mo=3553,Pc=34067,di=34069,bn=6408,qu=6406,Ka=6407,xs=6409,ou=6410,la=32854,da=32855,Ro=36194,cl=32819,fl=32820,Oc=33635,xu=34042,Fa=6402,ao=34041,ec=35904,tc=35906,bo=36193,su=33776,uu=33777,ko=33778,rc=33779,Ss=35986,Bo=35987,cu=34798,bf=35840,ll=35841,Ef=35842,_f=35843,dl=36196,ns=5121,Su=5123,Dc=5125,oo=5126,is=10242,wu=10243,hl=10497,Mu=33071,vl=33648,pl=10240,Nc=10241,zn=9728,gl=9729,xf=9984,Lc=9985,Sf=9986,nc=9987,wf=33170,Cu=4352,ic=4353,Mf=4354,Rc=34046,ac=3317,oc=37440,Oa=37441,kc=37443,Tu=37444,sc=33984,yl=[xf,Sf,Lc,nc],Au=[0,xs,ou,Ka,bn],$a={};$a[xs]=$a[qu]=$a[Fa]=1,$a[ao]=$a[ou]=2,$a[Ka]=$a[ec]=3,$a[bn]=$a[tc]=4;function Qa(ge){return"[object "+ge+"]"}var Us=Qa("HTMLCanvasElement"),ml=Qa("OffscreenCanvas"),Cf=Qa("CanvasRenderingContext2D"),Tf=Qa("ImageBitmap"),fu=Qa("HTMLImageElement"),bl=Qa("HTMLVideoElement"),Af=Object.keys(_a).concat([Us,ml,Cf,Tf,fu,bl]),as=[];as[ns]=1,as[oo]=4,as[bo]=2,as[Su]=2,as[Dc]=4;var Sa=[];Sa[la]=2,Sa[da]=2,Sa[Ro]=2,Sa[ao]=4,Sa[su]=.5,Sa[uu]=.5,Sa[ko]=1,Sa[rc]=1,Sa[Ss]=.5,Sa[Bo]=1,Sa[cu]=1,Sa[bf]=.5,Sa[ll]=.25,Sa[Ef]=.5,Sa[_f]=.25,Sa[dl]=.5;function Bc(ge){return Array.isArray(ge)&&(ge.length===0||typeof ge[0]=="number")}function ws(ge){if(!Array.isArray(ge))return!1;var tt=ge.length;return!(tt===0||!Hi(ge[0]))}function Go(ge){return Object.prototype.toString.call(ge)}function If(ge){return Go(ge)===Us}function Pf(ge){return Go(ge)===ml}function Gc(ge){return Go(ge)===Cf}function Fc(ge){return Go(ge)===Tf}function El(ge){return Go(ge)===fu}function uc(ge){return Go(ge)===bl}function Io(ge){if(!ge)return!1;var tt=Go(ge);return Af.indexOf(tt)>=0?!0:Bc(ge)||ws(ge)||Ia(ge)}function Uc(ge){return _a[Object.prototype.toString.call(ge)]|0}function zs(ge,tt){var Et=tt.length;switch(ge.type){case ns:case Su:case Dc:case oo:var gr=Ne.allocType(ge.type,Et);gr.set(tt),ge.data=gr;break;case bo:ge.data=Lo(tt);break;default:le.raise("unsupported texture type, must specify a typed array")}}function _l(ge,tt){return Ne.allocType(ge.type===bo?oo:ge.type,tt)}function xl(ge,tt){ge.type===bo?(ge.data=Lo(tt),Ne.freeType(tt)):ge.data=tt}function Ms(ge,tt,Et,gr,Nr,pr){for(var _r=ge.width,Wr=ge.height,Zr=ge.channels,Hr=_r*Wr*Zr,zr=_l(ge,Hr),qr=0,u=0;u<Wr;++u)for(var P=0;P<_r;++P)for(var W=0;W<Zr;++W)zr[qr++]=tt[Et*P+gr*u+Nr*W+pr];xl(ge,zr)}function wa(ge,tt,Et,gr,Nr,pr){var _r;if(typeof Sa[ge]!="undefined"?_r=Sa[ge]:_r=$a[ge]*as[tt],pr&&(_r*=6),Nr){for(var Wr=0,Zr=Et;Zr>=1;)Wr+=_r*Zr*Zr,Zr/=2;return Wr}else return _r*Et*gr}function rd(ge,tt,Et,gr,Nr,pr,_r){var Wr={"don't care":Cu,"dont care":Cu,nice:Mf,fast:ic},Zr={repeat:hl,clamp:Mu,mirror:vl},Hr={nearest:zn,linear:gl},zr=M({mipmap:nc,"nearest mipmap nearest":xf,"linear mipmap nearest":Lc,"nearest mipmap linear":Sf,"linear mipmap linear":nc},Hr),qr={none:0,browser:Tu},u={uint8:ns,rgba4:cl,rgb565:Oc,"rgb5 a1":fl},P={alpha:qu,luminance:xs,"luminance alpha":ou,rgb:Ka,rgba:bn,rgba4:la,"rgb5 a1":da,rgb565:Ro},W={};tt.ext_srgb&&(P.srgb=ec,P.srgba=tc),tt.oes_texture_float&&(u.float32=u.float=oo),tt.oes_texture_half_float&&(u.float16=u["half float"]=bo),tt.webgl_depth_texture&&(M(P,{depth:Fa,"depth stencil":ao}),M(u,{uint16:Su,uint32:Dc,"depth stencil":xu})),tt.webgl_compressed_texture_s3tc&&M(W,{"rgb s3tc dxt1":su,"rgba s3tc dxt1":uu,"rgba s3tc dxt3":ko,"rgba s3tc dxt5":rc}),tt.webgl_compressed_texture_atc&&M(W,{"rgb atc":Ss,"rgba atc explicit alpha":Bo,"rgba atc interpolated alpha":cu}),tt.webgl_compressed_texture_pvrtc&&M(W,{"rgb pvrtc 4bppv1":bf,"rgb pvrtc 2bppv1":ll,"rgba pvrtc 4bppv1":Ef,"rgba pvrtc 2bppv1":_f}),tt.webgl_compressed_texture_etc1&&(W["rgb etc1"]=dl);var $=Array.prototype.slice.call(ge.getParameter(mf));Object.keys(W).forEach(function(yt){var br=W[yt];$.indexOf(br)>=0&&(P[yt]=br)});var oe=Object.keys(P);Et.textureFormats=oe;var ue=[];Object.keys(P).forEach(function(yt){var br=P[yt];ue[br]=yt});var pe=[];Object.keys(u).forEach(function(yt){var br=u[yt];pe[br]=yt});var _e=[];Object.keys(Hr).forEach(function(yt){var br=Hr[yt];_e[br]=yt});var Te=[];Object.keys(zr).forEach(function(yt){var br=zr[yt];Te[br]=yt});var Re=[];Object.keys(Zr).forEach(function(yt){var br=Zr[yt];Re[br]=yt});var Ze=oe.reduce(function(yt,br){var hr=P[br];return hr===xs||hr===qu||hr===xs||hr===ou||hr===Fa||hr===ao||tt.ext_srgb&&(hr===ec||hr===tc)?yt[hr]=hr:hr===da||br.indexOf("rgba")>=0?yt[hr]=bn:yt[hr]=Ka,yt},{});function je(){this.internalformat=bn,this.format=bn,this.type=ns,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Tu,this.width=0,this.height=0,this.channels=0}function ht(yt,br){yt.internalformat=br.internalformat,yt.format=br.format,yt.type=br.type,yt.compressed=br.compressed,yt.premultiplyAlpha=br.premultiplyAlpha,yt.flipY=br.flipY,yt.unpackAlignment=br.unpackAlignment,yt.colorSpace=br.colorSpace,yt.width=br.width,yt.height=br.height,yt.channels=br.channels}function zt(yt,br){if(!(typeof br!="object"||!br)){if("premultiplyAlpha"in br&&(le.type(br.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),yt.premultiplyAlpha=br.premultiplyAlpha),"flipY"in br&&(le.type(br.flipY,"boolean","invalid texture flip"),yt.flipY=br.flipY),"alignment"in br&&(le.oneOf(br.alignment,[1,2,4,8],"invalid texture unpack alignment"),yt.unpackAlignment=br.alignment),"colorSpace"in br&&(le.parameter(br.colorSpace,qr,"invalid colorSpace"),yt.colorSpace=qr[br.colorSpace]),"type"in br){var hr=br.type;le(tt.oes_texture_float||!(hr==="float"||hr==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),le(tt.oes_texture_half_float||!(hr==="half float"||hr==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),le(tt.webgl_depth_texture||!(hr==="uint16"||hr==="uint32"||hr==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),le.parameter(hr,u,"invalid texture type"),yt.type=u[hr]}var mn=yt.width,fi=yt.height,ot=yt.channels,Xe=!1;"shape"in br?(le(Array.isArray(br.shape)&&br.shape.length>=2,"shape must be an array"),mn=br.shape[0],fi=br.shape[1],br.shape.length===3&&(ot=br.shape[2],le(ot>0&&ot<=4,"invalid number of channels"),Xe=!0),le(mn>=0&&mn<=Et.maxTextureSize,"invalid width"),le(fi>=0&&fi<=Et.maxTextureSize,"invalid height")):("radius"in br&&(mn=fi=br.radius,le(mn>=0&&mn<=Et.maxTextureSize,"invalid radius")),"width"in br&&(mn=br.width,le(mn>=0&&mn<=Et.maxTextureSize,"invalid width")),"height"in br&&(fi=br.height,le(fi>=0&&fi<=Et.maxTextureSize,"invalid height")),"channels"in br&&(ot=br.channels,le(ot>0&&ot<=4,"invalid number of channels"),Xe=!0)),yt.width=mn|0,yt.height=fi|0,yt.channels=ot|0;var Gt=!1;if("format"in br){var tr=br.format;le(tt.webgl_depth_texture||!(tr==="depth"||tr==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),le.parameter(tr,P,"invalid texture format");var or=yt.internalformat=P[tr];yt.format=Ze[or],tr in u&&("type"in br||(yt.type=u[tr])),tr in W&&(yt.compressed=!0),Gt=!0}!Xe&&Gt?yt.channels=$a[yt.format]:Xe&&!Gt?yt.channels!==Au[yt.format]&&(yt.format=yt.internalformat=Au[yt.channels]):Gt&&Xe&&le(yt.channels===$a[yt.format],"number of channels inconsistent with specified format")}}function wr(yt){ge.pixelStorei(oc,yt.flipY),ge.pixelStorei(Oa,yt.premultiplyAlpha),ge.pixelStorei(kc,yt.colorSpace),ge.pixelStorei(ac,yt.unpackAlignment)}function Kt(){je.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function qt(yt,br){var hr=null;if(Io(br)?hr=br:br&&(le.type(br,"object","invalid pixel data type"),zt(yt,br),"x"in br&&(yt.xOffset=br.x|0),"y"in br&&(yt.yOffset=br.y|0),Io(br.data)&&(hr=br.data)),le(!yt.compressed||hr instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),br.copy){le(!hr,"can not specify copy and data field for the same texture");var mn=Nr.viewportWidth,fi=Nr.viewportHeight;yt.width=yt.width||mn-yt.xOffset,yt.height=yt.height||fi-yt.yOffset,yt.needsCopy=!0,le(yt.xOffset>=0&&yt.xOffset<mn&&yt.yOffset>=0&&yt.yOffset<fi&&yt.width>0&&yt.width<=mn&&yt.height>0&&yt.height<=fi,"copy texture read out of bounds")}else if(!hr)yt.width=yt.width||1,yt.height=yt.height||1,yt.channels=yt.channels||4;else if(x(hr))yt.channels=yt.channels||4,yt.data=hr,!("type"in br)&&yt.type===ns&&(yt.type=Uc(hr));else if(Bc(hr))yt.channels=yt.channels||4,zs(yt,hr),yt.alignment=1,yt.needsFree=!0;else if(Ia(hr)){var ot=hr.data;!Array.isArray(ot)&&yt.type===ns&&(yt.type=Uc(ot));var Xe=hr.shape,Gt=hr.stride,tr,or,Wt,Ft,Xt,st;Xe.length===3?(Wt=Xe[2],st=Gt[2]):(le(Xe.length===2,"invalid ndarray pixel data, must be 2 or 3D"),Wt=1,st=1),tr=Xe[0],or=Xe[1],Ft=Gt[0],Xt=Gt[1],yt.alignment=1,yt.width=tr,yt.height=or,yt.channels=Wt,yt.format=yt.internalformat=Au[Wt],yt.needsFree=!0,Ms(yt,ot,Ft,Xt,st,hr.offset)}else if(If(hr)||Pf(hr)||Gc(hr))If(hr)||Pf(hr)?yt.element=hr:yt.element=hr.canvas,yt.width=yt.element.width,yt.height=yt.element.height,yt.channels=4;else if(Fc(hr))yt.element=hr,yt.width=hr.width,yt.height=hr.height,yt.channels=4;else if(El(hr))yt.element=hr,yt.width=hr.naturalWidth,yt.height=hr.naturalHeight,yt.channels=4;else if(uc(hr))yt.element=hr,yt.width=hr.videoWidth,yt.height=hr.videoHeight,yt.channels=4;else if(ws(hr)){var Ot=yt.width||hr[0].length,it=yt.height||hr.length,Jt=yt.channels;Hi(hr[0][0])?Jt=Jt||hr[0][0].length:Jt=Jt||1;for(var cr=Ya.shape(hr),Lr=1,Br=0;Br<cr.length;++Br)Lr*=cr[Br];var Tr=_l(yt,Lr);Ya.flatten(hr,cr,"",Tr),xl(yt,Tr),yt.alignment=1,yt.width=Ot,yt.height=it,yt.channels=Jt,yt.format=yt.internalformat=Au[Jt],yt.needsFree=!0}yt.type===oo?le(Et.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):yt.type===bo&&le(Et.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function Qt(yt,br,hr){var mn=yt.element,fi=yt.data,ot=yt.internalformat,Xe=yt.format,Gt=yt.type,tr=yt.width,or=yt.height;wr(yt),mn?ge.texImage2D(br,hr,Xe,Xe,Gt,mn):yt.compressed?ge.compressedTexImage2D(br,hr,ot,tr,or,0,fi):yt.needsCopy?(gr(),ge.copyTexImage2D(br,hr,Xe,yt.xOffset,yt.yOffset,tr,or,0)):ge.texImage2D(br,hr,Xe,tr,or,0,Xe,Gt,fi||null)}function Xr(yt,br,hr,mn,fi){var ot=yt.element,Xe=yt.data,Gt=yt.internalformat,tr=yt.format,or=yt.type,Wt=yt.width,Ft=yt.height;wr(yt),ot?ge.texSubImage2D(br,fi,hr,mn,tr,or,ot):yt.compressed?ge.compressedTexSubImage2D(br,fi,hr,mn,Gt,Wt,Ft,Xe):yt.needsCopy?(gr(),ge.copyTexSubImage2D(br,fi,hr,mn,yt.xOffset,yt.yOffset,Wt,Ft)):ge.texSubImage2D(br,fi,hr,mn,Wt,Ft,tr,or,Xe)}var Yr=[];function Kr(){return Yr.pop()||new Kt}function Cn(yt){yt.needsFree&&Ne.freeType(yt.data),Kt.call(yt),Yr.push(yt)}function Sn(){je.call(this),this.genMipmaps=!1,this.mipmapHint=Cu,this.mipmask=0,this.images=Array(16)}function Rn(yt,br,hr){var mn=yt.images[0]=Kr();yt.mipmask=1,mn.width=yt.width=br,mn.height=yt.height=hr,mn.channels=yt.channels=4}function jn(yt,br){var hr=null;if(Io(br))hr=yt.images[0]=Kr(),ht(hr,yt),qt(hr,br),yt.mipmask=1;else if(zt(yt,br),Array.isArray(br.mipmap))for(var mn=br.mipmap,fi=0;fi<mn.length;++fi)hr=yt.images[fi]=Kr(),ht(hr,yt),hr.width>>=fi,hr.height>>=fi,qt(hr,mn[fi]),yt.mipmask|=1<<fi;else hr=yt.images[0]=Kr(),ht(hr,yt),qt(hr,br),yt.mipmask=1;ht(yt,yt.images[0]),yt.compressed&&(yt.internalformat===su||yt.internalformat===uu||yt.internalformat===ko||yt.internalformat===rc)&&le(yt.width%4==0&&yt.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function kn(yt,br){for(var hr=yt.images,mn=0;mn<hr.length;++mn){if(!hr[mn])return;Qt(hr[mn],br,mn)}}var Bi=[];function Xn(){var yt=Bi.pop()||new Sn;je.call(yt),yt.mipmask=0;for(var br=0;br<16;++br)yt.images[br]=null;return yt}function qi(yt){for(var br=yt.images,hr=0;hr<br.length;++hr)br[hr]&&Cn(br[hr]),br[hr]=null;Bi.push(yt)}function Oi(){this.minFilter=zn,this.magFilter=zn,this.wrapS=Mu,this.wrapT=Mu,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=Cu}function Kn(yt,br){if("min"in br){var hr=br.min;le.parameter(hr,zr),yt.minFilter=zr[hr],yl.indexOf(yt.minFilter)>=0&&!("faces"in br)&&(yt.genMipmaps=!0)}if("mag"in br){var mn=br.mag;le.parameter(mn,Hr),yt.magFilter=Hr[mn]}var fi=yt.wrapS,ot=yt.wrapT;if("wrap"in br){var Xe=br.wrap;typeof Xe=="string"?(le.parameter(Xe,Zr),fi=ot=Zr[Xe]):Array.isArray(Xe)&&(le.parameter(Xe[0],Zr),le.parameter(Xe[1],Zr),fi=Zr[Xe[0]],ot=Zr[Xe[1]])}else{if("wrapS"in br){var Gt=br.wrapS;le.parameter(Gt,Zr),fi=Zr[Gt]}if("wrapT"in br){var tr=br.wrapT;le.parameter(tr,Zr),ot=Zr[tr]}}if(yt.wrapS=fi,yt.wrapT=ot,"anisotropic"in br){var or=br.anisotropic;le(typeof or=="number"&&or>=1&&or<=Et.maxAnisotropic,"aniso samples must be between 1 and "),yt.anisotropic=br.anisotropic}if("mipmap"in br){var Wt=!1;switch(typeof br.mipmap){case"string":le.parameter(br.mipmap,Wr,"invalid mipmap hint"),yt.mipmapHint=Wr[br.mipmap],yt.genMipmaps=!0,Wt=!0;break;case"boolean":Wt=yt.genMipmaps=br.mipmap;break;case"object":le(Array.isArray(br.mipmap),"invalid mipmap type"),yt.genMipmaps=!1,Wt=!0;break;default:le.raise("invalid mipmap type")}Wt&&!("min"in br)&&(yt.minFilter=xf)}}function Zi(yt,br){ge.texParameteri(br,Nc,yt.minFilter),ge.texParameteri(br,pl,yt.magFilter),ge.texParameteri(br,is,yt.wrapS),ge.texParameteri(br,wu,yt.wrapT),tt.ext_texture_filter_anisotropic&&ge.texParameteri(br,Rc,yt.anisotropic),yt.genMipmaps&&(ge.hint(wf,yt.mipmapHint),ge.generateMipmap(br))}var Ki=0,ri={},za=Et.maxTextureUnits,pa=Array(za).map(function(){return null});function Jn(yt){je.call(this),this.mipmask=0,this.internalformat=bn,this.id=Ki++,this.refCount=1,this.target=yt,this.texture=ge.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Oi,_r.profile&&(this.stats={size:0})}function Ga(yt){ge.activeTexture(sc),ge.bindTexture(yt.target,yt.texture)}function Mi(){var yt=pa[0];yt?ge.bindTexture(yt.target,yt.texture):ge.bindTexture(mo,null)}function Bn(yt){var br=yt.texture;le(br,"must not double destroy texture");var hr=yt.unit,mn=yt.target;hr>=0&&(ge.activeTexture(sc+hr),ge.bindTexture(mn,null),pa[hr]=null),ge.deleteTexture(br),yt.texture=null,yt.params=null,yt.pixels=null,yt.refCount=0,delete ri[yt.id],pr.textureCount--}M(Jn.prototype,{bind:function(){var yt=this;yt.bindCount+=1;var br=yt.unit;if(br<0){for(var hr=0;hr<za;++hr){var mn=pa[hr];if(mn){if(mn.bindCount>0)continue;mn.unit=-1}pa[hr]=yt,br=hr;break}br>=za&&le.raise("insufficient number of texture units"),_r.profile&&pr.maxTextureUnits<br+1&&(pr.maxTextureUnits=br+1),yt.unit=br,ge.activeTexture(sc+br),ge.bindTexture(yt.target,yt.texture)}return br},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&Bn(this)}});function hi(yt,br){var hr=new Jn(mo);ri[hr.id]=hr,pr.textureCount++;function mn(Xe,Gt){var tr=hr.texInfo;Oi.call(tr);var or=Xn();return typeof Xe=="number"?typeof Gt=="number"?Rn(or,Xe|0,Gt|0):Rn(or,Xe|0,Xe|0):Xe?(le.type(Xe,"object","invalid arguments to regl.texture"),Kn(tr,Xe),jn(or,Xe)):Rn(or,1,1),tr.genMipmaps&&(or.mipmask=(or.width<<1)-1),hr.mipmask=or.mipmask,ht(hr,or),le.texture2D(tr,or,Et),hr.internalformat=or.internalformat,mn.width=or.width,mn.height=or.height,Ga(hr),kn(or,mo),Zi(tr,mo),Mi(),qi(or),_r.profile&&(hr.stats.size=wa(hr.internalformat,hr.type,or.width,or.height,tr.genMipmaps,!1)),mn.format=ue[hr.internalformat],mn.type=pe[hr.type],mn.mag=_e[tr.magFilter],mn.min=Te[tr.minFilter],mn.wrapS=Re[tr.wrapS],mn.wrapT=Re[tr.wrapT],mn}function fi(Xe,Gt,tr,or){le(!!Xe,"must specify image data");var Wt=Gt|0,Ft=tr|0,Xt=or|0,st=Kr();return ht(st,hr),st.width=0,st.height=0,qt(st,Xe),st.width=st.width||(hr.width>>Xt)-Wt,st.height=st.height||(hr.height>>Xt)-Ft,le(hr.type===st.type&&hr.format===st.format&&hr.internalformat===st.internalformat,"incompatible format for texture.subimage"),le(Wt>=0&&Ft>=0&&Wt+st.width<=hr.width&&Ft+st.height<=hr.height,"texture.subimage write out of bounds"),le(hr.mipmask&1<<Xt,"missing mipmap data"),le(st.data||st.element||st.needsCopy,"missing image data"),Ga(hr),Xr(st,mo,Wt,Ft,Xt),Mi(),Cn(st),mn}function ot(Xe,Gt){var tr=Xe|0,or=Gt|0||tr;if(tr===hr.width&&or===hr.height)return mn;mn.width=hr.width=tr,mn.height=hr.height=or,Ga(hr);for(var Wt=0;hr.mipmask>>Wt;++Wt){var Ft=tr>>Wt,Xt=or>>Wt;if(!Ft||!Xt)break;ge.texImage2D(mo,Wt,hr.format,Ft,Xt,0,hr.format,hr.type,null)}return Mi(),_r.profile&&(hr.stats.size=wa(hr.internalformat,hr.type,tr,or,!1,!1)),mn}return mn(yt,br),mn.subimage=fi,mn.resize=ot,mn._reglType="texture2d",mn._texture=hr,_r.profile&&(mn.stats=hr.stats),mn.destroy=function(){hr.decRef()},mn}function yi(yt,br,hr,mn,fi,ot){var Xe=new Jn(Pc);ri[Xe.id]=Xe,pr.cubeCount++;var Gt=new Array(6);function tr(Ft,Xt,st,Ot,it,Jt){var cr,Lr=Xe.texInfo;for(Oi.call(Lr),cr=0;cr<6;++cr)Gt[cr]=Xn();if(typeof Ft=="number"||!Ft){var Br=Ft|0||1;for(cr=0;cr<6;++cr)Rn(Gt[cr],Br,Br)}else if(typeof Ft=="object")if(Xt)jn(Gt[0],Ft),jn(Gt[1],Xt),jn(Gt[2],st),jn(Gt[3],Ot),jn(Gt[4],it),jn(Gt[5],Jt);else if(Kn(Lr,Ft),zt(Xe,Ft),"faces"in Ft){var Tr=Ft.faces;for(le(Array.isArray(Tr)&&Tr.length===6,"cube faces must be a length 6 array"),cr=0;cr<6;++cr)le(typeof Tr[cr]=="object"&&!!Tr[cr],"invalid input for cube map face"),ht(Gt[cr],Xe),jn(Gt[cr],Tr[cr])}else for(cr=0;cr<6;++cr)jn(Gt[cr],Ft);else le.raise("invalid arguments to cube map");for(ht(Xe,Gt[0]),Et.npotTextureCube||le(Ju(Xe.width)&&Ju(Xe.height),"your browser does not support non power or two texture dimensions"),Lr.genMipmaps?Xe.mipmask=(Gt[0].width<<1)-1:Xe.mipmask=Gt[0].mipmask,le.textureCube(Xe,Lr,Gt,Et),Xe.internalformat=Gt[0].internalformat,tr.width=Gt[0].width,tr.height=Gt[0].height,Ga(Xe),cr=0;cr<6;++cr)kn(Gt[cr],di+cr);for(Zi(Lr,Pc),Mi(),_r.profile&&(Xe.stats.size=wa(Xe.internalformat,Xe.type,tr.width,tr.height,Lr.genMipmaps,!0)),tr.format=ue[Xe.internalformat],tr.type=pe[Xe.type],tr.mag=_e[Lr.magFilter],tr.min=Te[Lr.minFilter],tr.wrapS=Re[Lr.wrapS],tr.wrapT=Re[Lr.wrapT],cr=0;cr<6;++cr)qi(Gt[cr]);return tr}function or(Ft,Xt,st,Ot,it){le(!!Xt,"must specify image data"),le(typeof Ft=="number"&&Ft===(Ft|0)&&Ft>=0&&Ft<6,"invalid face");var Jt=st|0,cr=Ot|0,Lr=it|0,Br=Kr();return ht(Br,Xe),Br.width=0,Br.height=0,qt(Br,Xt),Br.width=Br.width||(Xe.width>>Lr)-Jt,Br.height=Br.height||(Xe.height>>Lr)-cr,le(Xe.type===Br.type&&Xe.format===Br.format&&Xe.internalformat===Br.internalformat,"incompatible format for texture.subimage"),le(Jt>=0&&cr>=0&&Jt+Br.width<=Xe.width&&cr+Br.height<=Xe.height,"texture.subimage write out of bounds"),le(Xe.mipmask&1<<Lr,"missing mipmap data"),le(Br.data||Br.element||Br.needsCopy,"missing image data"),Ga(Xe),Xr(Br,di+Ft,Jt,cr,Lr),Mi(),Cn(Br),tr}function Wt(Ft){var Xt=Ft|0;if(Xt!==Xe.width){tr.width=Xe.width=Xt,tr.height=Xe.height=Xt,Ga(Xe);for(var st=0;st<6;++st)for(var Ot=0;Xe.mipmask>>Ot;++Ot)ge.texImage2D(di+st,Ot,Xe.format,Xt>>Ot,Xt>>Ot,0,Xe.format,Xe.type,null);return Mi(),_r.profile&&(Xe.stats.size=wa(Xe.internalformat,Xe.type,tr.width,tr.height,!1,!0)),tr}}return tr(yt,br,hr,mn,fi,ot),tr.subimage=or,tr.resize=Wt,tr._reglType="textureCube",tr._texture=Xe,_r.profile&&(tr.stats=Xe.stats),tr.destroy=function(){Xe.decRef()},tr}function aa(){for(var yt=0;yt<za;++yt)ge.activeTexture(sc+yt),ge.bindTexture(mo,null),pa[yt]=null;vi(ri).forEach(Bn),pr.cubeCount=0,pr.textureCount=0}_r.profile&&(pr.getTotalTextureSize=function(){var yt=0;return Object.keys(ri).forEach(function(br){yt+=ri[br].stats.size}),yt});function qs(){for(var yt=0;yt<za;++yt){var br=pa[yt];br&&(br.bindCount=0,br.unit=-1,pa[yt]=null)}vi(ri).forEach(function(hr){hr.texture=ge.createTexture(),ge.bindTexture(hr.target,hr.texture);for(var mn=0;mn<32;++mn)if((hr.mipmask&1<<mn)!=0)if(hr.target===mo)ge.texImage2D(mo,mn,hr.internalformat,hr.width>>mn,hr.height>>mn,0,hr.internalformat,hr.type,null);else for(var fi=0;fi<6;++fi)ge.texImage2D(di+fi,mn,hr.internalformat,hr.width>>mn,hr.height>>mn,0,hr.internalformat,hr.type,null);Zi(hr.texInfo,hr.target)})}function Tc(){for(var yt=0;yt<za;++yt){var br=pa[yt];br&&(br.bindCount=0,br.unit=-1,pa[yt]=null),ge.activeTexture(sc+yt),ge.bindTexture(mo,null),ge.bindTexture(Pc,null)}}return{create2D:hi,createCube:yi,clear:aa,getTexture:function(yt){return null},restore:qs,refresh:Tc}}var yn=36161,cc=32854,gi=32855,fc=36194,Sl=33189,lu=36168,Of=34041,zc=35907,Df=34836,wl=34842,Nf=34843,Fo=[];Fo[cc]=2,Fo[gi]=2,Fo[fc]=2,Fo[Sl]=2,Fo[lu]=1,Fo[Of]=4,Fo[zc]=4,Fo[Df]=16,Fo[wl]=8,Fo[Nf]=6;function Ml(ge,tt,Et){return Fo[ge]*tt*Et}var Wc=function(ge,tt,Et,gr,Nr){var pr={rgba4:cc,rgb565:fc,"rgb5 a1":gi,depth:Sl,stencil:lu,"depth stencil":Of};tt.ext_srgb&&(pr.srgba=zc),tt.ext_color_buffer_half_float&&(pr.rgba16f=wl,pr.rgb16f=Nf),tt.webgl_color_buffer_float&&(pr.rgba32f=Df);var _r=[];Object.keys(pr).forEach(function(P){var W=pr[P];_r[W]=P});var Wr=0,Zr={};function Hr(P){this.id=Wr++,this.refCount=1,this.renderbuffer=P,this.format=cc,this.width=0,this.height=0,Nr.profile&&(this.stats={size:0})}Hr.prototype.decRef=function(){--this.refCount<=0&&zr(this)};function zr(P){var W=P.renderbuffer;le(W,"must not double destroy renderbuffer"),ge.bindRenderbuffer(yn,null),ge.deleteRenderbuffer(W),P.renderbuffer=null,P.refCount=0,delete Zr[P.id],gr.renderbufferCount--}function qr(P,W){var $=new Hr(ge.createRenderbuffer());Zr[$.id]=$,gr.renderbufferCount++;function oe(pe,_e){var Te=0,Re=0,Ze=cc;if(typeof pe=="object"&&pe){var je=pe;if("shape"in je){var ht=je.shape;le(Array.isArray(ht)&&ht.length>=2,"invalid renderbuffer shape"),Te=ht[0]|0,Re=ht[1]|0}else"radius"in je&&(Te=Re=je.radius|0),"width"in je&&(Te=je.width|0),"height"in je&&(Re=je.height|0);"format"in je&&(le.parameter(je.format,pr,"invalid renderbuffer format"),Ze=pr[je.format])}else typeof pe=="number"?(Te=pe|0,typeof _e=="number"?Re=_e|0:Re=Te):pe?le.raise("invalid arguments to renderbuffer constructor"):Te=Re=1;if(le(Te>0&&Re>0&&Te<=Et.maxRenderbufferSize&&Re<=Et.maxRenderbufferSize,"invalid renderbuffer size"),!(Te===$.width&&Re===$.height&&Ze===$.format))return oe.width=$.width=Te,oe.height=$.height=Re,$.format=Ze,ge.bindRenderbuffer(yn,$.renderbuffer),ge.renderbufferStorage(yn,Ze,Te,Re),le(ge.getError()===0,"invalid render buffer format"),Nr.profile&&($.stats.size=Ml($.format,$.width,$.height)),oe.format=_r[$.format],oe}function ue(pe,_e){var Te=pe|0,Re=_e|0||Te;return Te===$.width&&Re===$.height||(le(Te>0&&Re>0&&Te<=Et.maxRenderbufferSize&&Re<=Et.maxRenderbufferSize,"invalid renderbuffer size"),oe.width=$.width=Te,oe.height=$.height=Re,ge.bindRenderbuffer(yn,$.renderbuffer),ge.renderbufferStorage(yn,$.format,Te,Re),le(ge.getError()===0,"invalid render buffer format"),Nr.profile&&($.stats.size=Ml($.format,$.width,$.height))),oe}return oe(P,W),oe.resize=ue,oe._reglType="renderbuffer",oe._renderbuffer=$,Nr.profile&&(oe.stats=$.stats),oe.destroy=function(){$.decRef()},oe}Nr.profile&&(gr.getTotalRenderbufferSize=function(){var P=0;return Object.keys(Zr).forEach(function(W){P+=Zr[W].stats.size}),P});function u(){vi(Zr).forEach(function(P){P.renderbuffer=ge.createRenderbuffer(),ge.bindRenderbuffer(yn,P.renderbuffer),ge.renderbufferStorage(yn,P.format,P.width,P.height)}),ge.bindRenderbuffer(yn,null)}return{create:qr,clear:function(){vi(Zr).forEach(zr)},restore:u}},Da=36160,Lf=36161,Iu=3553,Rf=34069,kf=36064,nd=36096,Ws=36128,Bf=33306,Uo=36053,Pu=36054,lc=36055,jc=36057,zo=36061,so=36193,Cl=5121,Po=5126,Vc=6407,Cs=6408,Ts=6402,Gf=[Vc,Cs],Ou=[];Ou[Cs]=4,Ou[Vc]=3;var js=[];js[Cl]=1,js[Po]=4,js[so]=2;var Ri=32854,Xc=32855,os=36194,Wo=33189,ss=36168,Yc=34041,dc=35907,hc=34836,Tl=34842,Ff=34843,Uf=[Ri,Xc,os,dc,Tl,Ff,hc],us={};us[Uo]="complete",us[Pu]="incomplete attachment",us[jc]="incomplete dimensions",us[lc]="incomplete, missing attachment",us[zo]="unsupported";function Al(ge,tt,Et,gr,Nr,pr){var _r={cur:null,next:null,dirty:!1,setFBO:null},Wr=["rgba"],Zr=["rgba4","rgb565","rgb5 a1"];tt.ext_srgb&&Zr.push("srgba"),tt.ext_color_buffer_half_float&&Zr.push("rgba16f","rgb16f"),tt.webgl_color_buffer_float&&Zr.push("rgba32f");var Hr=["uint8"];tt.oes_texture_half_float&&Hr.push("half float","float16"),tt.oes_texture_float&&Hr.push("float","float32");function zr(Kt,qt,Qt){this.target=Kt,this.texture=qt,this.renderbuffer=Qt;var Xr=0,Yr=0;qt?(Xr=qt.width,Yr=qt.height):Qt&&(Xr=Qt.width,Yr=Qt.height),this.width=Xr,this.height=Yr}function qr(Kt){Kt&&(Kt.texture&&Kt.texture._texture.decRef(),Kt.renderbuffer&&Kt.renderbuffer._renderbuffer.decRef())}function u(Kt,qt,Qt){if(!!Kt)if(Kt.texture){var Xr=Kt.texture._texture,Yr=Math.max(1,Xr.width),Kr=Math.max(1,Xr.height);le(Yr===qt&&Kr===Qt,"inconsistent width/height for supplied texture"),Xr.refCount+=1}else{var Cn=Kt.renderbuffer._renderbuffer;le(Cn.width===qt&&Cn.height===Qt,"inconsistent width/height for renderbuffer"),Cn.refCount+=1}}function P(Kt,qt){qt&&(qt.texture?ge.framebufferTexture2D(Da,Kt,qt.target,qt.texture._texture.texture,0):ge.framebufferRenderbuffer(Da,Kt,Lf,qt.renderbuffer._renderbuffer.renderbuffer))}function W(Kt){var qt=Iu,Qt=null,Xr=null,Yr=Kt;typeof Kt=="object"&&(Yr=Kt.data,"target"in Kt&&(qt=Kt.target|0)),le.type(Yr,"function","invalid attachment data");var Kr=Yr._reglType;return Kr==="texture2d"?(Qt=Yr,le(qt===Iu)):Kr==="textureCube"?(Qt=Yr,le(qt>=Rf&&qt<Rf+6,"invalid cube map target")):Kr==="renderbuffer"?(Xr=Yr,qt=Lf):le.raise("invalid regl object for attachment"),new zr(qt,Qt,Xr)}function $(Kt,qt,Qt,Xr,Yr){if(Qt){var Kr=gr.create2D({width:Kt,height:qt,format:Xr,type:Yr});return Kr._texture.refCount=0,new zr(Iu,Kr,null)}else{var Cn=Nr.create({width:Kt,height:qt,format:Xr});return Cn._renderbuffer.refCount=0,new zr(Lf,null,Cn)}}function oe(Kt){return Kt&&(Kt.texture||Kt.renderbuffer)}function ue(Kt,qt,Qt){Kt&&(Kt.texture?Kt.texture.resize(qt,Qt):Kt.renderbuffer&&Kt.renderbuffer.resize(qt,Qt),Kt.width=qt,Kt.height=Qt)}var pe=0,_e={};function Te(){this.id=pe++,_e[this.id]=this,this.framebuffer=ge.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function Re(Kt){Kt.colorAttachments.forEach(qr),qr(Kt.depthAttachment),qr(Kt.stencilAttachment),qr(Kt.depthStencilAttachment)}function Ze(Kt){var qt=Kt.framebuffer;le(qt,"must not double destroy framebuffer"),ge.deleteFramebuffer(qt),Kt.framebuffer=null,pr.framebufferCount--,delete _e[Kt.id]}function je(Kt){var qt;ge.bindFramebuffer(Da,Kt.framebuffer);var Qt=Kt.colorAttachments;for(qt=0;qt<Qt.length;++qt)P(kf+qt,Qt[qt]);for(qt=Qt.length;qt<Et.maxColorAttachments;++qt)ge.framebufferTexture2D(Da,kf+qt,Iu,null,0);ge.framebufferTexture2D(Da,Bf,Iu,null,0),ge.framebufferTexture2D(Da,nd,Iu,null,0),ge.framebufferTexture2D(Da,Ws,Iu,null,0),P(nd,Kt.depthAttachment),P(Ws,Kt.stencilAttachment),P(Bf,Kt.depthStencilAttachment);var Xr=ge.checkFramebufferStatus(Da);!ge.isContextLost()&&Xr!==Uo&&le.raise("framebuffer configuration not supported, status = "+us[Xr]),ge.bindFramebuffer(Da,_r.next?_r.next.framebuffer:null),_r.cur=_r.next,ge.getError()}function ht(Kt,qt){var Qt=new Te;pr.framebufferCount++;function Xr(Kr,Cn){var Sn;le(_r.next!==Qt,"can not update framebuffer which is currently in use");var Rn=0,jn=0,kn=!0,Bi=!0,Xn=null,qi=!0,Oi="rgba",Kn="uint8",Zi=1,Ki=null,ri=null,za=null,pa=!1;if(typeof Kr=="number")Rn=Kr|0,jn=Cn|0||Rn;else if(!Kr)Rn=jn=1;else{le.type(Kr,"object","invalid arguments for framebuffer");var Jn=Kr;if("shape"in Jn){var Ga=Jn.shape;le(Array.isArray(Ga)&&Ga.length>=2,"invalid shape for framebuffer"),Rn=Ga[0],jn=Ga[1]}else"radius"in Jn&&(Rn=jn=Jn.radius),"width"in Jn&&(Rn=Jn.width),"height"in Jn&&(jn=Jn.height);("color"in Jn||"colors"in Jn)&&(Xn=Jn.color||Jn.colors,Array.isArray(Xn)&&le(Xn.length===1||tt.webgl_draw_buffers,"multiple render targets not supported")),Xn||("colorCount"in Jn&&(Zi=Jn.colorCount|0,le(Zi>0,"invalid color buffer count")),"colorTexture"in Jn&&(qi=!!Jn.colorTexture,Oi="rgba4"),"colorType"in Jn&&(Kn=Jn.colorType,qi?(le(tt.oes_texture_float||!(Kn==="float"||Kn==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),le(tt.oes_texture_half_float||!(Kn==="half float"||Kn==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Kn==="half float"||Kn==="float16"?(le(tt.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),Oi="rgba16f"):(Kn==="float"||Kn==="float32")&&(le(tt.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),Oi="rgba32f"),le.oneOf(Kn,Hr,"invalid color type")),"colorFormat"in Jn&&(Oi=Jn.colorFormat,Wr.indexOf(Oi)>=0?qi=!0:Zr.indexOf(Oi)>=0?qi=!1:qi?le.oneOf(Jn.colorFormat,Wr,"invalid color format for texture"):le.oneOf(Jn.colorFormat,Zr,"invalid color format for renderbuffer"))),("depthTexture"in Jn||"depthStencilTexture"in Jn)&&(pa=!!(Jn.depthTexture||Jn.depthStencilTexture),le(!pa||tt.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in Jn&&(typeof Jn.depth=="boolean"?kn=Jn.depth:(Ki=Jn.depth,Bi=!1)),"stencil"in Jn&&(typeof Jn.stencil=="boolean"?Bi=Jn.stencil:(ri=Jn.stencil,kn=!1)),"depthStencil"in Jn&&(typeof Jn.depthStencil=="boolean"?kn=Bi=Jn.depthStencil:(za=Jn.depthStencil,kn=!1,Bi=!1))}var Mi=null,Bn=null,hi=null,yi=null;if(Array.isArray(Xn))Mi=Xn.map(W);else if(Xn)Mi=[W(Xn)];else for(Mi=new Array(Zi),Sn=0;Sn<Zi;++Sn)Mi[Sn]=$(Rn,jn,qi,Oi,Kn);le(tt.webgl_draw_buffers||Mi.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),le(Mi.length<=Et.maxColorAttachments,"too many color attachments, not supported"),Rn=Rn||Mi[0].width,jn=jn||Mi[0].height,Ki?Bn=W(Ki):kn&&!Bi&&(Bn=$(Rn,jn,pa,"depth","uint32")),ri?hi=W(ri):Bi&&!kn&&(hi=$(Rn,jn,!1,"stencil","uint8")),za?yi=W(za):!Ki&&!ri&&Bi&&kn&&(yi=$(Rn,jn,pa,"depth stencil","depth stencil")),le(!!Ki+!!ri+!!za<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var aa=null;for(Sn=0;Sn<Mi.length;++Sn)if(u(Mi[Sn],Rn,jn),le(!Mi[Sn]||Mi[Sn].texture&&Gf.indexOf(Mi[Sn].texture._texture.format)>=0||Mi[Sn].renderbuffer&&Uf.indexOf(Mi[Sn].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+Sn+" is invalid"),Mi[Sn]&&Mi[Sn].texture){var qs=Ou[Mi[Sn].texture._texture.format]*js[Mi[Sn].texture._texture.type];aa===null?aa=qs:le(aa===qs,"all color attachments much have the same number of bits per pixel.")}return u(Bn,Rn,jn),le(!Bn||Bn.texture&&Bn.texture._texture.format===Ts||Bn.renderbuffer&&Bn.renderbuffer._renderbuffer.format===Wo,"invalid depth attachment for framebuffer object"),u(hi,Rn,jn),le(!hi||hi.renderbuffer&&hi.renderbuffer._renderbuffer.format===ss,"invalid stencil attachment for framebuffer object"),u(yi,Rn,jn),le(!yi||yi.texture&&yi.texture._texture.format===Yc||yi.renderbuffer&&yi.renderbuffer._renderbuffer.format===Yc,"invalid depth-stencil attachment for framebuffer object"),Re(Qt),Qt.width=Rn,Qt.height=jn,Qt.colorAttachments=Mi,Qt.depthAttachment=Bn,Qt.stencilAttachment=hi,Qt.depthStencilAttachment=yi,Xr.color=Mi.map(oe),Xr.depth=oe(Bn),Xr.stencil=oe(hi),Xr.depthStencil=oe(yi),Xr.width=Qt.width,Xr.height=Qt.height,je(Qt),Xr}function Yr(Kr,Cn){le(_r.next!==Qt,"can not resize a framebuffer which is currently in use");var Sn=Math.max(Kr|0,1),Rn=Math.max(Cn|0||Sn,1);if(Sn===Qt.width&&Rn===Qt.height)return Xr;for(var jn=Qt.colorAttachments,kn=0;kn<jn.length;++kn)ue(jn[kn],Sn,Rn);return ue(Qt.depthAttachment,Sn,Rn),ue(Qt.stencilAttachment,Sn,Rn),ue(Qt.depthStencilAttachment,Sn,Rn),Qt.width=Xr.width=Sn,Qt.height=Xr.height=Rn,je(Qt),Xr}return Xr(Kt,qt),M(Xr,{resize:Yr,_reglType:"framebuffer",_framebuffer:Qt,destroy:function(){Ze(Qt),Re(Qt)},use:function(Kr){_r.setFBO({framebuffer:Xr},Kr)}})}function zt(Kt){var qt=Array(6);function Qt(Yr){var Kr;le(qt.indexOf(_r.next)<0,"can not update framebuffer which is currently in use");var Cn={color:null},Sn=0,Rn=null,jn="rgba",kn="uint8",Bi=1;if(typeof Yr=="number")Sn=Yr|0;else if(!Yr)Sn=1;else{le.type(Yr,"object","invalid arguments for framebuffer");var Xn=Yr;if("shape"in Xn){var qi=Xn.shape;le(Array.isArray(qi)&&qi.length>=2,"invalid shape for framebuffer"),le(qi[0]===qi[1],"cube framebuffer must be square"),Sn=qi[0]}else"radius"in Xn&&(Sn=Xn.radius|0),"width"in Xn?(Sn=Xn.width|0,"height"in Xn&&le(Xn.height===Sn,"must be square")):"height"in Xn&&(Sn=Xn.height|0);("color"in Xn||"colors"in Xn)&&(Rn=Xn.color||Xn.colors,Array.isArray(Rn)&&le(Rn.length===1||tt.webgl_draw_buffers,"multiple render targets not supported")),Rn||("colorCount"in Xn&&(Bi=Xn.colorCount|0,le(Bi>0,"invalid color buffer count")),"colorType"in Xn&&(le.oneOf(Xn.colorType,Hr,"invalid color type"),kn=Xn.colorType),"colorFormat"in Xn&&(jn=Xn.colorFormat,le.oneOf(Xn.colorFormat,Wr,"invalid color format for texture"))),"depth"in Xn&&(Cn.depth=Xn.depth),"stencil"in Xn&&(Cn.stencil=Xn.stencil),"depthStencil"in Xn&&(Cn.depthStencil=Xn.depthStencil)}var Oi;if(Rn)if(Array.isArray(Rn))for(Oi=[],Kr=0;Kr<Rn.length;++Kr)Oi[Kr]=Rn[Kr];else Oi=[Rn];else{Oi=Array(Bi);var Kn={radius:Sn,format:jn,type:kn};for(Kr=0;Kr<Bi;++Kr)Oi[Kr]=gr.createCube(Kn)}for(Cn.color=Array(Oi.length),Kr=0;Kr<Oi.length;++Kr){var Zi=Oi[Kr];le(typeof Zi=="function"&&Zi._reglType==="textureCube","invalid cube map"),Sn=Sn||Zi.width,le(Zi.width===Sn&&Zi.height===Sn,"invalid cube map shape"),Cn.color[Kr]={target:Rf,data:Oi[Kr]}}for(Kr=0;Kr<6;++Kr){for(var Ki=0;Ki<Oi.length;++Ki)Cn.color[Ki].target=Rf+Kr;Kr>0&&(Cn.depth=qt[0].depth,Cn.stencil=qt[0].stencil,Cn.depthStencil=qt[0].depthStencil),qt[Kr]?qt[Kr](Cn):qt[Kr]=ht(Cn)}return M(Qt,{width:Sn,height:Sn,color:Oi})}function Xr(Yr){var Kr,Cn=Yr|0;if(le(Cn>0&&Cn<=Et.maxCubeMapSize,"invalid radius for cube fbo"),Cn===Qt.width)return Qt;var Sn=Qt.color;for(Kr=0;Kr<Sn.length;++Kr)Sn[Kr].resize(Cn);for(Kr=0;Kr<6;++Kr)qt[Kr].resize(Cn);return Qt.width=Qt.height=Cn,Qt}return Qt(Kt),M(Qt,{faces:qt,resize:Xr,_reglType:"framebufferCube",destroy:function(){qt.forEach(function(Yr){Yr.destroy()})}})}function wr(){_r.cur=null,_r.next=null,_r.dirty=!0,vi(_e).forEach(function(Kt){Kt.framebuffer=ge.createFramebuffer(),je(Kt)})}return M(_r,{getFramebuffer:function(Kt){if(typeof Kt=="function"&&Kt._reglType==="framebuffer"){var qt=Kt._framebuffer;if(qt instanceof Te)return qt}return null},create:ht,createCube:zt,clear:function(){vi(_e).forEach(Ze)},restore:wr})}var cs=5126,on=34962;function jo(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=cs,this.offset=0,this.stride=0,this.divisor=0}function id(ge,tt,Et,gr,Nr){for(var pr=Et.maxAttributes,_r=new Array(pr),Wr=0;Wr<pr;++Wr)_r[Wr]=new jo;var Zr=0,Hr={},zr={Record:jo,scope:{},state:_r,currentVAO:null,targetVAO:null,restore:u()?_e:function(){},createVAO:Te,getVAO:W,destroyBuffer:qr,setVAO:u()?$:oe,clear:u()?ue:function(){}};function qr(Re){for(var Ze=0;Ze<_r.length;++Ze){var je=_r[Ze];je.buffer===Re&&(ge.disableVertexAttribArray(Ze),je.buffer=null)}}function u(){return tt.oes_vertex_array_object}function P(){return tt.angle_instanced_arrays}function W(Re){return typeof Re=="function"&&Re._vao?Re._vao:null}function $(Re){if(Re!==zr.currentVAO){var Ze=u();Re?Ze.bindVertexArrayOES(Re.vao):Ze.bindVertexArrayOES(null),zr.currentVAO=Re}}function oe(Re){if(Re!==zr.currentVAO){if(Re)Re.bindAttrs();else for(var Ze=P(),je=0;je<_r.length;++je){var ht=_r[je];ht.buffer?(ge.enableVertexAttribArray(je),ge.vertexAttribPointer(je,ht.size,ht.type,ht.normalized,ht.stride,ht.offfset),Ze&&ht.divisor&&Ze.vertexAttribDivisorANGLE(je,ht.divisor)):(ge.disableVertexAttribArray(je),ge.vertexAttrib4f(je,ht.x,ht.y,ht.z,ht.w))}zr.currentVAO=Re}}function ue(){vi(Hr).forEach(function(Re){Re.destroy()})}function pe(){this.id=++Zr,this.attributes=[];var Re=u();Re?this.vao=Re.createVertexArrayOES():this.vao=null,Hr[this.id]=this,this.buffers=[]}pe.prototype.bindAttrs=function(){for(var Re=P(),Ze=this.attributes,je=0;je<Ze.length;++je){var ht=Ze[je];ht.buffer?(ge.enableVertexAttribArray(je),ge.bindBuffer(on,ht.buffer.buffer),ge.vertexAttribPointer(je,ht.size,ht.type,ht.normalized,ht.stride,ht.offset),Re&&ht.divisor&&Re.vertexAttribDivisorANGLE(je,ht.divisor)):(ge.disableVertexAttribArray(je),ge.vertexAttrib4f(je,ht.x,ht.y,ht.z,ht.w))}for(var zt=Ze.length;zt<pr;++zt)ge.disableVertexAttribArray(zt)},pe.prototype.refresh=function(){var Re=u();Re&&(Re.bindVertexArrayOES(this.vao),this.bindAttrs(),zr.currentVAO=this)},pe.prototype.destroy=function(){if(this.vao){var Re=u();this===zr.currentVAO&&(zr.currentVAO=null,Re.bindVertexArrayOES(null)),Re.deleteVertexArrayOES(this.vao),this.vao=null}Hr[this.id]&&(delete Hr[this.id],gr.vaoCount-=1)};function _e(){var Re=u();Re&&vi(Hr).forEach(function(Ze){Ze.refresh()})}function Te(Re){var Ze=new pe;gr.vaoCount+=1;function je(ht){le(Array.isArray(ht),"arguments to vertex array constructor must be an array"),le(ht.length<pr,"too many attributes"),le(ht.length>0,"must specify at least one attribute");var zt={},wr=Ze.attributes;wr.length=ht.length;for(var Kt=0;Kt<ht.length;++Kt){var qt=ht[Kt],Qt=wr[Kt]=new jo,Xr=qt.data||qt;if(Array.isArray(Xr)||x(Xr)||Ia(Xr)){var Yr;Ze.buffers[Kt]&&(Yr=Ze.buffers[Kt],x(Xr)&&Yr._buffer.byteLength>=Xr.byteLength?Yr.subdata(Xr):(Yr.destroy(),Ze.buffers[Kt]=null)),Ze.buffers[Kt]||(Yr=Ze.buffers[Kt]=Nr.create(qt,on,!1,!0)),Qt.buffer=Nr.getBuffer(Yr),Qt.size=Qt.buffer.dimension|0,Qt.normalized=!1,Qt.type=Qt.buffer.dtype,Qt.offset=0,Qt.stride=0,Qt.divisor=0,Qt.state=1,zt[Kt]=1}else Nr.getBuffer(qt)?(Qt.buffer=Nr.getBuffer(qt),Qt.size=Qt.buffer.dimension|0,Qt.normalized=!1,Qt.type=Qt.buffer.dtype,Qt.offset=0,Qt.stride=0,Qt.divisor=0,Qt.state=1):Nr.getBuffer(qt.buffer)?(Qt.buffer=Nr.getBuffer(qt.buffer),Qt.size=(+qt.size||Qt.buffer.dimension)|0,Qt.normalized=!!qt.normalized||!1,"type"in qt?(le.parameter(qt.type,Nn,"invalid buffer type"),Qt.type=Nn[qt.type]):Qt.type=Qt.buffer.dtype,Qt.offset=(qt.offset||0)|0,Qt.stride=(qt.stride||0)|0,Qt.divisor=(qt.divisor||0)|0,Qt.state=1,le(Qt.size>=1&&Qt.size<=4,"size must be between 1 and 4"),le(Qt.offset>=0,"invalid offset"),le(Qt.stride>=0&&Qt.stride<=255,"stride must be between 0 and 255"),le(Qt.divisor>=0,"divisor must be positive"),le(!Qt.divisor||!!tt.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in qt?(le(Kt>0,"first attribute must not be a constant"),Qt.x=+qt.x||0,Qt.y=+qt.y||0,Qt.z=+qt.z||0,Qt.w=+qt.w||0,Qt.state=2):le(!1,"invalid attribute spec for location "+Kt)}for(var Kr=0;Kr<Ze.buffers.length;++Kr)!zt[Kr]&&Ze.buffers[Kr]&&(Ze.buffers[Kr].destroy(),Ze.buffers[Kr]=null);return Ze.refresh(),je}return je.destroy=function(){for(var ht=0;ht<Ze.buffers.length;++ht)Ze.buffers[ht]&&Ze.buffers[ht].destroy();Ze.buffers.length=0,Ze.destroy()},je._vao=Ze,je._reglType="vao",je(Re)}return zr}var Zc=35632,ad=35633,Eo=35718,Il=35721;function Pl(ge,tt,Et,gr){var Nr={},pr={};function _r($,oe,ue,pe){this.name=$,this.id=oe,this.location=ue,this.info=pe}function Wr($,oe){for(var ue=0;ue<$.length;++ue)if($[ue].id===oe.id){$[ue].location=oe.location;return}$.push(oe)}function Zr($,oe,ue){var pe=$===Zc?Nr:pr,_e=pe[oe];if(!_e){var Te=tt.str(oe);_e=ge.createShader($),ge.shaderSource(_e,Te),ge.compileShader(_e),le.shaderError(ge,_e,Te,$,ue),pe[oe]=_e}return _e}var Hr={},zr=[],qr=0;function u($,oe){this.id=qr++,this.fragId=$,this.vertId=oe,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,gr.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function P($,oe,ue){var pe,_e,Te=Zr(Zc,$.fragId),Re=Zr(ad,$.vertId),Ze=$.program=ge.createProgram();if(ge.attachShader(Ze,Te),ge.attachShader(Ze,Re),ue)for(pe=0;pe<ue.length;++pe){var je=ue[pe];ge.bindAttribLocation(Ze,je[0],je[1])}ge.linkProgram(Ze),le.linkError(ge,Ze,tt.str($.fragId),tt.str($.vertId),oe);var ht=ge.getProgramParameter(Ze,Eo);gr.profile&&($.stats.uniformsCount=ht);var zt=$.uniforms;for(pe=0;pe<ht;++pe)if(_e=ge.getActiveUniform(Ze,pe),_e)if(_e.size>1)for(var wr=0;wr<_e.size;++wr){var Kt=_e.name.replace("[0]","["+wr+"]");Wr(zt,new _r(Kt,tt.id(Kt),ge.getUniformLocation(Ze,Kt),_e))}else Wr(zt,new _r(_e.name,tt.id(_e.name),ge.getUniformLocation(Ze,_e.name),_e));var qt=ge.getProgramParameter(Ze,Il);gr.profile&&($.stats.attributesCount=qt);var Qt=$.attributes;for(pe=0;pe<qt;++pe)_e=ge.getActiveAttrib(Ze,pe),_e&&Wr(Qt,new _r(_e.name,tt.id(_e.name),ge.getAttribLocation(Ze,_e.name),_e))}gr.profile&&(Et.getMaxUniformsCount=function(){var $=0;return zr.forEach(function(oe){oe.stats.uniformsCount>$&&($=oe.stats.uniformsCount)}),$},Et.getMaxAttributesCount=function(){var $=0;return zr.forEach(function(oe){oe.stats.attributesCount>$&&($=oe.stats.attributesCount)}),$});function W(){Nr={},pr={};for(var $=0;$<zr.length;++$)P(zr[$],null,zr[$].attributes.map(function(oe){return[oe.location,oe.name]}))}return{clear:function(){var $=ge.deleteShader.bind(ge);vi(Nr).forEach($),Nr={},vi(pr).forEach($),pr={},zr.forEach(function(oe){ge.deleteProgram(oe.program)}),zr.length=0,Hr={},Et.shaderCount=0},program:function($,oe,ue,pe){le.command($>=0,"missing vertex shader",ue),le.command(oe>=0,"missing fragment shader",ue);var _e=Hr[oe];_e||(_e=Hr[oe]={});var Te=_e[$];if(Te&&(Te.refCount++,!pe))return Te;var Re=new u(oe,$);return Et.shaderCount++,P(Re,ue,pe),Te||(_e[$]=Re),zr.push(Re),M(Re,{destroy:function(){if(Re.refCount--,Re.refCount<=0){ge.deleteProgram(Re.program);var Ze=zr.indexOf(Re);zr.splice(Ze,1),Et.shaderCount--}_e[Re.vertId].refCount<=0&&(ge.deleteShader(pr[Re.vertId]),delete pr[Re.vertId],delete Hr[Re.fragId][Re.vertId]),Object.keys(Hr[Re.fragId]).length||(ge.deleteShader(Nr[Re.fragId]),delete Nr[Re.fragId],delete Hr[Re.fragId])}})},restore:W,shader:Zr,frag:-1,vert:-1}}var od=6408,Du=5121,Vo=3333,vc=5126;function sd(ge,tt,Et,gr,Nr,pr,_r){function Wr(zr){var qr;tt.next===null?(le(Nr.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),qr=Du):(le(tt.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),qr=tt.next.colorAttachments[0].texture._texture.type,pr.oes_texture_float?(le(qr===Du||qr===vc,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),qr===vc&&le(_r.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):le(qr===Du,"Reading from a framebuffer is only allowed for the type 'uint8'"));var u=0,P=0,W=gr.framebufferWidth,$=gr.framebufferHeight,oe=null;x(zr)?oe=zr:zr&&(le.type(zr,"object","invalid arguments to regl.read()"),u=zr.x|0,P=zr.y|0,le(u>=0&&u<gr.framebufferWidth,"invalid x offset for regl.read"),le(P>=0&&P<gr.framebufferHeight,"invalid y offset for regl.read"),W=(zr.width||gr.framebufferWidth-u)|0,$=(zr.height||gr.framebufferHeight-P)|0,oe=zr.data||null),oe&&(qr===Du?le(oe instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):qr===vc&&le(oe instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),le(W>0&&W+u<=gr.framebufferWidth,"invalid width for read pixels"),le($>0&&$+P<=gr.framebufferHeight,"invalid height for read pixels"),Et();var ue=W*$*4;return oe||(qr===Du?oe=new Uint8Array(ue):qr===vc&&(oe=oe||new Float32Array(ue))),le.isTypedArray(oe,"data buffer for regl.read() must be a typedarray"),le(oe.byteLength>=ue,"data buffer for regl.read() too small"),ge.pixelStorei(Vo,4),ge.readPixels(u,P,W,$,od,qr,oe),oe}function Zr(zr){var qr;return tt.setFBO({framebuffer:zr.framebuffer},function(){qr=Wr(zr)}),qr}function Hr(zr){return!zr||!("framebuffer"in zr)?Wr(zr):Zr(zr)}return Hr}function du(ge){return Array.prototype.slice.call(ge)}function ln(ge){return du(ge).join("")}function ud(){var ge=0,tt=[],Et=[];function gr(qr){for(var u=0;u<Et.length;++u)if(Et[u]===qr)return tt[u];var P="g"+ge++;return tt.push(P),Et.push(qr),P}function Nr(){var qr=[];function u(){qr.push.apply(qr,du(arguments))}var P=[];function W(){var $="v"+ge++;return P.push($),arguments.length>0&&(qr.push($,"="),qr.push.apply(qr,du(arguments)),qr.push(";")),$}return M(u,{def:W,toString:function(){return ln([P.length>0?"var "+P.join(",")+";":"",ln(qr)])}})}function pr(){var qr=Nr(),u=Nr(),P=qr.toString,W=u.toString;function $(oe,ue){u(oe,ue,"=",qr.def(oe,ue),";")}return M(function(){qr.apply(qr,du(arguments))},{def:qr.def,entry:qr,exit:u,save:$,set:function(oe,ue,pe){$(oe,ue),qr(oe,ue,"=",pe,";")},toString:function(){return P()+W()}})}function _r(){var qr=ln(arguments),u=pr(),P=pr(),W=u.toString,$=P.toString;return M(u,{then:function(){return u.apply(u,du(arguments)),this},else:function(){return P.apply(P,du(arguments)),this},toString:function(){var oe=$();return oe&&(oe="else{"+oe+"}"),ln(["if(",qr,"){",W(),"}",oe])}})}var Wr=Nr(),Zr={};function Hr(qr,u){var P=[];function W(){var _e="a"+P.length;return P.push(_e),_e}u=u||0;for(var $=0;$<u;++$)W();var oe=pr(),ue=oe.toString,pe=Zr[qr]=M(oe,{arg:W,toString:function(){return ln(["function(",P.join(),"){",ue(),"}"])}});return pe}function zr(){var qr=['"use strict";',Wr,"return {"];Object.keys(Zr).forEach(function(W){qr.push('"',W,'":',Zr[W].toString(),",")}),qr.push("}");var u=ln(qr).replace(/;/g,`;
  1021. `).replace(/}/g,`}
  1022. `).replace(/{/g,`{
  1023. `),P=Function.apply(null,tt.concat(u));return P.apply(null,Et)}return{global:Wr,link:gr,block:Nr,proc:Hr,scope:pr,cond:_r,compile:zr}}var Nu="xyzw".split(""),fs=5121,ls=1,zf=2,hu=0,Wf=1,Lu=2,Ru=3,pc=4,Ol=5,Dl=6,Nl="dither",jf="blend.enable",Vf="blend.color",Xf="blend.equation",Wi="blend.func",Ll="depth.enable",Yf="depth.func",gc="depth.range",vu="depth.mask",ka="colorMask",Bt="cull.enable",Rl="cull.face",ku="frontFace",Hc="lineWidth",kl="polygonOffset.enable",Zf="polygonOffset.offset",Kc="sample.alpha",Bl="sample.enable",yc="sample.coverage",$c="stencil.enable",Hf="stencil.mask",Qc="stencil.func",ha="stencil.opFront",Bu="stencil.opBack",ia="scissor.enable",Gu="scissor.box",Oo="viewport",As="profile",Vs="framebuffer",Is="vert",Xs="frag",Ps="elements",ai="primitive",uo="count",Os="offset",mc="instances",Fu="vao",Jc="Width",Ys="Height",ti=Vs+Jc,_o=Vs+Ys,pu=Oo+Jc,qc=Oo+Ys,gu="drawingBuffer",ef=gu+Jc,Xo=gu+Ys,Gl=[Wi,Xf,Qc,ha,Bu,yc,Oo,Gu,Zf],yu=34962,Fl=34963,ds=35632,Uu=35633,hs=3553,va=34067,bc=2884,Ds=3042,zu=3024,tf=2960,Yo=2929,Zs=3089,Ba=32823,Ja=32926,co=32928,Ns=5126,Ec=35664,Hs=35665,Wu=35666,Kf=5124,rf=35667,_c=35668,Ks=35669,$f=35670,nf=35671,xc=35672,Di=35673,ju=35674,vs=35675,Vu=35676,Xu=35678,Yi=35680,Ul=4,Sc=1028,mu=1029,Qn=2304,af=2305,fo=32775,cd=32776,zl=519,$s=7680,Wl=0,jl=1,Yu=32774,fd=513,Vl=36160,ld=36064,Ua={"0":0,"1":1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},of=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],bu={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Qs={"0":0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Xl={frag:ds,vert:Uu},Qf={cw:Qn,ccw:af};function sf(ge){return Array.isArray(ge)||x(ge)||Ia(ge)}function Jf(ge){return ge.sort(function(tt,Et){return tt===Oo?-1:Et===Oo?1:tt<Et?-1:1})}function ro(ge,tt,Et,gr){this.thisDep=ge,this.contextDep=tt,this.propDep=Et,this.append=gr}function Js(ge){return ge&&!(ge.thisDep||ge.contextDep||ge.propDep)}function oi(ge){return new ro(!1,!1,!1,ge)}function Ji(ge,tt){var Et=ge.type;if(Et===hu){var gr=ge.data.length;return new ro(!0,gr>=1,gr>=2,tt)}else if(Et===pc){var Nr=ge.data;return new ro(Nr.thisDep,Nr.contextDep,Nr.propDep,tt)}else{if(Et===Ol)return new ro(!1,!1,!1,tt);if(Et===Dl){for(var pr=!1,_r=!1,Wr=!1,Zr=0;Zr<ge.data.length;++Zr){var Hr=ge.data[Zr];if(Hr.type===Wf)Wr=!0;else if(Hr.type===Lu)_r=!0;else if(Hr.type===Ru)pr=!0;else if(Hr.type===hu){pr=!0;var zr=Hr.data;zr>=1&&(_r=!0),zr>=2&&(Wr=!0)}else Hr.type===pc&&(pr=pr||Hr.data.thisDep,_r=_r||Hr.data.contextDep,Wr=Wr||Hr.data.propDep)}return new ro(pr,_r,Wr,tt)}else return new ro(Et===Ru,Et===Lu,Et===Wf,tt)}}var uf=new ro(!1,!1,!1,function(){});function Yl(ge,tt,Et,gr,Nr,pr,_r,Wr,Zr,Hr,zr,qr,u,P,W){var $=Hr.Record,oe={add:32774,subtract:32778,"reverse subtract":32779};Et.ext_blend_minmax&&(oe.min=fo,oe.max=cd);var ue=Et.angle_instanced_arrays,pe=Et.webgl_draw_buffers,_e={dirty:!0,profile:W.profile},Te={},Re=[],Ze={},je={};function ht(ot){return ot.replace(".","_")}function zt(ot,Xe,Gt){var tr=ht(ot);Re.push(ot),Te[tr]=_e[tr]=!!Gt,Ze[tr]=Xe}function wr(ot,Xe,Gt){var tr=ht(ot);Re.push(ot),Array.isArray(Gt)?(_e[tr]=Gt.slice(),Te[tr]=Gt.slice()):_e[tr]=Te[tr]=Gt,je[tr]=Xe}zt(Nl,zu),zt(jf,Ds),wr(Vf,"blendColor",[0,0,0,0]),wr(Xf,"blendEquationSeparate",[Yu,Yu]),wr(Wi,"blendFuncSeparate",[jl,Wl,jl,Wl]),zt(Ll,Yo,!0),wr(Yf,"depthFunc",fd),wr(gc,"depthRange",[0,1]),wr(vu,"depthMask",!0),wr(ka,ka,[!0,!0,!0,!0]),zt(Bt,bc),wr(Rl,"cullFace",mu),wr(ku,ku,af),wr(Hc,Hc,1),zt(kl,Ba),wr(Zf,"polygonOffset",[0,0]),zt(Kc,Ja),zt(Bl,co),wr(yc,"sampleCoverage",[1,!1]),zt($c,tf),wr(Hf,"stencilMask",-1),wr(Qc,"stencilFunc",[zl,0,-1]),wr(ha,"stencilOpSeparate",[Sc,$s,$s,$s]),wr(Bu,"stencilOpSeparate",[mu,$s,$s,$s]),zt(ia,Zs),wr(Gu,"scissor",[0,0,ge.drawingBufferWidth,ge.drawingBufferHeight]),wr(Oo,Oo,[0,0,ge.drawingBufferWidth,ge.drawingBufferHeight]);var Kt={gl:ge,context:u,strings:tt,next:Te,current:_e,draw:qr,elements:pr,buffer:Nr,shader:zr,attributes:Hr.state,vao:Hr,uniforms:Zr,framebuffer:Wr,extensions:Et,timer:P,isBufferArgs:sf},qt={primTypes:Ha,compareFuncs:bu,blendFuncs:Ua,blendEquations:oe,stencilOps:Qs,glTypes:Nn,orientationType:Qf};le.optional(function(){Kt.isArrayLike=Hi}),pe&&(qt.backBuffer=[mu],qt.drawBuffer=gn(gr.maxDrawbuffers,function(ot){return ot===0?[0]:gn(ot,function(Xe){return ld+Xe})}));var Qt=0;function Xr(){var ot=ud(),Xe=ot.link,Gt=ot.global;ot.id=Qt++,ot.batchId="0";var tr=Xe(Kt),or=ot.shared={props:"a0"};Object.keys(Kt).forEach(function(Ot){or[Ot]=Gt.def(tr,".",Ot)}),le.optional(function(){ot.CHECK=Xe(le),ot.commandStr=le.guessCommand(),ot.command=Xe(ot.commandStr),ot.assert=function(Ot,it,Jt){Ot("if(!(",it,"))",this.CHECK,".commandRaise(",Xe(Jt),",",this.command,");")},qt.invalidBlendCombinations=of});var Wt=ot.next={},Ft=ot.current={};Object.keys(je).forEach(function(Ot){Array.isArray(_e[Ot])&&(Wt[Ot]=Gt.def(or.next,".",Ot),Ft[Ot]=Gt.def(or.current,".",Ot))});var Xt=ot.constants={};Object.keys(qt).forEach(function(Ot){Xt[Ot]=Gt.def(JSON.stringify(qt[Ot]))}),ot.invoke=function(Ot,it){switch(it.type){case hu:var Jt=["this",or.context,or.props,ot.batchId];return Ot.def(Xe(it.data),".call(",Jt.slice(0,Math.max(it.data.length+1,4)),")");case Wf:return Ot.def(or.props,it.data);case Lu:return Ot.def(or.context,it.data);case Ru:return Ot.def("this",it.data);case pc:return it.data.append(ot,Ot),it.data.ref;case Ol:return it.data.toString();case Dl:return it.data.map(function(cr){return ot.invoke(Ot,cr)})}},ot.attribCache={};var st={};return ot.scopeAttrib=function(Ot){var it=tt.id(Ot);if(it in st)return st[it];var Jt=Hr.scope[it];Jt||(Jt=Hr.scope[it]=new $);var cr=st[it]=Xe(Jt);return cr},ot}function Yr(ot){var Xe=ot.static,Gt=ot.dynamic,tr;if(As in Xe){var or=!!Xe[As];tr=oi(function(Ft,Xt){return or}),tr.enable=or}else if(As in Gt){var Wt=Gt[As];tr=Ji(Wt,function(Ft,Xt){return Ft.invoke(Xt,Wt)})}return tr}function Kr(ot,Xe){var Gt=ot.static,tr=ot.dynamic;if(Vs in Gt){var or=Gt[Vs];return or?(or=Wr.getFramebuffer(or),le.command(or,"invalid framebuffer object"),oi(function(Ft,Xt){var st=Ft.link(or),Ot=Ft.shared;Xt.set(Ot.framebuffer,".next",st);var it=Ot.context;return Xt.set(it,"."+ti,st+".width"),Xt.set(it,"."+_o,st+".height"),st})):oi(function(Ft,Xt){var st=Ft.shared;Xt.set(st.framebuffer,".next","null");var Ot=st.context;return Xt.set(Ot,"."+ti,Ot+"."+ef),Xt.set(Ot,"."+_o,Ot+"."+Xo),"null"})}else if(Vs in tr){var Wt=tr[Vs];return Ji(Wt,function(Ft,Xt){var st=Ft.invoke(Xt,Wt),Ot=Ft.shared,it=Ot.framebuffer,Jt=Xt.def(it,".getFramebuffer(",st,")");le.optional(function(){Ft.assert(Xt,"!"+st+"||"+Jt,"invalid framebuffer object")}),Xt.set(it,".next",Jt);var cr=Ot.context;return Xt.set(cr,"."+ti,Jt+"?"+Jt+".width:"+cr+"."+ef),Xt.set(cr,"."+_o,Jt+"?"+Jt+".height:"+cr+"."+Xo),Jt})}else return null}function Cn(ot,Xe,Gt){var tr=ot.static,or=ot.dynamic;function Wt(st){if(st in tr){var Ot=tr[st];le.commandType(Ot,"object","invalid "+st,Gt.commandStr);var it=!0,Jt=Ot.x|0,cr=Ot.y|0,Lr,Br;return"width"in Ot?(Lr=Ot.width|0,le.command(Lr>=0,"invalid "+st,Gt.commandStr)):it=!1,"height"in Ot?(Br=Ot.height|0,le.command(Br>=0,"invalid "+st,Gt.commandStr)):it=!1,new ro(!it&&Xe&&Xe.thisDep,!it&&Xe&&Xe.contextDep,!it&&Xe&&Xe.propDep,function(Pn,qn){var En=Pn.shared.context,Fn=Lr;"width"in Ot||(Fn=qn.def(En,".",ti,"-",Jt));var Yn=Br;return"height"in Ot||(Yn=qn.def(En,".",_o,"-",cr)),[Jt,cr,Fn,Yn]})}else if(st in or){var Tr=or[st],$r=Ji(Tr,function(Pn,qn){var En=Pn.invoke(qn,Tr);le.optional(function(){Pn.assert(qn,En+"&&typeof "+En+'==="object"',"invalid "+st)});var Fn=Pn.shared.context,Yn=qn.def(En,".x|0"),_i=qn.def(En,".y|0"),ra=qn.def('"width" in ',En,"?",En,".width|0:","(",Fn,".",ti,"-",Yn,")"),lo=qn.def('"height" in ',En,"?",En,".height|0:","(",Fn,".",_o,"-",_i,")");return le.optional(function(){Pn.assert(qn,ra+">=0&&"+lo+">=0","invalid "+st)}),[Yn,_i,ra,lo]});return Xe&&($r.thisDep=$r.thisDep||Xe.thisDep,$r.contextDep=$r.contextDep||Xe.contextDep,$r.propDep=$r.propDep||Xe.propDep),$r}else return Xe?new ro(Xe.thisDep,Xe.contextDep,Xe.propDep,function(Pn,qn){var En=Pn.shared.context;return[0,0,qn.def(En,".",ti),qn.def(En,".",_o)]}):null}var Ft=Wt(Oo);if(Ft){var Xt=Ft;Ft=new ro(Ft.thisDep,Ft.contextDep,Ft.propDep,function(st,Ot){var it=Xt.append(st,Ot),Jt=st.shared.context;return Ot.set(Jt,"."+pu,it[2]),Ot.set(Jt,"."+qc,it[3]),it})}return{viewport:Ft,scissor_box:Wt(Gu)}}function Sn(ot,Xe){var Gt=ot.static,tr=typeof Gt[Xs]=="string"&&typeof Gt[Is]=="string";if(tr){if(Object.keys(Xe.dynamic).length>0)return null;var or=Xe.static,Wt=Object.keys(or);if(Wt.length>0&&typeof or[Wt[0]]=="number"){for(var Ft=[],Xt=0;Xt<Wt.length;++Xt)le(typeof or[Wt[Xt]]=="number","must specify all vertex attribute locations when using vaos"),Ft.push([or[Wt[Xt]]|0,Wt[Xt]]);return Ft}}return null}function Rn(ot,Xe,Gt){var tr=ot.static,or=ot.dynamic;function Wt(it){if(it in tr){var Jt=tt.id(tr[it]);le.optional(function(){zr.shader(Xl[it],Jt,le.guessCommand())});var cr=oi(function(){return Jt});return cr.id=Jt,cr}else if(it in or){var Lr=or[it];return Ji(Lr,function(Br,Tr){var $r=Br.invoke(Tr,Lr),Pn=Tr.def(Br.shared.strings,".id(",$r,")");return le.optional(function(){Tr(Br.shared.shader,".shader(",Xl[it],",",Pn,",",Br.command,");")}),Pn})}return null}var Ft=Wt(Xs),Xt=Wt(Is),st=null,Ot;return Js(Ft)&&Js(Xt)?(st=zr.program(Xt.id,Ft.id,null,Gt),Ot=oi(function(it,Jt){return it.link(st)})):Ot=new ro(Ft&&Ft.thisDep||Xt&&Xt.thisDep,Ft&&Ft.contextDep||Xt&&Xt.contextDep,Ft&&Ft.propDep||Xt&&Xt.propDep,function(it,Jt){var cr=it.shared.shader,Lr;Ft?Lr=Ft.append(it,Jt):Lr=Jt.def(cr,".",Xs);var Br;Xt?Br=Xt.append(it,Jt):Br=Jt.def(cr,".",Is);var Tr=cr+".program("+Br+","+Lr;return le.optional(function(){Tr+=","+it.command}),Jt.def(Tr+")")}),{frag:Ft,vert:Xt,progVar:Ot,program:st}}function jn(ot,Xe){var Gt=ot.static,tr=ot.dynamic;function or(){if(Ps in Gt){var it=Gt[Ps];sf(it)?it=pr.getElements(pr.create(it,!0)):it&&(it=pr.getElements(it),le.command(it,"invalid elements",Xe.commandStr));var Jt=oi(function(Lr,Br){if(it){var Tr=Lr.link(it);return Lr.ELEMENTS=Tr,Tr}return Lr.ELEMENTS=null,null});return Jt.value=it,Jt}else if(Ps in tr){var cr=tr[Ps];return Ji(cr,function(Lr,Br){var Tr=Lr.shared,$r=Tr.isBufferArgs,Pn=Tr.elements,qn=Lr.invoke(Br,cr),En=Br.def("null"),Fn=Br.def($r,"(",qn,")"),Yn=Lr.cond(Fn).then(En,"=",Pn,".createStream(",qn,");").else(En,"=",Pn,".getElements(",qn,");");return le.optional(function(){Lr.assert(Yn.else,"!"+qn+"||"+En,"invalid elements")}),Br.entry(Yn),Br.exit(Lr.cond(Fn).then(Pn,".destroyStream(",En,");")),Lr.ELEMENTS=En,En})}return null}var Wt=or();function Ft(){if(ai in Gt){var it=Gt[ai];return le.commandParameter(it,Ha,"invalid primitve",Xe.commandStr),oi(function(cr,Lr){return Ha[it]})}else if(ai in tr){var Jt=tr[ai];return Ji(Jt,function(cr,Lr){var Br=cr.constants.primTypes,Tr=cr.invoke(Lr,Jt);return le.optional(function(){cr.assert(Lr,Tr+" in "+Br,"invalid primitive, must be one of "+Object.keys(Ha))}),Lr.def(Br,"[",Tr,"]")})}else if(Wt)return Js(Wt)?Wt.value?oi(function(cr,Lr){return Lr.def(cr.ELEMENTS,".primType")}):oi(function(){return Ul}):new ro(Wt.thisDep,Wt.contextDep,Wt.propDep,function(cr,Lr){var Br=cr.ELEMENTS;return Lr.def(Br,"?",Br,".primType:",Ul)});return null}function Xt(it,Jt){if(it in Gt){var cr=Gt[it]|0;return le.command(!Jt||cr>=0,"invalid "+it,Xe.commandStr),oi(function(Br,Tr){return Jt&&(Br.OFFSET=cr),cr})}else if(it in tr){var Lr=tr[it];return Ji(Lr,function(Br,Tr){var $r=Br.invoke(Tr,Lr);return Jt&&(Br.OFFSET=$r,le.optional(function(){Br.assert(Tr,$r+">=0","invalid "+it)})),$r})}else if(Jt&&Wt)return oi(function(Br,Tr){return Br.OFFSET="0",0});return null}var st=Xt(Os,!0);function Ot(){if(uo in Gt){var it=Gt[uo]|0;return le.command(typeof it=="number"&&it>=0,"invalid vertex count",Xe.commandStr),oi(function(){return it})}else if(uo in tr){var Jt=tr[uo];return Ji(Jt,function(Br,Tr){var $r=Br.invoke(Tr,Jt);return le.optional(function(){Br.assert(Tr,"typeof "+$r+'==="number"&&'+$r+">=0&&"+$r+"===("+$r+"|0)","invalid vertex count")}),$r})}else if(Wt)if(Js(Wt)){if(Wt)return st?new ro(st.thisDep,st.contextDep,st.propDep,function(Br,Tr){var $r=Tr.def(Br.ELEMENTS,".vertCount-",Br.OFFSET);return le.optional(function(){Br.assert(Tr,$r+">=0","invalid vertex offset/element buffer too small")}),$r}):oi(function(Br,Tr){return Tr.def(Br.ELEMENTS,".vertCount")});var cr=oi(function(){return-1});return le.optional(function(){cr.MISSING=!0}),cr}else{var Lr=new ro(Wt.thisDep||st.thisDep,Wt.contextDep||st.contextDep,Wt.propDep||st.propDep,function(Br,Tr){var $r=Br.ELEMENTS;return Br.OFFSET?Tr.def($r,"?",$r,".vertCount-",Br.OFFSET,":-1"):Tr.def($r,"?",$r,".vertCount:-1")});return le.optional(function(){Lr.DYNAMIC=!0}),Lr}return null}return{elements:Wt,primitive:Ft(),count:Ot(),instances:Xt(mc,!1),offset:st}}function kn(ot,Xe){var Gt=ot.static,tr=ot.dynamic,or={};return Re.forEach(function(Wt){var Ft=ht(Wt);function Xt(st,Ot){if(Wt in Gt){var it=st(Gt[Wt]);or[Ft]=oi(function(){return it})}else if(Wt in tr){var Jt=tr[Wt];or[Ft]=Ji(Jt,function(cr,Lr){return Ot(cr,Lr,cr.invoke(Lr,Jt))})}}switch(Wt){case Bt:case jf:case Nl:case $c:case Ll:case ia:case kl:case Kc:case Bl:case vu:return Xt(function(st){return le.commandType(st,"boolean",Wt,Xe.commandStr),st},function(st,Ot,it){return le.optional(function(){st.assert(Ot,"typeof "+it+'==="boolean"',"invalid flag "+Wt,st.commandStr)}),it});case Yf:return Xt(function(st){return le.commandParameter(st,bu,"invalid "+Wt,Xe.commandStr),bu[st]},function(st,Ot,it){var Jt=st.constants.compareFuncs;return le.optional(function(){st.assert(Ot,it+" in "+Jt,"invalid "+Wt+", must be one of "+Object.keys(bu))}),Ot.def(Jt,"[",it,"]")});case gc:return Xt(function(st){return le.command(Hi(st)&&st.length===2&&typeof st[0]=="number"&&typeof st[1]=="number"&&st[0]<=st[1],"depth range is 2d array",Xe.commandStr),st},function(st,Ot,it){le.optional(function(){st.assert(Ot,st.shared.isArrayLike+"("+it+")&&"+it+".length===2&&typeof "+it+'[0]==="number"&&typeof '+it+'[1]==="number"&&'+it+"[0]<="+it+"[1]","depth range must be a 2d array")});var Jt=Ot.def("+",it,"[0]"),cr=Ot.def("+",it,"[1]");return[Jt,cr]});case Wi:return Xt(function(st){le.commandType(st,"object","blend.func",Xe.commandStr);var Ot="srcRGB"in st?st.srcRGB:st.src,it="srcAlpha"in st?st.srcAlpha:st.src,Jt="dstRGB"in st?st.dstRGB:st.dst,cr="dstAlpha"in st?st.dstAlpha:st.dst;return le.commandParameter(Ot,Ua,Ft+".srcRGB",Xe.commandStr),le.commandParameter(it,Ua,Ft+".srcAlpha",Xe.commandStr),le.commandParameter(Jt,Ua,Ft+".dstRGB",Xe.commandStr),le.commandParameter(cr,Ua,Ft+".dstAlpha",Xe.commandStr),le.command(of.indexOf(Ot+", "+Jt)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+Ot+", "+Jt+")",Xe.commandStr),[Ua[Ot],Ua[Jt],Ua[it],Ua[cr]]},function(st,Ot,it){var Jt=st.constants.blendFuncs;le.optional(function(){st.assert(Ot,it+"&&typeof "+it+'==="object"',"invalid blend func, must be an object")});function cr(En,Fn){var Yn=Ot.def('"',En,Fn,'" in ',it,"?",it,".",En,Fn,":",it,".",En);return le.optional(function(){st.assert(Ot,Yn+" in "+Jt,"invalid "+Wt+"."+En+Fn+", must be one of "+Object.keys(Ua))}),Yn}var Lr=cr("src","RGB"),Br=cr("dst","RGB");le.optional(function(){var En=st.constants.invalidBlendCombinations;st.assert(Ot,En+".indexOf("+Lr+'+", "+'+Br+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var Tr=Ot.def(Jt,"[",Lr,"]"),$r=Ot.def(Jt,"[",cr("src","Alpha"),"]"),Pn=Ot.def(Jt,"[",Br,"]"),qn=Ot.def(Jt,"[",cr("dst","Alpha"),"]");return[Tr,Pn,$r,qn]});case Xf:return Xt(function(st){if(typeof st=="string")return le.commandParameter(st,oe,"invalid "+Wt,Xe.commandStr),[oe[st],oe[st]];if(typeof st=="object")return le.commandParameter(st.rgb,oe,Wt+".rgb",Xe.commandStr),le.commandParameter(st.alpha,oe,Wt+".alpha",Xe.commandStr),[oe[st.rgb],oe[st.alpha]];le.commandRaise("invalid blend.equation",Xe.commandStr)},function(st,Ot,it){var Jt=st.constants.blendEquations,cr=Ot.def(),Lr=Ot.def(),Br=st.cond("typeof ",it,'==="string"');return le.optional(function(){function Tr($r,Pn,qn){st.assert($r,qn+" in "+Jt,"invalid "+Pn+", must be one of "+Object.keys(oe))}Tr(Br.then,Wt,it),st.assert(Br.else,it+"&&typeof "+it+'==="object"',"invalid "+Wt),Tr(Br.else,Wt+".rgb",it+".rgb"),Tr(Br.else,Wt+".alpha",it+".alpha")}),Br.then(cr,"=",Lr,"=",Jt,"[",it,"];"),Br.else(cr,"=",Jt,"[",it,".rgb];",Lr,"=",Jt,"[",it,".alpha];"),Ot(Br),[cr,Lr]});case Vf:return Xt(function(st){return le.command(Hi(st)&&st.length===4,"blend.color must be a 4d array",Xe.commandStr),gn(4,function(Ot){return+st[Ot]})},function(st,Ot,it){return le.optional(function(){st.assert(Ot,st.shared.isArrayLike+"("+it+")&&"+it+".length===4","blend.color must be a 4d array")}),gn(4,function(Jt){return Ot.def("+",it,"[",Jt,"]")})});case Hf:return Xt(function(st){return le.commandType(st,"number",Ft,Xe.commandStr),st|0},function(st,Ot,it){return le.optional(function(){st.assert(Ot,"typeof "+it+'==="number"',"invalid stencil.mask")}),Ot.def(it,"|0")});case Qc:return Xt(function(st){le.commandType(st,"object",Ft,Xe.commandStr);var Ot=st.cmp||"keep",it=st.ref||0,Jt="mask"in st?st.mask:-1;return le.commandParameter(Ot,bu,Wt+".cmp",Xe.commandStr),le.commandType(it,"number",Wt+".ref",Xe.commandStr),le.commandType(Jt,"number",Wt+".mask",Xe.commandStr),[bu[Ot],it,Jt]},function(st,Ot,it){var Jt=st.constants.compareFuncs;le.optional(function(){function Tr(){st.assert(Ot,Array.prototype.join.call(arguments,""),"invalid stencil.func")}Tr(it+"&&typeof ",it,'==="object"'),Tr('!("cmp" in ',it,")||(",it,".cmp in ",Jt,")")});var cr=Ot.def('"cmp" in ',it,"?",Jt,"[",it,".cmp]",":",$s),Lr=Ot.def(it,".ref|0"),Br=Ot.def('"mask" in ',it,"?",it,".mask|0:-1");return[cr,Lr,Br]});case ha:case Bu:return Xt(function(st){le.commandType(st,"object",Ft,Xe.commandStr);var Ot=st.fail||"keep",it=st.zfail||"keep",Jt=st.zpass||"keep";return le.commandParameter(Ot,Qs,Wt+".fail",Xe.commandStr),le.commandParameter(it,Qs,Wt+".zfail",Xe.commandStr),le.commandParameter(Jt,Qs,Wt+".zpass",Xe.commandStr),[Wt===Bu?mu:Sc,Qs[Ot],Qs[it],Qs[Jt]]},function(st,Ot,it){var Jt=st.constants.stencilOps;le.optional(function(){st.assert(Ot,it+"&&typeof "+it+'==="object"',"invalid "+Wt)});function cr(Lr){return le.optional(function(){st.assert(Ot,'!("'+Lr+'" in '+it+")||("+it+"."+Lr+" in "+Jt+")","invalid "+Wt+"."+Lr+", must be one of "+Object.keys(Qs))}),Ot.def('"',Lr,'" in ',it,"?",Jt,"[",it,".",Lr,"]:",$s)}return[Wt===Bu?mu:Sc,cr("fail"),cr("zfail"),cr("zpass")]});case Zf:return Xt(function(st){le.commandType(st,"object",Ft,Xe.commandStr);var Ot=st.factor|0,it=st.units|0;return le.commandType(Ot,"number",Ft+".factor",Xe.commandStr),le.commandType(it,"number",Ft+".units",Xe.commandStr),[Ot,it]},function(st,Ot,it){le.optional(function(){st.assert(Ot,it+"&&typeof "+it+'==="object"',"invalid "+Wt)});var Jt=Ot.def(it,".factor|0"),cr=Ot.def(it,".units|0");return[Jt,cr]});case Rl:return Xt(function(st){var Ot=0;return st==="front"?Ot=Sc:st==="back"&&(Ot=mu),le.command(!!Ot,Ft,Xe.commandStr),Ot},function(st,Ot,it){return le.optional(function(){st.assert(Ot,it+'==="front"||'+it+'==="back"',"invalid cull.face")}),Ot.def(it,'==="front"?',Sc,":",mu)});case Hc:return Xt(function(st){return le.command(typeof st=="number"&&st>=gr.lineWidthDims[0]&&st<=gr.lineWidthDims[1],"invalid line width, must be a positive number between "+gr.lineWidthDims[0]+" and "+gr.lineWidthDims[1],Xe.commandStr),st},function(st,Ot,it){return le.optional(function(){st.assert(Ot,"typeof "+it+'==="number"&&'+it+">="+gr.lineWidthDims[0]+"&&"+it+"<="+gr.lineWidthDims[1],"invalid line width")}),it});case ku:return Xt(function(st){return le.commandParameter(st,Qf,Ft,Xe.commandStr),Qf[st]},function(st,Ot,it){return le.optional(function(){st.assert(Ot,it+'==="cw"||'+it+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),Ot.def(it+'==="cw"?'+Qn+":"+af)});case ka:return Xt(function(st){return le.command(Hi(st)&&st.length===4,"color.mask must be length 4 array",Xe.commandStr),st.map(function(Ot){return!!Ot})},function(st,Ot,it){return le.optional(function(){st.assert(Ot,st.shared.isArrayLike+"("+it+")&&"+it+".length===4","invalid color.mask")}),gn(4,function(Jt){return"!!"+it+"["+Jt+"]"})});case yc:return Xt(function(st){le.command(typeof st=="object"&&st,Ft,Xe.commandStr);var Ot="value"in st?st.value:1,it=!!st.invert;return le.command(typeof Ot=="number"&&Ot>=0&&Ot<=1,"sample.coverage.value must be a number between 0 and 1",Xe.commandStr),[Ot,it]},function(st,Ot,it){le.optional(function(){st.assert(Ot,it+"&&typeof "+it+'==="object"',"invalid sample.coverage")});var Jt=Ot.def('"value" in ',it,"?+",it,".value:1"),cr=Ot.def("!!",it,".invert");return[Jt,cr]})}}),or}function Bi(ot,Xe){var Gt=ot.static,tr=ot.dynamic,or={};return Object.keys(Gt).forEach(function(Wt){var Ft=Gt[Wt],Xt;if(typeof Ft=="number"||typeof Ft=="boolean")Xt=oi(function(){return Ft});else if(typeof Ft=="function"){var st=Ft._reglType;st==="texture2d"||st==="textureCube"?Xt=oi(function(Ot){return Ot.link(Ft)}):st==="framebuffer"||st==="framebufferCube"?(le.command(Ft.color.length>0,'missing color attachment for framebuffer sent to uniform "'+Wt+'"',Xe.commandStr),Xt=oi(function(Ot){return Ot.link(Ft.color[0])})):le.commandRaise('invalid data for uniform "'+Wt+'"',Xe.commandStr)}else Hi(Ft)?Xt=oi(function(Ot){var it=Ot.global.def("[",gn(Ft.length,function(Jt){return le.command(typeof Ft[Jt]=="number"||typeof Ft[Jt]=="boolean","invalid uniform "+Wt,Ot.commandStr),Ft[Jt]}),"]");return it}):le.commandRaise('invalid or missing data for uniform "'+Wt+'"',Xe.commandStr);Xt.value=Ft,or[Wt]=Xt}),Object.keys(tr).forEach(function(Wt){var Ft=tr[Wt];or[Wt]=Ji(Ft,function(Xt,st){return Xt.invoke(st,Ft)})}),or}function Xn(ot,Xe){var Gt=ot.static,tr=ot.dynamic,or={};return Object.keys(Gt).forEach(function(Wt){var Ft=Gt[Wt],Xt=tt.id(Wt),st=new $;if(sf(Ft))st.state=ls,st.buffer=Nr.getBuffer(Nr.create(Ft,yu,!1,!0)),st.type=0;else{var Ot=Nr.getBuffer(Ft);if(Ot)st.state=ls,st.buffer=Ot,st.type=0;else if(le.command(typeof Ft=="object"&&Ft,"invalid data for attribute "+Wt,Xe.commandStr),"constant"in Ft){var it=Ft.constant;st.buffer="null",st.state=zf,typeof it=="number"?st.x=it:(le.command(Hi(it)&&it.length>0&&it.length<=4,"invalid constant for attribute "+Wt,Xe.commandStr),Nu.forEach(function(Pn,qn){qn<it.length&&(st[Pn]=it[qn])}))}else{sf(Ft.buffer)?Ot=Nr.getBuffer(Nr.create(Ft.buffer,yu,!1,!0)):Ot=Nr.getBuffer(Ft.buffer),le.command(!!Ot,'missing buffer for attribute "'+Wt+'"',Xe.commandStr);var Jt=Ft.offset|0;le.command(Jt>=0,'invalid offset for attribute "'+Wt+'"',Xe.commandStr);var cr=Ft.stride|0;le.command(cr>=0&&cr<256,'invalid stride for attribute "'+Wt+'", must be integer betweeen [0, 255]',Xe.commandStr);var Lr=Ft.size|0;le.command(!("size"in Ft)||Lr>0&&Lr<=4,'invalid size for attribute "'+Wt+'", must be 1,2,3,4',Xe.commandStr);var Br=!!Ft.normalized,Tr=0;"type"in Ft&&(le.commandParameter(Ft.type,Nn,"invalid type for attribute "+Wt,Xe.commandStr),Tr=Nn[Ft.type]);var $r=Ft.divisor|0;"divisor"in Ft&&(le.command($r===0||ue,'cannot specify divisor for attribute "'+Wt+'", instancing not supported',Xe.commandStr),le.command($r>=0,'invalid divisor for attribute "'+Wt+'"',Xe.commandStr)),le.optional(function(){var Pn=Xe.commandStr,qn=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(Ft).forEach(function(En){le.command(qn.indexOf(En)>=0,'unknown parameter "'+En+'" for attribute pointer "'+Wt+'" (valid parameters are '+qn+")",Pn)})}),st.buffer=Ot,st.state=ls,st.size=Lr,st.normalized=Br,st.type=Tr||Ot.dtype,st.offset=Jt,st.stride=cr,st.divisor=$r}}or[Wt]=oi(function(Pn,qn){var En=Pn.attribCache;if(Xt in En)return En[Xt];var Fn={isStream:!1};return Object.keys(st).forEach(function(Yn){Fn[Yn]=st[Yn]}),st.buffer&&(Fn.buffer=Pn.link(st.buffer),Fn.type=Fn.type||Fn.buffer+".dtype"),En[Xt]=Fn,Fn})}),Object.keys(tr).forEach(function(Wt){var Ft=tr[Wt];function Xt(st,Ot){var it=st.invoke(Ot,Ft),Jt=st.shared,cr=st.constants,Lr=Jt.isBufferArgs,Br=Jt.buffer;le.optional(function(){st.assert(Ot,it+"&&(typeof "+it+'==="object"||typeof '+it+'==="function")&&('+Lr+"("+it+")||"+Br+".getBuffer("+it+")||"+Br+".getBuffer("+it+".buffer)||"+Lr+"("+it+'.buffer)||("constant" in '+it+"&&(typeof "+it+'.constant==="number"||'+Jt.isArrayLike+"("+it+".constant))))",'invalid dynamic attribute "'+Wt+'"')});var Tr={isStream:Ot.def(!1)},$r=new $;$r.state=ls,Object.keys($r).forEach(function(Fn){Tr[Fn]=Ot.def(""+$r[Fn])});var Pn=Tr.buffer,qn=Tr.type;Ot("if(",Lr,"(",it,")){",Tr.isStream,"=true;",Pn,"=",Br,".createStream(",yu,",",it,");",qn,"=",Pn,".dtype;","}else{",Pn,"=",Br,".getBuffer(",it,");","if(",Pn,"){",qn,"=",Pn,".dtype;",'}else if("constant" in ',it,"){",Tr.state,"=",zf,";","if(typeof "+it+'.constant === "number"){',Tr[Nu[0]],"=",it,".constant;",Nu.slice(1).map(function(Fn){return Tr[Fn]}).join("="),"=0;","}else{",Nu.map(function(Fn,Yn){return Tr[Fn]+"="+it+".constant.length>"+Yn+"?"+it+".constant["+Yn+"]:0;"}).join(""),"}}else{","if(",Lr,"(",it,".buffer)){",Pn,"=",Br,".createStream(",yu,",",it,".buffer);","}else{",Pn,"=",Br,".getBuffer(",it,".buffer);","}",qn,'="type" in ',it,"?",cr.glTypes,"[",it,".type]:",Pn,".dtype;",Tr.normalized,"=!!",it,".normalized;");function En(Fn){Ot(Tr[Fn],"=",it,".",Fn,"|0;")}return En("size"),En("offset"),En("stride"),En("divisor"),Ot("}}"),Ot.exit("if(",Tr.isStream,"){",Br,".destroyStream(",Pn,");","}"),Tr}or[Wt]=Ji(Ft,Xt)}),or}function qi(ot,Xe){var Gt=ot.static,tr=ot.dynamic;if(Fu in Gt){var or=Gt[Fu];return or!==null&&Hr.getVAO(or)===null&&(or=Hr.createVAO(or)),oi(function(Ft){return Ft.link(Hr.getVAO(or))})}else if(Fu in tr){var Wt=tr[Fu];return Ji(Wt,function(Ft,Xt){var st=Ft.invoke(Xt,Wt);return Xt.def(Ft.shared.vao+".getVAO("+st+")")})}return null}function Oi(ot){var Xe=ot.static,Gt=ot.dynamic,tr={};return Object.keys(Xe).forEach(function(or){var Wt=Xe[or];tr[or]=oi(function(Ft,Xt){return typeof Wt=="number"||typeof Wt=="boolean"?""+Wt:Ft.link(Wt)})}),Object.keys(Gt).forEach(function(or){var Wt=Gt[or];tr[or]=Ji(Wt,function(Ft,Xt){return Ft.invoke(Xt,Wt)})}),tr}function Kn(ot,Xe,Gt,tr,or){var Wt=ot.static,Ft=ot.dynamic;le.optional(function(){var En=[Vs,Is,Xs,Ps,ai,Os,uo,mc,As,Fu].concat(Re);function Fn(Yn){Object.keys(Yn).forEach(function(_i){le.command(En.indexOf(_i)>=0,'unknown parameter "'+_i+'"',or.commandStr)})}Fn(Wt),Fn(Ft)});var Xt=Sn(ot,Xe),st=Kr(ot,or),Ot=Cn(ot,st,or),it=jn(ot,or),Jt=kn(ot,or),cr=Rn(ot,or,Xt);function Lr(En){var Fn=Ot[En];Fn&&(Jt[En]=Fn)}Lr(Oo),Lr(ht(Gu));var Br=Object.keys(Jt).length>0,Tr={framebuffer:st,draw:it,shader:cr,state:Jt,dirty:Br,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(Tr.profile=Yr(ot,or),Tr.uniforms=Bi(Gt,or),Tr.drawVAO=Tr.scopeVAO=qi(ot,or),!Tr.drawVAO&&cr.program&&!Xt&&Et.angle_instanced_arrays){var $r=!0,Pn=cr.program.attributes.map(function(En){var Fn=Xe.static[En];return $r=$r&&!!Fn,Fn});if($r&&Pn.length>0){var qn=Hr.getVAO(Hr.createVAO(Pn));Tr.drawVAO=new ro(null,null,null,function(En,Fn){return En.link(qn)}),Tr.useVAO=!0}}return Xt?Tr.useVAO=!0:Tr.attributes=Xn(Xe,or),Tr.context=Oi(tr,or),Tr}function Zi(ot,Xe,Gt){var tr=ot.shared,or=tr.context,Wt=ot.scope();Object.keys(Gt).forEach(function(Ft){Xe.save(or,"."+Ft);var Xt=Gt[Ft],st=Xt.append(ot,Xe);Array.isArray(st)?Wt(or,".",Ft,"=[",st.join(),"];"):Wt(or,".",Ft,"=",st,";")}),Xe(Wt)}function Ki(ot,Xe,Gt,tr){var or=ot.shared,Wt=or.gl,Ft=or.framebuffer,Xt;pe&&(Xt=Xe.def(or.extensions,".webgl_draw_buffers"));var st=ot.constants,Ot=st.drawBuffer,it=st.backBuffer,Jt;Gt?Jt=Gt.append(ot,Xe):Jt=Xe.def(Ft,".next"),tr||Xe("if(",Jt,"!==",Ft,".cur){"),Xe("if(",Jt,"){",Wt,".bindFramebuffer(",Vl,",",Jt,".framebuffer);"),pe&&Xe(Xt,".drawBuffersWEBGL(",Ot,"[",Jt,".colorAttachments.length]);"),Xe("}else{",Wt,".bindFramebuffer(",Vl,",null);"),pe&&Xe(Xt,".drawBuffersWEBGL(",it,");"),Xe("}",Ft,".cur=",Jt,";"),tr||Xe("}")}function ri(ot,Xe,Gt){var tr=ot.shared,or=tr.gl,Wt=ot.current,Ft=ot.next,Xt=tr.current,st=tr.next,Ot=ot.cond(Xt,".dirty");Re.forEach(function(it){var Jt=ht(it);if(!(Jt in Gt.state)){var cr,Lr;if(Jt in Ft){cr=Ft[Jt],Lr=Wt[Jt];var Br=gn(_e[Jt].length,function($r){return Ot.def(cr,"[",$r,"]")});Ot(ot.cond(Br.map(function($r,Pn){return $r+"!=="+Lr+"["+Pn+"]"}).join("||")).then(or,".",je[Jt],"(",Br,");",Br.map(function($r,Pn){return Lr+"["+Pn+"]="+$r}).join(";"),";"))}else{cr=Ot.def(st,".",Jt);var Tr=ot.cond(cr,"!==",Xt,".",Jt);Ot(Tr),Jt in Ze?Tr(ot.cond(cr).then(or,".enable(",Ze[Jt],");").else(or,".disable(",Ze[Jt],");"),Xt,".",Jt,"=",cr,";"):Tr(or,".",je[Jt],"(",cr,");",Xt,".",Jt,"=",cr,";")}}}),Object.keys(Gt.state).length===0&&Ot(Xt,".dirty=false;"),Xe(Ot)}function za(ot,Xe,Gt,tr){var or=ot.shared,Wt=ot.current,Ft=or.current,Xt=or.gl;Jf(Object.keys(Gt)).forEach(function(st){var Ot=Gt[st];if(!(tr&&!tr(Ot))){var it=Ot.append(ot,Xe);if(Ze[st]){var Jt=Ze[st];Js(Ot)?it?Xe(Xt,".enable(",Jt,");"):Xe(Xt,".disable(",Jt,");"):Xe(ot.cond(it).then(Xt,".enable(",Jt,");").else(Xt,".disable(",Jt,");")),Xe(Ft,".",st,"=",it,";")}else if(Hi(it)){var cr=Wt[st];Xe(Xt,".",je[st],"(",it,");",it.map(function(Lr,Br){return cr+"["+Br+"]="+Lr}).join(";"),";")}else Xe(Xt,".",je[st],"(",it,");",Ft,".",st,"=",it,";")}})}function pa(ot,Xe){ue&&(ot.instancing=Xe.def(ot.shared.extensions,".angle_instanced_arrays"))}function Jn(ot,Xe,Gt,tr,or){var Wt=ot.shared,Ft=ot.stats,Xt=Wt.current,st=Wt.timer,Ot=Gt.profile;function it(){return typeof performance=="undefined"?"Date.now()":"performance.now()"}var Jt,cr;function Lr(En){Jt=Xe.def(),En(Jt,"=",it(),";"),typeof or=="string"?En(Ft,".count+=",or,";"):En(Ft,".count++;"),P&&(tr?(cr=Xe.def(),En(cr,"=",st,".getNumPendingQueries();")):En(st,".beginQuery(",Ft,");"))}function Br(En){En(Ft,".cpuTime+=",it(),"-",Jt,";"),P&&(tr?En(st,".pushScopeStats(",cr,",",st,".getNumPendingQueries(),",Ft,");"):En(st,".endQuery();"))}function Tr(En){var Fn=Xe.def(Xt,".profile");Xe(Xt,".profile=",En,";"),Xe.exit(Xt,".profile=",Fn,";")}var $r;if(Ot){if(Js(Ot)){Ot.enable?(Lr(Xe),Br(Xe.exit),Tr("true")):Tr("false");return}$r=Ot.append(ot,Xe),Tr($r)}else $r=Xe.def(Xt,".profile");var Pn=ot.block();Lr(Pn),Xe("if(",$r,"){",Pn,"}");var qn=ot.block();Br(qn),Xe.exit("if(",$r,"){",qn,"}")}function Ga(ot,Xe,Gt,tr,or){var Wt=ot.shared;function Ft(st){switch(st){case Ec:case rf:case nf:return 2;case Hs:case _c:case xc:return 3;case Wu:case Ks:case Di:return 4;default:return 1}}function Xt(st,Ot,it){var Jt=Wt.gl,cr=Xe.def(st,".location"),Lr=Xe.def(Wt.attributes,"[",cr,"]"),Br=it.state,Tr=it.buffer,$r=[it.x,it.y,it.z,it.w],Pn=["buffer","normalized","offset","stride"];function qn(){Xe("if(!",Lr,".buffer){",Jt,".enableVertexAttribArray(",cr,");}");var Fn=it.type,Yn;if(it.size?Yn=Xe.def(it.size,"||",Ot):Yn=Ot,Xe("if(",Lr,".type!==",Fn,"||",Lr,".size!==",Yn,"||",Pn.map(function(ra){return Lr+"."+ra+"!=="+it[ra]}).join("||"),"){",Jt,".bindBuffer(",yu,",",Tr,".buffer);",Jt,".vertexAttribPointer(",[cr,Yn,Fn,it.normalized,it.stride,it.offset],");",Lr,".type=",Fn,";",Lr,".size=",Yn,";",Pn.map(function(ra){return Lr+"."+ra+"="+it[ra]+";"}).join(""),"}"),ue){var _i=it.divisor;Xe("if(",Lr,".divisor!==",_i,"){",ot.instancing,".vertexAttribDivisorANGLE(",[cr,_i],");",Lr,".divisor=",_i,";}")}}function En(){Xe("if(",Lr,".buffer){",Jt,".disableVertexAttribArray(",cr,");",Lr,".buffer=null;","}if(",Nu.map(function(Fn,Yn){return Lr+"."+Fn+"!=="+$r[Yn]}).join("||"),"){",Jt,".vertexAttrib4f(",cr,",",$r,");",Nu.map(function(Fn,Yn){return Lr+"."+Fn+"="+$r[Yn]+";"}).join(""),"}")}Br===ls?qn():Br===zf?En():(Xe("if(",Br,"===",ls,"){"),qn(),Xe("}else{"),En(),Xe("}"))}tr.forEach(function(st){var Ot=st.name,it=Gt.attributes[Ot],Jt;if(it){if(!or(it))return;Jt=it.append(ot,Xe)}else{if(!or(uf))return;var cr=ot.scopeAttrib(Ot);le.optional(function(){ot.assert(Xe,cr+".state","missing attribute "+Ot)}),Jt={},Object.keys(new $).forEach(function(Lr){Jt[Lr]=Xe.def(cr,".",Lr)})}Xt(ot.link(st),Ft(st.info.type),Jt)})}function Mi(ot,Xe,Gt,tr,or){for(var Wt=ot.shared,Ft=Wt.gl,Xt,st=0;st<tr.length;++st){var Ot=tr[st],it=Ot.name,Jt=Ot.info.type,cr=Gt.uniforms[it],Lr=ot.link(Ot),Br=Lr+".location",Tr;if(cr){if(!or(cr))continue;if(Js(cr)){var $r=cr.value;if(le.command($r!==null&&typeof $r!="undefined",'missing uniform "'+it+'"',ot.commandStr),Jt===Xu||Jt===Yi){le.command(typeof $r=="function"&&(Jt===Xu&&($r._reglType==="texture2d"||$r._reglType==="framebuffer")||Jt===Yi&&($r._reglType==="textureCube"||$r._reglType==="framebufferCube")),"invalid texture for uniform "+it,ot.commandStr);var Pn=ot.link($r._texture||$r.color[0]._texture);Xe(Ft,".uniform1i(",Br,",",Pn+".bind());"),Xe.exit(Pn,".unbind();")}else if(Jt===ju||Jt===vs||Jt===Vu){le.optional(function(){le.command(Hi($r),"invalid matrix for uniform "+it,ot.commandStr),le.command(Jt===ju&&$r.length===4||Jt===vs&&$r.length===9||Jt===Vu&&$r.length===16,"invalid length for matrix uniform "+it,ot.commandStr)});var qn=ot.global.def("new Float32Array(["+Array.prototype.slice.call($r)+"])"),En=2;Jt===vs?En=3:Jt===Vu&&(En=4),Xe(Ft,".uniformMatrix",En,"fv(",Br,",false,",qn,");")}else{switch(Jt){case Ns:le.commandType($r,"number","uniform "+it,ot.commandStr),Xt="1f";break;case Ec:le.command(Hi($r)&&$r.length===2,"uniform "+it,ot.commandStr),Xt="2f";break;case Hs:le.command(Hi($r)&&$r.length===3,"uniform "+it,ot.commandStr),Xt="3f";break;case Wu:le.command(Hi($r)&&$r.length===4,"uniform "+it,ot.commandStr),Xt="4f";break;case $f:le.commandType($r,"boolean","uniform "+it,ot.commandStr),Xt="1i";break;case Kf:le.commandType($r,"number","uniform "+it,ot.commandStr),Xt="1i";break;case nf:le.command(Hi($r)&&$r.length===2,"uniform "+it,ot.commandStr),Xt="2i";break;case rf:le.command(Hi($r)&&$r.length===2,"uniform "+it,ot.commandStr),Xt="2i";break;case xc:le.command(Hi($r)&&$r.length===3,"uniform "+it,ot.commandStr),Xt="3i";break;case _c:le.command(Hi($r)&&$r.length===3,"uniform "+it,ot.commandStr),Xt="3i";break;case Di:le.command(Hi($r)&&$r.length===4,"uniform "+it,ot.commandStr),Xt="4i";break;case Ks:le.command(Hi($r)&&$r.length===4,"uniform "+it,ot.commandStr),Xt="4i";break}Xe(Ft,".uniform",Xt,"(",Br,",",Hi($r)?Array.prototype.slice.call($r):$r,");")}continue}else Tr=cr.append(ot,Xe)}else{if(!or(uf))continue;Tr=Xe.def(Wt.uniforms,"[",tt.id(it),"]")}Jt===Xu?(le(!Array.isArray(Tr),"must specify a scalar prop for textures"),Xe("if(",Tr,"&&",Tr,'._reglType==="framebuffer"){',Tr,"=",Tr,".color[0];","}")):Jt===Yi&&(le(!Array.isArray(Tr),"must specify a scalar prop for cube maps"),Xe("if(",Tr,"&&",Tr,'._reglType==="framebufferCube"){',Tr,"=",Tr,".color[0];","}")),le.optional(function(){function lo(xo,yd){ot.assert(Xe,xo,'bad data or missing for uniform "'+it+'". '+yd)}function $l(xo){le(!Array.isArray(Tr),"must not specify an array type for uniform"),lo("typeof "+Tr+'==="'+xo+'"',"invalid type, expected "+xo)}function Zo(xo,yd){Array.isArray(Tr)?le(Tr.length===xo,"must have length "+xo):lo(Wt.isArrayLike+"("+Tr+")&&"+Tr+".length==="+xo,"invalid vector, should have length "+xo,ot.commandStr)}function gd(xo){le(!Array.isArray(Tr),"must not specify a value type"),lo("typeof "+Tr+'==="function"&&'+Tr+'._reglType==="texture'+(xo===hs?"2d":"Cube")+'"',"invalid texture type",ot.commandStr)}switch(Jt){case Kf:$l("number");break;case rf:Zo(2,"number");break;case _c:Zo(3,"number");break;case Ks:Zo(4,"number");break;case Ns:$l("number");break;case Ec:Zo(2,"number");break;case Hs:Zo(3,"number");break;case Wu:Zo(4,"number");break;case $f:$l("boolean");break;case nf:Zo(2,"boolean");break;case xc:Zo(3,"boolean");break;case Di:Zo(4,"boolean");break;case ju:Zo(4,"number");break;case vs:Zo(9,"number");break;case Vu:Zo(16,"number");break;case Xu:gd(hs);break;case Yi:gd(va);break}});var Fn=1;switch(Jt){case Xu:case Yi:var Yn=Xe.def(Tr,"._texture");Xe(Ft,".uniform1i(",Br,",",Yn,".bind());"),Xe.exit(Yn,".unbind();");continue;case Kf:case $f:Xt="1i";break;case rf:case nf:Xt="2i",Fn=2;break;case _c:case xc:Xt="3i",Fn=3;break;case Ks:case Di:Xt="4i",Fn=4;break;case Ns:Xt="1f";break;case Ec:Xt="2f",Fn=2;break;case Hs:Xt="3f",Fn=3;break;case Wu:Xt="4f",Fn=4;break;case ju:Xt="Matrix2fv";break;case vs:Xt="Matrix3fv";break;case Vu:Xt="Matrix4fv";break}if(Xe(Ft,".uniform",Xt,"(",Br,","),Xt.charAt(0)==="M"){var _i=Math.pow(Jt-ju+2,2),ra=ot.global.def("new Float32Array(",_i,")");Array.isArray(Tr)?Xe("false,(",gn(_i,function(lo){return ra+"["+lo+"]="+Tr[lo]}),",",ra,")"):Xe("false,(Array.isArray(",Tr,")||",Tr," instanceof Float32Array)?",Tr,":(",gn(_i,function(lo){return ra+"["+lo+"]="+Tr+"["+lo+"]"}),",",ra,")")}else Fn>1?Xe(gn(Fn,function(lo){return Array.isArray(Tr)?Tr[lo]:Tr+"["+lo+"]"})):(le(!Array.isArray(Tr),"uniform value must not be an array"),Xe(Tr));Xe(");")}}function Bn(ot,Xe,Gt,tr){var or=ot.shared,Wt=or.gl,Ft=or.draw,Xt=tr.draw;function st(){var Yn=Xt.elements,_i,ra=Xe;return Yn?((Yn.contextDep&&tr.contextDynamic||Yn.propDep)&&(ra=Gt),_i=Yn.append(ot,ra)):_i=ra.def(Ft,".",Ps),_i&&ra("if("+_i+")"+Wt+".bindBuffer("+Fl+","+_i+".buffer.buffer);"),_i}function Ot(){var Yn=Xt.count,_i,ra=Xe;return Yn?((Yn.contextDep&&tr.contextDynamic||Yn.propDep)&&(ra=Gt),_i=Yn.append(ot,ra),le.optional(function(){Yn.MISSING&&ot.assert(Xe,"false","missing vertex count"),Yn.DYNAMIC&&ot.assert(ra,_i+">=0","missing vertex count")})):(_i=ra.def(Ft,".",uo),le.optional(function(){ot.assert(ra,_i+">=0","missing vertex count")})),_i}var it=st();function Jt(Yn){var _i=Xt[Yn];return _i?_i.contextDep&&tr.contextDynamic||_i.propDep?_i.append(ot,Gt):_i.append(ot,Xe):Xe.def(Ft,".",Yn)}var cr=Jt(ai),Lr=Jt(Os),Br=Ot();if(typeof Br=="number"){if(Br===0)return}else Gt("if(",Br,"){"),Gt.exit("}");var Tr,$r;ue&&(Tr=Jt(mc),$r=ot.instancing);var Pn=it+".type",qn=Xt.elements&&Js(Xt.elements);function En(){function Yn(){Gt($r,".drawElementsInstancedANGLE(",[cr,Br,Pn,Lr+"<<(("+Pn+"-"+fs+")>>1)",Tr],");")}function _i(){Gt($r,".drawArraysInstancedANGLE(",[cr,Lr,Br,Tr],");")}it?qn?Yn():(Gt("if(",it,"){"),Yn(),Gt("}else{"),_i(),Gt("}")):_i()}function Fn(){function Yn(){Gt(Wt+".drawElements("+[cr,Br,Pn,Lr+"<<(("+Pn+"-"+fs+")>>1)"]+");")}function _i(){Gt(Wt+".drawArrays("+[cr,Lr,Br]+");")}it?qn?Yn():(Gt("if(",it,"){"),Yn(),Gt("}else{"),_i(),Gt("}")):_i()}ue&&(typeof Tr!="number"||Tr>=0)?typeof Tr=="string"?(Gt("if(",Tr,">0){"),En(),Gt("}else if(",Tr,"<0){"),Fn(),Gt("}")):En():Fn()}function hi(ot,Xe,Gt,tr,or){var Wt=Xr(),Ft=Wt.proc("body",or);return le.optional(function(){Wt.commandStr=Xe.commandStr,Wt.command=Wt.link(Xe.commandStr)}),ue&&(Wt.instancing=Ft.def(Wt.shared.extensions,".angle_instanced_arrays")),ot(Wt,Ft,Gt,tr),Wt.compile().body}function yi(ot,Xe,Gt,tr){pa(ot,Xe),Gt.useVAO?Gt.drawVAO?Xe(ot.shared.vao,".setVAO(",Gt.drawVAO.append(ot,Xe),");"):Xe(ot.shared.vao,".setVAO(",ot.shared.vao,".targetVAO);"):(Xe(ot.shared.vao,".setVAO(null);"),Ga(ot,Xe,Gt,tr.attributes,function(){return!0})),Mi(ot,Xe,Gt,tr.uniforms,function(){return!0}),Bn(ot,Xe,Xe,Gt)}function aa(ot,Xe){var Gt=ot.proc("draw",1);pa(ot,Gt),Zi(ot,Gt,Xe.context),Ki(ot,Gt,Xe.framebuffer),ri(ot,Gt,Xe),za(ot,Gt,Xe.state),Jn(ot,Gt,Xe,!1,!0);var tr=Xe.shader.progVar.append(ot,Gt);if(Gt(ot.shared.gl,".useProgram(",tr,".program);"),Xe.shader.program)yi(ot,Gt,Xe,Xe.shader.program);else{Gt(ot.shared.vao,".setVAO(null);");var or=ot.global.def("{}"),Wt=Gt.def(tr,".id"),Ft=Gt.def(or,"[",Wt,"]");Gt(ot.cond(Ft).then(Ft,".call(this,a0);").else(Ft,"=",or,"[",Wt,"]=",ot.link(function(Xt){return hi(yi,ot,Xe,Xt,1)}),"(",tr,");",Ft,".call(this,a0);"))}Object.keys(Xe.state).length>0&&Gt(ot.shared.current,".dirty=true;")}function qs(ot,Xe,Gt,tr){ot.batchId="a1",pa(ot,Xe);function or(){return!0}Ga(ot,Xe,Gt,tr.attributes,or),Mi(ot,Xe,Gt,tr.uniforms,or),Bn(ot,Xe,Xe,Gt)}function Tc(ot,Xe,Gt,tr){pa(ot,Xe);var or=Gt.contextDep,Wt=Xe.def(),Ft="a0",Xt="a1",st=Xe.def();ot.shared.props=st,ot.batchId=Wt;var Ot=ot.scope(),it=ot.scope();Xe(Ot.entry,"for(",Wt,"=0;",Wt,"<",Xt,";++",Wt,"){",st,"=",Ft,"[",Wt,"];",it,"}",Ot.exit);function Jt(Pn){return Pn.contextDep&&or||Pn.propDep}function cr(Pn){return!Jt(Pn)}if(Gt.needsContext&&Zi(ot,it,Gt.context),Gt.needsFramebuffer&&Ki(ot,it,Gt.framebuffer),za(ot,it,Gt.state,Jt),Gt.profile&&Jt(Gt.profile)&&Jn(ot,it,Gt,!1,!0),tr)Gt.useVAO?Gt.drawVAO?Jt(Gt.drawVAO)?it(ot.shared.vao,".setVAO(",Gt.drawVAO.append(ot,it),");"):Ot(ot.shared.vao,".setVAO(",Gt.drawVAO.append(ot,Ot),");"):Ot(ot.shared.vao,".setVAO(",ot.shared.vao,".targetVAO);"):(Ot(ot.shared.vao,".setVAO(null);"),Ga(ot,Ot,Gt,tr.attributes,cr),Ga(ot,it,Gt,tr.attributes,Jt)),Mi(ot,Ot,Gt,tr.uniforms,cr),Mi(ot,it,Gt,tr.uniforms,Jt),Bn(ot,Ot,it,Gt);else{var Lr=ot.global.def("{}"),Br=Gt.shader.progVar.append(ot,it),Tr=it.def(Br,".id"),$r=it.def(Lr,"[",Tr,"]");it(ot.shared.gl,".useProgram(",Br,".program);","if(!",$r,"){",$r,"=",Lr,"[",Tr,"]=",ot.link(function(Pn){return hi(qs,ot,Gt,Pn,2)}),"(",Br,");}",$r,".call(this,a0[",Wt,"],",Wt,");")}}function yt(ot,Xe){var Gt=ot.proc("batch",2);ot.batchId="0",pa(ot,Gt);var tr=!1,or=!0;Object.keys(Xe.context).forEach(function(Lr){tr=tr||Xe.context[Lr].propDep}),tr||(Zi(ot,Gt,Xe.context),or=!1);var Wt=Xe.framebuffer,Ft=!1;Wt?(Wt.propDep?tr=Ft=!0:Wt.contextDep&&tr&&(Ft=!0),Ft||Ki(ot,Gt,Wt)):Ki(ot,Gt,null),Xe.state.viewport&&Xe.state.viewport.propDep&&(tr=!0);function Xt(Lr){return Lr.contextDep&&tr||Lr.propDep}ri(ot,Gt,Xe),za(ot,Gt,Xe.state,function(Lr){return!Xt(Lr)}),(!Xe.profile||!Xt(Xe.profile))&&Jn(ot,Gt,Xe,!1,"a1"),Xe.contextDep=tr,Xe.needsContext=or,Xe.needsFramebuffer=Ft;var st=Xe.shader.progVar;if(st.contextDep&&tr||st.propDep)Tc(ot,Gt,Xe,null);else{var Ot=st.append(ot,Gt);if(Gt(ot.shared.gl,".useProgram(",Ot,".program);"),Xe.shader.program)Tc(ot,Gt,Xe,Xe.shader.program);else{Gt(ot.shared.vao,".setVAO(null);");var it=ot.global.def("{}"),Jt=Gt.def(Ot,".id"),cr=Gt.def(it,"[",Jt,"]");Gt(ot.cond(cr).then(cr,".call(this,a0,a1);").else(cr,"=",it,"[",Jt,"]=",ot.link(function(Lr){return hi(Tc,ot,Xe,Lr,2)}),"(",Ot,");",cr,".call(this,a0,a1);"))}}Object.keys(Xe.state).length>0&&Gt(ot.shared.current,".dirty=true;")}function br(ot,Xe){var Gt=ot.proc("scope",3);ot.batchId="a2";var tr=ot.shared,or=tr.current;Zi(ot,Gt,Xe.context),Xe.framebuffer&&Xe.framebuffer.append(ot,Gt),Jf(Object.keys(Xe.state)).forEach(function(Ft){var Xt=Xe.state[Ft],st=Xt.append(ot,Gt);Hi(st)?st.forEach(function(Ot,it){Gt.set(ot.next[Ft],"["+it+"]",Ot)}):Gt.set(tr.next,"."+Ft,st)}),Jn(ot,Gt,Xe,!0,!0),[Ps,Os,uo,mc,ai].forEach(function(Ft){var Xt=Xe.draw[Ft];!Xt||Gt.set(tr.draw,"."+Ft,""+Xt.append(ot,Gt))}),Object.keys(Xe.uniforms).forEach(function(Ft){var Xt=Xe.uniforms[Ft].append(ot,Gt);Array.isArray(Xt)&&(Xt="["+Xt.join()+"]"),Gt.set(tr.uniforms,"["+tt.id(Ft)+"]",Xt)}),Object.keys(Xe.attributes).forEach(function(Ft){var Xt=Xe.attributes[Ft].append(ot,Gt),st=ot.scopeAttrib(Ft);Object.keys(new $).forEach(function(Ot){Gt.set(st,"."+Ot,Xt[Ot])})}),Xe.scopeVAO&&Gt.set(tr.vao,".targetVAO",Xe.scopeVAO.append(ot,Gt));function Wt(Ft){var Xt=Xe.shader[Ft];Xt&&Gt.set(tr.shader,"."+Ft,Xt.append(ot,Gt))}Wt(Is),Wt(Xs),Object.keys(Xe.state).length>0&&(Gt(or,".dirty=true;"),Gt.exit(or,".dirty=true;")),Gt("a1(",ot.shared.context,",a0,",ot.batchId,");")}function hr(ot){if(!(typeof ot!="object"||Hi(ot))){for(var Xe=Object.keys(ot),Gt=0;Gt<Xe.length;++Gt)if(ir.isDynamic(ot[Xe[Gt]]))return!0;return!1}}function mn(ot,Xe,Gt){var tr=Xe.static[Gt];if(!tr||!hr(tr))return;var or=ot.global,Wt=Object.keys(tr),Ft=!1,Xt=!1,st=!1,Ot=ot.global.def("{}");Wt.forEach(function(Jt){var cr=tr[Jt];if(ir.isDynamic(cr)){typeof cr=="function"&&(cr=tr[Jt]=ir.unbox(cr));var Lr=Ji(cr,null);Ft=Ft||Lr.thisDep,st=st||Lr.propDep,Xt=Xt||Lr.contextDep}else{switch(or(Ot,".",Jt,"="),typeof cr){case"number":or(cr);break;case"string":or('"',cr,'"');break;case"object":Array.isArray(cr)&&or("[",cr.join(),"]");break;default:or(ot.link(cr));break}or(";")}});function it(Jt,cr){Wt.forEach(function(Lr){var Br=tr[Lr];if(!!ir.isDynamic(Br)){var Tr=Jt.invoke(cr,Br);cr(Ot,".",Lr,"=",Tr,";")}})}Xe.dynamic[Gt]=new ir.DynamicVariable(pc,{thisDep:Ft,contextDep:Xt,propDep:st,ref:Ot,append:it}),delete Xe.static[Gt]}function fi(ot,Xe,Gt,tr,or){var Wt=Xr();Wt.stats=Wt.link(or),Object.keys(Xe.static).forEach(function(Xt){mn(Wt,Xe,Xt)}),Gl.forEach(function(Xt){mn(Wt,ot,Xt)});var Ft=Kn(ot,Xe,Gt,tr,Wt);return aa(Wt,Ft),br(Wt,Ft),yt(Wt,Ft),M(Wt.compile(),{destroy:function(){Ft.shader.program.destroy()}})}return{next:Te,current:_e,procs:function(){var ot=Xr(),Xe=ot.proc("poll"),Gt=ot.proc("refresh"),tr=ot.block();Xe(tr),Gt(tr);var or=ot.shared,Wt=or.gl,Ft=or.next,Xt=or.current;tr(Xt,".dirty=false;"),Ki(ot,Xe),Ki(ot,Gt,null,!0);var st;ue&&(st=ot.link(ue)),Et.oes_vertex_array_object&&Gt(ot.link(Et.oes_vertex_array_object),".bindVertexArrayOES(null);");for(var Ot=0;Ot<gr.maxAttributes;++Ot){var it=Gt.def(or.attributes,"[",Ot,"]"),Jt=ot.cond(it,".buffer");Jt.then(Wt,".enableVertexAttribArray(",Ot,");",Wt,".bindBuffer(",yu,",",it,".buffer.buffer);",Wt,".vertexAttribPointer(",Ot,",",it,".size,",it,".type,",it,".normalized,",it,".stride,",it,".offset);").else(Wt,".disableVertexAttribArray(",Ot,");",Wt,".vertexAttrib4f(",Ot,",",it,".x,",it,".y,",it,".z,",it,".w);",it,".buffer=null;"),Gt(Jt),ue&&Gt(st,".vertexAttribDivisorANGLE(",Ot,",",it,".divisor);")}return Gt(ot.shared.vao,".currentVAO=null;",ot.shared.vao,".setVAO(",ot.shared.vao,".targetVAO);"),Object.keys(Ze).forEach(function(cr){var Lr=Ze[cr],Br=tr.def(Ft,".",cr),Tr=ot.block();Tr("if(",Br,"){",Wt,".enable(",Lr,")}else{",Wt,".disable(",Lr,")}",Xt,".",cr,"=",Br,";"),Gt(Tr),Xe("if(",Br,"!==",Xt,".",cr,"){",Tr,"}")}),Object.keys(je).forEach(function(cr){var Lr=je[cr],Br=_e[cr],Tr,$r,Pn=ot.block();if(Pn(Wt,".",Lr,"("),Hi(Br)){var qn=Br.length;Tr=ot.global.def(Ft,".",cr),$r=ot.global.def(Xt,".",cr),Pn(gn(qn,function(En){return Tr+"["+En+"]"}),");",gn(qn,function(En){return $r+"["+En+"]="+Tr+"["+En+"];"}).join("")),Xe("if(",gn(qn,function(En){return Tr+"["+En+"]!=="+$r+"["+En+"]"}).join("||"),"){",Pn,"}")}else Tr=tr.def(Ft,".",cr),$r=tr.def(Xt,".",cr),Pn(Tr,");",Xt,".",cr,"=",Tr,";"),Xe("if(",Tr,"!==",$r,"){",Pn,"}");Gt(Pn)}),ot.compile()}(),compile:fi}}function Zl(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var dd=34918,hd=34919,Zu=35007,wc=function(ge,tt){if(!tt.ext_disjoint_timer_query)return null;var Et=[];function gr(){return Et.pop()||tt.ext_disjoint_timer_query.createQueryEXT()}function Nr(ue){Et.push(ue)}var pr=[];function _r(ue){var pe=gr();tt.ext_disjoint_timer_query.beginQueryEXT(Zu,pe),pr.push(pe),P(pr.length-1,pr.length,ue)}function Wr(){tt.ext_disjoint_timer_query.endQueryEXT(Zu)}function Zr(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var Hr=[];function zr(){return Hr.pop()||new Zr}function qr(ue){Hr.push(ue)}var u=[];function P(ue,pe,_e){var Te=zr();Te.startQueryIndex=ue,Te.endQueryIndex=pe,Te.sum=0,Te.stats=_e,u.push(Te)}var W=[],$=[];function oe(){var ue,pe,_e=pr.length;if(_e!==0){$.length=Math.max($.length,_e+1),W.length=Math.max(W.length,_e+1),W[0]=0,$[0]=0;var Te=0;for(ue=0,pe=0;pe<pr.length;++pe){var Re=pr[pe];tt.ext_disjoint_timer_query.getQueryObjectEXT(Re,hd)?(Te+=tt.ext_disjoint_timer_query.getQueryObjectEXT(Re,dd),Nr(Re)):pr[ue++]=Re,W[pe+1]=Te,$[pe+1]=ue}for(pr.length=ue,ue=0,pe=0;pe<u.length;++pe){var Ze=u[pe],je=Ze.startQueryIndex,ht=Ze.endQueryIndex;Ze.sum+=W[ht]-W[je];var zt=$[je],wr=$[ht];wr===zt?(Ze.stats.gpuTime+=Ze.sum/1e6,qr(Ze)):(Ze.startQueryIndex=zt,Ze.endQueryIndex=wr,u[ue++]=Ze)}u.length=ue}}return{beginQuery:_r,endQuery:Wr,pushScopeStats:P,update:oe,getNumPendingQueries:function(){return pr.length},clear:function(){Et.push.apply(Et,pr);for(var ue=0;ue<Et.length;ue++)tt.ext_disjoint_timer_query.deleteQueryEXT(Et[ue]);pr.length=0,Et.length=0},restore:function(){pr.length=0,Et.length=0}}},qf=16384,vd=256,Hl=1024,Mc=34962,cf="webglcontextlost",ff="webglcontextrestored",Kl=1,pd=2,Hu=3;function lf(ge,tt){for(var Et=0;Et<ge.length;++Et)if(ge[Et]===tt)return Et;return-1}function Cc(ge){var tt=wn(ge);if(!tt)return null;var Et=tt.gl,gr=Et.getContextAttributes(),Nr=Et.isContextLost(),pr=xn(Et,tt);if(!pr)return null;var _r=Pr(),Wr=Zl(),Zr=pr.extensions,Hr=wc(Et,Zr),zr=xr(),qr=Et.drawingBufferWidth,u=Et.drawingBufferHeight,P={tick:0,time:0,viewportWidth:qr,viewportHeight:u,framebufferWidth:qr,framebufferHeight:u,drawingBufferWidth:qr,drawingBufferHeight:u,pixelRatio:tt.pixelRatio},W={},$={elements:null,primitive:4,count:-1,offset:0,instances:-1},oe=Mo(Et,Zr),ue=ts(Et,Wr,tt,_e),pe=id(Et,Zr,oe,Wr,ue);function _e(Bn){return pe.destroyBuffer(Bn)}var Te=_s(Et,Zr,ue,Wr),Re=Pl(Et,_r,Wr,tt),Ze=rd(Et,Zr,oe,function(){zt.procs.poll()},P,Wr,tt),je=Wc(Et,Zr,oe,Wr,tt),ht=Al(Et,Zr,oe,Ze,je,Wr),zt=Yl(Et,_r,Zr,oe,ue,Te,Ze,ht,W,pe,Re,$,P,Hr,tt),wr=sd(Et,ht,zt.procs.poll,P,gr,Zr,oe),Kt=zt.next,qt=Et.canvas,Qt=[],Xr=[],Yr=[],Kr=[tt.onDestroy],Cn=null;function Sn(){if(Qt.length===0){Hr&&Hr.update(),Cn=null;return}Cn=At.next(Sn),za();for(var Bn=Qt.length-1;Bn>=0;--Bn){var hi=Qt[Bn];hi&&hi(P,null,0)}Et.flush(),Hr&&Hr.update()}function Rn(){!Cn&&Qt.length>0&&(Cn=At.next(Sn))}function jn(){Cn&&(At.cancel(Sn),Cn=null)}function kn(Bn){Bn.preventDefault(),Nr=!0,jn(),Xr.forEach(function(hi){hi()})}function Bi(Bn){Et.getError(),Nr=!1,pr.restore(),Re.restore(),ue.restore(),Ze.restore(),je.restore(),ht.restore(),pe.restore(),Hr&&Hr.restore(),zt.procs.refresh(),Rn(),Yr.forEach(function(hi){hi()})}qt&&(qt.addEventListener(cf,kn,!1),qt.addEventListener(ff,Bi,!1));function Xn(){Qt.length=0,jn(),qt&&(qt.removeEventListener(cf,kn),qt.removeEventListener(ff,Bi)),Re.clear(),ht.clear(),je.clear(),Ze.clear(),Te.clear(),ue.clear(),pe.clear(),Hr&&Hr.clear(),Kr.forEach(function(Bn){Bn()})}function qi(Bn){le(!!Bn,"invalid args to regl({...})"),le.type(Bn,"object","invalid args to regl({...})");function hi(or){var Wt=M({},or);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 Ft(Xt){if(Xt in Wt){var st=Wt[Xt];delete Wt[Xt],Object.keys(st).forEach(function(Ot){Wt[Xt+"."+Ot]=st[Ot]})}}return Ft("blend"),Ft("depth"),Ft("cull"),Ft("stencil"),Ft("polygonOffset"),Ft("scissor"),Ft("sample"),"vao"in or&&(Wt.vao=or.vao),Wt}function yi(or,Wt){var Ft={},Xt={};return Object.keys(or).forEach(function(st){var Ot=or[st];if(ir.isDynamic(Ot)){Xt[st]=ir.unbox(Ot,st);return}else if(Wt&&Array.isArray(Ot)){for(var it=0;it<Ot.length;++it)if(ir.isDynamic(Ot[it])){Xt[st]=ir.unbox(Ot,st);return}}Ft[st]=Ot}),{dynamic:Xt,static:Ft}}var aa=yi(Bn.context||{},!0),qs=yi(Bn.uniforms||{},!0),Tc=yi(Bn.attributes||{},!1),yt=yi(hi(Bn),!1),br={gpuTime:0,cpuTime:0,count:0},hr=zt.compile(yt,Tc,qs,aa,br),mn=hr.draw,fi=hr.batch,ot=hr.scope,Xe=[];function Gt(or){for(;Xe.length<or;)Xe.push(null);return Xe}function tr(or,Wt){var Ft;if(Nr&&le.raise("context lost"),typeof or=="function")return ot.call(this,null,or,0);if(typeof Wt=="function")if(typeof or=="number")for(Ft=0;Ft<or;++Ft)ot.call(this,null,Wt,Ft);else if(Array.isArray(or))for(Ft=0;Ft<or.length;++Ft)ot.call(this,or[Ft],Wt,Ft);else return ot.call(this,or,Wt,0);else if(typeof or=="number"){if(or>0)return fi.call(this,Gt(or|0),or|0)}else if(Array.isArray(or)){if(or.length)return fi.call(this,or,or.length)}else return mn.call(this,or)}return M(tr,{stats:br,destroy:function(){hr.destroy()}})}var Oi=ht.setFBO=qi({framebuffer:ir.define.call(null,Kl,"framebuffer")});function Kn(Bn,hi){var yi=0;zt.procs.poll();var aa=hi.color;aa&&(Et.clearColor(+aa[0]||0,+aa[1]||0,+aa[2]||0,+aa[3]||0),yi|=qf),"depth"in hi&&(Et.clearDepth(+hi.depth),yi|=vd),"stencil"in hi&&(Et.clearStencil(hi.stencil|0),yi|=Hl),le(!!yi,"called regl.clear with no buffer specified"),Et.clear(yi)}function Zi(Bn){if(le(typeof Bn=="object"&&Bn,"regl.clear() takes an object as input"),"framebuffer"in Bn)if(Bn.framebuffer&&Bn.framebuffer_reglType==="framebufferCube")for(var hi=0;hi<6;++hi)Oi(M({framebuffer:Bn.framebuffer.faces[hi]},Bn),Kn);else Oi(Bn,Kn);else Kn(null,Bn)}function Ki(Bn){le.type(Bn,"function","regl.frame() callback must be a function"),Qt.push(Bn);function hi(){var yi=lf(Qt,Bn);le(yi>=0,"cannot cancel a frame twice");function aa(){var qs=lf(Qt,aa);Qt[qs]=Qt[Qt.length-1],Qt.length-=1,Qt.length<=0&&jn()}Qt[yi]=aa}return Rn(),{cancel:hi}}function ri(){var Bn=Kt.viewport,hi=Kt.scissor_box;Bn[0]=Bn[1]=hi[0]=hi[1]=0,P.viewportWidth=P.framebufferWidth=P.drawingBufferWidth=Bn[2]=hi[2]=Et.drawingBufferWidth,P.viewportHeight=P.framebufferHeight=P.drawingBufferHeight=Bn[3]=hi[3]=Et.drawingBufferHeight}function za(){P.tick+=1,P.time=Jn(),ri(),zt.procs.poll()}function pa(){Ze.refresh(),ri(),zt.procs.refresh(),Hr&&Hr.update()}function Jn(){return(xr()-zr)/1e3}pa();function Ga(Bn,hi){le.type(hi,"function","listener callback must be a function");var yi;switch(Bn){case"frame":return Ki(hi);case"lost":yi=Xr;break;case"restore":yi=Yr;break;case"destroy":yi=Kr;break;default:le.raise("invalid event, must be one of frame,lost,restore,destroy")}return yi.push(hi),{cancel:function(){for(var aa=0;aa<yi.length;++aa)if(yi[aa]===hi){yi[aa]=yi[yi.length-1],yi.pop();return}}}}var Mi=M(qi,{clear:Zi,prop:ir.define.bind(null,Kl),context:ir.define.bind(null,pd),this:ir.define.bind(null,Hu),draw:qi({}),buffer:function(Bn){return ue.create(Bn,Mc,!1,!1)},elements:function(Bn){return Te.create(Bn,!1)},texture:Ze.create2D,cube:Ze.createCube,renderbuffer:je.create,framebuffer:ht.create,framebufferCube:ht.createCube,vao:pe.createVAO,attributes:gr,frame:Ki,on:Ga,limits:oe,hasExtension:function(Bn){return oe.extensions.indexOf(Bn.toLowerCase())>=0},read:wr,destroy:Xn,_gl:Et,_refresh:pa,poll:function(){za(),Hr&&Hr.update()},now:Jn,stats:Wr});return tt.onDone(null,Mi),Mi}return Cc})},86851:function(dt,x,M){"use strict";var S=M(89594),B=Array.prototype.concat,N=Array.prototype.slice,E=dt.exports=function(A){for(var v=[],p=0,c=A.length;p<c;p++){var f=A[p];S(f)?v=B.call(v,N.call(f)):v.push(f)}return v};E.wrap=function(I){return function(){return I(E(arguments))}}},89594:function(dt){dt.exports=function(M){return!M||typeof M=="string"?!1:M instanceof Array||Array.isArray(M)||M.length>=0&&(M.splice instanceof Function||Object.getOwnPropertyDescriptor(M,M.length-1)&&M.constructor.name!=="String")}}}]);