import{ak as Ka,al as bi,am as me,k as EP,L as _P,an as SP,a3 as MP,K as AP,o as iw,c as CP,a as rc,e as ow,m as TP,w as IP,M as kP,n as NP,ao as OP,G as LP,d as DP,h as PP}from"./index-BFjouPFU.js";import{_ as RP}from"./_plugin-vue_export-helper-DlAUqK2U.js";function FP(t,e){for(var r=0;rn[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const ty=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return Ea},get Circle(){return b9},get Ellipse(){return w9},get Image(){return x9},get Line(){return E9},get Marker(){return S9},get Path(){return Ky},get Polygon(){return N9},get Polyline(){return O9},get Rect(){return P9},get Text(){return R9}},Symbol.toStringTag,{value:"Module"})),ry=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return aa},get Circle(){return z9},get Dom(){return j9},get Ellipse(){return U9},get Image(){return $9},get Line(){return X9},get Marker(){return W9},get Path(){return V9},get Polygon(){return Y9},get Polyline(){return q9},get Rect(){return Z9},get Text(){return e7}},Symbol.toStringTag,{value:"Module"}));var b0=function(t,e){return b0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},b0(t,e)};function jt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");b0(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var P=function(){return P=Object.assign||function(e){for(var r,n=1,a=arguments.length;n=0;s--)(o=t[s])&&(i=(a<3?o(i):a>3?o(e,r,i):o(e,r))||i);return a>3&&i&&Object.defineProperty(e,r,i),i}function vS(t,e){return function(r,n){e(r,n,t)}}function pS(t,e,r,n,a,i){function o(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}for(var s=n.kind,u=s==="getter"?"get":s==="setter"?"set":"value",f=!e&&t?n.static?t:t.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),c,h=!1,d=r.length-1;d>=0;d--){var v={};for(var p in n)v[p]=p==="access"?{}:n[p];for(var p in n.access)v.access[p]=n.access[p];v.addInitializer=function(y){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(y||null))};var g=(0,r[d])(s==="accessor"?{get:l.get,set:l.set}:l[u],v);if(s==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(c=o(g.get))&&(l.get=c),(c=o(g.set))&&(l.set=c),(c=o(g.init))&&a.unshift(c)}else(c=o(g))&&(s==="field"?a.unshift(c):l[u]=c)}f&&Object.defineProperty(f,n.name,l),h=!0}function gS(t,e,r){for(var n=arguments.length>2,a=0;a0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ny(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),a,i=[],o;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)i.push(a.value)}catch(s){o={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function xS(){for(var t=[],e=0;e1||u(d,p)})},v&&(a[d]=v(a[d])))}function u(d,v){try{f(n[d](v))}catch(p){h(i[0][3],p)}}function f(d){d.value instanceof Hs?Promise.resolve(d.value.v).then(l,c):h(i[0][2],d)}function l(d){u("next",d)}function c(d){u("throw",d)}function h(d,v){d(v),i.shift(),i.length&&u(i[0][0],i[0][1])}}function _S(t){var e,r;return e={},n("next"),n("throw",function(a){throw a}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(a,i){e[a]=t[a]?function(o){return(r=!r)?{value:Hs(t[a](o)),done:!1}:i?i(o):o}:i}}function SS(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof _h=="function"?_h(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(s,u){o=t[i](o),a(s,u,o.done,o.value)})}}function a(i,o,s,u){Promise.resolve(u).then(function(f){i({value:f,done:s})},o)}}function MS(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var BP=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},w0=function(t){return w0=Object.getOwnPropertyNames||function(e){var r=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[r.length]=n);return r},w0(t)};function AS(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=w0(t),n=0;n-1:!1},DS=function(t,e){if(!On(t))return t;for(var r=[],n=0;n-1;)HP.call(t,i,1);return t},QP=Array.prototype.splice,GS=function(e,r){if(!On(e))return[];for(var n=e?r.length:0,a=n-1;n--;){var i=void 0,o=r[n];(n===a||o!==i)&&(i=o,QP.call(e,o,1))}return e},zS=function(t,e,r){if(!bt(t)&&!ln(t))return t;var n=r;return _e(t,function(a,i){n=e(n,a,i)}),n},JP=function(t,e){var r=[];if(!On(t))return r;for(var n=-1,a=[],i=t.length;++ni[s])return 1;if(a[s]r?r:t},pR=function(t,e){var r=e.toString(),n=r.indexOf(".");if(n===-1)return Math.round(t);var a=r.substr(n+1).length;return a>20&&(a=20),parseFloat(t.toFixed(a))},Ot=function(t){return xa(t,"Number")},gR=function(t){return Ot(t)&&t%1!==0},yR=function(t){return Ot(t)&&t%2===0},mR=Number.isInteger?Number.isInteger:function(t){return Ot(t)&&t%1===0},bR=function(t){return Ot(t)&&t<0},wR=1e-5;function US(t,e,r){return r===void 0&&(r=wR),Math.abs(t-e)0};const _R=function(t,e){if(bt(t)){for(var r,n=-1/0,a=0;an&&(r=i,n=o)}return r}},SR=function(t,e){if(bt(t)){for(var r,n=1/0,a=0;ae?(n&&(clearTimeout(n),n=null),s=l,o=t.apply(a,i),n||(a=i=null)):!n&&r.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=a=i=null},f},ZS=function(t){return On(t)?Array.prototype.slice.call(t):[]};var nc={};const Ji=function(t){return t=t||"g",nc[t]?nc[t]+=1:nc[t]=1,t+nc[t]},sf=function(){},a3=function(t){return t};function i3(t){return Zt(t)?0:On(t)?t.length:Object.keys(t).length}var ac;const uf=YS(function(t,e){e===void 0&&(e={});var r=e.fontSize,n=e.fontFamily,a=e.fontWeight,i=e.fontStyle,o=e.fontVariant;return ac||(ac=document.createElement("canvas").getContext("2d")),ac.font=[i,o,a,r+"px",n].join(" "),ac.measureText(Ye(t)?t:"").width},function(t,e){return e===void 0&&(e={}),ay([t],iy(e)).join("")}),o3=function(t,e,r,n){n===void 0&&(n="...");var a=16,i=uf(n,r),o=Ye(t)?t:vu(t),s=e,u=[],f,l;if(uf(t,r)<=e)return t;for(;f=o.substr(0,a),l=uf(f,r),!(l+i>s&&l>s);)if(u.push(f),s-=l,o=o.substr(a),!o)return u.join("");for(;f=o.substr(0,1),l=uf(f,r),!(l+i>s);)if(u.push(f),s-=l,o=o.substr(1),!o)return u.join("");return""+u.join("")+n};var s3=function(){function t(){this.map={}}return t.prototype.has=function(e){return this.map[e]!==void 0},t.prototype.get=function(e,r){var n=this.map[e];return n===void 0?r:n},t.prototype.set=function(e,r){this.map[e]=r},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(e){delete this.map[e]},t.prototype.size=function(){return Object.keys(this.map).length},t}();const u3=Object.freeze(Object.defineProperty({__proto__:null,Cache:s3,assign:Et,augment:XR,clamp:vR,clearAnimationFrame:VS,clone:rr,contains:Sh,debounce:oy,deepMix:_r,difference:UP,each:_e,endsWith:oR,every:sR,extend:VR,filter:DS,find:XP,findIndex:WP,firstValue:VP,fixedBase:pR,flatten:YP,flattenDeep:FS,forIn:_e,get:HS,getEllipsisText:o3,getRange:qP,getType:$S,getWrapBehavior:cR,group:lR,groupBy:Ah,groupToMap:jS,has:uw,hasKey:uw,hasValue:IR,head:nR,identity:a3,includes:Sh,indexOf:YR,isArguments:PR,isArray:bt,isArrayLike:On,isBoolean:Qf,isDate:RR,isDecimal:gR,isElement:$R,isEmpty:HR,isEqual:jo,isEqualWith:ZR,isError:FR,isEven:yR,isFinite:BR,isFunction:Tr,isInteger:mR,isMatch:RS,isNegative:bR,isNil:Zt,isNull:GR,isNumber:Ot,isNumberEqual:US,isObject:gn,isObjectLike:Mh,isOdd:xR,isPlainObject:ln,isPositive:ER,isPrototype:XS,isRegExp:jR,isString:Ye,isType:xa,isUndefined:UR,keys:PS,last:aR,lowerCase:kR,lowerFirst:NR,map:KR,mapValues:JR,max:qa,maxBy:_R,measureTextWidth:uf,memoize:YS,min:Ha,minBy:SR,mix:Et,mod:gd,noop:sf,number2color:hR,omit:n3,parseRadius:dR,pick:r3,pull:KP,pullAt:GS,reduce:zS,remove:JP,requestAnimationFrame:WS,set:e3,size:i3,some:uR,sortBy:eR,startsWith:iR,substitute:OR,throttle:Ch,toArray:ZS,toDegree:AR,toInteger:CR,toRadian:yd,toString:vu,union:tR,uniq:kf,uniqueId:Ji,upperCase:LR,upperFirst:Zs,values:iy,valuesOfKey:rR,wrapBehavior:Bs},Symbol.toStringTag,{value:"Module"})),f3={getDefaultCfg:function(){return{}},getEvents:function(){return{}},updateCfg:function(e){return Object.assign(this,e),!0},shouldBegin:function(){return!0},shouldUpdate:function(){return!0},shouldEnd:function(){return!0},bind:function(e){var r=this,n=this.events;this.graph=e,(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&e.get("canvas").set("draggable",!0),_e(n,function(a,i){e.on(i,a)}),document.addEventListener("visibilitychange",function(){r.keydown=!1})},unbind:function(e){var r=this.events,n=e.get("canvas").get("draggable");(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&e.get("canvas").set("draggable",!1),_e(r,function(a,i){e.off(i,a)}),e.get("canvas").set("draggable",n)},get:function(e){return this[e]},set:function(e,r){return this[e]=r,this}};var sy=function(){function t(){}return t.registerBehavior=function(e,r){if(!r)throw new Error("please specify handler for this behavior: ".concat(e));var n=rr(f3);Object.assign(n,r);var a=function(o){var s=this;Object.assign(this,this.getDefaultCfg(),o);var u=this.getEvents();this.events=null;var f={};u&&(_e(u,function(l,c){f[c]=Bs(s,l)}),this.events=f)};a.prototype=n,t.types[e]=a},t.hasBehavior=function(e){return!!t.types[e]},t.getBehavior=function(e){return t.types[e]},t.types={},t}(),l3="*",KS=function(){function t(){this._events={}}return t.prototype.on=function(e,r,n){return this._events[e]||(this._events[e]=[]),this._events[e].push({callback:r,once:!!n}),this},t.prototype.once=function(e,r){return this.on(e,r,!0)},t.prototype.emit=function(e){for(var r=this,n=[],a=1;a=0?Math.round(t):t%.5===0?Math.floor(t):Math.round(t)}function c3(t){qt=t}var h3=Math.PI/180,d3=180/Math.PI;function v3(t){return t*h3}function p3(t){return t*d3}function g3(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:pt;return Math.abs(t-e)<=r*Math.max(1,Math.abs(t),Math.abs(e))}const y3=Object.freeze(Object.defineProperty({__proto__:null,ANGLE_ORDER:QS,get ARRAY_TYPE(){return qt},EPSILON:pt,RANDOM:ya,equals:g3,round:Ba,setMatrixArrayType:c3,toDegree:p3,toRadian:v3},Symbol.toStringTag,{value:"Module"}));function m3(){var t=new qt(4);return qt!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function b3(t){var e=new qt(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function w3(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function x3(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function E3(t,e,r,n){var a=new qt(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=n,a}function _3(t,e,r,n,a){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t}function S3(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function M3(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r*i-a*n;return o?(o=1/o,t[0]=i*o,t[1]=-n*o,t[2]=-a*o,t[3]=r*o,t):null}function A3(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t}function C3(t){return t[0]*t[3]-t[2]*t[1]}function JS(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0],u=r[1],f=r[2],l=r[3];return t[0]=n*s+i*u,t[1]=a*s+o*u,t[2]=n*f+i*l,t[3]=a*f+o*l,t}function T3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+i*s,t[1]=a*u+o*s,t[2]=n*-s+i*u,t[3]=a*-s+o*u,t}function I3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0],u=r[1];return t[0]=n*s,t[1]=a*s,t[2]=i*u,t[3]=o*u,t}function k3(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t}function N3(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function O3(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function L3(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3])}function D3(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]}function P3(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}function eM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}function R3(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function F3(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=e[0],s=e[1],u=e[2],f=e[3];return Math.abs(r-o)<=pt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=pt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(a-u)<=pt*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(i-f)<=pt*Math.max(1,Math.abs(i),Math.abs(f))}function B3(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function G3(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}var z3=JS,j3=eM;const U3=Object.freeze(Object.defineProperty({__proto__:null,LDU:D3,add:P3,adjoint:A3,clone:b3,copy:w3,create:m3,determinant:C3,equals:F3,exactEquals:R3,frob:L3,fromRotation:k3,fromScaling:N3,fromValues:E3,identity:x3,invert:M3,mul:z3,multiply:JS,multiplyScalar:B3,multiplyScalarAndAdd:G3,rotate:T3,scale:I3,set:_3,str:O3,sub:j3,subtract:eM,transpose:S3},Symbol.toStringTag,{value:"Module"}));function $3(){var t=new qt(6);return qt!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}function X3(t){var e=new qt(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function W3(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function V3(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function Y3(t,e,r,n,a,i){var o=new qt(6);return o[0]=t,o[1]=e,o[2]=r,o[3]=n,o[4]=a,o[5]=i,o}function q3(t,e,r,n,a,i,o){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=o,t}function H3(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=r*i-n*a;return u?(u=1/u,t[0]=i*u,t[1]=-n*u,t[2]=-a*u,t[3]=r*u,t[4]=(a*s-i*o)*u,t[5]=(n*o-r*s)*u,t):null}function Z3(t){return t[0]*t[3]-t[1]*t[2]}function tM(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=r[0],l=r[1],c=r[2],h=r[3],d=r[4],v=r[5];return t[0]=n*f+i*l,t[1]=a*f+o*l,t[2]=n*c+i*h,t[3]=a*c+o*h,t[4]=n*d+i*v+s,t[5]=a*d+o*v+u,t}function K3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*f,t[1]=a*l+o*f,t[2]=n*-f+i*l,t[3]=a*-f+o*l,t[4]=s,t[5]=u,t}function Q3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=r[0],l=r[1];return t[0]=n*f,t[1]=a*f,t[2]=i*l,t[3]=o*l,t[4]=s,t[5]=u,t}function J3(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=r[0],l=r[1];return t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=n*f+i*l+s,t[5]=a*f+o*l+u,t}function e5(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=0,t[5]=0,t}function t5(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t}function r5(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t}function n5(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"}function a5(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+1)}function i5(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t}function rM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t}function o5(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t}function s5(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t}function u5(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function f5(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=e[0],f=e[1],l=e[2],c=e[3],h=e[4],d=e[5];return Math.abs(r-u)<=pt*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(n-f)<=pt*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(a-l)<=pt*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(i-c)<=pt*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-h)<=pt*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-d)<=pt*Math.max(1,Math.abs(s),Math.abs(d))}var l5=tM,c5=rM;const h5=Object.freeze(Object.defineProperty({__proto__:null,add:i5,clone:X3,copy:W3,create:$3,determinant:Z3,equals:f5,exactEquals:u5,frob:a5,fromRotation:e5,fromScaling:t5,fromTranslation:r5,fromValues:Y3,identity:V3,invert:H3,mul:l5,multiply:tM,multiplyScalar:o5,multiplyScalarAndAdd:s5,rotate:K3,scale:Q3,set:q3,str:n5,sub:c5,subtract:rM,translate:J3},Symbol.toStringTag,{value:"Module"}));function nM(){var t=new qt(9);return qt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function d5(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function v5(t){var e=new qt(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function p5(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function g5(t,e,r,n,a,i,o,s,u){var f=new qt(9);return f[0]=t,f[1]=e,f[2]=r,f[3]=n,f[4]=a,f[5]=i,f[6]=o,f[7]=s,f[8]=u,f}function y5(t,e,r,n,a,i,o,s,u,f){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=o,t[6]=s,t[7]=u,t[8]=f,t}function m5(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function b5(t,e){if(t===e){var r=e[1],n=e[2],a=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=a}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function aM(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=l*o-s*f,h=-l*i+s*u,d=f*i-o*u,v=r*c+n*h+a*d;return v?(v=1/v,t[0]=c*v,t[1]=(-l*n+a*f)*v,t[2]=(s*n-a*o)*v,t[3]=h*v,t[4]=(l*r-a*u)*v,t[5]=(-s*r+a*i)*v,t[6]=d*v,t[7]=(-f*r+n*u)*v,t[8]=(o*r-n*i)*v,t):null}function w5(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8];return t[0]=o*l-s*f,t[1]=a*f-n*l,t[2]=n*s-a*o,t[3]=s*u-i*l,t[4]=r*l-a*u,t[5]=a*i-r*s,t[6]=i*f-o*u,t[7]=n*u-r*f,t[8]=r*o-n*i,t}function x5(t){var e=t[0],r=t[1],n=t[2],a=t[3],i=t[4],o=t[5],s=t[6],u=t[7],f=t[8];return e*(f*i-o*u)+r*(-f*a+o*s)+n*(u*a-i*s)}function Qa(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=r[0],d=r[1],v=r[2],p=r[3],g=r[4],y=r[5],m=r[6],b=r[7],w=r[8];return t[0]=h*n+d*o+v*f,t[1]=h*a+d*s+v*l,t[2]=h*i+d*u+v*c,t[3]=p*n+g*o+y*f,t[4]=p*a+g*s+y*l,t[5]=p*i+g*u+y*c,t[6]=m*n+b*o+w*f,t[7]=m*a+b*s+w*l,t[8]=m*i+b*u+w*c,t}function E5(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=r[0],d=r[1];return t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=s,t[5]=u,t[6]=h*n+d*o+f,t[7]=h*a+d*s+l,t[8]=h*i+d*u+c,t}function _5(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=Math.sin(r),d=Math.cos(r);return t[0]=d*n+h*o,t[1]=d*a+h*s,t[2]=d*i+h*u,t[3]=d*o-h*n,t[4]=d*s-h*a,t[5]=d*u-h*i,t[6]=f,t[7]=l,t[8]=c,t}function S5(t,e,r){var n=r[0],a=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=a*e[3],t[4]=a*e[4],t[5]=a*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function uy(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function fy(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function ly(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function M5(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function A5(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r+r,s=n+n,u=a+a,f=r*o,l=n*o,c=n*s,h=a*o,d=a*s,v=a*u,p=i*o,g=i*s,y=i*u;return t[0]=1-c-v,t[3]=l-y,t[6]=h+g,t[1]=l+y,t[4]=1-f-v,t[7]=d-p,t[2]=h-g,t[5]=d+p,t[8]=1-f-c,t}function C5(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=e[9],h=e[10],d=e[11],v=e[12],p=e[13],g=e[14],y=e[15],m=r*s-n*o,b=r*u-a*o,w=r*f-i*o,x=n*u-a*s,E=n*f-i*s,_=a*f-i*u,S=l*p-c*v,A=l*g-h*v,M=l*y-d*v,C=c*g-h*p,I=c*y-d*p,k=h*y-d*g,O=m*k-b*I+w*C+x*M-E*A+_*S;return O?(O=1/O,t[0]=(s*k-u*I+f*C)*O,t[1]=(u*M-o*k-f*A)*O,t[2]=(o*I-s*M+f*S)*O,t[3]=(a*I-n*k-i*C)*O,t[4]=(r*k-a*M+i*A)*O,t[5]=(n*M-r*I-i*S)*O,t[6]=(p*_-g*E+y*x)*O,t[7]=(g*w-v*_-y*b)*O,t[8]=(v*E-p*w+y*m)*O,t):null}function T5(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function I5(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function k5(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8])}function N5(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t}function iM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t}function O5(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t}function L5(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t}function D5(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function P5(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[8],c=e[0],h=e[1],d=e[2],v=e[3],p=e[4],g=e[5],y=e[6],m=e[7],b=e[8];return Math.abs(r-c)<=pt*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(n-h)<=pt*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(a-d)<=pt*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(i-v)<=pt*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(o-p)<=pt*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-g)<=pt*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(u-y)<=pt*Math.max(1,Math.abs(u),Math.abs(y))&&Math.abs(f-m)<=pt*Math.max(1,Math.abs(f),Math.abs(m))&&Math.abs(l-b)<=pt*Math.max(1,Math.abs(l),Math.abs(b))}var R5=Qa,F5=iM;const oM=Object.freeze(Object.defineProperty({__proto__:null,add:N5,adjoint:w5,clone:v5,copy:p5,create:nM,determinant:x5,equals:P5,exactEquals:D5,frob:k5,fromMat2d:M5,fromMat4:d5,fromQuat:A5,fromRotation:fy,fromScaling:ly,fromTranslation:uy,fromValues:g5,identity:m5,invert:aM,mul:R5,multiply:Qa,multiplyScalar:O5,multiplyScalarAndAdd:L5,normalFromMat4:C5,projection:T5,rotate:_5,scale:S5,set:y5,str:I5,sub:F5,subtract:iM,translate:E5,transpose:b5},Symbol.toStringTag,{value:"Module"}));function B5(){var t=new qt(16);return qt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function G5(t){var e=new qt(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function z5(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function j5(t,e,r,n,a,i,o,s,u,f,l,c,h,d,v,p){var g=new qt(16);return g[0]=t,g[1]=e,g[2]=r,g[3]=n,g[4]=a,g[5]=i,g[6]=o,g[7]=s,g[8]=u,g[9]=f,g[10]=l,g[11]=c,g[12]=h,g[13]=d,g[14]=v,g[15]=p,g}function U5(t,e,r,n,a,i,o,s,u,f,l,c,h,d,v,p,g){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=o,t[6]=s,t[7]=u,t[8]=f,t[9]=l,t[10]=c,t[11]=h,t[12]=d,t[13]=v,t[14]=p,t[15]=g,t}function sM(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function $5(t,e){if(t===e){var r=e[1],n=e[2],a=e[3],i=e[6],o=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[11]=e[14],t[12]=a,t[13]=o,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function X5(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=e[9],h=e[10],d=e[11],v=e[12],p=e[13],g=e[14],y=e[15],m=r*s-n*o,b=r*u-a*o,w=r*f-i*o,x=n*u-a*s,E=n*f-i*s,_=a*f-i*u,S=l*p-c*v,A=l*g-h*v,M=l*y-d*v,C=c*g-h*p,I=c*y-d*p,k=h*y-d*g,O=m*k-b*I+w*C+x*M-E*A+_*S;return O?(O=1/O,t[0]=(s*k-u*I+f*C)*O,t[1]=(a*I-n*k-i*C)*O,t[2]=(p*_-g*E+y*x)*O,t[3]=(h*E-c*_-d*x)*O,t[4]=(u*M-o*k-f*A)*O,t[5]=(r*k-a*M+i*A)*O,t[6]=(g*w-v*_-y*b)*O,t[7]=(l*_-h*w+d*b)*O,t[8]=(o*I-s*M+f*S)*O,t[9]=(n*M-r*I-i*S)*O,t[10]=(v*E-p*w+y*m)*O,t[11]=(c*w-l*E-d*m)*O,t[12]=(s*A-o*C-u*S)*O,t[13]=(r*C-n*A+a*S)*O,t[14]=(p*b-v*x-g*m)*O,t[15]=(l*x-c*b+h*m)*O,t):null}function W5(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],u=e[6],f=e[7],l=e[8],c=e[9],h=e[10],d=e[11],v=e[12],p=e[13],g=e[14],y=e[15],m=r*s-n*o,b=r*u-a*o,w=r*f-i*o,x=n*u-a*s,E=n*f-i*s,_=a*f-i*u,S=l*p-c*v,A=l*g-h*v,M=l*y-d*v,C=c*g-h*p,I=c*y-d*p,k=h*y-d*g;return t[0]=s*k-u*I+f*C,t[1]=a*I-n*k-i*C,t[2]=p*_-g*E+y*x,t[3]=h*E-c*_-d*x,t[4]=u*M-o*k-f*A,t[5]=r*k-a*M+i*A,t[6]=g*w-v*_-y*b,t[7]=l*_-h*w+d*b,t[8]=o*I-s*M+f*S,t[9]=n*M-r*I-i*S,t[10]=v*E-p*w+y*m,t[11]=c*w-l*E-d*m,t[12]=s*A-o*C-u*S,t[13]=r*C-n*A+a*S,t[14]=p*b-v*x-g*m,t[15]=l*x-c*b+h*m,t}function V5(t){var e=t[0],r=t[1],n=t[2],a=t[3],i=t[4],o=t[5],s=t[6],u=t[7],f=t[8],l=t[9],c=t[10],h=t[11],d=t[12],v=t[13],p=t[14],g=t[15],y=e*o-r*i,m=e*s-n*i,b=r*s-n*o,w=f*v-l*d,x=f*p-c*d,E=l*p-c*v,_=e*E-r*x+n*w,S=i*E-o*x+s*w,A=f*b-l*m+c*y,M=d*b-v*m+p*y;return u*_-a*S+g*A-h*M}function uM(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=e[8],h=e[9],d=e[10],v=e[11],p=e[12],g=e[13],y=e[14],m=e[15],b=r[0],w=r[1],x=r[2],E=r[3];return t[0]=b*n+w*s+x*c+E*p,t[1]=b*a+w*u+x*h+E*g,t[2]=b*i+w*f+x*d+E*y,t[3]=b*o+w*l+x*v+E*m,b=r[4],w=r[5],x=r[6],E=r[7],t[4]=b*n+w*s+x*c+E*p,t[5]=b*a+w*u+x*h+E*g,t[6]=b*i+w*f+x*d+E*y,t[7]=b*o+w*l+x*v+E*m,b=r[8],w=r[9],x=r[10],E=r[11],t[8]=b*n+w*s+x*c+E*p,t[9]=b*a+w*u+x*h+E*g,t[10]=b*i+w*f+x*d+E*y,t[11]=b*o+w*l+x*v+E*m,b=r[12],w=r[13],x=r[14],E=r[15],t[12]=b*n+w*s+x*c+E*p,t[13]=b*a+w*u+x*h+E*g,t[14]=b*i+w*f+x*d+E*y,t[15]=b*o+w*l+x*v+E*m,t}function Y5(t,e,r){var n=r[0],a=r[1],i=r[2],o,s,u,f,l,c,h,d,v,p,g,y;return e===t?(t[12]=e[0]*n+e[4]*a+e[8]*i+e[12],t[13]=e[1]*n+e[5]*a+e[9]*i+e[13],t[14]=e[2]*n+e[6]*a+e[10]*i+e[14],t[15]=e[3]*n+e[7]*a+e[11]*i+e[15]):(o=e[0],s=e[1],u=e[2],f=e[3],l=e[4],c=e[5],h=e[6],d=e[7],v=e[8],p=e[9],g=e[10],y=e[11],t[0]=o,t[1]=s,t[2]=u,t[3]=f,t[4]=l,t[5]=c,t[6]=h,t[7]=d,t[8]=v,t[9]=p,t[10]=g,t[11]=y,t[12]=o*n+l*a+v*i+e[12],t[13]=s*n+c*a+p*i+e[13],t[14]=u*n+h*a+g*i+e[14],t[15]=f*n+d*a+y*i+e[15]),t}function q5(t,e,r){var n=r[0],a=r[1],i=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*a,t[5]=e[5]*a,t[6]=e[6]*a,t[7]=e[7]*a,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function H5(t,e,r,n){var a=n[0],i=n[1],o=n[2],s=Math.sqrt(a*a+i*i+o*o),u,f,l,c,h,d,v,p,g,y,m,b,w,x,E,_,S,A,M,C,I,k,O,B;return s0?(r[0]=(s*o+l*n+u*i-f*a)*2/c,r[1]=(u*o+l*a+f*n-s*i)*2/c,r[2]=(f*o+l*i+s*a-u*n)*2/c):(r[0]=(s*o+l*n+u*i-f*a)*2,r[1]=(u*o+l*a+f*n-s*i)*2,r[2]=(f*o+l*i+s*a-u*n)*2),fM(t,e,r),t}function lM(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function cM(t,e){var r=e[0],n=e[1],a=e[2],i=e[4],o=e[5],s=e[6],u=e[8],f=e[9],l=e[10];return t[0]=Math.sqrt(r*r+n*n+a*a),t[1]=Math.sqrt(i*i+o*o+s*s),t[2]=Math.sqrt(u*u+f*f+l*l),t}function hM(t,e){var r=new qt(3);cM(r,e);var n=1/r[0],a=1/r[1],i=1/r[2],o=e[0]*n,s=e[1]*a,u=e[2]*i,f=e[4]*n,l=e[5]*a,c=e[6]*i,h=e[8]*n,d=e[9]*a,v=e[10]*i,p=o+l+v,g=0;return p>0?(g=Math.sqrt(p+1)*2,t[3]=.25*g,t[0]=(c-d)/g,t[1]=(h-u)/g,t[2]=(s-f)/g):o>l&&o>v?(g=Math.sqrt(1+o-l-v)*2,t[3]=(c-d)/g,t[0]=.25*g,t[1]=(s+f)/g,t[2]=(h+u)/g):l>v?(g=Math.sqrt(1+l-o-v)*2,t[3]=(h-u)/g,t[0]=(s+f)/g,t[1]=.25*g,t[2]=(c+d)/g):(g=Math.sqrt(1+v-o-l)*2,t[3]=(s-f)/g,t[0]=(h+u)/g,t[1]=(c+d)/g,t[2]=.25*g),t}function oF(t,e,r,n){e[0]=n[12],e[1]=n[13],e[2]=n[14];var a=n[0],i=n[1],o=n[2],s=n[4],u=n[5],f=n[6],l=n[8],c=n[9],h=n[10];r[0]=Math.sqrt(a*a+i*i+o*o),r[1]=Math.sqrt(s*s+u*u+f*f),r[2]=Math.sqrt(l*l+c*c+h*h);var d=1/r[0],v=1/r[1],p=1/r[2],g=a*d,y=i*v,m=o*p,b=s*d,w=u*v,x=f*p,E=l*d,_=c*v,S=h*p,A=g+w+S,M=0;return A>0?(M=Math.sqrt(A+1)*2,t[3]=.25*M,t[0]=(x-_)/M,t[1]=(E-m)/M,t[2]=(y-b)/M):g>w&&g>S?(M=Math.sqrt(1+g-w-S)*2,t[3]=(x-_)/M,t[0]=.25*M,t[1]=(y+b)/M,t[2]=(E+m)/M):w>S?(M=Math.sqrt(1+w-g-S)*2,t[3]=(E-m)/M,t[0]=(y+b)/M,t[1]=.25*M,t[2]=(x+_)/M):(M=Math.sqrt(1+S-g-w)*2,t[3]=(y-b)/M,t[0]=(E+m)/M,t[1]=(x+_)/M,t[2]=.25*M),t}function sF(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=e[3],u=a+a,f=i+i,l=o+o,c=a*u,h=a*f,d=a*l,v=i*f,p=i*l,g=o*l,y=s*u,m=s*f,b=s*l,w=n[0],x=n[1],E=n[2];return t[0]=(1-(v+g))*w,t[1]=(h+b)*w,t[2]=(d-m)*w,t[3]=0,t[4]=(h-b)*x,t[5]=(1-(c+g))*x,t[6]=(p+y)*x,t[7]=0,t[8]=(d+m)*E,t[9]=(p-y)*E,t[10]=(1-(c+v))*E,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function uF(t,e,r,n,a){var i=e[0],o=e[1],s=e[2],u=e[3],f=i+i,l=o+o,c=s+s,h=i*f,d=i*l,v=i*c,p=o*l,g=o*c,y=s*c,m=u*f,b=u*l,w=u*c,x=n[0],E=n[1],_=n[2],S=a[0],A=a[1],M=a[2],C=(1-(p+y))*x,I=(d+w)*x,k=(v-b)*x,O=(d-w)*E,B=(1-(h+y))*E,L=(g+m)*E,z=(v+b)*_,X=(g-m)*_,R=(1-(h+p))*_;return t[0]=C,t[1]=I,t[2]=k,t[3]=0,t[4]=O,t[5]=B,t[6]=L,t[7]=0,t[8]=z,t[9]=X,t[10]=R,t[11]=0,t[12]=r[0]+S-(C*S+O*A+z*M),t[13]=r[1]+A-(I*S+B*A+X*M),t[14]=r[2]+M-(k*S+L*A+R*M),t[15]=1,t}function fF(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r+r,s=n+n,u=a+a,f=r*o,l=n*o,c=n*s,h=a*o,d=a*s,v=a*u,p=i*o,g=i*s,y=i*u;return t[0]=1-c-v,t[1]=l+y,t[2]=h-g,t[3]=0,t[4]=l-y,t[5]=1-f-v,t[6]=d+p,t[7]=0,t[8]=h+g,t[9]=d-p,t[10]=1-f-c,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function lF(t,e,r,n,a,i,o){var s=1/(r-e),u=1/(a-n),f=1/(i-o);return t[0]=i*2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i*2*u,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(a+n)*u,t[10]=(o+i)*f,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*i*2*f,t[15]=0,t}function dM(t,e,r,n,a){var i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,a!=null&&a!==1/0){var o=1/(n-a);t[10]=(a+n)*o,t[14]=2*a*n*o}else t[10]=-1,t[14]=-2*n;return t}var cF=dM;function hF(t,e,r,n,a){var i=1/Math.tan(e/2);if(t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,a!=null&&a!==1/0){var o=1/(n-a);t[10]=a*o,t[14]=a*n*o}else t[10]=-1,t[14]=-n;return t}function dF(t,e,r,n){var a=Math.tan(e.upDegrees*Math.PI/180),i=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),u=2/(o+s),f=2/(a+i);return t[0]=u,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=f,t[6]=0,t[7]=0,t[8]=-((o-s)*u*.5),t[9]=(a-i)*f*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function vM(t,e,r,n,a,i,o){var s=1/(e-r),u=1/(n-a),f=1/(i-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*f,t[11]=0,t[12]=(e+r)*s,t[13]=(a+n)*u,t[14]=(o+i)*f,t[15]=1,t}var vF=vM;function pF(t,e,r,n,a,i,o){var s=1/(e-r),u=1/(n-a),f=1/(i-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=f,t[11]=0,t[12]=(e+r)*s,t[13]=(a+n)*u,t[14]=i*f,t[15]=1,t}function gF(t,e,r,n){var a,i,o,s,u,f,l,c,h,d,v=e[0],p=e[1],g=e[2],y=n[0],m=n[1],b=n[2],w=r[0],x=r[1],E=r[2];return Math.abs(v-w)0&&(d=1/Math.sqrt(d),l*=d,c*=d,h*=d);var v=u*h-f*c,p=f*l-s*h,g=s*c-u*l;return d=v*v+p*p+g*g,d>0&&(d=1/Math.sqrt(d),v*=d,p*=d,g*=d),t[0]=v,t[1]=p,t[2]=g,t[3]=0,t[4]=c*g-h*p,t[5]=h*v-l*g,t[6]=l*p-c*v,t[7]=0,t[8]=l,t[9]=c,t[10]=h,t[11]=0,t[12]=a,t[13]=i,t[14]=o,t[15]=1,t}function mF(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function bF(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])}function wF(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function pM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function xF(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function EF(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function _F(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function SF(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=t[8],c=t[9],h=t[10],d=t[11],v=t[12],p=t[13],g=t[14],y=t[15],m=e[0],b=e[1],w=e[2],x=e[3],E=e[4],_=e[5],S=e[6],A=e[7],M=e[8],C=e[9],I=e[10],k=e[11],O=e[12],B=e[13],L=e[14],z=e[15];return Math.abs(r-m)<=pt*Math.max(1,Math.abs(r),Math.abs(m))&&Math.abs(n-b)<=pt*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(a-w)<=pt*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(i-x)<=pt*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-E)<=pt*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(s-_)<=pt*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(u-S)<=pt*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(f-A)<=pt*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(l-M)<=pt*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(c-C)<=pt*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(h-I)<=pt*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(d-k)<=pt*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(v-O)<=pt*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(p-B)<=pt*Math.max(1,Math.abs(p),Math.abs(B))&&Math.abs(g-L)<=pt*Math.max(1,Math.abs(g),Math.abs(L))&&Math.abs(y-z)<=pt*Math.max(1,Math.abs(y),Math.abs(z))}var MF=uM,AF=pM;const CF=Object.freeze(Object.defineProperty({__proto__:null,add:wF,adjoint:W5,clone:G5,copy:z5,create:B5,decompose:oF,determinant:V5,equals:SF,exactEquals:_F,frob:bF,fromQuat:fF,fromQuat2:iF,fromRotation:tF,fromRotationTranslation:fM,fromRotationTranslationScale:sF,fromRotationTranslationScaleOrigin:uF,fromScaling:eF,fromTranslation:J5,fromValues:j5,fromXRotation:rF,fromYRotation:nF,fromZRotation:aF,frustum:lF,getRotation:hM,getScaling:cM,getTranslation:lM,identity:sM,invert:X5,lookAt:gF,mul:MF,multiply:uM,multiplyScalar:xF,multiplyScalarAndAdd:EF,ortho:vF,orthoNO:vM,orthoZO:pF,perspective:cF,perspectiveFromFieldOfView:dF,perspectiveNO:dM,perspectiveZO:hF,rotate:H5,rotateX:Z5,rotateY:K5,rotateZ:Q5,scale:q5,set:U5,str:mF,sub:AF,subtract:pM,targetTo:yF,translate:Y5,transpose:$5},Symbol.toStringTag,{value:"Module"}));function cy(){var t=new qt(3);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function TF(t){var e=new qt(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function gM(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function x0(t,e,r){var n=new qt(3);return n[0]=t,n[1]=e,n[2]=r,n}function IF(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function kF(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function NF(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function yM(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function mM(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function bM(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function OF(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function LF(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function DF(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function PF(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function RF(t,e){return t[0]=Ba(e[0]),t[1]=Ba(e[1]),t[2]=Ba(e[2]),t}function FF(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function BF(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function wM(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2];return Math.sqrt(r*r+n*n+a*a)}function xM(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2];return r*r+n*n+a*a}function EM(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function GF(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function zF(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function _M(t,e){var r=e[0],n=e[1],a=e[2],i=r*r+n*n+a*a;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function md(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function eh(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[0],s=r[1],u=r[2];return t[0]=a*u-i*s,t[1]=i*o-n*u,t[2]=n*s-a*o,t}function jF(t,e,r,n){var a=e[0],i=e[1],o=e[2];return t[0]=a+n*(r[0]-a),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t}function UF(t,e,r,n){var a=Math.acos(Math.min(Math.max(md(e,r),-1),1)),i=Math.sin(a),o=Math.sin((1-n)*a)/i,s=Math.sin(n*a)/i;return t[0]=o*e[0]+s*r[0],t[1]=o*e[1]+s*r[1],t[2]=o*e[2]+s*r[2],t}function $F(t,e,r,n,a,i){var o=i*i,s=o*(2*i-3)+1,u=o*(i-2)+i,f=o*(i-1),l=o*(3-2*i);return t[0]=e[0]*s+r[0]*u+n[0]*f+a[0]*l,t[1]=e[1]*s+r[1]*u+n[1]*f+a[1]*l,t[2]=e[2]*s+r[2]*u+n[2]*f+a[2]*l,t}function XF(t,e,r,n,a,i){var o=1-i,s=o*o,u=i*i,f=s*o,l=3*i*s,c=3*u*o,h=u*i;return t[0]=e[0]*f+r[0]*l+n[0]*c+a[0]*h,t[1]=e[1]*f+r[1]*l+n[1]*c+a[1]*h,t[2]=e[2]*f+r[2]*l+n[2]*c+a[2]*h,t}function WF(t,e){e=e===void 0?1:e;var r=ya()*2*Math.PI,n=ya()*2-1,a=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=n*e,t}function VF(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[3]*n+r[7]*a+r[11]*i+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*a+r[8]*i+r[12])/o,t[1]=(r[1]*n+r[5]*a+r[9]*i+r[13])/o,t[2]=(r[2]*n+r[6]*a+r[10]*i+r[14])/o,t}function bd(t,e,r){var n=e[0],a=e[1],i=e[2];return t[0]=n*r[0]+a*r[3]+i*r[6],t[1]=n*r[1]+a*r[4]+i*r[7],t[2]=n*r[2]+a*r[5]+i*r[8],t}function YF(t,e,r){var n=r[0],a=r[1],i=r[2],o=r[3],s=e[0],u=e[1],f=e[2],l=a*f-i*u,c=i*s-n*f,h=n*u-a*s;return l=l+l,c=c+c,h=h+h,t[0]=s+o*l+a*h-i*c,t[1]=u+o*c+i*l-n*h,t[2]=f+o*h+n*c-a*l,t}function qF(t,e,r,n){var a=[],i=[];return a[0]=e[0]-r[0],a[1]=e[1]-r[1],a[2]=e[2]-r[2],i[0]=a[0],i[1]=a[1]*Math.cos(n)-a[2]*Math.sin(n),i[2]=a[1]*Math.sin(n)+a[2]*Math.cos(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function HF(t,e,r,n){var a=[],i=[];return a[0]=e[0]-r[0],a[1]=e[1]-r[1],a[2]=e[2]-r[2],i[0]=a[2]*Math.sin(n)+a[0]*Math.cos(n),i[1]=a[1],i[2]=a[2]*Math.cos(n)-a[0]*Math.sin(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function ZF(t,e,r,n){var a=[],i=[];return a[0]=e[0]-r[0],a[1]=e[1]-r[1],a[2]=e[2]-r[2],i[0]=a[0]*Math.cos(n)-a[1]*Math.sin(n),i[1]=a[0]*Math.sin(n)+a[1]*Math.cos(n),i[2]=a[2],t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2],t}function KF(t,e){var r=t[0],n=t[1],a=t[2],i=e[0],o=e[1],s=e[2],u=Math.sqrt((r*r+n*n+a*a)*(i*i+o*o+s*s)),f=u&&md(t,e)/u;return Math.acos(Math.min(Math.max(f,-1),1))}function QF(t){return t[0]=0,t[1]=0,t[2]=0,t}function JF(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function eB(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function tB(t,e){var r=t[0],n=t[1],a=t[2],i=e[0],o=e[1],s=e[2];return Math.abs(r-i)<=pt*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=pt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(a-s)<=pt*Math.max(1,Math.abs(a),Math.abs(s))}var rB=yM,nB=mM,aB=bM,iB=wM,oB=xM,SM=gM,sB=EM,uB=function(){var t=cy();return function(e,r,n,a,i,o){var s,u;for(r||(r=3),n||(n=0),a?u=Math.min(a*r+n,e.length):u=e.length,s=n;s0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=a*o,t[3]=i*o,t}function vy(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function mB(t,e,r,n){var a=r[0]*n[1]-r[1]*n[0],i=r[0]*n[2]-r[2]*n[0],o=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],u=r[1]*n[3]-r[3]*n[1],f=r[2]*n[3]-r[3]*n[2],l=e[0],c=e[1],h=e[2],d=e[3];return t[0]=c*f-h*u+d*s,t[1]=-(l*f)+h*o-d*i,t[2]=l*u-c*o+d*a,t[3]=-(l*s)+c*i-h*a,t}function BM(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=e[3];return t[0]=a+n*(r[0]-a),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t}function bB(t,e){e=e===void 0?1:e;var r,n,a,i,o,s,u;u=ya(),r=u*2-1,n=(4*ya()-2)*Math.sqrt(u*-u+u),o=r*r+n*n,u=ya(),a=u*2-1,i=(4*ya()-2)*Math.sqrt(u*-u+u),s=a*a+i*i;var f=Math.sqrt((1-o)/s);return t[0]=e*r,t[1]=e*n,t[2]=e*a*f,t[3]=e*i*f,t}function wB(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*a+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*a+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*a+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*a+r[11]*i+r[15]*o,t}function xB(t,e,r){var n=r[0],a=r[1],i=r[2],o=r[3],s=e[0],u=e[1],f=e[2],l=a*f-i*u,c=i*s-n*f,h=n*u-a*s;return l=l+l,c=c+c,h=h+h,t[0]=s+o*l+a*h-i*c,t[1]=u+o*c+i*l-n*h,t[2]=f+o*h+n*c-a*l,t[3]=e[3],t}function EB(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function _B(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function GM(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function SB(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=e[0],s=e[1],u=e[2],f=e[3];return Math.abs(r-o)<=pt*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=pt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(a-u)<=pt*Math.max(1,Math.abs(a),Math.abs(u))&&Math.abs(i-f)<=pt*Math.max(1,Math.abs(i),Math.abs(f))}var MB=NM,AB=OM,CB=LM,TB=PM,IB=RM,kB=hy,NB=dy,OB=function(){var t=MM();return function(e,r,n,a,i,o){var s,u;for(r||(r=4),n||(n=0),a?u=Math.min(a*r+n,e.length):u=e.length,s=n;spt?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r}function RB(t,e){var r=gy(t,e);return Math.acos(2*r*r-1)}function jM(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0],u=r[1],f=r[2],l=r[3];return t[0]=n*l+o*s+a*f-i*u,t[1]=a*l+o*u+i*s-n*f,t[2]=i*l+o*f+n*u-a*s,t[3]=o*l-n*s-a*u-i*f,t}function UM(t,e,r){r*=.5;var n=e[0],a=e[1],i=e[2],o=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+o*s,t[1]=a*u+i*s,t[2]=i*u-a*s,t[3]=o*u-n*s,t}function $M(t,e,r){r*=.5;var n=e[0],a=e[1],i=e[2],o=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u-i*s,t[1]=a*u+o*s,t[2]=i*u+n*s,t[3]=o*u-a*s,t}function XM(t,e,r){r*=.5;var n=e[0],a=e[1],i=e[2],o=e[3],s=Math.sin(r),u=Math.cos(r);return t[0]=n*u+a*s,t[1]=a*u-n*s,t[2]=i*u+o*s,t[3]=o*u-i*s,t}function FB(t,e){var r=e[0],n=e[1],a=e[2];return t[0]=r,t[1]=n,t[2]=a,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-a*a)),t}function WM(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=Math.sqrt(r*r+n*n+a*a),s=Math.exp(i),u=o>0?s*Math.sin(o)/o:0;return t[0]=r*u,t[1]=n*u,t[2]=a*u,t[3]=s*Math.cos(o),t}function VM(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=Math.sqrt(r*r+n*n+a*a),s=o>0?Math.atan2(o,i)/o:0;return t[0]=r*s,t[1]=n*s,t[2]=a*s,t[3]=.5*Math.log(r*r+n*n+a*a+i*i),t}function BB(t,e,r){return VM(t,e),qM(t,t,r),WM(t,t),t}function th(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=e[3],u=r[0],f=r[1],l=r[2],c=r[3],h,d,v,p,g;return d=a*u+i*f+o*l+s*c,d<0&&(d=-d,u=-u,f=-f,l=-l,c=-c),1-d>pt?(h=Math.acos(d),v=Math.sin(h),p=Math.sin((1-n)*h)/v,g=Math.sin(n*h)/v):(p=1-n,g=n),t[0]=p*a+g*u,t[1]=p*i+g*f,t[2]=p*o+g*l,t[3]=p*s+g*c,t}function GB(t){var e=ya(),r=ya(),n=ya(),a=Math.sqrt(1-e),i=Math.sqrt(e);return t[0]=a*Math.sin(2*Math.PI*r),t[1]=a*Math.cos(2*Math.PI*r),t[2]=i*Math.sin(2*Math.PI*n),t[3]=i*Math.cos(2*Math.PI*n),t}function zB(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=r*r+n*n+a*a+i*i,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-a*s,t[3]=i*s,t}function jB(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function YM(t,e){var r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var a=0;e[4]>e[0]&&(a=1),e[8]>e[a*3+a]&&(a=2);var i=(a+1)%3,o=(a+2)%3;n=Math.sqrt(e[a*3+a]-e[i*3+i]-e[o*3+o]+1),t[a]=.5*n,n=.5/n,t[3]=(e[i*3+o]-e[o*3+i])*n,t[i]=(e[i*3+a]+e[a*3+i])*n,t[o]=(e[o*3+a]+e[a*3+o])*n}return t}function UB(t,e,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:QS,i=Math.PI/360;e*=i,n*=i,r*=i;var o=Math.sin(e),s=Math.cos(e),u=Math.sin(r),f=Math.cos(r),l=Math.sin(n),c=Math.cos(n);switch(a){case"xyz":t[0]=o*f*c+s*u*l,t[1]=s*u*c-o*f*l,t[2]=s*f*l+o*u*c,t[3]=s*f*c-o*u*l;break;case"xzy":t[0]=o*f*c-s*u*l,t[1]=s*u*c-o*f*l,t[2]=s*f*l+o*u*c,t[3]=s*f*c+o*u*l;break;case"yxz":t[0]=o*f*c+s*u*l,t[1]=s*u*c-o*f*l,t[2]=s*f*l-o*u*c,t[3]=s*f*c+o*u*l;break;case"yzx":t[0]=o*f*c+s*u*l,t[1]=s*u*c+o*f*l,t[2]=s*f*l-o*u*c,t[3]=s*f*c-o*u*l;break;case"zxy":t[0]=o*f*c-s*u*l,t[1]=s*u*c+o*f*l,t[2]=s*f*l+o*u*c,t[3]=s*f*c-o*u*l;break;case"zyx":t[0]=o*f*c-s*u*l,t[1]=s*u*c+o*f*l,t[2]=s*f*l-o*u*c,t[3]=s*f*c+o*u*l;break;default:throw new Error("Unknown angle order "+a)}return t}function $B(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var XB=AM,WB=CM,py=TM,VB=IM,YB=kM,qB=jM,qM=DM,gy=vy,HB=BM,yy=hy,ZB=yy,my=dy,KB=my,by=FM,QB=GM;function JB(t,e){return Math.abs(vy(t,e))>=1-pt}var e4=function(){var t=cy(),e=x0(1,0,0),r=x0(0,1,0);return function(n,a,i){var o=md(a,i);return o<-.999999?(eh(t,e,a),SM(t)<1e-6&&eh(t,r,a),_M(t,t),zM(n,t,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(eh(t,a,i),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+o,by(n,n))}}(),t4=function(){var t=Th(),e=Th();return function(r,n,a,i,o,s){return th(t,n,o,s),th(e,a,i,s),th(r,t,e,2*s*(1-s)),r}}(),r4=function(){var t=nM();return function(e,r,n,a){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=a[0],t[4]=a[1],t[7]=a[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],by(e,YM(e,t))}}();const n4=Object.freeze(Object.defineProperty({__proto__:null,add:YB,calculateW:FB,clone:XB,conjugate:jB,copy:py,create:Th,dot:gy,equals:JB,exactEquals:QB,exp:WM,fromEuler:UB,fromMat3:YM,fromValues:WB,getAngle:RB,getAxisAngle:PB,identity:DB,invert:zB,len:ZB,length:yy,lerp:HB,ln:VM,mul:qB,multiply:jM,normalize:by,pow:BB,random:GB,rotateX:UM,rotateY:$M,rotateZ:XM,rotationTo:e4,scale:qM,set:VB,setAxes:r4,setAxisAngle:zM,slerp:th,sqlerp:t4,sqrLen:KB,squaredLength:my,str:$B},Symbol.toStringTag,{value:"Module"}));function a4(){var t=new qt(8);return qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t}function i4(t){var e=new qt(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function o4(t,e,r,n,a,i,o,s){var u=new qt(8);return u[0]=t,u[1]=e,u[2]=r,u[3]=n,u[4]=a,u[5]=i,u[6]=o,u[7]=s,u}function s4(t,e,r,n,a,i,o){var s=new qt(8);s[0]=t,s[1]=e,s[2]=r,s[3]=n;var u=a*.5,f=i*.5,l=o*.5;return s[4]=u*n+f*r-l*e,s[5]=f*n+l*t-u*r,s[6]=l*n+u*e-f*t,s[7]=-u*t-f*e-l*r,s}function HM(t,e,r){var n=r[0]*.5,a=r[1]*.5,i=r[2]*.5,o=e[0],s=e[1],u=e[2],f=e[3];return t[0]=o,t[1]=s,t[2]=u,t[3]=f,t[4]=n*f+a*u-i*s,t[5]=a*f+i*o-n*u,t[6]=i*f+n*s-a*o,t[7]=-n*o-a*s-i*u,t}function u4(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0]*.5,t[5]=e[1]*.5,t[6]=e[2]*.5,t[7]=0,t}function f4(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function l4(t,e){var r=Th();hM(r,e);var n=new qt(3);return lM(n,e),HM(t,r,n),t}function ZM(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function c4(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t}function h4(t,e,r,n,a,i,o,s,u){return t[0]=e,t[1]=r,t[2]=n,t[3]=a,t[4]=i,t[5]=o,t[6]=s,t[7]=u,t}var d4=py;function v4(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t}var p4=py;function g4(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t}function y4(t,e){var r=e[4],n=e[5],a=e[6],i=e[7],o=-e[0],s=-e[1],u=-e[2],f=e[3];return t[0]=(r*f+i*o+n*u-a*s)*2,t[1]=(n*f+i*s+a*o-r*u)*2,t[2]=(a*f+i*u+r*s-n*o)*2,t}function m4(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0]*.5,u=r[1]*.5,f=r[2]*.5,l=e[4],c=e[5],h=e[6],d=e[7];return t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=o*s+a*f-i*u+l,t[5]=o*u+i*s-n*f+c,t[6]=o*f+n*u-a*s+h,t[7]=-n*s-a*u-i*f+d,t}function b4(t,e,r){var n=-e[0],a=-e[1],i=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*i-f*a,h=u*o+l*a+f*n-s*i,d=f*o+l*i+s*a-u*n,v=l*o-s*n-u*a-f*i;return UM(t,e,r),n=t[0],a=t[1],i=t[2],o=t[3],t[4]=c*o+v*n+h*i-d*a,t[5]=h*o+v*a+d*n-c*i,t[6]=d*o+v*i+c*a-h*n,t[7]=v*o-c*n-h*a-d*i,t}function w4(t,e,r){var n=-e[0],a=-e[1],i=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*i-f*a,h=u*o+l*a+f*n-s*i,d=f*o+l*i+s*a-u*n,v=l*o-s*n-u*a-f*i;return $M(t,e,r),n=t[0],a=t[1],i=t[2],o=t[3],t[4]=c*o+v*n+h*i-d*a,t[5]=h*o+v*a+d*n-c*i,t[6]=d*o+v*i+c*a-h*n,t[7]=v*o-c*n-h*a-d*i,t}function x4(t,e,r){var n=-e[0],a=-e[1],i=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*i-f*a,h=u*o+l*a+f*n-s*i,d=f*o+l*i+s*a-u*n,v=l*o-s*n-u*a-f*i;return XM(t,e,r),n=t[0],a=t[1],i=t[2],o=t[3],t[4]=c*o+v*n+h*i-d*a,t[5]=h*o+v*a+d*n-c*i,t[6]=d*o+v*i+c*a-h*n,t[7]=v*o-c*n-h*a-d*i,t}function E4(t,e,r){var n=r[0],a=r[1],i=r[2],o=r[3],s=e[0],u=e[1],f=e[2],l=e[3];return t[0]=s*o+l*n+u*i-f*a,t[1]=u*o+l*a+f*n-s*i,t[2]=f*o+l*i+s*a-u*n,t[3]=l*o-s*n-u*a-f*i,s=e[4],u=e[5],f=e[6],l=e[7],t[4]=s*o+l*n+u*i-f*a,t[5]=u*o+l*a+f*n-s*i,t[6]=f*o+l*i+s*a-u*n,t[7]=l*o-s*n-u*a-f*i,t}function _4(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0],u=r[1],f=r[2],l=r[3];return t[0]=n*l+o*s+a*f-i*u,t[1]=a*l+o*u+i*s-n*f,t[2]=i*l+o*f+n*u-a*s,t[3]=o*l-n*s-a*u-i*f,s=r[4],u=r[5],f=r[6],l=r[7],t[4]=n*l+o*s+a*f-i*u,t[5]=a*l+o*u+i*s-n*f,t[6]=i*l+o*f+n*u-a*s,t[7]=o*l-n*s-a*u-i*f,t}function S4(t,e,r,n){if(Math.abs(n)0){r=Math.sqrt(r);var n=e[0]/r,a=e[1]/r,i=e[2]/r,o=e[3]/r,s=e[4],u=e[5],f=e[6],l=e[7],c=n*s+a*u+i*f+o*l;t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=(s-n*c)/r,t[5]=(u-a*c)/r,t[6]=(f-i*c)/r,t[7]=(l-o*c)/r}return t}function D4(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"}function P4(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]}function R4(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=t[4],s=t[5],u=t[6],f=t[7],l=e[0],c=e[1],h=e[2],d=e[3],v=e[4],p=e[5],g=e[6],y=e[7];return Math.abs(r-l)<=pt*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(n-c)<=pt*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(a-h)<=pt*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(i-d)<=pt*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(o-v)<=pt*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(s-p)<=pt*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(u-g)<=pt*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(f-y)<=pt*Math.max(1,Math.abs(f),Math.abs(y))}const F4=Object.freeze(Object.defineProperty({__proto__:null,add:M4,clone:i4,conjugate:k4,copy:ZM,create:a4,dot:QM,equals:R4,exactEquals:P4,fromMat4:l4,fromRotation:f4,fromRotationTranslation:HM,fromRotationTranslationValues:s4,fromTranslation:u4,fromValues:o4,getDual:v4,getReal:d4,getTranslation:y4,identity:c4,invert:I4,len:N4,length:JM,lerp:T4,mul:A4,multiply:KM,normalize:L4,rotateAroundAxis:S4,rotateByQuatAppend:E4,rotateByQuatPrepend:_4,rotateX:b4,rotateY:w4,rotateZ:x4,scale:C4,set:h4,setDual:g4,setReal:p4,sqrLen:O4,squaredLength:wd,str:D4,translate:m4},Symbol.toStringTag,{value:"Module"}));function eA(){var t=new qt(2);return qt!=Float32Array&&(t[0]=0,t[1]=0),t}function B4(t){var e=new qt(2);return e[0]=t[0],e[1]=t[1],e}function G4(t,e){var r=new qt(2);return r[0]=t,r[1]=e,r}function z4(t,e){return t[0]=e[0],t[1]=e[1],t}function j4(t,e,r){return t[0]=e,t[1]=r,t}function fn(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function tA(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function rA(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function nA(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function U4(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function $4(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function Pi(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function Ri(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function X4(t,e){return t[0]=Ba(e[0]),t[1]=Ba(e[1]),t}function wn(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function W4(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t}function Ih(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)}function aA(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function iA(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)}function oA(t){var e=t[0],r=t[1];return e*e+r*r}function V4(t,e){return t[0]=-e[0],t[1]=-e[1],t}function Y4(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function Wi(t,e){var r=e[0],n=e[1],a=r*r+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t}function wy(t,e){return t[0]*e[0]+t[1]*e[1]}function q4(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t}function H4(t,e,r,n){var a=e[0],i=e[1];return t[0]=a+n*(r[0]-a),t[1]=i+n*(r[1]-i),t}function Z4(t,e){e=e===void 0?1:e;var r=ya()*2*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function K4(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[2]*a,t[1]=r[1]*n+r[3]*a,t}function Q4(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[2]*a+r[4],t[1]=r[1]*n+r[3]*a+r[5],t}function J4(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[3]*a+r[6],t[1]=r[1]*n+r[4]*a+r[7],t}function eG(t,e,r){var n=e[0],a=e[1];return t[0]=r[0]*n+r[4]*a+r[12],t[1]=r[1]*n+r[5]*a+r[13],t}function tG(t,e,r,n){var a=e[0]-r[0],i=e[1]-r[1],o=Math.sin(n),s=Math.cos(n);return t[0]=a*s-i*o+r[0],t[1]=a*o+i*s+r[1],t}function sA(t,e){var r=t[0],n=t[1],a=e[0],i=e[1];return Math.abs(Math.atan2(n*a-r*i,r*a+n*i))}function rG(t,e){var r=t[0],n=t[1],a=e[0],i=e[1];return Math.atan2(r*i-n*a,r*a+n*i)}function nG(t){return t[0]=0,t[1]=0,t}function aG(t){return"vec2("+t[0]+", "+t[1]+")"}function xy(t,e){return t[0]===e[0]&&t[1]===e[1]}function iG(t,e){var r=t[0],n=t[1],a=e[0],i=e[1];return Math.abs(r-a)<=pt*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-i)<=pt*Math.max(1,Math.abs(n),Math.abs(i))}var oG=iA,rh=tA,sG=rA,uG=nA,fG=Ih,lG=aA,cG=oA,hG=function(){var t=eA();return function(e,r,n,a,i,o){var s,u;for(r||(r=2),n||(n=0),a?u=Math.min(a*r+n,e.length):u=e.length,s=n;s0&&d(x[0])}},y=0;y0;)h.push(u.pop());o.push(h)}}return o},cA=function(e){for(var r=e.nodes,n=r===void 0?[]:r,a=e.edges,i=a===void 0?[]:a,o=[],s={},u={},f={},l=[],c=0,h=function g(y){u[y.id]=c,f[y.id]=c,c+=1,o.push(y),s[y.id]=!0;for(var m=Un(y.id,i,"target").filter(function(_){return n.map(function(S){return S.id}).indexOf(_)>-1}),b=function(S){var A=m[S];if(!u[A]&&u[A]!==0){var M=n.filter(function(C){return C.id===A});M.length>0&&g(M[0]),f[y.id]=Math.min(f[y.id],f[A])}else s[A]&&(f[y.id]=Math.min(f[y.id],u[A]))},w=0;w0;){var E=o.pop();if(s[E.id]=!1,x.push(E),E===y)break}x.length>0&&l.push(x)}},d=0,v=n;d0;)for(var g=d.pop(),y=g.id,m=Un(y,e.edges),b=function(E){var _,S=m[E],A=e.nodes.find(function(B){return B.id===S});if(S===y)o.push((_={},_[S]=g,_));else if(!(S in p))v[S]=g,d.push(A),p[S]=new Set([g]);else if(!p[y].has(A)){for(var M=!0,C=[A,g],I=v[y];p[S].size&&!p[S].has(I)&&(C.push(I),I!==v[I.id]);)I=v[I.id];if(C.push(I),r&&n?(M=!1,C.findIndex(function(B){return r.indexOf(B.id)>-1})>-1&&(M=!0)):r&&!n&&C.findIndex(function(B){return r.indexOf(B.id)>-1})>-1&&(M=!1),M){for(var k={},O=1;O0;){var O=k.pop();i.has(O)&&(i.delete(O),o[O.id].forEach(function(B){k.push(B)}),o[O.id].clear())}},c=function C(I,k,O){var B=!1;if(r&&n===!1&&r.indexOf(I.id)>-1)return B;a.push(I),i.add(I);for(var L=O[I.id],z=0;z-1});le-1)?s.push((k={},k[ce.id]=ce,k)):he[ce.id].push(f[Ie])}}return{component:V,adjList:he,minIdx:B}},b=0;b=b}),x=cA({nodes:w,edges:e.edges}).filter(function(C){return C.length>1});if(x.length===0)break;var E=m(x),_=E.minIdx,S=E.adjList,A=E.component;if(A.length>1){A.forEach(function(C){o[C.id]=new Set});var M=u[_];if(r&&n&&r.indexOf(M.id)===-1)return s;c(M,M,S),b=_+1}else break}return s},pA=function(e,r,n,a){return a===void 0&&(a=!0),r?Ay(e,n,a):My(e,n,a)},MG=function(e,r,n){for(var a=1/0,i,o=0;ol[w.id]+C?(l[M]=l[w.id]+C,c[M]=[w.id]):l[M]===l[w.id]+C&&c[M].push(w.id)})},v=0;v0&&l.length>0;){var d=l[l.length-1];if(d.length){var v=d.shift();v&&(u.push(v),f[v]=!0,h=a?Un(v,s,"target"):Un(v,s),l.push(h.filter(function(y){return!f[y]})))}else{var p=u.pop();f[p]=!1,l.pop();continue}if(u[u.length-1]===n){var g=u.map(function(m){return m});c.push(g);var p=u.pop();f[p]=!1,l.pop()}}return c},Of=function(e,r){for(var n=Uo(e,r),a=[],i=n.length,o=0;oa[o][u]+a[u][s]&&(a[o][s]=a[o][u]+a[u][s]);return a},bA=function(e,r,n,a){r===void 0&&(r=!1),n===void 0&&(n="weight"),a===void 0&&(a=1e3);var i=e.nodes,o=i===void 0?[]:i,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,w){var x=fA();b.clusterId=x,f[x]={id:x,nodes:[b]},l[b.id]={node:b,idx:w}});var c=Uo(e,r),h={};c.forEach(function(b,w){var x=o[w].id;h[x]={},b.forEach(function(E,_){if(E){var S=o[_].id;h[x][S]=E}})});for(var d=0,v=function(){var w=!1;if(o.forEach(function(x){var E={};Object.keys(h[x.id]).forEach(function(O){var B=h[x.id][O],L=l[O].node,z=L.clusterId;E[z]||(E[z]=0),E[z]+=B});var _=-1/0,S=[];if(Object.keys(E).forEach(function(O){_=0&&S.splice(A,1),S&&S.length){w=!0;var M=f[x.clusterId],C=M.nodes.indexOf(x);M.nodes.splice(C,1);var I=Math.floor(Math.random()*S.length),k=f[S[I]];k.nodes.push(x),x.clusterId=k.id}}}),!w)return"break";d++};d0&&S>A&&S-AA&&(C=c.map(function(R){return{node:R,clusterId:R.clusterId}}),I=rr(m),A=S),k||M>100)break;M++,Object.keys(m).forEach(function(R){var V=0;d.forEach(function(he){var ce=he.source,le=he.target,ie=b[ce].node.clusterId,Ie=b[le].node.clusterId;(ie===R&&Ie!==R||Ie===R&&ie!==R)&&(V=V+(he[n]||1))}),m[R].sumTot=V}),c.forEach(function(R,V){var he=m[R.clusterId],ce=0,le,ie=x[V]/(2*_),Ie=0,qe=he.nodes;qe.forEach(function(Wt){var vr=b[Wt.id].idx;Ie+=w[V][vr]||0});var Ve=Ie-he.sumTot*ie,it=qe.filter(function(Wt){return Wt.id!==R.id});it.forEach(function(Wt,vr){v[Wt.originIndex]});var dt=fp(it,v)*f,st=E[R.id];if(Object.keys(st).forEach(function(Wt){var vr=b[Wt].node,cr=vr.clusterId;if(cr!==R.clusterId){var $t=m[cr],sr=$t.nodes;if(!(!sr||!sr.length)){var tn=0;sr.forEach(function(Fe){var ge=b[Fe.id].idx;tn+=w[V][ge]||0});var tt=tn-$t.sumTot*ie,te=sr.concat([R]);te.forEach(function(Fe,ge){v[Fe.originIndex]});var N=fp(te,v)*f,Se=tt-Ve;i&&(Se=tt+N-(Ve+dt)),Se>ce&&(ce=Se,le=$t)}}}),ce>0){le.nodes.push(R);var Tt=R.clusterId;R.clusterId=le.id;var _t=he.nodes.indexOf(R);he.nodes.splice(_t,1);var lr=0,Bt=0;d.forEach(function(Wt){var vr=Wt.source,cr=Wt.target,$t=b[vr].node.clusterId,sr=b[cr].node.clusterId;($t===le.id&&sr!==le.id||sr===le.id&&$t!==le.id)&&(lr=lr+(Wt[n]||1)),($t===Tt&&sr!==Tt||sr===Tt&&$t!==Tt)&&(Bt=Bt+(Wt[n]||1))}),le.sumTot=lr,he.sumTot=Bt}})}var O={},B=0;Object.keys(I).forEach(function(R){var V=I[R];if(!V.nodes||!V.nodes.length){delete I[R];return}var he=String(B+1);he!==R&&(V.id=he,V.nodes=V.nodes.map(function(ce){return{id:ce.id,clusterId:he}}),I[he]=V,O[R]=he,delete I[R],B++)}),C.forEach(function(R){var V=R.node,he=R.clusterId;V&&(V.clusterId=he,V.clusterId&&O[V.clusterId]&&(V.clusterId=O[V.clusterId]))});var L=[],z={};d.forEach(function(R){var V=R.source,he=R.target,ce=R[n]||1,le=b[V].node.clusterId,ie=b[he].node.clusterId;if(!(!le||!ie)){var Ie="".concat(le,"---").concat(ie);if(z[Ie])z[Ie].weight+=ce,z[Ie].count++;else{var qe={source:le,target:ie,weight:ce,count:1};z[Ie]=qe,L.push(qe)}}});var X=[];return Object.keys(I).forEach(function(R){X.push(I[R])}),{clusters:X,clusterEdges:L}},wA=function(e,r,n,a,i,o,s,u){return r===void 0&&(r=!1),n===void 0&&(n="weight"),a===void 0&&(a=1e-4),i===void 0&&(i=void 0),o===void 0&&(o=[]),s===void 0&&(s=["id"]),u===void 0&&(u=1),Iy(e,r,n,a,!0,i,o,s,u)},xA=function(e,r){var n;r===void 0&&(r=1);for(var a=rr(e),i=a.nodes,o=i===void 0?[]:i,s=a.edges,u=s===void 0?[]:s,f=function(){var h=yi({nodes:o,edges:u}),d=Object.keys(h);d.sort(function(g,y){var m,b;return((m=h[g])===null||m===void 0?void 0:m.degree)-((b=h[y])===null||b===void 0?void 0:b.degree)});var v=d[0];if(!o.length||((n=h[v])===null||n===void 0?void 0:n.degree)>=r)return"break";var p=o.findIndex(function(g){return g.id===v});o.splice(p,1),u=u.filter(function(g){return!(g.source===v||g.target===v)})};;){var l=f();if(l==="break")break}return{nodes:o,edges:u}},hw=function(e,r,n){var a=[];switch(e){case pa.EuclideanDistance:a=r[n];break;default:a=[];break}return a},EA=function(e,r,n,a,i,o){r===void 0&&(r=3),n===void 0&&(n=void 0),a===void 0&&(a=[]),i===void 0&&(i=["id"]),o===void 0&&(o=pa.EuclideanDistance);var s=e.nodes,u=s===void 0?[]:s,f=e.edges,l=f===void 0?[]:f,c={clusters:[{id:"0",nodes:u}],clusterEdges:[]};if(o===pa.EuclideanDistance&&!u.every(function(he){return he.hasOwnProperty(n)}))return c;var h=[],d=[];if(o===pa.EuclideanDistance&&(h=Cy(u,n),d=Ty(h,a,i)),!d.length)return c;for(var v=kf(d.map(function(he){return he.join("")})),p=Math.min(r,u.length,v.length),g=0;gx&&!y.find(function(it){return jo(it,hw(o,d,u[le].originIndex))})&&(x=Ve,E=le)}},S=0;S=0;O--)b[Number(u[g].clusterId)][O].id===u[g].id&&b[Number(u[g].clusterId)].splice(O,1);u[g].clusterId=String(M),b[M].push(u[g])}}for(var B=!1,g=0;g=1e3)break}var R=[],V={};return l.forEach(function(he){var ce,le,ie=he.source,Ie=he.target,qe=(ce=u.find(function(st){return st.id===ie}))===null||ce===void 0?void 0:ce.clusterId,Ve=(le=u.find(function(st){return st.id===Ie}))===null||le===void 0?void 0:le.clusterId,it="".concat(qe,"---").concat(Ve);if(V[it])V[it].count++;else{var dt={source:qe,target:Ve,count:1};V[it]=dt,R.push(dt)}}),{clusters:b,clusterEdges:R}},ky=function(e,r){var n=new ta(r),a=n.norm2(),i=new ta(e),o=i.norm2(),s=n.dot(i),u=a*o,f=u?s/u:0;return f},_A=function(e,r,n,a,i){e===void 0&&(e=[]),n===void 0&&(n=void 0),a===void 0&&(a=[]),i===void 0&&(i=[]);var o=rr(e.filter(function(h){return h.id!==r.id})),s=e.findIndex(function(h){return h.id===r.id}),u=Cy(e,n),f=Ty(u,a,i),l=f[s],c=[];return o.forEach(function(h,d){if(h.id!==r.id){var v=f[d],p=ky(v,l);c.push(p),h.cosineSimilarity=p}}),o.sort(function(h,d){return d.cosineSimilarity-h.cosineSimilarity}),{allCosineSimilarity:c,similarNodes:o}},CG=function(){function t(e){this.count=e.length,this.parent={};for(var r=0,n=e;r0&&(this.list[0]=r,this.moveDown(0)),e},t.prototype.insert=function(e){if(e!==null){this.list.push(e);var r=this.list.length-1;return this.moveUp(r),!0}return!1},t.prototype.moveUp=function(e){for(var r=this.getParent(e);e&&e>0&&this.compareFn(this.list[r],this.list[e])>0;){var n=this.list[r];this.list[r]=this.list[e],this.list[e]=n,e=r,r=this.getParent(e)}},t.prototype.moveDown=function(e){var r,n=e,a=this.getLeft(e),i=this.getRight(e),o=this.list.length;a!==null&&a0?n=a:i!==null&&i0&&(n=i),e!==n&&(r=[this.list[n],this.list[e]],this.list[e]=r[0],this.list[n]=r[1],this.moveDown(n))},t}(),kG=function(e,r){var n=[],a=e.nodes,i=a===void 0?[]:a,o=e.edges,s=o===void 0?[]:o;if(i.length===0)return n;var u=i[0],f=new Set;f.add(u);var l=function(g,y){return r?g.weight-y.weight:0},c=new IG(l);for(nh(u.id,s).forEach(function(p){c.insert(p)});!c.isEmpty();){var h=c.delMin(),d=h.source,v=h.target;f.has(d)&&f.has(v)||(n.push(h),f.has(d)||(f.add(d),nh(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),nh(v,s).forEach(function(p){c.insert(p)})))}return n},dw=function(e,r){var n=[],a=e.nodes,i=a===void 0?[]:a,o=e.edges,s=o===void 0?[]:o;if(i.length===0)return n;var u=s.map(function(d){return d});r&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new CG(i.map(function(d){return d.id}));u.length>0;){var l=u.shift(),c=l.source,h=l.target;f.connected(c,h)||(n.push(l),f.union(c,h))}return n},SA=function(e,r,n){var a={prim:kG,kruskal:dw};return n?a[n](e,r):dw(e,r)},MA=function(e,r,n){typeof r!="number"&&(r=1e-6),typeof n!="number"&&(n=.85);for(var a=1,i=0,o=1e3,s=e.nodes,u=s===void 0?[]:s,f=e.edges,l=f===void 0?[]:f,c=u.length,h,d={},v={},p=0;p0&&a>r;){i=0;for(var p=0;p0&&(h+=v[x]/E)}d[y]=n*h,i+=d[y]}}i=(1-i)/c,a=0;for(var p=0;p=0;n--){var a=this.dfsEdgeList[n],i=a.fromNode,o=a.toNode;id||a.hasNode(o[h.to])||(r.labelb;x--){var E=w(x);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new ko(p,m,Ga,_.edgeLabel,Ga));var S=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[S]!==o.dfsEdgeList[S]?!1:c(g[_.edgeLabel].projected)}var A={};y=!1;var M=0;h.forEach(function(L){var z=new ic(L),X=e.findForwardPureEdges(a,z.edges[d[0]],v,z);X.length>0&&(y=!0,M=p,X.forEach(function(R){var V="".concat(R.label,"-").concat(i[R.to].label);A[V]||(A[V]={projected:[],edgeLabel:R.label,nodeLabel2:i[R.to].label}),A[V].projected.push({graphId:a.id,edge:R,preNode:L})}))});for(var C=d.length,I=function(z){if(y)return"break";var X=d[z];h.forEach(function(R){var V=new ic(R),he=e.findForwardRmpathEdges(a,V.edges[X],v,V);he.length>0&&(y=!0,M=o.dfsEdgeList[X].fromNode,he.forEach(function(ce){var le="".concat(ce.label,"-").concat(i[ce.to].label);A[le]||(A[le]={projected:[],edgeLabel:ce.label,nodeLabel2:i[ce.to].label}),A[le].projected.push({graphId:a.id,edge:ce,preNode:R})}))})},x=0;x=0;v--){var p=r.findBackwardEdge(c,d.edges[i[v]],d.edges[i[0]],d);if(p){var g="".concat(r.dfsCode.dfsEdgeList[i[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:r.dfsCode.dfsEdgeList[i[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(a>=r.maxNodeNum)){var y=r.findForwardPureEdges(c,d.edges[i[0]],s,d);y.forEach(function(b){var w="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[w]||(u[w]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[w].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(w){var x=r.findForwardRmpathEdges(c,d.edges[i[w]],s,d);x.forEach(function(E){var _="".concat(r.dfsCode.dfsEdgeList[i[w]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:r.dfsCode.dfsEdgeList[i[w]].fromNode,edgeLabel:E.label,nodeLabel2:h[E.to].label}),u[_].projected.push({graphId:l.graphId,edge:E,preNode:l})})},v=0;vm){var b=m;m=y,y=b}var w=g.label,x="".concat(y,"-").concat(w,"-").concat(m);if(!o[x]){var E=o[x]||0;E++,o[x]=E}})})}),Object.keys(i).forEach(function(u){var f=i[u];if(!(f2*r)););if(g<2*r&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:i[l][p]},c++,u++,u>=n))return s;if(h++,h>2*r)break}if(ch&&(u=h);var d=n[c.id].inDegree;f>d&&(f=d);var v=n[c.id].outDegree;l>v&&(l=v)}),e[r]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},kA=function(e,r,n,a,i,o,s){var u;if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!e||!e.nodes)){var f=e.nodes.length;if(f){var l=Of(e,n),c=Of(r,n),h=ww(e.nodes,l,n),d=ww(r.nodes,c,n),v=mw(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=mw(r.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;bw(e.edges,s,p);var w=bw(r.edges,s,m).edgeLabelMap,x=[];c==null||c.forEach(function(tt){x=x.concat(tt)}),i||(i=Math.max.apply(Math,Xn(Xn([],x,!1),[2],!1))),a||(a=i);var E=yw(e,l,o,a),_=yw(r,c,o,a),S=Math.min(100,f*(f-1)/2),A=FG(a,f,S,E,l),M=ah(A,E,e),C=10,I=1,k=1,O=4,B={graphs:M,nodeLabelProp:o,edgeLabelProp:s,minSupport:I,minNodeNum:k,maxNodeNum:O,directed:n},L=RG(B).slice(0,C),z=L.length,X=[];L.forEach(function(tt,te){X[te]={},Object.keys(M).forEach(function(N){var Se=M[N],Fe=ih(Se,tt,o,s);X[te][N]=Fe})});var R=BG(X,z,L),V=R.structure,he=R.structureCountMap,ce=r.nodes[0],le=[],ie=(u=r.nodes[0])===null||u===void 0?void 0:u[o],Ie=-1/0;r.nodes.forEach(function(tt){var te=tt[o],N=g[te];(N==null?void 0:N.length)>Ie&&(Ie=N.length,le=N,ie=te,ce=tt)});var qe={},Ve={},it={},dt={},st={},Tt={};Object.keys(b).forEach(function(tt,te){st[tt]=[],n&&(Tt[tt]=[]);var N=b[tt],Se={};N.forEach(function(Ze){var Je=d["".concat(ce.id,"-").concat(Ze.id)];if(Je&&st[tt].push(Je),Se["".concat(ce.id,"-").concat(Ze.id)]={start:0,end:m[Ze.id].idx,distance:Je},n){var ht=d["".concat(Ze.id,"-").concat(ce.id)];ht&&Tt[tt].push(ht)}}),st[tt]=st[tt].sort(function(Ze,Je){return Ze-Je}),n&&(Tt[tt]=Tt[tt].sort(function(Ze,Je){return Ze-Je})),Ve=ah(Se,_,r,Ve);var Fe=[];if(Object.keys(Se).forEach(function(Ze){if(it[Ze]){Fe.push(it[Ze]);return}var Je=Ve[Ze];it[Ze]=ih(Je,V,o,s),Fe.push(it[Ze])}),Fe=Fe.sort(function(Ze,Je){return Je-Ze}),dt["".concat(ce.id,"-").concat(tt)]=Fe,tt!==ie)for(var ge=(le==null?void 0:le.length)||0,Ue=function(Je){var ht=le[Je],Lt=E[p[ht.id].idx],ur=Lt.nodeLabelCountMap[tt],Dt=b[tt].length;if(!ur||ur.countst[tt][or]){fr=!0;break}if(fr)return le.splice(Je,1),"continue";var gr={};Lt.neighbors.forEach(function(nr){var Fr=h["".concat(ht.id,"-").concat(nr.id)];gr["".concat(ht.id,"-").concat(nr.id)]={start:p[ht.id].idx,end:p[nr.id].idx,distance:Fr}}),M=ah(gr,E,e,M);var hr=[];Object.keys(gr).forEach(function(nr){if(he[nr]){hr.push(he[nr]);return}var Fr=M[nr];he[nr]=ih(Fr,V,o,s),hr.push(he[nr])}),hr=hr.sort(function(nr,Fr){return Fr-nr});for(var hn=!1,or=0;or=0;$e--)Ue($e)});var _t=[];le==null||le.forEach(function(tt){for(var te=p[tt.id].idx,N=IA(e.nodes,l[te],te,o,i),Se=N.neighbors,Fe=Se.length,ge=!1,Ue=Fe-1;Ue>=0;Ue--){if(Se.length+1ur){Se.splice(Ue,1);continue}if(n){var Dt="".concat($e.id,"-").concat(tt.id),fr=h[Dt];Lt=Tt[Ze].length-1;var or=Tt[Ze][Lt];if(fr>or){Se.splice(Ue,1);continue}}var gr=he[Je]?he[Je]:GG(e,tt,$e,p,ht,E,V,o,s,he,M),hr="".concat(ce.id,"-").concat(Ze),hn=dt[hr][dt[hr].length-1];if(gr=0;ht--){var or=fr(ht);if(or==="break")break}if(Dt)return _t.splice(te,1),"continue";N.edges=Ue;var gr=Nf(N,N.nodes[0].id,!1).length;if(Object.keys(gr).reverse().forEach(function(St){if(!(St===N.nodes[0].id||Dt)){if(gr[St]===1/0){var dr=ge[St].node[o];if(Fe[dr]--,Fe[dr]Bt[Sr][Bt[Sr].length-1]){var dr=ge[St].node[o];if(Fe[dr]--,Fe[dr]=0;oa--){var Ur=N.nodes[oa],Mi=ge[Ur.id].degree,xu=ge[Ur.id].inDegree,Eu=ge[Ur.id].outDegree,rn=Ur[o],ti=xw(qe,rn,m,b),uo=ti.minPatternNodeLabelDegree,_u=ti.minPatternNodeLabelInDegree,Su=ti.minPatternNodeLabelOutDegree,Mu=n?Mi=0;sa--){var Br=Ue[sa];if(!ge[Br.source]||!ge[Br.target]){Ue.splice(sa,1);var ua=Br[s];if($e[ua]--,ge[Br.source]&&(ge[Br.source].degree--,ge[Br.source].outDegree--),ge[Br.target]&&(ge[Br.target].degree--,ge[Br.target].inDegree--),w[ua]&&$e[ua]=0;cr--){var $t=vr(cr);if($t==="break")break}for(var sr=_t.length,tn=function(te){var N=_t[te],Se={};N.edges.forEach(function(Ue){var $e="".concat(Ue.source,"-").concat(Ue.target,"-").concat(Ue.label);Se[$e]?Se[$e]++:Se[$e]=1});for(var Fe=function($e){var Ze=_t[$e],Je={};Ze.edges.forEach(function(Lt){var ur="".concat(Lt.source,"-").concat(Lt.target,"-").concat(Lt.label);Je[ur]?Je[ur]++:Je[ur]=1});var ht=!0;Object.keys(Je).length!==Object.keys(Se).length?ht=!1:Object.keys(Se).forEach(function(Lt){Je[Lt]!==Se[Lt]&&(ht=!1)}),ht&&_t.splice($e,1)},ge=sr-1;ge>te;ge--)Fe(ge);sr=_t.length},cr=0;cr<=sr-1;cr++)tn(cr);return _t}}},Gs=function(){function t(e){e===void 0&&(e=10),this.linkedList=new uA,this.maxStep=e}return Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(e){this.linkedList.prepend(e),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var e=this.linkedList.deleteHead();return e?e.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map(function(e){return e.value})},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},t}(),NA=Sy;const zG={getAdjMatrix:Uo,breadthFirstSearch:lA,connectedComponent:Ey,getDegree:yi,getInDegree:hA,getOutDegree:dA,detectCycle:Sy,detectDirectedCycle:NA,detectAllCycles:pA,detectAllDirectedCycle:Ay,detectAllUndirectedCycle:My,depthFirstSearch:_y,dijkstra:Nf,findAllPath:mA,findShortestPath:yA,floydWarshall:Of,labelPropagation:bA,louvain:Iy,iLouvain:wA,kCore:xA,kMeans:EA,cosineSimilarity:ky,nodesCosineSimilarity:_A,minimumSpanningTree:SA,pageRank:MA,getNeighbors:Un,Stack:Gs,GADDI:kA},jG=Object.freeze(Object.defineProperty({__proto__:null,GADDI:kA,Stack:Gs,breadthFirstSearch:lA,connectedComponent:Ey,cosineSimilarity:ky,default:zG,depthFirstSearch:_y,detectAllCycles:pA,detectAllDirectedCycle:Ay,detectAllUndirectedCycle:My,detectCycle:Sy,detectDirectedCycle:NA,dijkstra:Nf,findAllPath:mA,findShortestPath:yA,floydWarshall:Of,getAdjMatrix:Uo,getDegree:yi,getInDegree:hA,getNeighbors:Un,getOutDegree:dA,iLouvain:wA,kCore:xA,kMeans:EA,labelPropagation:bA,louvain:Iy,minimumSpanningTree:SA,nodesCosineSimilarity:_A,pageRank:MA},Symbol.toStringTag,{value:"Module"}));var Nh=eo,UG=function(e){return function(r,n){return r[e]-n[e]}},Ew=function(e,r,n){return e>=r&&e<=n},xd=function(e,r,n,a){var i=1e-4,o={x:n.x-e.x,y:n.y-e.y},s={x:r.x-e.x,y:r.y-e.y},u={x:a.x-n.x,y:a.y-n.y},f=s.x*u.y-s.y*u.x,l=f*f,c=1/f,h=s.x*s.x+s.y*s.y,d=u.x*u.x+u.y*u.y;if(l>i*h*d){var v=(o.x*u.y-o.y*u.x)*c,p=(o.x*s.y-o.y*s.x)*c;return!Ew(v,0,1)||!Ew(p,0,1)?null:{x:e.x+v*s.x,y:e.y+v*s.y}}return null},OA=function(e,r){var n=e.x,a=e.y,i=e.width,o=e.height,s=n+i/2,u=a+o/2,f=[],l={x:s,y:u};f.push({x:n,y:a}),f.push({x:n+i,y:a}),f.push({x:n+i,y:a+o}),f.push({x:n,y:a+o}),f.push({x:n,y:a});for(var c=null,h=1;hr[a][o]+r[o][i]&&(r[a][i]=r[a][o]+r[o][i]);return r},WG=function(e,r){var n=e.nodes,a=e.edges,i=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];i.push(f)}),a&&a.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];i[l][c]=1,r||(i[c][l]=1)}),i},RA=function(e,r){e.translate(r.x,r.y)},_0=function(e,r,n,a){a===void 0&&(a={duration:500});var i=e.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var o=e.getCanvasBBox(),s=r.x-o.minX,u=r.y-o.minY;if(n){var f=s*i[0],l=u*i[4],c=0,h=0,d=0,v=0;e.animate(function(g){return d=f*g,v=l*g,i=Nh(i,[["t",d-c,v-h]]),c=d,h=v,{matrix:i}},a)}else{var p=Nh(i,[["t",s,u]]);e.setMatrix(p)}},VG=function(e,r){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var a=r;bt(r)||(a=[r,r]),bt(r)&&r.length===1&&(a=[r[0],r[0]]),n=Nh(n,[["s",a[0],a[1]]]),e.setMatrix(n)},YG=function(e,r){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=Nh(n,[["r",r]]),e.setMatrix(n)},qG=function(e,r,n){for(var a=[],i=0;i0!=s(l[1]-n)>0&&s(r-(n-f[1])*(f[0]-l[0])/(f[1]-l[1])-f[0])<0&&(a=!a)}return a},FA=function(e,r){return!(r.minX>e.maxX||r.maxXe.maxY||r.maxY1){var m=h[0],b=h[v-1];d.push({from:{x:b[0],y:b[1]},to:{x:m[0],y:m[1]}})}return d};if(e.length<2||r.length<2)return!1;var i=n(e),o=n(r);if(!FA(i,o))return!1;var s=!1;if(_e(r,function(c){if(Lf(e,c[0],c[1]))return s=!0,!1}),s||(_e(e,function(c){if(Lf(r,c[0],c[1]))return s=!0,!1}),s))return!0;var u=a(e),f=a(r),l=!1;return _e(f,function(c){if(ZG(u,c))return l=!0,!1}),l},$o=function(){function t(e,r,n,a){this.x1=e,this.y1=r,this.x2=n,this.y2=a}return t.prototype.getBBox=function(){var e=Math.min(this.x1,this.x2),r=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),a=Math.max(this.y1,this.y2),i={x:e,y:r,minX:e,minY:r,maxX:n,maxY:a,width:n-e,height:a-r};return i},t}(),Ny=function(e,r){var n={top:[e.minX,e.minY,e.maxX,e.minY],left:[e.minX,e.minY,e.minX,e.maxY],bottom:[e.minX,e.maxY,e.maxX,e.maxY],right:[e.maxX,e.minY,e.maxX,e.maxY]};return n[r]},KG=function(e,r){var n=(r.x2-r.x1)*(e.y1-r.y1)-(r.y2-r.y1)*(e.x1-r.x1),a=(e.x2-e.x1)*(e.y1-r.y1)-(e.y2-e.y1)*(e.x1-r.x1),i=(r.y2-r.y1)*(e.x2-e.x1)-(r.x2-r.x1)*(e.y2-e.y1);if(i){var o=n/i,s=a/i;if(o>=0&&o<=1&&s>=0&&s<=1)return o}return Number.POSITIVE_INFINITY},GA=function(e,r){for(var n=["top","left","bottom","right"],a=e.getBBox(),i=0,o=[],s=0;s<4;s++){var u=Ny(a,n[s]),f=u[0],l=u[1],c=u[2],h=u[3];o[s]=xd({x:r.x1,y:r.y1},{x:r.x2,y:r.y2},{x:f,y:l},{x:c,y:h}),o[s]&&(i+=1)}return[o,i]},Oy=function(e,r){for(var n=["top","left","bottom","right"],a=e.getBBox(),i=Number.POSITIVE_INFINITY,o=0,s=0;s<4;s++){var u=Ny(a,n[s]),f=u[0],l=u[1],c=u[2],h=u[3],d=KG(r,new $o(f,l,c,h));d=Math.abs(d-.5),d>=0&&d<=1&&(o+=1,i=d0){for(var a=0,i=e;ar.x+r.width,i=e.y>r.y+r.height,o=e.y":.604998779296875,"/":.5,"?":.53699951171875};var Pa=Math.PI,A0=Math.sin,C0=Math.cos,sn=A0(Pa/8),un=C0(Pa/8),Dh=function(e,r){var n=e.getBBox(),a={x:n.minX,y:n.minY},i={x:n.maxX,y:n.maxY};if(r){var o=r.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),a=Us(a,o),i=Us(i,o)}var s=a.x,u=a.y,f=i.x,l=i.y;return{x:s,y:u,minX:s,minY:u,maxX:f,maxY:l,width:f-s,height:l-u}},$A=function(e){var r=e.sourceNode||e.targetNode,n=r.get("group"),a=n.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]);var i=r.getKeyShape(),o=i.getBBox(),s=e.loopCfg||{},u=s.dist||Math.max(o.width,o.height)*2,f=s.position||ft.defaultLoopPosition,l=[(o.minX+o.maxX)/2+a[6],(o.minY+o.maxY)/2+a[7]],c=[e.startPoint.x,e.startPoint.y],h=[e.endPoint.x,e.endPoint.y],d=o.height/2,v=o.width/2,p=d,g=d,y=p*sn,m=p*un,b=g*sn,w=g*un,x=i.get("type"),E=Math.min(d/2,v/2),_=Math.min(d,v),S=s!=null&&s.pointPadding?Math.min(_,s==null?void 0:s.pointPadding):E;if(c[0]===h[0]&&c[1]===h[1]){switch(f){case"top":x==="circle"?(c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-w]):(c=[l[0]-S,l[1]-d],h=[l[0]+S,l[1]-d]);break;case"top-right":p=d,g=v,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]+y,l[1]-m],h=[l[0]+w,l[1]-b]):(c=[l[0]+v-S,l[1]-d],h=[l[0]+v,l[1]-d+S]);break;case"right":p=v,g=v,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]+m,l[1]-y],h=[l[0]+w,l[1]+b]):(c=[l[0]+v,l[1]-S],h=[l[0]+v,l[1]+S]);break;case"bottom-right":p=v,g=d,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]+m,l[1]+y],h=[l[0]+b,l[1]+w]):(c=[l[0]+v,l[1]+d-S],h=[l[0]+v-S,l[1]+d]);break;case"bottom":p=d,g=d,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]+y,l[1]+m],h=[l[0]-b,l[1]+w]):(c=[l[0]-S,l[1]+d],h=[l[0]+S,l[1]+d]);break;case"bottom-left":p=d,g=v,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]-y,l[1]+m],h=[l[0]-w,l[1]+b]):(c=[l[0]-v,l[1]+d-S],h=[l[0]-v+S,l[1]+d]);break;case"left":p=v,g=v,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]-m,l[1]+y],h=[l[0]-w,l[1]-b]):(c=[l[0]-v,l[1]-S],h=[l[0]-v,l[1]+S]);break;case"top-left":p=v,g=d,x==="circle"?(y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]-m,l[1]-y],h=[l[0]-b,l[1]-w]):(c=[l[0]-v+S,l[1]-d],h=[l[0]-v,l[1]-d+S]);break;default:p=v,g=v,y=p*sn,m=p*un,b=g*sn,w=g*un,c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-w]}if(s.clockwise===!1){var A=[c[0],c[1]];c=[h[0],h[1]],h=[A[0],A[1]]}}var M=[c[0]-l[0],c[1]-l[1]],C=(p+u)/p,I=(g+u)/g;s.clockwise===!1&&(C=(g+u)/g,I=(p+u)/p);var k=wn([0,0],M,C),O=[l[0]+k[0],l[1]+k[1]],B=[h[0]-l[0],h[1]-l[1]],L=wn([0,0],B,I),z=[l[0]+L[0],l[1]+L[1]];return e.startPoint={x:c[0],y:c[1]},e.endPoint={x:h[0],y:h[1]},e.controlPoints=[{x:O[0],y:O[1]},{x:z[0],y:z[1]}],e},XA=function(e,r,n,a,i){var o=1e-4,s=[],u=e==null?void 0:e.getPoint(r);if(!u)return{x:0,y:0,angle:0};if(r1-o)s=e.getEndTangent();else{var f=e==null?void 0:e.getPoint(r+o);s.push([u.x,u.y]),s.push([f.x,f.y])}var l=Math.atan2(s[1][1]-s[0][1],s[1][0]-s[0][0]);if(l<0&&(l+=Pa*2),n&&(u.x+=C0(l)*n,u.y+=A0(l)*n),a){var c=l-Pa/2;l>1/2*Pa&&l<3*1/2*Pa&&(c-=Pa),u.x+=C0(c)*a,u.y+=A0(c)*a}var h={x:u.x,y:u.y,angle:l};return i?(l>.5*Pa&&l<1.5*Pa&&(l-=Pa),P({rotate:l},h)):h},oz=function t(e,r,n,a){if(a(e,r,n)===!1)return!1;if(e&&e.children){for(var i=e.children.length-1;i>=0;i--)if(!t(e.children[i],e,i,a))return!1}return!0},sz=function t(e,r,n,a){if(e&&e.children){for(var i=e.children.length-1;i>=0;i--)if(!t(e.children[i],e,i,a))return}return a(e,r,n)!==!1},bn=function(e,r){typeof r=="function"&&oz(e,null,-1,r)},Ra=function(e,r){typeof r=="function"&&sz(e,null,-1,r)},WA=function(e,r){return r*(iz[e]||1)},VA=function(e,r){var n=0,a=new RegExp("[一-龥]+");return e.split("").forEach(function(i){a.test(i)?n+=r:n+=WA(i,r)}),[n,r]},YA=function(e,r){return typeof r!="number"||r<=0||r>=e.length?e:e.substring(0,r)+"..."},T0=function(e,r){var n=[],a={},i={};e.forEach(function(u){i[u.id]=u}),e.forEach(function(u,f){var l=rr(u);l.itemType="combo",l.children=void 0,l.parentId===l.id?(console.warn("The parentId for combo ".concat(l.id," can not be the same as the combo's id")),delete l.parentId):l.parentId&&!i[l.parentId]&&(console.warn("The parent combo for combo ".concat(l.id," does not exist!")),delete l.parentId);var c=a[l.id];if(c){if(l.children=c.children,a[l.id]=l,c=l,!c.parentId){n.push(c);return}var h=a[c.parentId];if(h)h.children?h.children.push(l):h.children=[l];else{var d={id:c.parentId,children:[c]};a[c.parentId]=d,a[l.id]=l}return}if(Ye(u.parentId)){var v=a[u.parentId];if(v)v.children?v.children.push(l):v.children=[l],a[l.id]=l;else{var p={id:u.parentId,children:[l]};a[p.id]=p,a[l.id]=l}}else n.push(l),a[l.id]=l});var o={};(r||[]).forEach(function(u){o[u.id]=u;var f=a[u.comboId];if(f){var l={id:u.id,comboId:u.comboId};f.children?f.children.push(l):f.children=[l],l.itemType="node",a[u.id]=l}});var s=0;return n.forEach(function(u){u.depth=s+10,bn(u,function(f){var l,c=a[f.id].itemType;c==="node"?l=a[f.comboId]:l=a[f.parentId],l&&c==="node"?f.depth=s+1:f.depth=s+10,s-1&&i.splice(l,1),u||(o={id:r,itemType:"node",comboId:n},s[r]={children:void 0}),r){var c=!1;if(n){var h=0;(e||[]).forEach(function(v){c||bn(v,function(p){return n===p.id?(c=!0,p.children?p.children.push(o):p.children=[o],h=p.depth,o.itemType==="node"?o.depth=h+2:o.depth=h+1,!1):!0})})}else(!n||!c)&&o.itemType!=="node"&&e.push(o);var d=o.depth;bn(o,function(v){return v.itemType==="node"?d+=2:d+=1,v.depth=d,!0})}return e},oh=function(e,r,n){var a={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,x:void 0,y:void 0,width:void 0,height:void 0,centerX:void 0,centerY:void 0};if(!e||e.length===0){var i=n==null?void 0:n.getModel(),o=i||{},s=o.x,u=o.y,f=o.fixSize,l=o.collapsed,c=o.fixCollapseSize,h=l?c:f,d=bt(h)?h:[h,h],v=d[0],p=d[1],g=[v/2,p/2];return{minX:s-g[0],minY:u-g[1],maxX:s+g[0],maxY:u+g[1],x:s,y:u,width:v,height:p}}return e.forEach(function(y){var m=r.findById(y.id);if(!(!m||!m.isVisible())){m.set("bboxCanvasCache",void 0);var b=m.getCanvasBBox();b.x&&a.minX>b.minX&&(a.minX=b.minX),b.y&&a.minY>b.minY&&(a.minY=b.minY),b.x&&a.maxX2&&(r.push([a].concat(o.splice(0,2))),s="l",a=a==="m"?"l":"L"),s==="o"&&o.length===1&&r.push([a,o[0]]),s==="r")r.push([a].concat(o));else for(;o.length>=e[s]&&(r.push([a].concat(o.splice(0,e[s]))),!!e[s]););return t}),r},k0=function(t,e){for(var r=[],n=0,a=t.length;a-2*!e>n;n+=2){var i=[{x:+t[n-2],y:+t[n-1]},{x:+t[n],y:+t[n+1]},{x:+t[n+2],y:+t[n+3]},{x:+t[n+4],y:+t[n+5]}];e?n?a-4===n?i[3]={x:+t[0],y:+t[1]}:a-2===n&&(i[2]={x:+t[0],y:+t[1]},i[3]={x:+t[2],y:+t[3]}):i[0]={x:+t[a-2],y:+t[a-1]}:a-4===n?i[3]=i[2]:n||(i[0]={x:+t[n],y:+t[n+1]}),r.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return r},uc=function(t,e,r,n,a){var i=[];if(a===null&&n===null&&(n=r),t=+t,e=+e,r=+r,n=+n,a!==null){var o=Math.PI/180,s=t+r*Math.cos(-n*o),u=t+r*Math.cos(-a*o),f=e+r*Math.sin(-n*o),l=e+r*Math.sin(-a*o);i=[["M",s,f],["A",r,r,0,+(a-n>180),0,u,l]]}else i=[["M",t,e],["m",0,-n],["a",r,n,0,1,1,0,2*n],["a",r,n,0,1,1,0,-2*n],["z"]];return i},N0=function(t){if(t=zs(t),!t||!t.length)return[["M",0,0]];var e=[],r=0,n=0,a=0,i=0,o=0,s,u;t[0][0]==="M"&&(r=+t[0][1],n=+t[0][2],a=r,i=n,o++,e[0]=["M",r,n]);for(var f=t.length===3&&t[0][0]==="M"&&t[1][0].toUpperCase()==="R"&&t[2][0].toUpperCase()==="Z",l=void 0,c=void 0,h=o,d=t.length;h1&&(x=Math.sqrt(x),r=x*r,n=x*n);var E=r*r,_=n*n,S=(i===o?-1:1)*Math.sqrt(Math.abs((E*_-E*w*w-_*b*b)/(E*w*w+_*b*b)));g=S*r*w/n+(t+s)/2,y=S*-n*b/r+(e+u)/2,v=Math.asin(((e-y)/n).toFixed(9)),p=Math.asin(((u-y)/n).toFixed(9)),v=tp&&(v=v-Math.PI*2),!o&&p>v&&(p=p-Math.PI*2)}var A=p-v;if(Math.abs(A)>l){var M=p,C=s,I=u;p=v+l*(o&&p>v?1:-1),s=g+r*Math.cos(p),u=y+n*Math.sin(p),h=qA(s,u,r,n,a,0,o,C,I,[p,M,g,y])}A=p-v;var k=Math.cos(v),O=Math.sin(v),B=Math.cos(p),L=Math.sin(p),z=Math.tan(A/4),X=4/3*r*z,R=4/3*n*z,V=[t,e],he=[t+X*O,e-R*k],ce=[s+X*L,u-R*B],le=[s,u];if(he[0]=2*V[0]-he[0],he[1]=2*V[1]-he[1],f)return[he,ce,le].concat(h);h=[he,ce,le].concat(h).join().split(",");for(var ie=[],Ie=0,qe=h.length;Ie7){b[w].shift();for(var x=b[w];x.length;)o[w]="A",n&&(s[w]="A"),b.splice(w++,0,["C"].concat(x.splice(0,6)));b.splice(w,1),l=Math.max(r.length,n&&n.length||0)}},d=function(b,w,x,E,_){b&&w&&b[_][0]==="M"&&w[_][0]!=="M"&&(w.splice(_,0,["M",E.x,E.y]),x.bx=0,x.by=0,x.x=b[_][1],x.y=b[_][2],l=Math.max(r.length,n&&n.length||0))};l=Math.max(r.length,n&&n.length||0);for(var v=0;v1?1:u<0?0:u;for(var f=u/2,l=12,c=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,v=0;v0&&d<1&&u.push(d);continue}var p=c*c-4*h*l,g=Math.sqrt(p);if(!(p<0)){var y=(-c+g)/(2*l);y>0&&y<1&&u.push(y);var m=(-c-g)/(2*l);m>0&&m<1&&u.push(m)}}for(var b=u.length,w=b,x;b--;)d=u[b],x=1-d,f[0][b]=x*x*x*t+3*x*x*d*r+3*x*d*d*a+d*d*d*o,f[1][b]=x*x*x*e+3*x*x*d*n+3*x*d*d*i+d*d*d*s;return f[0][w]=t,f[1][w]=e,f[0][w+1]=o,f[1][w+1]=s,f[0].length=f[1].length=w+2,{min:{x:Math.min.apply(0,f[0]),y:Math.min.apply(0,f[1])},max:{x:Math.max.apply(0,f[0]),y:Math.max.apply(0,f[1])}}},gz=function(t,e,r,n,a,i,o,s){if(!(Math.max(t,r)Math.max(a,o)||Math.max(e,n)Math.max(i,s))){var u=(t*n-e*r)*(a-o)-(t-r)*(a*s-i*o),f=(t*n-e*r)*(i-s)-(e-n)*(a*s-i*o),l=(t-r)*(i-s)-(e-n)*(a-o);if(l){var c=u/l,h=f/l,d=+c.toFixed(2),v=+h.toFixed(2);if(!(d<+Math.min(t,r).toFixed(2)||d>+Math.max(t,r).toFixed(2)||d<+Math.min(a,o).toFixed(2)||d>+Math.max(a,o).toFixed(2)||v<+Math.min(e,n).toFixed(2)||v>+Math.max(e,n).toFixed(2)||v<+Math.min(i,s).toFixed(2)||v>+Math.max(i,s).toFixed(2)))return{x:c,y:h}}}},Oi=function(t,e,r){return e>=t.x&&e<=t.x+t.width&&r>=t.y&&r<=t.y+t.height},ZA=function(t,e,r,n,a){if(a)return[["M",+t+ +a,e],["l",r-a*2,0],["a",a,a,0,0,1,a,a],["l",0,n-a*2],["a",a,a,0,0,1,-a,a],["l",a*2-r,0],["a",a,a,0,0,1,-a,-a],["l",0,a*2-n],["a",a,a,0,0,1,a,-a],["z"]];var i=[["M",t,e],["l",r,0],["l",0,n],["l",-r,0],["z"]];return i.parsePathArray=HA,i},L0=function(t,e,r,n){return t===null&&(t=e=r=n=0),e===null&&(e=t.y,r=t.width,n=t.height,t=t.x),{x:t,y:e,width:r,w:r,height:n,h:n,x2:t+r,y2:e+n,cx:t+r/2,cy:e+n/2,r1:Math.min(r,n)/2,r2:Math.max(r,n)/2,r0:Math.sqrt(r*r+n*n)/2,path:ZA(t,e,r,n),vb:[t,e,r,n].join(" ")}},yz=function(t,e){return t=L0(t),e=L0(e),Oi(e,t.x,t.y)||Oi(e,t.x2,t.y)||Oi(e,t.x,t.y2)||Oi(e,t.x2,t.y2)||Oi(t,e.x,e.y)||Oi(t,e.x2,e.y)||Oi(t,e.x,e.y2)||Oi(t,e.x2,e.y2)||(t.xe.x||e.xt.x)&&(t.ye.y||e.yt.y)},Nw=function(t,e,r,n,a,i,o,s){bt(t)||(t=[t,e,r,n,a,i,o,s]);var u=pz.apply(null,t);return L0(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},Ow=function(t,e,r,n,a,i,o,s,u){var f=1-u,l=Math.pow(f,3),c=Math.pow(f,2),h=u*u,d=h*u,v=l*t+c*3*u*r+f*3*u*u*a+d*o,p=l*e+c*3*u*n+f*3*u*u*i+d*s,g=t+2*u*(r-t)+h*(a-2*r+t),y=e+2*u*(n-e)+h*(i-2*n+e),m=r+2*u*(a-r)+h*(o-2*a+r),b=n+2*u*(i-n)+h*(s-2*i+n),w=f*t+u*r,x=f*e+u*n,E=f*a+u*o,_=f*i+u*s,S=90-Math.atan2(g-m,y-b)*180/Math.PI;return{x:v,y:p,m:{x:g,y},n:{x:m,y:b},start:{x:w,y:x},end:{x:E,y:_},alpha:S}},mz=function(t,e,r){var n=Nw(t),a=Nw(e);if(!yz(n,a))return[];for(var i=kw.apply(0,t),o=kw.apply(0,e),s=~~(i/8),u=~~(o/8),f=[],l=[],c={},h=[],d=0;d=0&&_<=1&&S>=0&&S<=1&&h.push({x:E.x,y:E.y,t1:_,t2:S})}}return h},bz=function(t,e,r){t=O0(t),e=O0(e);for(var n,a,i,o,s,u,f,l,c,h,d=r?0:[],v=0,p=t.length;v=3&&(c.length===3&&h.push("Q"),h=h.concat(c[1])),c.length===2&&h.push("L"),h=h.concat(c[c.length-1]),h});return l}var _z=function(t,e,r){if(r===1)return[[].concat(t)];var n=[];if(e[0]==="L"||e[0]==="C"||e[0]==="Q")n=n.concat(Ez(t,e,r));else{var a=[].concat(t);a[0]==="M"&&(a[0]="L");for(var i=0;i<=r-1;i++)n.push(a)}return n},Sz=function(t,e){if(t.length===1)return t;var r=t.length-1,n=e.length-1,a=r/n,i=[];if(t.length===1&&t[0][0]==="M"){for(var o=0;o=0;u--)o=i[u].index,i[u].type==="add"?t.splice(o,0,[].concat(t[o])):t.splice(o,1)}n=t.length;var c=a-n;if(n0)r=cp(r,t[n-1],1);else{t[n]=e[n];break}t[n]=["Q"].concat(r.reduce(function(a,i){return a.concat(i)},[]));break;case"T":t[n]=["T"].concat(r[0]);break;case"C":if(r.length<3)if(n>0)r=cp(r,t[n-1],2);else{t[n]=e[n];break}t[n]=["C"].concat(r.reduce(function(a,i){return a.concat(i)},[]));break;case"S":if(r.length<2)if(n>0)r=cp(r,t[n-1],1);else{t[n]=e[n];break}t[n]=["S"].concat(r.reduce(function(a,i){return a.concat(i)},[]));break;default:t[n]=e[n]}return t};const Tz=Object.freeze(Object.defineProperty({__proto__:null,catmullRomToBezier:k0,fillPath:Sz,fillPathByDiff:KA,formatPath:D0,intersection:wz,parsePathArray:HA,parsePathString:zs,pathToAbsolute:N0,pathToCurve:O0,rectPath:ZA},Symbol.toStringTag,{value:"Module"}));var JA=function(){function t(e,r){this.bubbles=!0,this.target=null,this.currentTarget=null,this.delegateTarget=null,this.delegateObject=null,this.defaultPrevented=!1,this.propagationStopped=!1,this.shape=null,this.fromShape=null,this.toShape=null,this.propagationPath=[],this.type=e,this.name=e,this.originalEvent=r,this.timeStamp=r.timeStamp}return t.prototype.preventDefault=function(){this.defaultPrevented=!0,this.originalEvent.preventDefault&&this.originalEvent.preventDefault()},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t.prototype.toString=function(){var e=this.type;return"[Event (type="+e+")]"},t.prototype.save=function(){},t.prototype.restore=function(){},t}();function eC(t,e){var r=t.indexOf(e);r!==-1&&t.splice(r,1)}var Lw=typeof window<"u"&&typeof window.document<"u";function tC(t,e){if(t.isCanvas())return!0;for(var r=e.getParent(),n=!1;r;){if(r===t){n=!0;break}r=r.getParent()}return n}function P0(t){return t.cfg.visible&&t.cfg.capture}var Iz=function(t){jt(e,t);function e(r){var n=t.call(this)||this;n.destroyed=!1;var a=n.getDefaultCfg();return n.cfg=Et(a,r),n}return e.prototype.getDefaultCfg=function(){return{}},e.prototype.get=function(r){return this.cfg[r]},e.prototype.set=function(r,n){this.cfg[r]=n},e.prototype.destroy=function(){this.cfg={destroyed:!0},this.off(),this.destroyed=!0},e}(KS),Dw=function(t,e,r){if(r||arguments.length===2)for(var n=0,a=e.length,i;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Dz:typeof navigator<"u"?Gz(navigator.userAgent):jz()}function Bz(t){return t!==""&&Fz.reduce(function(e,r){var n=r[0],a=r[1];if(e)return e;var i=a.exec(t);return!!i&&[n,i]},!1)}function Gz(t){var e=Bz(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new Lz;var a=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);a?a.lengtho.delay&&_e(e.toAttrs,function(s,u){i.call(o.toAttrs,u)&&(delete o.toAttrs[u],delete o.fromAttrs[u])})}),t}var aC=function(t){jt(e,t);function e(r){var n=t.call(this,r)||this;n.attrs={};var a=n.getDefaultAttrs();return Et(a,r.attrs),n.attrs=a,n.initAttrs(a),n.initAnimate(),n}return e.prototype.getDefaultCfg=function(){return{visible:!0,capture:!0,zIndex:0}},e.prototype.getDefaultAttrs=function(){return{matrix:this.getDefaultMatrix(),opacity:1}},e.prototype.onCanvasChange=function(r){},e.prototype.initAttrs=function(r){},e.prototype.initAnimate=function(){this.set("animable",!0),this.set("animating",!1)},e.prototype.isGroup=function(){return!1},e.prototype.getParent=function(){return this.get("parent")},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.attr=function(){for(var r,n=[],a=0;a0?i=Zz(i,w):a.addAnimator(this),i.push(w),this.set("animations",i),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(r){var n=this;r===void 0&&(r=!0);var a=this.get("animations");_e(a,function(i){r&&(i.onFrame?n.attr(i.onFrame(1)):n.attr(i.toAttrs)),i.callback&&i.callback()}),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var r=this.get("timeline"),n=this.get("animations"),a=r.getTime();return _e(n,function(i){i._paused=!0,i._pauseTime=a,i.pauseCallback&&i.pauseCallback()}),this.set("_pause",{isPaused:!0,pauseTime:a}),this},e.prototype.resumeAnimate=function(){var r=this.get("timeline"),n=r.getTime(),a=this.get("animations"),i=this.get("_pause").pauseTime;return _e(a,function(o){o.startTime=o.startTime+(n-i),o._paused=!1,o._pauseTime=null,o.resumeCallback&&o.resumeCallback()}),this.set("_pause",{isPaused:!1}),this.set("animations",a),this},e.prototype.emitDelegation=function(r,n){var a=this,i=n.propagationPath;this.getEvents();var o;r==="mouseenter"?o=n.fromShape:r==="mouseleave"&&(o=n.toShape);for(var s=function(c){var h=i[c],d=h.get("name");if(d){if((h.isGroup()||h.isCanvas&&h.isCanvas())&&o&&tC(h,o))return"break";bt(d)?_e(d,function(v){a.emitDelegateEvent(h,v,n)}):u.emitDelegateEvent(h,d,n)}},u=this,f=0;f0)});o.length>0?_e(o,function(u){var f=u.getBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;ln&&(n=c),hi&&(i=d)}):(r=0,n=0,a=0,i=0);var s={x:r,y:a,minX:r,minY:a,maxX:n,maxY:i,width:n-r,height:i-a};return s},e.prototype.getCanvasBBox=function(){var r=1/0,n=-1/0,a=1/0,i=-1/0,o=this.getChildren().filter(function(u){return u.get("visible")&&(!u.isGroup()||u.isGroup()&&u.getChildren().length>0)});o.length>0?_e(o,function(u){var f=u.getCanvasBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;ln&&(n=c),hi&&(i=d)}):(r=0,n=0,a=0,i=0);var s={x:r,y:a,minX:r,minY:a,maxX:n,maxY:i,width:n-r,height:i-a};return s},e.prototype.getDefaultCfg=function(){var r=t.prototype.getDefaultCfg.call(this);return r.children=[],r},e.prototype.onAttrChange=function(r,n,a){if(t.prototype.onAttrChange.call(this,r,n,a),r==="matrix"){var i=this.getTotalMatrix();this._applyChildrenMarix(i)}},e.prototype.applyMatrix=function(r){var n=this.getTotalMatrix();t.prototype.applyMatrix.call(this,r);var a=this.getTotalMatrix();a!==n&&this._applyChildrenMarix(a)},e.prototype._applyChildrenMarix=function(r){var n=this.getChildren();_e(n,function(a){a.applyMatrix(r)})},e.prototype.addShape=function(){for(var r=[],n=0;n=0;s--){var u=r[s];if(P0(u)&&(u.isGroup()?o=u.getShape(n,a,i):u.isHit(n,a)&&(o=u)),o)break}return o},e.prototype.add=function(r){var n=this.getCanvas(),a=this.getChildren(),i=this.get("timeline"),o=r.getParent();o&&Kz(o,r),r.set("parent",this),n&&iC(r,n),i&&oC(r,i),a.push(r),r.onCanvasChange("add"),this._applyElementMatrix(r)},e.prototype._applyElementMatrix=function(r){var n=this.getTotalMatrix();n&&r.applyMatrix(n)},e.prototype.getChildren=function(){return this.get("children")||[]},e.prototype.sort=function(){var r=this.getChildren();_e(r,function(n,a){return n[R0]=a,n}),r.sort(Qz(function(n,a){return n.get("zIndex")-a.get("zIndex")})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var r=this.getChildren(),n=r.length-1;n>=0;n--)r[n].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),t.prototype.destroy.call(this))},e.prototype.getFirst=function(){return this.getChildByIndex(0)},e.prototype.getLast=function(){var r=this.getChildren();return this.getChildByIndex(r.length-1)},e.prototype.getChildByIndex=function(r){var n=this.getChildren();return n[r]},e.prototype.getCount=function(){var r=this.getChildren();return r.length},e.prototype.contain=function(r){var n=this.getChildren();return n.indexOf(r)>-1},e.prototype.removeChild=function(r,n){n===void 0&&(n=!0),this.contain(r)&&r.remove(n)},e.prototype.findAll=function(r){var n=[],a=this.getChildren();return _e(a,function(i){r(i)&&n.push(i),i.isGroup()&&(n=n.concat(i.findAll(r)))}),n},e.prototype.find=function(r){var n=null,a=this.getChildren();return _e(a,function(i){if(r(i)?n=i:i.isGroup()&&(n=i.find(r)),n)return!1}),n},e.prototype.findById=function(r){return this.find(function(n){return n.get("id")===r})},e.prototype.findByClassName=function(r){return this.find(function(n){return n.get("className")===r})},e.prototype.findAllByName=function(r){return this.findAll(function(n){return n.get("name")===r})},e}(aC),Ks=0,ff=0,Xu=0,uC=1e3,Ph,lf,Rh=0,Xo=0,Ed=0,Pf=typeof performance=="object"&&performance.now?performance:Date,fC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function lC(){return Xo||(fC(Jz),Xo=Pf.now()+Ed)}function Jz(){Xo=0}function F0(){this._call=this._time=this._next=null}F0.prototype=cC.prototype={constructor:F0,restart:function(t,e,r){if(typeof t!="function")throw new TypeError("callback is not a function");r=(r==null?lC():+r)+(e==null?0:+e),!this._next&&lf!==this&&(lf?lf._next=this:Ph=this,lf=this),this._call=t,this._time=r,B0()},stop:function(){this._call&&(this._call=null,this._time=1/0,B0())}};function cC(t,e,r){var n=new F0;return n.restart(t,e,r),n}function e6(){lC(),++Ks;for(var t=Ph,e;t;)(e=Xo-t._time)>=0&&t._call.call(null,e),t=t._next;--Ks}function Gw(){Xo=(Rh=Pf.now())+Ed,Ks=ff=0;try{e6()}finally{Ks=0,r6(),Xo=0}}function t6(){var t=Pf.now(),e=t-Rh;e>uC&&(Ed-=e,Rh=t)}function r6(){for(var t,e=Ph,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:Ph=r);lf=t,B0(n)}function B0(t){if(!Ks){ff&&(ff=clearTimeout(ff));var e=t-Xo;e>24?(t<1/0&&(ff=setTimeout(Gw,t-Pf.now()-Ed)),Xu&&(Xu=clearInterval(Xu))):(Xu||(Rh=Pf.now(),Xu=setInterval(t6,uC)),Ks=1,fC(Gw))}}function Dy(t,e,r){t.prototype=e.prototype=r,r.constructor=t}function hC(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function Jf(){}var Rf=.7,Fh=1/Rf,$s="\\s*([+-]?\\d+)\\s*",Ff="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Va="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",n6=/^#([0-9a-f]{3,8})$/,a6=new RegExp(`^rgb\\(${$s},${$s},${$s}\\)$`),i6=new RegExp(`^rgb\\(${Va},${Va},${Va}\\)$`),o6=new RegExp(`^rgba\\(${$s},${$s},${$s},${Ff}\\)$`),s6=new RegExp(`^rgba\\(${Va},${Va},${Va},${Ff}\\)$`),u6=new RegExp(`^hsl\\(${Ff},${Va},${Va}\\)$`),f6=new RegExp(`^hsla\\(${Ff},${Va},${Va},${Ff}\\)$`),zw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Dy(Jf,Bf,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:jw,formatHex:jw,formatHex8:l6,formatHsl:c6,formatRgb:Uw,toString:Uw});function jw(){return this.rgb().formatHex()}function l6(){return this.rgb().formatHex8()}function c6(){return dC(this).formatHsl()}function Uw(){return this.rgb().formatRgb()}function Bf(t){var e,r;return t=(t+"").trim().toLowerCase(),(e=n6.exec(t))?(r=e[1].length,e=parseInt(e[1],16),r===6?$w(e):r===3?new Nn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):r===8?lc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):r===4?lc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=a6.exec(t))?new Nn(e[1],e[2],e[3],1):(e=i6.exec(t))?new Nn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=o6.exec(t))?lc(e[1],e[2],e[3],e[4]):(e=s6.exec(t))?lc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=u6.exec(t))?Vw(e[1],e[2]/100,e[3]/100,1):(e=f6.exec(t))?Vw(e[1],e[2]/100,e[3]/100,e[4]):zw.hasOwnProperty(t)?$w(zw[t]):t==="transparent"?new Nn(NaN,NaN,NaN,0):null}function $w(t){return new Nn(t>>16&255,t>>8&255,t&255,1)}function lc(t,e,r,n){return n<=0&&(t=e=r=NaN),new Nn(t,e,r,n)}function h6(t){return t instanceof Jf||(t=Bf(t)),t?(t=t.rgb(),new Nn(t.r,t.g,t.b,t.opacity)):new Nn}function G0(t,e,r,n){return arguments.length===1?h6(t):new Nn(t,e,r,n??1)}function Nn(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}Dy(Nn,G0,hC(Jf,{brighter(t){return t=t==null?Fh:Math.pow(Fh,t),new Nn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Rf:Math.pow(Rf,t),new Nn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Nn(Bo(this.r),Bo(this.g),Bo(this.b),Bh(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Xw,formatHex:Xw,formatHex8:d6,formatRgb:Ww,toString:Ww}));function Xw(){return`#${Po(this.r)}${Po(this.g)}${Po(this.b)}`}function d6(){return`#${Po(this.r)}${Po(this.g)}${Po(this.b)}${Po((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ww(){const t=Bh(this.opacity);return`${t===1?"rgb(":"rgba("}${Bo(this.r)}, ${Bo(this.g)}, ${Bo(this.b)}${t===1?")":`, ${t})`}`}function Bh(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Bo(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Po(t){return t=Bo(t),(t<16?"0":"")+t.toString(16)}function Vw(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new ga(t,e,r,n)}function dC(t){if(t instanceof ga)return new ga(t.h,t.s,t.l,t.opacity);if(t instanceof Jf||(t=Bf(t)),!t)return new ga;if(t instanceof ga)return t;t=t.rgb();var e=t.r/255,r=t.g/255,n=t.b/255,a=Math.min(e,r,n),i=Math.max(e,r,n),o=NaN,s=i-a,u=(i+a)/2;return s?(e===i?o=(r-n)/s+(r0&&u<1?0:o,new ga(o,s,u,t.opacity)}function v6(t,e,r,n){return arguments.length===1?dC(t):new ga(t,e,r,n??1)}function ga(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}Dy(ga,v6,hC(Jf,{brighter(t){return t=t==null?Fh:Math.pow(Fh,t),new ga(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Rf:Math.pow(Rf,t),new ga(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,a=2*r-n;return new Nn(dp(t>=240?t-240:t+120,a,n),dp(t,a,n),dp(t<120?t+240:t-120,a,n),this.opacity)},clamp(){return new ga(Yw(this.h),cc(this.s),cc(this.l),Bh(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Bh(this.opacity);return`${t===1?"hsl(":"hsla("}${Yw(this.h)}, ${cc(this.s)*100}%, ${cc(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Yw(t){return t=(t||0)%360,t<0?t+360:t}function cc(t){return Math.max(0,Math.min(1,t||0))}function dp(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}const Py=t=>()=>t;function p6(t,e){return function(r){return t+r*e}}function g6(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}function y6(t){return(t=+t)==1?vC:function(e,r){return r-e?g6(e,r,t):Py(isNaN(e)?r:e)}}function vC(t,e){var r=e-t;return r?p6(t,r):Py(isNaN(t)?e:t)}const qw=function t(e){var r=y6(e);function n(a,i){var o=r((a=G0(a)).r,(i=G0(i)).r),s=r(a.g,i.g),u=r(a.b,i.b),f=vC(a.opacity,i.opacity);return function(l){return a.r=o(l),a.g=s(l),a.b=u(l),a.opacity=f(l),a+""}}return n.gamma=t,n}(1);function pC(t,e){e||(e=[]);var r=t?Math.min(e.length,t.length):0,n=e.slice(),a;return function(i){for(a=0;ar&&(i=e.slice(r,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(a=a[0])?s[o]?s[o]+=a:s[++o]=a:(s[++o]=null,u.push({i:o,x:z0(n,a)})),r=vp.lastIndex;return rf.length?(u=zs(i[s]),f=zs(a[s]),f=KA(f,u),f=D0(f,u),e.fromAttrs.path=f,e.toAttrs.path=u):e.pathFormatted||(u=zs(i[s]),f=zs(a[s]),f=D0(f,u),e.fromAttrs.path=f,e.toAttrs.path=u,e.pathFormatted=!0),n[s]=[];for(var l=0;l0){for(var s=e.animators.length-1;s>=0;s--){if(n=e.animators[s],n.destroyed){e.removeAnimator(s);continue}if(!n.isAnimatePaused()){a=n.get("animations");for(var u=a.length-1;u>=0;u--)i=a[u],r=nj(n,i,o),r&&(a.splice(u,1),r=!1,i.callback&&i.callback())}a.length===0&&e.removeAnimator(s)}var f=e.canvas.get("autoDraw");f||e.canvas.draw()}})},t.prototype.addAnimator=function(e){this.animators.push(e)},t.prototype.removeAnimator=function(e){this.animators.splice(e,1)},t.prototype.isAnimating=function(){return!!this.animators.length},t.prototype.stop=function(){this.timer&&this.timer.stop()},t.prototype.stopAllAnimations=function(e){e===void 0&&(e=!0),this.animators.forEach(function(r){r.stopAnimate(e)}),this.animators=[],this.canvas.draw()},t.prototype.getTime=function(){return this.current},t}(),ij=40,ax=0,ix=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function ox(t,e,r){r.name=e,r.target=t,r.currentTarget=t,r.delegateTarget=t,t.emit(e,r)}function oj(t,e,r){if(r.bubbles){var n=void 0,a=!1;if(e==="mouseenter"?(n=r.fromShape,a=!0):e==="mouseleave"&&(a=!0,n=r.toShape),t.isCanvas()&&a)return;if(n&&tC(t,n)){r.bubbles=!1;return}r.name=e,r.currentTarget=t,r.delegateTarget=t,t.emit(e,r)}}var sj=function(){function t(e){var r=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(n){var a=n.type;r._triggerEvent(a,n)},this._onDocumentMove=function(n){var a=r.canvas,i=a.get("el");if(i!==n.target&&(r.dragging||r.currentShape)){var o=r._getPointInfo(n);r.dragging&&r._emitEvent("drag",n,o,r.draggingShape)}},this._onDocumentMouseUp=function(n){var a=r.canvas,i=a.get("el");if(i!==n.target&&r.dragging){var o=r._getPointInfo(n);r.draggingShape&&r._emitEvent("drop",n,o,null),r._emitEvent("dragend",n,o,r.draggingShape),r._afterDrag(r.draggingShape,o,n)}},this.canvas=e.canvas}return t.prototype.init=function(){this._bindEvents()},t.prototype._bindEvents=function(){var e=this,r=this.canvas.get("el");_e(ix,function(n){r.addEventListener(n,e._eventCallback)}),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._clearEvents=function(){var e=this,r=this.canvas.get("el");_e(ix,function(n){r.removeEventListener(n,e._eventCallback)}),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},t.prototype._getEventObj=function(e,r,n,a,i,o){var s=new JA(e,r);return s.fromShape=i,s.toShape=o,s.x=n.x,s.y=n.y,s.clientX=n.clientX,s.clientY=n.clientY,s.propagationPath.push(a),s},t.prototype._getShape=function(e,r){return this.canvas.getShape(e.x,e.y,r)},t.prototype._getPointInfo=function(e){var r=this.canvas,n=r.getClientByEvent(e),a=r.getPointByEvent(e);return{x:a.x,y:a.y,clientX:n.x,clientY:n.y}},t.prototype._triggerEvent=function(e,r){var n=this._getPointInfo(r),a=this._getShape(n,r),i=this["_on"+e],o=!1;if(i)i.call(this,n,a,r);else{var s=this.currentShape;e==="mouseenter"||e==="dragenter"||e==="mouseover"?(this._emitEvent(e,r,n,null,null,a),a&&this._emitEvent(e,r,n,a,null,a),e==="mouseenter"&&this.draggingShape&&this._emitEvent("dragenter",r,n,null)):e==="mouseleave"||e==="dragleave"||e==="mouseout"?(o=!0,s&&this._emitEvent(e,r,n,s,s,null),this._emitEvent(e,r,n,null,s,null),e==="mouseleave"&&this.draggingShape&&this._emitEvent("dragleave",r,n,null)):this._emitEvent(e,r,n,a,null,null)}if(o||(this.currentShape=a),a&&!a.get("destroyed")){var u=this.canvas,f=u.get("el");f.style.cursor=a.attr("cursor")||u.get("cursor")}},t.prototype._onmousedown=function(e,r,n){n.button===ax&&(this.mousedownShape=r,this.mousedownPoint=e,this.mousedownTimeStamp=n.timeStamp),this._emitEvent("mousedown",n,e,r,null,null)},t.prototype._emitMouseoverEvents=function(e,r,n,a){var i=this.canvas.get("el");n!==a&&(n&&(this._emitEvent("mouseout",e,r,n,n,a),this._emitEvent("mouseleave",e,r,n,n,a),(!a||a.get("destroyed"))&&(i.style.cursor=this.canvas.get("cursor"))),a&&(this._emitEvent("mouseover",e,r,a,n,a),this._emitEvent("mouseenter",e,r,a,n,a)))},t.prototype._emitDragoverEvents=function(e,r,n,a,i){a?(a!==n&&(n&&this._emitEvent("dragleave",e,r,n,n,a),this._emitEvent("dragenter",e,r,a,n,a)),i||this._emitEvent("dragover",e,r,a)):n&&this._emitEvent("dragleave",e,r,n,n,a),i&&this._emitEvent("dragover",e,r,a)},t.prototype._afterDrag=function(e,r,n){e&&(e.set("capture",!0),this.draggingShape=null),this.dragging=!1;var a=this._getShape(r,n);a!==e&&this._emitMouseoverEvents(n,r,e,a),this.currentShape=a},t.prototype._onmouseup=function(e,r,n){if(n.button===ax){var a=this.draggingShape;this.dragging?(a&&this._emitEvent("drop",n,e,r),this._emitEvent("dragend",n,e,a),this._afterDrag(a,e,n)):(this._emitEvent("mouseup",n,e,r),r===this.mousedownShape&&this._emitEvent("click",n,e,r),this.mousedownShape=null,this.mousedownPoint=null)}},t.prototype._ondragover=function(e,r,n){n.preventDefault();var a=this.currentShape;this._emitDragoverEvents(n,e,a,r,!0)},t.prototype._onmousemove=function(e,r,n){var a=this.canvas,i=this.currentShape,o=this.draggingShape;if(this.dragging)o&&this._emitDragoverEvents(n,e,i,r,!1),this._emitEvent("drag",n,e,o);else{var s=this.mousedownPoint;if(s){var u=this.mousedownShape,f=n.timeStamp,l=f-this.mousedownTimeStamp,c=s.clientX-e.clientX,h=s.clientY-e.clientY,d=c*c+h*h;l>120||d>ij?u&&u.get("draggable")?(o=this.mousedownShape,o.set("capture",!1),this.draggingShape=o,this.dragging=!0,this._emitEvent("dragstart",n,e,o),this.mousedownShape=null,this.mousedownPoint=null):!u&&a.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",n,e,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(n,e,i,r),this._emitEvent("mousemove",n,e,r)):(this._emitMouseoverEvents(n,e,i,r),this._emitEvent("mousemove",n,e,r))}else this._emitMouseoverEvents(n,e,i,r),this._emitEvent("mousemove",n,e,r)}},t.prototype._emitEvent=function(e,r,n,a,i,o){var s=this._getEventObj(e,r,n,a,i,o);if(a){s.shape=a,ox(a,e,s);for(var u=a.getParent();u;)u.emitDelegation(e,s),s.propagationStopped||oj(u,e,s),s.propagationPath.push(u),u=u.getParent()}else{var f=this.canvas;ox(f,e,s)}},t.prototype.destroy=function(){this._clearEvents(),this.canvas=null,this.currentShape=null,this.draggingShape=null,this.mousedownPoint=null,this.mousedownShape=null,this.mousedownTimeStamp=null},t}(),sx="px",ux=rC(),uj=ux&&ux.name==="firefox",wC=function(t){jt(e,t);function e(r){var n=t.call(this,r)||this;return n.initContainer(),n.initDom(),n.initEvents(),n.initTimeline(),n}return e.prototype.getDefaultCfg=function(){var r=t.prototype.getDefaultCfg.call(this);return r.cursor="default",r.supportCSSTransform=!1,r},e.prototype.initContainer=function(){var r=this.get("container");Ye(r)&&(r=document.getElementById(r),this.set("container",r))},e.prototype.initDom=function(){var r=this.createDom();this.set("el",r);var n=this.get("container");n.appendChild(r),this.setDOMSize(this.get("width"),this.get("height"))},e.prototype.initEvents=function(){var r=new sj({canvas:this});r.init(),this.set("eventController",r)},e.prototype.initTimeline=function(){var r=new aj(this);this.set("timeline",r)},e.prototype.setDOMSize=function(r,n){var a=this.get("el");Lw&&(a.style.width=r+sx,a.style.height=n+sx)},e.prototype.changeSize=function(r,n){this.setDOMSize(r,n),this.set("width",r),this.set("height",n),this.onCanvasChange("changeSize")},e.prototype.getRenderer=function(){return this.get("renderer")},e.prototype.getCursor=function(){return this.get("cursor")},e.prototype.setCursor=function(r){this.set("cursor",r);var n=this.get("el");Lw&&n&&(n.style.cursor=r)},e.prototype.getPointByEvent=function(r){var n=this.get("supportCSSTransform");if(n){if(uj&&!Zt(r.layerX)&&r.layerX!==r.offsetX)return{x:r.layerX,y:r.layerY};if(!Zt(r.offsetX))return{x:r.offsetX,y:r.offsetY}}var a=this.getClientByEvent(r),i=a.x,o=a.y;return this.getPointByClient(i,o)},e.prototype.getClientByEvent=function(r){var n=r;return r.touches&&(r.type==="touchend"?n=r.changedTouches[0]:n=r.touches[0]),{x:n.clientX,y:n.clientY}},e.prototype.getPointByClient=function(r,n){var a=this.get("el"),i=a.getBoundingClientRect();return{x:r-i.left,y:n-i.top}},e.prototype.getClientByPoint=function(r,n){var a=this.get("el"),i=a.getBoundingClientRect();return{x:r+i.left,y:n+i.top}},e.prototype.draw=function(){},e.prototype.removeDom=function(){var r=this.get("el");r.parentNode.removeChild(r)},e.prototype.clearEvents=function(){var r=this.get("eventController");r.destroy()},e.prototype.isCanvas=function(){return!0},e.prototype.getParent=function(){return null},e.prototype.destroy=function(){var r=this.get("timeline");this.get("destroyed")||(this.clear(),r&&r.stop(),this.clearEvents(),this.removeDom(),t.prototype.destroy.call(this))},e}(sC),xC=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.isGroup=function(){return!0},e.prototype.isEntityGroup=function(){return!1},e.prototype.clone=function(){for(var r=t.prototype.clone.call(this),n=this.getChildren(),a=0;a=r&&a.minY<=n&&a.maxY>=n},e.prototype.afterAttrsChange=function(r){t.prototype.afterAttrsChange.call(this,r),this.clearCacheBBox()},e.prototype.getBBox=function(){var r=this.cfg.bbox;return r||(r=this.calculateBBox(),this.set("bbox",r)),r},e.prototype.getCanvasBBox=function(){var r=this.cfg.canvasBBox;return r||(r=this.calculateCanvasBBox(),this.set("canvasBBox",r)),r},e.prototype.applyMatrix=function(r){t.prototype.applyMatrix.call(this,r),this.set("canvasBBox",null)},e.prototype.calculateCanvasBBox=function(){var r=this.getBBox(),n=this.getTotalMatrix(),a=r.minX,i=r.minY,o=r.maxX,s=r.maxY;if(n){var u=Do(n,[r.minX,r.minY]),f=Do(n,[r.maxX,r.minY]),l=Do(n,[r.minX,r.maxY]),c=Do(n,[r.maxX,r.maxY]);a=Math.min(u[0],f[0],l[0],c[0]),o=Math.max(u[0],f[0],l[0],c[0]),i=Math.min(u[1],f[1],l[1],c[1]),s=Math.max(u[1],f[1],l[1],c[1])}var h=this.attrs;if(h.shadowColor){var d=h.shadowBlur,v=d===void 0?0:d,p=h.shadowOffsetX,g=p===void 0?0:p,y=h.shadowOffsetY,m=y===void 0?0:y,b=a-v+g,w=o+v+g,x=i-v+m,E=s+v+m;a=Math.min(a,b),o=Math.max(o,w),i=Math.min(i,x),s=Math.max(s,E)}return{x:a,y:i,minX:a,minY:i,maxX:o,maxY:s,width:o-a,height:s-i}},e.prototype.clearCacheBBox=function(){this.set("bbox",null),this.set("canvasBBox",null)},e.prototype.isClipShape=function(){return this.get("isClipShape")},e.prototype.isInShape=function(r,n){return!1},e.prototype.isOnlyHitBox=function(){return!1},e.prototype.isHit=function(r,n){var a=this.get("startArrowShape"),i=this.get("endArrowShape"),o=[r,n,1];o=this.invertFromMatrix(o);var s=o[0],u=o[1],f=this._isInBBox(s,u);return this.isOnlyHitBox()?f:!!(f&&!this.isClipped(s,u)&&(this.isInShape(s,u)||a&&a.isHit(s,u)||i&&i.isHit(s,u)))},e}(aC),_C=new Map;function Ja(t,e){_C.set(t,e)}function SC(t){return _C.get(t)}function MC(t){var e=t.attr(),r=e.x,n=e.y,a=e.width,i=e.height;return{x:r,y:n,width:a,height:i}}function AC(t){var e=t.attr(),r=e.x,n=e.y,a=e.r;return{x:r-a,y:n-a,width:a*2,height:a*2}}function xn(t,e,r,n){var a=t-r,i=e-n;return Math.sqrt(a*a+i*i)}function uh(t,e){return Math.abs(t-e)<.001}function pu(t,e){var r=Ha(t),n=Ha(e),a=qa(t),i=qa(e);return{x:r,y:n,width:a-r,height:i-n}}function _d(t){return(t+Math.PI*2)%(Math.PI*2)}const cn={box:function(t,e,r,n){return pu([t,r],[e,n])},length:function(t,e,r,n){return xn(t,e,r,n)},pointAt:function(t,e,r,n,a){return{x:(1-a)*t+a*r,y:(1-a)*e+a*n}},pointDistance:function(t,e,r,n,a,i){var o=(r-t)*(a-t)+(n-e)*(i-e);if(o<0)return xn(t,e,a,i);var s=(r-t)*(r-t)+(n-e)*(n-e);return o>s?xn(r,n,a,i):this.pointToLine(t,e,r,n,a,i)},pointToLine:function(t,e,r,n,a,i){var o=[r-t,n-e];if(xy(o,[0,0]))return Math.sqrt((a-t)*(a-t)+(i-e)*(i-e));var s=[-o[1],o[0]];Wi(s,s);var u=[a-t,i-e];return Math.abs(wy(u,s))},tangentAngle:function(t,e,r,n){return Math.atan2(n-e,r-t)}};var fj=1e-4;function CC(t,e,r,n,a,i){var o,s=1/0,u=[r,n],f=20;i&&i>200&&(f=i/10);for(var l=1/f,c=l/10,h=0;h<=f;h++){var d=h*l,v=[a.apply(null,t.concat([d])),a.apply(null,e.concat([d]))],p=xn(u[0],u[1],v[0],v[1]);p=0&&p=0?[a]:[]}function lx(t,e,r,n){return 2*(1-n)*(e-t)+2*n*(r-e)}function TC(t,e,r,n,a,i,o){var s=Bi(t,r,a,o),u=Bi(e,n,i,o),f=cn.pointAt(t,e,r,n,o),l=cn.pointAt(r,n,a,i,o);return[[t,e,f.x,f.y,s,u],[s,u,l.x,l.y,a,i]]}function $0(t,e,r,n,a,i,o){if(o===0)return(xn(t,e,r,n)+xn(r,n,a,i)+xn(t,e,a,i))/2;var s=TC(t,e,r,n,a,i,.5),u=s[0],f=s[1];return u.push(o-1),f.push(o-1),$0.apply(null,u)+$0.apply(null,f)}const IC={box:function(t,e,r,n,a,i){var o=fx(t,r,a)[0],s=fx(e,n,i)[0],u=[t,a],f=[e,i];return o!==void 0&&u.push(Bi(t,r,a,o)),s!==void 0&&f.push(Bi(e,n,i,s)),pu(u,f)},length:function(t,e,r,n,a,i){return $0(t,e,r,n,a,i,3)},nearestPoint:function(t,e,r,n,a,i,o,s){return CC([t,r,a],[e,n,i],o,s,Bi)},pointDistance:function(t,e,r,n,a,i,o,s){var u=this.nearestPoint(t,e,r,n,a,i,o,s);return xn(u.x,u.y,o,s)},interpolationAt:Bi,pointAt:function(t,e,r,n,a,i,o){return{x:Bi(t,r,a,o),y:Bi(e,n,i,o)}},divide:function(t,e,r,n,a,i,o){return TC(t,e,r,n,a,i,o)},tangentAngle:function(t,e,r,n,a,i,o){var s=lx(t,r,a,o),u=lx(e,n,i,o),f=Math.atan2(u,s);return _d(f)}};function Gi(t,e,r,n,a){var i=1-a;return i*i*i*t+3*e*a*i*i+3*r*a*a*i+n*a*a*a}function cx(t,e,r,n,a){var i=1-a;return 3*(i*i*(e-t)+2*i*a*(r-e)+a*a*(n-r))}function pp(t,e,r,n){var a=-3*t+9*e-9*r+3*n,i=6*t-12*e+6*r,o=3*e-3*t,s=[],u,f,l;if(uh(a,0))uh(i,0)||(u=-o/i,u>=0&&u<=1&&s.push(u));else{var c=i*i-4*a*o;uh(c,0)?s.push(-i/(2*a)):c>0&&(l=Math.sqrt(c),u=(-i+l)/(2*a),f=(-i-l)/(2*a),u>=0&&u<=1&&s.push(u),f>=0&&f<=1&&s.push(f))}return s}function kC(t,e,r,n,a,i,o,s,u){var f=Gi(t,r,a,o,u),l=Gi(e,n,i,s,u),c=cn.pointAt(t,e,r,n,u),h=cn.pointAt(r,n,a,i,u),d=cn.pointAt(a,i,o,s,u),v=cn.pointAt(c.x,c.y,h.x,h.y,u),p=cn.pointAt(h.x,h.y,d.x,d.y,u);return[[t,e,c.x,c.y,v.x,v.y,f,l],[f,l,p.x,p.y,d.x,d.y,o,s]]}function X0(t,e,r,n,a,i,o,s,u){if(u===0)return lj([t,r,a,o],[e,n,i,s]);var f=kC(t,e,r,n,a,i,o,s,.5),l=f[0],c=f[1];return l.push(u-1),c.push(u-1),X0.apply(null,l)+X0.apply(null,c)}const xf={extrema:pp,box:function(t,e,r,n,a,i,o,s){for(var u=[t,o],f=[e,s],l=pp(t,r,a,o),c=pp(e,n,i,s),h=0;h0?r:r*-1}const cj={box:function(t,e,r,n){return{x:t-r,y:e-n,width:r*2,height:n*2}},length:function(t,e,r,n){return Math.PI*(3*(r+n)-Math.sqrt((3*r+n)*(r+3*n)))},nearestPoint:function(t,e,r,n,a,i){var o=r,s=n;if(o===0||s===0)return{x:t,y:e};for(var u=a-t,f=i-e,l=Math.abs(u),c=Math.abs(f),h=o*o,d=s*s,v=Math.PI/4,p,g,y=0;y<4;y++){p=o*Math.cos(v),g=s*Math.sin(v);var m=(h-d)*Math.pow(Math.cos(v),3)/o,b=(d-h)*Math.pow(Math.sin(v),3)/s,w=p-m,x=g-b,E=l-m,_=c-b,S=Math.hypot(x,w),A=Math.hypot(_,E),M=S*Math.asin((w*_-x*E)/(S*A)),C=M/Math.sqrt(h+d-p*p-g*g);v+=C,v=Math.min(Math.PI/2,Math.max(0,v))}return{x:t+hx(p,u),y:e+hx(g,f)}},pointDistance:function(t,e,r,n,a,i){var o=this.nearestPoint(t,e,r,n,a,i);return xn(o.x,o.y,a,i)},pointAt:function(t,e,r,n,a){var i=2*Math.PI*a;return{x:t+r*Math.cos(i),y:e+n*Math.sin(i)}},tangentAngle:function(t,e,r,n,a){var i=2*Math.PI*a,o=Math.atan2(n*Math.cos(i),-r*Math.sin(i));return _d(o)}};function hj(t,e,r,n,a,i,o,s){return-1*r*Math.cos(a)*Math.sin(s)-n*Math.sin(a)*Math.cos(s)}function dj(t,e,r,n,a,i,o,s){return-1*r*Math.sin(a)*Math.sin(s)+n*Math.cos(a)*Math.cos(s)}function vj(t,e,r){return Math.atan(-e/t*Math.tan(r))}function pj(t,e,r){return Math.atan(e/(t*Math.tan(r)))}function dx(t,e,r,n,a,i){return r*Math.cos(a)*Math.cos(i)-n*Math.sin(a)*Math.sin(i)+t}function vx(t,e,r,n,a,i){return r*Math.sin(a)*Math.cos(i)+n*Math.cos(a)*Math.sin(i)+e}function gj(t,e,r,n){var a=Math.atan2(n*t,r*e);return(a+Math.PI*2)%(Math.PI*2)}function px(t,e,r){return{x:t*Math.cos(r),y:e*Math.sin(r)}}function gx(t,e,r){var n=Math.cos(r),a=Math.sin(r);return[t*n-e*a,t*a+e*n]}const yj={box:function(t,e,r,n,a,i,o){for(var s=vj(r,n,a),u=1/0,f=-1/0,l=[i,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var h=s+c;if&&(f=d)}for(var v=pj(r,n,a),p=1/0,g=-1/0,y=[i,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var m=v+c;ig&&(g=b)}return{x:u,y:p,width:f-u,height:g-p}},length:function(t,e,r,n,a,i,o){},nearestPoint:function(t,e,r,n,a,i,o,s,u){var f=gx(s-t,u-e,-a),l=f[0],c=f[1],h=cj.nearestPoint(0,0,r,n,l,c),d=gj(r,n,h.x,h.y);do&&(h=px(r,n,o));var v=gx(h.x,h.y,a);return{x:v[0]+t,y:v[1]+e}},pointDistance:function(t,e,r,n,a,i,o,s,u){var f=this.nearestPoint(t,e,r,n,s,u);return xn(f.x,f.y,s,u)},pointAt:function(t,e,r,n,a,i,o,s){var u=(o-i)*s+i;return{x:dx(t,e,r,n,a,u),y:vx(t,e,r,n,a,u)}},tangentAngle:function(t,e,r,n,a,i,o,s){var u=(o-i)*s+i,f=hj(t,e,r,n,a,i,o,u),l=dj(t,e,r,n,a,i,o,u);return _d(Math.atan2(l,f))}};function NC(t){for(var e=0,r=[],n=0;n1||e<0||t.length<2)return null;var r=NC(t),n=r.segments,a=r.totalLength;if(a===0)return{x:t[0][0],y:t[0][1]};for(var i=0,o=null,s=0;s=i&&e<=i+c){var h=(e-i)/c;o=cn.pointAt(f[0],f[1],l[0],l[1],h);break}i+=c}return o}function wj(t,e){if(e>1||e<0||t.length<2)return 0;for(var r=NC(t),n=r.segments,a=r.totalLength,i=0,o=0,s=0;s=i&&e<=i+c){o=Math.atan2(l[1]-f[1],l[0]-f[0]);break}i+=c}return o}function xj(t,e,r){for(var n=1/0,a=0;a1){var a=Sj(e,r);return e*n+a*(n-1)}return e}function Sj(t,e){return e?e-t:t*.14}function Mj(t,e){var r=LC(),n=0;if(Zt(t)||t==="")return n;if(r.save(),r.font=e,Ye(t)&&t.includes(` `)){var a=t.split(` `);_e(a,function(i){var o=r.measureText(i).width;n1){var a=r[0].charAt(0);r.splice(1,0,r[0].substr(1)),r[0]=a}_e(r,function(i,o){isNaN(i)||(r[o]=+i)}),e[n]=r}),e}function kj(t,e,r,n){var a=[],i=!!n,o,s,u,f,l,c,h;if(i){u=n[0],f=n[1];for(var d=0,v=t.length;d2&&(r.push([a].concat(o.splice(0,2))),s="l",a=a==="m"?"l":"L"),s==="o"&&o.length===1&&r.push([a,o[0]]),s==="r")r.push([a].concat(o));else for(;o.length>=e[s]&&(r.push([a].concat(o.splice(0,e[s]))),!!e[s]););return""}),r}var Dj=/[a-z]/;function mx(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function RC(t){var e=W0(t);if(!e||!e.length)return[["M",0,0]];for(var r=!1,n=0;n=0){r=!0;break}}if(!r)return e;var i=[],o=0,s=0,u=0,f=0,l=0,c=e[0];(c[0]==="M"||c[0]==="m")&&(o=+c[1],s=+c[2],u=o,f=s,l++,i[0]=["M",o,s]);for(var n=l,h=e.length;n1&&(r*=Math.sqrt(d),n*=Math.sqrt(d));var v=r*r*(h*h)+n*n*(c*c),p=v?Math.sqrt((r*r*(n*n)-v)/v):1;i===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*r*h/n:0,y=r?p*-n*c/r:0,m=(s+f)/2+Math.cos(a)*g-Math.sin(a)*y,b=(u+l)/2+Math.sin(a)*g+Math.cos(a)*y,w=[(c-g)/r,(h-y)/n],x=[(-1*c-g)/r,(-1*h-y)/n],E=bx([1,0],w),_=bx(w,x);return V0(w,x)<=-1&&(_=Math.PI),V0(w,x)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:Y0(t,[f,l])?0:r,ry:Y0(t,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:a,arcFlag:i,sweepFlag:o}}function wx(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function FC(t){t=Ij(t);for(var e=[],r=null,n=null,a=null,i=0,o=t.length,s=0;sMath.PI/2?Math.PI-f:f,l=l>Math.PI/2?Math.PI-l:l;var c={xExtra:Math.cos(u/2-f)*(e/2*(1/Math.sin(u/2)))-e/2||0,yExtra:Math.cos(l-u/2)*(e/2*(1/Math.sin(u/2)))-e/2||0};return c}function Fj(t){var e=t.attr(),r=e.path,n=e.stroke,a=n?e.lineWidth:0,i=t.get("segments")||FC(r),o=Rj(i,a),s=o.x,u=o.y,f=o.width,l=o.height,c={minX:s,minY:u,maxX:s+f,maxY:u+l};return c=zy(t,c),{x:c.minX,y:c.minY,width:c.maxX-c.minX,height:c.maxY-c.minY}}function Bj(t){var e=t.attr(),r=e.x1,n=e.y1,a=e.x2,i=e.y2,o=Math.min(r,a),s=Math.max(r,a),u=Math.min(n,i),f=Math.max(n,i),l={minX:o,maxX:s,minY:u,maxY:f};return l=zy(t,l),{x:l.minX,y:l.minY,width:l.maxX-l.minX,height:l.maxY-l.minY}}function Gj(t){var e=t.attr(),r=e.x,n=e.y,a=e.rx,i=e.ry;return{x:r-a,y:n-i,width:a*2,height:i*2}}Ja("rect",MC);Ja("image",MC);Ja("circle",AC);Ja("marker",AC);Ja("polyline",Ej);Ja("polygon",_j);Ja("text",Aj);Ja("path",Fj);Ja("line",Bj);Ja("ellipse",Gj);var zj=function(t){jt(e,t);function e(r,n){var a=t.call(this,r,n)||this;return a.item=n.item,a.canvasX=n.canvasX,a.canvasY=n.canvasY,a.wheelDelta=n.wheelDelta,a.detail=n.detail,a}return e}(JA),q0=function(e){return"".concat(e,"-").concat(Math.random()).concat(Date.now())},jy=function(e){if(bt(e))switch(e.length){case 4:return e;case 3:return e.push(e[1]),e;case 2:return e.concat(e);case 1:return[e[0],e[0],e[0],e[0]];default:return[0,0,0,0]}if(Ot(e))return[e,e,e,e];if(Ye(e)){var r=parseInt(e,10);return[r,r,r,r]}return[0,0,0,0]},jj=function(e){var r=new zj(e.type,e);return r.clientX=e.clientX,r.clientY=e.clientY,r.x=e.x,r.y=e.y,r.target=e.target,r.currentTarget=e.currentTarget,r.bubbles=!0,r.item=e.item,r},Uj=function(e){if(!e)return!1;for(var r=9,n=[1,0,0,0,1,0,0,0,1],a=0;an&&(n=c),h>i&&(i=h)}var d=Math.floor(r),v=Math.floor(a),p=Math.ceil(n)-Math.floor(r),g=Math.ceil(i)-Math.floor(a);return{x:d,y:v,width:p,height:g,minX:r,minY:a,maxX:n,maxY:i}},$j=function(e,r,n,a,i){r===void 0&&(r=15),n===void 0&&(n="quadratic"),a===void 0&&(a=void 0),i===void 0&&(i=void 0);for(var o=e.length,s=r*2,u=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],f={},l=[],c={},h=0;h=0;return r?a?Math.PI*2-n:n:a?n:Math.PI*2-n}to.angleTo=qj;function Hj(t,e,r){return r?(t[0]=e[1],t[1]=-1*e[0]):(t[0]=-1*e[1],t[1]=e[0]),t}to.vertical=Hj;var Zj=function(){function t(e){this.destroyed=!1,this.graph=e,this.destroyed=!1}return t.prototype.getViewCenter=function(){var e=this.getFormatPadding(),r=this.graph,n=this.graph.get("width"),a=r.get("height");return{x:(n-e[1]-e[3])/2+e[3],y:(a-e[0]-e[2])/2+e[0]}},t.prototype.fitCenter=function(e,r){var n=this.graph,a=n.get("group"),i,o=n.getNodes();if(o.length>n.get("optimizeThreshold")){var s=1/0,u=1/0,f=-1/0,l=-1/0;o.forEach(function(w){var x=w.getModel(),E=x.x,_=x.y;s>E&&(s=E),u>_&&(u=_),fg&&(y=g,console.warn("fitview failed, ratio out of range, ratio: %f",s,"graph maxzoom has been used instead"));var m=xx(d,[["t",-i.x,-i.y],["s",y,y],["t",i.x,i.y]]),b=Df({animateCfg:n,callback:function(){e.setMatrix(m),f.emit("viewportchange",{action:"translate",matrix:d}),f.emit("viewportchange",{action:"zoom",matrix:m})}});e.stopAnimate(),e.setMatrix(r),e.animate(function(w){return{matrix:M0(r,m,w)}},b)}},t.prototype.fitView=function(e,r){var n=this.graph,a=this.getFormatPadding(),i=n.get("width"),o=n.get("height"),s=n.get("group"),u=s.getMatrix()||[1,0,0,0,1,0,0,0,1];s.resetMatrix();var f,l=n.getNodes();if(l.length>n.get("optimizeThreshold")){var c=1/0,h=1/0,d=-1/0,v=-1/0;l.forEach(function(E){var _=E.getModel(),S=_.x,A=_.y;c>S&&(c=S),h>A&&(h=A),dm&&(b=m),e)this.animatedFitView(s,u,r,f,p,g,b,!0);else{var w=p.x-g.x,x=p.y-g.y;if(Fa(w)||Fa(x))return;n.translate(w,x),n.zoom(b,p)||console.warn("zoom failed, ratio out of range, ratio: %f",b)}}},t.prototype.fitViewByRules=function(e,r,n){var a=e.onlyOutOfViewPort,i=a===void 0?!1:a,o=e.direction,s=o===void 0?"both":o,u=e.ratioRule,f=u===void 0?"min":u,l=this.graph,c=this.getFormatPadding(),h=l.get("width"),d=l.get("height"),v=l.get("group"),p=v.getMatrix()||[1,0,0,0,1,0,0,0,1];v.resetMatrix();var g,y=l.getNodes();if(y.length>l.get("optimizeThreshold")){var m=1/0,b=1/0,w=-1/0,x=-1/0;y.forEach(function(O){var B=O.getModel(),L=B.x,z=B.y;m>L&&(m=L),b>z&&(b=z),wc.maxX&&(c.maxX=p.maxX),p.maxY>c.maxY&&(c.maxY=p.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 g=this.getViewCenter(),y={x:c.x+c.width/2,y:c.y+c.height/2},m=(s-o[1]-o[3])/c.width,b=(u-o[0]-o[2])/c.height,w=m;m>b&&(w=b),n?this.animatedFitView(f,l,a,c,g,y,w,r):(i.translate(g.x-y.x,g.y-y.y),r&&!i.zoom(w,g)&&console.warn("zoom failed, ratio out of range, ratio: %f",w))}}},t.prototype.changeSize=function(e,r){var n=this.graph;if(!Ot(e)||!Ot(r))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:e,height:r});var a=n.get("canvas");a.changeSize(e,r);var i=n.get("plugins");i.forEach(function(o){o.get("gridContainer")&&o.positionInit()})},t.prototype.destroy=function(){this.graph=null,this.destroyed=!1},t}();function H0(t){"@babel/helpers - typeof";return H0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},H0(t)}function Ex(t){if(typeof t!="string")return t;var e=function(_){if(typeof _!="string")return _;try{return JSON.parse(_.trim())}catch{return _.trim()}},r=e(t);if(typeof r!="string")return r;for(var n=function(_){return _[_.length-1]},a=t.trim(),i=[],o=[],s=function(){for(var _=[],S=0;S=0&&(i.height=o),s>=0&&(i.width=s),a.marginTop&&(i.y+=a.marginTop),a.marginLeft&&(i.x+=a.marginLeft),i}function XC(t,e){var r;e===void 0&&(e={x:0,y:0});var n=P({x:0,y:0,width:0,height:0},e);if(!((r=t.children)===null||r===void 0)&&r.length){var a=t.attrs,i=a===void 0?{}:a,o=i.marginTop,s=P({},e);o&&(s.y+=o);for(var u=0;un.width&&(n.width=l.width+l.x),l.height+l.y>n.height&&(n.height=l.height+l.y)}}}return t.bbox=Jj(t,e,n),t.attrs=P(P({},t.attrs),t.bbox),t}function WC(t,e){var r,n,a,i,o=(t||{}).type,s=((e==null?void 0:e.attrs)||{}).key;if(s&&t&&(t.attrs.key=s),!t&&e)return{action:"delete",val:e,type:o,key:s};if(t&&!e)return{action:"add",val:t,type:o};if(!t&&!e)return{action:"same",type:o};var u=[];if(((r=t.children)===null||r===void 0?void 0:r.length)>0||((n=e.children)===null||n===void 0?void 0:n.length)>0)for(var f=Math.max((a=t.children)===null||a===void 0?void 0:a.length,(i=e.children)===null||i===void 0?void 0:i.length),l=e.children||[],c=t.children||[],h=0;h"u"?a=q0(i):typeof a!="string"&&(a=String(a)),this.get("model").id=a,this.set("id",a);var o=e.group;o&&(o.set("item",this),o.set("id",a)),this.init(),this.draw();var s=n.shape||n.type||(i==="edge"?"line":"circle"),u=this.get("shapeFactory");if(u&&u[s]){var f=u[s].options;if(f&&f.stateStyles){var l=this.get("styles")||n.stateStyles;l=_r({},f.stateStyles,l),this.set("styles",l)}}}return t.prototype.calculateBBox=function(){var e=this.get("keyShape"),r=this.get("group"),n=Dh(e,r);return n.x=n.minX,n.y=n.minY,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,n},t.prototype.calculateCanvasBBox=function(){var e=this.get("keyShape"),r=this.get("group"),n=Dh(e,r);return n.x=n.minX,n.y=n.minY,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,n},t.prototype.drawInner=function(){var e=this,r=e.get("shapeFactory"),n=e.get("group"),a=e.get("model");n.clear();var i=a.visible;if(i!==void 0&&!i&&e.changeVisibility(i),!!r){e.updatePosition(a);var o=e.getShapeCfg(a),s=o.type,u=r.draw(s,o,n);u&&(e.set("keyShape",u),u.set("isKeyShape",!0),u.set("draggable",!0)),this.setOriginStyle(),this.set("currentShape",s),this.restoreStates(r,s)}},t.prototype.setOriginStyle=function(){var e=this.get("group"),r=e.get("children"),n=this.getKeyShape(),a=this,i=n.get("name");if(this.get("originStyle")){var d=this.get("originStyle");i&&!d[i]&&(d[i]={});for(var v=this.getCurrentStatesStyle(),p=function(y){var m=r[y],b=m.get("name"),w=m.attr();if(b&&b!==i){var x=v[b];d[b]||(d[b]={}),x?Object.keys(w).forEach(function(S){var A=w[S];A!==x[S]&&(d[b][S]=A)}):d[b]=m.get("type")!=="image"?rr(w):a.getShapeStyleByName(b)}else{var E=m.attr(),_={};Object.keys(v).forEach(function(S){var A=v[S];(S===i||!ln(A))&&(_[S]=A)}),Object.keys(E).forEach(function(S){var A=E[S];_[S]!==A&&(i?d[i][S]=A:d[S]=A)})}},s=0;s-1)return;n.push(i)}else u>-1&&n.splice(u,1)}else if(Ye(r)){var f=n.filter(function(h){return h.includes(o)});f.length>0&&this.clearStates(f),s=s.filter(function(h){return!h.includes(o)}),s.push(i),this.set("states",s)}if(a){var l=this.get("model"),c=l.type;a.setState(c,e,r,this)}},t.prototype.clearStates=function(e){var r=this,n=r.getStates(),a=r.get("shapeFactory"),i=r.get("model"),o=i.type;e||(e=n),Ye(e)&&(e=[e]);var s=n.filter(function(u){return e.indexOf(u)===-1});r.set("states",s),e.forEach(function(u){a.setState(o,u,!1,r)})},t.prototype.setOptimize=function(e){this.optimize=e},t.prototype.getContainer=function(){return this.get("group")},t.prototype.getKeyShape=function(){return this.get("keyShape")},t.prototype.getModel=function(){return this.get("model")},t.prototype.getType=function(){return this.get("type")},t.prototype.getID=function(){return this.get("id")},t.prototype.isItem=function(){return!0},t.prototype.getStates=function(){return this.get("states")},t.prototype.hasState=function(e){var r=this.getStates();return r.indexOf(e)>=0},t.prototype.refresh=function(e){var r=this.get("model");this.updatePosition(r),this.updateShape(e),this.afterUpdate(),this.clearCache()},t.prototype.getUpdateType=function(e){},t.prototype.update=function(e,r){r===void 0&&(r=void 0);var n=this.get("model");if(r==="move")this.updatePosition(e);else{var a=n.visible,i=e.visible;a!==i&&i!==void 0&&this.changeVisibility(i);var o={x:n.x,y:n.y};e.x=isNaN(+e.x)?n.x:+e.x,e.y=isNaN(+e.y)?n.y:+e.y;var s=this.get("styles");if(e.stateStyles){var u=e.stateStyles;Et(s,u),delete e.stateStyles}Object.assign(n,e),(o.x!==e.x||o.y!==e.y)&&this.updatePosition(e),this.updateShape(r)}this.afterUpdate(),this.clearCache()},t.prototype.updateShape=function(e){var r=this.get("shapeFactory"),n=this.get("model"),a=n.type;if(r.shouldUpdate(a)&&a===this.get("currentShape")){var i=this.getShapeCfg(n,e);r.baseUpdate(a,i,this,e),e!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(r,a)},t.prototype.updatePosition=function(e){var r=this.get("model"),n=isNaN(+e.x)?+r.x:+e.x,a=isNaN(+e.y)?+r.y:+e.y,i=this.get("group");if(isNaN(n)||isNaN(a))return!1;r.x=n,r.y=a;var o=i.getMatrix();return o&&o[6]===n&&o[7]===a?!1:(i.resetMatrix(),RA(i,{x:n,y:a}),this.clearCache(),!0)},t.prototype.getBBox=function(){var e=this.get(bp);return e||(e=this.calculateBBox(),this.set(bp,e)),e},t.prototype.getCanvasBBox=function(){var e=this.get(wp);return e||(e=this.calculateCanvasBBox(),this.set(wp,e)),e},t.prototype.toFront=function(){var e=this.get("group");e.toFront()},t.prototype.toBack=function(){var e=this.get("group");e.toBack()},t.prototype.show=function(){this.changeVisibility(!0)},t.prototype.hide=function(){this.changeVisibility(!1)},t.prototype.changeVisibility=function(e){var r=this.get("group");e?r.show():r.hide(),this.set("visible",e)},t.prototype.isVisible=function(){return this.get("visible")},t.prototype.enableCapture=function(e){var r=this.get("group");r&&r.set("capture",e)},t.prototype.destroy=function(){if(!this.destroyed){var e=this.get("animate"),r=this.get("group");e&&r.stopAnimate(),r.shapeMap={},this.clearCache(),r.remove(),this._cfg=null,this.destroyed=!0}},t}(),pc={source:"start",target:"end"},ka="Node",bs="Point",t8="Anchor",r8=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},e.prototype.setEnd=function(r,n){var a=pc[r]+bs,i=r+ka,o=this.get(i);o&&!o.destroyed&&o.removeEdge(this),ln(n)?(this.set(a,n),this.set(i,null)):n&&(n.addEdge(this),this.set(i,n),this.set(a,null))},e.prototype.getLinkPoint=function(r,n,a){var i=pc[r]+bs,o=r+ka,s=this.get(i);if(!s){var u=this.get(o),f=r+t8,l=this.getPrePoint(r,a),c=n[f];Zt(c)||(s=u.getLinkPointByAnchor(c)),s=s||u.getLinkPoint(l),Zt(s.index)||this.set("".concat(r,"AnchorIndex"),s.index)}return s},e.prototype.getPrePoint=function(r,n){if(n&&n.length){var a=r==="source"?0:n.length-1;return n[a]}var i=r==="source"?"target":"source";return this.getEndPoint(i)},e.prototype.getEndPoint=function(r){var n=r+ka,a=pc[r]+bs,i=this.get(n);return i&&!i.destroyed?i.get("model"):this.get(a)},e.prototype.getControlPointsByCenter=function(r){var n=this.getEndPoint("source"),a=this.getEndPoint("target"),i=this.get("shapeFactory"),o=r.type;return i.getControlPoints(o,{startPoint:n,endPoint:a})},e.prototype.getEndCenter=function(r){var n=r+ka,a=pc[r]+bs,i=this.get(n);if(i){var o=i.getBBox();return{x:o.centerX,y:o.centerY}}return this.get(a)},e.prototype.init=function(){t.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(r,n){var a=this,i=a.get("linkCenter"),o=n!=null&&n.includes("move")?r:t.prototype.getShapeCfg.call(this,r);if(i)o.startPoint=a.getEndCenter("source"),o.endPoint=a.getEndCenter("target");else{var s=o.controlPoints||a.getControlPointsByCenter(o);o.startPoint=a.getLinkPoint("source",r,s),o.endPoint=a.getLinkPoint("target",r,s)}return o.sourceNode=a.get("sourceNode"),o.targetNode=a.get("targetNode"),o},e.prototype.getModel=function(){var r=this.get("model"),n=this.get("source".concat(ka)),a=this.get("target".concat(ka));return n?delete r["source".concat(ka)]:r.source=this.get("start".concat(bs)),a?delete r["target".concat(ka)]:r.target=this.get("end".concat(bs)),!Ye(r.source)&&!ln(r.source)&&(r.source=r.source.getID()),!Ye(r.target)&&!ln(r.target)&&(r.target=r.target.getID()),r},e.prototype.setSource=function(r){this.setEnd("source",r),this.set("source",r)},e.prototype.setTarget=function(r){this.setEnd("target",r),this.set("target",r)},e.prototype.getSource=function(){return this.get("source")},e.prototype.getTarget=function(){return this.get("target")},e.prototype.updatePosition=function(){return!1},e.prototype.update=function(r,n){n===void 0&&(n=void 0);var a=this.get("model"),i=a.visible,o=r.visible;i!==o&&o!==void 0&&this.changeVisibility(o);var s=this.get("source"),u=this.get("target");if(!(!s||s.destroyed||!u||u.destroyed)){var f=this.get("styles");if(r.stateStyles){var l=r.stateStyles;Et(f,l),delete r.stateStyles}Object.assign(a,r),this.updateShape(n),this.afterUpdate(),this.clearCache()}},e.prototype.destroy=function(){var r=this.get("source".concat(ka)),n=this.get("target".concat(ka));r&&!r.destroyed&&r.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),t.prototype.destroy.call(this)},e}(VC),xp="anchorPointsCache",n8="bboxCache",YC=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getNearestPoint=function(r,n){for(var a=0,i=r[0],o=Oh(r[0],n),s=0;s-1&&n.splice(a,1)},e.prototype.clearCache=function(){this.set(n8,null),this.set(xp,null)},e.prototype.getUpdateType=function(r){var n,a,i,o,s;if(r){var u=!Zt(r.x),f=!Zt(r.y),l=Object.keys(r);if(l.length===1&&(u||f)||l.length===2&&u&&f)return"move";if(Ot(r.x)||Ot(r.y)||r.type||r.anchorPoints||r.size||r!=null&&r.style&&(!((n=r==null?void 0:r.style)===null||n===void 0)&&n.r||!((a=r==null?void 0:r.style)===null||a===void 0)&&a.width||!((i=r==null?void 0:r.style)===null||i===void 0)&&i.height||!((o=r==null?void 0:r.style)===null||o===void 0)&&o.rx||!((s=r==null?void 0:r.style)===null||s===void 0)&&s.ry))return"bbox|label";var c=l.includes("label")||l.includes("labelCfg");return c?"style|label":"style"}},e.prototype.setState=function(r,n){var a=this;if(this.optimize){t.prototype.setState.call(this,r,n);return}this.runWithBBoxAffected(function(){return t.prototype.setState.call(a,r,n)})},e.prototype.clearStates=function(r){var n=this;if(this.optimize){t.prototype.clearStates.call(this,r);return}this.runWithBBoxAffected(function(){return t.prototype.clearStates.call(n,r)})},e.prototype.runWithBBoxAffected=function(r){var n=["r","width","height","rx","ry","lineWidth"],a=this.getKeyShape().attr(),i={};Object.keys(this.getKeyShape().attr()).forEach(function(f){n.includes(f)&&(i[f]=a[f])}),r();for(var o=this.getKeyShape().attr(),s=0;s-1?(n.splice(a,1),!0):!1}},e.prototype.removeNode=function(r){if(r){var n=this.getNodes(),a=n.indexOf(r);return a>-1?(n.splice(a,1),!0):!1}},e.prototype.getUpdateType=function(r){},e.prototype.getBBox=function(){this.set(Ax,null);var r=this.calculateCanvasBBox();return r},e.prototype.clearCache=function(){this.set(Mx,null),this.set(Ax,null),this.set(Cx,null)},e.prototype.destroy=function(){if(!this.destroyed){var r=this.get("animate"),n=this.get("group");r&&n.stopAnimate(),n.shapeMap={},this.clearCache(),this.set(gc,null),this.set("bbox",null),n.remove(),this._cfg=null,this.destroyed=!0}},e}(YC),yc="node",mc="edge",Tx="vedge",Wu="combo",i8="default",Ix="Mapper",ii="stateStyles",o8=function(){function t(e){var r=this;this.edgeToBeUpdateMap={},this.throttleRefresh=Ch(function(n){var a=r.graph;if(!(!a||a.get("destroyed"))){var i=r.edgeToBeUpdateMap;if(i){var o=Object.values(i);o.length&&(o.forEach(function(s){var u=s.edge;if(!(!u||u.destroyed)){var f=u.getSource(),l=u.getTarget();!f||f.destroyed||!l||l.destroyed||u.refresh(s.updateType)}}),r.edgeToBeUpdateMap={})}}},16,{trailing:!0,leading:!0}),this.graph=e,this.destroyed=!1}return t.prototype.addItem=function(e,r){var n=this.graph,a=e===Tx?mc:e,i=n.get("".concat(a,"Group"))||n.get("group"),o=Zs(a),s=null,u=n.get(a+Zs(ii))||{},f=n.get(i8+o);r[ii]&&(u=r[ii]),f&&_e(f,function(E,_){gn(E)&&!bt(E)?r[_]=_r({},E,r[_]):bt(E)?r[_]=r[_]||rr(f[_]):r[_]=r[_]||f[_]});var l=n.get(a+Ix);if(l){var c=l(r);c[ii]&&(u=c[ii],delete c[ii]),_e(c,function(E,_){gn(E)&&!bt(E)?r[_]=_r({},r[_],E):r[_]=c[_]||r[_]})}if(n.emit("beforeadditem",{type:e,model:r}),e===mc||e===Tx){var h=void 0,d=void 0;if(h=r.source,d=r.target,h&&Ye(h)&&(h=n.findById(h)),d&&Ye(d)&&(d=n.findById(d)),!h||!d){console.warn("The source or target node of edge ".concat(r.id," does not exist!"));return}h.getType&&h.getType()==="combo"&&(r.isComboEdge=!0),d.getType&&d.getType()==="combo"&&(r.isComboEdge=!0),s=new r8({model:r,source:h,target:d,styles:u,linkCenter:n.get("linkCenter"),group:i.addGroup()})}else if(e===yc)s=new YC({model:r,styles:u,group:i.addGroup()});else if(e===Wu){var v=r.children,p=oh(v,n),g=void 0,y=void 0;if(isNaN(p.x)?isNaN(r.x)&&(g=Math.random()*100):g=p.x,isNaN(p.y)?isNaN(r.y)&&(y=Math.random()*100):y=p.y,isNaN(r.x)||isNaN(r.y))r.x=g,r.y=y;else{var m=r.x-g,b=r.y-y;this.updateComboSucceeds(r.id,m,b,v)}var w=i.addGroup();w.setZIndex(r.depth),s=new a8({model:r,styles:u,animate:n.get("animate"),bbox:r.collapsed?oh([],n):p,group:w}),!r.collapsed&&s.getKeyShape().get("type")==="circle"&&(p.width=Math.hypot(p.height,p.width),p.height=p.width,s.set("bbox",p),s.refresh());var x=s.getModel();(v||[]).forEach(function(E){var _=n.findById(E.id);s.addChild(_),E.depth=x.depth+2})}if(s)return s.setOptimize(n.getNodes().length>n.get("optimizeThreshold")),n.get("".concat(e,"s")).push(s),n.get("itemMap")[s.get("id")]=s,n.emit("afteradditem",{item:s,model:r}),s},t.prototype.updateItem=function(e,r){var n=this,a,i,o=this.graph;if(Ye(e)&&(e=o.findById(e)),!(!e||e.destroyed)){var s="";e.getType&&(s=e.getType());var u=o.get(s+Ix),f=e.getModel(),l=f.x,c=f.y,h=e.getUpdateType(r);if(u){var d=_r({},f,r),v=u(d),p=_r({},f,v,r);v[ii]&&(e.set("styles",p[ii]),delete p[ii]),_e(p,function(M,C){r[C]=M})}else _e(r,function(M,C){f[C]&&gn(M)&&!bt(M)&&(r[C]=P(P({},f[C]),r[C]))});if(o.emit("beforeupdateitem",{item:e,cfg:r}),s===mc){if(r.source){var g=r.source;Ye(g)&&(g=o.findById(g)),e.setSource(g)}if(r.target){var y=r.target;Ye(y)&&(y=o.findById(y)),e.setTarget(y)}e.update(r)}else if(s===yc){e.update(r,h);var m=e.getEdges();h==="move"?_e(m,function(M){n.edgeToBeUpdateMap[M.getID()]={edge:M,updateType:h},n.throttleRefresh()}):h!=null&&h.includes("bbox")&&_e(m,function(M){M.refresh(h)})}else if(s===Wu){if(e.update(r,h),!isNaN(r.x)||!isNaN(r.y)){var b=r.x-l||0,w=r.y-c||0;this.updateComboSucceeds(f.id,b,w)}var x=e.getEdges(),E=(h==null?void 0:h.includes("bbox"))||h==="move";if(E&&s===Wu){var _=e.get("shapeFactory"),S=f.type||"circle",A=f.animate===void 0||r.animate===void 0?(i=(a=_[S])===null||a===void 0?void 0:a.options)===null||i===void 0?void 0:i.animate:f.animate||r.animate;A?setTimeout(function(){if(!(!e||e.destroyed)){var M=e.getKeyShape();!M||M.destroyed||_e(x,function(C){C&&!C.destroyed&&C.refresh()})}},201):_e(x,function(M){M.refresh()})}}e.setOptimize(o.getNodes().length>o.get("optimizeThreshold")),o.emit("afterupdateitem",{item:e,cfg:r})}},t.prototype.updateCombo=function(e,r,n){var a=this,i,o,s=this.graph;if(Ye(e)&&(e=s.findById(e)),!(!e||e.destroyed)){var u=e.getModel(),f=oh(r,s,e),l=f.x,c=f.y;e.set("bbox",f);var h=l,d=c;n?(h=isNaN(u.x)?l:u.x,d=isNaN(u.y)?c:u.y):(h=isNaN(l)?u.x:l,d=isNaN(c)?u.y:c),e.update({x:h,y:d});var v=e.get("shapeFactory"),p=u.type||"circle",g=u.animate===void 0?(o=(i=v[p])===null||i===void 0?void 0:i.options)===null||o===void 0?void 0:o.animate:u.animate;g?setTimeout(function(){if(!(!e||e.destroyed)){var y=e.getKeyShape();!y||y.destroyed||(e.getShapeCfg(u),a.updateComboEdges(e))}},201):this.updateComboEdges(e)}},t.prototype.updateComboEdges=function(e){for(var r,n,a=e.getEdges()||[],i=0;i-1&&o.splice(s,1),i===mc){var u=n.get("v".concat(i,"s")),f=u.indexOf(e);f>-1&&u.splice(f,1)}var l=e.get("id"),c=n.get("itemMap");delete c[l];var h=n.get("comboTrees"),d=e.get("id");if(i===yc){var v=e.getModel().comboId;if(h&&v){var p=h,g=!1;h.forEach(function(E){g||bn(E,function(_){if(_.id===d&&p){var S=p.indexOf(_);return p.splice(S,1),g=!0,!1}return p=_.children,!0})})}for(var y=e.getEdges(),m=y.length-1;m>=0;m--)n.removeItem(y[m],!1);v&&n.updateCombo(v)}else if(i===Wu){var b=e.getModel().parentId,w,x=!1;(h||[]).forEach(function(_){x||bn(_,function(S){return S.id===d?(w=S,x=!0,!1):!0})}),w.removed=!0,w&&w.children&&w.children.forEach(function(_){r.removeItem(_.id)});for(var y=e.getEdges(),m=y.length;m>=0;m--)n.removeItem(y[m],!1);b&&n.updateCombo(b)}e.destroy(),n.emit("afterremoveitem",{item:a,type:i})}},t.prototype.setItemState=function(e,r,n){var a=this.graph,i=r;Ye(n)&&(i="".concat(r,":").concat(n)),!(e.hasState(i)===n&&n||Ye(n)&&e.hasState(i))&&(a.emit("beforeitemstatechange",{item:e,state:i,enabled:n}),e.setState(r,n),a.autoPaint(),a.emit("afteritemstatechange",{item:e,state:i,enabled:n}))},t.prototype.priorityState=function(e,r){var n=this.graph,a=e;Ye(e)&&(a=n.findById(e)),this.setItemState(a,r,!1),this.setItemState(a,r,!0)},t.prototype.clearItemStates=function(e,r){var n=this.graph;Ye(e)&&(e=n.findById(e)),n.emit("beforeitemstatesclear",{item:e,states:r}),e.clearStates(r),n.emit("afteritemstatesclear",{item:e,states:r})},t.prototype.refreshItem=function(e){var r=this.graph;Ye(e)&&(e=r.findById(e)),r.emit("beforeitemrefresh",{item:e}),e.refresh(),r.emit("afteritemrefresh",{item:e})},t.prototype.addCombos=function(e,r){var n=this,a=this.graph;(e||[]).forEach(function(o){Ra(o,function(s){var u;return r.forEach(function(f){f.id===s.id&&(f.children=s.children,f.depth=s.depth,u=f)}),u&&n.addItem("combo",u),!0})});var i=a.get("comboGroup");i&&i.sort()},t.prototype.changeItemVisibility=function(e,r){var n=this,a=this.graph;if(Ye(e)&&(e=a.findById(e)),!e){console.warn("The item to be shown or hidden does not exist!");return}if(a.emit("beforeitemvisibilitychange",{item:e,visible:r}),e.changeVisibility(r),e.getType&&e.getType()===yc){var i=e.getEdges();_e(i,function(l){r&&!(l.get("source").isVisible()&&l.get("target").isVisible())||n.changeItemVisibility(l,r)})}else if(e.getType&&e.getType()===Wu){var o=a.get("comboTrees"),s=e.get("id"),u=[],f=!1;(o||[]).forEach(function(c){f||!c.children||c.children.length===0||bn(c,function(h){return h.id===s?(u=h.children,f=!0,!1):!0})}),u&&(!r||r&&!e.getModel().collapsed)&&u.forEach(function(c){var h=a.findById(c.id);n.changeItemVisibility(h,r)});var i=e.getEdges();_e(i,function(c){r&&!(c.get("source").isVisible()&&c.get("target").isVisible())||n.changeItemVisibility(c,r)})}return a.emit("afteritemvisibilitychange",{item:e,visible:r}),e},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),s8=function(){function t(e){this.graph=e,this.destroyed=!1}return t.prototype.updateState=function(e,r,n){var a=this.graph.get("states"),i=r;Ye(n)&&(i="".concat(r,":").concat(n)),a[i]||(a[i]=[]),n?a[i].push(e):a[i]=a[i].filter(function(o){return o!==e}),this.graph.set("states",a),this.graph.emit("graphstatechange",{states:a})},t.prototype.updateStates=function(e,r,n){var a=this.graph.get("states"),i=Ye(r)?[r]:r;i.forEach(function(o){var s=o;a[s]||(a[s]=[]),Ye(n)&&(s="".concat(o,":").concat(n)),n?a[s].push(e):a[s]=a[s].filter(function(u){return u!==e})}),this.graph.set("states",a),this.graph.emit("graphstatechange",{states:r})},t.prototype.destroy=function(){this.graph=null,this.destroyed=!0},t}(),u8=function(e,r){return!e||!r?e:e.replace(/\\?\{([^{}]+)\}/g,function(n,a){if(n.charAt(0)==="\\")return n.slice(1);var i=r[a];return i===0&&(i="0"),i||""})},qC=function(e){var r=[];if(e.length<2)throw new Error("point length must largn than 2, now it's ".concat(e.length));for(var n=0,a=e;n0?o-1:r-1,u=Wi([0,0],fn([0,0],i[s].v,wn([0,0],i[o].v,-1)));i[o].p=fn([0,0],i[o].p,wn([0,0],u,e))}return i.map(function(f){var l=f.p;return{x:l[0],y:l[1]}})}var l8=function(e,r){for(var n=[],a=0;a<5;a++){var i=Math.cos((18+72*a)/180*Math.PI)*e,o=Math.sin((18+72*a)/180*Math.PI)*e,s=Math.cos((54+72*a)/180*Math.PI)*r,u=Math.sin((54+72*a)/180*Math.PI)*r;a===0?n.push(["M",i,-o]):n.push(["L",i,-o]),n.push(["L",s,-u])}return n.push(["Z"]),n};const c8=Object.freeze(Object.defineProperty({__proto__:null,getClosedSpline:K0,getControlPoint:zh,getSpline:qC,getStarPath:l8,paddedHull:HC,pathToPoints:Z0,pointsToPolygon:f8,roundedHull:Q0},Symbol.toStringTag,{value:"Module"}));var Lx=function(e,r,n){return(e.y-n.y)*(r.x-n.x)-(e.x-n.x)*(r.y-n.y)},Dx=function(e){var r=e.map(function(c){return{x:c.getModel().x,y:c.getModel().y}});r.sort(function(c,h){return c.x===h.x?c.y-h.y:c.x-h.x});for(var n={},a=r.length-1;a>=0;a--){var i=r[a],o=i.x,s=i.y;n["".concat(o,"-").concat(s)]&&r.splice(a,1),n["".concat(o,"-").concat(s)]=!0}if(r.length===1)return r;for(var u=[],a=0;a=2&&Lx(u[u.length-2],u[u.length-1],r[a])<=0;)u.pop();u.push(r[a])}for(var f=[],a=r.length-1;a>=0;a--){for(;f.length>=2&&Lx(f[f.length-2],f[f.length-1],r[a])<=0;)f.pop();f.push(r[a])}f.pop(),u.pop();var l=u.concat(f);return l},h8={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 d8(t,e,r){var n=!1,a=function(u,f){return e.cells[u+f*e.width]},i=function(u,f){var l=0;return a(u-1,f-1)>=r&&(l+=1),a(u,f-1)>r&&(l+=2),a(u-1,f)>r&&(l+=4),a(u,f)>r&&(l+=8),l},o=function(u,f){for(var l=u,c=f,h,d,v=0;v-1){if(!(t[0].x!==l||t[0].y!==c))return!0}else t.push({x:l,y:c});var p=i(l,c);switch(p){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:l++;break;case 12:case 14:case 4:l--;break;case 6:h===0&&(d===-1?l-=1:l+=1);break;case 1:case 13:case 5:c--;break;case 9:h===1&&(d===0?c-=1:c+=1);break;case 10:case 8:case 11:c++;break;default:return console.warn("Marching squares invalid state: ".concat(p)),!0}}};this.march=function(){for(var s=0;sr&&i(s,u)!==15&&(n=o(s,u));return n}}var v8=function(e,r,n){var a=Math.ceil(e/n),i=Math.ceil(r/n),o=new Float32Array(Math.max(0,a*i)).fill(0);return{cells:o,width:a,height:i}},p8=function(e,r,n){var a=null,i=Number.POSITIVE_INFINITY;return r.forEach(function(o){var s={x:e.getModel().x,y:e.getModel().y},u={x:o.getModel().x,y:o.getModel().y},f=Lh(s,u),l=new $o(s.x,s.y,u.x,u.y),c=n.reduce(function(h,d){return Oy(d,l)>0?h+1:h},0);f*Math.pow(c+1,2)=0&&o=1;)x/=1.5,E=Px(v,x,g,w),_=f(E,o)||f(E,i),S=l(E,r);E&&!_&&(!w||!S)&&(o.push(new $o(d.x1,d.y1,E.x,E.y)),o.push(new $o(E.x,E.y,d.x2,d.y2)),s=!0)};m(!0),s||m(!1)}}s||i.push(d),u+=1};!s&&o.length;)c()}for(;o.length;)i.push(o.pop());return i};function y8(t,e,r,n,a){var i=p8(t,r,e);if(i===null)return[];var o=function(c){for(var h=[];c.length>0;){var d=c.pop();if(c.length===0){h.push(d);break}var v=c.pop(),p=new $o(d.x1,d.y1,v.x2,v.y2),g=ZC(e,p);g?(h.push(d),c.push(v)):c.push(p)}return h},s=new $o(t.getModel().x,t.getModel().y,i.getModel().x,i.getModel().y),u=g8(s,e,n,a),f=o(u);return f}var m8=function(e,r,n){var a=Object.assign(h8,n),i=zA(e.map(function(m){return{x:m.getModel().x,y:m.getModel().y}}));e=e.sort(function(m,b){return Lh({x:m.getModel().x,y:m.getModel().y},i)-Lh({x:b.getModel().x,y:b.getModel().y},i)});var o=[],s=[];e.forEach(function(m){var b=y8(m,r,o,a.maxRoutingIterations,a.morphBuffer);b.forEach(function(w){s.push(w)}),o.push(m)});for(var u=b8(e,s,a.nodeR0),f=v8(u.width,u.height,a.pixelGroupSize),l=[],c=[],h=0;h1)for(v=Math.floor(d.length/a.skip);v<3&&a.skip>1;)a.skip-=1,v=Math.floor(d.length/a.skip);for(var p=0,g=0;g0)a.nonMemberInfluenceFactor*=.8;else break}return c};function b8(t,e,r){var n={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,width:0,height:0,x:0,y:0},a=[];t.forEach(function(u){a.push(u.getBBox())}),e.forEach(function(u){a.push(u.getBBox())});for(var i=0,o=a;in.maxX?s.maxX:n.maxX)+r,n.maxY=(s.maxY>n.maxY?s.maxY:n.maxY)+r}return n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.x=n.minX,n.y=n.minY,n}function w8(t,e,r,n,a,i){function o(d,v){var p=Math.floor((d-v)/i.pixelGroupSize);return p<0?0:p}function s(d,v){return d*i.pixelGroupSize+v}var u=(i.nodeR0-i.nodeR1)*(i.nodeR0-i.nodeR1),f=(i.edgeR0-i.edgeR1)*(i.edgeR0-i.edgeR1),l=function(v,p){var g=Math.min(o(v.minX,p+n.minX),a.width),y=Math.min(o(v.minY,p+n.minY),a.height),m=Math.min(o(v.maxX,-p+n.minX),a.width),b=Math.min(o(v.maxY,-p+n.minY),a.height);return[g,y,m,b]},c=function(v,p){for(var g=v.getBBox(),y=l(g,i.nodeR1),m=y[0],b=y[1],w=y[2],x=y[3],E=b;Eu.y?n?f.topLeft:f.bottomRight:n?f.topRight:f.bottomLeft:o.ys.x?n?f.topLeft:f.bottomRight:n?f.bottomLeft:f.topRight:i.x0?this.cfg.padding+e:10+e,this.cfg.bubbleCfg={nodeR0:this.padding-e,nodeR1:this.padding-e,morphBuffer:this.padding-e}},t.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")},t.prototype.calcPath=function(e,r){var n,a,i;switch(this.type){case"round-convex":n=Dx(e),i=Q0(n.map(function(o){return[o.x,o.y]}),this.padding),a=W0(i);break;case"smooth-convex":n=Dx(e),n.length===2?(i=Q0(n.map(function(o){return[o.x,o.y]}),this.padding),a=W0(i)):n.length>2&&(i=HC(n.map(function(o){return[o.x,o.y]}),this.padding),a=K0(i));break;case"bubble":n=m8(e,r,this.cfg.bubbleCfg),a=n.length>=2&&K0(n);break}return a},t.prototype.render=function(){this.group.addShape("path",{attrs:P({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},t.prototype.addMember=function(e){if(e){Ye(e)&&(e=this.graph.findById(e)),this.members.push(e);var r=this.nonMembers.indexOf(e);return r>-1&&this.nonMembers.splice(r,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.addNonMember=function(e){if(e){Ye(e)&&(e=this.graph.findById(e)),this.nonMembers.push(e);var r=this.members.indexOf(e);return r>-1&&this.members.splice(r,1),this.updateData(this.members,this.nonMembers),!0}},t.prototype.removeMember=function(e){if(e){Ye(e)&&(e=this.graph.findById(e));var r=this.members.indexOf(e);return r>-1?(this.members.splice(r,1),this.updateData(this.members,this.nonMembers),!0):!1}},t.prototype.removeNonMember=function(e){if(e){Ye(e)&&(e=this.graph.findById(e));var r=this.nonMembers.indexOf(e);return r>-1?(this.nonMembers.splice(r,1),this.updateData(this.members,this.nonMembers),!0):!1}},t.prototype.updateData=function(e,r){var n=this;this.group.findById(this.id).remove(),e&&(this.members=e.map(function(a){return Ye(a)?n.graph.findById(a):a})),r&&(this.nonMembers=r.map(function(a){return Ye(a)?n.graph.findById(a):a})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.updateStyle=function(e){var r=this.group.findById(this.id);r.attr(P({},e))},t.prototype.updateCfg=function(e){var r=this;this.cfg=_r(this.cfg,e),this.id=this.cfg.id,this.group=this.cfg.group,e.members&&(this.members=this.cfg.members.map(function(n){return Ye(n)?r.graph.findById(n):n})),e.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(n){return Ye(n)?r.graph.findById(n):n})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},t.prototype.contain=function(e){var r=this,n;Ye(e)?n=this.graph.findById(e):n=e;var a,i=n.getKeyShape();if(n.get("type")==="path")a=Z0(i.attr("path"));else{var o=i.getCanvasBBox();a=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return a=a.map(function(s){var u=r.graph.getPointByCanvas(s[0],s[1]);return[u.x,u.y]}),BA(a,Z0(this.path))},t.prototype.destroy=function(){this.group.remove(),this.cfg=null},t}(),Vu=eo,E8="node",_8=function(t){jt(e,t);function e(r){var n=t.call(this)||this;return n.sortCombos=oy(function(){var a=n.get("comboSorted");if(!(!n||n.destroyed||a)){n.set("comboSorted",!0);var i=[],o={},s=n.get("comboTrees");(s||[]).forEach(function(f){bn(f,function(l){return i[l.depth]?i[l.depth].push(l.id):i[l.depth]=[l.id],o[l.id]=l.depth,!0})});var u=n.getEdges().concat(n.get("vedges"));(u||[]).forEach(function(f){var l=f.getModel(),c=o[l.source]||0,h=o[l.target]||0,d=Math.max(c,h);i[d]?i[d].push(l.id):i[d]=[l.id]}),i.forEach(function(f){if(!(!f||!f.length))for(var l=f.length-1;l>=0;l--){var c=n.findById(f[l]);c&&c.toFront()}})}},500,!1),n.cfg=_r(n.getDefaultCfg(),r),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new Gs(n.cfg.maxStep),n.redoStack=new Gs(n.cfg.maxStep)),n}return e.prototype.init=function(){this.initCanvas();var r=new Zj(this),n=new cz(this),a=new o8(this),i=new s8(this);this.set({viewController:r,modeController:n,itemController:a,stateController:i}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var r=this.get("canvas");if(r){var n=r.get("el"),a=(n||{}).id,i=a===void 0?"g6":a,o=r.addGroup({id:"".concat(i,"-root"),className:ft.rootContainerClassName});if(this.get("groupByTypes")){var s=o.addGroup({id:"".concat(i,"-edge"),className:ft.edgeContainerClassName}),u=o.addGroup({id:"".concat(i,"-node"),className:ft.nodeContainerClassName}),f=o.addGroup({id:"".concat(i,"-combo"),className:ft.comboContainerClassName});f.toBack(),this.set({nodeGroup:u,edgeGroup:s,comboGroup:f})}var l=o.addGroup({id:"".concat(i,"-delegate"),className:ft.delegateContainerClassName});this.set({delegateGroup:l}),this.set("group",o)}},e.prototype.getDefaultCfg=function(){return{container:void 0,width:void 0,height:void 0,renderer:"canvas",modes:{},plugins:[],data:{},fitViewPadding:10,minZoom:.02,maxZoom:10,event:!0,groupByTypes:!0,directed:!1,autoPaint:!0,nodes:[],edges:[],combos:[],vedges:[],itemMap:{},linkCenter:!1,defaultNode:{},defaultEdge:{},nodeStateStyles:{},edgeStateStyles:{},states:{},animate:!1,animateCfg:{onFrame:void 0,duration:500,easing:"easeLinear"},callback:void 0,enabledStack:!1,maxStep:10,tooltips:[],optimizeThreshold:1e3}},e.prototype.set=function(r,n){return ln(r)?this.cfg=P(P({},this.cfg),r):this.cfg[r]=n,r==="enabledStack"&&n&&!this.undoStack&&!this.redoStack&&(this.undoStack=new Gs(this.cfg.maxStep),this.redoStack=new Gs(this.cfg.maxStep)),this},e.prototype.get=function(r){var n;return(n=this.cfg)===null||n===void 0?void 0:n[r]},e.prototype.getGroup=function(){return this.get("group")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.getMinZoom=function(){return this.get("minZoom")},e.prototype.setMinZoom=function(r){return this.set("minZoom",r)},e.prototype.getMaxZoom=function(){return this.get("maxZoom")},e.prototype.setMaxZoom=function(r){return this.set("maxZoom",r)},e.prototype.getWidth=function(){return this.get("width")},e.prototype.getHeight=function(){return this.get("height")},e.prototype.clearItemStates=function(r,n){Ye(r)&&(r=this.findById(r));var a=this.get("itemController");n||(n=r.get("states")),a.clearItemStates(r,n);var i=this.get("stateController");i.updateStates(r,n,!1)},e.prototype.node=function(r){typeof r=="function"&&this.set("nodeMapper",r)},e.prototype.edge=function(r){typeof r=="function"&&this.set("edgeMapper",r)},e.prototype.combo=function(r){typeof r=="function"&&this.set("comboMapper",r)},e.prototype.findById=function(r){return this.get("itemMap")[r]},e.prototype.find=function(r,n){var a,i=this.get("".concat(r,"s"));return _e(i,function(o,s){if(n(o,s))return a=o,a}),a},e.prototype.findAll=function(r,n){var a=[];return _e(this.get("".concat(r,"s")),function(i,o){n(i,o)&&a.push(i)}),a},e.prototype.findAllByState=function(r,n,a){return a?this.findAll(r,function(i){return i.hasState(n)&&a(i)}):this.findAll(r,function(i){return i.hasState(n)})},e.prototype.translate=function(r,n,a,i){var o=this,s=this.get("group"),u=rr(s.getMatrix());if(u||(u=[1,0,0,0,1,0,0,0,1]),a){var f=Df({animateCfg:i,callback:function(){return o.emit("viewportchange",{action:"translate",matrix:s.getMatrix()})}});_0(s,{x:s.getCanvasBBox().x+r,y:s.getCanvasBBox().y+n},a,f||{duration:500,easing:"easeCubic"})}else u=Vu(u,[["t",r,n]]),s.setMatrix(u),this.emit("viewportchange",{action:"translate",matrix:u}),this.autoPaint()},e.prototype.moveTo=function(r,n,a,i){var o=this.get("group");_0(o,{x:r,y:n},a,i||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:o.getMatrix()})},e.prototype.fitView=function(r,n,a,i){r&&this.set("fitViewPadding",r);var o=this.get("viewController");n?o.fitViewByRules(n,a,i):o.fitView(a,i),this.autoPaint()},e.prototype.fitCenter=function(r,n){var a=this.get("viewController");a.fitCenter(r,n),this.autoPaint()},e.prototype.addBehaviors=function(r,n){var a=this.get("modeController");return a.manipulateBehaviors(r,n,!0),this},e.prototype.removeBehaviors=function(r,n){var a=this.get("modeController");return a.manipulateBehaviors(r,n,!1),this},e.prototype.updateBehavior=function(r,n,a){var i=this.get("modeController");return i.updateBehavior(r,n,a),this},e.prototype.zoom=function(r,n,a,i){var o=this,s=this.get("group"),u=rr(s.getMatrix())||[1,0,0,0,1,0,0,0,1],f=this.get("minZoom"),l=this.get("maxZoom"),c=this.getZoom()||1,h=c*r,d=r,v=!1;if(f&&hl&&(d=l/c,v=!0),n?u=Vu(u,[["t",-n.x,-n.y],["s",d,d],["t",n.x,n.y]]):u=Vu(u,[["s",d,d]]),a){var p=rr(s.getMatrix());p||(p=[1,0,0,0,1,0,0,0,1]);var g=p[0],y=g*d,m=Df({animateCfg:i,callback:function(){return o.emit("viewportchange",{action:"zoom",matrix:s.getMatrix()})}});s.animate(function(b){if(b===1)p=u;else{var w=Ly(g,y,b)/p[0];n?p=Vu(p,[["t",-n.x,-n.y],["s",w,w],["t",n.x,n.y]]):p=Vu(p,[["s",w,w]])}return{matrix:p}},m)}else s.setMatrix(u),this.emit("viewportchange",{action:"zoom",matrix:u}),this.autoPaint();return!v},e.prototype.zoomTo=function(r,n,a,i){var o=r/this.getZoom();return this.zoom(o,n,a,i)},e.prototype.focusItem=function(r,n,a){var i=this.get("viewController"),o=!1;n?o=!0:n===void 0&&(o=this.get("animate"));var s={};a?s=a:a===void 0&&(s=this.get("animateCfg")),i.focus(r,o,s),this.autoPaint()},e.prototype.focusItems=function(r,n,a,i){var o=this.get("viewController");o.focusItems(r,n,a,i)},e.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},e.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},e.prototype.getPointByClient=function(r,n){var a=this.get("viewController");return a.getPointByClient(r,n)},e.prototype.getClientByPoint=function(r,n){var a=this.get("viewController");return a.getClientByPoint(r,n)},e.prototype.getPointByCanvas=function(r,n){var a=this.get("viewController");return a.getPointByCanvas(r,n)},e.prototype.getCanvasByPoint=function(r,n){var a=this.get("viewController");return a.getCanvasByPoint(r,n)},e.prototype.getGraphCenterPoint=function(){var r=this.get("group").getCanvasBBox();return{x:(r.minX+r.maxX)/2,y:(r.minY+r.maxY)/2}},e.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},e.prototype.showItem=function(r,n){n===void 0&&(n=!0);var a=this.get("itemController"),i=a.changeItemVisibility(r,!0);if(n&&this.get("enabledStack")){var o=i.getID(),s=i.getType(),u={},f={};switch(s){case"node":u.nodes=[{id:o,visible:!1}],f.nodes=[{id:o,visible:!0}];break;case"edge":u.nodes=[{id:o,visible:!1}],f.edges=[{id:o,visible:!0}];break;case"combo":u.nodes=[{id:o,visible:!1}],f.combos=[{id:o,visible:!0}];break}this.pushStack("visible",{before:u,after:f})}},e.prototype.hideItem=function(r,n){n===void 0&&(n=!0);var a=this.get("itemController"),i=a.changeItemVisibility(r,!1);if(n&&this.get("enabledStack")){var o=i.getID(),s=i.getType(),u={},f={};switch(s){case"node":u.nodes=[{id:o,visible:!0}],f.nodes=[{id:o,visible:!1}];break;case"edge":u.nodes=[{id:o,visible:!0}],f.edges=[{id:o,visible:!1}];break;case"combo":u.nodes=[{id:o,visible:!0}],f.combos=[{id:o,visible:!1}];break}this.pushStack("visible",{before:u,after:f})}},e.prototype.refreshItem=function(r){var n=this.get("itemController");n.refreshItem(r)},e.prototype.setAutoPaint=function(r){var n=this;n.set("autoPaint",r);var a=n.get("canvas");a.set("autoDraw",r)},e.prototype.remove=function(r,n){n===void 0&&(n=!0),this.removeItem(r,n)},e.prototype.removeItem=function(r,n){n===void 0&&(n=!0);var a=r;if(Ye(r)&&(a=this.findById(r)),!a&&Ye(r))console.warn("The item ".concat(r," to be removed does not exist!"));else if(a){var i="";if(a.getType&&(i=a.getType()),n&&this.get("enabledStack")){var o=P(P({},a.getModel()),{itemType:i}),s={};switch(i){case"node":{s.nodes=[o],s.edges=[];for(var u=a.getEdges(),f=u.length-1;f>=0;f--)s.edges.push(P(P({},u[f].getModel()),{itemType:"edge"}));break}case"edge":s.edges=[o];break;case"combo":s.combos=[o];break}this.pushStack("delete",{before:s,after:{}})}if(i==="node"){var l=a.getModel();l.comboId&&this.updateComboTree(a,void 0,!1)}var c=this.get("itemController");if(c.removeItem(a),i==="combo"){var h=I0(this.get("comboTrees"));this.set("comboTrees",h)}}},e.prototype.innerAddItem=function(r,n,a){if(!lz(r,n))return!1;if(n.id&&this.findById(n.id)){console.warn("This item exists already. Be sure the id %c".concat(n.id,"%c is unique."),"font-size: 20px; color: red;","");return}var i,o=this.get("comboTrees")||[];if(r==="combo"){var s=this.get("itemMap"),u=!1;if(o.forEach(function(v){u||Ra(v,function(p){if(n.parentId===p.id){u=!0;var g=P({id:n.id,depth:p.depth+2},n);p.children?p.children.push(g):p.children=[g],n.depth=g.depth,i=a.addItem(r,n)}var y=s[p.id];return u&&y&&y.getType&&y.getType()==="combo"&&a.updateCombo(y,p.children),!0})}),!u){var f=P({id:n.id,depth:0},n);n.depth=f.depth,o.push(f),i=a.addItem(r,n)}this.set("comboTrees",o),n.collapsed&&(this.collapseCombo(i,!1),this.updateCombo(i))}else if(r==="node"&&Ye(n.comboId)&&o){var l=this.findById(n.comboId);l&&l.getType&&l.getType()!=="combo"&&console.warn("'".concat(n.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),i=a.addItem(r,n);var c=this.get("itemMap"),h=!1,d=!1;o.forEach(function(v){d||h||Ra(v,function(p){if(p.id===n.id)return d=!0,!1;if(n.comboId===p.id&&!d){h=!0;var g=rr(n);g.itemType="node",p.children?p.children.push(g):p.children=[g],g.depth=p.depth+1}return h&&c[p.id].getType&&c[p.id].getType()==="combo"&&a.updateCombo(c[p.id],p.children),!0})})}else i=a.addItem(r,n);if(r==="node"&&n.comboId||r==="combo"&&n.parentId){var l=this.findById(n.comboId||n.parentId);l&&l.getType&&l.getType()==="combo"&&l.addChild(i)}return i},e.prototype.addItem=function(r,n,a,i){a===void 0&&(a=!0),i===void 0&&(i=!0);var o=this.get("comboSorted");this.set("comboSorted",o&&!i);var s=this.get("itemController"),u=this.innerAddItem(r,n,s);if(u===!1||u===!0)return u;var f=this.get("combos");if(f&&f.length>0&&this.sortCombos(),this.autoPaint(),a&&this.get("enabledStack")){var l=P(P({},u.getModel()),{itemType:r}),c={};switch(r){case"node":c.nodes=[l];break;case"edge":c.edges=[l];break;case"combo":c.combos=[l];break}this.pushStack("add",{before:{},after:c})}return u},e.prototype.addItems=function(r,n,a){r===void 0&&(r=[]),n===void 0&&(n=!0),a===void 0&&(a=!0);var i=this.get("comboSorted");this.set("comboSorted",i&&!a);for(var o=this.get("itemController"),s=[],u=0;u0&&this.sortCombos()}if(this.autoPaint(),n&&this.get("enabledStack")){for(var c={nodes:[],edges:[],combos:[]},u=0;u=0;g--)v[g].destroyed&&v.splice(g,1);h&&(o.addCombos(h),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",c,s.edges),_e(l,function(w,x){w.getType&&(w.getType()==="node"||w.getType()==="combo")||c.edges.indexOf(w)<0&&(delete l[x],o.remove(w,!1))}),(this.get("comboTrees")||[]).forEach(function(w){Ra(w,function(x){var E=a.findById(x.id);return E.getType()==="combo"&&x.collapsed&&a.collapseCombo(x.id,!1),!0})}),this.set({nodes:c.nodes,edges:c.edges});var y=(this.get("layout")||{}).relayoutAtChangeData,m=y===void 0?!0:y,b=this.get("layoutController");return m&&b&&(b.changeData(function(){setTimeout(function(){var w;(w=o.getCombos())===null||w===void 0||w.forEach(function(x){x.set("animate",!0)})},0)}),o.get("animate")&&!b.getLayoutType()?(o.positionsAnimate(),(i=o.getCombos())===null||i===void 0||i.forEach(function(w){return w.set("animate",!0)})):o.autoPaint()),setTimeout(function(){u.set("localRefresh",f)},16),this.set("data",s),this.emit("afterchangedata"),this},e.prototype.addCombos=function(r){var n=this,a=n.get("comboTrees"),i=this.get("itemController");i.addCombos(a,r)},e.prototype.createCombo=function(r,n,a){var i=this;a===void 0&&(a=!0);var o=this.get("itemController");this.set("comboSorted",!1);var s="",u;if(r){if(Ye(r))s=r,u={id:r};else{if(s=r.id,!s){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}u=r}var f=a&&this.get("enabledStack"),l={nodes:[],combos:[]};f&&n.forEach(function(y){var m=i.findById(y),b=m.getType();if(!(b!=="node"&&b!=="combo")){var w=m.getModel();l["".concat(b,"s")].push({id:y,parentId:b==="node"?w.comboId:w.parentId})}});var c=this.get("comboTrees"),h=new Set(n),d=new Map;c&&(c.forEach(function(y){Ra(y,function(m,b,w){if(h.has(m.id)){if(b){var x=i.findById(b.id),E=i.findById(m.id);b.children.splice(w,1),x.removeChild(E),o.updateCombo(x,b.children)}m.itemType==="combo"&&d.set(m.id,m)}return!0})}),c=c.filter(function(y){return!h.has(y.id)}),this.set("comboTrees",c));var v={nodes:[],combos:[]},p=n.map(function(y){var m=i.findById(y),b=m.getModel(),w="";m.getType&&(w=m.getType());var x=d.get(y)||{id:m.getID(),itemType:w};return w==="combo"?(x.parentId=s,b.parentId=s):w==="node"&&(x.comboId=s,b.comboId=s),f&&v["".concat(w,"s")].push({id:b.id,parentId:s}),x});u.children=p,this.addItem("combo",u,!1),this.set("comboSorted",!1),c&&(c.forEach(function(y){bn(y,function(m){return m.id===s?(m.itemType="combo",m.children=p,!1):!0})}),this.sortCombos()),f&&(v.combos.push(u),this.pushStack("createCombo",{before:l,after:v}));var g=this.findById(s);!g.getModel().parentId&&g.getChildren().combos.length&&this.updateComboTree(g,void 0,!1),setTimeout(function(){g.set("animate",!0)},0)}},e.prototype.uncombo=function(r,n){var a=this,i,o;n===void 0&&(n=!0);var s=this,u=r;if(Ye(r)&&(u=this.findById(r)),!u||u.getType&&u.getType()!=="combo"){console.warn("The item is not a combo!");return}var f=u.getModel(),l=u.getModel().parentId,c=s.get("comboTrees");c||(c=[]);var h=this.get("itemMap"),d=u.get("id"),v,p=[],g=this.get("combos"),y=this.findById(l),m=n&&this.get("enabledStack"),b={};if(m&&(b=rr(f),b.children=[]),c.forEach(function(_){v||Ra(_,function(S){var A;if(S.id===d){v=S;var M=u.getEdges().map(function(k){return k.getID()});M.forEach(function(k){a.removeItem(k,!1)});var C=g.indexOf(u);g.splice(C,1),delete h[d];var I=rr(u.getModel());u.destroy(),a.emit("afterremoveitem",{item:I,type:"combo"})}if(l&&v&&S.id===l){y.removeCombo(u),p=S.children;var C=p.indexOf(v);return C!==-1&&p.splice(C,1),(A=v.children)===null||A===void 0||A.forEach(function(O){var B=a.findById(O.id),L=B.getModel();B.getType&&B.getType()==="combo"?(O.parentId=l,delete O.comboId,L.parentId=l,delete L.comboId):B.getType&&B.getType()==="node"&&(O.comboId=l,L.comboId=l),y.addChild(B),p.push(O)}),a.updateCombo(y),!1}return!0})}),!l&&v){var w=c.indexOf(v);c.splice(w,1),(i=v.children)===null||i===void 0||i.forEach(function(_){_.parentId=void 0;var S=a.findById(_.id).getModel();delete S.parentId,delete S.comboId,_.itemType!=="node"&&c.push(_)})}if(m){var x={nodes:[],combos:[]},E={nodes:[],combos:[]};(o=v.children)===null||o===void 0||o.forEach(function(_){var S=a.findById(_.id),A=S.getType();A!=="node"&&A!=="combo"||(x["".concat(A,"s")].push({id:_.id,parentId:d}),E["".concat(A,"s")].push({id:_.id,parentId:l}))}),x.combos.push(b),this.pushStack("uncombo",{before:x,after:E})}},e.prototype.updateCombos=function(r){var n=this;r===void 0&&(r=!1);var a=this,i=this.get("comboTrees"),o=a.get("itemController"),s=a.get("itemMap");(i||[]).forEach(function(u){Ra(u,function(f){var l;if(!f)return!0;var c=s[f.id];if(((l=c==null?void 0:c.getType)===null||l===void 0?void 0:l.call(c))==="combo"){var h=Xn([],c.getStates(),!0);_e(h,function(d){return n.setItemState(c,d,!1)}),o.updateCombo(c,f.children,r),_e(h,function(d){return n.setItemState(c,d,!0)})}return!0})}),a.sortCombos()},e.prototype.updateCombo=function(r){var n=this,a=this,i=r,o;if(Ye(r)&&(i=this.findById(r)),!i||i.getType&&i.getType()!=="combo"){console.warn("The item to be updated is not a combo!");return}o=i.get("id");var s=this.get("comboTrees"),u=a.get("itemController"),f=a.get("itemMap");(s||[]).forEach(function(l){Ra(l,function(c){if(!c)return!0;var h=f[c.id];if(o===c.id&&h&&h.getType&&h.getType()==="combo"){var d=Xn([],h.getStates(),!0);_e(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!1)}),u.updateCombo(h,c.children),_e(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!0)}),o&&(o=c.parentId)}return!0})})},e.prototype.updateComboTree=function(r,n,a){a===void 0&&(a=!0);var i=this;this.set("comboSorted",!1);var o;Ye(r)?o=i.findById(r):o=r;var s=o.getModel(),u=s.comboId||s.parentId,f="";if(o.getType&&(f=o.getType()),n&&f==="combo"){var l=this.get("comboTrees"),c=!0,h;if((l||[]).forEach(function(m){h||bn(m,function(b){if(!h)return b.id===o.getID()&&(h=b),!0})}),bn(h,function(m){return m.id===n?(c=!1,!1):!0}),!c){console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!");return}}if(a&&this.get("enabledStack")){var d={},v={};f==="combo"?(d.combos=[{id:s.id,parentId:s.parentId}],v.combos=[{id:s.id,parentId:n}]):f==="node"&&(d.nodes=[{id:s.id,parentId:s.comboId}],v.nodes=[{id:s.id,parentId:n}]),this.pushStack("updateComboTree",{before:d,after:v})}if(s.parentId||s.comboId){var p=this.findById(s.parentId||s.comboId);p&&p.removeChild(o)}if(f==="combo"?s.parentId=n:f==="node"&&(s.comboId=n),n){var g=this.findById(n);g&&g.addChild(o)}if(u){var g=this.findById(u);g&&g.removeChild(o)}var y=I0(this.get("comboTrees"),s.id,n);this.set("comboTrees",y),this.updateCombos()},e.prototype.save=function(){var r=[],n=[],a=[];return _e(this.get("nodes"),function(i){r.push(i.getModel())}),_e(this.get("edges"),function(i){n.push(i.getModel())}),_e(this.get("combos"),function(i){a.push(i.getModel())}),{nodes:r,edges:n,combos:a}},e.prototype.changeSize=function(r,n){var a=this.get("viewController");return a.changeSize(r,n),this},e.prototype.refresh=function(){var r=this;if(r.emit("beforegraphrefresh"),r.get("animate"))r.positionsAnimate();else{var n=r.get("nodes"),a=r.get("edges"),i=r.get("edges");_e(n,function(o){o.refresh()}),_e(a,function(o){o.refresh()}),_e(i,function(o){o.refresh()})}r.emit("aftergraphrefresh"),r.autoPaint()},e.prototype.getNodes=function(){return this.get("nodes")},e.prototype.getEdges=function(){return this.get("edges")},e.prototype.getCombos=function(){return this.get("combos")},e.prototype.getComboChildren=function(r){if(Ye(r)&&(r=this.findById(r)),!r||r.getType&&r.getType()!=="combo"){console.warn("The combo does not exist!");return}return r.getChildren()},e.prototype.positionsAnimate=function(r){var n=this;n.emit("beforeanimate");var a=n.get("animateCfg"),i=a.onFrame,o=r?n.getNodes().concat(n.getCombos()):n.getNodes(),s=o.map(function(f){var l=f.getModel();return{id:l.id,x:l.x,y:l.y}});n.stopAnimate();var u=n.get("canvas");n.animating=!0,setTimeout(function(){u.animate(function(f){_e(s,function(l){var c=n.findById(l.id);if(!(!c||c.destroyed)){var h=c.get("originAttrs"),d=c.get("model"),v=c.getContainer().getMatrix();if(h==null&&(v&&(h={x:v[6],y:v[7]}),c.set("originAttrs",h||0)),i){var p=i(c,f,l,h||{x:0,y:0});c.set("model",Object.assign(d,p))}else h?(d.x=h.x+(l.x-h.x)*f,d.y=h.y+(l.y-h.y)*f):(d.x=l.x,d.y=l.y)}}),n.refreshPositions(r)},{duration:a.duration,easing:a.easing,callback:function(){_e(o,function(l){l.set("originAttrs",null)}),a.callback&&a.callback(),n.emit("afteranimate"),n.animating=!1}})},0)},e.prototype.refreshPositions=function(r){var n=this;n.emit("beforegraphrefreshposition");var a=n.get("nodes"),i=n.get("edges"),o=n.get("vedges"),s=n.get("combos"),u,f={},l=function(h){_e(h,function(d){u=d.getModel();var v=d.get("originAttrs");if(!(v&&u.x===v.x&&u.y===v.y)){var p=d.updatePosition({x:u.x,y:u.y});f[u.id]=p,u.comboId&&(f[u.comboId]=f[u.comboId]||p),u.parentId&&(f[u.parentId]=f[u.parentId]||p)}})};l(s),l(a),s&&s.length!==0&&(r&&l(s),n.updateCombos()),_e(i,function(c){var h=c.getSource().getModel(),d=c.getTarget();if(!ln(d)){var v=d.getModel();(f[h.id]||f[v.id]||c.getModel().isComboEdge)&&c.refresh()}}),_e(o,function(c){c.refresh()}),n.emit("aftergraphrefreshposition"),n.autoPaint()},e.prototype.stopAnimate=function(){var r=this.get("canvas"),n=r.cfg.timeline;n&&n.stopAllAnimations()},e.prototype.isAnimating=function(){return this.animating},e.prototype.getZoom=function(){var r=this.get("group").getMatrix();return r?r[0]:1},e.prototype.getCurrentMode=function(){var r=this.get("modeController");return r.getMode()},e.prototype.setMode=function(r){var n=this.get("modeController");return n.setMode(r),this},e.prototype.clear=function(r){var n;return r===void 0&&(r=!1),(n=this.get("canvas"))===null||n===void 0||n.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),r||this.emit("afterrender"),this},e.prototype.updateLayout=function(r,n,a,i){var o=this;r===void 0&&(r={}),i===void 0&&(i=!0);var s=this.get("layoutController");if(Ye(r)&&(r={type:r}),n){var u=a;u||(n==="begin"?u={x:0,y:0}:u={x:this.getWidth()/2,y:this.getHeight()/2}),u=this.getPointByCanvas(u.x,u.y);var f=["force","gForce","fruchterman","force2"];f.includes(r.type)||!r.type&&f.includes(s==null?void 0:s.layoutType)?r.center=[u.x,u.y]:this.once("afterlayout",function(h){var d=o.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];u.x=u.x*d[0]+d[6],u.y=u.y*d[0]+d[7];var v=o.getGroup().getCanvasBBox(),p=v.minX,g=v.maxX,y=v.minY,m=v.maxY,b={x:(p+g)/2,y:(y+m)/2};n==="begin"&&(b.x=p,b.y=y),o.translate(u.x-b.x,u.y-b.y)})}var l=P({},this.get("layout")),c={};Object.assign(c,l,r),r.pipes&&!r.type?delete c.type:!r.pipes&&c.type&&delete c.pipes,this.set("layout",c),s&&(s.isLayoutTypeSame(c)&&c.gpuEnabled===l.gpuEnabled?s.updateLayoutCfg(c):s.changeLayout(c),i&&this.get("enabledStack")&&this.pushStack("layout",{before:l,after:c}))},e.prototype.destroyLayout=function(){var r=this.get("layoutController");r==null||r.destroyLayout()},e.prototype.layout=function(){var r,n=this.get("layoutController"),a=this.get("layout");if(!(!a||!n)){if(a.workerEnabled){n.layout();return}!((r=n.layoutMethods)===null||r===void 0)&&r.length?n.relayout(!0):n.layout()}},e.prototype.collapseCombo=function(r,n){var a=this;if(n===void 0&&(n=!0),!this.destroyed){if(Ye(r)&&(r=this.findById(r)),!r){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"collapse",item:r});var i=r.getModel(),o=this.get("itemController");o.collapseCombo(r,n),i.collapsed=!0;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||bn(h,function(d){if(l&&d.depth<=i.depth)return!1;if(i.id===d.id&&(l=!0),l){var v=a.findById(d.id);v&&v.getType&&v.getType()==="combo"&&(u=u.concat(v.getNodes()),u=u.concat(v.getCombos()))}return!0})});var c={};s.forEach(function(h){var d=h.getModel(),v=d.isVEdge,p=d.size,g=p===void 0?1:p;if(!(h.isVisible()&&!v)){var y=h.getSource(),m=h.getTarget(),b=null,w;if(y.getModel().id===i.id||u.includes(y)&&!u.includes(m)?(b=m,w=!1):(m.getModel().id===i.id||!u.includes(y)&&u.includes(m))&&(b=y,w=!0),b){if(v){a.removeItem(h,!1);return}for(var x=b.getModel();!b.isVisible();){var E=x.parentId,_=x.comboId,S=E||_;if(b=a.findById(S),!b||!S)return;x=b.getModel()}var A=x.id,M=w?{source:A,target:i.id,size:g,isVEdge:!0}:{source:i.id,target:A,size:g,isVEdge:!0},C="".concat(M.source,"-").concat(M.target);if(c[C]){c[C].size+=g;return}c[C]=M}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:r})}},e.prototype.expandCombo=function(r,n){var a=this;if(n===void 0&&(n=!0),Ye(r)&&(r=this.findById(r)),!r||r.getType&&r.getType()!=="combo"){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:r});var i=r.getModel(),o=this.get("itemController");o.expandCombo(r,n),i.collapsed=!1;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||bn(h,function(d){if(l&&d.depth<=i.depth)return!1;if(i.id===d.id&&(l=!0),l){var v=a.findById(d.id);v&&v.getType&&v.getType()==="combo"&&(u=u.concat(v.getNodes()),u=u.concat(v.getCombos()))}return!0})});var c={};s.forEach(function(h){if(!(h.isVisible()&&!h.getModel().isVEdge)){var d=h.getSource(),v=h.getTarget(),p=d.get("id"),g=v.get("id"),y=null,m;if(p===i.id||u.includes(d)&&!u.includes(v)?(y=v,m=!1):g===i.id||!u.includes(d)&&u.includes(v)?(y=d,m=!0):u.includes(d)&&u.includes(v)&&d.isVisible()&&v.isVisible()&&h.show(),y){var b=h.getModel(),w=b.isVEdge,x=b.size,E=x===void 0?1:x;if(w){a.removeItem(h,!1);return}for(var _=y.getModel();!y.isVisible();){var S=_.parentId,A=_.comboId,M=S||A;if(y=a.findById(M),!y||!M)return;_=y.getModel()}for(var C=_.id,I=m?v:d,k=I.getModel();!I.isVisible();){var O=k.parentId,B=k.comboId,L=O||B;if(I=a.findById(L),!I||!L)return;if(k.comboId===i.id||k.parentId===i.id)break;k=I.getModel()}var z=k.id;if(C){var X=m?{source:C,target:z,isVEdge:!0,size:E}:{source:z,target:C,isVEdge:!0,size:E},R="".concat(X.source,"-").concat(X.target);if(c[R]){c[R].size+=E;return}c[R]=X}}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:r})},e.prototype.collapseExpandCombo=function(r,n){if(n===void 0&&(n=!0),Ye(r)&&(r=this.findById(r)),!(!r||r.getType&&r.getType()!=="combo")){for(var a=r.getModel(),i=this.findById(a.parentId);i;){var o=i.getModel();if(o.collapsed){console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),i=void 0;return}i=this.findById(o.parentId)}var s=a.collapsed;s?this.expandCombo(r,n):this.collapseCombo(r,n),this.updateCombo(r)}},e.prototype.getNeighbors=function(r,n){var a=r;return Ye(r)&&(a=this.findById(r)),a.getNeighbors(n)},e.prototype.getNodeDegree=function(r,n,a){n===void 0&&(n=void 0),a===void 0&&(a=!1);var i=r;Ye(r)&&(i=this.findById(r));var o=this.get("degrees");(!o||a)&&(o=yi(this.save()),this.set("degrees",o));var s=o[i.getID()],u=0;if(!s)return 0;switch(n){case"in":u=s.inDegree;break;case"out":u=s.outDegree;break;case"all":u=s;break;default:u=s.degree;break}return u},e.prototype.getUndoStack=function(){return this.undoStack},e.prototype.getRedoStack=function(){return this.redoStack},e.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},e.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear(),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack}))},e.prototype.pushStack=function(r,n,a){if(r===void 0&&(r="update"),a===void 0&&(a="undo"),!this.get("enabledStack")){console.warn("请先启用 undo & redo 功能,在实例化 Graph 时候配置 enabledStack: true !");return}var i=n?rr(n):{before:{},after:rr(this.save())};a==="redo"?this.redoStack.push({action:r,data:i}):this.undoStack.push({action:r,data:i}),this.emit("stackchange",{action:r,stackType:a,undoStack:this.undoStack,redoStack:this.redoStack})},e.prototype.getAdjMatrix=function(r,n){r===void 0&&(r=!0),n===void 0&&(n=this.get("directed"));var a=this.get("adjMatrix");return(!a||!r)&&(a=Uo(this.save(),n),this.set("adjMatrix",a)),a},e.prototype.getShortestPathMatrix=function(r,n){r===void 0&&(r=!0),n===void 0&&(n=this.get("directed"));var a=this.get("adjMatrix"),i=this.get("shortestPathMatrix");return(!a||!r)&&(a=Uo(this.save(),n),this.set("adjMatrix",a)),(!i||!r)&&(i=Of(this.save(),n),this.set("shortestPathMatrix",i)),i},e.prototype.on=function(r,n,a){return t.prototype.on.call(this,r,n,a)},e.prototype.destroy=function(){var r,n,a,i,o;this.emit("beforedestroy"),this.clear(),this.clearStack(),(r=this.get("itemController"))===null||r===void 0||r.destroy(),(n=this.get("modeController"))===null||n===void 0||n.destroy(),(a=this.get("viewController"))===null||a===void 0||a.destroy(),(i=this.get("stateController"))===null||i===void 0||i.destroy(),(o=this.get("canvas"))===null||o===void 0||o.destroy(),this.cfg=null,this.destroyed=!0,this.redoStack=null,this.undoStack=null,this.emit("afterdestroy")},e.prototype.createHull=function(r){if(!r.members||r.members.length<1){console.warn("Create hull failed! The members is empty.");return}var n=this.get("hullGroup"),a=this.get("hullMap");if(a||(a={},this.set("hullMap",a)),(!n||n.get("destroyed"))&&(n=this.get("group").addGroup({id:"hullGroup"}),n.toBack(),this.set("hullGroup",n)),a[r.id])return console.warn("Existed hull id."),a[r.id];var i=n.addGroup({id:"".concat(r.id,"-container")}),o=new x8(this,P(P({},r),{group:i})),s=o.id;return a[s]=o,o},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(r){return this.get("hullMap")[r]},e.prototype.removeHull=function(r){var n,a;Ye(r)?a=this.getHullById(r):a=r,(n=this.get("hullMap"))===null||n===void 0||delete n[a.id],a.destroy()},e.prototype.removeHulls=function(){var r=this.getHulls();!r||!Object.keys(r).length||(Object.keys(r).forEach(function(n){var a=r[n];a.destroy()}),this.set("hullMap",{}))},e}(KS);function J0(t){"@babel/helpers - typeof";return J0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},J0(t)}var ws=eo,Rx="-shape",Ep="-label",bc=["startArrow","endArrow"],Fx={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},S8={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},wc={edge:S8,node:Fx,combo:Fx},eg="-label-bg",Uy={options:{labelCfg:{style:{fontFamily:ft.windowFontFamily}},descriptionCfg:{style:{fontFamily:ft.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(e){return{}},getOptions:function(e,r){return r==="move"||r!=null&&r.includes("bbox")?e:_r({},this.options,this.getCustomConfig(e)||{},e)},draw:function(e,r){r.shapeMap={},this.mergeStyle=this.getOptions(e);var n=this.drawShape(e,r);if(n.set("className",this.itemType+Rx),r.shapeMap[this.itemType+Rx]=n,e.label){var a=this.drawLabel(e,r);a.set("className",this.itemType+Ep),r.shapeMap[this.itemType+Ep]=a}return n},afterDraw:function(e,r,n){},drawShape:function(e,r){return null},drawLabel:function(e,r){var n=(this.mergeStyle||this.getOptions(e)||{}).labelCfg,a=n||{},i=this.getLabelStyle(e,a,r),o=i.rotate;delete i.rotate;var s=r.addShape("text",{attrs:i,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(r.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""){var u=s.getBBox(),f=[1,0,0,0,1,0,0,0,1];if(i.rotateCenter)switch(i.rotateCenter){case"center":f=ws(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break;case"lefttop":f=ws(f,[["t",-i.x,-i.y],["r",o],["t",i.x,i.y]]);break;case"leftcenter":f=ws(f,[["t",-i.x,-i.y-u.height/2],["r",o],["t",i.x,i.y+u.height/2]]);break;default:f=ws(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break}else f=ws(f,[["t",-i.x,-i.y-u.height/2],["r",o],["t",i.x,i.y+u.height/2]]);s.setMatrix(f)}if(i.background){var l=this.drawLabelBg(e,r,s),c=this.itemType+eg;l.set("classname",c),r.shapeMap[c]=l,s.toFront()}return s},drawLabelBg:function(e,r,n){var a=this.options.labelCfg,i=Et({},a,e.labelCfg),o=this.getLabelBgStyleByPosition(n,i),s=r.addShape("rect",{name:"text-bg-shape",attrs:o,labelRelated:!0});return r.shapeMap["text-bg-shape"]=s,s},getLabelStyleByPosition:function(e,r,n){return{text:e.label}},getLabelBgStyleByPosition:function(e,r){return{}},getLabelStyle:function(e,r,n){var a=this.getLabelStyleByPosition(e,r,n),i="".concat(this.itemType,"Label"),o=ft[i]?ft[i].style:null;return P(P(P({},o),a),r.style)},getShapeStyle:function(e){return e.style},update:function(e,r,n){this.updateShapeStyle(e,r,n),this.updateLabel(e,r,n)},updateShapeStyle:function(e,r,n){var a,i=r.getContainer(),o=r.getKeyShape(),s=Et({},o.attr(),e.style),u=function(c){var h,d=s[c];if(ln(d)){var v=((a=i.shapeMap)===null||a===void 0?void 0:a[c])||i.find(function(p){return p.get("name")===c});v==null||v.attr(d)}else o.attr((h={},h[c]=d,h))};for(var f in s)u(f)},updateLabel:function(e,r,n){var a,i,o=r.getContainer(),s=(this.mergeStyle||this.getOptions({},n)||{}).labelCfg,u=s===void 0?{}:s,f=this.itemType+Ep,l=o.shapeMap[f]||o.find(function(w){return w.get("className")===f}),c=this.itemType+eg,h=o.shapeMap[c]||o.find(function(w){return w.get("className")===c});if(l&&e.label===void 0&&(o.removeChild(l),delete o.shapeMap[f],h&&(o.removeChild(h),delete o.shapeMap[c])),e.label||e.label==="")if(l){(!n||n==="bbox|label"||this.itemType==="edge"&&n!=="style")&&(u=_r(u,e.labelCfg));var v=this.getLabelStyleByPosition(e,u,o),p=(a=e.labelCfg)===null||a===void 0?void 0:a.style,g=P(P({},v),p),y=g.rotate;if(delete g.rotate,!isNaN(y)&&y!==""){var m=[1,0,0,0,1,0,0,0,1];m=ws(m,[["t",-g.x,-g.y],["r",y],["t",g.x,g.y]]),g.matrix=m,l.attr(g)}else((i=l.getMatrix())===null||i===void 0?void 0:i[4])!==1&&l.resetMatrix(),l.attr(g);if(!h)g.background&&(h=this.drawLabelBg(e,o,l),h.set("classname",c),o.shapeMap[c]=h,l.toFront());else if(g.background){var b=this.getLabelBgStyleByPosition(l,u);h.attr(b)}else o.removeChild(h)}else{var d=this.drawLabel(e,o);d.set("className",f),o.shapeMap[f]=d}},afterUpdate:function(e,r){},setState:function(e,r,n){var a,i,o,s=n.get("keyShape");if(!(!s||s.destroyed)){var u=n.getType(),f=Qf(r)?e:"".concat(e,":").concat(r),l=this.getStateStyle(f,n),c=n.getStateStyle(f);if(!(!c&&!l)){var h=Et({},c||l),d=n.getContainer(),v={x:1,y:1,cx:1,cy:1,matrix:1};if(u==="combo"&&(v.r=1,v.width=1,v.height=1),r){var p=function(L){var z,X=h[L];if(ln(X)&&!bc.includes(L)){var R=((o=d.shapeMap)===null||o===void 0?void 0:o[L])||d.find(function(V){return V.get("name")===L});R==null||R.attr(X)}else s.attr((z={},z[L]=X,z))};for(var g in h)p(g)}else{var y=sh(n.getCurrentStatesStyle()),m=n.getModel(),b=Et({},m.style,sh(n.getOriginStyle())),w=s.get("name"),x=s.attr(),E={};Object.keys(x).forEach(function(B){if(B!=="img"){var L=x[B];L&&J0(L)==="object"?E[B]=rr(L):E[B]=L}});var _={},S=function(L){var z=h[L];if(ln(z)&&!bc.includes(L)){var X=d.shapeMap[L]||d.find(function(he){return he.get("name")===L});if(X){var R=sh(X.attr());_e(z,function(he,ce){if(L===w&&E[ce]&&!v[ce]){delete E[ce];var le=b[L][ce]||wc[u][ce];s.attr(ce,le)}else if(R[ce]||R[ce]===0){delete R[ce];var ie=b[L][ce]||wc[u][ce];X.attr(ce,ie)}}),_[L]=R}}else if(E[L]&&!v[L]){delete E[L];var V=b[L]||(b[w]?b[w][L]:void 0)||wc[u][L];s.attr(L,V)}};for(var A in h)S(A);w?_[w]=E:Et(_,E);for(var g in y)if(!v[g]){var M=y[g];(!ln(M)||bc.includes(g))&&(w?(Et(b[w],(i={},i[g]=M,i)),delete b[g]):Et(b,(a={},a[g]=M,a)),delete y[g])}var C={};_r(C,b,_,y);var I=!1,k=function(L){var z,X,R=C[L];if(ln(R)&&!bc.includes(L)){var V=d.shapeMap[L]||d.find(function(ce){return ce.get("name")===L});V&&((V.get("type")==="text"||V.get("labelRelated"))&&(delete R.x,delete R.y,delete R.matrix),L===w&&(u==="combo"&&(delete R.r,delete R.width,delete R.height),I=!0),V.attr(R))}else if(!I){var he=R||wc[u][L];u==="combo"?w||s.attr((z={},z[L]=he,z)):s.attr((X={},X[L]=he,X))}};for(var O in C)k(O)}}}},getStateStyle:function(e,r){var n=r.getModel(),a=r.getType(),i=this.getOptions(n),o=i.stateStyles,s=i.style,u=s===void 0?{}:s,f=n.stateStyles?n.stateStyles[e]:o&&o[e];return a==="combo"?rr(f):Et({},u,f)},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var r,n,a=(e==null?void 0:e.anchorPoints)||((r=this.getCustomConfig(e))===null||r===void 0?void 0:r.anchorPoints)||((n=this.options)===null||n===void 0?void 0:n.anchorPoints);return a}},M8={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:ft.nodeLabel.offset,getSize:function(e){var r,n=((r=this.mergeStyle)===null||r===void 0?void 0:r.size)||e.size||this.getOptions({}).size||ft.defaultNode.size;return bt(n)&&n.length===1&&(n=[n[0],n[0]]),bt(n)||(n=[n,n]),n},getLabelStyleByPosition:function(e,r){var n=r.maxLength,a=e.label;n&&(a=YA(a,n));var i=r.position||this.labelPosition;if(i==="center")return{x:0,y:0,text:a,textBaseline:"middle",textAlign:"center"};var o=r.offset;Zt(o)&&(o=this.offset);var s=this.getSize(e),u;switch(i){case"top":u={x:0,y:-s[1]/2-o,textBaseline:"bottom",textAlign:"center"};break;case"bottom":u={x:0,y:s[1]/2+o,textBaseline:"top",textAlign:"center"};break;case"left":u={x:-s[0]/2-o,y:0,textBaseline:"middle",textAlign:"right"};break;default:u={x:s[0]/2+o,y:0,textBaseline:"middle",textAlign:"left"};break}return u.text=a,u},getLabelBgStyleByPosition:function(e,r){var n;if(!e)return{};var a=(n=r.style)===null||n===void 0?void 0:n.background;if(!a)return{};var i=e.getBBox(),o=jy(a.padding),s=i.width+o[1]+o[3],u=i.height+o[0]+o[2];return P(P({x:i.minX-o[3],y:i.minY-o[0]},a),{width:s,height:u})},drawShape:function(e,r){var n=this.shapeType,a=this.getShapeStyle(e),i=r.addShape(n,{attrs:a,draggable:!0,name:"node-shape"});return r.shapeMap["node-shape"]=i,i},updateLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=r.shapeMap["link-point-left"]||r.find(function(C){return C.get("className")==="link-point-left"}),i=r.shapeMap["link-point-right"]||r.find(function(C){return C.get("className")==="link-point-right"}),o=r.shapeMap["link-point-top"]||r.find(function(C){return C.get("className")==="link-point-top"}),s=r.shapeMap["link-point-bottom"]||r.find(function(C){return C.get("className")==="link-point-bottom"}),u;a&&(u=a.attr()),i&&!u&&(u=i.attr()),o&&!u&&(u=o.attr()),s&&!u&&(u=s.attr()),u||(u=n);var f=Et({},u,e.linkPoints),l=f.fill,c=f.stroke,h=f.lineWidth,d=f.size/2;d||(d=f.r);var v=e.linkPoints?e.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},p=v.left,g=v.right,y=v.top,m=v.bottom,b=this.getSize(e),w=b[0],x=b[1],E={r:d,fill:l,stroke:c,lineWidth:h};if(a)!p&&p!==void 0?(a.remove(),delete r.shapeMap["link-point-left"]):a.attr(P(P({},E),{x:-w/2,y:0}));else if(p){var _="link-point-left";r.shapeMap[_]=r.addShape("circle",{attrs:P(P({},E),{x:-w/2,y:0}),className:_,name:_,isAnchorPoint:!0})}if(i)!g&&g!==void 0&&(i.remove(),delete r.shapeMap["link-point-right"]),i.attr(P(P({},E),{x:w/2,y:0}));else if(g){var S="link-point-right";r.shapeMap[S]=r.addShape("circle",{attrs:P(P({},E),{x:w/2,y:0}),className:S,name:S,isAnchorPoint:!0})}if(o)!y&&y!==void 0&&(o.remove(),delete r.shapeMap["link-point-top"]),o.attr(P(P({},E),{x:0,y:-x/2}));else if(y){var A="link-point-top";r.shapeMap[A]=r.addShape("circle",{attrs:P(P({},E),{x:0,y:-x/2}),className:A,name:A,isAnchorPoint:!0})}if(s)!m&&m!==void 0?(s.remove(),delete r.shapeMap["link-point-bottom"]):s.attr(P(P({},E),{x:0,y:x/2}));else if(m){var M="link-point-bottom";r.shapeMap[M]=r.addShape("circle",{attrs:P(P({},E),{x:0,y:x/2}),className:M,name:M,isAnchorPoint:!0})}},updateShape:function(e,r,n,a,i){var o=r.get("keyShape");o.attr(P({},n)),this.updateLabel(e,r,i),a&&this.updateIcon(e,r)},updateIcon:function(e,r){var n=this,a=r.getContainer(),i=(this.mergeStyle||this.getOptions(e)).icon,o=e.icon?e.icon:{show:void 0,text:void 0},s=o.show,u=o.text,f=a.shapeMap["".concat(this.type,"-icon")]||a.find(function(y){return y.get("name")==="".concat(n.type,"-icon")});if(f)if(s||s===void 0){var l=Et({},f.attr(),i),c=l.width,h=c===void 0?20:c,d=l.height,v=d===void 0?20:d;(l.fontFamily==="iconfont"||l.hasOwnProperty("text"))&&(h=0,v=0),f.attr(P(P({},l),{x:-h/2,y:-v/2}))}else f.remove(),delete a.shapeMap["".concat(this.type,"-icon")];else if(s){var p="".concat(this.type,"-icon");if(u)a.shapeMap[p]=a.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:p,name:p});else{var h=i.width,v=i.height;a.shapeMap[p]=a.addShape("image",{attrs:P(P({},i),{x:-h/2,y:-v/2}),className:p,name:p})}var g=a.shapeMap["node-label"]||a.find(function(y){return y.get("name")==="node-label"});g&&g.toFront()}}},A8=P(P({},Uy),M8);mr.registerNode("single-node",A8);var xc="edge-shape";function C8(t){var e=t;return t==="start"?e="end":t==="end"&&(e="start"),e}var T8={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:ft.defaultEdge.size,style:{x:0,y:0,stroke:ft.defaultEdge.style.stroke,lineAppendWidth:ft.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:ft.edgeLabel.style.fill,fontSize:ft.edgeLabel.style.fontSize,fontFamily:ft.windowFontFamily}},stateStyles:P({},ft.edgeStateStyles)},getPath:function(e){var r=[];return _e(e,function(n,a){a===0?r.push(["M",n.x,n.y]):r.push(["L",n.x,n.y])}),r},getShapeStyle:function(e){var r=this.options.style,n={stroke:e.color},a=Et({},r,n,e.style),i=e.size||ft.defaultEdge.size;e=this.getPathPoints(e);var o=e.startPoint,s=e.endPoint,u=this.getControlPoints(e),f=[o];u&&(f=f.concat(u)),f.push(s);var l=this.getPath(f),c=Et({},ft.defaultEdge.style,{stroke:ft.defaultEdge.color,lineWidth:i,path:l},a);return c},updateShapeStyle:function(e,r,n){var a,i=r.getContainer(),o=((a=r.getKeyShape)===null||a===void 0?void 0:a.call(r))||i.shapeMap["edge-shape"],s=e.size;e=this.getPathPoints(e);var u=e.startPoint,f=e.endPoint,l=this.getControlPoints(e),c=[u];l&&(c=c.concat(l)),c.push(f);var h=o.attr(),d=e.style||{};d.stroke===void 0&&(d.stroke=e.color);var v=e.sourceNode,p=e.targetNode,g={radius:d.radius};l||(g={source:v,target:p,offset:d.offset,radius:d.radius});var y=this.getPath(c,g),m={};n==="move"?m={path:y}:(h.endArrow&&d.endArrow===!1&&(e.style.endArrow={path:""}),h.startArrow&&d.startArrow===!1&&(e.style.startArrow={path:""}),m=P({},e.style),m.lineWidth===void 0&&(m.lineWidth=(Ot(s)?s:s==null?void 0:s[0])||h.lineWidth),m.path===void 0&&(m.path=y),m.stroke===void 0&&(m.stroke=h.stroke||e.color)),o&&o.attr(m)},getLabelStyleByPosition:function(e,r,n){var a=r.position||this.labelPosition,i={},o=n==null?void 0:n.shapeMap[xc],s;a==="start"?s=0:a==="end"?s=1:s=.5;var u=r.refX||this.refX,f=r.refY||this.refY;if(e.startPoint.x===e.endPoint.x&&e.startPoint.y===e.endPoint.y)return i.x=e.startPoint.x+u,i.y=e.startPoint.y+f,i.text=e.label,i;var l;Zt(r.autoRotate)?l=this.labelAutoRotate:l=r.autoRotate;var c=XA(o,s,u,f,l);return i.x=c.x,i.y=c.y,i.rotate=c.rotate,i.textAlign=this._getTextAlign(a,c.angle),i.text=e.label,i},getLabelBgStyleByPosition:function(e,r){if(!e)return{};var n=e.getBBox(),a=r.style&&r.style.background;if(!a)return{};var i=a.padding,o=n.width+i[1]+i[3],s=n.height+i[0]+i[2],u=P(P({},a),{width:o,height:s,x:n.minX-i[3],y:n.minY-i[0],matrix:[1,0,0,0,1,0,0,0,1]}),f;return Zt(r.autoRotate)?f=this.labelAutoRotate:f=r.autoRotate,f&&(u.matrix=e.attr("matrix")||[1,0,0,0,1,0,0,0,1]),u},_getTextAlign:function(e,r){var n="center";return r?(r=r%(Math.PI*2),e!=="center"&&(r>=0&&r<=Math.PI/2||r>=3/2*Math.PI&&r<2*Math.PI?n=e:n=C8(e)),n):e},getControlPoints:function(e){return e.controlPoints},getPathPoints:function(e){return e},drawShape:function(e,r){var n=this.getShapeStyle(e),a=r.addShape("path",{className:xc,name:xc,attrs:n});return r.shapeMap[xc]=a,a},drawLabel:function(e,r){var n=this.options.labelCfg,a=_r({},n,e.labelCfg),i=this.getLabelStyle(e,a,r),o=i.rotate;delete i.rotate;var s=r.addShape("text",{attrs:i,name:"text-shape",labelRelated:!0,draggable:!0});if(r.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""&&s.rotateAtStart(o),i.background){var u=this.drawLabelBg(e,r,s,i,o),f=this.itemType+eg;u.set("classname",f),r.shapeMap[f]=u,s.toFront()}return s},drawLabelBg:function(e,r,n,a,i){var o=this.options.labelCfg,s=_r({},o,e.labelCfg),u=this.getLabelBgStyleByPosition(n,s),f=r.addShape("rect",{name:"text-bg-shape",attrs:u,labelRelated:!0});return r.shapeMap["text-bg-shape"]=f,f}},I8=P(P({},Uy),T8);mr.registerEdge("single-edge",I8);mr.registerEdge("line",{getControlPoints:function(){}},"single-edge");mr.registerEdge("spline",{getPath:function(e){var r=qC(e);return r}},"single-edge");mr.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(e){var r=e.startPoint,n=e.endPoint,a={x:(r.x+n.x)/2,y:(r.y+n.y)/2},i,o;if(e.controlPoints!==void 0){if(o=e.controlPoints[0],i=E0(r,o,n),r.x<=n.x&&r.y>n.y?this.clockwise=i.x>o.x?0:1:r.x<=n.x&&r.yo.x?1:0:r.x>n.x&&r.y<=n.y?this.clockwise=i.y0&&d(x[0])}},y=0;y0;)h.push(u.pop());o.push(h)}}return o};Zi.detectConnectedComponents=eT;var tT=function(e){for(var r=e.nodes,n=r===void 0?[]:r,a=e.edges,i=a===void 0?[]:a,o=[],s={},u={},f={},l=[],c=0,h=function g(y){u[y.id]=c,f[y.id]=c,c+=1,o.push(y),s[y.id]=!0;for(var m=(0,JC.getNeighbors)(y.id,i,"target").filter(function(_){return n.map(function(S){return S.id}).indexOf(_)>-1}),b=function(S){var A=m[S];if(!u[A]&&u[A]!==0){var M=n.filter(function(C){return C.id===A});M.length>0&&g(M[0]),f[y.id]=Math.min(f[y.id],f[A])}else s[A]&&(f[y.id]=Math.min(f[y.id],u[A]))},w=0;w0;){var E=o.pop();if(s[E.id]=!1,x.push(E),E===y)break}x.length>0&&l.push(x)}},d=0,v=n;d0;)for(var g=d.pop(),y=g.id,m=(0,aT.getNeighbors)(y,e.edges),b=function(E){var _,S=m[E],A=e.nodes.find(function(B){return B.id===S});if(S===y)o.push((_={},_[S]=g,_));else if(!(S in p))v[S]=g,d.push(A),p[S]=new Set([g]);else if(!p[y].has(A)){for(var M=!0,C=[A,g],I=v[y];p[S].size&&!p[S].has(I)&&(C.push(I),I!==v[I.id]);)I=v[I.id];if(C.push(I),r&&n?(M=!1,C.findIndex(function(B){return r.indexOf(B.id)>-1})>-1&&(M=!0)):r&&!n&&C.findIndex(function(B){return r.indexOf(B.id)>-1})>-1&&(M=!1),M){for(var k={},O=1;O0;){var O=k.pop();i.has(O)&&(i.delete(O),o[O.id].forEach(function(B){k.push(B)}),o[O.id].clear())}},c=function C(I,k,O){var B=!1;if(r&&n===!1&&r.indexOf(I.id)>-1)return B;a.push(I),i.add(I);for(var L=O[I.id],z=0;z-1});le-1)?s.push((k={},k[ce.id]=ce,k)):he[ce.id].push(f[Ie])}}return{component:V,adjList:he,minIdx:B}},b=0;b=b}),x=(0,nT.detectStrongConnectComponents)({nodes:w,edges:e.edges}).filter(function(C){return C.length>1});if(x.length===0)break;var E=m(x),_=E.minIdx,S=E.adjList,A=E.component;if(A.length>1){A.forEach(function(C){o[C.id]=new Set});var M=u[_];if(r&&n&&r.indexOf(M.id)===-1)return s;c(M,M,S),b=_+1}else break}return s};za.detectAllDirectedCycle=sT;var mU=function(e,r,n,a){return a===void 0&&(a=!0),r?sT(e,n,a):oT(e,n,a)};za.detectAllCycles=mU;var bU=yU;za.default=bU;var gu={};const uT=Ka(jP),el=Ka(u3);Object.defineProperty(gu,"__esModule",{value:!0});gu.default=void 0;var Bx=uT,wU=el,Gx=Wr,xU=function(e,r,n){for(var a=1/0,i,o=0;ol[w.id]+C?(l[M]=l[w.id]+C,c[M]=[w.id]):l[M]===l[w.id]+C&&c[M].push(w.id)})},v=0;v0&&l.length>0;){var d=l[l.length-1];if(d.length){var v=d.shift();v&&(u.push(v),f[v]=!0,h=a?(0,Ec.getNeighbors)(v,s,"target"):(0,Ec.getNeighbors)(v,s),l.push(h.filter(function(y){return!f[y]})))}else{var p=u.pop();f[p]=!1,l.pop();continue}if(u[u.length-1]===n){var g=u.map(function(m){return m});c.push(g);var p=u.pop();f[p]=!1,l.pop()}}return c};eu.findAllPath=CU;var tl={};Object.defineProperty(tl,"__esModule",{value:!0});tl.default=void 0;var TU=IU(Ko);function IU(t){return t&&t.__esModule?t:{default:t}}var kU=function(e,r){for(var n=(0,TU.default)(e,r),a=[],i=n.length,o=0;oa[o][u]+a[u][s]&&(a[o][s]=a[o][u]+a[u][s]);return a},NU=kU;tl.default=NU;var Id={};Object.defineProperty(Id,"__esModule",{value:!0});Id.default=void 0;var OU=DU(Ko),LU=Wr;function DU(t){return t&&t.__esModule?t:{default:t}}var PU=function(e,r,n,a){r===void 0&&(r=!1),n===void 0&&(n="weight"),a===void 0&&(a=1e3);var i=e.nodes,o=i===void 0?[]:i,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,w){var x=(0,LU.uniqueId)();b.clusterId=x,f[x]={id:x,nodes:[b]},l[b.id]={node:b,idx:w}});var c=(0,OU.default)(e,r),h={};c.forEach(function(b,w){var x=o[w].id;h[x]={},b.forEach(function(E,_){if(E){var S=o[_].id;h[x][S]=E}})});for(var d=0,v=function(){var w=!1;if(o.forEach(function(x){var E={};Object.keys(h[x.id]).forEach(function(O){var B=h[x.id][O],L=l[O].node,z=L.clusterId;E[z]||(E[z]=0),E[z]+=B});var _=-1/0,S=[];if(Object.keys(E).forEach(function(O){_=0&&S.splice(A,1),S&&S.length){w=!0;var M=f[x.clusterId],C=M.nodes.indexOf(x);M.nodes.splice(C,1);var I=Math.floor(Math.random()*S.length),k=f[S[I]];k.nodes.push(x),x.clusterId=k.id}}}),!w)return"break";d++};d0&&S>A&&S-AA&&(C=c.map(function(R){return{node:R,clusterId:R.clusterId}}),I=(0,VU.clone)(m),A=S),k||M>100)break;M++,Object.keys(m).forEach(function(R){var V=0;d.forEach(function(he){var ce=he.source,le=he.target,ie=b[ce].node.clusterId,Ie=b[le].node.clusterId;(ie===R&&Ie!==R||Ie===R&&ie!==R)&&(V=V+(he[n]||1))}),m[R].sumTot=V}),c.forEach(function(R,V){var he=m[R.clusterId],ce=0,le,ie=x[V]/(2*_),Ie=0,qe=he.nodes;qe.forEach(function(Wt){var vr=b[Wt.id].idx;Ie+=w[V][vr]||0});var Ve=Ie-he.sumTot*ie,it=qe.filter(function(Wt){return Wt.id!==R.id});it.forEach(function(Wt,vr){v[Wt.originIndex]});var dt=_p(it,v)*f,st=E[R.id];if(Object.keys(st).forEach(function(Wt){var vr=b[Wt].node,cr=vr.clusterId;if(cr!==R.clusterId){var $t=m[cr],sr=$t.nodes;if(!(!sr||!sr.length)){var tn=0;sr.forEach(function(Fe){var ge=b[Fe.id].idx;tn+=w[V][ge]||0});var tt=tn-$t.sumTot*ie,te=sr.concat([R]);te.forEach(function(Fe,ge){v[Fe.originIndex]});var N=_p(te,v)*f,Se=tt-Ve;i&&(Se=tt+N-(Ve+dt)),Se>ce&&(ce=Se,le=$t)}}}),ce>0){le.nodes.push(R);var Tt=R.clusterId;R.clusterId=le.id;var _t=he.nodes.indexOf(R);he.nodes.splice(_t,1);var lr=0,Bt=0;d.forEach(function(Wt){var vr=Wt.source,cr=Wt.target,$t=b[vr].node.clusterId,sr=b[cr].node.clusterId;($t===le.id&&sr!==le.id||sr===le.id&&$t!==le.id)&&(lr=lr+(Wt[n]||1)),($t===Tt&&sr!==Tt||sr===Tt&&$t!==Tt)&&(Bt=Bt+(Wt[n]||1))}),le.sumTot=lr,he.sumTot=Bt}})}var O={},B=0;Object.keys(I).forEach(function(R){var V=I[R];if(!V.nodes||!V.nodes.length){delete I[R];return}var he=String(B+1);he!==R&&(V.id=he,V.nodes=V.nodes.map(function(ce){return{id:ce.id,clusterId:he}}),I[he]=V,O[R]=he,delete I[R],B++)}),C.forEach(function(R){var V=R.node,he=R.clusterId;V&&(V.clusterId=he,V.clusterId&&O[V.clusterId]&&(V.clusterId=O[V.clusterId]))});var L=[],z={};d.forEach(function(R){var V=R.source,he=R.target,ce=R[n]||1,le=b[V].node.clusterId,ie=b[he].node.clusterId;if(!(!le||!ie)){var Ie="".concat(le,"---").concat(ie);if(z[Ie])z[Ie].weight+=ce,z[Ie].count++;else{var qe={source:le,target:ie,weight:ce,count:1};z[Ie]=qe,L.push(qe)}}});var X=[];return Object.keys(I).forEach(function(R){X.push(I[R])}),{clusters:X,clusterEdges:L}},KU=ZU;kd.default=KU;var Nd={},Od={};Object.defineProperty(Od,"__esModule",{value:!0});Od.default=void 0;var QU=function(){function t(e){this.count=e.length,this.parent={};for(var r=0,n=e;r0&&(this.list[0]=r,this.moveDown(0)),e},t.prototype.insert=function(e){if(e!==null){this.list.push(e);var r=this.list.length-1;return this.moveUp(r),!0}return!1},t.prototype.moveUp=function(e){for(var r=this.getParent(e);e&&e>0&&this.compareFn(this.list[r],this.list[e])>0;){var n=this.list[r];this.list[r]=this.list[e],this.list[e]=n,e=r,r=this.getParent(e)}},t.prototype.moveDown=function(e){var r,n=e,a=this.getLeft(e),i=this.getRight(e),o=this.list.length;a!==null&&a0?n=a:i!==null&&i0&&(n=i),e!==n&&(r=[this.list[n],this.list[e]],this.list[e]=r[0],this.list[n]=r[1],this.moveDown(n))},t}(),r$=t$;Ld.default=r$;Object.defineProperty(Nd,"__esModule",{value:!0});Nd.default=void 0;var n$=pT(Od),a$=pT(Ld),Sp=Wr;function pT(t){return t&&t.__esModule?t:{default:t}}var i$=function(e,r){var n=[],a=e.nodes,i=a===void 0?[]:a,o=e.edges,s=o===void 0?[]:o;if(i.length===0)return n;var u=i[0],f=new Set;f.add(u);var l=function(g,y){return r?g.weight-y.weight:0},c=new a$.default(l);for((0,Sp.getEdgesByNodeId)(u.id,s).forEach(function(p){c.insert(p)});!c.isEmpty();){var h=c.delMin(),d=h.source,v=h.target;f.has(d)&&f.has(v)||(n.push(h),f.has(d)||(f.add(d),(0,Sp.getEdgesByNodeId)(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),(0,Sp.getEdgesByNodeId)(v,s).forEach(function(p){c.insert(p)})))}return n},Wx=function(e,r){var n=[],a=e.nodes,i=a===void 0?[]:a,o=e.edges,s=o===void 0?[]:o;if(i.length===0)return n;var u=s.map(function(d){return d});r&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new n$.default(i.map(function(d){return d.id}));u.length>0;){var l=u.shift(),c=l.source,h=l.target;f.connected(c,h)||(n.push(l),f.union(c,h))}return n},o$=function(e,r,n){var a={prim:i$,kruskal:Wx};return n?a[n](e,r):Wx(e,r)},s$=o$;Nd.default=s$;var Dd={};Object.defineProperty(Dd,"__esModule",{value:!0});Dd.default=void 0;var u$=l$(pi),f$=Wr;function l$(t){return t&&t.__esModule?t:{default:t}}var c$=function(e,r,n){typeof r!="number"&&(r=1e-6),typeof n!="number"&&(n=.85);for(var a=1,i=0,o=1e3,s=e.nodes,u=s===void 0?[]:s,f=e.edges,l=f===void 0?[]:f,c=u.length,h,d={},v={},p=0;p0&&a>r;){i=0;for(var p=0;p0&&(h+=v[x]/E)}d[y]=n*h,i+=d[y]}}i=(1-i)/c,a=0;for(var p=0;p=0;n--){var a=this.dfsEdgeList[n],i=a.fromNode,o=a.toNode;id||a.hasNode(o[h.to])||(r.labelb;x--){var E=w(x);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new No(p,m,In.VACANT_NODE_LABEL,_.edgeLabel,In.VACANT_NODE_LABEL));var S=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[S]!==o.dfsEdgeList[S]?!1:c(g[_.edgeLabel].projected)}var A={};y=!1;var M=0;h.forEach(function(L){var z=new _c(L),X=e.findForwardPureEdges(a,z.edges[d[0]],v,z);X.length>0&&(y=!0,M=p,X.forEach(function(R){var V="".concat(R.label,"-").concat(i[R.to].label);A[V]||(A[V]={projected:[],edgeLabel:R.label,nodeLabel2:i[R.to].label}),A[V].projected.push({graphId:a.id,edge:R,preNode:L})}))});for(var C=d.length,I=function(z){if(y)return"break";var X=d[z];h.forEach(function(R){var V=new _c(R),he=e.findForwardRmpathEdges(a,V.edges[X],v,V);he.length>0&&(y=!0,M=o.dfsEdgeList[X].fromNode,he.forEach(function(ce){var le="".concat(ce.label,"-").concat(i[ce.to].label);A[le]||(A[le]={projected:[],edgeLabel:ce.label,nodeLabel2:i[ce.to].label}),A[le].projected.push({graphId:a.id,edge:ce,preNode:R})}))})},x=0;x=0;v--){var p=r.findBackwardEdge(c,d.edges[i[v]],d.edges[i[0]],d);if(p){var g="".concat(r.dfsCode.dfsEdgeList[i[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:r.dfsCode.dfsEdgeList[i[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(a>=r.maxNodeNum)){var y=r.findForwardPureEdges(c,d.edges[i[0]],s,d);y.forEach(function(b){var w="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[w]||(u[w]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[w].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(w){var x=r.findForwardRmpathEdges(c,d.edges[i[w]],s,d);x.forEach(function(E){var _="".concat(r.dfsCode.dfsEdgeList[i[w]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:r.dfsCode.dfsEdgeList[i[w]].fromNode,edgeLabel:E.label,nodeLabel2:h[E.to].label}),u[_].projected.push({graphId:l.graphId,edge:E,preNode:l})})},v=0;vm){var b=m;m=y,y=b}var w=g.label,x="".concat(y,"-").concat(w,"-").concat(m);if(!o[x]){var E=o[x]||0;E++,o[x]=E}})})}),Object.keys(i).forEach(function(u){var f=i[u];if(!(f2*r)););if(g<2*r&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:i[l][p]},c++,u++,u>=n))return s;if(h++,h>2*r)break}if(ch&&(u=h);var d=n[c.id].inDegree;f>d&&(f=d);var v=n[c.id].outDegree;l>v&&(l=v)}),e[r]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},C$=function(e,r,n,a,i,o,s){var u;if(n===void 0&&(n=!1),o===void 0&&(o="cluster"),s===void 0&&(s="cluster"),!(!e||!e.nodes)){var f=e.nodes.length;if(f){var l=(0,Hx.default)(e,n),c=(0,Hx.default)(r,n),h=eE(e.nodes,l,n),d=eE(r.nodes,c,n),v=Qx(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=Qx(r.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;Jx(e.edges,s,p);var w=Jx(r.edges,s,m).edgeLabelMap,x=[];c==null||c.forEach(function(tt){x=x.concat(tt)}),i||(i=Math.max.apply(Math,(0,qx.__spreadArray)((0,qx.__spreadArray)([],x,!1),[2],!1))),a||(a=i);var E=Kx(e,l,o,a),_=Kx(r,c,o,a),S=Math.min(100,f*(f-1)/2),A=S$(a,f,S,E,l),M=fh(A,E,e),C=10,I=1,k=1,O=4,B={graphs:M,nodeLabelProp:o,edgeLabelProp:s,minSupport:I,minNodeNum:k,maxNodeNum:O,directed:n},L=(0,E$.default)(B).slice(0,C),z=L.length,X=[];L.forEach(function(tt,te){X[te]={},Object.keys(M).forEach(function(N){var Se=M[N],Fe=lh(Se,tt,o,s);X[te][N]=Fe})});var R=M$(X,z,L),V=R.structure,he=R.structureCountMap,ce=r.nodes[0],le=[],ie=(u=r.nodes[0])===null||u===void 0?void 0:u[o],Ie=-1/0;r.nodes.forEach(function(tt){var te=tt[o],N=g[te];(N==null?void 0:N.length)>Ie&&(Ie=N.length,le=N,ie=te,ce=tt)});var qe={},Ve={},it={},dt={},st={},Tt={};Object.keys(b).forEach(function(tt,te){st[tt]=[],n&&(Tt[tt]=[]);var N=b[tt],Se={};N.forEach(function(Ze){var Je=d["".concat(ce.id,"-").concat(Ze.id)];if(Je&&st[tt].push(Je),Se["".concat(ce.id,"-").concat(Ze.id)]={start:0,end:m[Ze.id].idx,distance:Je},n){var ht=d["".concat(Ze.id,"-").concat(ce.id)];ht&&Tt[tt].push(ht)}}),st[tt]=st[tt].sort(function(Ze,Je){return Ze-Je}),n&&(Tt[tt]=Tt[tt].sort(function(Ze,Je){return Ze-Je})),Ve=fh(Se,_,r,Ve);var Fe=[];if(Object.keys(Se).forEach(function(Ze){if(it[Ze]){Fe.push(it[Ze]);return}var Je=Ve[Ze];it[Ze]=lh(Je,V,o,s),Fe.push(it[Ze])}),Fe=Fe.sort(function(Ze,Je){return Je-Ze}),dt["".concat(ce.id,"-").concat(tt)]=Fe,tt!==ie)for(var ge=(le==null?void 0:le.length)||0,Ue=function(Je){var ht=le[Je],Lt=E[p[ht.id].idx],ur=Lt.nodeLabelCountMap[tt],Dt=b[tt].length;if(!ur||ur.countst[tt][or]){fr=!0;break}if(fr)return le.splice(Je,1),"continue";var gr={};Lt.neighbors.forEach(function(nr){var Fr=h["".concat(ht.id,"-").concat(nr.id)];gr["".concat(ht.id,"-").concat(nr.id)]={start:p[ht.id].idx,end:p[nr.id].idx,distance:Fr}}),M=fh(gr,E,e,M);var hr=[];Object.keys(gr).forEach(function(nr){if(he[nr]){hr.push(he[nr]);return}var Fr=M[nr];he[nr]=lh(Fr,V,o,s),hr.push(he[nr])}),hr=hr.sort(function(nr,Fr){return Fr-nr});for(var hn=!1,or=0;or=0;$e--)Ue($e)});var _t=[];le==null||le.forEach(function(tt){for(var te=p[tt.id].idx,N=wT(e.nodes,l[te],te,o,i),Se=N.neighbors,Fe=Se.length,ge=!1,Ue=Fe-1;Ue>=0;Ue--){if(Se.length+1ur){Se.splice(Ue,1);continue}if(n){var Dt="".concat($e.id,"-").concat(tt.id),fr=h[Dt];Lt=Tt[Ze].length-1;var or=Tt[Ze][Lt];if(fr>or){Se.splice(Ue,1);continue}}var gr=he[Je]?he[Je]:A$(e,tt,$e,p,ht,E,V,o,s,he,M),hr="".concat(ce.id,"-").concat(Ze),hn=dt[hr][dt[hr].length-1];if(gr=0;ht--){var or=fr(ht);if(or==="break")break}if(Dt)return _t.splice(te,1),"continue";N.edges=Ue;var gr=(0,Zx.default)(N,N.nodes[0].id,!1).length;if(Object.keys(gr).reverse().forEach(function(St){if(!(St===N.nodes[0].id||Dt)){if(gr[St]===1/0){var dr=ge[St].node[o];if(Fe[dr]--,Fe[dr]Bt[Sr][Bt[Sr].length-1]){var dr=ge[St].node[o];if(Fe[dr]--,Fe[dr]=0;oa--){var Ur=N.nodes[oa],Mi=ge[Ur.id].degree,xu=ge[Ur.id].inDegree,Eu=ge[Ur.id].outDegree,rn=Ur[o],ti=tE(qe,rn,m,b),uo=ti.minPatternNodeLabelDegree,_u=ti.minPatternNodeLabelInDegree,Su=ti.minPatternNodeLabelOutDegree,Mu=n?Mi=0;sa--){var Br=Ue[sa];if(!ge[Br.source]||!ge[Br.target]){Ue.splice(sa,1);var ua=Br[s];if($e[ua]--,ge[Br.source]&&(ge[Br.source].degree--,ge[Br.source].outDegree--),ge[Br.target]&&(ge[Br.target].degree--,ge[Br.target].inDegree--),w[ua]&&$e[ua]=0;cr--){var $t=vr(cr);if($t==="break")break}for(var sr=_t.length,tn=function(te){var N=_t[te],Se={};N.edges.forEach(function(Ue){var $e="".concat(Ue.source,"-").concat(Ue.target,"-").concat(Ue.label);Se[$e]?Se[$e]++:Se[$e]=1});for(var Fe=function($e){var Ze=_t[$e],Je={};Ze.edges.forEach(function(Lt){var ur="".concat(Lt.source,"-").concat(Lt.target,"-").concat(Lt.label);Je[ur]?Je[ur]++:Je[ur]=1});var ht=!0;Object.keys(Je).length!==Object.keys(Se).length?ht=!1:Object.keys(Se).forEach(function(Lt){Je[Lt]!==Se[Lt]&&(ht=!1)}),ht&&_t.splice($e,1)},ge=sr-1;ge>te;ge--)Fe(ge);sr=_t.length},cr=0;cr<=sr-1;cr++)tn(cr);return _t}}},T$=C$;Pd.default=T$;(function(t){function e(w){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(x){return typeof x}:function(x){return x&&typeof Symbol=="function"&&x.constructor===Symbol&&x!==Symbol.prototype?"symbol":typeof x},e(w)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"GADDI",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(t,"breadthFirstSearch",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"connectedComponent",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"depthFirstSearch",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"detectCycle",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"dijkstra",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"findAllPath",{enumerable:!0,get:function(){return f.findAllPath}}),Object.defineProperty(t,"findShortestPath",{enumerable:!0,get:function(){return f.findShortestPath}}),Object.defineProperty(t,"floydWarshall",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"getAdjMatrix",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"getDegree",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"getInDegree",{enumerable:!0,get:function(){return i.getInDegree}}),Object.defineProperty(t,"getNeighbors",{enumerable:!0,get:function(){return g.getNeighbors}}),Object.defineProperty(t,"getOutDegree",{enumerable:!0,get:function(){return i.getOutDegree}}),Object.defineProperty(t,"labelPropagation",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"louvain",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"minimumSpanningTree",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"pageRank",{enumerable:!0,get:function(){return v.default}});var r=b(Ko),n=b(Ad),a=b(Zi),i=m(pi),o=b(za),s=b(Td),u=b(gu),f=eu,l=b(tl),c=b(Id),h=b(kd),d=b(Nd),v=b(Dd),p=b(Pd),g=Wr;function y(w){if(typeof WeakMap!="function")return null;var x=new WeakMap,E=new WeakMap;return(y=function(S){return S?E:x})(w)}function m(w,x){if(w&&w.__esModule)return w;if(w===null||e(w)!=="object"&&typeof w!="function")return{default:w};var E=y(x);if(E&&E.has(w))return E.get(w);var _={},S=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var A in w)if(A!=="default"&&Object.prototype.hasOwnProperty.call(w,A)){var M=S?Object.getOwnPropertyDescriptor(w,A):null;M&&(M.get||M.set)?Object.defineProperty(_,A,M):_[A]=w[A]}return _.default=w,E&&E.set(w,_),_}function b(w){return w&&w.__esModule?w:{default:w}}})(QC);function ig(t){"@babel/helpers - typeof";return ig=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ig(t)}Object.defineProperty(Md,"__esModule",{value:!0});Md.default=void 0;var Mp=I$(QC),rE=Hi;function xT(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(xT=function(a){return a?r:e})(t)}function I$(t,e){if(t&&t.__esModule)return t;if(t===null||ig(t)!=="object"&&typeof t!="function")return{default:t};var r=xT(e);if(r&&r.has(t))return r.get(t);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if(i!=="default"&&Object.prototype.hasOwnProperty.call(t,i)){var o=a?Object.getOwnPropertyDescriptor(t,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=t[i]}return n.default=t,r&&r.set(t,n),n}var Ap=typeof self<"u"?self:{};Ap.onmessage=function(t){var e=t.data,r=e._algorithmType,n=e.data;if(r){if(typeof Mp[r]=="function"){var a=Mp[r].apply(Mp,n);Ap.postMessage({_algorithmType:rE.MESSAGE.SUCCESS,data:a});return}Ap.postMessage({_algorithmType:rE.MESSAGE.FAILURE})}};var k$=null;Md.default=k$;Object.defineProperty(Sd,"__esModule",{value:!0});Sd.default=void 0;var N$=Hi,O$=L$(Md);function L$(t){return t&&t.__esModule?t:{default:t}}var D$=function(e){return function(){for(var r=[],n=0;n=t&&a<=t+r&&i>=e&&i<=e+n}function Uf(t,e){return!(e.minX>t.maxX||e.maxXt.maxY||e.maxY=0&&a<1/2*Math.PI?(s={x:o.minX,y:o.minY},u={x:o.maxX,y:o.maxY}):1/2*Math.PI<=a&&a1&&(r*=Math.sqrt(d),n*=Math.sqrt(d));var v=r*r*(h*h)+n*n*(c*c),p=v?Math.sqrt((r*r*(n*n)-v)/v):1;i===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*r*h/n:0,y=r?p*-n*c/r:0,m=(s+f)/2+Math.cos(a)*g-Math.sin(a)*y,b=(u+l)/2+Math.sin(a)*g+Math.cos(a)*y,w=[(c-g)/r,(h-y)/n],x=[(-1*c-g)/r,(-1*h-y)/n],E=aE([1,0],w),_=aE(w,x);return og(w,x)<=-1&&(_=Math.PI),og(w,x)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:nE(t,[f,l])?0:r,ry:nE(t,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:a,arcFlag:i,sweepFlag:o}}var jh=Math.sin,Uh=Math.cos,Yy=Math.atan2,Mc=Math.PI;function MT(t,e,r,n,a,i,o){var s=e.stroke,u=e.lineWidth,f=r-a,l=n-i,c=Yy(l,f),h=new Ky({type:"path",canvas:t.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*Uh(Mc/6)+","+10*jh(Mc/6)+" L0,0 L"+10*Uh(Mc/6)+",-"+10*jh(Mc/6),stroke:s,lineWidth:u}});h.translate(a,i),h.rotateAtPoint(a,i,c),t.set(o?"startArrowShape":"endArrowShape",h)}function AT(t,e,r,n,a,i,o){var s=e.startArrow,u=e.endArrow,f=e.stroke,l=e.lineWidth,c=o?s:u,h=c.d,d=c.fill,v=c.stroke,p=c.lineWidth,g=Kr(c,["d","fill","stroke","lineWidth"]),y=r-a,m=n-i,b=Yy(m,y);h&&(a=a-Uh(b)*h,i=i-jh(b)*h);var w=new Ky({type:"path",canvas:t.get("canvas"),isArrowShape:!0,attrs:P(P({},g),{stroke:v||f,lineWidth:p||l,fill:d})});w.translate(a,i),w.rotateAtPoint(a,i,b),t.set(o?"startArrowShape":"endArrowShape",w)}function Go(t,e,r,n,a){var i=Yy(n-e,r-t);return{dx:Uh(i)*a,dy:jh(i)*a}}function qy(t,e,r,n,a,i){typeof e.startArrow=="object"?AT(t,e,r,n,a,i,!0):e.startArrow?MT(t,e,r,n,a,i,!0):t.set("startArrowShape",null)}function Hy(t,e,r,n,a,i){typeof e.endArrow=="object"?AT(t,e,r,n,a,i,!1):e.endArrow?MT(t,e,r,n,a,i,!1):t.set("startArrowShape",null)}var oE={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"};function ru(t,e){var r=e.attr();for(var n in r){var a=r[n],i=oE[n]?oE[n]:n;i==="matrix"&&a?t.transform(a[0],a[1],a[3],a[4],a[6],a[7]):i==="lineDash"&&t.setLineDash?bt(a)&&t.setLineDash(a):(i==="strokeStyle"||i==="fillStyle"?a=h9(t,e,a):i==="globalAlpha"&&(a=a*t.globalAlpha),t[i]=a)}}function sg(t,e,r){for(var n=0;nx?w:x,C=w>x?1:w/x,I=w>x?x/w:1;e.translate(m,b),e.rotate(S),e.scale(C,I),e.arc(0,0,M,E,_,1-A),e.scale(1/C,1/I),e.rotate(-S),e.translate(-m,-b)}break}case"Z":e.closePath();break}if(h==="Z")s=u;else{var k=c.length;s=[c[k-2],c[k-1]]}}}}function IT(t,e){var r=t.get("canvas");r&&(e==="remove"&&(t._cacheCanvasBBox=t.get("cacheCanvasBBox")),t.get("hasChanged")||(t.set("hasChanged",!0),t.cfg.parent&&t.cfg.parent.get("hasChanged")||(r.refreshElement(t,e,r),r.get("autoDraw")&&r.draw())))}function g9(t){var e;if(t.destroyed)e=t._cacheCanvasBBox;else{var r=t.get("cacheCanvasBBox"),n=r&&!!(r.width&&r.height),a=t.getCanvasBBox(),i=a&&!!(a.width&&a.height);n&&i?e=i9(r,a):n?e=r:i&&(e=a)}return e}function y9(t){if(!t.length)return null;var e=[],r=[],n=[],a=[];return _e(t,function(i){var o=g9(i);o&&(e.push(o.minX),r.push(o.minY),n.push(o.maxX),a.push(o.maxY))}),{minX:Ha(e),minY:Ha(r),maxX:qa(n),maxY:qa(a)}}function m9(t,e){return!t||!e||!Uf(t,e)?null:{minX:Math.max(t.minX,e.minX),minY:Math.max(t.minY,e.minY),maxX:Math.min(t.maxX,e.maxX),maxY:Math.min(t.maxY,e.maxY)}}var kT=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.onCanvasChange=function(r){IT(this,r)},e.prototype.getShapeBase=function(){return ty},e.prototype.getGroupBase=function(){return e},e.prototype._applyClip=function(r,n){n&&(r.save(),ru(r,n),n.createPath(r),r.restore(),r.clip(),n._afterDraw())},e.prototype.cacheCanvasBBox=function(){var r=this.cfg.children,n=[],a=[];_e(r,function(h){var d=h.cfg.cacheCanvasBBox;d&&h.cfg.isInView&&(n.push(d.minX,d.maxX),a.push(d.minY,d.maxY))});var i=null;if(n.length){var o=Ha(n),s=qa(n),u=Ha(a),f=qa(a);i={minX:o,minY:u,x:o,y:u,maxX:s,maxY:f,width:s-o,height:f-u};var l=this.cfg.canvas;if(l){var c=l.getViewRange();this.set("isInView",Uf(i,c))}}else this.set("isInView",!1);this.set("cacheCanvasBBox",i)},e.prototype.draw=function(r,n){var a=this.cfg.children,i=n?this.cfg.refresh:!0;a.length&&i&&(r.save(),ru(r,this),this._applyClip(r,this.getClip()),sg(r,a,n),r.restore(),this.cacheCanvasBBox()),this.cfg.refresh=null,this.set("hasChanged",!1)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("hasChanged",!1)},e}(xC),Ea=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.getShapeBase=function(){return ty},e.prototype.getGroupBase=function(){return kT},e.prototype.onCanvasChange=function(r){IT(this,r)},e.prototype.calculateBBox=function(){var r=this.get("type"),n=this.getHitLineWidth(),a=SC(r),i=a(this),o=n/2,s=i.x-o,u=i.y-o,f=i.x+i.width+o,l=i.y+i.height+o;return{x:s,minX:s,y:u,minY:u,width:i.width+n,height:i.height+n,maxX:f,maxY:l}},e.prototype.isFill=function(){return!!this.attrs.fill||this.isClipShape()},e.prototype.isStroke=function(){return!!this.attrs.stroke},e.prototype._applyClip=function(r,n){n&&(r.save(),ru(r,n),n.createPath(r),r.restore(),r.clip(),n._afterDraw())},e.prototype.draw=function(r,n){var a=this.cfg.clipShape;if(n){if(this.cfg.refresh===!1){this.set("hasChanged",!1);return}var i=this.getCanvasBBox();if(!Uf(n,i)){this.set("hasChanged",!1),this.cfg.isInView&&this._afterDraw();return}}r.save(),ru(r,this),this._applyClip(r,a),this.drawPath(r),r.restore(),this._afterDraw()},e.prototype.getCanvasViewBox=function(){var r=this.cfg.canvas;return r?r.getViewRange():null},e.prototype.cacheCanvasBBox=function(){var r=this.getCanvasViewBox();if(r){var n=this.getCanvasBBox(),a=Uf(n,r);this.set("isInView",a),a?this.set("cacheCanvasBBox",n):this.set("cacheCanvasBBox",null)}},e.prototype._afterDraw=function(){this.cacheCanvasBBox(),this.set("hasChanged",!1),this.set("refresh",null)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("isInView",null),this.set("hasChanged",!1)},e.prototype.drawPath=function(r){this.createPath(r),this.strokeAndFill(r),this.afterDrawPath(r)},e.prototype.fill=function(r){r.fill()},e.prototype.stroke=function(r){r.stroke()},e.prototype.strokeAndFill=function(r){var n=this.attrs,a=n.lineWidth,i=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isFill()&&(!Zt(s)&&s!==1?(r.globalAlpha=s,this.fill(r),r.globalAlpha=i):this.fill(r)),this.isStroke()&&a>0&&(!Zt(o)&&o!==1&&(r.globalAlpha=o),this.stroke(r)),this.afterDrawPath(r)},e.prototype.createPath=function(r){},e.prototype.afterDrawPath=function(r){},e.prototype.isInShape=function(r,n){var a=this.isStroke(),i=this.isFill(),o=this.getHitLineWidth();return this.isInStrokeOrPath(r,n,a,i,o)},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){return!1},e.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var r=this.attrs;return r.lineWidth+r.lineAppendWidth},e}(EC),b9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,r:0})},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){var s=this.attr(),u=s.x,f=s.y,l=s.r,c=o/2,h=ET(u,f,r,n);return i&&a?h<=l+c:i?h<=l:a?h>=l-c&&h<=l+c:!1},e.prototype.createPath=function(r){var n=this.attr(),a=n.x,i=n.y,o=n.r;r.beginPath(),r.arc(a,i,o,0,Math.PI*2,!1),r.closePath()},e}(Ea);function Ac(t,e,r,n){return t/(r*r)+e/(n*n)}var w9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,rx:0,ry:0})},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){var s=this.attr(),u=o/2,f=s.x,l=s.y,c=s.rx,h=s.ry,d=(r-f)*(r-f),v=(n-l)*(n-l);return i&&a?Ac(d,v,c+u,h+u)<=1:i?Ac(d,v,c,h)<=1:a?Ac(d,v,c-u,h-u)>=1&&Ac(d,v,c+u,h+u)<=1:!1},e.prototype.createPath=function(r){var n=this.attr(),a=n.x,i=n.y,o=n.rx,s=n.ry;if(r.beginPath(),r.ellipse)r.ellipse(a,i,o,s,0,0,Math.PI*2,!1);else{var u=o>s?o:s,f=o>s?1:o/s,l=o>s?s/o:1;r.save(),r.translate(a,i),r.scale(f,l),r.arc(0,0,u,0,Math.PI*2),r.restore(),r.closePath()}},e}(Ea);function sE(t){return t instanceof HTMLElement&&Ye(t.nodeName)&&t.nodeName.toUpperCase()==="CANVAS"}var x9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,width:0,height:0})},e.prototype.initAttrs=function(r){this._setImage(r.img)},e.prototype.isStroke=function(){return!1},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._afterLoading=function(){if(this.get("toDraw")===!0){var r=this.get("canvas");r?r.draw():this.createPath(this.get("context"))}},e.prototype._setImage=function(r){var n=this,a=this.attrs;if(Ye(r)){var i=new Image;i.onload=function(){if(n.destroyed)return!1;n.attr("img",i),n.set("loading",!1),n._afterLoading();var o=n.get("callback");o&&o.call(n)},i.crossOrigin="Anonymous",i.src=r,this.set("loading",!0)}else r instanceof Image?(a.width||(a.width=r.width),a.height||(a.height=r.height)):sE(r)&&(a.width||(a.width=Number(r.getAttribute("width"))),a.height||(a.height,Number(r.getAttribute("height"))))},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),r==="img"&&this._setImage(n)},e.prototype.createPath=function(r){if(this.get("loading")){this.set("toDraw",!0),this.set("context",r);return}var n=this.attr(),a=n.x,i=n.y,o=n.width,s=n.height,u=n.sx,f=n.sy,l=n.swidth,c=n.sheight,h=n.img;(h instanceof Image||sE(h))&&(!Zt(u)&&!Zt(f)&&!Zt(l)&&!Zt(c)?r.drawImage(h,u,f,l,c,a,i,o,s):r.drawImage(h,a,i,o,s))},e}(Ea);function ji(t,e,r,n,a,i,o){var s=Math.min(t,r),u=Math.max(t,r),f=Math.min(e,n),l=Math.max(e,n),c=a/2;return i>=s-c&&i<=u+c&&o>=f-c&&o<=l+c?cn.pointToLine(t,e,r,n,i,o)<=a/2:!1}var E9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(r){this.setArrow()},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),this.setArrow()},e.prototype.setArrow=function(){var r=this.attr(),n=r.x1,a=r.y1,i=r.x2,o=r.y2,s=r.startArrow,u=r.endArrow;s&&qy(this,r,i,o,n,a),u&&Hy(this,r,n,a,i,o)},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){if(!a||!o)return!1;var s=this.attr(),u=s.x1,f=s.y1,l=s.x2,c=s.y2;return ji(u,f,l,c,o,r,n)},e.prototype.createPath=function(r){var n=this.attr(),a=n.x1,i=n.y1,o=n.x2,s=n.y2,u=n.startArrow,f=n.endArrow,l={dx:0,dy:0},c={dx:0,dy:0};u&&u.d&&(l=Go(a,i,o,s,n.startArrow.d)),f&&f.d&&(c=Go(a,i,o,s,n.endArrow.d)),r.beginPath(),r.moveTo(a+l.dx,i+l.dy),r.lineTo(o-c.dx,s-c.dy)},e.prototype.afterDrawPath=function(r){var n=this.get("startArrowShape"),a=this.get("endArrowShape");n&&n.draw(r),a&&a.draw(r)},e.prototype.getTotalLength=function(){var r=this.attr(),n=r.x1,a=r.y1,i=r.x2,o=r.y2;return cn.length(n,a,i,o)},e.prototype.getPoint=function(r){var n=this.attr(),a=n.x1,i=n.y1,o=n.x2,s=n.y2;return cn.pointAt(a,i,o,s,r)},e}(Ea),_9={circle:function(t,e,r){return[["M",t-r,e],["A",r,r,0,1,0,t+r,e],["A",r,r,0,1,0,t-r,e]]},square:function(t,e,r){return[["M",t-r,e-r],["L",t+r,e-r],["L",t+r,e+r],["L",t-r,e+r],["Z"]]},diamond:function(t,e,r){return[["M",t-r,e],["L",t,e-r],["L",t+r,e],["L",t,e+r],["Z"]]},triangle:function(t,e,r){var n=r*Math.sin(.3333333333333333*Math.PI);return[["M",t-r,e+n],["L",t,e-n],["L",t+r,e+n],["Z"]]},"triangle-down":function(t,e,r){var n=r*Math.sin(.3333333333333333*Math.PI);return[["M",t-r,e-n],["L",t+r,e-n],["L",t,e+n],["Z"]]}},S9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.initAttrs=function(r){this._resetParamsCache()},e.prototype._resetParamsCache=function(){this.set("paramsCache",{})},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),["symbol","x","y","r","radius"].indexOf(r)!==-1&&this._resetParamsCache()},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._getR=function(r){return Zt(r.r)?r.radius:r.r},e.prototype._getPath=function(){var r=this.attr(),n=r.x,a=r.y,i=r.symbol||"circle",o=this._getR(r),s,u;if(Tr(i))s=i,u=s(n,a,o),u=RC(u);else{if(s=e.Symbols[i],!s)return console.warn(i+" marker is not supported."),null;u=s(n,a,o)}return u},e.prototype.createPath=function(r){var n=this._getPath(),a=this.get("paramsCache");TT(this,r,{path:n},a)},e.Symbols=_9,e}(Ea);function NT(t,e,r){var n=LC();return t.createPath(n),n.isPointInPath(e,r)}var M9=1e-6;function Cp(t){return Math.abs(t)0!=Cp(s[1]-r)>0&&Cp(e-(r-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function cf(t,e,r,n,a,i,o,s){var u=(Math.atan2(s-e,o-t)+Math.PI*2)%(Math.PI*2);if(ua)return!1;var f={x:t+r*Math.cos(u),y:e+r*Math.sin(u)};return ET(f.x,f.y,o,s)<=i/2}var C9=eo;function T9(t){for(var e=!1,r=t.length,n=0;nb?m:b,A=m>b?1:m/b,M=m>b?b/m:1,C=C9(null,[["t",-g,-y],["r",-E],["s",1/A,1/M]]);bd(_,_,C),i=cf(0,0,S,w,x,e,_[0],_[1]);break}if(i)break}}return i}function k9(t){for(var e=t.length,r=[],n=[],a=[],i=0;i0&&n.push(a),{polygons:r,polylines:n}}const Cc=P({hasArc:T9,extractPolygons:k9,isPointInStroke:I9},Tz);function uE(t,e,r){for(var n=!1,a=0;a=l[0]&&r<=l[1]&&(a=(r-l[0])/(l[1]-l[0]),i=c)});var s=o[i];if(Zt(s)||Zt(i))return null;var u=s.length,f=o[i+1];return xf.pointAt(s[u-2],s[u-1],f[1],f[2],f[3],f[4],f[5],f[6],a)},e.prototype._calculateCurve=function(){var r=this.attr().path;this.set("curve",Cc.pathToCurve(r))},e.prototype._setTcache=function(){var r=0,n=0,a=[],i,o,s,u,f=this.get("curve");if(f){if(_e(f,function(l,c){s=f[c+1],u=l.length,s&&(r+=xf.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6])||0)}),this.set("totalLength",r),r===0){this.set("tCache",[]);return}_e(f,function(l,c){s=f[c+1],u=l.length,s&&(i=[],i[0]=n/r,o=xf.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6]),n+=o||0,i[1]=n/r,a.push(i))}),this.set("tCache",a)}},e.prototype.getStartTangent=function(){var r=this.getSegments(),n;if(r.length>1){var a=r[0].currentPoint,i=r[1].currentPoint,o=r[1].startTangent;n=[],o?(n.push([a[0]-o[0],a[1]-o[1]]),n.push([a[0],a[1]])):(n.push([i[0],i[1]]),n.push([a[0],a[1]]))}return n},e.prototype.getEndTangent=function(){var r=this.getSegments(),n=r.length,a;if(n>1){var i=r[n-2].currentPoint,o=r[n-1].currentPoint,s=r[n-1].endTangent;a=[],s?(a.push([o[0]-s[0],o[1]-s[1]]),a.push([o[0],o[1]])):(a.push([i[0],i[1]]),a.push([o[0],o[1]]))}return a},e}(Ea);function LT(t,e,r,n,a){var i=t.length;if(i<2)return!1;for(var o=0;o=s[0]&&r<=s[1]&&(i=(r-s[0])/(s[1]-s[0]),o=u)}),cn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],i)},e.prototype._setTcache=function(){var r=this.attr().points;if(!(!r||r.length===0)){var n=this.getTotalLength();if(!(n<=0)){var a=0,i=[],o,s;_e(r,function(u,f){r[f+1]&&(o=[],o[0]=a/n,s=cn.length(u[0],u[1],r[f+1][0],r[f+1][1]),a+=s,o[1]=a/n,i.push(o))}),this.set("tCache",i)}}},e.prototype.getStartTangent=function(){var r=this.attr().points,n=[];return n.push([r[1][0],r[1][1]]),n.push([r[0][0],r[0][1]]),n},e.prototype.getEndTangent=function(){var r=this.attr().points,n=r.length-1,a=[];return a.push([r[n-1][0],r[n-1][1]]),a.push([r[n][0],r[n][1]]),a},e}(Ea);function L9(t,e,r,n,a,i,o){var s=a/2;return Ro(t-s,e-s,r,a,i,o)||Ro(t+r-s,e-s,a,n,i,o)||Ro(t+s,e+n-s,r,a,i,o)||Ro(t-s,e+s,a,n,i,o)}function D9(t,e,r,n,a,i,o,s){return ji(t+a,e,t+r-a,e,i,o,s)||ji(t+r,e+a,t+r,e+n-a,i,o,s)||ji(t+r-a,e+n,t+a,e+n,i,o,s)||ji(t,e+n-a,t,e+a,i,o,s)||cf(t+r-a,e+a,a,1.5*Math.PI,2*Math.PI,i,o,s)||cf(t+r-a,e+n-a,a,0,.5*Math.PI,i,o,s)||cf(t+a,e+n-a,a,.5*Math.PI,Math.PI,i,o,s)||cf(t+a,e+a,a,Math.PI,1.5*Math.PI,i,o,s)}var P9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.isInStrokeOrPath=function(r,n,a,i,o){var s=this.attr(),u=s.x,f=s.y,l=s.width,c=s.height,h=s.radius;if(h){var v=!1;return a&&(v=D9(u,f,l,c,h,o,r,n)),!v&&i&&(v=NT(this,r,n)),v}else{var d=o/2;if(i&&a)return Ro(u-d,f-d,l+d,c+d,r,n);if(i)return Ro(u,f,l,c,r,n);if(a)return L9(u,f,l,c,o,r,n)}},e.prototype.createPath=function(r){var n=this.attr(),a=n.x,i=n.y,o=n.width,s=n.height,u=n.radius;if(r.beginPath(),u===0)r.rect(a,i,o,s);else{var f=d9(u),l=f[0],c=f[1],h=f[2],d=f[3];r.moveTo(a+l,i),r.lineTo(a+o-c,i),c!==0&&r.arc(a+o-c,i+c,c,-Math.PI/2,0),r.lineTo(a+o,i+s-h),h!==0&&r.arc(a+o-h,i+s-h,h,0,Math.PI/2),r.lineTo(a+d,i+s),d!==0&&r.arc(a+d,i+s-d,d,Math.PI/2,Math.PI),r.lineTo(a,i+l),l!==0&&r.arc(a+l,i+l,l,Math.PI,Math.PI*1.5),r.closePath()}},e}(Ea),R9=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.isOnlyHitBox=function(){return!0},e.prototype.initAttrs=function(r){this._assembleFont(),r.text&&this._setText(r.text)},e.prototype._assembleFont=function(){var r=this.attrs;r.font=PC(r)},e.prototype._setText=function(r){var n=null;Ye(r)&&r.indexOf(` `)!==-1&&(n=r.split(` `)),this.set("textArr",n)},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),r.startsWith("font")&&this._assembleFont(),r==="text"&&this._setText(n)},e.prototype._getSpaceingY=function(){var r=this.attrs,n=r.lineHeight,a=r.fontSize*1;return n?n-a:a*.14},e.prototype._drawTextArr=function(r,n,a){var i=this.attrs,o=i.textBaseline,s=i.x,u=i.y,f=i.fontSize*1,l=this._getSpaceingY(),c=DC(i.text,i.fontSize,i.lineHeight),h;_e(n,function(d,v){h=u+v*(l+f)-c+f,o==="middle"&&(h+=c-f-(c-f)/2),o==="top"&&(h+=c-f),Zt(d)||(a?r.fillText(d,s,h):r.strokeText(d,s,h))})},e.prototype._drawText=function(r,n){var a=this.attr(),i=a.x,o=a.y,s=this.get("textArr");if(s)this._drawTextArr(r,s,n);else{var u=a.text;Zt(u)||(n?r.fillText(u,i,o):r.strokeText(u,i,o))}},e.prototype.strokeAndFill=function(r){var n=this.attrs,a=n.lineWidth,i=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isStroke()&&a>0&&(!Zt(o)&&o!==1&&(r.globalAlpha=i),this.stroke(r)),this.isFill()&&(!Zt(s)&&s!==1?(r.globalAlpha=s,this.fill(r),r.globalAlpha=i):this.fill(r)),this.afterDrawPath(r)},e.prototype.fill=function(r){this._drawText(r,!0)},e.prototype.stroke=function(r){this._drawText(r,!1)},e}(Ea);function F9(t,e){if(e){var r=nC(e);return Do(r,t)}return t}function DT(t,e,r){var n=t.getTotalMatrix();if(n){var a=F9([e,r,1],n),i=a[0],o=a[1];return[i,o]}return[e,r]}function fE(t,e,r){if(t.isCanvas&&t.isCanvas())return!0;if(!P0(t)||t.cfg.isInView===!1)return!1;if(t.cfg.clipShape){var n=DT(t,e,r),a=n[0],i=n[1];if(t.isClipped(a,i))return!1}var o=t.cfg.cacheCanvasBBox||t.getCanvasBBox();return e>=o.minX&&e<=o.maxX&&r>=o.minY&&r<=o.maxY}function PT(t,e,r){if(!fE(t,e,r))return null;for(var n=null,a=t.getChildren(),i=a.length,o=i-1;o>=0;o--){var s=a[o];if(s.isGroup())n=PT(s,e,r);else if(fE(s,e,r)){var u=s,f=DT(s,e,r),l=f[0],c=f[1];u.isInShape(l,c)&&(n=s)}if(n)break}return n}var qu=function(t){jt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){var r=t.prototype.getDefaultCfg.call(this);return r.renderer="canvas",r.autoDraw=!0,r.localRefresh=!0,r.refreshElements=[],r.clipView=!0,r.quickHit=!1,r},e.prototype.onCanvasChange=function(r){(r==="attr"||r==="sort"||r==="changeSize")&&(this.set("refreshElements",[this]),this.draw())},e.prototype.getShapeBase=function(){return ty},e.prototype.getGroupBase=function(){return kT},e.prototype.getPixelRatio=function(){var r=this.get("pixelRatio")||a9();return r>=1?Math.ceil(r):1},e.prototype.getViewRange=function(){return{minX:0,minY:0,maxX:this.cfg.width,maxY:this.cfg.height}},e.prototype.createDom=function(){var r=document.createElement("canvas"),n=r.getContext("2d");return this.set("context",n),r},e.prototype.setDOMSize=function(r,n){t.prototype.setDOMSize.call(this,r,n);var a=this.get("context"),i=this.get("el"),o=this.getPixelRatio();i.width=o*r,i.height=o*n,o>1&&a.scale(o,o)},e.prototype.clear=function(){t.prototype.clear.call(this),this._clearFrame();var r=this.get("context"),n=this.get("el");r.clearRect(0,0,n.width,n.height)},e.prototype.getShape=function(r,n){var a;return this.get("quickHit")?a=PT(this,r,n):a=t.prototype.getShape.call(this,r,n,null),a},e.prototype._getRefreshRegion=function(){var r=this.get("refreshElements"),n=this.getViewRange(),a;if(r.length&&r[0]===this)a=n;else if(a=y9(r),a){a.minX=Math.floor(a.minX),a.minY=Math.floor(a.minY),a.maxX=Math.ceil(a.maxX),a.maxY=Math.ceil(a.maxY),a.maxY+=1;var i=this.get("clipView");i&&(a=m9(a,n))}return a},e.prototype.refreshElement=function(r){var n=this.get("refreshElements");n.push(r)},e.prototype._clearFrame=function(){var r=this.get("drawFrame");r&&(VS(r),this.set("drawFrame",null),this.set("refreshElements",[]))},e.prototype.draw=function(){var r=this.get("drawFrame");this.get("autoDraw")&&r||this._startDraw()},e.prototype._drawAll=function(){var r=this.get("context"),n=this.get("el"),a=this.getChildren();r.clearRect(0,0,n.width,n.height),ru(r,this),sg(r,a),this.set("refreshElements",[])},e.prototype._drawRegion=function(){var r=this.get("context"),n=this.get("refreshElements"),a=this.getChildren(),i=this._getRefreshRegion();i?(r.clearRect(i.minX,i.minY,i.maxX-i.minX,i.maxY-i.minY),r.save(),r.beginPath(),r.rect(i.minX,i.minY,i.maxX-i.minX,i.maxY-i.minY),r.clip(),ru(r,this),v9(this,a,i),sg(r,a,i),r.restore()):n.length&&CT(n),_e(n,function(o){o.get("hasChanged")&&o.set("hasChanged",!1)}),this.set("refreshElements",[])},e.prototype._startDraw=function(){var r=this,n=this.get("drawFrame"),a=this.get("drawFrameCallback");n||(n=WS(function(){r.get("localRefresh")?r._drawRegion():r._drawAll(),r.set("drawFrame",null),a&&a()}),this.set("drawFrame",n))},e.prototype.skipDraw=function(){},e.prototype.removeDom=function(){var r=this.get("el");r.width=0,r.height=0,r.parentNode.removeChild(r)},e}(wC),fg={rect:"path",circle:"circle",line:"line",path:"path",marker:"path",text:"text",polyline:"polyline",polygon:"polygon",image:"image",ellipse:"ellipse",dom:"foreignObject"},ar={opacity:"opacity",fillStyle:"fill",fill:"fill",fillOpacity:"fill-opacity",strokeStyle:"stroke",strokeOpacity:"stroke-opacity",stroke:"stroke",x:"x",y:"y",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",x1:"x1",x2:"x2",y1:"y1",y2:"y2",lineCap:"stroke-linecap",lineJoin:"stroke-linejoin",lineWidth:"stroke-width",lineDash:"stroke-dasharray",lineDashOffset:"stroke-dashoffset",miterLimit:"stroke-miterlimit",font:"font",fontSize:"font-size",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",fontFamily:"font-family",startArrow:"marker-start",endArrow:"marker-end",path:"d",class:"class",id:"id",style:"style",preserveAspectRatio:"preserveAspectRatio"};function ra(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function RT(t){var e=fg[t.type],r=t.getParent();if(!e)throw new Error("the type "+t.type+" is not supported by svg");var n=ra(e);if(t.get("id")&&(n.id=t.get("id")),t.set("el",n),t.set("attrs",{}),r){var a=r.get("el");a||(a=r.createDom(),r.set("el",a)),a.appendChild(n)}return n}function FT(t,e){var r=t.get("el"),n=ZS(r.children).sort(e),a=document.createDocumentFragment();n.forEach(function(i){a.appendChild(i)}),r.appendChild(a)}function B9(t,e){var r=t.parentNode,n=Array.from(r.childNodes).filter(function(s){return s.nodeType===1&&s.nodeName.toLowerCase()!=="defs"}),a=n[e],i=n.indexOf(t);if(a){if(i>e)r.insertBefore(t,a);else if(i0&&(n?"stroke"in a?this._setColor(r,"stroke",s):"strokeStyle"in a&&this._setColor(r,"stroke",u):this._setColor(r,"stroke",s||u),l&&h.setAttribute(ar.strokeOpacity,l),c&&h.setAttribute(ar.lineWidth,c))},e.prototype._setColor=function(r,n,a){var i=this.get("el");if(!a){i.setAttribute(ar[n],"none");return}if(a=a.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(a)){var o=r.find("gradient",a);o||(o=r.addGradient(a)),i.setAttribute(ar[n],"url(#"+o+")")}else if(/^[p,P]{1}[\s]*\(/.test(a)){var o=r.find("pattern",a);o||(o=r.addPattern(a)),i.setAttribute(ar[n],"url(#"+o+")")}else i.setAttribute(ar[n],a)},e.prototype.shadow=function(r,n){var a=this.attr(),i=n||a,o=i.shadowOffsetX,s=i.shadowOffsetY,u=i.shadowBlur,f=i.shadowColor;(o||s||u||f)&&G9(this,r)},e.prototype.transform=function(r){var n=this.attr(),a=(r||n).matrix;a&&al(this)},e.prototype.isInShape=function(r,n){return this.isPointInPath(r,n)},e.prototype.isPointInPath=function(r,n){var a=this.get("el"),i=this.get("canvas"),o=i.get("el").getBoundingClientRect(),s=r+o.left,u=n+o.top,f=document.elementFromPoint(s,u);return!!(f&&f.isEqualNode(a))},e.prototype.getHitLineWidth=function(){var r=this.attrs,n=r.lineWidth,a=r.lineAppendWidth;return this.isStroke()?n+a:0},e}(EC),z9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="circle",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,r:0})},e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){s==="x"||s==="y"?i.setAttribute("c"+s,o):ar[s]&&i.setAttribute(ar[s],o)})},e}(aa),j9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="dom",r.canFill=!1,r.canStroke=!1,r}return e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");if(_e(n||a,function(f,l){ar[l]&&i.setAttribute(ar[l],f)}),typeof a.html=="function"){var o=a.html.call(this,a);if(o instanceof Element||o instanceof HTMLDocument){for(var s=i.childNodes,u=s.length-1;u>=0;u--)i.removeChild(s[u]);i.appendChild(o)}else i.innerHTML=o}else i.innerHTML=a.html},e}(aa),U9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="ellipse",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,rx:0,ry:0})},e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){s==="x"||s==="y"?i.setAttribute("c"+s,o):ar[s]&&i.setAttribute(ar[s],o)})},e}(aa),$9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="image",r.canFill=!1,r.canStroke=!1,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,width:0,height:0})},e.prototype.createPath=function(r,n){var a=this,i=this.attr(),o=this.get("el");_e(n||i,function(s,u){u==="img"?a._setImage(i.img):ar[u]&&o.setAttribute(ar[u],s)})},e.prototype.setAttr=function(r,n){this.attrs[r]=n,r==="img"&&this._setImage(n)},e.prototype._setImage=function(r){var n=this.attr(),a=this.get("el");if(Ye(r))a.setAttribute("href",r);else if(r instanceof window.Image)n.width||(a.setAttribute("width",r.width),this.attr("width",r.width)),n.height||(a.setAttribute("height",r.height),this.attr("height",r.height)),a.setAttribute("href",r.src);else if(r instanceof HTMLElement&&Ye(r.nodeName)&&r.nodeName.toUpperCase()==="CANVAS")a.setAttribute("href",r.toDataURL());else if(r instanceof ImageData){var i=document.createElement("canvas");i.setAttribute("width",""+r.width),i.setAttribute("height",""+r.height),i.getContext("2d").putImageData(r,0,0),n.width||(a.setAttribute("width",""+r.width),this.attr("width",r.width)),n.height||(a.setAttribute("height",""+r.height),this.attr("height",r.height)),a.setAttribute("href",i.toDataURL())}},e}(aa),X9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="line",r.canFill=!1,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){if(s==="startArrow"||s==="endArrow")if(o){var u=gn(o)?r.addArrow(a,ar[s]):r.getDefaultArrow(a,ar[s]);i.setAttribute(ar[s],"url(#"+u+")")}else i.removeAttribute(ar[s]);else ar[s]&&i.setAttribute(ar[s],o)})},e.prototype.getTotalLength=function(){var r=this.attr(),n=r.x1,a=r.y1,i=r.x2,o=r.y2;return cn.length(n,a,i,o)},e.prototype.getPoint=function(r){var n=this.attr(),a=n.x1,i=n.y1,o=n.x2,s=n.y2;return cn.pointAt(a,i,o,s,r)},e}(aa),Tc={circle:function(t,e,r){return[["M",t,e],["m",-r,0],["a",r,r,0,1,0,r*2,0],["a",r,r,0,1,0,-r*2,0]]},square:function(t,e,r){return[["M",t-r,e-r],["L",t+r,e-r],["L",t+r,e+r],["L",t-r,e+r],["Z"]]},diamond:function(t,e,r){return[["M",t-r,e],["L",t,e-r],["L",t+r,e],["L",t,e+r],["Z"]]},triangle:function(t,e,r){var n=r*Math.sin(.3333333333333333*Math.PI);return[["M",t-r,e+n],["L",t,e-n],["L",t+r,e+n],["z"]]},triangleDown:function(t,e,r){var n=r*Math.sin(.3333333333333333*Math.PI);return[["M",t-r,e-n],["L",t+r,e-n],["L",t,e+n],["Z"]]}};const lE={get:function(t){return Tc[t]},register:function(t,e){Tc[t]=e},remove:function(t){delete Tc[t]},getAll:function(){return Tc}};var W9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="marker",r.canFill=!0,r.canStroke=!0,r}return e.prototype.createPath=function(r){var n=this.get("el");n.setAttribute("d",this._assembleMarker())},e.prototype._assembleMarker=function(){var r=this._getPath();return bt(r)?r.map(function(n){return n.join(" ")}).join(""):r},e.prototype._getPath=function(){var r=this.attr(),n=r.x,a=r.y,i=r.r||r.radius,o=r.symbol||"circle",s;return Tr(o)?s=o:s=lE.get(o),s?s(n,a,i):(console.warn(s+" symbol is not exist."),null)},e.symbolsFactory=lE,e}(aa),V9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="path",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{startArrow:!1,endArrow:!1})},e.prototype.createPath=function(r,n){var a=this,i=this.attr(),o=this.get("el");_e(n||i,function(s,u){if(u==="path"&&bt(s))o.setAttribute("d",a._formatPath(s));else if(u==="startArrow"||u==="endArrow")if(s){var f=gn(s)?r.addArrow(i,ar[u]):r.getDefaultArrow(i,ar[u]);o.setAttribute(ar[u],"url(#"+f+")")}else o.removeAttribute(ar[u]);else ar[u]&&o.setAttribute(ar[u],s)})},e.prototype._formatPath=function(r){var n=r.map(function(a){return a.join(" ")}).join("");return~n.indexOf("NaN")?"":n},e.prototype.getTotalLength=function(){var r=this.get("el");return r?r.getTotalLength():null},e.prototype.getPoint=function(r){var n=this.get("el"),a=this.getTotalLength();if(a===0)return null;var i=n?n.getPointAtLength(r*a):null;return i?{x:i.x,y:i.y}:null},e}(aa),Y9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="polygon",r.canFill=!0,r.canStroke=!0,r}return e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){s==="points"&&bt(o)&&o.length>=2?i.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):ar[s]&&i.setAttribute(ar[s],o)})},e}(aa),q9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="polyline",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{startArrow:!1,endArrow:!1})},e.prototype.onAttrChange=function(r,n,a){t.prototype.onAttrChange.call(this,r,n,a),["points"].indexOf(r)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.createPath=function(r,n){var a=this.attr(),i=this.get("el");_e(n||a,function(o,s){s==="points"&&bt(o)&&o.length>=2?i.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):ar[s]&&i.setAttribute(ar[s],o)})},e.prototype.getTotalLength=function(){var r=this.attr().points,n=this.get("totalLength");return Zt(n)?(this.set("totalLength",OC.length(r)),this.get("totalLength")):n},e.prototype.getPoint=function(r){var n=this.attr().points,a=this.get("tCache");a||(this._setTcache(),a=this.get("tCache"));var i,o;return _e(a,function(s,u){r>=s[0]&&r<=s[1]&&(i=(r-s[0])/(s[1]-s[0]),o=u)}),cn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],i)},e.prototype._setTcache=function(){var r=this.attr().points;if(!(!r||r.length===0)){var n=this.getTotalLength();if(!(n<=0)){var a=0,i=[],o,s;_e(r,function(u,f){r[f+1]&&(o=[],o[0]=a/n,s=cn.length(u[0],u[1],r[f+1][0],r[f+1][1]),a+=s,o[1]=a/n,i.push(o))}),this.set("tCache",i)}}},e.prototype.getStartTangent=function(){var r=this.attr().points,n=[];return n.push([r[1][0],r[1][1]]),n.push([r[0][0],r[0][1]]),n},e.prototype.getEndTangent=function(){var r=this.attr().points,n=r.length-1,a=[];return a.push([r[n-1][0],r[n-1][1]]),a.push([r[n][0],r[n][1]]),a},e}(aa);function H9(t){var e=0,r=0,n=0,a=0;return bt(t)?t.length===1?e=r=n=a=t[0]:t.length===2?(e=n=t[0],r=a=t[1]):t.length===3?(e=t[0],r=a=t[1],n=t[2]):(e=t[0],r=t[1],n=t[2],a=t[3]):e=r=n=a=t,{r1:e,r2:r,r3:n,r4:a}}var Z9=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="rect",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.createPath=function(r,n){var a=this,i=this.attr(),o=this.get("el"),s=!1,u=["x","y","width","height","radius"];_e(n||i,function(f,l){u.indexOf(l)!==-1&&!s?(o.setAttribute("d",a._assembleRect(i)),s=!0):u.indexOf(l)===-1&&ar[l]&&o.setAttribute(ar[l],f)})},e.prototype._assembleRect=function(r){var n=r.x,a=r.y,i=r.width,o=r.height,s=r.radius;if(!s)return"M "+n+","+a+" l "+i+",0 l 0,"+o+" l"+-i+" 0 z";var u=H9(s);bt(s)?s.length===1?u.r1=u.r2=u.r3=u.r4=s[0]:s.length===2?(u.r1=u.r3=s[0],u.r2=u.r4=s[1]):s.length===3?(u.r1=s[0],u.r2=u.r4=s[1],u.r3=s[2]):(u.r1=s[0],u.r2=s[1],u.r3=s[2],u.r4=s[3]):u.r1=u.r2=u.r3=u.r4=s;var f=[["M "+(n+u.r1)+","+a],["l "+(i-u.r1-u.r2)+",0"],["a "+u.r2+","+u.r2+",0,0,1,"+u.r2+","+u.r2],["l 0,"+(o-u.r2-u.r3)],["a "+u.r3+","+u.r3+",0,0,1,"+-u.r3+","+u.r3],["l "+(u.r3+u.r4-i)+",0"],["a "+u.r4+","+u.r4+",0,0,1,"+-u.r4+","+-u.r4],["l 0,"+(u.r4+u.r1-o)],["a "+u.r1+","+u.r1+",0,0,1,"+u.r1+","+-u.r1],["z"]];return f.join(" ")},e}(aa),cE=.3,K9={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},Q9={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},J9={left:"left",start:"left",center:"middle",right:"end",end:"end"},e7=function(t){jt(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r.type="text",r.canFill=!0,r.canStroke=!0,r}return e.prototype.getDefaultAttrs=function(){var r=t.prototype.getDefaultAttrs.call(this);return P(P({},r),{x:0,y:0,text:null,fontSize:12,fontFamily:"sans-serif",fontStyle:"normal",fontWeight:"normal",fontVariant:"normal",textAlign:"start",textBaseline:"bottom"})},e.prototype.createPath=function(r,n){var a=this,i=this.attr(),o=this.get("el");this._setFont(),_e(n||i,function(s,u){u==="text"?a._setText(""+s):u==="matrix"&&s?al(a):ar[u]&&o.setAttribute(ar[u],s)}),o.setAttribute("paint-order","stroke"),o.setAttribute("style","stroke-linecap:butt; stroke-linejoin:miter;")},e.prototype._setFont=function(){var r=this.get("el"),n=this.attr(),a=n.textBaseline,i=n.textAlign,o=rC();o&&o.name==="firefox"?r.setAttribute("dominant-baseline",Q9[a]||"alphabetic"):r.setAttribute("alignment-baseline",K9[a]||"baseline"),r.setAttribute("text-anchor",J9[i]||"left")},e.prototype._setText=function(r){var n=this.get("el"),a=this.attr(),i=a.x,o=a.textBaseline,s=o===void 0?"bottom":o;if(!r)n.innerHTML="";else if(~r.indexOf(` `)){var u=r.split(` `),f=u.length-1,l="";_e(u,function(c,h){h===0?s==="alphabetic"?l+=''+c+"":s==="top"?l+=''+c+"":s==="middle"?l+=''+c+"":s==="bottom"?l+=''+c+"":s==="hanging"&&(l+=''+c+""):l+=''+c+""}),n.innerHTML=l}else n.innerHTML=r},e}(aa),t7=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,r7=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,n7=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function jT(t){var e=t.match(n7);if(!e)return"";var r="";return e.sort(function(n,a){return n=n.split(":"),a=a.split(":"),Number(n[0])-Number(a[0])}),_e(e,function(n){n=n.split(":"),r+=''}),r}function a7(t,e){var r=t7.exec(t),n=gd(yd(parseFloat(r[1])),Math.PI*2),a=r[2],i,o;n>=0&&n<.5*Math.PI?(i={x:0,y:0},o={x:1,y:1}):.5*Math.PI<=n&&n`;r.innerHTML=n},t}(),hE=function(){function t(e,r){this.cfg={};var n=ra("marker"),a=Ji("marker_");n.setAttribute("id",a);var i=ra("path");i.setAttribute("stroke",e.stroke||"none"),i.setAttribute("fill",e.fill||"none"),n.appendChild(i),n.setAttribute("overflow","visible"),n.setAttribute("orient","auto-start-reverse"),this.el=n,this.child=i,this.id=a;var o=e[r==="marker-start"?"startArrow":"endArrow"];return this.stroke=e.stroke||"#000",o===!0?this._setDefaultPath(r,i):(this.cfg=o,this._setMarker(e.lineWidth,i)),this}return t.prototype.match=function(){return!1},t.prototype._setDefaultPath=function(e,r){var n=this.el;r.setAttribute("d","M0,0 L"+10*Math.cos(Math.PI/6)+",5 L0,10"),n.setAttribute("refX",""+10*Math.cos(Math.PI/6)),n.setAttribute("refY","5")},t.prototype._setMarker=function(e,r){var n=this.el,a=this.cfg.path,i=this.cfg.d;bt(a)&&(a=a.map(function(o){return o.join(" ")}).join("")),r.setAttribute("d",a),n.appendChild(r),i&&n.setAttribute("refX",""+i/e)},t.prototype.update=function(e){var r=this.child;r.attr?r.attr("fill",e):r.setAttribute("fill",e)},t}(),l7=function(){function t(e){this.type="clip",this.cfg={};var r=ra("clipPath");this.el=r,this.id=Ji("clip_"),r.id=this.id;var n=e.cfg.el;return r.appendChild(n),this.cfg=e,this}return t.prototype.match=function(){return!1},t.prototype.remove=function(){var e=this.el;e.parentNode.removeChild(e)},t}(),c7=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,h7=function(){function t(e){this.cfg={};var r=ra("pattern");r.setAttribute("patternUnits","userSpaceOnUse");var n=ra("image");r.appendChild(n);var a=Ji("pattern_");r.id=a,this.el=r,this.id=a,this.cfg=e;var i=c7.exec(e),o=i[2];n.setAttribute("href",o);var s=new Image;o.match(/^data:/i)||(s.crossOrigin="Anonymous"),s.src=o;function u(){r.setAttribute("width",""+s.width),r.setAttribute("height",""+s.height)}return s.complete?u():(s.onload=u,s.src=s.src),this}return t.prototype.match=function(e,r){return this.cfg===r},t}(),d7=function(){function t(e){var r=ra("defs"),n=Ji("defs_");r.id=n,e.appendChild(r),this.children=[],this.defaultArrow={},this.el=r,this.canvas=e}return t.prototype.find=function(e,r){for(var n=this.children,a=null,i=0;i]*>/,lg={tr:document.createElement("tbody"),tbody:hf,thead:hf,tfoot:hf,td:Ip,th:Ip,"*":document.createElement("div")}}function cg(t){hf||v7();var e=UT.test(t)&&RegExp.$1;(!e||!(e in lg))&&(e="*");var r=lg[e];t=typeof t=="string"?t.replace(/(^\s*)|(\s*$)/g,""):t,r.innerHTML=""+t;var n=r.childNodes[0];return n&&r.contains(n)&&r.removeChild(n),n}function Hu(t,e){if(t)for(var r in e)e.hasOwnProperty(r)&&(t.style[r]=e[r]);return t}var $T={exports:{}},p7={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]},XT={exports:{}},g7=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")},y7=g7,m7=Array.prototype.concat,b7=Array.prototype.slice,dE=XT.exports=function(e){for(var r=[],n=0,a=e.length;n=4&&t[3]!==1&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"};$n.to.keyword=function(t){return VT[t.slice(0,3)]};function Vi(t,e,r){return Math.min(Math.max(e,t),r)}function kc(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}var x7=$T.exports,YT={exports:{}},E7={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]},zo=E7,qT={};for(var Np in zo)zo.hasOwnProperty(Np)&&(qT[zo[Np]]=Np);var mt=YT.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 Tn in mt)if(mt.hasOwnProperty(Tn)){if(!("channels"in mt[Tn]))throw new Error("missing channels property: "+Tn);if(!("labels"in mt[Tn]))throw new Error("missing channel labels property: "+Tn);if(mt[Tn].labels.length!==mt[Tn].channels)throw new Error("channel and label counts mismatch: "+Tn);var _7=mt[Tn].channels,S7=mt[Tn].labels;delete mt[Tn].channels,delete mt[Tn].labels,Object.defineProperty(mt[Tn],"channels",{value:_7}),Object.defineProperty(mt[Tn],"labels",{value:S7})}mt.rgb.hsl=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,a=Math.min(e,r,n),i=Math.max(e,r,n),o=i-a,s,u,f;return i===a?s=0:e===i?s=(r-n)/o:r===i?s=2+(n-e)/o:n===i&&(s=4+(e-r)/o),s=Math.min(s*60,360),s<0&&(s+=360),f=(a+i)/2,i===a?u=0:f<=.5?u=o/(i+a):u=o/(2-i-a),[s,u*100,f*100]};mt.rgb.hsv=function(t){var e,r,n,a,i,o=t[0]/255,s=t[1]/255,u=t[2]/255,f=Math.max(o,s,u),l=f-Math.min(o,s,u),c=function(h){return(f-h)/6/l+1/2};return l===0?a=i=0:(i=l/f,e=c(o),r=c(s),n=c(u),o===f?a=n-r:s===f?a=1/3+e-n:u===f&&(a=2/3+r-e),a<0?a+=1:a>1&&(a-=1)),[a*360,i*100,f*100]};mt.rgb.hwb=function(t){var e=t[0],r=t[1],n=t[2],a=mt.rgb.hsl(t)[0],i=1/255*Math.min(e,Math.min(r,n));return n=1-1/255*Math.max(e,Math.max(r,n)),[a,i*100,n*100]};mt.rgb.cmyk=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,a,i,o,s;return s=Math.min(1-e,1-r,1-n),a=(1-e-s)/(1-s)||0,i=(1-r-s)/(1-s)||0,o=(1-n-s)/(1-s)||0,[a*100,i*100,o*100,s*100]};function M7(t,e){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2)}mt.rgb.keyword=function(t){var e=qT[t];if(e)return e;var r=1/0,n;for(var a in zo)if(zo.hasOwnProperty(a)){var i=zo[a],o=M7(t,i);o.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var a=e*.4124+r*.3576+n*.1805,i=e*.2126+r*.7152+n*.0722,o=e*.0193+r*.1192+n*.9505;return[a*100,i*100,o*100]};mt.rgb.lab=function(t){var e=mt.rgb.xyz(t),r=e[0],n=e[1],a=e[2],i,o,s;return r/=95.047,n/=100,a/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,i=116*n-16,o=500*(r-n),s=200*(n-a),[i,o,s]};mt.hsl.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,a,i,o,s,u;if(r===0)return u=n*255,[u,u,u];n<.5?i=n*(1+r):i=n+r-n*r,a=2*n-i,s=[0,0,0];for(var f=0;f<3;f++)o=e+1/3*-(f-1),o<0&&o++,o>1&&o--,6*o<1?u=a+(i-a)*6*o:2*o<1?u=i:3*o<2?u=a+(i-a)*(2/3-o)*6:u=a,s[f]=u*255;return s};mt.hsl.hsv=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,a=r,i=Math.max(n,.01),o,s;return n*=2,r*=n<=1?n:2-n,a*=i<=1?i:2-i,s=(n+r)/2,o=n===0?2*a/(i+a):2*r/(n+r),[e,o*100,s*100]};mt.hsv.rgb=function(t){var e=t[0]/60,r=t[1]/100,n=t[2]/100,a=Math.floor(e)%6,i=e-Math.floor(e),o=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,a){case 0:return[n,u,o];case 1:return[s,n,o];case 2:return[o,n,u];case 3:return[o,s,n];case 4:return[u,o,n];case 5:return[n,o,s]}};mt.hsv.hsl=function(t){var e=t[0],r=t[1]/100,n=t[2]/100,a=Math.max(n,.01),i,o,s;return s=(2-r)*n,i=(2-r)*a,o=r*a,o/=i<=1?i:2-i,o=o||0,s/=2,[e,o*100,s*100]};mt.hwb.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,a=r+n,i,o,s,u;a>1&&(r/=a,n/=a),i=Math.floor(6*e),o=1-n,s=6*e-i,i&1&&(s=1-s),u=r+s*(o-r);var f,l,c;switch(i){default:case 6:case 0:f=o,l=u,c=r;break;case 1:f=u,l=o,c=r;break;case 2:f=r,l=o,c=u;break;case 3:f=r,l=u,c=o;break;case 4:f=u,l=r,c=o;break;case 5:f=o,l=r,c=u;break}return[f*255,l*255,c*255]};mt.cmyk.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,a=t[3]/100,i,o,s;return i=1-Math.min(1,e*(1-a)+a),o=1-Math.min(1,r*(1-a)+a),s=1-Math.min(1,n*(1-a)+a),[i*255,o*255,s*255]};mt.xyz.rgb=function(t){var e=t[0]/100,r=t[1]/100,n=t[2]/100,a,i,o;return a=e*3.2406+r*-1.5372+n*-.4986,i=e*-.9689+r*1.8758+n*.0415,o=e*.0557+r*-.204+n*1.057,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,a=Math.min(Math.max(0,a),1),i=Math.min(Math.max(0,i),1),o=Math.min(Math.max(0,o),1),[a*255,i*255,o*255]};mt.xyz.lab=function(t){var e=t[0],r=t[1],n=t[2],a,i,o;return e/=95.047,r/=100,n/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,a=116*r-16,i=500*(e-r),o=200*(r-n),[a,i,o]};mt.lab.xyz=function(t){var e=t[0],r=t[1],n=t[2],a,i,o;i=(e+16)/116,a=r/500+i,o=i-n/200;var s=Math.pow(i,3),u=Math.pow(a,3),f=Math.pow(o,3);return i=s>.008856?s:(i-16/116)/7.787,a=u>.008856?u:(a-16/116)/7.787,o=f>.008856?f:(o-16/116)/7.787,a*=95.047,i*=100,o*=108.883,[a,i,o]};mt.lab.lch=function(t){var e=t[0],r=t[1],n=t[2],a,i,o;return a=Math.atan2(n,r),i=a*360/2/Math.PI,i<0&&(i+=360),o=Math.sqrt(r*r+n*n),[e,o,i]};mt.lch.lab=function(t){var e=t[0],r=t[1],n=t[2],a,i,o;return o=n/360*2*Math.PI,a=r*Math.cos(o),i=r*Math.sin(o),[e,a,i]};mt.rgb.ansi16=function(t){var e=t[0],r=t[1],n=t[2],a=1 in arguments?arguments[1]:mt.rgb.hsv(t)[2];if(a=Math.round(a/50),a===0)return 30;var i=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(e/255));return a===2&&(i+=60),i};mt.hsv.ansi16=function(t){return mt.rgb.ansi16(mt.hsv.rgb(t),t[2])};mt.rgb.ansi256=function(t){var e=t[0],r=t[1],n=t[2];if(e===r&&r===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var a=16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5);return a};mt.ansi16.rgb=function(t){var e=t%10;if(e===0||e===7)return t>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var r=(~~(t>50)+1)*.5,n=(e&1)*r*255,a=(e>>1&1)*r*255,i=(e>>2&1)*r*255;return[n,a,i]};mt.ansi256.rgb=function(t){if(t>=232){var e=(t-232)*10+8;return[e,e,e]}t-=16;var r,n=Math.floor(t/36)/5*255,a=Math.floor((r=t%36)/6)/5*255,i=r%6/5*255;return[n,a,i]};mt.rgb.hex=function(t){var e=((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255),r=e.toString(16).toUpperCase();return"000000".substring(r.length)+r};mt.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var r=e[0];e[0].length===3&&(r=r.split("").map(function(s){return s+s}).join(""));var n=parseInt(r,16),a=n>>16&255,i=n>>8&255,o=n&255;return[a,i,o]};mt.rgb.hcg=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,a=Math.max(Math.max(e,r),n),i=Math.min(Math.min(e,r),n),o=a-i,s,u;return o<1?s=i/(1-o):s=0,o<=0?u=0:a===e?u=(r-n)/o%6:a===r?u=2+(n-e)/o:u=4+(e-r)/o+4,u/=6,u%=1,[u*360,o*100,s*100]};mt.hsl.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1,a=0;return r<.5?n=2*e*r:n=2*e*(1-r),n<1&&(a=(r-.5*n)/(1-n)),[t[0],n*100,a*100]};mt.hsv.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=e*r,a=0;return n<1&&(a=(r-n)/(1-n)),[t[0],n*100,a*100]};mt.hcg.rgb=function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100;if(r===0)return[n*255,n*255,n*255];var a=[0,0,0],i=e%1*6,o=i%1,s=1-o,u=0;switch(Math.floor(i)){case 0:a[0]=1,a[1]=o,a[2]=0;break;case 1:a[0]=s,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=o;break;case 3:a[0]=0,a[1]=s,a[2]=1;break;case 4:a[0]=o,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=s}return u=(1-r)*n,[(r*a[0]+u)*255,(r*a[1]+u)*255,(r*a[2]+u)*255]};mt.hcg.hsv=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e),a=0;return n>0&&(a=e/n),[t[0],a*100,n*100]};mt.hcg.hsl=function(t){var e=t[1]/100,r=t[2]/100,n=r*(1-e)+.5*e,a=0;return n>0&&n<.5?a=e/(2*n):n>=.5&&n<1&&(a=e/(2*(1-n))),[t[0],a*100,n*100]};mt.hcg.hwb=function(t){var e=t[1]/100,r=t[2]/100,n=e+r*(1-e);return[t[0],(n-e)*100,(1-n)*100]};mt.hwb.hcg=function(t){var e=t[1]/100,r=t[2]/100,n=1-r,a=n-e,i=0;return a<1&&(i=(n-a)/(1-a)),[t[0],a*100,i*100]};mt.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};mt.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};mt.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};mt.gray.hsl=mt.gray.hsv=function(t){return[0,0,t[0]]};mt.gray.hwb=function(t){return[0,100,t[0]]};mt.gray.cmyk=function(t){return[0,0,0,t[0]]};mt.gray.lab=function(t){return[t[0],0,0]};mt.gray.hex=function(t){var e=Math.round(t[0]/100*255)&255,r=(e<<16)+(e<<8)+e,n=r.toString(16).toUpperCase();return"000000".substring(n.length)+n};mt.rgb.gray=function(t){var e=(t[0]+t[1]+t[2])/3;return[e/255*100]};var HT=YT.exports,$h=HT;function A7(){for(var t={},e=Object.keys($h),r=e.length,n=0;n1&&(r=Array.prototype.slice.call(arguments)),t(r))};return"conversion"in t&&(e.conversion=t.conversion),e}function D7(t){var e=function(r){if(r==null)return r;arguments.length>1&&(r=Array.prototype.slice.call(arguments));var n=t(r);if(typeof n=="object")for(var a=n.length,i=0;i>16&255,t>>8&255,t&255],this.valpha=1;else{this.valpha=1;var o=Object.keys(t);"alpha"in t&&(o.splice(o.indexOf("alpha"),1),this.valpha=typeof t.alpha=="number"?t.alpha:0);var s=o.sort().join("");if(!(s in dg))throw new Error("Unable to parse color from object: "+JSON.stringify(t));this.model=dg[s];var u=zn[this.model].labels,f=[];for(r=0;rr?(e+.05)/(r+.05):(r+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var t=this.rgb().color,e=(t[0]*299+t[1]*587+t[2]*114)/1e3;return e<128},isLight:function(){return!this.isDark()},negate:function(){for(var t=this.rgb(),e=0;e<3;e++)t.color[e]=255-t.color[e];return t},lighten:function(t){var e=this.hsl();return e.color[2]+=e.color[2]*t,e},darken:function(t){var e=this.hsl();return e.color[2]-=e.color[2]*t,e},saturate:function(t){var e=this.hsl();return e.color[1]+=e.color[1]*t,e},desaturate:function(t){var e=this.hsl();return e.color[1]-=e.color[1]*t,e},whiten:function(t){var e=this.hwb();return e.color[1]+=e.color[1]*t,e},blacken:function(t){var e=this.hwb();return e.color[2]+=e.color[2]*t,e},grayscale:function(){var t=this.rgb().color,e=t[0]*.3+t[1]*.59+t[2]*.11;return pn.rgb(e,e,e)},fade:function(t){return this.alpha(this.valpha-this.valpha*t)},opaquer:function(t){return this.alpha(this.valpha+this.valpha*t)},rotate:function(t){var e=this.hsl(),r=e.color[0];return r=(r+t)%360,r=r<0?360+r:r,e.color[0]=r,e},mix:function(t,e){if(!t||!t.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof t);var r=t.rgb(),n=this.rgb(),a=e===void 0?.5:e,i=2*a-1,o=r.alpha()-n.alpha(),s=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,u=1-s;return pn.rgb(s*r.red()+u*n.red(),s*r.green()+u*n.green(),s*r.blue()+u*n.blue(),r.alpha()*a+n.alpha()*(1-a))}};Object.keys(zn).forEach(function(t){if(ZT.indexOf(t)===-1){var e=zn[t].channels;pn.prototype[t]=function(){if(this.model===t)return new pn(this);if(arguments.length)return new pn(arguments,t);var r=typeof arguments[e]=="number"?e:this.valpha;return new pn(B7(zn[this.model][t].raw(this.color)).concat(r),t)},pn[t]=function(r){return typeof r=="number"&&(r=vg(Qy.call(arguments),e)),new pn(r,t)}}});function R7(t,e){return Number(t.toFixed(e))}function F7(t){return function(e){return R7(e,t)}}function Lr(t,e,r){return t=Array.isArray(t)?t:[t],t.forEach(function(n){(Xh[n]||(Xh[n]=[]))[e]=r}),t=t[0],function(n){var a;return arguments.length?(r&&(n=r(n)),a=this[t](),a.color[e]=n,a):(a=this[t]().color[e],r&&(a=r(a)),a)}}function qr(t){return function(e){return Math.max(0,Math.min(t,e))}}function B7(t){return Array.isArray(t)?t:[t]}function vg(t,e){for(var r=0;r=0,i=!r&&a&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return i?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return wt(this.toString())},_applyModification:function(e,r){var n=e.apply(null,[this].concat([].slice.call(r)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(Z7,arguments)},brighten:function(){return this._applyModification(K7,arguments)},darken:function(){return this._applyModification(Q7,arguments)},desaturate:function(){return this._applyModification(Y7,arguments)},saturate:function(){return this._applyModification(q7,arguments)},greyscale:function(){return this._applyModification(H7,arguments)},spin:function(){return this._applyModification(J7,arguments)},_applyCombination:function(e,r){return e.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(rX,arguments)},complement:function(){return this._applyCombination(eX,arguments)},monochromatic:function(){return this._applyCombination(nX,arguments)},splitcomplement:function(){return this._applyCombination(tX,arguments)},triad:function(){return this._applyCombination(mE,[3])},tetrad:function(){return this._applyCombination(mE,[4])}};wt.fromRatio=function(t,e){if(Wh(t)=="object"){var r={};for(var n in t)t.hasOwnProperty(n)&&(n==="a"?r[n]=t[n]:r[n]=vf(t[n]));t=r}return wt(t,e)};function U7(t){var e={r:0,g:0,b:0},r=1,n=null,a=null,i=null,o=!1,s=!1;return typeof t=="string"&&(t=uX(t)),Wh(t)=="object"&&(oi(t.r)&&oi(t.g)&&oi(t.b)?(e=$7(t.r,t.g,t.b),o=!0,s=String(t.r).substr(-1)==="%"?"prgb":"rgb"):oi(t.h)&&oi(t.s)&&oi(t.v)?(n=vf(t.s),a=vf(t.v),e=W7(t.h,n,a),o=!0,s="hsv"):oi(t.h)&&oi(t.s)&&oi(t.l)&&(n=vf(t.s),i=vf(t.l),e=X7(t.h,n,i),o=!0,s="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=KT(r),{ok:o,format:t.format||s,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:r}}function $7(t,e,r){return{r:Er(t,255)*255,g:Er(e,255)*255,b:Er(r,255)*255}}function vE(t,e,r){t=Er(t,255),e=Er(e,255),r=Er(r,255);var n=Math.max(t,e,r),a=Math.min(t,e,r),i,o,s=(n+a)/2;if(n==a)i=o=0;else{var u=n-a;switch(o=s>.5?u/(2-n-a):u/(n+a),n){case t:i=(e-r)/u+(e1&&(c-=1),c<1/6?f+(l-f)*6*c:c<1/2?l:c<2/3?f+(l-f)*(2/3-c)*6:f}if(e===0)n=a=i=r;else{var s=r<.5?r*(1+e):r+e-r*e,u=2*r-s;n=o(u,s,t+1/3),a=o(u,s,t),i=o(u,s,t-1/3)}return{r:n*255,g:a*255,b:i*255}}function pE(t,e,r){t=Er(t,255),e=Er(e,255),r=Er(r,255);var n=Math.max(t,e,r),a=Math.min(t,e,r),i,o,s=n,u=n-a;if(o=n===0?0:u/n,n==a)i=0;else{switch(n){case t:i=(e-r)/u+(e>1)+720)%360;--e;)n.h=(n.h+a)%360,i.push(wt(n));return i}function nX(t,e){e=e||6;for(var r=wt(t).toHsv(),n=r.h,a=r.s,i=r.v,o=[],s=1/e;e--;)o.push(wt({h:n,s:a,v:i})),i=(i+s)%1;return o}wt.mix=function(t,e,r){r=r===0?0:r||50;var n=wt(t).toRgb(),a=wt(e).toRgb(),i=r/100,o={r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a};return wt(o)};wt.readability=function(t,e){var r=wt(t),n=wt(e);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)};wt.isReadable=function(t,e,r){var n=wt.readability(t,e),a,i;switch(i=!1,a=fX(r),a.level+a.size){case"AAsmall":case"AAAlarge":i=n>=4.5;break;case"AAlarge":i=n>=3;break;case"AAAsmall":i=n>=7;break}return i};wt.mostReadable=function(t,e,r){var n=null,a=0,i,o,s,u;r=r||{},o=r.includeFallbackColors,s=r.level,u=r.size;for(var f=0;fa&&(a=i,n=wt(e[f]));return wt.isReadable(t,n,{level:s,size:u})||!o?n:(r.includeFallbackColors=!1,wt.mostReadable(t,["#fff","#000"],r))};var pg=wt.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},aX=wt.hexNames=iX(pg);function iX(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function KT(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Er(t,e){oX(t)&&(t="100%");var r=sX(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function Fd(t){return Math.min(1,Math.max(0,t))}function Fn(t){return parseInt(t,16)}function oX(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function sX(t){return typeof t=="string"&&t.indexOf("%")!=-1}function ma(t){return t.length==1?"0"+t:""+t}function vf(t){return t<=1&&(t=t*100+"%"),t}function QT(t){return Math.round(parseFloat(t)*255).toString(16)}function bE(t){return Fn(t)/255}var ha=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",a="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+a),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function oi(t){return!!ha.CSS_UNIT.exec(t)}function uX(t){t=t.replace(z7,"").replace(j7,"").toLowerCase();var e=!1;if(pg[t])t=pg[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=ha.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=ha.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=ha.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=ha.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=ha.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=ha.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=ha.hex8.exec(t))?{r:Fn(r[1]),g:Fn(r[2]),b:Fn(r[3]),a:bE(r[4]),format:e?"name":"hex8"}:(r=ha.hex6.exec(t))?{r:Fn(r[1]),g:Fn(r[2]),b:Fn(r[3]),format:e?"name":"hex"}:(r=ha.hex4.exec(t))?{r:Fn(r[1]+""+r[1]),g:Fn(r[2]+""+r[2]),b:Fn(r[3]+""+r[3]),a:bE(r[4]+""+r[4]),format:e?"name":"hex8"}:(r=ha.hex3.exec(t))?{r:Fn(r[1]+""+r[1]),g:Fn(r[2]+""+r[2]),b:Fn(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function fX(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:e,size:r}}var Nc=2,wE=.16,lX=.05,cX=.05,hX=.15,JT=5,eI=4,dX=[{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 xE(t,e,r){var n;return Math.round(t.h)>=60&&Math.round(t.h)<=240?n=r?Math.round(t.h)-Nc*e:Math.round(t.h)+Nc*e:n=r?Math.round(t.h)+Nc*e:Math.round(t.h)-Nc*e,n<0?n+=360:n>=360&&(n-=360),n}function EE(t,e,r){if(t.h===0&&t.s===0)return t.s;var n;return r?n=t.s-wE*e:e===eI?n=t.s+wE:n=t.s+lX*e,n>1&&(n=1),r&&e===JT&&n>.1&&(n=.1),n<.06&&(n=.06),Number(n.toFixed(2))}function _E(t,e,r){var n;return r?n=t.v+cX*e:n=t.v-hX*e,n>1&&(n=1),Number(n.toFixed(2))}function Vh(t){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=[],n=wt(t),a=JT;a>0;a-=1){var i=n.toHsv(),o=wt({h:xE(i,a,!0),s:EE(i,a,!0),v:_E(i,a,!0)}).toHexString();r.push(o)}r.push(n.toHexString());for(var s=1;s<=eI;s+=1){var u=n.toHsv(),f=wt({h:xE(u,s),s:EE(u,s),v:_E(u,s)}).toHexString();r.push(f)}return e.theme==="dark"?dX.map(function(l){var c=l.index,h=l.opacity,d=wt.mix(e.backgroundColor||"#141414",r[c],h*100).toHexString();return d}):r}var Op={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"},Lp={},Dp={};Object.keys(Op).forEach(function(t){Lp[t]=Vh(Op[t]),Lp[t].primary=Lp[t][5],Dp[t]=Vh(Op[t],{theme:"dark",backgroundColor:"#141414"}),Dp[t].primary=Dp[t][5]});var Zr=function(e,r,n){var a=Sf(e),i=Sf(r);return Sf([(1-n)*a.red()+n*i.red(),(1-n)*a.green()+n*i.green(),(1-n)*a.blue()+n*i.blue()]).rgb()},vX=function(e,r,n){r===void 0&&(r="#fff");var a=Zr(r,e,.05).rgb().toString(),i=Zr(r,e,.1).rgb().toString(),o=Zr(r,e,.2).rgb().toString(),s=Zr(r,e,.4).rgb().toString(),u=Zr(r,n,.02).rgb().toString(),f=Zr(r,n,.05).rgb().toString(),l=Zr(r,n,.1).rgb().toString(),c=Zr(r,n,.2).rgb().toString(),h=Zr(r,n,.3).rgb().toString(),d=Vh(e,{theme:"default",backgroundColor:r}),v=Sf(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:e,mainFill:i,activeStroke:e,activeFill:a,inactiveStroke:s,inactiveFill:a,selectedStroke:e,selectedFill:r,highlightStroke:g,highlightFill:o,disableStroke:h,disableFill:f,edgeMainStroke:h,edgeActiveStroke:e,edgeInactiveStroke:c,edgeSelectedStroke:e,edgeHighlightStroke:e,edgeDisableStroke:l,comboMainStroke:h,comboMainFill:u,comboActiveStroke:e,comboActiveFill:a,comboInactiveStroke:h,comboInactiveFill:u,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:c,comboDisableFill:f}},pX=function(e,r,n){r===void 0&&(r="#fff");var a=Zr(r,e,.2).rgb().toString(),i=Zr(r,e,.3).rgb().toString(),o=Zr(r,e,.6).rgb().toString(),s=Zr(r,e,.8).rgb().toString(),u=Zr(r,n,.2).rgb().toString(),f=Zr(r,n,.25).rgb().toString(),l=Zr(r,n,.3).rgb().toString(),c=Zr(r,n,.4).rgb().toString(),h=Zr(r,n,.5).rgb().toString(),d=Vh(e,{theme:"dark",backgroundColor:r}),v=Sf(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:s,mainFill:a,activeStroke:e,activeFill:i,inactiveStroke:s,inactiveFill:a,selectedStroke:e,selectedFill:a,highlightStroke:e,highlightFill:o,disableStroke:h,disableFill:f,edgeMainStroke:n,edgeActiveStroke:e,edgeInactiveStroke:n,edgeSelectedStroke:e,edgeHighlightStroke:e,edgeDisableStroke:l,comboMainStroke:c,comboMainFill:f,comboActiveStroke:e,comboActiveFill:u,comboInactiveStroke:c,comboInactiveFill:f,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:f,comboDisableStroke:c,comboDisableFill:u}},Jy=function(e,r,n,a){return r===void 0&&(r="#fff"),n===void 0&&(n="default"),n==="default"?vX(e,r,"rgb(150, 150, 150)"):pX(e,r,"#777")},gX=function(e,r,n,a){r===void 0&&(r="#fff"),n===void 0&&(n="default");var i=[];return e.forEach(function(o){i.push(Jy(o,r,n))}),i};const yX=Object.freeze(Object.defineProperty({__proto__:null,getColorSetsBySubjectColors:gX,getColorsWithSubjectColor:Jy,mixColor:Zr},Symbol.toStringTag,{value:"Module"}));var mX="rgb(95, 149, 255)",bX="rgb(255, 255, 255)",Ht=Jy(mX,bX);const Mf={defaultNode:{style:{stroke:Ht.mainStroke,fill:Ht.mainFill},color:Ht.mainStroke,linkPoints:{fill:Ht.activeFill,stroke:Ht.activeStroke}},nodeStateStyles:{active:{fill:Ht.activeFill,stroke:Ht.activeStroke,shadowColor:Ht.mainStroke},selected:{fill:Ht.selectedFill,stroke:Ht.selectedStroke,shadowColor:Ht.selectedStroke},highlight:{fill:Ht.highlightFill,stroke:Ht.highlightStroke},inactive:{fill:Ht.inactiveFill,stroke:Ht.inactiveStroke},disable:{fill:Ht.disableFill,stroke:Ht.disableStroke}},defaultEdge:{style:{stroke:Ht.edgeMainStroke},color:Ht.edgeMainStroke},edgeStateStyles:{active:{stroke:Ht.edgeActiveStroke},selected:{stroke:Ht.edgeSelectedStroke,shadowColor:Ht.edgeSelectedStroke},highlight:{stroke:Ht.edgeHighlightStroke},inactive:{stroke:Ht.edgeInactiveStroke},disable:{stroke:Ht.edgeDisableStroke}},defaultCombo:{style:{fill:Ht.comboMainFill,stroke:Ht.comboMainStroke},color:Ht.comboMainStroke},comboStateStyles:{active:{stroke:Ht.comboActiveStroke,fill:Ht.comboActiveFill},selected:{stroke:Ht.comboSelectedStroke,fill:Ht.comboSelectedFill,shadowColor:Ht.comboSelectedStroke},highlight:{stroke:Ht.comboHighlightStroke,fill:Ht.comboHighlightFill},inactive:{stroke:Ht.comboInactiveStroke,fill:Ht.comboInactiveFill},disable:{stroke:Ht.comboDisableStroke,fill:Ht.comboDisableFill}},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"};var wX=function(e){var r=e.clone();return tI(e,r),r},tI=function(e,r){var n;e.isGroup()&&r.isGroup()&&((n=e.get("children"))===null||n===void 0||n.forEach(function(s,u){var f=r.get("children")[u];tI(s,f)}));var a=e.get("type"),i=r.get("type");if(!(a!=="image"||i!=="image")){var o=e.get("clipShape");o&&r.setClip({type:o.get("type"),attrs:o.attr()})}},xX=Za.cloneEvent,EX=Za.isViewportChanged,_X=function(t){jt(e,t);function e(r){var n=t.call(this,r)||this;return n.extendEvents=[],n.dragging=!1,n.mousedown=!1,n.preItem=null,n.destroy(),n.graph=r,n.destroyed=!1,n.initEvents(),n}return e.prototype.initEvents=function(){var r=this,n=r.graph,a=r.extendEvents,i=a===void 0?[]:a,o=n.get("canvas"),s=o.get("el"),u=Bs(this,"onCanvasEvents"),f=Bs(this,"onExtendEvents"),l=Bs(this,"onWheelEvent");o.off("*").on("*",u),this.canvasHandler=u,i.push(Ic(s,"wheel",l)),typeof window<"u"&&(i.push(Ic(window,"keydown",f)),i.push(Ic(window,"keyup",f)),i.push(Ic(window,"focus",f))),this.resetHandler&&n.off("afterchangedata",this.resetHandler),this.resetHandler=Bs(this,"resetStatus"),n.on("afterchangedata",this.resetHandler)},e.getItemRoot=function(r){for(;r&&!r.get("item");)r=r.get("parent");return r},e.prototype.onCanvasEvents=function(r){var n=this,a=this.graph,i=a.get("canvas"),o=r.target,s=r.type;switch(s){case"drag":this.onCanvasEvents(Object.assign({},r,{type:"mousemove"}));break;case"dragend":this.onCanvasEvents(Object.assign({},r,{type:"mouseup"}));break;case"mousedown":this.mousedown=!0;break;case"mouseup":setTimeout(function(){return n.mousedown=!1});break;case"click":if(!this.mousedown)return;break}r.canvasX=r.x,r.canvasY=r.y;var u={x:r.canvasX,y:r.canvasY},f=a.get("group"),l=f.getMatrix();if(l||(l=[1,0,0,0,1,0,0,0,1]),EX(l)&&(u=a.getPointByClient(r.clientX,r.clientY)),r.x=u.x,r.y=u.y,r.currentTarget=a,o===i){(s==="mousemove"||s==="mouseleave")&&this.handleMouseMove(r,"canvas"),r.target=i,r.item=null,a.emit(s,r),a.emit("canvas:".concat(s),r);return}var c=e.getItemRoot(o);if(!c){a.emit(s,r);return}var h=c.get("item");if(!h.destroyed){var d=h.getType();if(r.target=o,r.item=h,r.canvasX===r.x&&r.canvasY===r.y){var v=a.getCanvasByPoint(r.x,r.y);r.canvasX=v.x,r.canvasY=v.y}r.name&&!r.name.includes(":")?(a.emit("".concat(d,":").concat(s),r),a.emit(s,r)):r.name&&a.emit(r.name,r),s==="dragstart"&&(this.dragging=!0),s==="dragend"&&(this.dragging=!1),s==="mousemove"&&this.handleMouseMove(r,d)}},e.prototype.onExtendEvents=function(r){this.graph.emit(r.type,r)},e.prototype.onWheelEvent=function(r){Zt(r.wheelDelta)&&(r.wheelDelta=-r.detail),this.graph.emit("wheel",r)},e.prototype.handleMouseMove=function(r,n){var a=this,i=a.graph,o=a.preItem,s=i.get("canvas"),u=r.target===s?null:r.item;r=xX(r),o&&o!==u&&!o.destroyed&&(r.item=o,this.emitCustomEvent(o.getType(),"mouseleave",r),this.dragging&&this.emitCustomEvent(o.getType(),"dragleave",r)),u&&o!==u&&(r.item=u,this.emitCustomEvent(n,"mouseenter",r),this.dragging&&this.emitCustomEvent(n,"dragenter",r)),this.preItem=u},e.prototype.emitCustomEvent=function(r,n,a){a.type=n,this.graph.emit("".concat(r,":").concat(n),a)},e.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},e.prototype.destroy=function(){var r=this,n=r.graph,a=r.canvasHandler,i=r.extendEvents,o=n.get("canvas");o.off("*",a),_e(i,function(s){s.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},e}(F8),Kt={},gi={},Rr={};Object.defineProperty(Rr,"__esModule",{value:!0});Rr.Base=void 0;var SX=function(){function t(){this.nodes=[],this.edges=[],this.combos=[],this.comboEdges=[],this.hiddenNodes=[],this.hiddenEdges=[],this.hiddenCombos=[],this.vedges=[],this.positions=[],this.destroyed=!1,this.onLayoutEnd=function(){}}return t.prototype.layout=function(e){return this.init(e),this.execute(!0)},t.prototype.init=function(e){this.nodes=e.nodes||[],this.edges=e.edges||[],this.combos=e.combos||[],this.comboEdges=e.comboEdges||[],this.hiddenNodes=e.hiddenNodes||[],this.hiddenEdges=e.hiddenEdges||[],this.hiddenCombos=e.hiddenCombos||[],this.vedges=e.vedges||[]},t.prototype.execute=function(e){},t.prototype.executeWithWorker=function(){},t.prototype.getDefaultCfg=function(){return{}},t.prototype.updateCfg=function(e){e&&Object.assign(this,e)},t.prototype.getType=function(){return"base"},t.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},t}();Rr.Base=SX;var Pp={},nu={};Object.defineProperty(nu,"__esModule",{value:!0});nu.camelize=nu.isString=void 0;var MX=function(t){return typeof t=="string"};nu.isString=MX;var AX=function(t){var e=Object.create(null);return function(r){var n=e[r];return n||(e[r]=t(r))}},CX=/-(\w)/g;nu.camelize=AX(function(t){return t.replace(CX,function(e,r){return r?r.toUpperCase():""})});var ol={};Object.defineProperty(ol,"__esModule",{value:!0});ol.isArray=void 0;ol.isArray=Array.isArray;var Bd={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.toNumber=t.isNaN=t.isNumber=void 0;var e=function(a){return typeof a=="number"};t.isNumber=e;var r=function(a){return Number.isNaN(Number(a))};t.isNaN=r;var n=function(a){var i=parseFloat(a);return(0,t.isNaN)(i)?a:i};t.toNumber=n})(Bd);var Gd={},em={};(function(t){var e=me&&me.__assign||function(){return e=Object.assign||function(a){for(var i,o=1,s=arguments.length;ob[x][_]+b[_][E]&&(b[x][E]=b[x][_]+b[_][E]);return b};t.floydWarshall=s;var u=function(m,b){var w=m.nodes,x=m.edges,E=[],_={};if(!w)throw new Error("invalid nodes data!");return w&&w.forEach(function(S,A){_[S.id]=A;var M=[];E.push(M)}),x==null||x.forEach(function(S){var A=(0,t.getEdgeTerminal)(S,"source"),M=(0,t.getEdgeTerminal)(S,"target"),C=_[A],I=_[M];C===void 0||I===void 0||(E[C][I]=1,b||(E[I][C]=1))}),E};t.getAdjMatrix=u;var f=function(m,b){var w=[];return m.forEach(function(x){var E=[];x.forEach(function(_){E.push(_*b)}),w.push(E)}),w};t.scaleMatrix=f;var l=function(m,b){if(m&&m.children){for(var w=m.children.length-1;w>=0;w--)if(!l(m.children[w],b))return}return!!b(m)},c=function(m,b){typeof b=="function"&&l(m,b)};t.traverseTreeUp=c;var h=function(m){var b=1/0,w=1/0,x=-1/0,E=-1/0;return m.forEach(function(_){var S=_.size;(0,e.isArray)(S)?S.length===1&&(S=[S[0],S[0]]):(0,r.isNumber)(S)?S=[S,S]:(S===void 0||isNaN(S))&&(S=[30,30]);var A=[S[0]/2,S[1]/2],M=_.x-A[0],C=_.x+A[0],I=_.y-A[1],k=_.y+A[1];b>M&&(b=M),w>I&&(w=I),xf.size[1]?f.size[0]:f.size[1]:(0,e.isObject)(f.size)?f.size.width>f.size.height?f.size.width:f.size.height:f.size:o}:(0,t.isFunction)(s)?s:(0,r.isNumber)(s)?function(){return s}:(0,e.isArray)(s)?function(){if(u){var f=Math.max.apply(Math,s);return isNaN(f)?o:f}return s}:(0,e.isObject)(s)?function(){if(u){var f=Math.max(s.width,s.height);return isNaN(f)?o:f}return[s.width,s.height]}:function(){return o}};t.getFuncByUnknownType=i}(Rp)),Rp}var ME;function Ir(){return ME||(ME=1,function(t){var e=me&&me.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(a,i);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,s)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=me&&me.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&e(a,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(nu,t),r(ol,t),r(Bd,t),r(Gd,t),r(em,t),r(TX(),t)}(Pp)),Pp}var IX=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(gi,"__esModule",{value:!0});gi.getLayoutByName=gi.unRegisterLayout=gi.registerLayout=void 0;var kX=Rr,NX=Ir(),Ui=new Map,OX=function(t,e){if(Ui.get(t)&&console.warn("The layout with the name ".concat(t," exists already, it will be overridden")),(0,NX.isObject)(e)){var r=function(n){IX(a,n);function a(i){var o=this,s;o=n.call(this)||this;var u=o,f={},l=Object.assign({},u.getDefaultCfg(),((s=e.getDefaultCfg)===null||s===void 0?void 0:s.call(e))||{});return Object.assign(f,l,e,i),Object.keys(f).forEach(function(c){var h=f[c];u[c]=h}),o}return a}(kX.Base);Ui.set(t,r)}else Ui.set(t,e);return Ui.get(t)};gi.registerLayout=OX;var LX=function(t){Ui.has(t)&&Ui.delete(t)};gi.unRegisterLayout=LX;var DX=function(t){return Ui.has(t)?Ui.get(t):null};gi.getLayoutByName=DX;var Fp={},sl={},PX=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(sl,"__esModule",{value:!0});sl.GridLayout=void 0;var xs=Ir(),RX=Rr,FX=function(t){PX(e,t);function e(r){var n=t.call(this)||this;return n.begin=[0,0],n.preventOverlap=!0,n.preventOverlapPadding=10,n.condense=!1,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.row=0,n.col=0,n.cellWidth=0,n.cellHeight=0,n.cellUsed={},n.id2manPos={},n.onLayoutEnd=function(){},n.updateCfg(r),n}return e.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}},e.prototype.execute=function(){var r=this,n=r.nodes,a=r.edges,i=r.begin,o=n.length;if(o===0)return r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:a};if(o===1)return n[0].x=i[0],n[0].y=i[1],r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:a};var s=r.sortBy,u=r.width,f=r.height,l=r.condense,c=r.preventOverlapPadding,h=r.preventOverlap,d=r.nodeSpacing,v=r.nodeSize,p=[];n.forEach(function(I){p.push(I)});var g={};if(p.forEach(function(I,k){g[I.id]=k}),(s==="degree"||!(0,xs.isString)(s)||p[0][s]===void 0)&&(s="degree",(0,xs.isNaN)(n[0].degree))){var y=(0,xs.getDegree)(p.length,g,a);p.forEach(function(I,k){I.degree=y[k].all})}p.sort(function(I,k){return k[s]-I[s]}),!u&&typeof window<"u"&&(u=window.innerWidth),!f&&typeof window<"u"&&(f=window.innerHeight);var m=r.rows,b=r.cols!=null?r.cols:r.columns;if(r.cells=o,m!=null&&b!=null?(r.rows=m,r.cols=b):m!=null&&b==null?(r.rows=m,r.cols=Math.ceil(r.cells/r.rows)):m==null&&b!=null?(r.cols=b,r.rows=Math.ceil(r.cells/r.cols)):(r.splits=Math.sqrt(r.cells*r.height/r.width),r.rows=Math.round(r.splits),r.cols=Math.round(r.width/r.height*r.splits)),r.rows=Math.max(r.rows,1),r.cols=Math.max(r.cols,1),r.cols*r.rows>r.cells){var w=r.small(),x=r.large();(w-1)*x>=r.cells?r.small(w-1):(x-1)*w>=r.cells&&r.large(x-1)}else for(;r.cols*r.rows=r.cells?r.large(x+1):r.small(w+1)}if(r.cellWidth=u/r.cols,r.cellHeight=f/r.rows,l&&(r.cellWidth=0,r.cellHeight=0),h||d){var E=(0,xs.getFuncByUnknownType)(10,d),_=(0,xs.getFuncByUnknownType)(30,v,!1);p.forEach(function(I){(!I.x||!I.y)&&(I.x=0,I.y=0);var k=_(I)||30,O,B;(0,xs.isArray)(k)?(O=k[0],B=k[1]):(O=k,B=k);var L=E!==void 0?E(I):c,z=O+L,X=B+L;r.cellWidth=Math.max(r.cellWidth,z),r.cellHeight=Math.max(r.cellHeight,X)})}r.cellUsed={},r.row=0,r.col=0,r.id2manPos={};for(var S=0;S=n&&(r.col=0,r.row++)},e.prototype.getPos=function(r){var n=this,a=n.begin,i=n.cellWidth,o=n.cellHeight,s,u,f=n.id2manPos[r.id];if(f)s=f.col*i+i/2+a[0],u=f.row*o+o/2+a[1];else{for(;n.used(n.row,n.col);)n.moveToNextCell();s=n.col*i+i/2+a[0],u=n.row*o+o/2+a[1],n.use(n.row,n.col),n.moveToNextCell()}r.x=s,r.y=u},e.prototype.getType=function(){return"grid"},e}(RX.Base);sl.GridLayout=FX;var ul={},BX=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(ul,"__esModule",{value:!0});ul.RandomLayout=void 0;var GX=Rr,zX=function(t){BX(e,t);function e(r){var n=t.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(r),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},e.prototype.execute=function(){var r=this,n=r.nodes,a=.9,i=r.center;return!r.width&&typeof window<"u"&&(r.width=window.innerWidth),!r.height&&typeof window<"u"&&(r.height=window.innerHeight),n&&n.forEach(function(o){o.x=(Math.random()-.5)*a*r.width+i[0],o.y=(Math.random()-.5)*a*r.height+i[1]}),r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:this.edges}},e.prototype.getType=function(){return"random"},e}(GX.Base);ul.RandomLayout=zX;var fl={},jX=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(fl,"__esModule",{value:!0});fl.GForceLayout=void 0;var UX=Rr,yn=Ir(),Bp=function(t,e){var r;return t?(0,yn.isNumber)(t)?r=function(n){return t}:r=t:r=function(n){return e},r},$X=function(t){jX(e,t);function e(r){var n=t.call(this)||this;return n.maxIteration=500,n.workerEnabled=!1,n.edgeStrength=200,n.nodeStrength=1e3,n.coulombDisScale=.005,n.damping=.9,n.maxSpeed=1e3,n.minMovement=.5,n.interval=.02,n.factor=1,n.linkDistance=1,n.gravity=10,n.preventOverlap=!0,n.collideStrength=1,n.tick=function(){},n.nodes=[],n.edges=[],n.width=300,n.height=300,n.nodeMap={},n.nodeIdxMap={},n.animate=!0,n.updateCfg(r),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var r,n,a=this,i=a.nodes;if(a.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(a.timeInterval),!i||i.length===0){(r=a.onLayoutEnd)===null||r===void 0||r.call(a);return}!a.width&&typeof window<"u"&&(a.width=window.innerWidth),!a.height&&typeof window<"u"&&(a.height=window.innerHeight),a.center||(a.center=[a.width/2,a.height/2]);var o=a.center;if(i.length===1){i[0].x=o[0],i[0].y=o[1],(n=a.onLayoutEnd)===null||n===void 0||n.call(a);return}var s={},u={};i.forEach(function(v,p){(0,yn.isNumber)(v.x)||(v.x=Math.random()*a.width),(0,yn.isNumber)(v.y)||(v.y=Math.random()*a.height),s[v.id]=v,u[v.id]=p}),a.nodeMap=s,a.nodeIdxMap=u,a.linkDistance=Bp(a.linkDistance,1),a.nodeStrength=Bp(a.nodeStrength,1),a.edgeStrength=Bp(a.edgeStrength,1);var f=a.nodeSize,l;if(a.preventOverlap){var c=a.nodeSpacing,h;(0,yn.isNumber)(c)?h=function(){return c}:(0,yn.isFunction)(c)?h=c:h=function(){return 0},f?(0,yn.isArray)(f)?l=function(v){return Math.max(f[0],f[1])+h(v)}:l=function(v){return f+h(v)}:l=function(v){return v.size?(0,yn.isArray)(v.size)?Math.max(v.size[0],v.size[1])+h(v):(0,yn.isObject)(v.size)?Math.max(v.size.width,v.size.height)+h(v):v.size+h(v):10+h(v)}}a.nodeSize=l;var d=a.edges;a.degrees=(0,yn.getDegree)(i.length,a.nodeIdxMap,d),a.getMass||(a.getMass=function(v){var p=v.mass||a.degrees[a.nodeIdxMap[v.id]].all||1;return p}),a.run()},e.prototype.run=function(){var r,n=this,a=n.maxIteration,i=n.nodes,o=n.workerEnabled,s=n.minMovement,u=n.animate;if(i)if(o||!u){for(var f=0;f"u")return;var c=0;this.timeInterval=window.setInterval(function(){var h,d;if(i){var v=n.runOneStep(c)||[];n.reachMoveThreshold(i,v,s)&&((h=n.onLayoutEnd)===null||h===void 0||h.call(n),window.clearInterval(n.timeInterval)),c++,c>=a&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))}},0)}},e.prototype.reachMoveThreshold=function(r,n,a){var i=0;return r.forEach(function(o,s){var u=o.x-n[s].x,f=o.y-n[s].y;i+=Math.sqrt(u*u+f*f)}),i/=r.length,i=y)){var m=d.x-g.x,b=d.y-g.y;m===0&&b===0&&(m=Math.random()*.01,b=Math.random()*.01);var w=m*m+b*b,x=Math.sqrt(w),E=(x+.1)*s,_=m/x,S=b/x,A=(c(d)+c(g))*.5*o/(E*E),M=i?i(g):1;if(r[2*v]+=_*A,r[2*v+1]+=S*A,r[2*y]-=_*A,r[2*y+1]-=S*A,u&&(h(d)+h(g))/2>x){var C=l*(c(d)+c(g))*.5/w;r[2*v]+=_*C/p,r[2*v+1]+=S*C/p,r[2*y]-=_*C/M,r[2*y+1]-=S*C/M}}})})},e.prototype.calAttractive=function(r,n){var a=this,i=a.nodeMap,o=a.nodeIdxMap,s=a.linkDistance,u=a.edgeStrength,f=a.nodeSize,l=a.getMass;n.forEach(function(c,h){var d=(0,yn.getEdgeTerminal)(c,"source"),v=(0,yn.getEdgeTerminal)(c,"target"),p=i[d],g=i[v],y=g.x-p.x,m=g.y-p.y;y===0&&m===0&&(y=Math.random()*.01,m=Math.random()*.01);var b=Math.sqrt(y*y+m*m),w=y/b,x=m/b,E=s(c,p,g)||1+(f(p)+f(g)||0)/2,_=E-b,S=_*u(c),A=o[d],M=o[v],C=l?l(p):1,I=l?l(g):1;r[2*A]-=w*S/C,r[2*A+1]-=x*S/C,r[2*M]+=w*S/I,r[2*M+1]+=x*S/I})},e.prototype.calGravity=function(r,n){for(var a=this,i=a.center,o=a.gravity,s=a.degrees,u=n.length,f=0;fo.maxSpeed){var d=o.maxSpeed/h;l=d*l,c=d*c}n[2*f]=l,n[2*f+1]=c})},e.prototype.updatePosition=function(r,n,a){a.forEach(function(i,o){if((0,yn.isNumber)(i.fx)&&(0,yn.isNumber)(i.fy)){i.x=i.fx,i.y=i.fy;return}var s=r[2*o]*n,u=r[2*o+1]*n;i.x+=s,i.y+=u})},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var r=this;r.stop(),r.tick=null,r.nodes=null,r.edges=null,r.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(UX.Base);fl.GForceLayout=$X;var ll={},zd={};function XX(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return rI(this.cover(e,r),e,r,t)}function rI(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var a,i=t._root,o={data:n},s=t._x0,u=t._y0,f=t._x1,l=t._y1,c,h,d,v,p,g,y,m;if(!i)return t._root=o,t;for(;i.length;)if((p=e>=(c=(s+f)/2))?s=c:f=c,(g=r>=(h=(u+l)/2))?u=h:l=h,a=i,!(i=i[y=g<<1|p]))return a[y]=o,t;if(d=+t._x.call(null,i.data),v=+t._y.call(null,i.data),e===d&&r===v)return o.next=i,a?a[y]=o:t._root=o,t;do a=a?a[y]=new Array(4):t._root=new Array(4),(p=e>=(c=(s+f)/2))?s=c:f=c,(g=r>=(h=(u+l)/2))?u=h:l=h;while((y=g<<1|p)===(m=(v>=h)<<1|d>=c));return a[m]=i,a[y]=o,t}function WX(t){var e,r,n=t.length,a,i,o=new Array(n),s=new Array(n),u=1/0,f=1/0,l=-1/0,c=-1/0;for(r=0;rl&&(l=a),ic&&(c=i));if(u>l||f>c)return this;for(this.cover(u,f).cover(l,c),r=0;rt||t>=a||n>e||e>=i;)switch(f=(el||(s=v.y0)>c||(u=v.x1)=y)<<1|t>=g)&&(v=h[h.length-1],h[h.length-1]=h[h.length-1-p],h[h.length-1-p]=v)}else{var m=t-+this._x.call(null,d.data),b=e-+this._y.call(null,d.data),w=m*m+b*b;if(w=(h=(o+u)/2))?o=h:u=h,(p=c>=(d=(s+f)/2))?s=d:f=d,e=r,!(r=r[g=p<<1|v]))return this;if(!r.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(n=e,y=g)}for(;r.data!==t;)if(a=r,!(r=r.next))return this;return(i=r.next)&&delete r.next,a?(i?a.next=i:delete a.next,this):e?(i?e[g]=i:delete e[g],(r=e[0]||e[1]||e[2]||e[3])&&r===(e[3]||e[2]||e[1]||e[0])&&!r.length&&(n?n[y]=r:this._root=r),this):(this._root=i,this)}function KX(t){for(var e=0,r=t.length;e1&&(S=(0,Hr.getAvgNodePosition)(M))}else S=void 0;return{x:S==null?void 0:S.x,y:S==null?void 0:S.y}}}}if(a){c||(c=this.getSameTypeLeafMap());var d=Array.from(new Set(o.map(function(b,w){return b[i]}))).filter(function(b){return b!==void 0}),v={};d.forEach(function(b){var w=o.filter(function(x){return x[i]===b}).map(function(x){return s[x.id]});v[b]=(0,Hr.getAvgNodePosition)(w)}),l={single:function(b){return f(b)},leaf:function(b){return f(b)},others:function(b){return f(b)},center:function(b,w,x){var E=v[b[i]];return{x:E==null?void 0:E.x,y:E==null?void 0:E.y}}}}this.centripetalOptions=da(da({},this.centripetalOptions),l);var p=this.centripetalOptions,g=p.leaf,y=p.single,m=p.others;g&&typeof g!="function"&&(this.centripetalOptions.leaf=function(){return g}),y&&typeof y!="function"&&(this.centripetalOptions.single=function(){return y}),m&&typeof m!="function"&&(this.centripetalOptions.others=function(){return m})},e.prototype.updateCfg=function(r){r&&Object.assign(this,r)},e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var r=this;r.stop();var n=r.nodes,a=r.edges,i=r.defSpringLen;if(r.judgingDistance=0,!n||n.length===0){r.onLayoutEnd([]);return}!r.width&&typeof window<"u"&&(r.width=window.innerWidth),!r.height&&typeof window<"u"&&(r.height=window.innerHeight),r.center||(r.center=[r.width/2,r.height/2]);var o=r.center;if(n.length===1){n[0].x=o[0],n[0].y=o[1],r.onLayoutEnd([da({},n[0])]);return}r.degreesMap=(0,Hr.getDegreeMap)(n,a),r.propsGetMass?r.getMass=r.propsGetMass:r.getMass=function(d){var v=1;(0,Hr.isNumber)(d.mass)&&(v=d.mass);var p=r.degreesMap[d.id].all;return!p||p<5?v:p*5*v};var s=r.nodeSize,u;if(r.preventOverlap){var f=r.nodeSpacing,l;(0,Hr.isNumber)(f)?l=function(){return f}:(0,Hr.isFunction)(f)?l=f:l=function(){return 0},s?(0,Hr.isArray)(s)?u=function(d){return Math.max(s[0],s[1])+l(d)}:u=function(d){return s+l(d)}:u=function(d){return d.size?(0,Hr.isArray)(d.size)?Math.max(d.size[0],d.size[1])+l(d):(0,Hr.isObject)(d.size)?Math.max(d.size.width,d.size.height)+l(d):d.size+l(d):10+l(d)}}r.nodeSize=u,r.linkDistance=Gp(r.linkDistance,1),r.nodeStrength=Gp(r.nodeStrength,1),r.edgeStrength=Gp(r.edgeStrength,1);var c={},h={};n.forEach(function(d,v){(0,Hr.isNumber)(d.x)||(d.x=Math.random()*r.width),(0,Hr.isNumber)(d.y)||(d.y=Math.random()*r.height);var p=r.degreesMap[d.id];c[d.id]=da(da({},d),{data:da(da({},d.data),{size:r.nodeSize(d)||30,layout:{inDegree:p.in,outDegree:p.out,degree:p.all,tDegree:p.in,sDegree:p.out,force:{mass:r.getMass(d),nodeStrength:r.nodeStrength(d,a)}}})}),h[d.id]=v}),r.nodeMap=c,r.nodeIdxMap=h,r.edgeInfos=[],a==null||a.forEach(function(d){var v=c[d.source],p=c[d.target];!v||!p?elf.edgeInfos.push({}):r.edgeInfos.push({edgeStrength:r.edgeStrength(d),linkDistance:i?i(da(da({},d),{source:v,target:p}),v,p):r.linkDistance(d,v,p)||1+(s(v)+s(v)||0)/2})}),this.getCentripetalOptions(),r.onLayoutEnd=r.onLayoutEnd||function(){},r.run()},e.prototype.run=function(){var r=this,n=r.maxIteration,a=r.nodes,i=r.edges,o=r.workerEnabled,s=r.minMovement,u=r.animate,f=r.nodeMap,l=r.height;if(r.currentMinY=0,r.currentMaxY=l,!!a){var c=[];if(a.forEach(function(y,m){c[2*m]=0,c[2*m+1]=0}),this.defSideCoe&&typeof this.defSideCoe=="function"){var h={};i.forEach(function(y){var m=y.source,b=y.target;h[m]=h[m]||[],h[m].push(y),h[b]=h[b]||[],h[b].push(y)}),this.relatedEdges=h}var d=n,v=!u;if(o||v){for(var p=0;(r.judgingDistance>s||p<1)&&p"u")return;var g=0;this.timeInterval=window.setInterval(function(){a&&(r.runOneStep(g,c),g++,(g>=d||r.judgingDistanceu){var v=u/d;c=v*c,h=v*h}n[2*l]=c,n[2*l+1]=h})},e.prototype.updatePosition=function(r,n){var a=this,i=a.nodes,o=a.distanceThresholdMode,s=a.nodeMap;if(!(i!=null&&i.length)){this.judgingDistance=0;return}var u=0;o==="max"?a.judgingDistance=-1/0:o==="min"&&(a.judgingDistance=1/0);var f=1/0,l=-1/0;i.forEach(function(c,h){var d=s[c.id];if((0,Hr.isNumber)(c.fx)&&(0,Hr.isNumber)(c.fy)){c.x=c.fx,c.y=c.fy,d.x=c.x,d.y=c.y;return}var v=r[2*h]*n,p=r[2*h+1]*n;c.x+=v,c.y+=p,d.x=c.x,d.y=c.y,c.yl&&(l=c.y);var g=Math.sqrt(v*v+p*p);switch(o){case"max":a.judgingDistanceg&&(a.judgingDistance=g);break;default:u=u+g;break}}),this.currentMinY=f,this.currentMaxY=l,(!o||o==="mean")&&(a.judgingDistance=u/i.length)},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var r=this;r.stop(),r.tick=null,r.nodes=null,r.edges=null,r.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var r=this,n=r.nodeClusterBy,a=r.nodes,i=r.edges,o=r.nodeMap,s=r.degreesMap;if(a!=null&&a.length){var u={};return a.forEach(function(f,l){var c=s[f.id].all;c===1&&(u[f.id]=(0,Hr.getCoreNodeAndRelativeLeafNodes)("leaf",f,i,n,s,o))}),u}},e}(pW.Base);ll.Force2Layout=yW;var rm={},Ud={};function mW(t,e){var r,n=1;t==null&&(t=0),e==null&&(e=0);function a(){var i,o=r.length,s,u=0,f=0;for(i=0;ih.index){var C=d-S.x-S.vx,I=v-S.y-S.vy,k=C*C+I*I;kd+M||Ev+M||_f.r&&(f.r=f[l].r)}function u(){if(e){var f,l=e.length,c;for(r=new Array(l),f=0;f[e(x,E,o),x])),w;for(g=0,s=new Array(y);g{}};function nI(){for(var t=0,e=arguments.length,r={},n;t=0&&(n=r.slice(a+1),r=r.slice(0,a)),r&&!e.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}ch.prototype=nI.prototype={constructor:ch,on:function(t,e){var r=this._,n=MW(t+"",r),a,i=-1,o=n.length;if(arguments.length<2){for(;++i0)for(var r=new Array(a),n=0,a,i;n=0&&t._call.call(null,e),t=t._next;--au}function kE(){Wo=(qh=Xf.now())+$d,au=pf=0;try{TW()}finally{au=0,kW(),Wo=0}}function IW(){var t=Xf.now(),e=t-qh;e>aI&&($d-=e,qh=t)}function kW(){for(var t,e=Yh,r,n=1/0;e;)e._call?(n>e._time&&(n=e._time),t=e,e=e._next):(r=e._next,e._next=null,e=t?t._next=r:Yh=r);gf=t,yg(n)}function yg(t){if(!au){pf&&(pf=clearTimeout(pf));var e=t-Wo;e>24?(t<1/0&&(pf=setTimeout(kE,t-Xf.now()-$d)),Zu&&(Zu=clearInterval(Zu))):(Zu||(qh=Xf.now(),Zu=setInterval(IW,aI)),au=1,iI(kE))}}const NW=1664525,OW=1013904223,NE=4294967296;function LW(){let t=1;return()=>(t=(NW*t+OW)%NE)/NE}function DW(t){return t.x}function PW(t){return t.y}var RW=10,FW=Math.PI*(3-Math.sqrt(5));function BW(t){var e,r=1,n=.001,a=1-Math.pow(n,1/300),i=0,o=.6,s=new Map,u=sI(c),f=nI("tick","end"),l=LW();t==null&&(t=[]);function c(){h(),f.call("tick",e),r1?(g==null?s.delete(p):s.set(p,v(g)),e):s.get(p)},find:function(p,g,y){var m=0,b=t.length,w,x,E,_,S;for(y==null?y=1/0:y*=y,m=0;m1?(f.on(p,g),e):f.on(p)}}}function GW(){var t,e,r,n,a=Qr(-30),i,o=1,s=1/0,u=.81;function f(d){var v,p=t.length,g=jd(t,DW,PW).visitAfter(c);for(n=d,v=0;v=s)return;(d.data!==e||d.next)&&(y===0&&(y=$i(r),w+=y*y),m===0&&(m=$i(r),w+=m*m),w-1||(o[u]=i[u])}),o}),n.ticking=!1},e.prototype.execute=function(r){var n=this,a=n.nodes,i=n.edges;if(!n.ticking){var o=n.forceSimulation,s=n.alphaMin,u=n.alphaDecay,f=n.alpha;if(o){if(r){if(n.clustering&&n.clusterForce&&(n.clusterForce.nodes(a),n.clusterForce.links(i)),o.nodes(a),i&&n.edgeForce)n.edgeForce.links(i);else if(i&&!n.edgeForce){var h=_s.forceLink().id(function(g){return g.id}).links(i);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}}n.preventOverlap&&n.overlapProcess(o),o.alpha(f).restart(),this.ticking=!0}else try{var l=_s.forceManyBody();if(n.nodeStrength&&l.strength(n.nodeStrength),o=_s.forceSimulation().nodes(a),n.clustering){var c=(0,JW.default)();c.centerX(n.center[0]).centerY(n.center[1]).template("force").strength(n.clusterFociStrength),i&&c.links(i),a&&c.nodes(a),c.forceLinkDistance(n.clusterEdgeDistance).forceLinkStrength(n.clusterEdgeStrength).forceCharge(n.clusterNodeStrength).forceNodeSize(n.clusterNodeSize),n.clusterForce=c,o.force("group",c)}if(o.force("center",_s.forceCenter(n.center[0],n.center[1])).force("charge",l).alpha(f).alphaDecay(u).alphaMin(s),n.preventOverlap&&n.overlapProcess(o),i){var h=_s.forceLink().id(function(p){return p.id}).links(i);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}if(n.workerEnabled&&!aV()&&(n.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),!n.workerEnabled)o.on("tick",function(){n.tick()}).on("end",function(){n.ticking=!1,n.onLayoutEnd&&n.onLayoutEnd()}),n.ticking=!0;else{o.stop();for(var d=nV(o),v=1;v<=d;v++)o.tick(),postMessage({nodes:a,currentTick:v,totalTicks:d,type:tV.LAYOUT_MESSAGE.TICK},void 0);n.ticking=!1}n.forceSimulation=o,n.ticking=!0}catch(p){n.ticking=!1,console.warn(p)}}},e.prototype.overlapProcess=function(r){var n=this,a=n.nodeSize,i=n.nodeSpacing,o,s,u=n.collideStrength;if((0,Ao.isNumber)(i)?s=function(){return i}:(0,Ao.isFunction)(i)?s=i:s=function(){return 0},!a)o=function(h){if(h.size){if((0,Ao.isArray)(h.size)){var d=h.size[0]>h.size[1]?h.size[0]:h.size[1];return d/2+s(h)}if((0,Ao.isObject)(h.size)){var d=h.size.width>h.size.height?h.size.width:h.size.height;return d/2+s(h)}return h.size/2+s(h)}return 10+s(h)};else if((0,Ao.isFunction)(a))o=function(h){var d=a(h);return d+s(h)};else if((0,Ao.isArray)(a)){var f=a[0]>a[1]?a[0]:a[1],l=f/2;o=function(h){return l+s(h)}}else if((0,Ao.isNumber)(a)){var c=a/2;o=function(h){return c+s(h)}}else o=function(){return 10};r.force("collisionForce",_s.forceCollide(o).strength(u))},e.prototype.updateCfg=function(r){var n=this;n.ticking&&(n.forceSimulation.stop(),n.ticking=!1),n.forceSimulation=null,Object.assign(n,r)},e.prototype.destroy=function(){var r=this;r.ticking&&(r.forceSimulation.stop(),r.ticking=!1),r.nodes=null,r.edges=null,r.destroyed=!0},e}(eV.Base);Ud.ForceLayout=rV;function nV(t){var e=t.alphaMin(),r=t.alphaTarget(),n=t.alpha(),a=Math.log((e-r)/(n-r))/Math.log(1-t.alphaDecay()),i=Math.ceil(a);return i}function aV(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}(function(t){var e=me&&me.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(a,i);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,s)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=me&&me.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&e(a,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(Ud,t)})(rm);var cl={},iV=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(cl,"__esModule",{value:!0});cl.CircularLayout=void 0;var oV=Rr,$a=Ir();function sV(t,e,r,n){t.forEach(function(a,i){t[i].children=[],t[i].parent=[]}),n?e.forEach(function(a){var i=(0,$a.getEdgeTerminal)(a,"source"),o=(0,$a.getEdgeTerminal)(a,"target"),s=0;i&&(s=r[i]);var u=0;o&&(u=r[o]);var f=t[s].children,l=t[u].parent;f.push(t[u].id),l.push(t[s].id)}):e.forEach(function(a){var i=(0,$a.getEdgeTerminal)(a,"source"),o=(0,$a.getEdgeTerminal)(a,"target"),s=0;i&&(s=r[i]);var u=0;o&&(u=r[o]);var f=t[s].children,l=t[u].children;f.push(t[u].id),l.push(t[s].id)})}function uV(t,e,r){for(var n=r.length,a=0;an?1:0}var lV=function(t){iV(e,t);function e(r){var n=t.call(this)||this;return n.radius=null,n.nodeSize=void 0,n.startRadius=null,n.endRadius=null,n.startAngle=0,n.endAngle=2*Math.PI,n.clockwise=!0,n.divisions=1,n.ordering=null,n.angleRatio=1,n.nodes=[],n.edges=[],n.nodeMap={},n.degrees=[],n.width=300,n.height=300,n.updateCfg(r),n}return e.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},e.prototype.execute=function(){var r,n=this,a=n.nodes,i=n.edges,o=a.length;if(o===0){n.onLayoutEnd&&n.onLayoutEnd();return}!n.width&&typeof window<"u"&&(n.width=window.innerWidth),!n.height&&typeof window<"u"&&(n.height=window.innerHeight),n.center||(n.center=[n.width/2,n.height/2]);var s=n.center;if(o===1){a[0].x=s[0],a[0].y=s[1],n.onLayoutEnd&&n.onLayoutEnd();return}var u=n.radius,f=n.startRadius,l=n.endRadius,c=n.divisions,h=n.startAngle,d=n.endAngle,v=n.angleRatio,p=n.ordering,g=n.clockwise,y=n.nodeSpacing,m=n.nodeSize,b=(d-h)/o,w={};a.forEach(function(L,z){w[L.id]=z}),n.nodeMap=w;var x=(0,$a.getDegree)(a.length,w,i);if(n.degrees=x,y){var E=(0,$a.getFuncByUnknownType)(10,y),_=(0,$a.getFuncByUnknownType)(10,m),S=-1/0;a.forEach(function(L){var z=_(L);Sn.width?n.width/2:n.height/2:!f&&l?f=l:f&&!l&&(l=f);var M=b*v,C=[];p==="topology"?C=n.topologyOrdering():p==="topology-directed"?C=n.topologyOrdering(!0):p==="degree"?C=n.degreeOrdering():C=a;for(var I=Math.ceil(o/c),k=0;k0?t.set(e,r):t.delete(e))}function uI(t,e,r,n){var a=String(e),i=String(r);if(!t&&a>i){var o=a;a=i,i=o}return a+Xs.EDGE_KEY_DELIM+i+Xs.EDGE_KEY_DELIM+(n===void 0?Xs.DEFAULT_EDGE_NAME:n)}function PE(t,e,r,n){var a=String(e),i=String(r),o={v:e,w:r};if(!t&&a>i){var s=o.v;o.v=o.w,o.w=s}return n!==void 0&&(o.name=n),o}function zp(t,e){return uI(t,e.v,e.w,e.name)}function RE(t){return typeof t=="function"}var dV=function(e){return e.nodes().map(function(r){var n=e.node(r),a=e.parent(r),i={id:r,value:n,parent:a};return i.value===void 0&&delete i.value,i.parent===void 0&&delete i.parent,i})},vV=function(e){return e.edges().map(function(r){var n=e.edge(r),a={v:r.v,w:r.w,value:n,name:r.name};return a.name===void 0&&delete a.name,a.value===void 0&&delete a.value,a})},pV=function(e){var r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:dV(e),edges:vV(e),value:e.graph()};return r.value===void 0&&delete r.value,r},gV=function(e){var r=new Qo(e.options);return e.value!==void 0&&r.setGraph(e.value),e.nodes.forEach(function(n){r.setNode(n.id,n.value),n.parent&&r.setParent(n.id,n.parent)}),e.edges.forEach(function(n){r.setEdge(n.v,n.w,n.value,n.name)}),r};function FE(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function BE(t){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};mV(this,t),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=Xs.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 e.directed},this.isMultigraph=function(){return e.multigraph},this.isCompound=function(){return e.compound},this.setGraph=function(a){return e.label=a,e},this.graph=function(){return e.label},this.setDefaultNodeLabel=function(a){return RE(a)?e.defaultNodeLabelFn=a:e.defaultNodeLabelFn=function(){return a},e},this.nodeCount=function(){return e.nodeCountNum},this.node=function(a){return e.nodesLabelMap.get(a)},this.nodes=function(){return Array.from(e.nodesLabelMap.keys())},this.sources=function(){return e.nodes().filter(function(a){var i;return!(!((i=e.inEdgesMap.get(a))===null||i===void 0)&&i.size)})},this.sinks=function(){return e.nodes().filter(function(a){var i;return!(!((i=e.outEdgesMap.get(a))===null||i===void 0)&&i.size)})},this.setNodes=function(a,i){return a.map(function(o){return e.setNode(o,i)}),e},this.hasNode=function(a){return e.nodesLabelMap.has(a)},this.checkCompound=function(){if(!e.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(a){if(e.isCompound()){var i,o=(i=e.parentMap)===null||i===void 0?void 0:i.get(a);if(o!==e.GRAPH_NODE)return o}},this.removeFromParentsChildList=function(a){var i=e.parentMap.get(a);e.childrenMap.get(i).delete(a)},this.setParent=function(a,i){var o,s;e.checkCompound();for(var u=i===void 0?e.GRAPH_NODE:i,f=e.parent(u);f;){if(a===f)throw new Error("Setting "+i+" as parent of "+a+" would create a cycle");f=e.parent(f)}i&&e.setNode(i),e.setNode(a),e.removeFromParentsChildList(a),(o=e.parentMap)===null||o===void 0||o.set(a,u);var l=e.childrenMap.get(u);return l.set(a,!0),(s=e.childrenMap)===null||s===void 0||s.set(u,l),e},this.children=function(a){var i=a===void 0?e.GRAPH_NODE:a;if(e.isCompound()){var o,s=(o=e.childrenMap)===null||o===void 0?void 0:o.get(i);return s?Array.from(s.keys()):void 0}if(i===e.GRAPH_NODE)return e.nodes();if(a&&e.hasNode(a))return[]},this.predecessors=function(a){var i=e.predecessorsMap.get(a);return i?Array.from(i.keys()):void 0},this.successors=function(a){var i=e.successorsMap.get(a);return i?Array.from(i.keys()):void 0},this.neighbors=function(a){var i;if(e.hasNode(a))return Array.from(new Set((i=e.predecessors(a))===null||i===void 0?void 0:i.concat(e.successors(a))))},this.isLeaf=function(a){var i;if(e.isDirected()){var o;return!(!((o=e.successors(a))===null||o===void 0)&&o.length)}return!(!((i=e.neighbors(a))===null||i===void 0)&&i.length)},this.filterNodes=function(a){var i=e.directed,o=e.multigraph,s=e.compound,u=new t({directed:i,multigraph:o,compound:s});if(u.setGraph(e.graph()),e.nodes().forEach(function(l){a(l)&&u.setNode(l,e.node(l))}),e.edges().forEach(function(l){u.hasNode(l.v)&&u.hasNode(l.w)&&u.setEdgeObj(l,e.edge(l))}),s){var f=function(c){for(var h=e.parent(c);h!==void 0&&!u.hasNode(h);)h=e.parent(h);return h};u.nodes().forEach(function(l){u.setParent(l,f(l))})}return u},this.setDefaultEdgeLabel=function(a){return RE(a)?e.defaultEdgeLabelFn=a:e.defaultEdgeLabelFn=function(){return a},e},this.edgeCount=function(){return e.edgeCountNum},this.setEdgeObj=function(a,i){return e.setEdge(a.v,a.w,i,a.name)},this.setPath=function(a,i){return a.reduce(function(o,s){return e.setEdge(o,s,i),s}),e},this.edgeFromArgs=function(a,i,o){return e.edge({v:a,w:i,name:o})},this.edge=function(a){return e.edgesLabelsMap.get(zp(e.isDirected(),a))},this.hasEdge=function(a,i,o){return e.edgesLabelsMap.has(zp(e.isDirected(),{v:a,w:i,name:o}))},this.removeEdgeObj=function(a){var i=a.v,o=a.w,s=a.name;return e.removeEdge(i,o,s)},this.edges=function(){return Array.from(e.edgesMap.values())},this.inEdges=function(a,i){var o=e.inEdgesMap.get(a);if(o)return Array.from(o.values()).filter(function(s){return!i||s.v===i})},this.outEdges=function(a,i){var o=e.outEdgesMap.get(a);if(o)return Array.from(o.values()).filter(function(s){return!i||s.w===i})},this.nodeEdges=function(a,i){var o;if(e.hasNode(a))return(o=e.inEdges(a,i))===null||o===void 0?void 0:o.concat(e.outEdges(a,i))},this.toJSON=function(){return pV(e)},this.nodeInDegree=function(a){var i=e.inEdgesMap.get(a);return i?i.size:0},this.nodeOutDegree=function(a){var i=e.outEdgesMap.get(a);return i?i.size:0},this.nodeDegree=function(a){return e.nodeInDegree(a)+e.nodeOutDegree(a)},this.source=function(a){return a.v},this.target=function(a){return a.w};var n=BE(BE({},xV),r);this.compound=n.compound,this.directed=n.directed,this.multigraph=n.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return wV(t,[{key:"setNode",value:function(r,n){var a=this.nodesLabelMap,i=this.defaultNodeLabelFn,o=this.isCompound,s=this.parentMap,u=this.childrenMap,f=this.inEdgesMap,l=this.outEdgesMap,c=this.predecessorsMap,h=this.successorsMap;if(a.has(r))return n!==void 0&&a.set(r,n),this;if(a.set(r,n||i(r)),o()){var d;s==null||s.set(r,this.GRAPH_NODE),u==null||u.set(r,new Map),u!=null&&u.has(this.GRAPH_NODE)||u==null||u.set(this.GRAPH_NODE,new Map),u==null||(d=u.get(this.GRAPH_NODE))===null||d===void 0||d.set(r,!0)}return[f,l,c,h].forEach(function(v){return v.set(r,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(r){var n=this;if(this.hasNode(r)){var a=function(g){n.removeEdge(g.v,g.w,g.name)},i=this.inEdgesMap,o=this.outEdgesMap,s=this.predecessorsMap,u=this.successorsMap,f=this.nodesLabelMap;if(this.isCompound()){var l,c,h;this.removeFromParentsChildList(r),(l=this.parentMap)===null||l===void 0||l.delete(r),(c=this.children(r))===null||c===void 0||c.forEach(function(p){return n.setParent(p)}),(h=this.childrenMap)===null||h===void 0||h.delete(r)}var d=i.get(r),v=o.get(r);Array.from(d.values()).forEach(function(p){return a(p)}),Array.from(v.values()).forEach(function(p){return a(p)}),f.delete(r),i.delete(r),o.delete(r),s.delete(r),u.delete(r),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(r,n,a,i){var o,s,u=PE(this.isDirected(),r,n,i),f=zp(this.isDirected(),u),l=u.v,c=u.w;if(this.edgesLabelsMap.has(f))return this.edgesLabelsMap.set(f,a),this;if(i!==void 0&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(l),this.setNode(c),this.edgesLabelsMap.set(f,a||this.defaultEdgeLabelFn(l,c,i)),Object.freeze(u),this.edgesMap.set(f,u);var h=this.predecessorsMap.get(c),d=this.successorsMap.get(l);return LE(h,l),LE(d,c),(o=this.inEdgesMap.get(c))===null||o===void 0||o.set(f,u),(s=this.outEdgesMap.get(l))===null||s===void 0||s.set(f,u),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(r,n,a){var i=uI(this.isDirected(),r,n,a),o=this.edgesMap.get(i);if(o){var s=PE(this.isDirected(),r,n,a),u=s.v,f=s.w;this.edgesLabelsMap.delete(i),this.edgesMap.delete(i);var l=this.predecessorsMap.get(f),c=this.successorsMap.get(u);DE(l,u),DE(c,f),this.inEdgesMap.get(f).delete(i),this.outEdgesMap.get(u).delete(i),this.edgeCountNum-=1}return this}}]),t}();Qo.fromJSON=gV;function mg(t){"@babel/helpers - typeof";return mg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mg(t)}function EV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _V(t,e){for(var r=0;r"u"||!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{return!1}}function di(t){return di=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},di(t)}var NV=function(t){AV(r,t);var e=CV(r);function r(){var n;EV(this,r);for(var a=arguments.length,i=new Array(a),o=0;o-1&&this.eventPool[a].splice(o,1)}}},{key:"emitEvent",value:function(a){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s>1,((s=n[i])===null||s===void 0?void 0:s.priority)e.arr[a].priority)throw new Error("New priority is greater than current priority.Key: ".concat(r," Old: + ").concat(e.arr[a].priority," New: ").concat(n));e.arr[a].priority=n,e.innerDecrease(a)}}),DV=function(e,r){var n=new Qo,a=new Map,i=new fI,o;function s(l){var c=l.v===o?l.w:l.v,h=i.priority(c);if(h!==void 0){var d=r(l);d0;){var f;if(o=i.removeMin(),a.has(o))n.setEdge(o,a.get(o));else{if(u)throw new Error("Input graph is not connected: "+e.graph());u=!0}(f=e.nodeEdges(o))===null||f===void 0||f.forEach(s)}return n},PV=function(e){var r=new Set,n=[],a=e.nodes();return a.forEach(function(i){for(var o=[],s=[i];s.length>0;){var u=s.pop();if(!r.has(u)){var f,l;r.add(u),o.push(u),(f=e.successors(u))===null||f===void 0||f.forEach(function(c){return s.push(c)}),(l=e.predecessors(u))===null||l===void 0||l.forEach(function(c){return s.push(c)})}}o.length&&n.push(o)}),n},RV=function t(e,r,n,a,i,o){a.includes(r)||(a.push(r),n||o.push(r),i(r).forEach(function(s){return t(e,s,n,a,i,o)}),n&&o.push(r))},lm=function(e,r,n){var a=Array.isArray(r)?r:[r],i=function(f){return e.isDirected()?e.successors(f):e.neighbors(f)},o=[],s=[];return a.forEach(function(u){if(e.hasNode(u))RV(e,u,n==="post",s,i,o);else throw new Error("Graph does not have node: "+u)}),o};function FV(t,e){return jV(t)||zV(t,e)||GV(t,e)||BV()}function BV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GV(t,e){if(t){if(typeof t=="string")return GE(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return GE(t,e)}}function GE(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&(s=o.removeMin(),u=i.get(s),!(u&&u.distance===Number.POSITIVE_INFINITY));)a(s).forEach(f);var l={};return Array.from(i.entries()).forEach(function(c){var h=FV(c,2),d=h[0],v=h[1];return l[String(d)]=v,l}),l},XV=function(e,r,n){var a={};return e.nodes().forEach(function(i){return a[String(i)]=lI(e,i,r,n),a}),a},cI=function(e){var r=0,n=[],a=new Map,i=[];function o(s){var u,f={onStack:!0,lowlink:r,index:r};if(a.set(s,f),r+=1,n.push(s),(u=e.successors(s))===null||u===void 0||u.forEach(function(d){var v;if(a.has(d)){if(!((v=a.get(d))===null||v===void 0)&&v.onStack){var g=a.get(d);f.lowlink=Math.min(f.lowlink,g.index)}}else{o(d);var p=a.get(d);f.lowlink=Math.min(f.lowlink,p.lowlink)}}),f.lowlink===f.index){var l=[],c;do{c=n.pop();var h=a.get(c);h.onStack=!1,l.push(c)}while(s!==c);i.push(l)}}return e.nodes().forEach(function(s){a.has(s)||o(s)}),i},WV=function(e){return cI(e).filter(function(r){return r.length>1||r.length===1&&e.hasEdge(r[0],r[0])})};function wg(t){"@babel/helpers - typeof";return wg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wg(t)}function VV(t,e,r){return Object.defineProperty(t,"prototype",{writable:!1}),t}function YV(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qV(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wf(t,e)}function HV(t){var e=hI();return function(){var n=Vf(t),a;if(e){var i=Vf(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return ZV(this,a)}}function ZV(t,e){if(e&&(wg(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return KV(t)}function KV(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function xg(t){var e=typeof Map=="function"?new Map:void 0;return xg=function(n){if(n===null||!QV(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,a)}function a(){return hh(n,arguments,Vf(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),Wf(a,n)},xg(t)}function hh(t,e,r){return hI()?hh=Reflect.construct:hh=function(a,i,o){var s=[null];s.push.apply(s,i);var u=Function.bind.apply(a,s),f=new u;return o&&Wf(f,o.prototype),f},hh.apply(null,arguments)}function hI(){if(typeof Reflect>"u"||!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{return!1}}function QV(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Wf(t,e){return Wf=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},Wf(t,e)}function Vf(t){return Vf=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Vf(t)}var Eg=function(t){qV(r,t);var e=HV(r);function r(){return YV(this,r),e.apply(this,arguments)}return VV(r)}(xg(Error));function dI(t){var e=new Set,r=new Set,n=[];function a(i){if(r.has(i))throw new Eg;if(!e.has(i)){var o;r.add(i),e.add(i),(o=t.predecessors(i))===null||o===void 0||o.forEach(a),r.delete(i),n.push(i)}}if(t.sinks().forEach(a),e.size!==t.nodeCount())throw new Eg;return n}var JV=function(e){try{dI(e)}catch(r){if(r instanceof Eg)return!1;throw r}return!0},eY=function(e,r){return lm(e,r,"post")},tY=function(e,r){return lm(e,r,"pre")},rY=function(){return 1};function nY(t,e,r){return aY(t,e||rY,r||function(n){return t.outEdges(n)})}function aY(t,e,r){var n={},a=t.nodes();return a.forEach(function(i){var o=String(i);n[o]={},n[o][o]={distance:0},a.forEach(function(s){i!==s&&(n[o][String(s)]={distance:Number.POSITIVE_INFINITY})}),r(i).forEach(function(s){var u=s.v===i?s.w:s.v,f=e(s);n[o][String(u)]={distance:f,predecessor:i}})}),a.forEach(function(i){var o=String(i),s=n[o];a.forEach(function(u){var f=String(u),l=n[f];a.forEach(function(c){var h=String(c),d=l[o],v=s[h],p=l[h],g=d.distance+v.distance;gt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0;--s)if(o=e[s].dequeue(),o){n=n.concat(jp(t,e,r,o,!0));break}}}return n},jp=function(t,e,r,n,a){var i,o,s=[];return(i=t.inEdges(n.v))===null||i===void 0||i.forEach(function(u){var f=t.edge(u),l=t.node(u.v);a&&s.push({v:u.v,w:u.w,in:0,out:0}),l.out===void 0&&(l.out=0),l.out-=f,_g(e,r,l)}),(o=t.outEdges(n.v))===null||o===void 0||o.forEach(function(u){var f=t.edge(u),l=u.w,c=t.node(l);c.in===void 0&&(c.in=0),c.in-=f,_g(e,r,c)}),t.removeNode(n.v),a?s:void 0},NY=function(t,e){var r=new CY,n=0,a=0;t.nodes().forEach(function(f){r.setNode(f,{v:f,in:0,out:0})}),t.edges().forEach(function(f){var l=r.edge(f)||0,c=(e==null?void 0:e(f))||1,h=l+c;r.setEdge(f.v,f.w,h),a=Math.max(a,r.node(f.v).out+=c),n=Math.max(n,r.node(f.w).in+=c)});for(var i=[],o=a+n+3,s=0;sMath.abs(S)*C?(A<0&&(C=-C),I=C*S/A,k=C):(S<0&&(M=-M),I=M,k=M*A/S),{x:E+I,y:_+k}};t.intersectRect=l;var c=function(w){for(var x=[],E=(0,t.maxRank)(w)+1,_=0;_x)&&(x=S)}),x||(x=0),x};t.maxRank=p;var g=function(w,x){var E={lhs:[],rhs:[]};return w==null||w.forEach(function(_){x(_)?E.lhs.push(_):E.rhs.push(_)}),E};t.partition=g;var y=function(w,x){var E=Date.now();try{return x()}finally{console.log("".concat(w," time: ").concat(Date.now()-E,"ms"))}};t.time=y;var m=function(w,x){return x()};t.notime=m;var b=function(w,x){return w.reduce(function(E,_){var S=x(E),A=x(_);return S>A?_:E})};t.minBy=b})(Vn);Object.defineProperty(hm,"__esModule",{value:!0});var zY=Vn,jY=function(t){t.graph().dummyChains=[],t.edges().forEach(function(e){return UY(t,e)})},UY=function(t,e){var r=e.v,n=t.node(r).rank,a=e.w,i=t.node(a).rank,o=e.name,s=t.edge(e),u=s.labelRank;if(i!==n+1){t.removeEdgeObj(e);var f=t.graph(),l,c,h;for(h=0,++n;nA.lim&&(M=A,C=!0);var I=w.edges().filter(function(k){return C===m(b,b.node(k.v),M)&&C!==m(b,b.node(k.w),M)});return(0,n.minBy)(I,function(k){return(0,r.slack)(w,k)})};t.enterEdge=v;var p=function(b,w,x,E){var _=x.v,S=x.w;b.removeEdge(_,S),b.setEdge(E.v,E.w,{}),(0,t.initLowLimValues)(b),(0,t.initCutValues)(b,w),g(b,w)};t.exchangeEdges=p;var g=function(b,w){var x=b.nodes().find(function(_){var S;return!(!((S=w.node(_))===null||S===void 0)&&S.parent)}),E=i(b,x);E=E==null?void 0:E.slice(1),E==null||E.forEach(function(_){var S=b.node(_).parent,A=w.edgeFromArgs(_,S),M=!1;A||(A=w.edgeFromArgs(S,_),M=!0),w.node(_).rank=w.node(S).rank+(M?A.minlen:-A.minlen)})},y=function(b,w,x){return b.hasEdge(w,x)},m=function(b,w,x){return x.low<=w.lim&&w.lim<=x.lim};t.default=s})(CI);var YY=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(dm,"__esModule",{value:!0});var TI=ba,qY=Ki,HY=YY(CI),ZY=function(t){switch(t.graph().ranker){case"network-simplex":QY(t);break;case"tight-tree":jE(t);break;case"longest-path":KY(t);break;default:jE(t)}},KY=TI.longestPath,jE=function(t){(0,TI.longestPathWithLayer)(t),(0,qY.feasibleTreeWithLayer)(t)},QY=function(t){(0,HY.default)(t)};dm.default=ZY;var vm={};Object.defineProperty(vm,"__esModule",{value:!0});var JY=function(t){var e,r={},n=0,a=function(i){var o,s=n;(o=t.children(i))===null||o===void 0||o.forEach(a),r[i]={low:s,lim:n++}};return(e=t.children())===null||e===void 0||e.forEach(a),r},eq=function(t,e,r,n){var a=[],i=[],o=Math.min(e[r].low,e[n].low),s=Math.max(e[r].lim,e[n].lim),u,f;u=r;do u=t.parent(u),a.push(u);while(u&&(e[u].low>o||s>e[u].lim));for(f=u,u=n;u&&u!==f;)i.push(u),u=t.parent(u);return{lca:f,path:a.concat(i.reverse())}},tq=function(t){var e,r=JY(t);(e=t.graph().dummyChains)===null||e===void 0||e.forEach(function(n){var a,i,o=n,s=t.node(o),u=s.edgeObj;if(u)for(var f=eq(t,r,u.v,u.w),l=f.path,c=f.lca,h=0,d=l[h],v=!0;o!==u.w;){if(s=t.node(o),v){for(;d!==c&&((a=t.node(d))===null||a===void 0?void 0:a.maxRank)-1:!1},LI=function(t,e){if(!Ln(t))return t;for(var r=[],n=0;n-1;)bq.call(t,i,1);return t},Eq=Array.prototype.splice,zI=function(e,r){if(!Ln(e))return[];for(var n=e?r.length:0,a=n-1;n--;){var i=void 0,o=r[n];(n===a||o!==i)&&(i=o,Eq.call(e,o,1))}return e},jI=function(t,e,r){if(!Vr(t)&&!ou(t))return t;var n=r;return iu(t,function(a,i){n=e(n,a,i)}),n},_q=function(t,e){var r=[];if(!Ln(t))return r;for(var n=-1,a=[],i=t.length;++ni[s])return 1;if(a[s]r?r:t},zq=function(t,e){var r=e.toString(),n=r.indexOf(".");if(n===-1)return Math.round(t);var a=r.substr(n+1).length;return a>20&&(a=20),parseFloat(t.toFixed(a))};function xi(t){return typeof t=="number"}function jq(t){return xi(t)&&t%1!==0}function Uq(t){return xi(t)&&t%2===0}function $q(t){return xi(t)&&t%1===0}function Xq(t){return xi(t)&&t<0}var Wq=1e-5;function Vq(t,e,r){return r===void 0&&(r=Wq),t===e||Math.abs(t-e)0};const Hq=function(t,e){if(Vr(t)){for(var r,n=-1/0,a=0;an&&(r=i,n=o)}return r}},Zq=function(t,e){if(Vr(t)){for(var r,n=1/0,a=0;aa&&(n=r,o(1),++e),r[s]=u}function o(s){e=0,r=Object.create(null),s||(n=Object.create(null))}return o(),{clear:o,has:function(s){return r[s]!==void 0||n[s]!==void 0},get:function(s){var u=r[s];if(u!==void 0)return u;if((u=n[s])!==void 0)return i(s,u),u},set:function(s,u){r[s]!==void 0?r[s]=u:i(s,u)}}}var Vp=new Map;function qI(t,e,r){r===void 0&&(r=128);var n=function(){for(var a=[],i=0;ie?(n&&(clearTimeout(n),n=null),s=l,o=t.apply(a,i),n||(a=i=null)):!n&&r.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=a=i=null},f},UH=function(t){return Ln(t)?Array.prototype.slice.call(t):[]};var Lc={};const $H=function(t){return t=t||"g",Lc[t]?Lc[t]+=1:Lc[t]=1,t+Lc[t]},XH=function(){},WH=function(t){return t};function VH(t){return no(t)?0:Ln(t)?t.length:Object.keys(t).length}var YH=function(){function t(){this.map={}}return t.prototype.has=function(e){return this.map[e]!==void 0},t.prototype.get=function(e,r){var n=this.map[e];return n===void 0?r:n},t.prototype.set=function(e,r){this.map[e]=r},t.prototype.clear=function(){this.map={}},t.prototype.delete=function(e){delete this.map[e]},t.prototype.size=function(){return Object.keys(this.map).length},t}(),qH=/rgba?\(([\s.,0-9]+)\)/;function HH(){var t=document.getElementById("antv-web-colour-picker");return t||(t=document.createElement("i"),t.id="antv-web-colour-picker",t.title="Web Colour Picker",t.style.display="none",document.body.appendChild(t),t)}function ZH(t){if(t[0]==="#"&&t.length===7)return t;var e=HH();e.style.color=t;var r=document.defaultView.getComputedStyle(e,"").getPropertyValue("color"),n=qH.exec(r),a=n[1].split(/\s*,\s*/).map(function(i){return Number(i)});return r=OI(a),r}var ZI=qI(ZH,function(t){return t},256);function Yp(t,e,r,n){return t[n]+(e[n]-t[n])*r}function KH(t,e){var r=isNaN(Number(e))||e<0?0:e>1?1:Number(e),n=t.length-1,a=Math.floor(n*r),i=n*r-a,o=t[a],s=a===n?o:t[a+1];return OI([Yp(o,s,i,0),Yp(o,s,i,1),Yp(o,s,i,2)])}function QH(t){var e=typeof t=="string"?t.split("-"):t,r=e.map(function(n){return NI(n.indexOf("#")===-1?ZI(n):n)});return function(n){return KH(r,n)}}var JH=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,eZ=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,tZ=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function rZ(t){return/^[r,R,L,l]{1}[\s]*\(/.test(t)}function nZ(t){if(rZ(t)){var e,r=void 0;if(t[0]==="l"){var n=JH.exec(t),a=+n[1]+90;r=n[2],e="linear-gradient(".concat(a,"deg, ")}else if(t[0]==="r"){e="radial-gradient(";var n=eZ.exec(t);r=n[4]}var i=r.match(tZ);return i.forEach(function(o,s){var u=o.split(":");e+="".concat(u[1]," ").concat(Number(u[0])*100,"%"),s!==i.length-1&&(e+=", ")}),e+=")",e}return t}function aZ(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return uy(n,r),Qa(t,n,e)}function iZ(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return fy(n,r),Qa(t,n,e)}function oZ(t,e,r){var n=[0,0,0,0,0,0,0,0,0];return ly(n,r),Qa(t,n,e)}function sZ(t,e,r){return Qa(t,r,e)}function uZ(t,e){for(var r=t?[].concat(t):[1,0,0,0,1,0,0,0,1],n=0,a=e.length;n=0;return r?a?Math.PI*2-n:n:a?n:Math.PI*2-n}function lZ(t,e,r){return r?(t[0]=e[1],t[1]=-1*e[0]):(t[0]=-1*e[1],t[1]=e[0]),t}function cZ(t,e){if(e==="off")return[].concat(t);var r=typeof e=="number"&&e>=1?Math.pow(10,e):1;return t.map(function(n){var a=n.slice(1).map(Number).map(function(i){return e?Math.round(i*r)/r:Math.round(i)});return[n[0]].concat(a)})}function hZ(t,e){return e===void 0&&(e="off"),cZ(t,e).map(function(r){return r[0]+r.slice(1).join(" ")}).join("")}var QI={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function dZ(t,e,r){if(t[r].length>7){t[r].shift();for(var n=t[r],a=r;n.length;)e[r]="A",t.splice(a+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}var Af={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function JI(t){return Array.isArray(t)&&t.every(function(e){var r=e[0].toLowerCase();return Af[r]===e.length-1&&"achlmqstvz".includes(r)})}function ek(t){return JI(t)&&t.every(function(e){var r=e[0];return r===r.toUpperCase()})}function tk(t){return ek(t)&&t.every(function(e){var r=e[0];return"ACLMQZ".includes(r)})}function VE(t){for(var e=t.pathValue[t.segmentStart],r=e.toLowerCase(),n=t.data;n.length>=Af[r]&&(r==="m"&&n.length>2?(t.segments.push([e].concat(n.splice(0,2))),r="l",e=e==="m"?"l":"L"):t.segments.push([e].concat(n.splice(0,Af[r]))),!!Af[r]););}function vZ(t){var e=t.index,r=t.pathValue,n=r.charCodeAt(e);if(n===48){t.param=0,t.index+=1;return}if(n===49){t.param=1,t.index+=1;return}t.err='[path-util]: invalid Arc flag "'.concat(r[e],'", expecting 0 or 1 at index ').concat(e)}function pZ(t){return t>=48&&t<=57||t===43||t===45||t===46}function Ss(t){return t>=48&&t<=57}function gZ(t){var e=t.max,r=t.pathValue,n=t.index,a=n,i=!1,o=!1,s=!1,u=!1,f;if(a>=e){t.err="[path-util]: Invalid path value at index ".concat(a,', "pathValue" is missing param');return}if(f=r.charCodeAt(a),(f===43||f===45)&&(a+=1,f=r.charCodeAt(a)),!Ss(f)&&f!==46){t.err="[path-util]: Invalid path value at index ".concat(a,', "').concat(r[a],'" is not a number');return}if(f!==46){if(i=f===48,a+=1,f=r.charCodeAt(a),i&&a=5760&&e.includes(t)}function dh(t){for(var e=t.pathValue,r=t.max;t.index0;o-=1){if(bZ(a)&&(o===3||o===4)?vZ(t):gZ(t),t.err.length)return;t.data.push(t.param),dh(t),t.index=t.max||!pZ(r.charCodeAt(t.index)))break}VE(t)}var xZ=function(){function t(e){this.pathValue=e,this.segments=[],this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return t}();function Yd(t){if(JI(t))return[].concat(t);var e=new xZ(t);for(dh(e);e.index1&&(M=Math.sqrt(M),h*=M,d*=M);var C=h*h,I=d*d,k=(i===o?-1:1)*Math.sqrt(Math.abs((C*I-C*A*A-I*S*S)/(C*A*A+I*S*S)));E=k*h*A/d+(l+v)/2,_=k*-d*S/h+(c+p)/2,w=Math.asin(((c-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),x=Math.asin(((p-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),w=lx&&(w-=Math.PI*2),!o&&x>w&&(x-=Math.PI*2)}var O=x-w;if(Math.abs(O)>g){var B=x,L=v,z=p;x=w+g*(o&&x>w?1:-1),v=E+h*Math.cos(x),p=_+d*Math.sin(x),m=wm(v,p,h,d,a,0,o,L,z,[x,B,E,_])}O=x-w;var X=Math.cos(w),R=Math.sin(w),V=Math.cos(x),he=Math.sin(x),ce=Math.tan(O/4),le=4/3*h*ce,ie=4/3*d*ce,Ie=[l,c],qe=[l+le*R,c-ie*X],Ve=[v+le*he,p-ie*V],it=[v,p];if(qe[0]=2*Ie[0]-qe[0],qe[1]=2*Ie[1]-qe[1],f)return qe.concat(Ve,it,m);m=qe.concat(Ve,it,m);for(var dt=[],st=0,Tt=m.length;st=i)o={x:r,y:n};else{var s=zi([t,e],[r,n],a/i),u=s[0],f=s[1];o={x:u,y:f}}return{length:i,point:o,min:{x:Math.min(t,r),y:Math.min(e,n)},max:{x:Math.max(t,r),y:Math.max(e,n)}}}function qE(t,e){var r=t.x,n=t.y,a=e.x,i=e.y,o=r*a+n*i,s=Math.sqrt((Math.pow(r,2)+Math.pow(n,2))*(Math.pow(a,2)+Math.pow(i,2))),u=r*i-n*a<0?-1:1,f=u*Math.acos(o/s);return f}function IZ(t,e,r,n,a,i,o,s,u,f){var l=Math.abs,c=Math.sin,h=Math.cos,d=Math.sqrt,v=Math.PI,p=l(r),g=l(n),y=(a%360+360)%360,m=y*(v/180);if(t===s&&e===u)return{x:t,y:e};if(p===0||g===0)return Ag(t,e,s,u,f).point;var b=(t-s)/2,w=(e-u)/2,x={x:h(m)*b+c(m)*w,y:-c(m)*b+h(m)*w},E=Math.pow(x.x,2)/Math.pow(p,2)+Math.pow(x.y,2)/Math.pow(g,2);E>1&&(p*=d(E),g*=d(E));var _=Math.pow(p,2)*Math.pow(g,2)-Math.pow(p,2)*Math.pow(x.y,2)-Math.pow(g,2)*Math.pow(x.x,2),S=Math.pow(p,2)*Math.pow(x.y,2)+Math.pow(g,2)*Math.pow(x.x,2),A=_/S;A=A<0?0:A;var M=(i!==o?1:-1)*d(A),C={x:M*(p*x.y/g),y:M*(-(g*x.x)/p)},I={x:h(m)*C.x-c(m)*C.y+(t+s)/2,y:c(m)*C.x+h(m)*C.y+(e+u)/2},k={x:(x.x-C.x)/p,y:(x.y-C.y)/g},O=qE({x:1,y:0},k),B={x:(-x.x-C.x)/p,y:(-x.y-C.y)/g},L=qE(k,B);!o&&L>0?L-=2*v:o&&L<0&&(L+=2*v),L%=2*v;var z=O+L*f,X=p*h(z),R=g*c(z),V={x:h(m)*X-c(m)*R+I.x,y:c(m)*X+h(m)*R+I.y};return V}function kZ(t,e,r,n,a,i,o,s,u,f,l){var c,h=l.bbox,d=h===void 0?!0:h,v=l.length,p=v===void 0?!0:v,g=l.sampleSize,y=g===void 0?30:g,m=typeof f=="number",b=t,w=e,x=0,E=[b,w,x],_=[b,w],S=0,A={x:0,y:0},M=[{x:b,y:w}];m&&f<=0&&(A={x:b,y:w});for(var C=0;C<=y;C+=1){if(S=C/y,c=IZ(t,e,r,n,a,i,o,s,u,S),b=c.x,w=c.y,d&&M.push({x:b,y:w}),p&&(x+=bu(_,[b,w])),_=[b,w],m&&x>=f&&f>E[2]){var I=(x-f)/(x-E[2]);A={x:_[0]*(1-I)+E[0]*I,y:_[1]*(1-I)+E[1]*I}}E=[b,w,x]}return m&&f>=x&&(A={x:s,y:u}),{length:x,point:A,min:{x:Math.min.apply(null,M.map(function(k){return k.x})),y:Math.min.apply(null,M.map(function(k){return k.y}))},max:{x:Math.max.apply(null,M.map(function(k){return k.x})),y:Math.max.apply(null,M.map(function(k){return k.y}))}}}function NZ(t,e,r,n,a,i,o,s,u){var f=1-u;return{x:Math.pow(f,3)*t+3*Math.pow(f,2)*u*r+3*f*Math.pow(u,2)*a+Math.pow(u,3)*o,y:Math.pow(f,3)*e+3*Math.pow(f,2)*u*n+3*f*Math.pow(u,2)*i+Math.pow(u,3)*s}}function ak(t,e,r,n,a,i,o,s,u,f){var l,c=f.bbox,h=c===void 0?!0:c,d=f.length,v=d===void 0?!0:d,p=f.sampleSize,g=p===void 0?10:p,y=typeof u=="number",m=t,b=e,w=0,x=[m,b,w],E=[m,b],_=0,S={x:0,y:0},A=[{x:m,y:b}];y&&u<=0&&(S={x:m,y:b});for(var M=0;M<=g;M+=1){if(_=M/g,l=NZ(t,e,r,n,a,i,o,s,_),m=l.x,b=l.y,h&&A.push({x:m,y:b}),v&&(w+=bu(E,[m,b])),E=[m,b],y&&w>=u&&u>x[2]){var C=(w-u)/(w-x[2]);S={x:E[0]*(1-C)+x[0]*C,y:E[1]*(1-C)+x[1]*C}}x=[m,b,w]}return y&&u>=w&&(S={x:o,y:s}),{length:w,point:S,min:{x:Math.min.apply(null,A.map(function(I){return I.x})),y:Math.min.apply(null,A.map(function(I){return I.y}))},max:{x:Math.max.apply(null,A.map(function(I){return I.x})),y:Math.max.apply(null,A.map(function(I){return I.y}))}}}function OZ(t,e,r,n,a,i,o){var s=1-o;return{x:Math.pow(s,2)*t+2*s*o*r+Math.pow(o,2)*a,y:Math.pow(s,2)*e+2*s*o*n+Math.pow(o,2)*i}}function LZ(t,e,r,n,a,i,o,s){var u,f=s.bbox,l=f===void 0?!0:f,c=s.length,h=c===void 0?!0:c,d=s.sampleSize,v=d===void 0?10:d,p=typeof o=="number",g=t,y=e,m=0,b=[g,y,m],w=[g,y],x=0,E={x:0,y:0},_=[{x:g,y}];p&&o<=0&&(E={x:g,y});for(var S=0;S<=v;S+=1){if(x=S/v,u=OZ(t,e,r,n,a,i,x),g=u.x,y=u.y,l&&_.push({x:g,y}),h&&(m+=bu(w,[g,y])),w=[g,y],p&&m>=o&&o>b[2]){var A=(m-o)/(m-b[2]);E={x:w[0]*(1-A)+b[0]*A,y:w[1]*(1-A)+b[1]*A}}b=[g,y,m]}return p&&o>=m&&(E={x:a,y:i}),{length:m,point:E,min:{x:Math.min.apply(null,_.map(function(M){return M.x})),y:Math.min.apply(null,_.map(function(M){return M.y}))},max:{x:Math.max.apply(null,_.map(function(M){return M.x})),y:Math.max.apply(null,_.map(function(M){return M.y}))}}}function Hd(t,e,r){for(var n,a,i,o,s,u,f=qd(t),l=typeof e=="number",c,h=[],d,v=0,p=0,g=0,y=0,m,b=[],w=[],x=0,E={x:0,y:0},_=E,S=E,A=E,M=0,C=0,I=f.length;C=e&&(A=S),w.push(_),b.push(E),M+=x,u=d!=="Z"?m.slice(-2):[g,y],v=u[0],p=u[1];return l&&e>=M&&(A={x:v,y:p}),{length:M,point:A,min:{x:Math.min.apply(null,b.map(function(k){return k.x})),y:Math.min.apply(null,b.map(function(k){return k.y}))},max:{x:Math.max.apply(null,w.map(function(k){return k.x})),y:Math.max.apply(null,w.map(function(k){return k.y}))}}}function DZ(t,e){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var r=Hd(t,void 0,P(P({},e),{length:!1})),n=r.min,a=n.x,i=n.y,o=r.max,s=o.x,u=o.y,f=s-a,l=u-i;return{width:f,height:l,x:a,y:i,x2:s,y2:u,cx:a+f/2,cy:i+l/2,cz:Math.max(f,l)+Math.min(f,l)/2}}function Cf(t,e){return Hd(t,void 0,P(P({},e),{bbox:!1,length:!0})).length}function PZ(t,e){if(!t)return{length:0,x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var r=Hd(t,void 0,P(P({},e),{bbox:!0,length:!0})),n=r.length,a=r.min,i=a.x,o=a.y,s=r.max,u=s.x,f=s.y,l=u-i,c=f-o;return{length:n,width:l,height:c,x:i,y:o,x2:u,y2:f,cx:i+l/2,cy:o+c/2,cz:Math.max(l,c)+Math.min(l,c)/2}}function RZ(t){var e=t.length,r=e-1;return t.map(function(n,a){return t.map(function(i,o){var s=a+o,u;return o===0||t[s]&&t[s][0]==="M"?(u=t[s],["M"].concat(u.slice(-2))):(s>=e&&(s-=r),t[s])})})}function FZ(t,e){var r=t.length-1,n=[],a=0,i=0,o=RZ(t);return o.forEach(function(s,u){t.slice(1).forEach(function(f,l){i+=bu(t[(u+l)%r].slice(-2),e[l%r].slice(-2))}),n[u]=i,i=0}),a=n.indexOf(Math.min.apply(null,n)),o[a]}function BZ(t,e,r,n,a,i,o,s){return 3*((s-e)*(r+a)-(o-t)*(n+i)+n*(t-a)-r*(e-i)+s*(a+t/3)-o*(i+e/3))/20}function ik(t){var e=0,r=0,n=0;return nk(t).map(function(a){var i;switch(a[0]){case"M":return e=a[1],r=a[2],0;default:var o=a.slice(1),s=o[0],u=o[1],f=o[2],l=o[3],c=o[4],h=o[5];return n=BZ(e,r,s,u,f,l,c,h),i=a.slice(-2),e=i[0],r=i[1],n}}).reduce(function(a,i){return a+i},0)}function GZ(t){return ik(t)>=0}function vh(t,e,r){return Hd(t,e,P(P({},r),{bbox:!1,length:!0})).point}function zZ(t,e){var r=Yd(t);if(typeof r=="string")throw TypeError(r);var n=r.slice(),a=Cf(n),i=n.length-1,o=0,s=0,u=r[0],f=u.slice(-2),l=f[0],c=f[1],h={x:l,y:c};if(i<=0||!e||!Number.isFinite(e))return{segment:u,index:0,length:s,point:h,lengthAtSegment:o};if(e>=a)return n=r.slice(0,-1),o=Cf(n),s=a-o,{segment:r[i],index:i,length:s,lengthAtSegment:o};for(var d=[];i>0;)u=n[i],n=n.slice(0,-1),o=Cf(n),s=a-o,a=o,d.push({segment:u,index:i,length:s,lengthAtSegment:o}),i-=1;return d.find(function(v){var p=v.lengthAtSegment;return p<=e})}function jZ(t,e){for(var r=Yd(t),n=qd(r),a=Cf(r),i=function(x){var E=x.x-e.x,_=x.y-e.y;return E*E+_*_},o=8,s,u=0,f,l=0,c=1/0,h=0;h<=a;h+=o)s=vh(n,h),u=i(s),u.5;)p=l-o,d=vh(n,p),y=i(d),g=l+o,v=vh(n,g),m=i(v),p>=0&&y$Z)return console.warn("Maximum recursion depth reached in equalizeSegments"),[t,e];var a=HE(t),i=HE(e),o=a.length,s=i.length,u=a.filter(function(y){return y.l}).length,f=i.filter(function(y){return y.l}).length,l=a.filter(function(y){return y.l}).reduce(function(y,m){var b=m.l;return y+b},0)/u||0,c=i.filter(function(y){return y.l}).reduce(function(y,m){var b=m.l;return y+b},0)/f||0,h=r||Math.max(o,s),d=[l,c],v=[h-o,h-s],p=0,g=[a,i].map(function(y,m){return y.l===h?y.map(function(b){return b.s}):y.map(function(b,w){return p=w&&v[m]&&b.l>=d[m],v[m]-=p?1:0,p?b.ss:[b.s]}).flat()});return g[0].length===g[1].length?g:ok(g[0],g[1],h,n+1)}var WZ=1e-6;function qp(t){return Math.abs(t)0!=qp(s[1]-r)>0&&qp(e-(r-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}var ZE=function(t,e,r){return t>=e&&t<=r};function YZ(t,e,r,n){var a=.001,i={x:r.x-t.x,y:r.y-t.y},o={x:e.x-t.x,y:e.y-t.y},s={x:n.x-r.x,y:n.y-r.y},u=o.x*s.y-o.y*s.x,f=u*u,l=o.x*o.x+o.y*o.y,c=s.x*s.x+s.y*s.y,h=null;if(f>a*l*c){var d=(i.x*s.y-i.y*s.x)/u,v=(i.x*o.y-i.y*o.x)/u;ZE(d,0,1)&&ZE(v,0,1)&&(h={x:t.x+d*o.x,y:t.y+d*o.y})}return h}function KE(t){for(var e=[],r=t.length,n=0;n1){var o=t[0],s=t[r-1];e.push({from:{x:s[0],y:s[1]},to:{x:o[0],y:o[1]}})}return e}function qZ(t,e){var r=!1;return t.forEach(function(n){if(YZ(n.from,n.to,e.from,e.to))return r=!0,!1}),r}function QE(t){var e=t.map(function(n){return n[0]}),r=t.map(function(n){return n[1]});return{minX:Math.min.apply(null,e),maxX:Math.max.apply(null,e),minY:Math.min.apply(null,r),maxY:Math.max.apply(null,r)}}function HZ(t,e){return!(e.minX>t.maxX||e.maxXt.maxY||e.maxY0;)c%2&&(h+=u[c+1]),c=c-1>>1,u[c]+=l.weight;f+=l.weight*h}}),f},aK=function(t,e){for(var r=0,n=1;n<(e==null?void 0:e.length);n+=1)r+=nK(t,e[n-1],e[n]);return r};xm.default=aK;var Em={};Object.defineProperty(Em,"__esModule",{value:!0});var iK=wi,oK=function(t,e,r){var n=sK(t),a=new iK.Graph({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(i){return t.node(i)});return t.nodes().forEach(function(i){var o,s=t.node(i),u=t.parent(i);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(a.setNode(i),a.setParent(i,u||n),(o=t[r](i))===null||o===void 0||o.forEach(function(f){var l=f.v===i?f.w:f.v,c=a.edgeFromArgs(l,i),h=c!==void 0?c.weight:0;a.setEdge(l,i,{weight:t.edge(f).weight+h})}),s.hasOwnProperty("minRank")&&a.setNode(i,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),a},sK=function(t){for(var e;t.hasNode(e="_root".concat(Math.random())););return e};Em.default=oK;var _m={};Object.defineProperty(_m,"__esModule",{value:!0});var uK=function(t,e,r){var n={},a;r==null||r.forEach(function(i){for(var o=t.parent(i),s,u;o;){if(s=t.parent(o),s?(u=n[s],n[s]=o):(u=a,a=o),u&&u!==o){e.setEdge(u,o);return}o=s}})};_m.default=uK;var Sm={},Mm={};Object.defineProperty(Mm,"__esModule",{value:!0});var fK=function(t,e){return e.map(function(r){var n=t.inEdges(r);if(!(n!=null&&n.length))return{v:r};{var a={sum:0,weight:0};return n==null||n.forEach(function(i){var o=t.edge(i),s=t.node(i.v);a.sum+=o.weight*s.order,a.weight+=o.weight}),{v:r,barycenter:a.sum/a.weight,weight:a.weight}}})};Mm.default=fK;var Am={};Object.defineProperty(Am,"__esModule",{value:!0});var lK=function(t,e){var r,n,a,i={};t==null||t.forEach(function(s,u){i[s.v]={i:u,indegree:0,in:[],out:[],vs:[s.v]};var f=i[s.v];s.barycenter!==void 0&&(f.barycenter=s.barycenter,f.weight=s.weight)}),(r=e.edges())===null||r===void 0||r.forEach(function(s){var u=i[s.v],f=i[s.w];u!==void 0&&f!==void 0&&(f.indegree++,u.out.push(i[s.w]))});var o=(a=(n=Object.values(i)).filter)===null||a===void 0?void 0:a.call(n,function(s){return!s.indegree});return cK(o)},cK=function(t){for(var e,r,n=[],a=function(f){return function(l){l.merged||(l.barycenter===void 0||f.barycenter===void 0||l.barycenter>=f.barycenter)&&hK(f,l)}},i=function(f){return function(l){l.in.push(f),--l.indegree===0&&t.push(l)}},o=function(){var f=t.pop();n.push(f),(e=f.in.reverse())===null||e===void 0||e.forEach(function(l){return a(f)(l)}),(r=f.out)===null||r===void 0||r.forEach(function(l){return i(f)(l)})};t!=null&&t.length;)o();var s=n.filter(function(f){return!f.merged}),u=["vs","i","barycenter","weight"];return s.map(function(f){var l={};return u==null||u.forEach(function(c){f[c]!==void 0&&(l[c]=f[c])}),l})},hK=function(t,e){var r,n=0,a=0;t.weight&&(n+=t.barycenter*t.weight,a+=t.weight),e.weight&&(n+=e.barycenter*e.weight,a+=e.weight),t.vs=(r=e.vs)===null||r===void 0?void 0:r.concat(t.vs),t.barycenter=n/a,t.weight=a,t.i=Math.min(e.i,t.i),e.merged=!0};Am.default=lK;var Cm={};Object.defineProperty(Cm,"__esModule",{value:!0});var dK=Vn,vK=function(t,e,r,n){var a=(0,dK.partition)(t,function(h){var d=h.hasOwnProperty("fixorder")&&!isNaN(h.fixorder);return n?!d&&h.hasOwnProperty("barycenter"):d||h.hasOwnProperty("barycenter")}),i=a.lhs,o=a.rhs.sort(function(h,d){return-h.i- -d.i}),s=[],u=0,f=0,l=0;i==null||i.sort(pK(!!e,!!r)),l=JE(s,o,l),i==null||i.forEach(function(h){var d;l+=(d=h.vs)===null||d===void 0?void 0:d.length,s.push(h.vs),u+=h.barycenter*h.weight,f+=h.weight,l=JE(s,o,l)});var c={vs:s.flat()};return f&&(c.barycenter=u/f,c.weight=f),c},JE=function(t,e,r){for(var n=r,a;e.length&&(a=e[e.length-1]).i<=n;)e.pop(),t==null||t.push(a.vs),n++;return n},pK=function(t,e){return function(r,n){if(r.fixorder!==void 0&&n.fixorder!==void 0)return r.fixorder-n.fixorder;if(r.barycentern.barycenter)return 1;if(e&&r.order!==void 0&&n.order!==void 0){if(r.ordern.order)return 1}return t?n.i-r.i:r.i-n.i}};Cm.default=vK;var Tm=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Sm,"__esModule",{value:!0});var gK=Tm(Mm),yK=Tm(Am),mK=Tm(Cm),uk=function(t,e,r,n,a,i){var o,s,u,f,l=t.children(e),c=t.node(e),h=c?c.borderLeft:void 0,d=c?c.borderRight:void 0,v={};h&&(l=l==null?void 0:l.filter(function(w){return w!==h&&w!==d}));var p=(0,gK.default)(t,l||[]);p==null||p.forEach(function(w){var x;if(!((x=t.children(w.v))===null||x===void 0)&&x.length){var E=uk(t,w.v,r,n,i);v[w.v]=E,E.hasOwnProperty("barycenter")&&wK(w,E)}});var g=(0,yK.default)(p,r);bK(g,v),(o=g.filter(function(w){return w.vs.length>0}))===null||o===void 0||o.forEach(function(w){var x=t.node(w.vs[0]);x&&(w.fixorder=x.fixorder,w.order=x.order)});var y=(0,mK.default)(g,n,a,i);if(h&&(y.vs=[h,y.vs,d].flat(),!((s=t.predecessors(h))===null||s===void 0)&&s.length)){var m=t.node(((u=t.predecessors(h))===null||u===void 0?void 0:u[0])||""),b=t.node(((f=t.predecessors(d))===null||f===void 0?void 0:f[0])||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+b.order)/(y.weight+2),y.weight+=2}return y},bK=function(t,e){t==null||t.forEach(function(r){var n,a=(n=r.vs)===null||n===void 0?void 0:n.map(function(i){return e[i]?e[i].vs:i});r.vs=a.flat()})},wK=function(t,e){t.barycenter!==void 0?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)};Sm.default=uk;var dl=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(mm,"__esModule",{value:!0});var e_=dl(bm),t_=dl(xm),xK=dl(Em),EK=dl(_m),_K=dl(Sm),r_=Ir(),SK=wi,Hp=Vn,MK=function(t,e){for(var r=(0,Hp.maxRank)(t),n=[],a=[],i=1;i-1;i--)a.push(i);var o=n_(t,n,"inEdges"),s=n_(t,a,"outEdges"),u=(0,e_.default)(t);Zp(t,u);for(var f=Number.POSITIVE_INFINITY,l,i=0,c=0;c<4;++i,++c){a_(i%2?o:s,i%4>=2,!1,e),u=(0,Hp.buildLayerMatrix)(t);var h=(0,t_.default)(t,u);h=2,!0,e),u=(0,Hp.buildLayerMatrix)(t);var h=(0,t_.default)(t,u);hB)&&(0,t.addConflict)(E,V,X)}))}function S(C){return JSON.stringify(C.slice(1))}function A(C,I){var k=S(C);I.get(k)||(_.apply(void 0,C),I.set(k,!0))}var M=function(C,I){var k=-1,O,B=0,L=new Map;return I==null||I.forEach(function(z,X){var R;if(((R=w.node(z))===null||R===void 0?void 0:R.dummy)==="border"){var V=w.predecessors(z)||[];V.length&&(O=w.node(V[0]).order,A([I,B,X,k,O],L),B=X,k=O)}A([I,B,I.length,O,C.length],L)}),I};return x!=null&&x.length&&x.reduce(M),E};t.findType2Conflicts=s;var u=function(w,x){var E,_;if(!((E=w.node(x))===null||E===void 0)&&E.dummy)return(_=w.predecessors(x))===null||_===void 0?void 0:_.find(function(S){return w.node(S).dummy})};t.findOtherInnerSegmentNode=u;var f=function(w,x,E){var _=x,S=E;if(_>S){var A=_;_=S,S=A}var M=w[_];M||(w[_]=M={}),M[S]=!0};t.addConflict=f;var l=function(w,x,E){var _=x,S=E;if(_>S){var A=x;_=S,S=A}return!!w[_]};t.hasConflict=l;var c=function(w,x,E,_){var S={},A={},M={};return x==null||x.forEach(function(C){C==null||C.forEach(function(I,k){S[I]=I,A[I]=I,M[I]=k})}),x==null||x.forEach(function(C){var I=-1;C==null||C.forEach(function(k){var O=_(k);if(O.length){O=O.sort(function(R,V){return M[R]-M[V]});for(var B=(O.length-1)/2,L=Math.floor(B),z=Math.ceil(B);L<=z;++L){var X=O[L];A[k]===k&&IN.x&&(B=N.x),L>N.y&&(L=N.y)}),b.edges().forEach(function(te){var N,Se=b.edge(te);(N=Se.points)===null||N===void 0||N.forEach(function(Fe){B>Fe.x&&(B=Fe.x),L>Fe.y&&(L=Fe.y)})}),O[0]=h[0]-B,O[1]=h[1]-L}var z=l==="LR"||l==="RL";if(d){var X=this,R=X.focusNode,V=X.ranksep,he=X.getRadialPos,ce=(0,Rn.isString)(R)?R:R==null?void 0:R.id,le=ce?(o=b.node(ce))===null||o===void 0?void 0:o._rank:0,ie=[],Ie=z?"y":"x",qe=z?"height":"width",Ve=1/0,it=-1/0;b.nodes().forEach(function(te){var N=b.node(te);if(s.nodeMap[te]){var Se=A(s.nodeMap[te]);if(le===0)ie[N._rank]||(ie[N._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),ie[N._rank].nodes.push(te),ie[N._rank].totalWidth+=Se*2+N[qe],ie[N._rank].maxSizeit&&(it=$e)}});var dt=V||50,st={},Tt=(it-Ve)/.9,_t=[(Ve+it-Tt)*.5,(Ve+it+Tt)*.5],lr=function(te,N,Se,Fe){Se===void 0&&(Se=-1/0),Fe===void 0&&(Fe=[0,1]);var ge=Se;return te.forEach(function(Ue){var $e=b.node(Ue);st[Ue]=N;var Ze=he($e[Ie],_t,Tt,N,Fe),Je=Ze.x,ht=Ze.y;if(s.nodeMap[Ue]){s.nodeMap[Ue].x=Je+O[0],s.nodeMap[Ue].y=ht+O[1],s.nodeMap[Ue]._order=$e._order;var Lt=S(s.nodeMap[Ue]);ge=ge})}:function(te,N,Se){var Fe=Math.max(N.x,Se.x),ge=Math.min(N.x,Se.x);return te.filter(function(Ue){return Ue.x<=Fe&&Ue.x>=ge})};b.edges().forEach(function(te){var N,Se=b.edge(te),Fe=m.findIndex(function($e){var Ze=(0,Rn.getEdgeTerminal)($e,"source"),Je=(0,Rn.getEdgeTerminal)($e,"target");return Ze===te.v&&Je===te.w});if(!(Fe<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[Fe].type!=="loop"){(N=Se==null?void 0:Se.points)===null||N===void 0||N.forEach(function($e){$e.x+=O[0],$e.y+=O[1]});var ge=s.nodeMap[te.v],Ue=s.nodeMap[te.w];m[Fe].controlPoints=dQ(Se==null?void 0:Se.points,ge,Ue,sr,z,tn,tt)}})}return s.onLayoutEnd&&s.onLayoutEnd(),{nodes:u,edges:m}}},e.prototype.getRadialPos=function(r,n,a,i,o){o===void 0&&(o=[0,1]);var s=(r-n[0])/a;s=s*(o[1]-o[0])+o[0];var u=s*2*Math.PI;return{x:Math.cos(u)*i,y:Math.sin(u)*i}},e.prototype.getType=function(){return"dagre"},e}(cQ.Base);yu.DagreLayout=hQ;var dQ=function(t,e,r,n,a,i,o){var s=(t==null?void 0:t.slice(1,t.length-1))||[];if(e&&r){var u=e.x,f=e.y,l=r.x,c=r.y;if(a&&(u=e.y,f=e.x,l=r.y,c=r.x),c!==f&&u!==l){var h=n.indexOf(f),d=n[h+1];if(d){var v=s[0],p=a?{x:(f+d)/2,y:(v==null?void 0:v.y)||l}:{x:(v==null?void 0:v.x)||l,y:(f+d)/2};(!v||i(v,p))&&s.unshift(p)}var g=n.indexOf(c),y=Math.abs(g-h);if(y===1)s=o(s,e,r),s.length||s.push(a?{x:(f+c)/2,y:u}:{x:u,y:(f+c)/2});else if(y>1){var m=n[g-1];if(m){var b=s[s.length-1],w=a?{x:(c+m)/2,y:(b==null?void 0:b.y)||l}:{x:(b==null?void 0:b.x)||u,y:(c+m)/2};(!b||i(b,w))&&s.push(w)}}}}return s},vl={};const ed={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 Tg(t={},e=ed){var r,n,a,i;const o=JSON.parse(JSON.stringify(e)),s=((r=t==null?void 0:t.graph)===null||r===void 0?void 0:r.meta)||{},u=((n=t==null?void 0:t.subScene)===null||n===void 0?void 0:n.meta)||{},f=((a=t==null?void 0:t.nodeSize)===null||a===void 0?void 0:a.meta)||{},l=((i=t==null?void 0:t.nodeSize)===null||i===void 0?void 0:i.node)||{},c=o.nodeSize.bridge;return{graph:{meta:Object.assign(o.graph.meta,s)},subScene:{meta:Object.assign(o.subScene.meta,u)},nodeSize:{meta:Object.assign(o.nodeSize.meta,f),node:Object.assign(o.nodeSize.node,l),bridge:c}}}function lk(t){return`◬${t}◬`}const su=lk("ROOT"),ck=lk("BRIDGE_GRAPH");var kn,Yo,uu,Ig;(function(t){t[t.META=0]="META",t[t.NODE=1]="NODE",t[t.BRIDGE=2]="BRIDGE"})(kn||(kn={})),function(t){t[t.INCLUDE=0]="INCLUDE",t[t.EXCLUDE=1]="EXCLUDE",t[t.UNSPECIFIED=2]="UNSPECIFIED"}(Yo||(Yo={})),function(t){t[t.META=0]="META",t[t.CORE=1]="CORE",t[t.BRIDGE=2]="BRIDGE"}(uu||(uu={})),function(t){t[t.META=0]="META",t[t.OP=1]="OP",t[t.SERIES=2]="SERIES"}(Ig||(Ig={}));var Pc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Om(t,e){return t(e={exports:{}},e.exports),e.exports}var vQ=function(){this.__data__=[],this.size=0},wu=function(t,e){return t===e||t!=t&&e!=e},Zd=function(t,e){for(var r=t.length;r--;)if(wu(t[r][0],e))return r;return-1},pQ=Array.prototype.splice,gQ=function(t){var e=this.__data__,r=Zd(e,t);return!(r<0)&&(r==e.length-1?e.pop():pQ.call(e,r,1),--this.size,!0)},yQ=function(t){var e=this.__data__,r=Zd(e,t);return r<0?void 0:e[r][1]},mQ=function(t){return Zd(this.__data__,t)>-1},bQ=function(t,e){var r=this.__data__,n=Zd(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Os(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991},br={};br["[object Float32Array]"]=br["[object Float64Array]"]=br["[object Int8Array]"]=br["[object Int16Array]"]=br["[object Int32Array]"]=br["[object Uint8Array]"]=br["[object Uint8ClampedArray]"]=br["[object Uint16Array]"]=br["[object Uint32Array]"]=!0,br["[object Arguments]"]=br["[object Array]"]=br["[object ArrayBuffer]"]=br["[object Boolean]"]=br["[object DataView]"]=br["[object Date]"]=br["[object Error]"]=br["[object Function]"]=br["[object Map]"]=br["[object Number]"]=br["[object Object]"]=br["[object RegExp]"]=br["[object Set]"]=br["[object String]"]=br["[object WeakMap]"]=!1;var oJ=function(t){return wa(t)&&Dm(t.length)&&!!br[ao(t)]},nv=function(t){return function(e){return t(e)}},lu=Om(function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,a=n&&n.exports===r&&hk.process,i=function(){try{var o=n&&n.require&&n.require("util").types;return o||a&&a.binding&&a.binding("util")}catch{}}();t.exports=i}),y_=lu&&lu.isTypedArray,yl=y_?nv(y_):oJ,sJ=Object.prototype.hasOwnProperty,pk=function(t,e){var r=Pr(t),n=!r&&fu(t),a=!r&&!n&&qo(t),i=!r&&!n&&!a&&yl(t),o=r||n||a||i,s=o?tJ(t.length,String):[],u=s.length;for(var f in t)!e&&!sJ.call(t,f)||o&&(f=="length"||a&&(f=="offset"||f=="parent")||i&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||rv(f,u))||s.push(f);return s},uJ=Object.prototype,av=function(t){var e=t&&t.constructor;return t===(typeof e=="function"&&e.prototype||uJ)},gk=function(t,e){return function(r){return t(e(r))}},fJ=gk(Object.keys,Object),lJ=Object.prototype.hasOwnProperty,Pm=function(t){if(!av(t))return fJ(t);var e=[];for(var r in Object(t))lJ.call(t,r)&&r!="constructor"&&e.push(r);return e},Ei=function(t){return t!=null&&Dm(t.length)&&!pl(t)},io=function(t){return Ei(t)?pk(t):Pm(t)},cJ=function(t,e){return t&&gl(e,io(e),t)},hJ=function(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e},dJ=Object.prototype.hasOwnProperty,vJ=function(t){if(!Dn(t))return hJ(t);var e=av(t),r=[];for(var n in t)(n!="constructor"||!e&&dJ.call(t,n))&&r.push(n);return r},ts=function(t){return Ei(t)?pk(t,!0):vJ(t)},pJ=function(t,e){return t&&gl(e,ts(e),t)},yk=Om(function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,a=n&&n.exports===r?_a.Buffer:void 0,i=a?a.allocUnsafe:void 0;t.exports=function(o,s){if(s)return o.slice();var u=o.length,f=i?i(u):new o.constructor(u);return o.copy(f),f}}),mk=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++rs))return!1;var f=i.get(t),l=i.get(e);if(f&&l)return f==e&&l==t;var c=-1,h=!0,d=2&r?new kk:void 0;for(i.set(t,e),i.set(e,t);++c0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Aee),fv=function(t,e){return Zk(Hk(t,e,rs),t+"")},Kk=function(t,e,r,n){for(var a=t.length,i=r+-1;++i-1},Oee=function(){},Lee=Ys&&1/Um(new Ys([,-0]))[1]==1/0?function(t){return new Ys(t)}:Oee,Dee=function(t,e,r){var n=-1,a=Nee,i=t.length,o=!0,s=[],u=s;if(i>=200){var f=Lee(t);if(f)return Um(f);o=!1,a=Nk,u=new kk}else u=s;e:for(;++ni){var o=a;a=i,i=o}return a+""+i+""+(ot.isUndefined(n)?"\0":n)}function Fee(t,e,r,n){var a=""+e,i=""+r;if(!t&&a>i){var o=a;a=i,i=o}var s={v:a,w:i};return n&&(s.name=n),s}function n0(t,e){return yf(t,e.v,e.w,e.name)}tr.prototype._nodeCount=0,tr.prototype._edgeCount=0,tr.prototype.isDirected=function(){return this._isDirected},tr.prototype.isMultigraph=function(){return this._isMultigraph},tr.prototype.isCompound=function(){return this._isCompound},tr.prototype.setGraph=function(t){return this._label=t,this},tr.prototype.graph=function(){return this._label},tr.prototype.setDefaultNodeLabel=function(t){return ot.isFunction(t)||(t=ot.constant(t)),this._defaultNodeLabelFn=t,this},tr.prototype.nodeCount=function(){return this._nodeCount},tr.prototype.nodes=function(){return ot.keys(this._nodes)},tr.prototype.sources=function(){var t=this;return ot.filter(this.nodes(),function(e){return ot.isEmpty(t._in[e])})},tr.prototype.sinks=function(){var t=this;return ot.filter(this.nodes(),function(e){return ot.isEmpty(t._out[e])})},tr.prototype.setNodes=function(t,e){var r=arguments,n=this;return ot.each(t,function(a){r.length>1?n.setNode(a,e):n.setNode(a)}),this},tr.prototype.setNode=function(t,e){return ot.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},tr.prototype.node=function(t){return this._nodes[t]},tr.prototype.hasNode=function(t){return ot.has(this._nodes,t)},tr.prototype.removeNode=function(t){var e=this;if(ot.has(this._nodes,t)){var r=function(n){e.removeEdge(e._edgeObjs[n])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],ot.each(this.children(t),function(n){e.setParent(n)}),delete this._children[t]),ot.each(ot.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],ot.each(ot.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},tr.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ot.isUndefined(e))e="\0";else{for(var r=e+="";!ot.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},tr.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},tr.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!=="\0")return e}},tr.prototype.children=function(t){if(ot.isUndefined(t)&&(t="\0"),this._isCompound){var e=this._children[t];if(e)return ot.keys(e)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}},tr.prototype.predecessors=function(t){var e=this._preds[t];if(e)return ot.keys(e)},tr.prototype.successors=function(t){var e=this._sucs[t];if(e)return ot.keys(e)},tr.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return ot.union(e,this.successors(t))},tr.prototype.isLeaf=function(t){return(this.isDirected()?this.successors(t):this.neighbors(t)).length===0},tr.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;ot.each(this._nodes,function(i,o){t(o)&&e.setNode(o,i)}),ot.each(this._edgeObjs,function(i){e.hasNode(i.v)&&e.hasNode(i.w)&&e.setEdge(i,r.edge(i))});var n={};function a(i){var o=r.parent(i);return o===void 0||e.hasNode(o)?(n[i]=o,o):o in n?n[o]:a(o)}return this._isCompound&&ot.each(e.nodes(),function(i){e.setParent(i,a(i))}),e},tr.prototype.setDefaultEdgeLabel=function(t){return ot.isFunction(t)||(t=ot.constant(t)),this._defaultEdgeLabelFn=t,this},tr.prototype.edgeCount=function(){return this._edgeCount},tr.prototype.edges=function(){return ot.values(this._edgeObjs)},tr.prototype.setPath=function(t,e){var r=this,n=arguments;return ot.reduce(t,function(a,i){return n.length>1?r.setEdge(a,i,e):r.setEdge(a,i),i}),this},tr.prototype.setEdge=function(){var t,e,r,n,a=!1,i=arguments[0];typeof i=="object"&&i!==null&&"v"in i?(t=i.v,e=i.w,r=i.name,arguments.length===2&&(n=arguments[1],a=!0)):(t=i,e=arguments[1],r=arguments[3],arguments.length>2&&(n=arguments[2],a=!0)),t=""+t,e=""+e,ot.isUndefined(r)||(r=""+r);var o=yf(this._isDirected,t,e,r);if(ot.has(this._edgeLabels,o))return a&&(this._edgeLabels[o]=n),this;if(!ot.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[o]=a?n:this._defaultEdgeLabelFn(t,e,r);var s=Fee(this._isDirected,t,e,r);return t=s.v,e=s.w,Object.freeze(s),this._edgeObjs[o]=s,O_(this._preds[e],t),O_(this._sucs[t],e),this._in[e][o]=s,this._out[t][o]=s,this._edgeCount++,this},tr.prototype.edge=function(t,e,r){var n=arguments.length===1?n0(this._isDirected,arguments[0]):yf(this._isDirected,t,e,r);return this._edgeLabels[n]},tr.prototype.hasEdge=function(t,e,r){var n=arguments.length===1?n0(this._isDirected,arguments[0]):yf(this._isDirected,t,e,r);return ot.has(this._edgeLabels,n)},tr.prototype.removeEdge=function(t,e,r){var n=arguments.length===1?n0(this._isDirected,arguments[0]):yf(this._isDirected,t,e,r),a=this._edgeObjs[n];return a&&(t=a.v,e=a.w,delete this._edgeLabels[n],delete this._edgeObjs[n],L_(this._preds[e],t),L_(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},tr.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var n=ot.values(r);return e?ot.filter(n,function(a){return a.v===e}):n}},tr.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var n=ot.values(r);return e?ot.filter(n,function(a){return a.w===e}):n}},tr.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))};var D_={Graph:Vm,version:"2.1.8"},Bee={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:Gee(t),edges:zee(t)};return ot.isUndefined(t.graph())||(e.value=ot.clone(t.graph())),e},read:function(t){var e=new Vm(t.options).setGraph(t.value);return ot.each(t.nodes,function(r){e.setNode(r.v,r.value),r.parent&&e.setParent(r.v,r.parent)}),ot.each(t.edges,function(r){e.setEdge({v:r.v,w:r.w,name:r.name},r.value)}),e}};function Gee(t){return ot.map(t.nodes(),function(e){var r=t.node(e),n=t.parent(e),a={v:e};return ot.isUndefined(r)||(a.value=r),ot.isUndefined(n)||(a.parent=n),a})}function zee(t){return ot.map(t.edges(),function(e){var r=t.edge(e),n={v:e.v,w:e.w};return ot.isUndefined(e.name)||(n.name=e.name),ot.isUndefined(r)||(n.value=r),n})}var jee=function(t){var e,r={},n=[];function a(i){ot.has(r,i)||(r[i]=!0,e.push(i),ot.each(t.successors(i),a),ot.each(t.predecessors(i),a))}return ot.each(t.nodes(),function(i){e=[],a(i),e.length&&n.push(e)}),n},eN=Qn;function Qn(){this._arr=[],this._keyIndices={}}Qn.prototype.size=function(){return this._arr.length},Qn.prototype.keys=function(){return this._arr.map(function(t){return t.key})},Qn.prototype.has=function(t){return ot.has(this._keyIndices,t)},Qn.prototype.priority=function(t){var e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority},Qn.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},Qn.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!ot.has(r,t)){var n=this._arr,a=n.length;return r[t]=a,n.push({key:t,priority:e}),this._decrease(a),!0}return!1},Qn.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},Qn.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},Qn.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,a=t;r>1].priority0&&(u=c.removeMin(),(f=l[u]).distance!==Number.POSITIVE_INFINITY);)s(u).forEach(h);return l}(t,String(e),r||Uee,n||function(a){return t.outEdges(a)})},Uee=ot.constant(1),$ee=function(t,e,r){return ot.transform(t.nodes(),function(n,a){n[a]=tN(t,a,e,r)},{})},rN=function(t){var e=0,r=[],n={},a=[];function i(o){var s=n[o]={onStack:!0,lowlink:e,index:e++};if(r.push(o),t.successors(o).forEach(function(l){ot.has(n,l)?n[l].onStack&&(s.lowlink=Math.min(s.lowlink,n[l].index)):(i(l),s.lowlink=Math.min(s.lowlink,n[l].lowlink))}),s.lowlink===s.index){var u,f=[];do u=r.pop(),n[u].onStack=!1,f.push(u);while(o!==u);a.push(f)}}return t.nodes().forEach(function(o){ot.has(n,o)||i(o)}),a},Xee=function(t){return ot.filter(rN(t),function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})},Wee=function(t,e,r){return function(n,a,i){var o={},s=n.nodes();return s.forEach(function(u){o[u]={},o[u][u]={distance:0},s.forEach(function(f){u!==f&&(o[u][f]={distance:Number.POSITIVE_INFINITY})}),i(u).forEach(function(f){var l=f.v===u?f.w:f.v,c=a(f);o[u][l]={distance:c,predecessor:u}})}),s.forEach(function(u){var f=o[u];s.forEach(function(l){var c=o[l];s.forEach(function(h){var d=c[u],v=f[h],p=c[h],g=d.distance+v.distance;g0;){if(r=i.removeMin(),ot.has(a,r))n.setEdge(r,a[r]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(r).forEach(o)}return n},tarjan:rN,topsort:a0},version:D_.version};try{id=Yee}catch{}id||(id=window.graphlib);var Sa=id,qee=function(t){return Ak(t,5)},Hf=function(t,e,r){if(!Dn(r))return!1;var n=typeof e;return!!(n=="number"?Ei(r)&&rv(e,r.length):n=="string"&&e in r)&&wu(r[e],t)},iN=Object.prototype,Hee=iN.hasOwnProperty,Zee=fv(function(t,e){t=Object(t);var r=-1,n=e.length,a=n>2?e[2]:void 0;for(a&&Hf(e[0],e[1],a)&&(n=1);++r-1?a[i?e[o]:o]:void 0}},Qee=/^\s+|\s+$/g,Jee=/^[-+]0x[0-9a-f]+$/i,ete=/^0b[01]+$/i,tte=/^0o[0-7]+$/i,rte=parseInt,nte=function(t){if(typeof t=="number")return t;if(Zo(t))return NaN;if(Dn(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Dn(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=t.replace(Qee,"");var r=ete.test(t);return r||tte.test(t)?rte(t.slice(2),r?2:8):Jee.test(t)?NaN:+t},gh=function(t){return t?(t=nte(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:t===0?t:0},ate=function(t){var e=gh(t),r=e%1;return e==e?r?e-r:e:0},ite=Math.max,ote=Kee(function(t,e,r){var n=t==null?0:t.length;if(!n)return-1;var a=r==null?0:ate(r);return a<0&&(a=ite(n+a,0)),Kk(t,_i(e),a)}),oN=function(t){return t!=null&&t.length?Wm(t):[]},ste=function(t,e){return t==null?t:zm(t,Ck(e),ts)},ute=function(t){var e=t==null?0:t.length;return e?t[e-1]:void 0},fte=function(t,e){var r={};return e=_i(e),jm(t,function(n,a,i){ev(r,a,e(n,a,i))}),r},Ym=function(t,e,r){for(var n=-1,a=t.length;++ne},cte=function(t){return t&&t.length?Ym(t,rs,lte):void 0},Rg=function(t,e,r){(r!==void 0&&!wu(t[e],r)||r===void 0&&!(e in t))&&ev(t,e,r)},hte=Function.prototype,dte=Object.prototype,sN=hte.toString,vte=dte.hasOwnProperty,pte=sN.call(Object),gte=function(t){if(!wa(t)||ao(t)!="[object Object]")return!1;var e=iv(t);if(e===null)return!0;var r=vte.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&sN.call(r)==pte},R_=function(t,e){if((e!=="constructor"||typeof t[e]!="function")&&e!="__proto__")return t[e]},yte=function(t){return gl(t,ts(t))},mte=function(t,e,r,n,a,i,o){var s=R_(t,r),u=R_(e,r),f=o.get(u);if(f)Rg(t,r,f);else{var l=void 0,c=l===void 0;if(c){var h=Pr(u),d=!h&&qo(u),v=!h&&!d&&yl(u);l=u,h||d||v?Pr(s)?l=s:Qk(s)?l=mk(s):d?(c=!1,l=yk(u,!0)):v?(c=!1,l=_k(u,!0)):l=[]:gte(u)||fu(u)?(l=s,fu(s)?l=yte(s):Dn(s)&&!pl(s)||(l=Mk(u))):c=!1}c&&(o.set(u,l),a(l,u,n,i,o),o.delete(u)),Rg(t,r,l)}},bte=function t(e,r,n,a,i){e!==r&&zm(r,function(o,s){if(i||(i=new Vs),Dn(o))mte(e,r,s,n,t,a,i);else{var u=void 0;u===void 0&&(u=o),Rg(e,s,u)}},ts)},wte=function(t){return fv(function(e,r){var n=-1,a=r.length,i=a>1?r[a-1]:void 0,o=a>2?r[2]:void 0;for(i=t.length>3&&typeof i=="function"?(a--,i):void 0,o&&Hf(r[0],r[1],o)&&(i=a<3?void 0:i,a=1),e=Object(e);++ne||i&&o&&u&&!s&&!f||n&&o&&u||!r&&u||!a)return 1;if(!n&&!i&&!f&&t=s?u:u*(r[n]=="desc"?-1:1)}return t.index-e.index},Pte=function(t,e,r){e=e.length?qs(e,function(i){return Pr(i)?function(o){return uv(o,i.length===1?i[0]:i)}:i}):[rs];var n=-1;e=qs(e,nv(_i));var a=$k(t,function(i,o,s){return{criteria:qs(e,function(u){return u(i)}),index:++n,value:i}});return Ote(a,function(i,o){return Dte(i,o,r)})},Rte=fv(function(t,e){if(t==null)return[];var r=e.length;return r>1&&Hf(t,e[0],e[1])?e=[]:r>2&&Hf(e[0],e[1],e[2])&&(e=[e[0]]),Pte(t,Wm(e),[])}),Fte=0,Bte=function(t){var e=++Fte;return Rk(t)+e},Gte=function(t,e,r){for(var n=-1,a=t.length,i=e.length,o={};++n0;--c)if(s=i[c].dequeue()){u=u.concat(i0(a,i,o,s,!0));break}}}return u}(r.graph,r.buckets,r.zeroIdx);return Z.flatten(Z.map(n,function(a){return t.outEdges(a.v,a.w)}),!0)},Wte=Z.constant(1);function i0(t,e,r,n,a){var i=a?[]:void 0;return Z.forEach(t.inEdges(n.v),function(o){var s=t.edge(o),u=t.node(o.v);a&&i.push({v:o.v,w:o.w}),u.out-=s,Fg(e,r,u)}),Z.forEach(t.outEdges(n.v),function(o){var s=t.edge(o),u=o.w,f=t.node(u);f.in-=s,Fg(e,r,f)}),t.removeNode(n.v),i}function Fg(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}var B_={run:function(t){var e=t.graph().acyclicer==="greedy"?Xte(t,function(r){return function(n){return r.edge(n).weight}}(t)):function(r){var n=[],a={},i={};function o(s){Z.has(i,s)||(i[s]=!0,a[s]=!0,Z.forEach(r.outEdges(s),function(u){Z.has(a,u.w)?n.push(u):o(u.w)}),delete a[s])}return Z.forEach(r.nodes(),o),n}(t);Z.forEach(e,function(r){var n=t.edge(r);t.removeEdge(r),n.forwardName=r.name,n.reversed=!0,t.setEdge(r.w,r.v,n,Z.uniqueId("rev"))})},undo:function(t){Z.forEach(t.edges(),function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}})}},G_=Sa.Graph,Mn={addDummyNode:z_,simplify:function(t){var e=new G_().setGraph(t.graph());return Z.forEach(t.nodes(),function(r){e.setNode(r,t.node(r))}),Z.forEach(t.edges(),function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},a=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+a.weight,minlen:Math.max(n.minlen,a.minlen)})}),e},asNonCompoundGraph:function(t){var e=new G_({multigraph:t.isMultigraph()}).setGraph(t.graph());return Z.forEach(t.nodes(),function(r){t.children(r).length||e.setNode(r,t.node(r))}),Z.forEach(t.edges(),function(r){e.setEdge(r,t.edge(r))}),e},successorWeights:function(t){var e=Z.map(t.nodes(),function(r){var n={};return Z.forEach(t.outEdges(r),function(a){n[a.w]=(n[a.w]||0)+t.edge(a).weight}),n});return Z.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=Z.map(t.nodes(),function(r){var n={};return Z.forEach(t.inEdges(r),function(a){n[a.v]=(n[a.v]||0)+t.edge(a).weight}),n});return Z.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,a=t.x,i=t.y,o=e.x-a,s=e.y-i,u=t.width/2,f=t.height/2;if(!o&&!s)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*u>Math.abs(o)*f?(s<0&&(f=-f),r=f*o/s,n=f):(o<0&&(u=-u),r=u,n=u*s/o),{x:a+r,y:i+n}},buildLayerMatrix:function(t){var e=Z.map(Z.range(j_(t)+1),function(){return[]});return Z.forEach(t.nodes(),function(r){var n=t.node(r),a=n.rank;Z.isUndefined(a)||(e[a][n.order]=r)}),e},normalizeRanks:function(t){var e=Z.min(Z.map(t.nodes(),function(r){return t.node(r).rank}));Z.forEach(t.nodes(),function(r){var n=t.node(r);Z.has(n,"rank")&&(n.rank-=e)})},removeEmptyRanks:function(t){var e=Z.min(Z.map(t.nodes(),function(i){return t.node(i).rank})),r=[];Z.forEach(t.nodes(),function(i){var o=t.node(i).rank-e;r[o]||(r[o]=[]),r[o].push(i)});var n=0,a=t.graph().nodeRankFactor;Z.forEach(r,function(i,o){Z.isUndefined(i)&&o%a!=0?--n:n&&Z.forEach(i,function(s){t.node(s).rank+=n})})},addBorderNode:function(t,e,r,n){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=n),z_(t,"border",a,e)},maxRank:j_,partition:function(t,e){var r={lhs:[],rhs:[]};return Z.forEach(t,function(n){e(n)?r.lhs.push(n):r.rhs.push(n)}),r},time:function(t,e){var r=Z.now();try{return e()}finally{console.log(t+" time: "+(Z.now()-r)+"ms")}},notime:function(t,e){return e()}};function z_(t,e,r,n){var a;do a=Z.uniqueId(n);while(t.hasNode(a));return r.dummy=e,t.setNode(a,r),a}function j_(t){return Z.max(Z.map(t.nodes(),function(e){var r=t.node(e).rank;if(!Z.isUndefined(r))return r}))}var U_={run:function(t){t.graph().dummyChains=[],Z.forEach(t.edges(),function(e){(function(r,n){var a,i,o,s=n.v,u=r.node(s).rank,f=n.w,l=r.node(f).rank,c=n.name,h=r.edge(n),d=h.labelRank;if(l!==u+1){for(r.removeEdge(n),o=0,++u;uo.lim&&(s=o,u=!0);var f=Z.filter(e.edges(),function(l){return u===$_(t,t.node(l.v),s)&&u!==$_(t,t.node(l.w),s)});return Z.minBy(f,function(l){return Zte(e,l)})}function gN(t,e,r,n){var a=r.v,i=r.w;t.removeEdge(a,i),t.setEdge(n.v,n.w,{}),Hm(t),qm(t,e),function(o,s){var u=Z.find(o.nodes(),function(l){return!s.node(l).parent}),f=Qte(o,u);f=f.slice(1),Z.forEach(f,function(l){var c=o.node(l).parent,h=s.edge(l,c),d=!1;h||(h=s.edge(c,l),d=!0),s.node(l).rank=s.node(c).rank+(d?h.minlen:-h.minlen)})}(t,e)}function $_(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}Lo.initLowLimValues=Hm,Lo.initCutValues=qm,Lo.calcCutValue=hN,Lo.leaveEdge=vN,Lo.enterEdge=pN,Lo.exchangeEdges=gN;var yN=fN,rre=function(t){switch(t.graph().ranker){case"network-simplex":X_(t);break;case"tight-tree":(function(e){yN(e),cN(e)})(t);break;case"longest-path":nre(t);break;default:X_(t)}},nre=yN;function X_(t){tre(t)}var are=function(t){var e=function(r){var n={},a=0;function i(o){var s=a;Z.forEach(r.children(o),i),n[o]={low:s,lim:a++}}return Z.forEach(r.children(),i),n}(t);Z.forEach(t.graph().dummyChains,function(r){for(var n=t.node(r),a=n.edgeObj,i=function(c,h,d,v){var p,g,y=[],m=[],b=Math.min(h[d].low,h[v].low),w=Math.max(h[d].lim,h[v].lim);p=d;do p=c.parent(p),y.push(p);while(p&&(h[p].low>b||w>h[p].lim));for(g=p,p=v;(p=c.parent(p))!==g;)m.push(p);return{path:y.concat(m.reverse()),lca:g}}(t,e,a.v,a.w),o=i.path,s=i.lca,u=0,f=o[u],l=!0;r!==a.w;){if(n=t.node(r),l){for(;(f=o[u])!==s&&t.node(f).maxRank0;)l%2&&(c+=s[l+1]),s[l=l-1>>1]+=f.weight;u+=f.weight*c})),u}var fre=function(t,e){return Z.map(e,function(r){var n=t.inEdges(r);if(n.length){var a=Z.reduce(n,function(i,o){var s=t.edge(o),u=t.node(o.v);return{sum:i.sum+s.weight*u.order,weight:i.weight+s.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}return{v:r}})},lre=function(t,e){var r={};return Z.forEach(t,function(n,a){var i=r[n.v]={indegree:0,in:[],out:[],vs:[n.v],i:a};Z.isUndefined(n.barycenter)||(i.barycenter=n.barycenter,i.weight=n.weight)}),Z.forEach(e.edges(),function(n){var a=r[n.v],i=r[n.w];Z.isUndefined(a)||Z.isUndefined(i)||(i.indegree++,a.out.push(r[n.w]))}),function(n){var a=[];function i(u){return function(f){f.merged||(Z.isUndefined(f.barycenter)||Z.isUndefined(u.barycenter)||f.barycenter>=u.barycenter)&&function(l,c){var h=0,d=0;l.weight&&(h+=l.barycenter*l.weight,d+=l.weight),c.weight&&(h+=c.barycenter*c.weight,d+=c.weight),l.vs=c.vs.concat(l.vs),l.barycenter=h/d,l.weight=d,l.i=Math.min(c.i,l.i),c.merged=!0}(u,f)}}function o(u){return function(f){f.in.push(u),--f.indegree==0&&n.push(f)}}for(;n.length;){var s=n.pop();a.push(s),Z.forEach(s.in.reverse(),i(s)),Z.forEach(s.out,o(s))}return Z.map(Z.filter(a,function(u){return!u.merged}),function(u){return Z.pick(u,["vs","i","barycenter","weight"])})}(Z.filter(r,function(n){return!n.indegree}))},cre=function(t,e){var r=Mn.partition(t,function(c){return Z.has(c,"barycenter")}),n=r.lhs,a=Z.sortBy(r.rhs,function(c){return-c.i}),i=[],o=0,s=0,u=0;n.sort((f=!!e,function(c,h){return c.barycenterh.barycenter?1:f?h.i-c.i:c.i-h.i})),u=Z_(i,a,u),Z.forEach(n,function(c){u+=c.vs.length,i.push(c.vs),o+=c.barycenter*c.weight,s+=c.weight,u=Z_(i,a,u)});var f,l={vs:Z.flatten(i,!0)};return s&&(l.barycenter=o/s,l.weight=s),l};function Z_(t,e,r){for(var n;e.length&&(n=Z.last(e)).i<=r;)e.pop(),t.push(n.vs),r++;return r}var hre=function t(e,r,n,a){var i=e.children(r),o=e.node(r),s=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};s&&(i=Z.filter(i,function(p){return p!==s&&p!==u}));var l=fre(e,i);Z.forEach(l,function(p){if(e.children(p.v).length){var g=t(e,p.v,n,a);f[p.v]=g,Z.has(g,"barycenter")&&(y=p,m=g,Z.isUndefined(y.barycenter)?(y.barycenter=m.barycenter,y.weight=m.weight):(y.barycenter=(y.barycenter*y.weight+m.barycenter*m.weight)/(y.weight+m.weight),y.weight+=m.weight))}var y,m});var c=lre(l,n);(function(p,g){Z.forEach(p,function(y){y.vs=Z.flatten(y.vs.map(function(m){return g[m]?g[m].vs:m}),!0)})})(c,f);var h=cre(c,a);if(s&&(h.vs=Z.flatten([s,h.vs,u],!0),e.predecessors(s).length)){var d=e.node(e.predecessors(s)[0]),v=e.node(e.predecessors(u)[0]);Z.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+d.order+v.order)/(h.weight+2),h.weight+=2}return h},dre=Sa.Graph,vre=function(t,e,r){var n=function(i){for(var o;i.hasNode(o=Z.uniqueId("_root")););return o}(t),a=new dre({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(i){return t.node(i)});return Z.forEach(t.nodes(),function(i){var o=t.node(i),s=t.parent(i);(o.rank===e||o.minRank<=e&&e<=o.maxRank)&&(a.setNode(i),a.setParent(i,s||n),Z.forEach(t[r](i),function(u){var f=u.v===i?u.w:u.v,l=a.edge(f,i),c=Z.isUndefined(l)?0:l.weight;a.setEdge(f,i,{weight:t.edge(u).weight+c})}),Z.has(o,"minRank")&&a.setNode(i,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))}),a},pre=function(t,e,r){var n,a={};Z.forEach(r,function(i){for(var o,s,u=t.parent(i);u;){if((o=t.parent(u))?(s=a[o],a[o]=u):(s=n,n=u),s&&s!==u)return void e.setEdge(s,u);u=o}})},gre=Sa.Graph,yre=function(t){var e=Mn.maxRank(t),r=K_(t,Z.range(1,e+1),"inEdges"),n=K_(t,Z.range(e-1,-1,-1),"outEdges"),a=ore(t);Q_(t,a);for(var i,o=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){mre(s%2?r:n,s%4>=2),a=Mn.buildLayerMatrix(t);var f=sre(t,a);fu)&&bN(r,c,f)})})}return Z.reduce(e,function(a,i){var o,s=-1,u=0;return Z.forEach(i,function(f,l){if(t.node(f).dummy==="border"){var c=t.predecessors(f);c.length&&(o=t.node(c[0]).order,n(i,u,l,s,o),u=l,s=o)}n(i,u,i.length,o,a.length)}),i}),r}function bN(t,e,r){if(e>r){var n=e;e=r,r=n}var a=t[e];a||(t[e]=a={}),a[r]=!0}function _re(t,e,r){if(e>r){var n=e;e=r,r=n}return Z.has(t[e],r)}function Sre(t,e,r,n){var a={},i={},o={};return Z.forEach(e,function(s){Z.forEach(s,function(u,f){a[u]=u,i[u]=u,o[u]=f})}),Z.forEach(e,function(s){var u=-1;Z.forEach(s,function(f){var l=n(f);if(l.length)for(var c=((l=Z.sortBy(l,function(p){return o[p]})).length-1)/2,h=Math.floor(c),d=Math.ceil(c);h<=d;++h){var v=l[h];i[f]===f&&unew Wre(r)).forEach(r=>{e.nodes[r.name]=r,r.inputs.forEach(n=>{(function(a,i,o){o.name!==i.name&&a.edges.push(Object.assign(Object.assign({},o.attr),{v:o.name,w:i.name}))})(e,r,n)})}),e}class qre{constructor(e,r={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=Yo.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=kn.META,this.path=[],this.name=e,this.metaGraph=Zm(e,uu.META,r)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map(e=>this.metaGraph.node(e))}leaves(){let e,r=[],n=[this];for(;n.length;){let a=n.shift();a.isGroupNode?(e=a.metaGraph,e.nodes().forEach(i=>n.push(e.node(i)))):r.push(a.name)}return r}}class Hre{constructor(e,r){this.v=e,this.w=r,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(e,r){this.baseEdgeList.push(e)}}function xN(t,e={}){return new qre(t,e)}function EN(t,e){return new Hre(t,e)}function Zm(t,e,r){const n=r||{},a=new $re.Graph(n);return a.setGraph({name:t,rankdir:n.rankdir,type:e,align:n.align}),a}class Zre{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=xN(su,this.graphOptions),this.index[su]=this.root}getNodeMap(){return this.index}node(e){return this.index[e]}setNode(e,r){this.index[e]=r}getBridgeGraph(e){const r=this.index[e];if(!r)throw Error("Could not find node in hierarchy: "+e);if(!("metaGraph"in r))return null;const n=r;if(n.bridgeGraph)return n.bridgeGraph;const a=Zm(ck,uu.BRIDGE,this.graphOptions);if(n.bridgeGraph=a,!r.parentNode||!("metaGraph"in r.parentNode))return a;const i=r.parentNode;return[i.metaGraph,this.getBridgeGraph(i.name)].forEach(o=>{o.edges().filter(s=>s.v===e||s.w===e).forEach(s=>{const u=s.w===e;o.edge(s).baseEdgeList.forEach(f=>{const[l,c]=u?[f.w,s.v]:[f.v,s.w],h=this.getChildName(e,l),d={v:u?c:h,w:u?h:c};let v=a.edge(d);v||(v=EN(d.v,d.w),v.inbound=u,a.setEdge(d.v,d.w,v)),v.addBaseEdge(f,this)})})}),a}getChildName(e,r){let n=this.index[r];for(;n;){if(n.parentNode&&n.parentNode.name===e)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+r)}getPredecessors(e){const r=this.index[e];if(!r)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(r,!0)}getSuccessors(e){const r=this.index[e];if(!r)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(r,!1)}getOneWayEdges(e,r){const n=[];if(!e.parentNode||!e.parentNode.isGroupNode)return n;const a=e.parentNode,i=a.metaGraph,o=this.getBridgeGraph(a.name);return J_(i,e,r,n),J_(o,e,r,n),n}}function Kre(t,e){const{rankDirection:r,align:n}=e,a=new Zre({rankdir:r,align:n});return function(i,o){Object.keys(o.nodes).forEach(s=>{const u=o.nodes[s],f=u.path;let l=i.root;l.depth=Math.max(f.length,l.depth);for(let c=0;c{let d=0;for(;c;)h[d++]=c.name,c=c.parentNode;return d-1};o.edges.forEach(c=>{u=[],f=[];let h=l(o.nodes[c.v],u),d=l(o.nodes[c.w],f);for(;u[h]===f[d];)if(h--,d--,h<0||d<0)throw Error("No difference found between ancestor paths.");const v=s[u[h+1]],p=u[h],g=f[d];let y=v.metaGraph.edge(p,g);y||(y=EN(p,g),v.metaGraph.setEdge(p,g,y)),y.addBaseEdge(c,i)})}(a,t),a}function J_(t,e,r,n){(r?t.inEdges(e.name):t.outEdges(e.name)).forEach(a=>{const i=t.edge(a);n.push(i)})}class Qre{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new t2(this.hierarchy.root,this.hierarchy.graphOptions),this.index[e.root.name]=this.root,this.buildSubHierarchy(e.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(e){if(e in this.hasSubHierarchy)return;this.hasSubHierarchy[e]=!0;const r=this.index[e];if(r.node.type!==kn.META)return;const n=r,a=n.node.metaGraph,i=n.coreGraph;a.nodes().forEach(l=>{const c=this.getOrCreateRenderNodeByName(l);i.setNode(l,c)}),a.edges().forEach(l=>{const c=a.edge(l),h=new e2(c);i.setEdge(l.v,l.w,h)});const o=n.node.parentNode;if(!o)return;const s=this.getRenderNodeByName(o.name),u=(l,...c)=>c.concat([l?"IN":"OUT"]).join("~~"),f=this.hierarchy.getBridgeGraph(e);f.edges().forEach(l=>{const c=f.edge(l),h=!!a.node(l.w),[d,v]=h?[l.w,l.v]:[l.v,l.w],p=x=>{const E=h?{v:x,w:e}:{v:e,w:x};return s.coreGraph.edge(E)};let g=p(v);g||(g=p(u(h,v,o.name)));const y=u(h,e),m=u(h,v,e);let b=i.node(m);if(!b){let x=i.node(y);if(!x){const _={name:y,type:kn.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:Yo.UNSPECIFIED,inbound:h,attr:{}};x=new mh(_),this.index[y]=x,i.setNode(y,x)}const E={name:m,type:kn.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:Yo.UNSPECIFIED,inbound:h,attr:{}};b=new mh(E),this.index[m]=b,i.setNode(m,b),i.setParent(m,y),x.node.cardinality++}const w=new e2(c);w.adjoiningMetaEdge=g,h?i.setEdge(m,d,w):i.setEdge(d,m,w)})}getOrCreateRenderNodeByName(e){if(!e)return null;if(e in this.index)return this.index[e];const r=this.getNodeByName(e);return r?(this.index[e]=r.isGroupNode?new t2(r,this.hierarchy.graphOptions):new mh(r),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class mh{constructor(e){this.node=e,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=e.width||0,this.height=e.height||0,this.displayName=e.name,this.attr=e.attr}}class e2{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class t2 extends mh{constructor(e,r){super(e);const n=e.metaGraph.graph();r.compound=!0,this.coreGraph=Zm(n.name,uu.CORE,r)}}function _N(t,e){t.node.isGroupNode&&function(r,n){const a=Tg(n);r.coreGraph.nodes().map(i=>r.coreGraph.node(i)).forEach(i=>{var o,s,u,f,l,c;const{height:h,width:d}=i;switch(i.node.type){case kn.NODE:Object.assign(i,a.nodeSize.node),i.height=h||a.nodeSize.node.height,i.width=d||a.nodeSize.node.width;break;case kn.BRIDGE:Object.assign(i,a.nodeSize.bridge);break;case kn.META:i.expanded?_N(i,n):(Object.assign(i,a.nodeSize.meta),i.height=a.nodeSize.meta.height,i.width=a.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+i.node.type)}if(!i.expanded){const v=i.attr;(function(p,g=!1){if(p.coreBox.width=p.width,p.coreBox.height=p.height,!g){const y=`${p.displayName}`.length,m=3;p.width=Math.max(p.coreBox.width,y*m)}})(i,n&&(i.node.type===0&&!!(!((s=(o=n==null?void 0:n.nodeSize)===null||o===void 0?void 0:o.meta)===null||s===void 0)&&s.width)||i.node.type===1&&(!!(!((f=(u=n==null?void 0:n.nodeSize)===null||u===void 0?void 0:u.node)===null||f===void 0)&&f.width)||!!v.width)||i.node.type===2&&!!(!((c=(l=n==null?void 0:n.nodeSize)===null||l===void 0?void 0:l.bridge)===null||c===void 0)&&c.width)))}})}(t,e),t.node.type===kn.META&&function(r,n){const a=Tg(n),i=a.subScene.meta;Object.assign(r,i);const{nodeSep:o,rankSep:s,edgeSep:u,align:f}=a.graph.meta,l={nodesep:o,ranksep:s,edgesep:u,align:f};Object.assign(r.coreBox,function(d,v){const{ranksep:p,nodesep:g,edgesep:y,align:m}=v;Object.assign(d.graph(),{ranksep:p,nodesep:g,edgesep:y,align:m});const b=[];if(d.nodes().forEach(S=>{d.node(S).node.type!==kn.BRIDGE&&b.push(S)}),!b.length)return{width:0,height:0};Xre(d);let w=1/0,x=1/0,E=-1/0,_=-1/0;return b.forEach(S=>{const A=d.node(S),M=.5*A.width,C=A.x-M,I=A.x+M;w=CE?I:E;const k=.5*A.height,O=A.y-k,B=A.y+k;x=O_?B:_}),d.edges().forEach(S=>{const A=d.edge(S),M=d.node(A.metaEdge.v),C=d.node(A.metaEdge.w);if(A.points.length===3&&function(O){let B=r2(O[0],O[1]);for(let L=1;L1)return!1;B=z}return!0}(A.points)){if(M!=null){const O=M.expanded?M.x:Bg(M);A.points[0].x=O}if(C!=null){const O=C.expanded?C.x:Bg(C);A.points[2].x=O}A.points=[A.points[0],A.points[1]]}const I=A.points[A.points.length-2];C!=null&&(A.points[A.points.length-1]=n2(I,C));const k=A.points[1];M!=null&&(A.points[0]=n2(k,M)),A.points.forEach(O=>{w=O.xE?O.x:E,x=O.y_?O.y:_})}),d.nodes().forEach(S=>{const A=d.node(S);A.x-=w,A.y-=x}),d.edges().forEach(S=>{d.edge(S).points.forEach(A=>{A.x-=w,A.y-=x})}),{width:E-w,height:_-x}}(r.coreGraph,l));let c=0;r.coreGraph.nodeCount()>0&&c++;const h=c<=1?0:c;r.coreBox.width+=h+h,r.coreBox.height=i.labelHeight+r.coreBox.height,r.width=r.coreBox.width+i.paddingLeft+i.paddingRight,r.height=r.paddingTop+r.coreBox.height+r.paddingBottom}(t,e)}function r2(t,e){const r=e.x-t.x,n=e.y-t.y;return 180*Math.atan(n/r)/Math.PI}function Bg(t){return t.expanded?t.x:t.x-t.width/2+0+t.coreBox.width/2}function n2(t,e){const r=e.expanded?e.x:Bg(e),n=e.y,a=t.x-r,i=t.y-n;let o,s,u=e.expanded?e.width:e.coreBox.width,f=e.expanded?e.height:e.coreBox.height;return Math.abs(i)*u/2>Math.abs(a)*f/2?(i<0&&(f=-f),o=i===0?0:f/2*a/i,s=f/2):(a<0&&(u=-u),o=u/2,s=a===0?0:u/2*i/a),{x:r+o,y:n+s}}function Jre(t,e,r){var n,a,i,o;const s=t.nodes.filter((c,h,d)=>d.findIndex(v=>v.id===c.id)!==h).map(c=>c.id);if(s.length)throw new Error(`Duplicated ids found: ${s.join(", ")}`);const u=function(c){const h={nodes:[]},d=c.compound,v=Object.keys(d||{}),p=new Map,g=(m,b=[])=>{if(p.has(m))return p.get(m);for(let w=0;wc.edges.filter(b=>b.w===m).map(b=>({name:b.v}));return c.nodes.forEach(m=>{const b=m.id,w=[...g(b),b];let x=y(b);h.nodes.push({name:b,path:w,inputs:x,width:m.width,height:m.height,attr:Object.assign({},m)})}),h}(t),f=function(c,h){const d=(p,g)=>{for(let y of g.values())if(y.includes(p))return!0;return!1},v=(p,g=[])=>{if(Object.keys(p).length===0)return[...new Set(g)];const y=new Map(Object.keys(p).map(b=>[b,p[b]])),m={};for(let[b,w]of y)d(b,y)?m[b]=w:g=g.concat(b,w);return v(m,g)};return v(c).filter(p=>h.includes(p))}(t.compound||{},(e==null?void 0:e.expanded)||[]),l=function(c,h){return function(d){return new Qre(d)}(Kre(Yre(c),h))}(u,{rankDirection:((a=(n=r==null?void 0:r.graph)===null||n===void 0?void 0:n.meta)===null||a===void 0?void 0:a.rankDir)||(e==null?void 0:e.rankDirection)||ed.graph.meta.rankDir,align:((o=(i=r==null?void 0:r.graph)===null||i===void 0?void 0:i.meta)===null||o===void 0?void 0:o.align)||ed.graph.meta.align});return function(c,h){h.forEach(d=>{const v=c.getRenderInfoNodes().find(y=>y.displayName===d);let p=v&&v.node&&v.node.name||"";const g=c.getRenderNodeByName(p);if(!g)throw new Error(`No nodes found: ${p}`);g.expanded=!0,c.buildSubHierarchy(p)})}(l,f),_N(l.root,r),SN(l.root)}function ene(t,e=!1){const r=JSON.parse(JSON.stringify(t)),n={nodes:[r],edges:[...r.edges]};return r.nodes.forEach(function a(i){(i.type===0||i.type===1)&&n.nodes.push(i),i.type===0&&(n.edges=n.edges.concat(i.edges)),Array.isArray(i.nodes)&&i.nodes.forEach(a)}),e&&n.nodes.forEach(a=>{const i=n.nodes.find(o=>o.id===a.parentNodeName);if(i){const o=i.x-i.width/2+i.paddingLeft,s=i.y-i.height/2+i.labelHeight+i.paddingTop;i.id!==su&&(a.x+=o,a.y+=s),a.type===0&&a.edges.forEach(u=>{u.points.forEach(f=>{f.x+=a.x-a.width/2+a.paddingLeft,f.y+=a.y-a.height/2+a.labelHeight+a.paddingTop})})}}),n}function tne(t,e,r,n){var a,i;let o=[];const s=((a=r.find(c=>c.id===t))===null||a===void 0?void 0:a.path)||[],u=((i=r.find(c=>c.id===e))===null||i===void 0?void 0:i.path)||[],f=[su,...s].slice(0,s.length).reverse(),l=[su,...u].slice(0,u.length);return f.forEach(c=>{const h=r.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||t)&&v.w===((n==null?void 0:n.w)||e))))}),l.filter(c=>!f.includes(c)).forEach(c=>{const h=r.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||t)&&v.w===((n==null?void 0:n.w)||e))))}),o}function SN(t){const e=t.coreGraph.nodes().map(n=>t.coreGraph.node(n));return Object.assign(Object.assign({},a2(t)),{expanded:t.expanded,nodes:t.expanded?(r=e,r.map(n=>n.node.type===kn.META?SN(n):a2(n))):[],edges:t.expanded?rne(t):[]});var r}function a2(t){return{id:t.node.name,name:t.node.name,type:t.node.type,cardinality:t.node.cardinality,attr:t.attr,parentNodeName:t.node.parentNode?t.node.parentNode.name:null,coreBox:Object.assign({},t.coreBox),x:t.x,y:t.y,width:t.width,height:t.height,radius:t.radius,labelHeight:t.labelHeight,labelOffset:t.labelOffset,outboxWidth:t.outboxWidth,paddingLeft:t.paddingLeft,paddingTop:t.paddingTop,paddingRight:t.paddingRight,paddingBottom:t.paddingBottom,path:t.node.path}}function rne(t){return t.coreGraph.edges().map(e=>({renderInfoEdge:t.coreGraph.edge(e),edge:e})).filter(({renderInfoEdge:e})=>e.metaEdge).map(({edge:e,renderInfoEdge:r})=>{const n=function(a,i){const o=i.points.map(s=>Object.assign({},s));if(i.adjoiningMetaEdge){const s=i.adjoiningMetaEdge.points,u=i.metaEdge.inbound,f=u?s[s.length-1]:s[0],l=o[u?0:o.length-1],c=a.x-a.width/2,h=a.y-a.height/2,d=f.x-c,v=f.y-h,p=-a.paddingLeft,g=-(a.paddingTop+a.labelHeight);l.x=d+p,l.y=v+g}return o}(t,r);return{adjoiningEdge:r.adjoiningMetaEdge?{w:r.adjoiningMetaEdge.metaEdge.w,v:r.adjoiningMetaEdge.metaEdge.v}:null,inbound:r.metaEdge.inbound,w:e.w,v:e.v,points:n,weight:r.weight,baseEdgeList:r.metaEdge.baseEdgeList,parentNodeName:t.node.name}})}const nne=Object.freeze(Object.defineProperty({__proto__:null,BRIDGE_GRAPH_NAME:ck,get GraphType(){return uu},get HierarchyNodeType(){return Ig},get InclusionType(){return Yo},LAYOUT_CONFIG:ed,get NodeType(){return kn},ROOT_NAME:su,buildGraph:Jre,flatGraph:ene,getEdges:tne,mergeConfig:Tg},Symbol.toStringTag,{value:"Module"})),ane=Ka(nne);var ine=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),va=me&&me.__assign||function(){return va=Object.assign||function(t){for(var e,r=1,n=arguments.length;rf.x&&(s=f.x),u>f.y&&(u=f.y)}),n.forEach(function(f){f.points.forEach(function(l){s>l.x&&(s=l.x),u>l.y&&(u=l.y)})}),o[0]=i[0]-s,o[1]=i[1]-u}return o},e.prototype.updateNodePosition=function(r,n){var a=this,i=a.combos,o=a.nodes,s=a.edges,u=a.anchorPoint,f=a.graphSettings,l=this.getBegin(r,n);r.forEach(function(c){var h,d=c.x,v=c.y,p=c.id,g=c.type,y=c.coreBox;if(g===Hn.HierarchyNodeType.META&&p!==Hn.ROOT_NAME){var m=i.findIndex(function(_){return _.id===p}),b=(h=f==null?void 0:f.subScene)===null||h===void 0?void 0:h.meta;i[m].offsetX=d+l[0],i[m].offsetY=v+l[1],i[m].fixSize=[y.width,y.height],i[m].fixCollapseSize=[y.width,y.height],c.expanded?i[m].padding=[b==null?void 0:b.paddingTop,b==null?void 0:b.paddingRight,b==null?void 0:b.paddingBottom,b==null?void 0:b.paddingLeft]:i[m].padding=[0,0,0,0]}else if(g===Hn.HierarchyNodeType.OP){var m=o.findIndex(function(S){return S.id===p});if(o[m].x=d+l[0],o[m].y=v+l[1],u){var w=[],x=n.filter(function(S){return S.v===p}),E=n.filter(function(S){return S.w===p});x.length>0&&x.forEach(function(S){var A=S.points[0],M=(A.x-d)/c.width+.5,C=(A.y-v)/c.height+.5;w.push([M,C]),S.baseEdgeList.forEach(function(I){var k=s.find(function(O){return O.source===I.v&&O.target===I.w});k&&(k.sourceAnchor=w.length-1)})}),E.length>0&&E.forEach(function(S){var A=S.points[S.points.length-1],M=(A.x-d)/c.width+.5,C=(A.y-v)/c.height+.5;w.push([M,C]),S.baseEdgeList.forEach(function(I){var k=s.find(function(O){return O.source===I.v&&O.target===I.w});k&&(k.targetAnchor=w.length-1)})}),o[m].anchorPoints=w.length>0?w:o[m].anchorPoints||[]}}})},e.prototype.updateEdgePosition=function(r,n){var a=this,i=a.combos,o=a.edges,s=a.controlPoints,u=this.getBegin(r,n);s&&(i.forEach(function(f){f.inEdges=[],f.outEdges=[]}),o.forEach(function(f){var l,c,h,d,v=r.find(function(_){return _.id===f.source}),p=r.find(function(_){return _.id===f.target}),g=[],y=[];if(v&&p)y=(0,Hn.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,r);else if(!v||!p){var m=a.getNodePath(f.source),b=a.getNodePath(f.target),w=m.reverse().slice(v?0:1).find(function(_){return r.find(function(S){return S.id===_})}),x=b.reverse().slice(p?0:1).find(function(_){return r.find(function(S){return S.id===_})});v=r.find(function(_){return _.id===w}),p=r.find(function(_){return _.id===x}),y=(0,Hn.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,r,{v:f.source,w:f.target})}if(g=y.reduce(function(_,S){return Ms(Ms([],_,!0),S.points.map(function(A){return va(va({},A),{x:A.x+u[0],y:A.y+u[1]})}),!0)},[]),g=g.slice(1,-1),f.controlPoints=g,(p==null?void 0:p.type)===Hn.NodeType.META){var E=i.findIndex(function(_){return _.id===(p==null?void 0:p.id)});if(!i[E]||!((l=i[E].inEdges)===null||l===void 0)&&l.some(function(_){return _.source===v.id&&_.target===p.id}))return;(c=i[E].inEdges)===null||c===void 0||c.push({source:v.id,target:p.id,controlPoints:g})}if((v==null?void 0:v.type)===Hn.NodeType.META){var E=i.findIndex(function(S){return S.id===(v==null?void 0:v.id)});if(!i[E]||!((h=i[E].outEdges)===null||h===void 0)&&h.some(function(S){return S.source===v.id&&S.target===p.id}))return;(d=i[E].outEdges)===null||d===void 0||d.push({source:v.id,target:p.id,controlPoints:g})}}))},e.prototype.getType=function(){return"dagreCompound"},e.prototype.getDataByOrder=function(r){return r.every(function(n){return n.layoutOrder!==void 0})||r.forEach(function(n,a){n.layoutOrder=a}),r.sort(function(n,a){return n.layoutOrder-a.layoutOrder})},e}(one.Base);vl.DagreCompoundLayout=sne;var Km={},lv={},Qm={};const une=Object.prototype.toString;function ud(t){const e=une.call(t);return e.endsWith("Array]")&&!e.includes("Big")}function fne(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ud(t))throw new TypeError("input must be an array");if(t.length===0)throw new TypeError("input must not be empty");var r=e.fromIndex,n=r===void 0?0:r,a=e.toIndex,i=a===void 0?t.length:a;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=t[n],s=n+1;so&&(o=t[s]);return o}function lne(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!ud(t))throw new TypeError("input must be an array");if(t.length===0)throw new TypeError("input must not be empty");var r=e.fromIndex,n=r===void 0?0:r,a=e.toIndex,i=a===void 0?t.length:a;if(n<0||n>=t.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(i<=n||i>t.length||!Number.isInteger(i))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=t[n],s=n+1;s1&&arguments[1]!==void 0?arguments[1]:{};if(ud(t)){if(t.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var r;if(e.output!==void 0){if(!ud(e.output))throw new TypeError("output option must be an array if specified");r=e.output}else r=new Array(t.length);var n=lne(t),a=fne(t);if(n===a)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var i=e.min,o=i===void 0?e.autoMinMax?n:0:i,s=e.max,u=s===void 0?e.autoMinMax?a:1:s;if(o>=u)throw new RangeError("min option must be smaller than max option");for(var f=(u-o)/(a-n),l=0;l>n);return this},t.prototype.signPropagatingRightShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let a=0;a>n.get(a,i));return this},t.signPropagatingRightShift=function(n,a){return new e(n).signPropagatingRightShift(a)},t.prototype.rightShift=function(n){return typeof n=="number"?this.rightShiftS(n):this.rightShiftM(n)},t.prototype.rightShiftS=function(n){for(let a=0;a>>n);return this},t.prototype.rightShiftM=function(n){if(n=e.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let a=0;a>>n.get(a,i));return this},t.rightShift=function(n,a){return new e(n).rightShift(a)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let n=0;nn)throw new RangeError("Row index out of range")}function ea(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function Rs(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Fs(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function CN(t,e,r){return{row:TN(t,e),column:IN(t,r)}}function TN(t,e){if(typeof e!="object")throw new TypeError("unexpected type for row indices");if(e.some(n=>n<0||n>=t.rows))throw new RangeError("row indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function IN(t,e){if(typeof e!="object")throw new TypeError("unexpected type for column indices");if(e.some(n=>n<0||n>=t.columns))throw new RangeError("column indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function Gg(t,e,r,n,a){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Bc("startRow",e),Bc("endRow",r),Bc("startColumn",n),Bc("endColumn",a),e>r||n>a||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||a<0||a>=t.columns)throw new RangeError("Submatrix indices are out of range")}function cv(t,e=0){let r=[];for(let n=0;n=i)throw new RangeError("min must be smaller than max");let s=i-a,u=new lt(e,r);for(let f=0;fn?(i=!0,n=r):(a=!1,i=!0);e++}return a}isReducedEchelonForm(){let e=0,r=0,n=-1,a=!0,i=!1;for(;en?(i=!0,n=r):(a=!1,i=!0);for(let o=r+1;oe.get(a,n)&&(a=i);if(e.get(a,n)===0)n++;else{e.swapRows(r,a);let i=e.get(r,n);for(let o=n;o=0;)if(e.maxRow(a)===0)a--;else{let i=0,o=!1;for(;ie&&(e=this.get(r,n));return e}maxIndex(){let e=this.get(0,0),r=[0,0];for(let n=0;ne&&(e=this.get(n,a),r[0]=n,r[1]=a);return r}min(){let e=this.get(0,0);for(let r=0;rr&&(r=this.get(e,n));return r}maxRowIndex(e){Jn(this,e);let r=this.get(e,0),n=[e,0];for(let a=1;ar&&(r=this.get(e,a),n[1]=a);return n}minRow(e){Jn(this,e);let r=this.get(e,0);for(let n=1;nr&&(r=this.get(n,e));return r}maxColumnIndex(e){ea(this,e);let r=this.get(0,e),n=[0,e];for(let a=1;ar&&(r=this.get(a,e),n[0]=a);return n}minColumn(e){ea(this,e);let r=this.get(0,e);for(let n=1;n=n)throw new RangeError("min must be smaller than max");let a=new lt(this.rows,this.columns);for(let i=0;i=n)throw new RangeError("min must be smaller than max");let a=new lt(this.rows,this.columns);for(let i=0;in||r<0||r>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let a=new lt(e.length,n-r+1);for(let i=0;i=this.rows)throw new RangeError(`Row index out of range: ${e[i]}`);a.set(i,o-r,this.get(e[i],o))}return a}subMatrixColumn(e,r,n){if(r===void 0&&(r=0),n===void 0&&(n=this.rows-1),r>n||r<0||r>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let a=new lt(n-r+1,e.length);for(let i=0;i=this.columns)throw new RangeError(`Column index out of range: ${e[i]}`);a.set(o-r,i,this.get(o,e[i]))}return a}setSubMatrix(e,r,n){e=lt.checkMatrix(e);let a=r+e.rows-1,i=n+e.columns-1;Gg(this,r,a,n,i);for(let o=0;o0)if(this.data=[],Number.isInteger(r)&&r>0)for(let n=0;n"u"&&(r=e,e=this.columns),ea(this,e,!0),r=Fs(this,r);for(let n=0;nMath.abs(v[l])&&(l=s);if(l!==u){for(f=0;f=0;f--){for(u=0;uo?a.set(i,o,e.get(i,o)):i===o?a.set(i,o,1):a.set(i,o,0);return a}get upperTriangularMatrix(){let e=this.LU,r=e.rows,n=e.columns,a=new lt(r,n);for(let i=0;iMath.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):e!==0?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class zg{constructor(e){e=Wn.checkMatrix(e);let r=e.clone(),n=e.rows,a=e.columns,i=new Float64Array(a),o,s,u,f;for(u=0;u=0;f--){for(u=0;u=0;s--){for(i=0;i=0;M--)if(v[M]!==0){for(let C=M+1;C=0;M--){if(M0;){let M,C;for(M=_-2;M>=-1&&M!==-1;M--){const I=Number.MIN_VALUE+A*Math.abs(v[M]+Math.abs(v[M+1]));if(Math.abs(y[M])<=I||Number.isNaN(y[M])){y[M]=0;break}}if(M===_-2)C=4;else{let I;for(I=_-1;I>=M&&I!==M;I--){let k=(I!==_?Math.abs(y[I]):0)+(I!==M+1?Math.abs(y[I-1]):0);if(Math.abs(v[I])<=A*k){v[I]=0;break}}I===M?C=3:I===_-1?C=1:(C=2,M=I)}switch(M++,C){case 1:{let I=y[_-2];y[_-2]=0;for(let k=_-2;k>=M;k--){let O=hi(v[k],I),B=v[k]/O,L=I/O;if(v[k]=O,k!==M&&(I=-L*y[k-1],y[k-1]=B*y[k-1]),f)for(let z=0;z=v[M+1]);){let I=v[M];if(v[M]=v[M+1],v[M+1]=I,f&&Mr&&i.set(l,c,e.get(l,c)/this.s[c]);let o=this.U,s=o.rows,u=o.columns,f=new lt(n,s);for(let l=0;le&&r++;return r}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return lt.diag(this.s)}}function Une(t,e=!1){return t=Wn.checkMatrix(t),e?new cu(t).inverse():NN(t,lt.eye(t.rows))}function NN(t,e,r=!1){return t=Wn.checkMatrix(t),e=Wn.checkMatrix(e),r?new cu(t).solve(e):t.isSquare()?new fd(t).solve(e):new zg(t).solve(e)}function wh(t){if(t=lt.checkMatrix(t),t.isSquare()){let e,r,n,a;if(t.columns===2)return e=t.get(0,0),r=t.get(0,1),n=t.get(1,0),a=t.get(1,1),e*a-r*n;if(t.columns===3){let i,o,s;return i=new bh(t,[1,2],[1,2]),o=new bh(t,[1,2],[0,2]),s=new bh(t,[1,2],[0,1]),e=t.get(0,0),r=t.get(0,1),n=t.get(0,2),e*wh(i)-r*wh(o)+n*wh(s)}else return new fd(t).determinant}else throw Error("determinant can only be calculated for a square matrix")}function $ne(t,e){let r=[];for(let n=0;na)return new Array(e.rows+1).fill(0);{let i=e.addRow(r,[0]);for(let o=0;oe?i[o]=1/i[o]:i[o]=0;return a.mmul(lt.diag(i).mmul(n.transpose()))}function Yne(t,e=t,r={}){t=new lt(t);let n=!1;if(typeof e=="object"&&!lt.isMatrix(e)&&!Array.isArray(e)?(r=e,e=t,n=!0):e=new lt(e),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:a=!0}=r;a&&(t=t.center("column"),n||(e=e.center("column")));const i=t.transpose().mmul(e);for(let o=0;o0?a.set(i,i+1,r[i]):r[i]<0&&a.set(i,i-1,r[i])}return a}}function Hne(t,e,r,n){let a,i,o,s,u,f,l,c;for(u=0;u0;s--){for(c=0,o=0,f=0;f0&&(i=-i),e[s]=c*i,o=o-a*i,r[s-1]=a-i,u=0;uf)do{for(a=r[f],c=(r[f+1]-a)/(2*e[f]),h=hi(c,1),c<0&&(h=-h),r[f]=e[f]/(c+h),r[f+1]=e[f]*(c+h),d=r[f+1],i=a-r[f],o=f+2;o=f;o--)for(g=p,p=v,b=m,a=v*e[o],i=v*c,h=hi(c,e[o]),e[o+1]=m*h,m=e[o]/h,v=c/h,c=v*r[o]-m*a,r[o+1]=i+m*(v*a+m*r[o]),u=0;uE*x);r[f]=r[f]+w,e[f]=0}for(o=0;o=c;f--)r[f]=e.get(f,c-1)/h,u+=r[f]*r[f];for(s=Math.sqrt(u),r[c]>0&&(s=-s),u=u-r[c]*s,r[c]=r[c]-s,l=c;l=c;f--)o+=r[f]*e.get(f,l);for(o=o/u,f=c;f<=i;f++)e.set(f,l,e.get(f,l)-o*r[f])}for(f=0;f<=i;f++){for(o=0,l=i;l>=c;l--)o+=r[l]*e.get(f,l);for(o=o/u,l=c;l<=i;l++)e.set(f,l,e.get(f,l)-o*r[l])}r[c]=h*r[c],e.set(c,c-1,h*s)}}for(f=0;f=a+1;c--)if(e.get(c,c-1)!==0){for(f=c+1;f<=i;f++)r[f]=e.get(f,c-1);for(l=c;l<=i;l++){for(s=0,f=c;f<=i;f++)s+=r[f]*n.get(f,l);for(s=s/r[c]/e.get(c,c-1),f=c;f<=i;f++)n.set(f,l,n.get(f,l)+s*r[f])}}}function Qne(t,e,r,n,a){let i=t-1,o=0,s=t-1,u=Number.EPSILON,f=0,l=0,c=0,h=0,d=0,v=0,p=0,g=0,y,m,b,w,x,E,_,S,A,M,C,I,k,O,B;for(y=0;ys)&&(r[y]=a.get(y,y),e[y]=0),m=Math.max(y-1,0);m=o;){for(w=i;w>o&&(v=Math.abs(a.get(w-1,w-1))+Math.abs(a.get(w,w)),v===0&&(v=l),!(Math.abs(a.get(w,w-1))=0){for(p=c>=0?c+p:c-p,r[i-1]=S+p,r[i]=r[i-1],p!==0&&(r[i]=S-_/p),e[i-1]=0,e[i]=0,S=a.get(i,i-1),v=Math.abs(S)+Math.abs(p),c=S/v,h=p/v,d=Math.sqrt(c*c+h*h),c=c/d,h=h/d,m=i-1;m0)){for(v=Math.sqrt(v),A=w&&(p=a.get(x,x),d=S-p,v=A-p,c=(d*v-_)/a.get(x+1,x)+a.get(x,x+1),h=a.get(x+1,x+1)-p-d-v,d=a.get(x+2,x+1),v=Math.abs(c)+Math.abs(h)+Math.abs(d),c=c/v,h=h/v,d=d/v,!(x===w||Math.abs(a.get(x,x-1))*(Math.abs(h)+Math.abs(d))x+2&&a.set(y,y-3,0);for(b=x;b<=i-1&&(O=b!==i-1,b!==x&&(c=a.get(b,b-1),h=a.get(b+1,b-1),d=O?a.get(b+2,b-1):0,S=Math.abs(c)+Math.abs(h)+Math.abs(d),S!==0&&(c=c/S,h=h/S,d=d/S)),S!==0);b++)if(v=Math.sqrt(c*c+h*h+d*d),c<0&&(v=-v),v!==0){for(b!==x?a.set(b,b-1,-v*S):w!==x&&a.set(b,b-1,-a.get(b,b-1)),c=c+v,S=c/v,A=h/v,p=d/v,h=h/c,d=d/c,m=b;m=0;i--)if(c=r[i],h=e[i],h===0)for(w=i,a.set(i,i,1),y=i-1;y>=0;y--){for(_=a.get(y,y)-c,d=0,m=w;m<=i;m++)d=d+a.get(y,m)*a.get(m,i);if(e[y]<0)p=_,v=d;else if(w=y,e[y]===0?a.set(y,i,_!==0?-d/_:-d/(u*l)):(S=a.get(y,y+1),A=a.get(y+1,y),h=(r[y]-c)*(r[y]-c)+e[y]*e[y],E=(S*v-p*d)/h,a.set(y,i,E),a.set(y+1,i,Math.abs(S)>Math.abs(p)?(-d-_*E)/S:(-v-A*E)/p)),E=Math.abs(a.get(y,i)),u*E*E>1)for(m=y;m<=i;m++)a.set(m,i,a.get(m,i)/E)}else if(h<0)for(w=i-1,Math.abs(a.get(i,i-1))>Math.abs(a.get(i-1,i))?(a.set(i-1,i-1,h/a.get(i,i-1)),a.set(i-1,i,-(a.get(i,i)-c)/a.get(i,i-1))):(B=Gc(0,-a.get(i-1,i),a.get(i-1,i-1)-c,h),a.set(i-1,i-1,B[0]),a.set(i-1,i,B[1])),a.set(i,i-1,0),a.set(i,i,1),y=i-2;y>=0;y--){for(M=0,C=0,m=w;m<=i;m++)M=M+a.get(y,m)*a.get(m,i-1),C=C+a.get(y,m)*a.get(m,i);if(_=a.get(y,y)-c,e[y]<0)p=_,d=M,v=C;else if(w=y,e[y]===0?(B=Gc(-M,-C,_,h),a.set(y,i-1,B[0]),a.set(y,i,B[1])):(S=a.get(y,y+1),A=a.get(y+1,y),I=(r[y]-c)*(r[y]-c)+e[y]*e[y]-h*h,k=(r[y]-c)*2*h,I===0&&k===0&&(I=u*l*(Math.abs(_)+Math.abs(h)+Math.abs(S)+Math.abs(A)+Math.abs(p))),B=Gc(S*d-p*M+h*C,S*v-p*C-h*M,I,k),a.set(y,i-1,B[0]),a.set(y,i,B[1]),Math.abs(S)>Math.abs(p)+Math.abs(h)?(a.set(y+1,i-1,(-M-_*a.get(y,i-1)+h*a.get(y,i))/S),a.set(y+1,i,(-C-_*a.get(y,i)-h*a.get(y,i-1))/S)):(B=Gc(-d-A*a.get(y,i-1),-v-A*a.get(y,i),p,h),a.set(y+1,i-1,B[0]),a.set(y+1,i,B[1]))),E=Math.max(Math.abs(a.get(y,i-1)),Math.abs(a.get(y,i))),u*E*E>1)for(m=y;m<=i;m++)a.set(m,i-1,a.get(m,i-1)/E),a.set(m,i,a.get(m,i)/E)}for(y=0;ys)for(m=y;m=o;m--)for(y=o;y<=s;y++){for(p=0,b=o;b<=Math.min(m,s);b++)p=p+n.get(y,b)*a.get(b,m);n.set(y,m,p)}}}function Gc(t,e,r,n){let a,i;return Math.abs(r)>Math.abs(n)?(a=n/r,i=r+a*n,[(t+a*e)/i,(e-a*t)/i]):(a=r/n,i=n+a*r,[(a*t+e)/i,(a*e-t)/i])}class u2{constructor(e){if(e=Wn.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let r=e,n=r.rows,a=new lt(n,n),i=!0,o,s,u;for(s=0;s0,a.set(s,s,Math.sqrt(Math.max(f,0))),u=s+1;u=0;u--)for(s=0;so;d++)c=e.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),c=c.div(c.norm()),f=e.mmul(c).div(c.transpose().mmul(c).get(0,0)),d>0&&(u=f.clone().sub(h).pow(2).sum()),h=f.clone(),n?(l=n.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0)),l=l.div(l.norm()),s=n.mmul(l).div(l.transpose().mmul(l).get(0,0))):s=f;if(n){let d=e.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0));d=d.div(d.norm());let v=e.clone().sub(f.clone().mmul(d.transpose())),p=s.transpose().mmul(f).div(f.transpose().mmul(f).get(0,0)),g=n.clone().sub(f.clone().mulS(p.get(0,0)).mmul(l.transpose()));this.t=f,this.p=d.transpose(),this.w=c.transpose(),this.q=l,this.u=s,this.s=f.transpose().mmul(f),this.xResidual=v,this.yResidual=g,this.betas=p}else this.w=c.transpose(),this.s=f.transpose().mmul(f).sqrt(),a?this.t=f.clone().div(this.s.get(0,0)):this.t=f,this.xResidual=e.sub(f.mmul(c.transpose()))}}const Jne=Object.freeze(Object.defineProperty({__proto__:null,AbstractMatrix:Xt,CHO:u2,CholeskyDecomposition:u2,EVD:s2,EigenvalueDecomposition:s2,LU:fd,LuDecomposition:fd,Matrix:lt,MatrixColumnSelectionView:Dne,MatrixColumnView:Lne,MatrixFlipColumnView:Pne,MatrixFlipRowView:Rne,MatrixRowSelectionView:Bne,MatrixRowView:Fne,MatrixSelectionView:bh,MatrixSubView:Gne,MatrixTransposeView:zne,NIPALS:f2,Nipals:f2,QR:zg,QrDecomposition:zg,SVD:cu,SingularValueDecomposition:cu,WrapperMatrix1D:kN,WrapperMatrix2D:Wn,correlation:qne,covariance:Yne,default:lt,determinant:wh,inverse:Une,linearDependencies:Wne,pseudoInverse:Vne,solve:NN,wrap:jne},Symbol.toStringTag,{value:"Module"})),ON=Ka(Jne);Object.defineProperty(Qm,"__esModule",{value:!0});var Qu=ON,eae=function(){function t(e){this.distances=e.distances,this.dimension=e.dimension||2,this.linkDistance=e.linkDistance}return t.prototype.layout=function(){var e=this,r=e.dimension,n=e.distances,a=e.linkDistance;try{var i=Qu.Matrix.mul(Qu.Matrix.pow(n,2),-.5),o=i.mean("row"),s=i.mean("column"),u=i.mean();i.add(u).subRowVector(o).subColumnVector(s);var f=new Qu.SingularValueDecomposition(i),l=Qu.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(p){return Qu.Matrix.mul([p],[l]).toJSON()[0].splice(0,r)})}catch{for(var c=[],h=0;hl?1:-1;c=.01*v,h=.01*v}if(dMath.PI/2&&(y-=Math.PI/2,v*=-1,p*=-1);var m=Math.cos(y)*g;f.x=v*m,f.y=p*m});var u=e.radii;r.forEach(function(f,l){if(l!==o){var c=Math.sqrt(n[l].x*n[l].x+n[l].y*n[l].y);if(c>0&&l!==o){var h=Math.min(s*(a/tae),c);if(f[0]+=n[l].x/c*h,f[1]+=n[l].y/c*h,i){var d=f[0]-r[o][0],v=f[1]-r[o][1],p=Math.sqrt(d*d+v*v);d=d/p*u[l],v=v/p*u[l],f[0]=r[o][0]+d,f[1]=r[o][1]+v}}}})},t}();Jm.default=rae;var nae=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),LN=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(lv,"__esModule",{value:!0});lv.RadialLayout=void 0;var Zn=Ir(),aae=Rr,iae=LN(Qm),oae=LN(Jm);function sae(t){for(var e=t.length,r=t[0].length,n=[],a=0;ai[0]?i[0]:p-i[0],m=g-i[1]>i[1]?i[1]:g-i[1];y===0&&(y=p/2),m===0&&(m=g/2);var b=m>y?y:m,w=Math.max.apply(Math,v),x=[];v.forEach(function(X,R){r.unitRadius||(r.unitRadius=b/w),x[R]=X*r.unitRadius}),r.radii=x;var E=r.eIdealDisMatrix();r.eIdealDistances=E;var _=sae(E);r.weights=_;var S=new iae.default({linkDistance:o,distances:E}),A=S.layout();A.forEach(function(X){(0,Zn.isNaN)(X[0])&&(X[0]=Math.random()*o),(0,Zn.isNaN)(X[1])&&(X[1]=Math.random()*o)}),r.positions=A,A.forEach(function(X,R){n[R].x=X[0]+i[0],n[R].y=X[1]+i[1]}),A.forEach(function(X){X[0]-=A[l][0],X[1]-=A[l][1]}),r.run();var M=r.preventOverlap,C=r.nodeSize,I,k=r.strictRadial;if(M){var O=r.nodeSpacing,B;(0,Zn.isNumber)(O)?B=function(){return O}:(0,Zn.isFunction)(O)?B=O:B=function(){return 0},C?(0,Zn.isArray)(C)?I=function(X){var R=C[0]>C[1]?C[0]:C[1];return R+B(X)}:I=function(X){return C+B(X)}:I=function(X){if(X.size){if((0,Zn.isArray)(X.size)){var R=X.size[0]>X.size[1]?X.size[0]:X.size[1];return R+B(X)}if((0,Zn.isObject)(X.size)){var R=X.size.width>X.size.height?X.size.width:X.size.height;return R+B(X)}return X.size+B(X)}return 10+B(X)};var L={nodes:n,nodeSizeFunc:I,adjMatrix:c,positions:A,radii:x,height:g,width:p,strictRadial:k,focusID:l,iterations:r.maxPreventOverlapIteration||200,k:A.length/4.5},z=new oae.default(L);A=z.layout()}return A.forEach(function(X,R){n[R].x=X[0]+i[0],n[R].y=X[1]+i[1]}),r.onLayoutEnd&&r.onLayoutEnd(),{nodes:n,edges:a}},e.prototype.run=function(){for(var r=this,n=r.maxIteration,a=r.positions||[],i=r.weights||[],o=r.eIdealDistances||[],s=r.radii||[],u=0;u<=n;u++){var f=u/n;r.oneIteration(f,a,s,o,i)}},e.prototype.oneIteration=function(r,n,a,i,o){var s=this,u=1-r,f=s.focusIndex;n.forEach(function(l,c){var h=l2(l,[0,0]),d=h===0?0:1/h;if(c!==f){var v=0,p=0,g=0;n.forEach(function(m,b){if(c!==b){var w=l2(l,m),x=w===0?0:1/w,E=i[b][c];g+=o[c][b],v+=o[c][b]*(m[0]+E*(l[0]-m[0])*x),p+=o[c][b]*(m[1]+E*(l[1]-m[1])*x)}});var y=a[c]===0?0:1/a[c];g*=u,g+=r*y*y,v*=u,v+=r*y*l[0]*d,l[0]=v/g,p*=u,p+=r*y*l[1]*d,l[1]=p/g}})},e.prototype.eIdealDisMatrix=function(){var r=this,n=r.nodes;if(!n)return[];var a=r.distances,i=r.linkDistance,o=r.radii||[],s=r.unitRadius||50,u=[];return a&&a.forEach(function(f,l){var c=[];f.forEach(function(h,d){if(l===d)c.push(0);else if(o[l]===o[d])if(r.sortBy==="data")c.push(h*(Math.abs(l-d)*r.sortStrength)/(o[l]/s));else if(r.sortBy){var v=n[l][r.sortBy]||0,p=n[d][r.sortBy]||0;(0,Zn.isString)(v)&&(v=v.charCodeAt(0)),(0,Zn.isString)(p)&&(p=p.charCodeAt(0)),c.push(h*(Math.abs(v-p)*r.sortStrength)/(o[l]/s))}else c.push(h*i/(o[l]/s));else{var g=(i+s)/2;c.push(h*g)}}),u.push(c)}),u},e.prototype.handleInfinity=function(r,n,a){for(var i=r.length,o=0;oa?r[n][i]:a);return a},e.prototype.getType=function(){return"radial"},e}(aae.Base);lv.RadialLayout=fae;(function(t){var e=me&&me.__createBinding||(Object.create?function(n,a,i,o){o===void 0&&(o=i);var s=Object.getOwnPropertyDescriptor(a,i);(!s||("get"in s?!a.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,o,s)}:function(n,a,i,o){o===void 0&&(o=i),n[o]=a[i]}),r=me&&me.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&e(a,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(lv,t)})(Km);var bl={},lae=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(bl,"__esModule",{value:!0});bl.ConcentricLayout=void 0;var Na=Ir(),cae=Rr,hae=function(t){lae(e,t);function e(r){var n=t.call(this)||this;return n.nodeSize=30,n.minNodeSpacing=10,n.nodeSpacing=10,n.preventOverlap=!1,n.equidistant=!1,n.startAngle=3/2*Math.PI,n.clockwise=!0,n.sortBy="degree",n.nodes=[],n.edges=[],n.width=300,n.height=300,n.onLayoutEnd=function(){},n.updateCfg(r),n}return e.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"}},e.prototype.execute=function(){var r,n,a=this,i=a.nodes,o=a.edges,s=i.length;if(s===0){(r=a.onLayoutEnd)===null||r===void 0||r.call(a);return}!a.width&&typeof window<"u"&&(a.width=window.innerWidth),!a.height&&typeof window<"u"&&(a.height=window.innerHeight),a.center||(a.center=[a.width/2,a.height/2]);var u=a.center;if(s===1){i[0].x=u[0],i[0].y=u[1],(n=a.onLayoutEnd)===null||n===void 0||n.call(a);return}var f=a.nodeSize,l=a.nodeSpacing,c=[],h,d=0;(0,Na.isArray)(f)?h=Math.max(f[0],f[1]):h=f,(0,Na.isArray)(l)?d=Math.max(l[0],l[1]):(0,Na.isNumber)(l)&&(d=l),i.forEach(function(k){c.push(k);var O=h;(0,Na.isArray)(k.size)?O=Math.max(k.size[0],k.size[1]):(0,Na.isNumber)(k.size)?O=k.size:(0,Na.isObject)(k.size)&&(O=Math.max(k.size.width,k.size.height)),h=Math.max(h,O),(0,Na.isFunction)(l)&&(d=Math.max(l(k),d))}),a.clockwise=a.counterclockwise!==void 0?!a.counterclockwise:a.clockwise;var v={},p={};if(c.forEach(function(k,O){v[k.id]=k,p[k.id]=O}),(a.sortBy==="degree"||!(0,Na.isString)(a.sortBy)||c[0][a.sortBy]===void 0)&&(a.sortBy="degree",!(0,Na.isNumber)(i[0].degree))){var g=(0,Na.getDegree)(i.length,p,o);c.forEach(function(k,O){k.degree=g[O].all})}c.sort(function(k,O){return O[a.sortBy]-k[a.sortBy]}),a.maxValueNode=c[0],a.maxLevelDiff=a.maxLevelDiff||a.maxValueNode[a.sortBy]/4;var y=[[]],m=y[0];c.forEach(function(k){if(m.length>0){var O=Math.abs(m[0][a.sortBy]-k[a.sortBy]);a.maxLevelDiff&&O>=a.maxLevelDiff&&(m=[],y.push(m))}m.push(k)});var b=h+(d||a.minNodeSpacing);if(!a.preventOverlap){var w=y.length>0&&y[0].length>1,x=Math.min(a.width,a.height)/2-b,E=x/(y.length+(w?1:0));b=Math.min(b,E)}var _=0;if(y.forEach(function(k){var O=a.sweep;O===void 0&&(O=2*Math.PI-2*Math.PI/k.length);var B=k.dTheta=O/Math.max(1,k.length-1);if(k.length>1&&a.preventOverlap){var L=Math.cos(B)-Math.cos(0),z=Math.sin(B)-Math.sin(0),X=Math.sqrt(b*b/(L*L+z*z));_=Math.max(X,_)}k.r=_,_+=b}),a.equidistant){for(var S=0,A=0,M=0;M"u")return;var h=0;this.timeInterval=window.setInterval(function(){var d;n.runOneStep(l),h++,h>=o&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))},0)}return{nodes:a,edges:i}}},e.prototype.runOneStep=function(r){var n,a=this,i=a.nodes;if(i){var o=a.edges,s=a.center,u=a.gravity,f=a.speed,l=a.clustering,c=a.height*a.width,h=Math.sqrt(c)/10,d=c/(i.length+1),v=Math.sqrt(d),p=[];if(i.forEach(function(m,b){p[b]={x:0,y:0}}),a.applyCalculate(i,o,p,v,d),l){for(var g in r)r[g].cx=0,r[g].cy=0,r[g].count=0;i.forEach(function(m){var b=r[m.cluster];(0,Dr.isNumber)(m.x)&&(b.cx+=m.x),(0,Dr.isNumber)(m.y)&&(b.cy+=m.y),b.count++});for(var g in r)r[g].cx/=r[g].count,r[g].cy/=r[g].count;var y=a.clusterGravity||u;i.forEach(function(m,b){if(!(!(0,Dr.isNumber)(m.x)||!(0,Dr.isNumber)(m.y))){var w=r[m.cluster],x=Math.sqrt((m.x-w.cx)*(m.x-w.cx)+(m.y-w.cy)*(m.y-w.cy)),E=v*y;p[b].x-=E*(m.x-w.cx)/x,p[b].y-=E*(m.y-w.cy)/x}})}i.forEach(function(m,b){if(!(!(0,Dr.isNumber)(m.x)||!(0,Dr.isNumber)(m.y))){var w=.01*v*u;p[b].x-=w*(m.x-s[0]),p[b].y-=w*(m.y-s[1])}}),i.forEach(function(m,b){if((0,Dr.isNumber)(m.fx)&&(0,Dr.isNumber)(m.fy)){m.x=m.fx,m.y=m.fy;return}if(!(!(0,Dr.isNumber)(m.x)||!(0,Dr.isNumber)(m.y))){var w=Math.sqrt(p[b].x*p[b].x+p[b].y*p[b].y);if(w>0){var x=Math.min(h*(f/mae),w);m.x+=p[b].x/w*x,m.y+=p[b].y/w*x}}}),(n=a.tick)===null||n===void 0||n.call(a)}},e.prototype.applyCalculate=function(r,n,a,i,o){var s=this;s.calRepulsive(r,a,o),n&&s.calAttractive(n,a,i)},e.prototype.calRepulsive=function(r,n,a){r.forEach(function(i,o){n[o]={x:0,y:0},r.forEach(function(s,u){if(o!==u&&!(!(0,Dr.isNumber)(i.x)||!(0,Dr.isNumber)(s.x)||!(0,Dr.isNumber)(i.y)||!(0,Dr.isNumber)(s.y))){var f=i.x-s.x,l=i.y-s.y,c=f*f+l*l;if(c===0){c=1;var h=o>u?1:-1;f=.01*h,l=.01*h}var d=a/c;n[o].x+=f*d,n[o].y+=l*d}})})},e.prototype.calAttractive=function(r,n,a){var i=this;r.forEach(function(o){var s=(0,Dr.getEdgeTerminal)(o,"source"),u=(0,Dr.getEdgeTerminal)(o,"target");if(!(!s||!u)){var f=i.nodeIdxMap[s],l=i.nodeIdxMap[u];if(f!==l){var c=i.nodeMap[s],h=i.nodeMap[u];if(!(!(0,Dr.isNumber)(h.x)||!(0,Dr.isNumber)(c.x)||!(0,Dr.isNumber)(h.y)||!(0,Dr.isNumber)(c.y))){var d=h.x-c.x,v=h.y-c.y,p=Math.sqrt(d*d+v*v),g=p*p/a;n[l].x-=d/p*g,n[l].y-=v/p*g,n[f].x+=d/p*g,n[f].y+=v/p*g}}}})},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var r=this;r.stop(),r.tick=null,r.nodes=null,r.edges=null,r.destroyed=!0},e.prototype.getType=function(){return"fruchterman"},e}(yae.Base);xl.FruchtermanLayout=bae;var El={};function c2(t,e,r,n,a,i,o){try{var s=t[i](o),u=s.value}catch(f){return void r(f)}s.done?e(u):Promise.resolve(u).then(n,a)}function Xi(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var i=t.apply(e,r);function o(u){c2(i,n,a,o,s,"next",u)}function s(u){c2(i,n,a,o,s,"throw",u)}o(void 0)})}}function hu(t){"@babel/helpers - typeof";return hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hu(t)}function wae(t,e){if(hu(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(hu(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function DN(t){var e=wae(t,"string");return hu(e)=="symbol"?e:e+""}function Ke(t,e,r){return(e=DN(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ma(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h2(t,e){for(var r=0;r-1&&t%1==0&&t<=jae}var $ae=Uae;function Xae(t){return t!=null&&typeof t=="object"}var t1=Xae,Wae=e1,Vae=$ae,Yae=t1,qae="[object Arguments]",Hae="[object Array]",Zae="[object Boolean]",Kae="[object Date]",Qae="[object Error]",Jae="[object Function]",eie="[object Map]",tie="[object Number]",rie="[object Object]",nie="[object RegExp]",aie="[object Set]",iie="[object String]",oie="[object WeakMap]",sie="[object ArrayBuffer]",uie="[object DataView]",fie="[object Float32Array]",lie="[object Float64Array]",cie="[object Int8Array]",hie="[object Int16Array]",die="[object Int32Array]",vie="[object Uint8Array]",pie="[object Uint8ClampedArray]",gie="[object Uint16Array]",yie="[object Uint32Array]",wr={};wr[fie]=wr[lie]=wr[cie]=wr[hie]=wr[die]=wr[vie]=wr[pie]=wr[gie]=wr[yie]=!0;wr[qae]=wr[Hae]=wr[sie]=wr[Zae]=wr[uie]=wr[Kae]=wr[Qae]=wr[Jae]=wr[eie]=wr[tie]=wr[rie]=wr[nie]=wr[aie]=wr[iie]=wr[oie]=!1;function mie(t){return Yae(t)&&Vae(t.length)&&!!wr[Wae(t)]}var bie=mie;function wie(t){return function(e){return t(e)}}var xie=wie,ld={exports:{}};ld.exports;(function(t,e){var r=PN,n=e&&!e.nodeType&&e,a=n&&!0&&t&&!t.nodeType&&t,i=a&&a.exports===n,o=i&&r.process,s=function(){try{var u=a&&a.require&&a.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}}();t.exports=s})(ld,ld.exports);var Eie=ld.exports,_ie=bie,Sie=xie,g2=Eie,y2=g2&&g2.isTypedArray,Mie=y2?Sie(y2):_ie,Aie=Mie;const cd=bi(Aie);var Cie=e1,Tie=t1,Iie="[object Number]";function kie(t){return typeof t=="number"||Tie(t)&&Cie(t)==Iie}var Nie=kie;const Oie=bi(Nie);var Lie=Array.isArray,Die=Lie;const Pie=bi(Die);var BN={exports:{}},GN={exports:{}};(function(t){function e(r,n){this.v=r,this.k=n}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})(GN);var zN=GN.exports,jN={exports:{}},UN={exports:{}};(function(t){function e(r,n,a,i){var o=Object.defineProperty;try{o({},"",{})}catch{o=0}t.exports=e=function(u,f,l,c){function h(d,v){e(u,d,function(p){return this._invoke(d,v,p)})}f?o?o(u,f,{value:l,enumerable:!c,configurable:!c,writable:!c}):u[f]=l:(h("next",0),h("throw",1),h("return",2))},t.exports.__esModule=!0,t.exports.default=t.exports,e(r,n,a,i)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})(UN);var $N=UN.exports;(function(t){var e=$N;function r(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var n,a,i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function u(g,y,m,b){var w=y&&y.prototype instanceof l?y:l,x=Object.create(w.prototype);return e(x,"_invoke",function(E,_,S){var A,M,C,I=0,k=S||[],O=!1,B={p:0,n:0,v:n,a:L,f:L.bind(n,4),d:function(X,R){return A=X,M=0,C=n,B.n=R,f}};function L(z,X){for(M=z,C=X,a=0;!O&&I&&!R&&a3?(R=ce===X)&&(C=V[(M=V[4])?5:(M=3,3)],V[4]=V[5]=n):V[0]<=he&&((R=z<2&&heX||X>ce)&&(V[4]=z,V[5]=X,B.n=ce,M=0))}if(R||z>1)return f;throw O=!0,X}return function(z,X,R){if(I>1)throw TypeError("Generator is already running");for(O&&X===1&&L(X,R),M=X,C=R;(a=M<2?n:C)||!O;){A||(M?M<3?(M>1&&(B.n=-1),L(M,C)):B.n=C:B.v=C);try{if(I=2,A){if(M||(z="next"),a=A[z]){if(!(a=a.call(A,C)))throw TypeError("iterator result is not an object");if(!a.done)return a;C=a.value,M<2&&(M=0)}else M===1&&(a=A.return)&&a.call(A),M<2&&(C=TypeError("The iterator does not provide a '"+z+"' method"),M=1);A=n}else if((a=(O=B.n<0)?C:E.call(_,B))!==f)break}catch(V){A=n,M=1,C=V}finally{I=1}}return{value:a,done:O}}}(g,m,b),!0),x}var f={};function l(){}function c(){}function h(){}a=Object.getPrototypeOf;var d=[][o]?a(a([][o]())):(e(a={},o,function(){return this}),a),v=h.prototype=l.prototype=Object.create(d);function p(g){return Object.setPrototypeOf?Object.setPrototypeOf(g,h):(g.__proto__=h,e(g,s,"GeneratorFunction")),g.prototype=Object.create(v),g}return c.prototype=h,e(v,"constructor",h),e(h,"constructor",c),c.displayName="GeneratorFunction",e(h,s,"GeneratorFunction"),e(v),e(v,s,"Generator"),e(v,o,function(){return this}),e(v,"toString",function(){return"[object Generator]"}),(t.exports=r=function(){return{w:u,m:p}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})(jN);var XN=jN.exports,WN={exports:{}},VN={exports:{}},YN={exports:{}};(function(t){var e=zN,r=$N;function n(a,i){function o(u,f,l,c){try{var h=a[u](f),d=h.value;return d instanceof e?i.resolve(d.v).then(function(v){o("next",v,l,c)},function(v){o("throw",v,l,c)}):i.resolve(d).then(function(v){h.value=v,l(h)},function(v){return o("throw",v,l,c)})}catch(v){c(v)}}var s;this.next||(r(n.prototype),r(n.prototype,typeof Symbol=="function"&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),r(this,"_invoke",function(u,f,l){function c(){return new i(function(h,d){o(u,l,h,d)})}return s=s?s.then(c,c):c()},!0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})(YN);var qN=YN.exports;(function(t){var e=XN,r=qN;function n(a,i,o,s,u){return new r(e().w(a,i,o,s),u||Promise)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports})(VN);var HN=VN.exports;(function(t){var e=HN;function r(n,a,i,o,s){var u=e(n,a,i,o,s);return u.next().then(function(f){return f.done?f.value:u.next()})}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})(WN);var Rie=WN.exports,ZN={exports:{}};(function(t){function e(r){var n=Object(r),a=[];for(var i in n)a.unshift(i);return function o(){for(;a.length;)if((i=a.pop())in n)return o.value=i,o.done=!1,o;return o.done=!0,o}}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})(ZN);var Fie=ZN.exports,KN={exports:{}},QN={exports:{}};(function(t){function e(r){"@babel/helpers - typeof";return t.exports=e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports})(QN);var Bie=QN.exports;(function(t){var e=Bie.default;function r(n){if(n!=null){var a=n[typeof Symbol=="function"&&Symbol.iterator||"@@iterator"],i=0;if(a)return a.call(n);if(typeof n.next=="function")return n;if(!isNaN(n.length))return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}}}throw new TypeError(e(n)+" is not iterable")}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports})(KN);var Gie=KN.exports;(function(t){var e=zN,r=XN,n=Rie,a=HN,i=qN,o=Fie,s=Gie;function u(){var f=r(),l=f.m(u),c=(Object.getPrototypeOf?Object.getPrototypeOf(l):l.__proto__).constructor;function h(p){var g=typeof p=="function"&&p.constructor;return!!g&&(g===c||(g.displayName||g.name)==="GeneratorFunction")}var d={throw:1,return:2,break:3,continue:3};function v(p){var g,y;return function(m){g||(g={stop:function(){return y(m.a,2)},catch:function(){return m.v},abrupt:function(w,x){return y(m.a,d[w],x)},delegateYield:function(w,x,E){return g.resultName=x,y(m.d,s(w),E)},finish:function(w){return y(m.f,w)}},y=function(w,x,E){m.p=g.prev,m.n=g.next;try{return w(x,E)}finally{g.next=m.n}}),g.resultName&&(g[g.resultName]=m.v,g.resultName=void 0),g.sent=m.v,g.next=m.n;try{return p.call(this,g)}finally{m.p=g.prev,m.n=g.next}}}return(t.exports=u=function(){return{wrap:function(y,m,b,w){return f.w(v(y),m,b,w&&w.reverse())},isGeneratorFunction:h,mark:f.m,awrap:function(y,m){return new e(y,m)},AsyncIterator:i,async:function(y,m,b,w,x){return(h(m)?a:n)(v(y),m,b,w,x)},keys:o,values:s}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=u,t.exports.__esModule=!0,t.exports.default=t.exports})(BN);var zie=BN.exports,xh=zie(),jie=xh;try{regeneratorRuntime=xh}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=xh:Function("r","regeneratorRuntime = r")(xh)}const mn=bi(jie);var Uie=1;function JN(){return Uie++}var ke;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.MAX_EXT=32776]="MAX_EXT",t[t.MIN_EXT=32775]="MIN_EXT",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.CULL_FACE=2884]="CULL_FACE",t[t.BLEND=3042]="BLEND",t[t.DITHER=3024]="DITHER",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.TEXTURE1=33985]="TEXTURE1",t[t.TEXTURE2=33986]="TEXTURE2",t[t.TEXTURE3=33987]="TEXTURE3",t[t.TEXTURE4=33988]="TEXTURE4",t[t.TEXTURE5=33989]="TEXTURE5",t[t.TEXTURE6=33990]="TEXTURE6",t[t.TEXTURE7=33991]="TEXTURE7",t[t.TEXTURE8=33992]="TEXTURE8",t[t.TEXTURE9=33993]="TEXTURE9",t[t.TEXTURE10=33994]="TEXTURE10",t[t.TEXTURE11=33995]="TEXTURE11",t[t.TEXTURE12=33996]="TEXTURE12",t[t.TEXTURE13=33997]="TEXTURE13",t[t.TEXTURE14=33998]="TEXTURE14",t[t.TEXTURE15=33999]="TEXTURE15",t[t.TEXTURE16=34e3]="TEXTURE16",t[t.TEXTURE17=34001]="TEXTURE17",t[t.TEXTURE18=34002]="TEXTURE18",t[t.TEXTURE19=34003]="TEXTURE19",t[t.TEXTURE20=34004]="TEXTURE20",t[t.TEXTURE21=34005]="TEXTURE21",t[t.TEXTURE22=34006]="TEXTURE22",t[t.TEXTURE23=34007]="TEXTURE23",t[t.TEXTURE24=34008]="TEXTURE24",t[t.TEXTURE25=34009]="TEXTURE25",t[t.TEXTURE26=34010]="TEXTURE26",t[t.TEXTURE27=34011]="TEXTURE27",t[t.TEXTURE28=34012]="TEXTURE28",t[t.TEXTURE29=34013]="TEXTURE29",t[t.TEXTURE30=34014]="TEXTURE30",t[t.TEXTURE31=34015]="TEXTURE31",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.COPY_SRC=1]="COPY_SRC",t[t.COPY_DST=2]="COPY_DST",t[t.SAMPLED=4]="SAMPLED",t[t.STORAGE=8]="STORAGE",t[t.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"})(ke||(ke={}));var $ie=function(){function t(){Ma(this,t),this.config=void 0}return Aa(t,[{key:"get",value:function(){return this.config}},{key:"set",value:function(r){this.config=r}}]),t}(),Zf;(function(t){t.Void="Void",t.Boolean="Boolean",t.Float="Float",t.Uint32="Uint32",t.Int32="Int32",t.Vector="Vector",t.Vector2Float="vec2",t.Vector3Float="vec3",t.Vector4Float="vec4",t.Vector2Boolean="vec2",t.Vector3Boolean="vec3",t.Vector4Boolean="vec4",t.Vector2Uint="vec2",t.Vector3Uint="vec3",t.Vector4Uint="vec4",t.Vector2Int="vec2",t.Vector3Int="vec3",t.Vector4Int="vec4",t.Matrix="Matrix",t.Matrix3x3Float="mat3x3",t.Matrix4x4Float="mat4x4",t.Struct="Struct",t.FloatArray="Float[]",t.Vector4FloatArray="vec4[]"})(Zf||(Zf={}));var m2;(function(t){t.Program="Program",t.Identifier="Identifier",t.VariableDeclaration="VariableDeclaration",t.BlockStatement="BlockStatement",t.ReturnStatement="ReturnStatement",t.FunctionDeclaration="FunctionDeclaration",t.VariableDeclarator="VariableDeclarator",t.AssignmentExpression="AssignmentExpression",t.LogicalExpression="LogicalExpression",t.BinaryExpression="BinaryExpression",t.ArrayExpression="ArrayExpression",t.UnaryExpression="UnaryExpression",t.UpdateExpression="UpdateExpression",t.FunctionExpression="FunctionExpression",t.MemberExpression="MemberExpression",t.ConditionalExpression="ConditionalExpression",t.ExpressionStatement="ExpressionStatement",t.CallExpression="CallExpression",t.NumThreadStatement="NumThreadStatement",t.StorageStatement="StorageStatement",t.DoWhileStatement="DoWhileStatement",t.WhileStatement="WhileStatement",t.ForStatement="ForStatement",t.BreakStatement="BreakStatement",t.ContinueStatement="ContinueStatement",t.IfStatement="IfStatement",t.ImportedFunctionStatement="ImportedFunctionStatement"})(m2||(m2={}));var du;(function(t){t.Input="Input",t.Output="Output",t.Uniform="Uniform",t.Workgroup="Workgroup",t.UniformConstant="UniformConstant",t.Image="Image",t.StorageBuffer="StorageBuffer",t.Private="Private",t.Function="Function"})(du||(du={}));var Tf;(function(t){t.GLSL100="GLSL100",t.GLSL450="GLSL450",t.WGSL="WGSL"})(Tf||(Tf={}));var Xie="__DefineValuePlaceholder__";function Wie(){if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function b2(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function w2(t){for(var e=1;e0&&s[0]!==void 0?s[0]:1,!this.dirty){f.next=6;break}return this.compiledBundle.context&&(i>1?this.compiledBundle.context.maxIteration=i:this.compiledBundle.context.maxIteration++),f.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(l){var c=l.isReferer;return c}).forEach(function(l){var c=l.data,h=l.name;a.model.confirmInput(c.model,h)}),o=0;o"u";case"symbol":return typeof T=="symbol"}}function h(T,F,W){c(T,F)||o("invalid parameter type"+u(W)+". expected "+F+", got "+typeof T)}function d(T,F){T>=0&&(T|0)===T||o("invalid parameter type, ("+T+")"+u(F)+". must be a nonnegative integer")}function v(T,F,W){F.indexOf(T)<0&&o("invalid value"+u(W)+". must be one of: "+F)}var p=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(T){Object.keys(T).forEach(function(F){p.indexOf(F)<0&&o('invalid regl constructor argument "'+F+'". must be one of '+p)})}function y(T,F){for(T=T+"";T.length0&&F.push(new w("unknown",0,W))}}),F}function A(T,F){F.forEach(function(W){var ue=T[W.file];if(ue){var be=ue.index[W.line];if(be){be.errors.push(W),ue.hasErrors=!0;return}}T.unknown.hasErrors=!0,T.unknown.lines[0].errors.push(W)})}function M(T,F,W,ue,be){if(!T.getShaderParameter(F,T.COMPILE_STATUS)){var se=T.getShaderInfoLog(F),de=ue===T.FRAGMENT_SHADER?"fragment":"vertex";z(W,"string",de+" shader source must be a string",be);var Ce=_(W,be),Ne=S(se);A(Ce,Ne),Object.keys(Ce).forEach(function(Pe){var Oe=Ce[Pe];if(!Oe.hasErrors)return;var Be=[""],Xe=[""];function Te(Ge,re){Be.push(Ge),Xe.push(re||"")}Te("file number "+Pe+": "+Oe.name+` `,"color:red;text-decoration:underline;font-weight:bold"),Oe.lines.forEach(function(Ge){if(Ge.errors.length>0){Te(y(Ge.number,4)+"| ","background-color:yellow; font-weight:bold"),Te(Ge.line+a,"color:red; background-color:yellow; font-weight:bold");var re=0;Ge.errors.forEach(function(ve){var De=ve.message,He=/^\s*'(.*)'\s*:\s*(.*)$/.exec(De);if(He){var Ee=He[1];switch(De=He[2],Ee){case"assign":Ee="=";break}re=Math.max(Ge.line.indexOf(Ee,re),0)}else re=0;Te(y("| ",6)),Te(y("^^^",re+3)+a,"font-weight:bold"),Te(y("| ",6)),Te(De+a,"font-weight:bold")}),Te(y("| ",6)+a)}else Te(y(Ge.number,4)+"| "),Te(Ge.line+a,"color:red")}),typeof document<"u"&&!window.chrome?(Xe[0]=Be.join("%c"),console.log.apply(console,Xe)):console.log(Be.join(""))}),s.raise("Error compiling "+de+" shader, "+Ce[0].name)}}function C(T,F,W,ue,be){if(!T.getProgramParameter(F,T.LINK_STATUS)){var se=T.getProgramInfoLog(F),de=_(W,be),Ce=_(ue,be),Ne='Error linking program with vertex shader, "'+Ce[0].name+'", and fragment shader "'+de[0].name+'"';typeof document<"u"?console.log("%c"+Ne+a+"%c"+se,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Ne+a+se),s.raise(Ne)}}function I(T){T._commandRef=x()}function k(T,F,W,ue){I(T);function be(Ne){return Ne?ue.id(Ne):0}T._fragId=be(T.static.frag),T._vertId=be(T.static.vert);function se(Ne,Pe){Object.keys(Pe).forEach(function(Oe){Ne[ue.id(Oe)]=!0})}var de=T._uniformSet={};se(de,F.static),se(de,F.dynamic);var Ce=T._attributeSet={};se(Ce,W.static),se(Ce,W.dynamic),T._hasCount="count"in T.static||"count"in T.dynamic||"elements"in T.static||"elements"in T.dynamic}function O(T,F){var W=E();o(T+" in command "+(F||x())+(W==="unknown"?"":" called from "+W))}function B(T,F,W){T||O(F,W||x())}function L(T,F,W,ue){T in F||O("unknown parameter ("+T+")"+u(W)+". possible values: "+Object.keys(F).join(),ue||x())}function z(T,F,W,ue){c(T,F)||O("invalid parameter type"+u(W)+". expected "+F+", got "+typeof T,ue||x())}function X(T){T()}function R(T,F,W){T.texture?v(T.texture._texture.internalformat,F,"unsupported texture format for attachment"):v(T.renderbuffer._renderbuffer.format,W,"unsupported renderbuffer format for attachment")}var V=33071,he=9728,ce=9984,le=9985,ie=9986,Ie=9987,qe=5120,Ve=5121,it=5122,dt=5123,st=5124,Tt=5125,_t=5126,lr=32819,Bt=32820,Wt=33635,vr=34042,cr=36193,$t={};$t[qe]=$t[Ve]=1,$t[it]=$t[dt]=$t[cr]=$t[Wt]=$t[lr]=$t[Bt]=2,$t[st]=$t[Tt]=$t[_t]=$t[vr]=4;function sr(T,F){return T===Bt||T===lr||T===Wt?2:T===vr?4:$t[T]*F}function tn(T){return!(T&T-1)&&!!T}function tt(T,F,W){var ue,be=F.width,se=F.height,de=F.channels;s(be>0&&be<=W.maxTextureSize&&se>0&&se<=W.maxTextureSize,"invalid texture shape"),(T.wrapS!==V||T.wrapT!==V)&&s(tn(be)&&tn(se),"incompatible wrap mode for texture, both width and height must be power of 2"),F.mipmask===1?be!==1&&se!==1&&s(T.minFilter!==ce&&T.minFilter!==ie&&T.minFilter!==le&&T.minFilter!==Ie,"min filter requires mipmap"):(s(tn(be)&&tn(se),"texture must be a square power of 2 to support mipmapping"),s(F.mipmask===(be<<1)-1,"missing or incomplete mipmap data")),F.type===_t&&(W.extensions.indexOf("oes_texture_float_linear")<0&&s(T.minFilter===he&&T.magFilter===he,"filter not supported, must enable oes_texture_float_linear"),s(!T.genMipmaps,"mipmap generation not supported with float textures"));var Ce=F.images;for(ue=0;ue<16;++ue)if(Ce[ue]){var Ne=be>>ue,Pe=se>>ue;s(F.mipmask&1<0&&be<=ue.maxTextureSize&&se>0&&se<=ue.maxTextureSize,"invalid texture shape"),s(be===se,"cube map must be square"),s(F.wrapS===V&&F.wrapT===V,"wrap mode not supported by cube map");for(var Ce=0;Ce>Oe,Te=se>>Oe;s(Ne.mipmask&1<1&&F===W&&(F==='"'||F==="'"))return['"'+Ze(T.substr(1,T.length-2))+'"'];var ue=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(T);if(ue)return Je(T.substr(0,ue.index)).concat(Je(ue[1])).concat(Je(T.substr(ue.index+ue[0].length)));var be=T.split(".");if(be.length===1)return['"'+Ze(T)+'"'];for(var se=[],de=0;deDt(W,F+"["+ue+"]")));if(T instanceof $e)return T;N(!1,"invalid option type in uniform "+F)}var fr={DynamicVariable:$e,define:Lt,isDynamic:ur,unbox:Dt,accessor:ht},or={next:typeof requestAnimationFrame=="function"?function(T){return requestAnimationFrame(T)}:function(T){return setTimeout(T,16)},cancel:typeof cancelAnimationFrame=="function"?function(T){return cancelAnimationFrame(T)}:clearTimeout},gr=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function hr(){var T={"":0},F=[""];return{id:function(W){var ue=T[W];return ue||(ue=T[W]=F.length,F.push(W),ue)},str:function(W){return F[W]}}}function hn(T,F,W){var ue=document.createElement("canvas");n(ue.style,{border:0,margin:0,padding:0,top:0,left:0}),T.appendChild(ue),T===document.body&&(ue.style.position="absolute",n(T.style,{margin:0,padding:0}));function be(){var Ce=window.innerWidth,Ne=window.innerHeight;if(T!==document.body){var Pe=T.getBoundingClientRect();Ce=Pe.right-Pe.left,Ne=Pe.bottom-Pe.top}ue.width=W*Ce,ue.height=W*Ne,n(ue.style,{width:Ce+"px",height:Ne+"px"})}var se;T!==document.body&&typeof ResizeObserver=="function"?(se=new ResizeObserver(function(){setTimeout(be)}),se.observe(T)):window.addEventListener("resize",be,!1);function de(){se?se.disconnect():window.removeEventListener("resize",be),T.removeChild(ue)}return be(),{canvas:ue,onDestroy:de}}function nr(T,F){function W(ue){try{return T.getContext(ue,F)}catch{return null}}return W("webgl")||W("experimental-webgl")||W("webgl-experimental")}function Fr(T){return typeof T.nodeName=="string"&&typeof T.appendChild=="function"&&typeof T.getBoundingClientRect=="function"}function oa(T){return typeof T.drawArrays=="function"||typeof T.drawElements=="function"}function Ur(T){return typeof T=="string"?T.split():(N(Array.isArray(T),"invalid extension array"),T)}function Mi(T){return typeof T=="string"?(N(typeof document<"u","not supported outside of DOM"),document.querySelector(T)):T}function xu(T){var F=T||{},W,ue,be,se,de={},Ce=[],Ne=[],Pe=typeof window>"u"?1:window.devicePixelRatio,Oe=!1,Be=function(Ge){Ge&&N.raise(Ge)},Xe=function(){};if(typeof F=="string"?(N(typeof document<"u","selector queries only supported in DOM enviroments"),W=document.querySelector(F),N(W,"invalid query string for element")):typeof F=="object"?Fr(F)?W=F:oa(F)?(se=F,be=se.canvas):(N.constructor(F),"gl"in F?se=F.gl:"canvas"in F?be=Mi(F.canvas):"container"in F&&(ue=Mi(F.container)),"attributes"in F&&(de=F.attributes,N.type(de,"object","invalid context attributes")),"extensions"in F&&(Ce=Ur(F.extensions)),"optionalExtensions"in F&&(Ne=Ur(F.optionalExtensions)),"onDone"in F&&(N.type(F.onDone,"function","invalid or missing onDone callback"),Be=F.onDone),"profile"in F&&(Oe=!!F.profile),"pixelRatio"in F&&(Pe=+F.pixelRatio,N(Pe>0,"invalid pixel ratio"))):N.raise("invalid arguments to regl"),W&&(W.nodeName.toLowerCase()==="canvas"?be=W:ue=W),!se){if(!be){N(typeof document<"u","must manually specify webgl context outside of DOM environments");var Te=hn(ue||document.body,Be,Pe);if(!Te)return null;be=Te.canvas,Xe=Te.onDestroy}de.premultipliedAlpha===void 0&&(de.premultipliedAlpha=!0),se=nr(be,de)}return se?{gl:se,canvas:be,container:ue,extensions:Ce,optionalExtensions:Ne,pixelRatio:Pe,profile:Oe,onDone:Be,onDestroy:Xe}:(Xe(),Be("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function Eu(T,F){var W={};function ue(de){N.type(de,"string","extension name must be string");var Ce=de.toLowerCase(),Ne;try{Ne=W[Ce]=T.getExtension(Ce)}catch{}return!!Ne}for(var be=0;be65535)<<4,T>>>=F,W=(T>255)<<3,T>>>=W,F|=W,W=(T>15)<<2,T>>>=W,F|=W,W=(T>3)<<1,T>>>=W,F|=W,F|T>>1}function dr(){var T=rn(8,function(){return[]});function F(se){var de=ua(se),Ce=T[St(de)>>2];return Ce.length>0?Ce.pop():new ArrayBuffer(de)}function W(se){T[St(se.byteLength)>>2].push(se)}function ue(se,de){var Ce=null;switch(se){case ti:Ce=new Int8Array(F(de),0,de);break;case uo:Ce=new Uint8Array(F(de),0,de);break;case _u:Ce=new Int16Array(F(2*de),0,de);break;case Su:Ce=new Uint16Array(F(2*de),0,de);break;case Mu:Ce=new Int32Array(F(4*de),0,de);break;case sa:Ce=new Uint32Array(F(4*de),0,de);break;case Br:Ce=new Float32Array(F(4*de),0,de);break;default:return null}return Ce.length!==de?Ce.subarray(0,de):Ce}function be(se){W(se.buffer)}return{alloc:F,free:W,allocType:ue,freeType:be}}var gt=dr();gt.zero=dr();var Sr=3408,dn=3410,fo=3411,lo=3412,ri=3413,co=3414,ho=3415,vo=33901,RO=33902,FO=3379,BO=3386,GO=34921,zO=36347,jO=36348,UO=35661,$O=35660,XO=34930,WO=36349,VO=34076,YO=34024,qO=7936,HO=7937,ZO=7938,KO=35724,QO=34047,JO=36063,eL=34852,Cl=3553,p1=34067,tL=34069,rL=33984,Au=6408,dv=5126,g1=5121,vv=36160,nL=36053,aL=36064,iL=16384,oL=function(T,F){var W=1;F.ext_texture_filter_anisotropic&&(W=T.getParameter(QO));var ue=1,be=1;F.webgl_draw_buffers&&(ue=T.getParameter(eL),be=T.getParameter(JO));var se=!!F.oes_texture_float;if(se){var de=T.createTexture();T.bindTexture(Cl,de),T.texImage2D(Cl,0,Au,1,1,0,Au,dv,null);var Ce=T.createFramebuffer();if(T.bindFramebuffer(vv,Ce),T.framebufferTexture2D(vv,aL,Cl,de,0),T.bindTexture(Cl,null),T.checkFramebufferStatus(vv)!==nL)se=!1;else{T.viewport(0,0,1,1),T.clearColor(1,0,0,1),T.clear(iL);var Ne=gt.allocType(dv,4);T.readPixels(0,0,1,1,Au,dv,Ne),T.getError()?se=!1:(T.deleteFramebuffer(Ce),T.deleteTexture(de),se=Ne[0]===1),gt.freeType(Ne)}}var Pe=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),Oe=!0;if(!Pe){var Be=T.createTexture(),Xe=gt.allocType(g1,36);T.activeTexture(rL),T.bindTexture(p1,Be),T.texImage2D(tL,0,Au,3,3,0,Au,g1,Xe),gt.freeType(Xe),T.bindTexture(p1,null),T.deleteTexture(Be),Oe=!T.getError()}return{colorBits:[T.getParameter(dn),T.getParameter(fo),T.getParameter(lo),T.getParameter(ri)],depthBits:T.getParameter(co),stencilBits:T.getParameter(ho),subpixelBits:T.getParameter(Sr),extensions:Object.keys(F).filter(function(Te){return!!F[Te]}),maxAnisotropic:W,maxDrawbuffers:ue,maxColorAttachments:be,pointSizeDims:T.getParameter(vo),lineWidthDims:T.getParameter(RO),maxViewportDims:T.getParameter(BO),maxCombinedTextureUnits:T.getParameter(UO),maxCubeMapSize:T.getParameter(VO),maxRenderbufferSize:T.getParameter(YO),maxTextureUnits:T.getParameter(XO),maxTextureSize:T.getParameter(FO),maxAttributes:T.getParameter(GO),maxVertexUniforms:T.getParameter(zO),maxVertexTextureUnits:T.getParameter($O),maxVaryingVectors:T.getParameter(jO),maxFragmentUniforms:T.getParameter(WO),glsl:T.getParameter(KO),renderer:T.getParameter(HO),vendor:T.getParameter(qO),version:T.getParameter(ZO),readFloat:se,npotTextureCube:Oe}};function fa(T){return!!T&&typeof T=="object"&&Array.isArray(T.shape)&&Array.isArray(T.stride)&&typeof T.offset=="number"&&T.shape.length===T.stride.length&&(Array.isArray(T.data)||r(T.data))}var Pn=function(T){return Object.keys(T).map(function(F){return T[F]})},Tl={shape:lL,flatten:fL};function sL(T,F,W){for(var ue=0;ue0){var ze;if(Array.isArray(ve[0])){Ae=b1(ve);for(var Me=1,je=1;je0)if(typeof Me[0]=="number"){var We=gt.allocType(Ee.dtype,Me.length);x1(We,Me),Ae(We,ct),gt.freeType(We)}else if(Array.isArray(Me[0])||r(Me[0])){Mt=b1(Me);var Re=gv(Me,Mt,Ee.dtype);Ae(Re,ct),gt.freeType(Re)}else N.raise("invalid buffer data")}else if(fa(Me)){Mt=Me.shape;var xe=Me.stride,xt=0,It=0,nt=0,Rt=0;Mt.length===1?(xt=Mt[0],It=1,nt=xe[0],Rt=0):Mt.length===2?(xt=Mt[0],It=Mt[1],nt=xe[0],Rt=xe[1]):N.raise("invalid shape");var At=Array.isArray(Me.data)?Ee.dtype:kl(Me.data),Pt=gt.allocType(At,xt*It);E1(Pt,Me.data,xt,It,nt,Rt,Me.offset),Ae(Pt,ct),gt.freeType(Pt)}else N.raise("invalid data for buffer subdata");return et}return De||et(re),et._reglType="buffer",et._buffer=Ee,et.subdata=ze,W.profile&&(et.stats=Ee.stats),et.destroy=function(){Xe(Ee)},et}function Ge(){Pn(se).forEach(function(re){re.buffer=T.createBuffer(),T.bindBuffer(re.type,re.buffer),T.bufferData(re.type,re.persistentData||re.byteLength,re.usage)})}return W.profile&&(F.getTotalBufferSize=function(){var re=0;return Object.keys(se).forEach(function(ve){re+=se[ve].stats.size}),re}),{create:Te,createStream:Ne,destroyStream:Pe,clear:function(){Pn(se).forEach(Xe),Ce.forEach(Xe)},getBuffer:function(re){return re&&re._buffer instanceof de?re._buffer:null},restore:Ge,_initBuffer:Be}}var _L=0,SL=0,ML=1,AL=1,CL=4,TL=4,ns={points:_L,point:SL,lines:ML,line:AL,triangles:CL,triangle:TL,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},IL=0,kL=1,Cu=4,NL=5120,as=5121,_1=5122,is=5123,S1=5124,go=5125,bv=34963,OL=35040,LL=35044;function DL(T,F,W,ue){var be={},se=0,de={uint8:as,uint16:is};F.oes_element_index_uint&&(de.uint32=go);function Ce(Ge){this.id=se++,be[this.id]=this,this.buffer=Ge,this.primType=Cu,this.vertCount=0,this.type=0}Ce.prototype.bind=function(){this.buffer.bind()};var Ne=[];function Pe(Ge){var re=Ne.pop();return re||(re=new Ce(W.create(null,bv,!0,!1)._buffer)),Be(re,Ge,OL,-1,-1,0,0),re}function Oe(Ge){Ne.push(Ge)}function Be(Ge,re,ve,De,He,Ee,et){Ge.buffer.bind();var Ae;if(re){var ze=et;!et&&(!r(re)||fa(re)&&!r(re.data))&&(ze=F.oes_element_index_uint?go:is),W._initBuffer(Ge.buffer,re,ve,ze,3)}else T.bufferData(bv,Ee,ve),Ge.buffer.dtype=Ae||as,Ge.buffer.usage=ve,Ge.buffer.dimension=3,Ge.buffer.byteLength=Ee;if(Ae=et,!et){switch(Ge.buffer.dtype){case as:case NL:Ae=as;break;case is:case _1:Ae=is;break;case go:case S1:Ae=go;break;default:N.raise("unsupported type for element array")}Ge.buffer.dtype=Ae}Ge.type=Ae,N(Ae!==go||!!F.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Me=He;Me<0&&(Me=Ge.buffer.byteLength,Ae===is?Me>>=1:Ae===go&&(Me>>=2)),Ge.vertCount=Me;var je=De;if(De<0){je=Cu;var ct=Ge.buffer.dimension;ct===1&&(je=IL),ct===2&&(je=kL),ct===3&&(je=Cu)}Ge.primType=je}function Xe(Ge){ue.elementsCount--,N(Ge.buffer!==null,"must not double destroy elements"),delete be[Ge.id],Ge.buffer.destroy(),Ge.buffer=null}function Te(Ge,re){var ve=W.create(null,bv,!0),De=new Ce(ve._buffer);ue.elementsCount++;function He(Ee){if(!Ee)ve(),De.primType=Cu,De.vertCount=0,De.type=as;else if(typeof Ee=="number")ve(Ee),De.primType=Cu,De.vertCount=Ee|0,De.type=as;else{var et=null,Ae=LL,ze=-1,Me=-1,je=0,ct=0;Array.isArray(Ee)||r(Ee)||fa(Ee)?et=Ee:(N.type(Ee,"object","invalid arguments for elements"),"data"in Ee&&(et=Ee.data,N(Array.isArray(et)||r(et)||fa(et),"invalid data for element buffer")),"usage"in Ee&&(N.parameter(Ee.usage,Il,"invalid element buffer usage"),Ae=Il[Ee.usage]),"primitive"in Ee&&(N.parameter(Ee.primitive,ns,"invalid element buffer primitive"),ze=ns[Ee.primitive]),"count"in Ee&&(N(typeof Ee.count=="number"&&Ee.count>=0,"invalid vertex count for elements"),Me=Ee.count|0),"type"in Ee&&(N.parameter(Ee.type,de,"invalid buffer type"),ct=de[Ee.type]),"length"in Ee?je=Ee.length|0:(je=Me,ct===is||ct===_1?je*=2:(ct===go||ct===S1)&&(je*=4))),Be(De,et,Ae,ze,Me,je,ct)}return He}return He(Ge),He._reglType="elements",He._elements=De,He.subdata=function(Ee,et){return ve.subdata(Ee,et),He},He.destroy=function(){Xe(De)},He}return{create:Te,createStream:Pe,destroyStream:Oe,getElements:function(Ge){return typeof Ge=="function"&&Ge._elements instanceof Ce?Ge._elements:null},clear:function(){Pn(be).forEach(Xe)}}}var M1=new Float32Array(1),PL=new Uint32Array(M1.buffer),RL=5123;function A1(T){for(var F=gt.allocType(RL,T.length),W=0;W>>31<<15,se=(ue<<1>>>24)-127,de=ue>>13&1023;if(se<-24)F[W]=be;else if(se<-14){var Ce=-14-se;F[W]=be+(de+1024>>Ce)}else se>15?F[W]=be+31744:F[W]=be+(se+15<<10)+de}return F}function Mr(T){return Array.isArray(T)||r(T)}var C1=function(T){return!(T&T-1)&&!!T},FL=34467,Ca=3553,wv=34067,Nl=34069,yo=6408,xv=6406,Ol=6407,Tu=6409,Ll=6410,T1=32854,Ev=32855,I1=36194,BL=32819,GL=32820,zL=33635,jL=34042,_v=6402,Dl=34041,Sv=35904,Mv=35906,os=36193,Av=33776,Cv=33777,Tv=33778,Iv=33779,k1=35986,N1=35987,O1=34798,L1=35840,D1=35841,P1=35842,R1=35843,F1=36196,ss=5121,kv=5123,Nv=5125,Iu=5126,UL=10242,$L=10243,XL=10497,Ov=33071,WL=33648,VL=10240,YL=10241,Lv=9728,qL=9729,Dv=9984,B1=9985,G1=9986,Pv=9987,HL=33170,Pl=4352,ZL=4353,KL=4354,QL=34046,JL=3317,eD=37440,tD=37441,rD=37443,z1=37444,ku=33984,nD=[Dv,G1,B1,Pv],Rl=[0,Tu,Ll,Ol,yo],Yn={};Yn[Tu]=Yn[xv]=Yn[_v]=1,Yn[Dl]=Yn[Ll]=2,Yn[Ol]=Yn[Sv]=3,Yn[yo]=Yn[Mv]=4;function us(T){return"[object "+T+"]"}var j1=us("HTMLCanvasElement"),U1=us("OffscreenCanvas"),$1=us("CanvasRenderingContext2D"),X1=us("ImageBitmap"),W1=us("HTMLImageElement"),V1=us("HTMLVideoElement"),aD=Object.keys(pv).concat([j1,U1,$1,X1,W1,V1]),fs=[];fs[ss]=1,fs[Iu]=4,fs[os]=2,fs[kv]=2,fs[Nv]=4;var nn=[];nn[T1]=2,nn[Ev]=2,nn[I1]=2,nn[Dl]=4,nn[Av]=.5,nn[Cv]=.5,nn[Tv]=1,nn[Iv]=1,nn[k1]=.5,nn[N1]=1,nn[O1]=1,nn[L1]=.5,nn[D1]=.25,nn[P1]=.5,nn[R1]=.25,nn[F1]=.5;function Y1(T){return Array.isArray(T)&&(T.length===0||typeof T[0]=="number")}function q1(T){if(!Array.isArray(T))return!1;var F=T.length;return!(F===0||!Mr(T[0]))}function mo(T){return Object.prototype.toString.call(T)}function H1(T){return mo(T)===j1}function Z1(T){return mo(T)===U1}function iD(T){return mo(T)===$1}function oD(T){return mo(T)===X1}function sD(T){return mo(T)===W1}function uD(T){return mo(T)===V1}function Rv(T){if(!T)return!1;var F=mo(T);return aD.indexOf(F)>=0?!0:Y1(T)||q1(T)||fa(T)}function K1(T){return pv[Object.prototype.toString.call(T)]|0}function fD(T,F){var W=F.length;switch(T.type){case ss:case kv:case Nv:case Iu:var ue=gt.allocType(T.type,W);ue.set(F),T.data=ue;break;case os:T.data=A1(F);break;default:N.raise("unsupported texture type, must specify a typed array")}}function Q1(T,F){return gt.allocType(T.type===os?Iu:T.type,F)}function J1(T,F){T.type===os?(T.data=A1(F),gt.freeType(F)):T.data=F}function lD(T,F,W,ue,be,se){for(var de=T.width,Ce=T.height,Ne=T.channels,Pe=de*Ce*Ne,Oe=Q1(T,Pe),Be=0,Xe=0;Xe=1;)Ce+=de*Ne*Ne,Ne/=2;return Ce}else return de*W*ue}function cD(T,F,W,ue,be,se,de){var Ce={"don't care":Pl,"dont care":Pl,nice:KL,fast:ZL},Ne={repeat:XL,clamp:Ov,mirror:WL},Pe={nearest:Lv,linear:qL},Oe=n({mipmap:Pv,"nearest mipmap nearest":Dv,"linear mipmap nearest":B1,"nearest mipmap linear":G1,"linear mipmap linear":Pv},Pe),Be={none:0,browser:z1},Xe={uint8:ss,rgba4:BL,rgb565:zL,"rgb5 a1":GL},Te={alpha:xv,luminance:Tu,"luminance alpha":Ll,rgb:Ol,rgba:yo,rgba4:T1,"rgb5 a1":Ev,rgb565:I1},Ge={};F.ext_srgb&&(Te.srgb=Sv,Te.srgba=Mv),F.oes_texture_float&&(Xe.float32=Xe.float=Iu),F.oes_texture_half_float&&(Xe.float16=Xe["half float"]=os),F.webgl_depth_texture&&(n(Te,{depth:_v,"depth stencil":Dl}),n(Xe,{uint16:kv,uint32:Nv,"depth stencil":jL})),F.webgl_compressed_texture_s3tc&&n(Ge,{"rgb s3tc dxt1":Av,"rgba s3tc dxt1":Cv,"rgba s3tc dxt3":Tv,"rgba s3tc dxt5":Iv}),F.webgl_compressed_texture_atc&&n(Ge,{"rgb atc":k1,"rgba atc explicit alpha":N1,"rgba atc interpolated alpha":O1}),F.webgl_compressed_texture_pvrtc&&n(Ge,{"rgb pvrtc 4bppv1":L1,"rgb pvrtc 2bppv1":D1,"rgba pvrtc 4bppv1":P1,"rgba pvrtc 2bppv1":R1}),F.webgl_compressed_texture_etc1&&(Ge["rgb etc1"]=F1);var re=Array.prototype.slice.call(T.getParameter(FL));Object.keys(Ge).forEach(function($){var fe=Ge[$];re.indexOf(fe)>=0&&(Te[$]=fe)});var ve=Object.keys(Te);W.textureFormats=ve;var De=[];Object.keys(Te).forEach(function($){var fe=Te[$];De[fe]=$});var He=[];Object.keys(Xe).forEach(function($){var fe=Xe[$];He[fe]=$});var Ee=[];Object.keys(Pe).forEach(function($){var fe=Pe[$];Ee[fe]=$});var et=[];Object.keys(Oe).forEach(function($){var fe=Oe[$];et[fe]=$});var Ae=[];Object.keys(Ne).forEach(function($){var fe=Ne[$];Ae[fe]=$});var ze=ve.reduce(function($,fe){var oe=Te[fe];return oe===Tu||oe===xv||oe===Tu||oe===Ll||oe===_v||oe===Dl||F.ext_srgb&&(oe===Sv||oe===Mv)?$[oe]=oe:oe===Ev||fe.indexOf("rgba")>=0?$[oe]=yo:$[oe]=Ol,$},{});function Me(){this.internalformat=yo,this.format=yo,this.type=ss,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=z1,this.width=0,this.height=0,this.channels=0}function je($,fe){$.internalformat=fe.internalformat,$.format=fe.format,$.type=fe.type,$.compressed=fe.compressed,$.premultiplyAlpha=fe.premultiplyAlpha,$.flipY=fe.flipY,$.unpackAlignment=fe.unpackAlignment,$.colorSpace=fe.colorSpace,$.width=fe.width,$.height=fe.height,$.channels=fe.channels}function ct($,fe){if(!(typeof fe!="object"||!fe)){if("premultiplyAlpha"in fe&&(N.type(fe.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),$.premultiplyAlpha=fe.premultiplyAlpha),"flipY"in fe&&(N.type(fe.flipY,"boolean","invalid texture flip"),$.flipY=fe.flipY),"alignment"in fe&&(N.oneOf(fe.alignment,[1,2,4,8],"invalid texture unpack alignment"),$.unpackAlignment=fe.alignment),"colorSpace"in fe&&(N.parameter(fe.colorSpace,Be,"invalid colorSpace"),$.colorSpace=Be[fe.colorSpace]),"type"in fe){var oe=fe.type;N(F.oes_texture_float||!(oe==="float"||oe==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),N(F.oes_texture_half_float||!(oe==="half float"||oe==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),N(F.webgl_depth_texture||!(oe==="uint16"||oe==="uint32"||oe==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(oe,Xe,"invalid texture type"),$.type=Xe[oe]}var rt=$.width,Ft=$.height,j=$.channels,D=!1;"shape"in fe?(N(Array.isArray(fe.shape)&&fe.shape.length>=2,"shape must be an array"),rt=fe.shape[0],Ft=fe.shape[1],fe.shape.length===3&&(j=fe.shape[2],N(j>0&&j<=4,"invalid number of channels"),D=!0),N(rt>=0&&rt<=W.maxTextureSize,"invalid width"),N(Ft>=0&&Ft<=W.maxTextureSize,"invalid height")):("radius"in fe&&(rt=Ft=fe.radius,N(rt>=0&&rt<=W.maxTextureSize,"invalid radius")),"width"in fe&&(rt=fe.width,N(rt>=0&&rt<=W.maxTextureSize,"invalid width")),"height"in fe&&(Ft=fe.height,N(Ft>=0&&Ft<=W.maxTextureSize,"invalid height")),"channels"in fe&&(j=fe.channels,N(j>0&&j<=4,"invalid number of channels"),D=!0)),$.width=rt|0,$.height=Ft|0,$.channels=j|0;var q=!1;if("format"in fe){var ee=fe.format;N(F.webgl_depth_texture||!(ee==="depth"||ee==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),N.parameter(ee,Te,"invalid texture format");var ne=$.internalformat=Te[ee];$.format=ze[ne],ee in Xe&&("type"in fe||($.type=Xe[ee])),ee in Ge&&($.compressed=!0),q=!0}!D&&q?$.channels=Yn[$.format]:D&&!q?$.channels!==Rl[$.format]&&($.format=$.internalformat=Rl[$.channels]):q&&D&&N($.channels===Yn[$.format],"number of channels inconsistent with specified format")}}function Mt($){T.pixelStorei(eD,$.flipY),T.pixelStorei(tD,$.premultiplyAlpha),T.pixelStorei(rD,$.colorSpace),T.pixelStorei(JL,$.unpackAlignment)}function We(){Me.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function Re($,fe){var oe=null;if(Rv(fe)?oe=fe:fe&&(N.type(fe,"object","invalid pixel data type"),ct($,fe),"x"in fe&&($.xOffset=fe.x|0),"y"in fe&&($.yOffset=fe.y|0),Rv(fe.data)&&(oe=fe.data)),N(!$.compressed||oe instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),fe.copy){N(!oe,"can not specify copy and data field for the same texture");var rt=be.viewportWidth,Ft=be.viewportHeight;$.width=$.width||rt-$.xOffset,$.height=$.height||Ft-$.yOffset,$.needsCopy=!0,N($.xOffset>=0&&$.xOffset=0&&$.yOffset0&&$.width<=rt&&$.height>0&&$.height<=Ft,"copy texture read out of bounds")}else if(!oe)$.width=$.width||1,$.height=$.height||1,$.channels=$.channels||4;else if(r(oe))$.channels=$.channels||4,$.data=oe,!("type"in fe)&&$.type===ss&&($.type=K1(oe));else if(Y1(oe))$.channels=$.channels||4,fD($,oe),$.alignment=1,$.needsFree=!0;else if(fa(oe)){var j=oe.data;!Array.isArray(j)&&$.type===ss&&($.type=K1(j));var D=oe.shape,q=oe.stride,ee,ne,K,H,Q,U;D.length===3?(K=D[2],U=q[2]):(N(D.length===2,"invalid ndarray pixel data, must be 2 or 3D"),K=1,U=1),ee=D[0],ne=D[1],H=q[0],Q=q[1],$.alignment=1,$.width=ee,$.height=ne,$.channels=K,$.format=$.internalformat=Rl[K],$.needsFree=!0,lD($,j,H,Q,U,oe.offset)}else if(H1(oe)||Z1(oe)||iD(oe))H1(oe)||Z1(oe)?$.element=oe:$.element=oe.canvas,$.width=$.element.width,$.height=$.element.height,$.channels=4;else if(oD(oe))$.element=oe,$.width=oe.width,$.height=oe.height,$.channels=4;else if(sD(oe))$.element=oe,$.width=oe.naturalWidth,$.height=oe.naturalHeight,$.channels=4;else if(uD(oe))$.element=oe,$.width=oe.videoWidth,$.height=oe.videoHeight,$.channels=4;else if(q1(oe)){var Y=$.width||oe[0].length,G=$.height||oe.length,J=$.channels;Mr(oe[0][0])?J=J||oe[0][0].length:J=J||1;for(var ae=Tl.shape(oe),ye=1,we=0;we=0,"oes_texture_float extension not enabled"):$.type===os&&N(W.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function xe($,fe,oe){var rt=$.element,Ft=$.data,j=$.internalformat,D=$.format,q=$.type,ee=$.width,ne=$.height;Mt($),rt?T.texImage2D(fe,oe,D,D,q,rt):$.compressed?T.compressedTexImage2D(fe,oe,j,ee,ne,0,Ft):$.needsCopy?(ue(),T.copyTexImage2D(fe,oe,D,$.xOffset,$.yOffset,ee,ne,0)):T.texImage2D(fe,oe,D,ee,ne,0,D,q,Ft||null)}function xt($,fe,oe,rt,Ft){var j=$.element,D=$.data,q=$.internalformat,ee=$.format,ne=$.type,K=$.width,H=$.height;Mt($),j?T.texSubImage2D(fe,Ft,oe,rt,ee,ne,j):$.compressed?T.compressedTexSubImage2D(fe,Ft,oe,rt,q,K,H,D):$.needsCopy?(ue(),T.copyTexSubImage2D(fe,Ft,oe,rt,$.xOffset,$.yOffset,K,H)):T.texSubImage2D(fe,Ft,oe,rt,K,H,ee,ne,D)}var It=[];function nt(){return It.pop()||new We}function Rt($){$.needsFree&>.freeType($.data),We.call($),It.push($)}function At(){Me.call(this),this.genMipmaps=!1,this.mipmapHint=Pl,this.mipmask=0,this.images=Array(16)}function Pt($,fe,oe){var rt=$.images[0]=nt();$.mipmask=1,rt.width=$.width=fe,rt.height=$.height=oe,rt.channels=$.channels=4}function Qt($,fe){var oe=null;if(Rv(fe))oe=$.images[0]=nt(),je(oe,$),Re(oe,fe),$.mipmask=1;else if(ct($,fe),Array.isArray(fe.mipmap))for(var rt=fe.mipmap,Ft=0;Ft>=Ft,oe.height>>=Ft,Re(oe,rt[Ft]),$.mipmask|=1<=0&&!("faces"in fe)&&($.genMipmaps=!0)}if("mag"in fe){var rt=fe.mag;N.parameter(rt,Pe),$.magFilter=Pe[rt]}var Ft=$.wrapS,j=$.wrapT;if("wrap"in fe){var D=fe.wrap;typeof D=="string"?(N.parameter(D,Ne),Ft=j=Ne[D]):Array.isArray(D)&&(N.parameter(D[0],Ne),N.parameter(D[1],Ne),Ft=Ne[D[0]],j=Ne[D[1]])}else{if("wrapS"in fe){var q=fe.wrapS;N.parameter(q,Ne),Ft=Ne[q]}if("wrapT"in fe){var ee=fe.wrapT;N.parameter(ee,Ne),j=Ne[ee]}}if($.wrapS=Ft,$.wrapT=j,"anisotropic"in fe){var ne=fe.anisotropic;N(typeof ne=="number"&&ne>=1&&ne<=W.maxAnisotropic,"aniso samples must be between 1 and "),$.anisotropic=fe.anisotropic}if("mipmap"in fe){var K=!1;switch(typeof fe.mipmap){case"string":N.parameter(fe.mipmap,Ce,"invalid mipmap hint"),$.mipmapHint=Ce[fe.mipmap],$.genMipmaps=!0,K=!0;break;case"boolean":K=$.genMipmaps=fe.mipmap;break;case"object":N(Array.isArray(fe.mipmap),"invalid mipmap type"),$.genMipmaps=!1,K=!0;break;default:N.raise("invalid mipmap type")}K&&!("min"in fe)&&($.minFilter=Dv)}}function zr($,fe){T.texParameteri(fe,YL,$.minFilter),T.texParameteri(fe,VL,$.magFilter),T.texParameteri(fe,UL,$.wrapS),T.texParameteri(fe,$L,$.wrapT),F.ext_texture_filter_anisotropic&&T.texParameteri(fe,QL,$.anisotropic),$.genMipmaps&&(T.hint(HL,$.mipmapHint),T.generateMipmap(fe))}var jr=0,Yr={},an=W.maxTextureUnits,Ar=Array(an).map(function(){return null});function kt($){Me.call(this),this.mipmask=0,this.internalformat=yo,this.id=jr++,this.refCount=1,this.target=$,this.texture=T.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new pr,de.profile&&(this.stats={size:0})}function on($){T.activeTexture(ku),T.bindTexture($.target,$.texture)}function ir(){var $=Ar[0];$?T.bindTexture($.target,$.texture):T.bindTexture(Ca,null)}function vt($){var fe=$.texture;N(fe,"must not double destroy texture");var oe=$.unit,rt=$.target;oe>=0&&(T.activeTexture(ku+oe),T.bindTexture(rt,null),Ar[oe]=null),T.deleteTexture(fe),$.texture=null,$.params=null,$.pixels=null,$.refCount=0,delete Yr[$.id],se.textureCount--}n(kt.prototype,{bind:function(){var $=this;$.bindCount+=1;var fe=$.unit;if(fe<0){for(var oe=0;oe0)continue;rt.unit=-1}Ar[oe]=$,fe=oe;break}fe>=an&&N.raise("insufficient number of texture units"),de.profile&&se.maxTextureUnits>Q)-K,U.height=U.height||(oe.height>>Q)-H,N(oe.type===U.type&&oe.format===U.format&&oe.internalformat===U.internalformat,"incompatible format for texture.subimage"),N(K>=0&&H>=0&&K+U.width<=oe.width&&H+U.height<=oe.height,"texture.subimage write out of bounds"),N(oe.mipmask&1<>K;++K){var H=ee>>K,Q=ne>>K;if(!H||!Q)break;T.texImage2D(Ca,K,oe.format,H,Q,0,oe.format,oe.type,null)}return ir(),de.profile&&(oe.stats.size=Fl(oe.internalformat,oe.type,ee,ne,!1,!1)),rt}return rt($,fe),rt.subimage=Ft,rt.resize=j,rt._reglType="texture2d",rt._texture=oe,de.profile&&(rt.stats=oe.stats),rt.destroy=function(){oe.decRef()},rt}function Vt($,fe,oe,rt,Ft,j){var D=new kt(wv);Yr[D.id]=D,se.cubeCount++;var q=new Array(6);function ee(H,Q,U,Y,G,J){var ae,ye=D.texInfo;for(pr.call(ye),ae=0;ae<6;++ae)q[ae]=zt();if(typeof H=="number"||!H){var we=H|0||1;for(ae=0;ae<6;++ae)Pt(q[ae],we,we)}else if(typeof H=="object")if(Q)Qt(q[0],H),Qt(q[1],Q),Qt(q[2],U),Qt(q[3],Y),Qt(q[4],G),Qt(q[5],J);else if(Or(ye,H),ct(D,H),"faces"in H){var pe=H.faces;for(N(Array.isArray(pe)&&pe.length===6,"cube faces must be a length 6 array"),ae=0;ae<6;++ae)N(typeof pe[ae]=="object"&&!!pe[ae],"invalid input for cube map face"),je(q[ae],D),Qt(q[ae],pe[ae])}else for(ae=0;ae<6;++ae)Qt(q[ae],H);else N.raise("invalid arguments to cube map");for(je(D,q[0]),W.npotTextureCube||N(C1(D.width)&&C1(D.height),"your browser does not support non power or two texture dimensions"),ye.genMipmaps?D.mipmask=(q[0].width<<1)-1:D.mipmask=q[0].mipmask,N.textureCube(D,ye,q,W),D.internalformat=q[0].internalformat,ee.width=q[0].width,ee.height=q[0].height,on(D),ae=0;ae<6;++ae)Nr(q[ae],Nl+ae);for(zr(ye,wv),ir(),de.profile&&(D.stats.size=Fl(D.internalformat,D.type,ee.width,ee.height,ye.genMipmaps,!0)),ee.format=De[D.internalformat],ee.type=He[D.type],ee.mag=Ee[ye.magFilter],ee.min=et[ye.minFilter],ee.wrapS=Ae[ye.wrapS],ee.wrapT=Ae[ye.wrapT],ae=0;ae<6;++ae)Gr(q[ae]);return ee}function ne(H,Q,U,Y,G){N(!!Q,"must specify image data"),N(typeof H=="number"&&H===(H|0)&&H>=0&&H<6,"invalid face");var J=U|0,ae=Y|0,ye=G|0,we=nt();return je(we,D),we.width=0,we.height=0,Re(we,Q),we.width=we.width||(D.width>>ye)-J,we.height=we.height||(D.height>>ye)-ae,N(D.type===we.type&&D.format===we.format&&D.internalformat===we.internalformat,"incompatible format for texture.subimage"),N(J>=0&&ae>=0&&J+we.width<=D.width&&ae+we.height<=D.height,"texture.subimage write out of bounds"),N(D.mipmask&1<>Y;++Y)T.texImage2D(Nl+U,Y,D.format,Q>>Y,Q>>Y,0,D.format,D.type,null);return ir(),de.profile&&(D.stats.size=Fl(D.internalformat,D.type,ee.width,ee.height,!1,!0)),ee}}return ee($,fe,oe,rt,Ft,j),ee.subimage=ne,ee.resize=K,ee._reglType="textureCube",ee._texture=D,de.profile&&(ee.stats=D.stats),ee.destroy=function(){D.decRef()},ee}function Cr(){for(var $=0;$>rt,oe.height>>rt,0,oe.internalformat,oe.type,null);else for(var Ft=0;Ft<6;++Ft)T.texImage2D(Nl+Ft,rt,oe.internalformat,oe.width>>rt,oe.height>>rt,0,oe.internalformat,oe.type,null);zr(oe.texInfo,oe.target)})}function Mo(){for(var $=0;$=2,"invalid renderbuffer shape"),et=je[0]|0,Ae=je[1]|0}else"radius"in Me&&(et=Ae=Me.radius|0),"width"in Me&&(et=Me.width|0),"height"in Me&&(Ae=Me.height|0);"format"in Me&&(N.parameter(Me.format,se,"invalid renderbuffer format"),ze=se[Me.format])}else typeof He=="number"?(et=He|0,typeof Ee=="number"?Ae=Ee|0:Ae=et):He?N.raise("invalid arguments to renderbuffer constructor"):et=Ae=1;if(N(et>0&&Ae>0&&et<=W.maxRenderbufferSize&&Ae<=W.maxRenderbufferSize,"invalid renderbuffer size"),!(et===re.width&&Ae===re.height&&ze===re.format))return ve.width=re.width=et,ve.height=re.height=Ae,re.format=ze,T.bindRenderbuffer(Ci,re.renderbuffer),T.renderbufferStorage(Ci,ze,et,Ae),N(T.getError()===0,"invalid render buffer format"),be.profile&&(re.stats.size=fb(re.format,re.width,re.height)),ve.format=de[re.format],ve}function De(He,Ee){var et=He|0,Ae=Ee|0||et;return et===re.width&&Ae===re.height||(N(et>0&&Ae>0&&et<=W.maxRenderbufferSize&&Ae<=W.maxRenderbufferSize,"invalid renderbuffer size"),ve.width=re.width=et,ve.height=re.height=Ae,T.bindRenderbuffer(Ci,re.renderbuffer),T.renderbufferStorage(Ci,re.format,et,Ae),N(T.getError()===0,"invalid render buffer format"),be.profile&&(re.stats.size=fb(re.format,re.width,re.height))),ve}return ve(Te,Ge),ve.resize=De,ve._reglType="renderbuffer",ve._renderbuffer=re,be.profile&&(ve.stats=re.stats),ve.destroy=function(){re.decRef()},ve}be.profile&&(ue.getTotalRenderbufferSize=function(){var Te=0;return Object.keys(Ne).forEach(function(Ge){Te+=Ne[Ge].stats.size}),Te});function Xe(){Pn(Ne).forEach(function(Te){Te.renderbuffer=T.createRenderbuffer(),T.bindRenderbuffer(Ci,Te.renderbuffer),T.renderbufferStorage(Ci,Te.format,Te.width,Te.height)}),T.bindRenderbuffer(Ci,null)}return{create:Be,clear:function(){Pn(Ne).forEach(Oe)},restore:Xe}},ni=36160,Fv=36161,bo=3553,Gl=34069,lb=36064,cb=36096,hb=36128,db=33306,vb=36053,dD=36054,vD=36055,pD=36057,gD=36061,yD=36193,mD=5121,bD=5126,pb=6407,gb=6408,wD=6402,xD=[pb,gb],Bv=[];Bv[gb]=4,Bv[pb]=3;var zl=[];zl[mD]=1,zl[bD]=4,zl[yD]=2;var ED=32854,_D=32855,SD=36194,MD=33189,AD=36168,yb=34041,CD=35907,TD=34836,ID=34842,kD=34843,ND=[ED,_D,SD,CD,ID,kD,TD],ls={};ls[vb]="complete",ls[dD]="incomplete attachment",ls[pD]="incomplete dimensions",ls[vD]="incomplete, missing attachment",ls[gD]="unsupported";function OD(T,F,W,ue,be,se){var de={cur:null,next:null,dirty:!1,setFBO:null},Ce=["rgba"],Ne=["rgba4","rgb565","rgb5 a1"];F.ext_srgb&&Ne.push("srgba"),F.ext_color_buffer_half_float&&Ne.push("rgba16f","rgb16f"),F.webgl_color_buffer_float&&Ne.push("rgba32f");var Pe=["uint8"];F.oes_texture_half_float&&Pe.push("half float","float16"),F.oes_texture_float&&Pe.push("float","float32");function Oe(We,Re,xe){this.target=We,this.texture=Re,this.renderbuffer=xe;var xt=0,It=0;Re?(xt=Re.width,It=Re.height):xe&&(xt=xe.width,It=xe.height),this.width=xt,this.height=It}function Be(We){We&&(We.texture&&We.texture._texture.decRef(),We.renderbuffer&&We.renderbuffer._renderbuffer.decRef())}function Xe(We,Re,xe){if(We)if(We.texture){var xt=We.texture._texture,It=Math.max(1,xt.width),nt=Math.max(1,xt.height);N(It===Re&&nt===xe,"inconsistent width/height for supplied texture"),xt.refCount+=1}else{var Rt=We.renderbuffer._renderbuffer;N(Rt.width===Re&&Rt.height===xe,"inconsistent width/height for renderbuffer"),Rt.refCount+=1}}function Te(We,Re){Re&&(Re.texture?T.framebufferTexture2D(ni,We,Re.target,Re.texture._texture.texture,0):T.framebufferRenderbuffer(ni,We,Fv,Re.renderbuffer._renderbuffer.renderbuffer))}function Ge(We){var Re=bo,xe=null,xt=null,It=We;typeof We=="object"&&(It=We.data,"target"in We&&(Re=We.target|0)),N.type(It,"function","invalid attachment data");var nt=It._reglType;return nt==="texture2d"?(xe=It,N(Re===bo)):nt==="textureCube"?(xe=It,N(Re>=Gl&&Re=2,"invalid shape for framebuffer"),Pt=on[0],Qt=on[1]}else"radius"in kt&&(Pt=Qt=kt.radius),"width"in kt&&(Pt=kt.width),"height"in kt&&(Qt=kt.height);("color"in kt||"colors"in kt)&&(zt=kt.color||kt.colors,Array.isArray(zt)&&N(zt.length===1||F.webgl_draw_buffers,"multiple render targets not supported")),zt||("colorCount"in kt&&(zr=kt.colorCount|0,N(zr>0,"invalid color buffer count")),"colorTexture"in kt&&(Gr=!!kt.colorTexture,pr="rgba4"),"colorType"in kt&&(Or=kt.colorType,Gr?(N(F.oes_texture_float||!(Or==="float"||Or==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),N(F.oes_texture_half_float||!(Or==="half float"||Or==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):Or==="half float"||Or==="float16"?(N(F.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),pr="rgba16f"):(Or==="float"||Or==="float32")&&(N(F.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),pr="rgba32f"),N.oneOf(Or,Pe,"invalid color type")),"colorFormat"in kt&&(pr=kt.colorFormat,Ce.indexOf(pr)>=0?Gr=!0:Ne.indexOf(pr)>=0?Gr=!1:Gr?N.oneOf(kt.colorFormat,Ce,"invalid color format for texture"):N.oneOf(kt.colorFormat,Ne,"invalid color format for renderbuffer"))),("depthTexture"in kt||"depthStencilTexture"in kt)&&(Ar=!!(kt.depthTexture||kt.depthStencilTexture),N(!Ar||F.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in kt&&(typeof kt.depth=="boolean"?Nr=kt.depth:(jr=kt.depth,$r=!1)),"stencil"in kt&&(typeof kt.stencil=="boolean"?$r=kt.stencil:(Yr=kt.stencil,Nr=!1)),"depthStencil"in kt&&(typeof kt.depthStencil=="boolean"?Nr=$r=kt.depthStencil:(an=kt.depthStencil,Nr=!1,$r=!1))}var ir=null,vt=null,Gt=null,Vt=null;if(Array.isArray(zt))ir=zt.map(Ge);else if(zt)ir=[Ge(zt)];else for(ir=new Array(zr),At=0;At=0||ir[At].renderbuffer&&ND.indexOf(ir[At].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+At+" is invalid"),ir[At]&&ir[At].texture){var Ia=Bv[ir[At].texture._texture.format]*zl[ir[At].texture._texture.type];Cr===null?Cr=Ia:N(Cr===Ia,"all color attachments much have the same number of bits per pixel.")}return Xe(vt,Pt,Qt),N(!vt||vt.texture&&vt.texture._texture.format===wD||vt.renderbuffer&&vt.renderbuffer._renderbuffer.format===MD,"invalid depth attachment for framebuffer object"),Xe(Gt,Pt,Qt),N(!Gt||Gt.renderbuffer&&Gt.renderbuffer._renderbuffer.format===AD,"invalid stencil attachment for framebuffer object"),Xe(Vt,Pt,Qt),N(!Vt||Vt.texture&&Vt.texture._texture.format===yb||Vt.renderbuffer&&Vt.renderbuffer._renderbuffer.format===yb,"invalid depth-stencil attachment for framebuffer object"),Ae(xe),xe.width=Pt,xe.height=Qt,xe.colorAttachments=ir,xe.depthAttachment=vt,xe.stencilAttachment=Gt,xe.depthStencilAttachment=Vt,xt.color=ir.map(ve),xt.depth=ve(vt),xt.stencil=ve(Gt),xt.depthStencil=ve(Vt),xt.width=xe.width,xt.height=xe.height,Me(xe),xt}function It(nt,Rt){N(de.next!==xe,"can not resize a framebuffer which is currently in use");var At=Math.max(nt|0,1),Pt=Math.max(Rt|0||At,1);if(At===xe.width&&Pt===xe.height)return xt;for(var Qt=xe.colorAttachments,Nr=0;Nr=2,"invalid shape for framebuffer"),N(Gr[0]===Gr[1],"cube framebuffer must be square"),At=Gr[0]}else"radius"in zt&&(At=zt.radius|0),"width"in zt?(At=zt.width|0,"height"in zt&&N(zt.height===At,"must be square")):"height"in zt&&(At=zt.height|0);("color"in zt||"colors"in zt)&&(Pt=zt.color||zt.colors,Array.isArray(Pt)&&N(Pt.length===1||F.webgl_draw_buffers,"multiple render targets not supported")),Pt||("colorCount"in zt&&($r=zt.colorCount|0,N($r>0,"invalid color buffer count")),"colorType"in zt&&(N.oneOf(zt.colorType,Pe,"invalid color type"),Nr=zt.colorType),"colorFormat"in zt&&(Qt=zt.colorFormat,N.oneOf(zt.colorFormat,Ce,"invalid color format for texture"))),"depth"in zt&&(Rt.depth=zt.depth),"stencil"in zt&&(Rt.stencil=zt.stencil),"depthStencil"in zt&&(Rt.depthStencil=zt.depthStencil)}var pr;if(Pt)if(Array.isArray(Pt))for(pr=[],nt=0;nt0&&(Rt.depth=Re[0].depth,Rt.stencil=Re[0].stencil,Rt.depthStencil=Re[0].depthStencil),Re[nt]?Re[nt](Rt):Re[nt]=je(Rt)}return n(xe,{width:At,height:At,color:pr})}function xt(It){var nt,Rt=It|0;if(N(Rt>0&&Rt<=W.maxCubeMapSize,"invalid radius for cube fbo"),Rt===xe.width)return xe;var At=xe.color;for(nt=0;nt0,"must specify at least one attribute");var ct={},Mt=ze.attributes;Mt.length=je.length;for(var We=0;We=xt.byteLength?It.subdata(xt):(It.destroy(),ze.buffers[We]=null)),ze.buffers[We]||(It=ze.buffers[We]=be.create(Re,mb,!1,!0)),xe.buffer=be.getBuffer(It),xe.size=xe.buffer.dimension|0,xe.normalized=!1,xe.type=xe.buffer.dtype,xe.offset=0,xe.stride=0,xe.divisor=0,xe.state=1,ct[We]=1}else be.getBuffer(Re)?(xe.buffer=be.getBuffer(Re),xe.size=xe.buffer.dimension|0,xe.normalized=!1,xe.type=xe.buffer.dtype,xe.offset=0,xe.stride=0,xe.divisor=0,xe.state=1):be.getBuffer(Re.buffer)?(xe.buffer=be.getBuffer(Re.buffer),xe.size=(+Re.size||xe.buffer.dimension)|0,xe.normalized=!!Re.normalized||!1,"type"in Re?(N.parameter(Re.type,po,"invalid buffer type"),xe.type=po[Re.type]):xe.type=xe.buffer.dtype,xe.offset=(Re.offset||0)|0,xe.stride=(Re.stride||0)|0,xe.divisor=(Re.divisor||0)|0,xe.state=1,N(xe.size>=1&&xe.size<=4,"size must be between 1 and 4"),N(xe.offset>=0,"invalid offset"),N(xe.stride>=0&&xe.stride<=255,"stride must be between 0 and 255"),N(xe.divisor>=0,"divisor must be positive"),N(!xe.divisor||!!F.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in Re?(N(We>0,"first attribute must not be a constant"),xe.x=+Re.x||0,xe.y=+Re.y||0,xe.z=+Re.z||0,xe.w=+Re.w||0,xe.state=2):N(!1,"invalid attribute spec for location "+We)}for(var nt=0;nt1)for(var Mt=0;Mtre&&(re=ve.stats.uniformsCount)}),re},W.getMaxAttributesCount=function(){var re=0;return Oe.forEach(function(ve){ve.stats.attributesCount>re&&(re=ve.stats.attributesCount)}),re});function Ge(){be={},se={};for(var re=0;re=0,"missing vertex shader",De),N.command(ve>=0,"missing fragment shader",De);var Ee=Pe[ve];Ee||(Ee=Pe[ve]={});var et=Ee[re];if(et&&(et.refCount++,!He))return et;var Ae=new Xe(ve,re);return W.shaderCount++,Te(Ae,De,He),et||(Ee[re]=Ae),Oe.push(Ae),n(Ae,{destroy:function(){if(Ae.refCount--,Ae.refCount<=0){T.deleteProgram(Ae.program);var ze=Oe.indexOf(Ae);Oe.splice(ze,1),W.shaderCount--}Ee[Ae.vertId].refCount<=0&&(T.deleteShader(se[Ae.vertId]),delete se[Ae.vertId],delete Pe[Ae.fragId][Ae.vertId]),Object.keys(Pe[Ae.fragId]).length||(T.deleteShader(be[Ae.fragId]),delete be[Ae.fragId],delete Pe[Ae.fragId])}})},restore:Ge,shader:Ne,frag:-1,vert:-1}}var GD=6408,Nu=5121,zD=3333,jl=5126;function jD(T,F,W,ue,be,se,de){function Ce(Oe){var Be;F.next===null?(N(be.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),Be=Nu):(N(F.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),Be=F.next.colorAttachments[0].texture._texture.type,se.oes_texture_float?(N(Be===Nu||Be===jl,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),Be===jl&&N(de.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):N(Be===Nu,"Reading from a framebuffer is only allowed for the type 'uint8'"));var Xe=0,Te=0,Ge=ue.framebufferWidth,re=ue.framebufferHeight,ve=null;r(Oe)?ve=Oe:Oe&&(N.type(Oe,"object","invalid arguments to regl.read()"),Xe=Oe.x|0,Te=Oe.y|0,N(Xe>=0&&Xe=0&&Te0&&Ge+Xe<=ue.framebufferWidth,"invalid width for read pixels"),N(re>0&&re+Te<=ue.framebufferHeight,"invalid height for read pixels"),W();var De=Ge*re*4;return ve||(Be===Nu?ve=new Uint8Array(De):Be===jl&&(ve=ve||new Float32Array(De))),N.isTypedArray(ve,"data buffer for regl.read() must be a typedarray"),N(ve.byteLength>=De,"data buffer for regl.read() too small"),T.pixelStorei(zD,4),T.readPixels(Xe,Te,Ge,re,GD,Be,ve),ve}function Ne(Oe){var Be;return F.setFBO({framebuffer:Oe.framebuffer},function(){Be=Ce(Oe)}),Be}function Pe(Oe){return!Oe||!("framebuffer"in Oe)?Ce(Oe):Ne(Oe)}return Pe}function cs(T){return Array.prototype.slice.call(T)}function hs(T){return cs(T).join("")}function UD(){var T=0,F=[],W=[];function ue(Be){for(var Xe=0;Xe0&&(Be.push(re,"="),Be.push.apply(Be,cs(arguments)),Be.push(";")),re}return n(Xe,{def:Ge,toString:function(){return hs([Te.length>0?"var "+Te.join(",")+";":"",hs(Be)])}})}function se(){var Be=be(),Xe=be(),Te=Be.toString,Ge=Xe.toString;function re(ve,De){Xe(ve,De,"=",Be.def(ve,De),";")}return n(function(){Be.apply(Be,cs(arguments))},{def:Be.def,entry:Be,exit:Xe,save:re,set:function(ve,De,He){re(ve,De),Be(ve,De,"=",He,";")},toString:function(){return Te()+Ge()}})}function de(){var Be=hs(arguments),Xe=se(),Te=se(),Ge=Xe.toString,re=Te.toString;return n(Xe,{then:function(){return Xe.apply(Xe,cs(arguments)),this},else:function(){return Te.apply(Te,cs(arguments)),this},toString:function(){var ve=re();return ve&&(ve="else{"+ve+"}"),hs(["if(",Be,"){",Ge(),"}",ve])}})}var Ce=be(),Ne={};function Pe(Be,Xe){var Te=[];function Ge(){var Ee="a"+Te.length;return Te.push(Ee),Ee}Xe=Xe||0;for(var re=0;re":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Ii={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Hb={frag:YD,vert:qD},op={cw:$b,ccw:ip};function tc(T){return Array.isArray(T)||r(T)||fa(T)}function Zb(T){return T.sort(function(F,W){return F===ai?-1:W===ai?1:F=1,ue>=2,F)}else if(W===Ul){var be=T.data;return new En(be.thisDep,be.contextDep,be.propDep,F)}else{if(W===xb)return new En(!1,!1,!1,F);if(W===Eb){for(var se=!1,de=!1,Ce=!1,Ne=0;Ne=1&&(de=!0),Oe>=2&&(Ce=!0)}else Pe.type===Ul&&(se=se||Pe.data.thisDep,de=de||Pe.data.contextDep,Ce=Ce||Pe.data.propDep)}return new En(se,de,Ce,F)}else return new En(W===Xv,W===$v,W===Uv,F)}}var Kb=new En(!1,!1,!1,function(){});function lP(T,F,W,ue,be,se,de,Ce,Ne,Pe,Oe,Be,Xe,Te,Ge){var re=Pe.Record,ve={add:32774,subtract:32778,"reverse subtract":32779};W.ext_blend_minmax&&(ve.min=iP,ve.max=oP);var De=W.angle_instanced_arrays,He=W.webgl_draw_buffers,Ee={dirty:!0,profile:Ge.profile},et={},Ae=[],ze={},Me={};function je(j){return j.replace(".","_")}function ct(j,D,q){var ee=je(j);Ae.push(j),et[ee]=Ee[ee]=!!q,ze[ee]=D}function Mt(j,D,q){var ee=je(j);Ae.push(j),Array.isArray(q)?(Ee[ee]=q.slice(),et[ee]=q.slice()):Ee[ee]=et[ee]=q,Me[ee]=D}ct(_b,QD),ct(Sb,KD),Mt(Mb,"blendColor",[0,0,0,0]),Mt(Wv,"blendEquationSeparate",[Vb,Vb]),Mt(Vv,"blendFuncSeparate",[Wb,Xb,Wb,Xb]),ct(Ab,eP,!0),Mt(Cb,"depthFunc",uP),Mt(Tb,"depthRange",[0,1]),Mt(Ib,"depthMask",!0),Mt(Yv,Yv,[!0,!0,!0,!0]),ct(kb,ZD),Mt(Nb,"cullFace",So),Mt(qv,qv,ip),Mt(Hv,Hv,1),ct(Ob,rP),Mt(Zv,"polygonOffset",[0,0]),ct(Lb,nP),ct(Db,aP),Mt(Kv,"sampleCoverage",[1,!1]),ct(Pb,JD),Mt(Rb,"stencilMask",-1),Mt(Qv,"stencilFunc",[sP,0,-1]),Mt(Jv,"stencilOpSeparate",[Uu,Ti,Ti,Ti]),Mt(Ou,"stencilOpSeparate",[So,Ti,Ti,Ti]),ct(Fb,tP),Mt($l,"scissor",[0,0,T.drawingBufferWidth,T.drawingBufferHeight]),Mt(ai,ai,[0,0,T.drawingBufferWidth,T.drawingBufferHeight]);var We={gl:T,context:Xe,strings:F,next:et,current:Ee,draw:Be,elements:se,buffer:be,shader:Oe,attributes:Pe.state,vao:Pe,uniforms:Ne,framebuffer:Ce,extensions:W,timer:Te,isBufferArgs:tc},Re={primTypes:ns,compareFuncs:ms,blendFuncs:Ta,blendEquations:ve,stencilOps:Ii,glTypes:po,orientationType:op};N.optional(function(){We.isArrayLike=Mr}),He&&(Re.backBuffer=[So],Re.drawBuffer=rn(ue.maxDrawbuffers,function(j){return j===0?[0]:rn(j,function(D){return fP+D})}));var xe=0;function xt(){var j=UD(),D=j.link,q=j.global;j.id=xe++,j.batchId="0";var ee=D(We),ne=j.shared={props:"a0"};Object.keys(We).forEach(function(Y){ne[Y]=q.def(ee,".",Y)}),N.optional(function(){j.CHECK=D(N),j.commandStr=N.guessCommand(),j.command=D(j.commandStr),j.assert=function(Y,G,J){Y("if(!(",G,"))",this.CHECK,".commandRaise(",D(J),",",this.command,");")},Re.invalidBlendCombinations=qb});var K=j.next={},H=j.current={};Object.keys(Me).forEach(function(Y){Array.isArray(Ee[Y])&&(K[Y]=q.def(ne.next,".",Y),H[Y]=q.def(ne.current,".",Y))});var Q=j.constants={};Object.keys(Re).forEach(function(Y){Q[Y]=q.def(JSON.stringify(Re[Y]))}),j.invoke=function(Y,G){switch(G.type){case jv:var J=["this",ne.context,ne.props,j.batchId];return Y.def(D(G.data),".call(",J.slice(0,Math.max(G.data.length+1,4)),")");case Uv:return Y.def(ne.props,G.data);case $v:return Y.def(ne.context,G.data);case Xv:return Y.def("this",G.data);case Ul:return G.data.append(j,Y),G.data.ref;case xb:return G.data.toString();case Eb:return G.data.map(function(ae){return j.invoke(Y,ae)})}},j.attribCache={};var U={};return j.scopeAttrib=function(Y){var G=F.id(Y);if(G in U)return U[G];var J=Pe.scope[G];J||(J=Pe.scope[G]=new re);var ae=U[G]=D(J);return ae},j}function It(j){var D=j.static,q=j.dynamic,ee;if(Lu in D){var ne=!!D[Lu];ee=kr(function(H,Q){return ne}),ee.enable=ne}else if(Lu in q){var K=q[Lu];ee=Cn(K,function(H,Q){return H.invoke(Q,K)})}return ee}function nt(j,D){var q=j.static,ee=j.dynamic;if(wo in q){var ne=q[wo];return ne?(ne=Ce.getFramebuffer(ne),N.command(ne,"invalid framebuffer object"),kr(function(H,Q){var U=H.link(ne),Y=H.shared;Q.set(Y.framebuffer,".next",U);var G=Y.context;return Q.set(G,"."+ps,U+".width"),Q.set(G,"."+gs,U+".height"),U})):kr(function(H,Q){var U=H.shared;Q.set(U.framebuffer,".next","null");var Y=U.context;return Q.set(Y,"."+ps,Y+"."+Gb),Q.set(Y,"."+gs,Y+"."+zb),"null"})}else if(wo in ee){var K=ee[wo];return Cn(K,function(H,Q){var U=H.invoke(Q,K),Y=H.shared,G=Y.framebuffer,J=Q.def(G,".getFramebuffer(",U,")");N.optional(function(){H.assert(Q,"!"+U+"||"+J,"invalid framebuffer object")}),Q.set(G,".next",J);var ae=Y.context;return Q.set(ae,"."+ps,J+"?"+J+".width:"+ae+"."+Gb),Q.set(ae,"."+gs,J+"?"+J+".height:"+ae+"."+zb),J})}else return null}function Rt(j,D,q){var ee=j.static,ne=j.dynamic;function K(U){if(U in ee){var Y=ee[U];N.commandType(Y,"object","invalid "+U,q.commandStr);var G=!0,J=Y.x|0,ae=Y.y|0,ye,we;return"width"in Y?(ye=Y.width|0,N.command(ye>=0,"invalid "+U,q.commandStr)):G=!1,"height"in Y?(we=Y.height|0,N.command(we>=0,"invalid "+U,q.commandStr)):G=!1,new En(!G&&D&&D.thisDep,!G&&D&&D.contextDep,!G&&D&&D.propDep,function(ut,Nt){var at=ut.shared.context,yt=ye;"width"in Y||(yt=Nt.def(at,".",ps,"-",J));var Ct=we;return"height"in Y||(Ct=Nt.def(at,".",gs,"-",ae)),[J,ae,yt,Ct]})}else if(U in ne){var pe=ne[U],Le=Cn(pe,function(ut,Nt){var at=ut.invoke(Nt,pe);N.optional(function(){ut.assert(Nt,at+"&&typeof "+at+'==="object"',"invalid "+U)});var yt=ut.shared.context,Ct=Nt.def(at,".x|0"),Jt=Nt.def(at,".y|0"),xr=Nt.def('"width" in ',at,"?",at,".width|0:","(",yt,".",ps,"-",Ct,")"),_n=Nt.def('"height" in ',at,"?",at,".height|0:","(",yt,".",gs,"-",Jt,")");return N.optional(function(){ut.assert(Nt,xr+">=0&&"+_n+">=0","invalid "+U)}),[Ct,Jt,xr,_n]});return D&&(Le.thisDep=Le.thisDep||D.thisDep,Le.contextDep=Le.contextDep||D.contextDep,Le.propDep=Le.propDep||D.propDep),Le}else return D?new En(D.thisDep,D.contextDep,D.propDep,function(ut,Nt){var at=ut.shared.context;return[0,0,Nt.def(at,".",ps),Nt.def(at,".",gs)]}):null}var H=K(ai);if(H){var Q=H;H=new En(H.thisDep,H.contextDep,H.propDep,function(U,Y){var G=Q.append(U,Y),J=U.shared.context;return Y.set(J,"."+$D,G[2]),Y.set(J,"."+XD,G[3]),G})}return{viewport:H,scissor_box:K($l)}}function At(j,D){var q=j.static,ee=typeof q[Pu]=="string"&&typeof q[Du]=="string";if(ee){if(Object.keys(D.dynamic).length>0)return null;var ne=D.static,K=Object.keys(ne);if(K.length>0&&typeof ne[K[0]]=="number"){for(var H=[],Q=0;Q=0,"invalid "+G,D.commandStr),kr(function(we,pe){return J&&(we.OFFSET=ae),ae})}else if(G in ee){var ye=ee[G];return Cn(ye,function(we,pe){var Le=we.invoke(pe,ye);return J&&(we.OFFSET=Le,N.optional(function(){we.assert(pe,Le+">=0","invalid "+G)})),Le})}else if(J&&K)return kr(function(we,pe){return we.OFFSET="0",0});return null}var U=Q(Xl,!0);function Y(){if(_o in q){var G=q[_o]|0;return N.command(typeof G=="number"&&G>=0,"invalid vertex count",D.commandStr),kr(function(){return G})}else if(_o in ee){var J=ee[_o];return Cn(J,function(we,pe){var Le=we.invoke(pe,J);return N.optional(function(){we.assert(pe,"typeof "+Le+'==="number"&&'+Le+">=0&&"+Le+"===("+Le+"|0)","invalid vertex count")}),Le})}else if(K)if(ki(K)){if(K)return U?new En(U.thisDep,U.contextDep,U.propDep,function(we,pe){var Le=pe.def(we.ELEMENTS,".vertCount-",we.OFFSET);return N.optional(function(){we.assert(pe,Le+">=0","invalid vertex offset/element buffer too small")}),Le}):kr(function(we,pe){return pe.def(we.ELEMENTS,".vertCount")});var ae=kr(function(){return-1});return N.optional(function(){ae.MISSING=!0}),ae}else{var ye=new En(K.thisDep||U.thisDep,K.contextDep||U.contextDep,K.propDep||U.propDep,function(we,pe){var Le=we.ELEMENTS;return we.OFFSET?pe.def(Le,"?",Le,".vertCount-",we.OFFSET,":-1"):pe.def(Le,"?",Le,".vertCount:-1")});return N.optional(function(){ye.DYNAMIC=!0}),ye}return null}return{elements:K,primitive:H(),count:Y(),instances:Q(Wl,!1),offset:U}}function Nr(j,D){var q=j.static,ee=j.dynamic,ne={};return Ae.forEach(function(K){var H=je(K);function Q(U,Y){if(K in q){var G=U(q[K]);ne[H]=kr(function(){return G})}else if(K in ee){var J=ee[K];ne[H]=Cn(J,function(ae,ye){return Y(ae,ye,ae.invoke(ye,J))})}}switch(K){case kb:case Sb:case _b:case Pb:case Ab:case Fb:case Ob:case Lb:case Db:case Ib:return Q(function(U){return N.commandType(U,"boolean",K,D.commandStr),U},function(U,Y,G){return N.optional(function(){U.assert(Y,"typeof "+G+'==="boolean"',"invalid flag "+K,U.commandStr)}),G});case Cb:return Q(function(U){return N.commandParameter(U,ms,"invalid "+K,D.commandStr),ms[U]},function(U,Y,G){var J=U.constants.compareFuncs;return N.optional(function(){U.assert(Y,G+" in "+J,"invalid "+K+", must be one of "+Object.keys(ms))}),Y.def(J,"[",G,"]")});case Tb:return Q(function(U){return N.command(Mr(U)&&U.length===2&&typeof U[0]=="number"&&typeof U[1]=="number"&&U[0]<=U[1],"depth range is 2d array",D.commandStr),U},function(U,Y,G){N.optional(function(){U.assert(Y,U.shared.isArrayLike+"("+G+")&&"+G+".length===2&&typeof "+G+'[0]==="number"&&typeof '+G+'[1]==="number"&&'+G+"[0]<="+G+"[1]","depth range must be a 2d array")});var J=Y.def("+",G,"[0]"),ae=Y.def("+",G,"[1]");return[J,ae]});case Vv:return Q(function(U){N.commandType(U,"object","blend.func",D.commandStr);var Y="srcRGB"in U?U.srcRGB:U.src,G="srcAlpha"in U?U.srcAlpha:U.src,J="dstRGB"in U?U.dstRGB:U.dst,ae="dstAlpha"in U?U.dstAlpha:U.dst;return N.commandParameter(Y,Ta,H+".srcRGB",D.commandStr),N.commandParameter(G,Ta,H+".srcAlpha",D.commandStr),N.commandParameter(J,Ta,H+".dstRGB",D.commandStr),N.commandParameter(ae,Ta,H+".dstAlpha",D.commandStr),N.command(qb.indexOf(Y+", "+J)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+Y+", "+J+")",D.commandStr),[Ta[Y],Ta[J],Ta[G],Ta[ae]]},function(U,Y,G){var J=U.constants.blendFuncs;N.optional(function(){U.assert(Y,G+"&&typeof "+G+'==="object"',"invalid blend func, must be an object")});function ae(at,yt){var Ct=Y.def('"',at,yt,'" in ',G,"?",G,".",at,yt,":",G,".",at);return N.optional(function(){U.assert(Y,Ct+" in "+J,"invalid "+K+"."+at+yt+", must be one of "+Object.keys(Ta))}),Ct}var ye=ae("src","RGB"),we=ae("dst","RGB");N.optional(function(){var at=U.constants.invalidBlendCombinations;U.assert(Y,at+".indexOf("+ye+'+", "+'+we+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var pe=Y.def(J,"[",ye,"]"),Le=Y.def(J,"[",ae("src","Alpha"),"]"),ut=Y.def(J,"[",we,"]"),Nt=Y.def(J,"[",ae("dst","Alpha"),"]");return[pe,ut,Le,Nt]});case Wv:return Q(function(U){if(typeof U=="string")return N.commandParameter(U,ve,"invalid "+K,D.commandStr),[ve[U],ve[U]];if(typeof U=="object")return N.commandParameter(U.rgb,ve,K+".rgb",D.commandStr),N.commandParameter(U.alpha,ve,K+".alpha",D.commandStr),[ve[U.rgb],ve[U.alpha]];N.commandRaise("invalid blend.equation",D.commandStr)},function(U,Y,G){var J=U.constants.blendEquations,ae=Y.def(),ye=Y.def(),we=U.cond("typeof ",G,'==="string"');return N.optional(function(){function pe(Le,ut,Nt){U.assert(Le,Nt+" in "+J,"invalid "+ut+", must be one of "+Object.keys(ve))}pe(we.then,K,G),U.assert(we.else,G+"&&typeof "+G+'==="object"',"invalid "+K),pe(we.else,K+".rgb",G+".rgb"),pe(we.else,K+".alpha",G+".alpha")}),we.then(ae,"=",ye,"=",J,"[",G,"];"),we.else(ae,"=",J,"[",G,".rgb];",ye,"=",J,"[",G,".alpha];"),Y(we),[ae,ye]});case Mb:return Q(function(U){return N.command(Mr(U)&&U.length===4,"blend.color must be a 4d array",D.commandStr),rn(4,function(Y){return+U[Y]})},function(U,Y,G){return N.optional(function(){U.assert(Y,U.shared.isArrayLike+"("+G+")&&"+G+".length===4","blend.color must be a 4d array")}),rn(4,function(J){return Y.def("+",G,"[",J,"]")})});case Rb:return Q(function(U){return N.commandType(U,"number",H,D.commandStr),U|0},function(U,Y,G){return N.optional(function(){U.assert(Y,"typeof "+G+'==="number"',"invalid stencil.mask")}),Y.def(G,"|0")});case Qv:return Q(function(U){N.commandType(U,"object",H,D.commandStr);var Y=U.cmp||"keep",G=U.ref||0,J="mask"in U?U.mask:-1;return N.commandParameter(Y,ms,K+".cmp",D.commandStr),N.commandType(G,"number",K+".ref",D.commandStr),N.commandType(J,"number",K+".mask",D.commandStr),[ms[Y],G,J]},function(U,Y,G){var J=U.constants.compareFuncs;N.optional(function(){function pe(){U.assert(Y,Array.prototype.join.call(arguments,""),"invalid stencil.func")}pe(G+"&&typeof ",G,'==="object"'),pe('!("cmp" in ',G,")||(",G,".cmp in ",J,")")});var ae=Y.def('"cmp" in ',G,"?",J,"[",G,".cmp]",":",Ti),ye=Y.def(G,".ref|0"),we=Y.def('"mask" in ',G,"?",G,".mask|0:-1");return[ae,ye,we]});case Jv:case Ou:return Q(function(U){N.commandType(U,"object",H,D.commandStr);var Y=U.fail||"keep",G=U.zfail||"keep",J=U.zpass||"keep";return N.commandParameter(Y,Ii,K+".fail",D.commandStr),N.commandParameter(G,Ii,K+".zfail",D.commandStr),N.commandParameter(J,Ii,K+".zpass",D.commandStr),[K===Ou?So:Uu,Ii[Y],Ii[G],Ii[J]]},function(U,Y,G){var J=U.constants.stencilOps;N.optional(function(){U.assert(Y,G+"&&typeof "+G+'==="object"',"invalid "+K)});function ae(ye){return N.optional(function(){U.assert(Y,'!("'+ye+'" in '+G+")||("+G+"."+ye+" in "+J+")","invalid "+K+"."+ye+", must be one of "+Object.keys(Ii))}),Y.def('"',ye,'" in ',G,"?",J,"[",G,".",ye,"]:",Ti)}return[K===Ou?So:Uu,ae("fail"),ae("zfail"),ae("zpass")]});case Zv:return Q(function(U){N.commandType(U,"object",H,D.commandStr);var Y=U.factor|0,G=U.units|0;return N.commandType(Y,"number",H+".factor",D.commandStr),N.commandType(G,"number",H+".units",D.commandStr),[Y,G]},function(U,Y,G){N.optional(function(){U.assert(Y,G+"&&typeof "+G+'==="object"',"invalid "+K)});var J=Y.def(G,".factor|0"),ae=Y.def(G,".units|0");return[J,ae]});case Nb:return Q(function(U){var Y=0;return U==="front"?Y=Uu:U==="back"&&(Y=So),N.command(!!Y,H,D.commandStr),Y},function(U,Y,G){return N.optional(function(){U.assert(Y,G+'==="front"||'+G+'==="back"',"invalid cull.face")}),Y.def(G,'==="front"?',Uu,":",So)});case Hv:return Q(function(U){return N.command(typeof U=="number"&&U>=ue.lineWidthDims[0]&&U<=ue.lineWidthDims[1],"invalid line width, must be a positive number between "+ue.lineWidthDims[0]+" and "+ue.lineWidthDims[1],D.commandStr),U},function(U,Y,G){return N.optional(function(){U.assert(Y,"typeof "+G+'==="number"&&'+G+">="+ue.lineWidthDims[0]+"&&"+G+"<="+ue.lineWidthDims[1],"invalid line width")}),G});case qv:return Q(function(U){return N.commandParameter(U,op,H,D.commandStr),op[U]},function(U,Y,G){return N.optional(function(){U.assert(Y,G+'==="cw"||'+G+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),Y.def(G+'==="cw"?'+$b+":"+ip)});case Yv:return Q(function(U){return N.command(Mr(U)&&U.length===4,"color.mask must be length 4 array",D.commandStr),U.map(function(Y){return!!Y})},function(U,Y,G){return N.optional(function(){U.assert(Y,U.shared.isArrayLike+"("+G+")&&"+G+".length===4","invalid color.mask")}),rn(4,function(J){return"!!"+G+"["+J+"]"})});case Kv:return Q(function(U){N.command(typeof U=="object"&&U,H,D.commandStr);var Y="value"in U?U.value:1,G=!!U.invert;return N.command(typeof Y=="number"&&Y>=0&&Y<=1,"sample.coverage.value must be a number between 0 and 1",D.commandStr),[Y,G]},function(U,Y,G){N.optional(function(){U.assert(Y,G+"&&typeof "+G+'==="object"',"invalid sample.coverage")});var J=Y.def('"value" in ',G,"?+",G,".value:1"),ae=Y.def("!!",G,".invert");return[J,ae]})}}),ne}function $r(j,D){var q=j.static,ee=j.dynamic,ne={};return Object.keys(q).forEach(function(K){var H=q[K],Q;if(typeof H=="number"||typeof H=="boolean")Q=kr(function(){return H});else if(typeof H=="function"){var U=H._reglType;U==="texture2d"||U==="textureCube"?Q=kr(function(Y){return Y.link(H)}):U==="framebuffer"||U==="framebufferCube"?(N.command(H.color.length>0,'missing color attachment for framebuffer sent to uniform "'+K+'"',D.commandStr),Q=kr(function(Y){return Y.link(H.color[0])})):N.commandRaise('invalid data for uniform "'+K+'"',D.commandStr)}else Mr(H)?Q=kr(function(Y){var G=Y.global.def("[",rn(H.length,function(J){return N.command(typeof H[J]=="number"||typeof H[J]=="boolean","invalid uniform "+K,Y.commandStr),H[J]}),"]");return G}):N.commandRaise('invalid or missing data for uniform "'+K+'"',D.commandStr);Q.value=H,ne[K]=Q}),Object.keys(ee).forEach(function(K){var H=ee[K];ne[K]=Cn(H,function(Q,U){return Q.invoke(U,H)})}),ne}function zt(j,D){var q=j.static,ee=j.dynamic,ne={};return Object.keys(q).forEach(function(K){var H=q[K],Q=F.id(K),U=new re;if(tc(H))U.state=vs,U.buffer=be.getBuffer(be.create(H,ys,!1,!0)),U.type=0;else{var Y=be.getBuffer(H);if(Y)U.state=vs,U.buffer=Y,U.type=0;else if(N.command(typeof H=="object"&&H,"invalid data for attribute "+K,D.commandStr),"constant"in H){var G=H.constant;U.buffer="null",U.state=zv,typeof G=="number"?U.x=G:(N.command(Mr(G)&&G.length>0&&G.length<=4,"invalid constant for attribute "+K,D.commandStr),ds.forEach(function(ut,Nt){Nt=0,'invalid offset for attribute "'+K+'"',D.commandStr);var ae=H.stride|0;N.command(ae>=0&&ae<256,'invalid stride for attribute "'+K+'", must be integer betweeen [0, 255]',D.commandStr);var ye=H.size|0;N.command(!("size"in H)||ye>0&&ye<=4,'invalid size for attribute "'+K+'", must be 1,2,3,4',D.commandStr);var we=!!H.normalized,pe=0;"type"in H&&(N.commandParameter(H.type,po,"invalid type for attribute "+K,D.commandStr),pe=po[H.type]);var Le=H.divisor|0;"divisor"in H&&(N.command(Le===0||De,'cannot specify divisor for attribute "'+K+'", instancing not supported',D.commandStr),N.command(Le>=0,'invalid divisor for attribute "'+K+'"',D.commandStr)),N.optional(function(){var ut=D.commandStr,Nt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(H).forEach(function(at){N.command(Nt.indexOf(at)>=0,'unknown parameter "'+at+'" for attribute pointer "'+K+'" (valid parameters are '+Nt+")",ut)})}),U.buffer=Y,U.state=vs,U.size=ye,U.normalized=we,U.type=pe||Y.dtype,U.offset=J,U.stride=ae,U.divisor=Le}}ne[K]=kr(function(ut,Nt){var at=ut.attribCache;if(Q in at)return at[Q];var yt={isStream:!1};return Object.keys(U).forEach(function(Ct){yt[Ct]=U[Ct]}),U.buffer&&(yt.buffer=ut.link(U.buffer),yt.type=yt.type||yt.buffer+".dtype"),at[Q]=yt,yt})}),Object.keys(ee).forEach(function(K){var H=ee[K];function Q(U,Y){var G=U.invoke(Y,H),J=U.shared,ae=U.constants,ye=J.isBufferArgs,we=J.buffer;N.optional(function(){U.assert(Y,G+"&&(typeof "+G+'==="object"||typeof '+G+'==="function")&&('+ye+"("+G+")||"+we+".getBuffer("+G+")||"+we+".getBuffer("+G+".buffer)||"+ye+"("+G+'.buffer)||("constant" in '+G+"&&(typeof "+G+'.constant==="number"||'+J.isArrayLike+"("+G+".constant))))",'invalid dynamic attribute "'+K+'"')});var pe={isStream:Y.def(!1)},Le=new re;Le.state=vs,Object.keys(Le).forEach(function(yt){pe[yt]=Y.def(""+Le[yt])});var ut=pe.buffer,Nt=pe.type;Y("if(",ye,"(",G,")){",pe.isStream,"=true;",ut,"=",we,".createStream(",ys,",",G,");",Nt,"=",ut,".dtype;","}else{",ut,"=",we,".getBuffer(",G,");","if(",ut,"){",Nt,"=",ut,".dtype;",'}else if("constant" in ',G,"){",pe.state,"=",zv,";","if(typeof "+G+'.constant === "number"){',pe[ds[0]],"=",G,".constant;",ds.slice(1).map(function(yt){return pe[yt]}).join("="),"=0;","}else{",ds.map(function(yt,Ct){return pe[yt]+"="+G+".constant.length>"+Ct+"?"+G+".constant["+Ct+"]:0;"}).join(""),"}}else{","if(",ye,"(",G,".buffer)){",ut,"=",we,".createStream(",ys,",",G,".buffer);","}else{",ut,"=",we,".getBuffer(",G,".buffer);","}",Nt,'="type" in ',G,"?",ae.glTypes,"[",G,".type]:",ut,".dtype;",pe.normalized,"=!!",G,".normalized;");function at(yt){Y(pe[yt],"=",G,".",yt,"|0;")}return at("size"),at("offset"),at("stride"),at("divisor"),Y("}}"),Y.exit("if(",pe.isStream,"){",we,".destroyStream(",ut,");","}"),pe}ne[K]=Cn(H,Q)}),ne}function Gr(j,D){var q=j.static,ee=j.dynamic;if(Ru in q){var ne=q[Ru];return ne!==null&&Pe.getVAO(ne)===null&&(ne=Pe.createVAO(ne)),kr(function(H){return H.link(Pe.getVAO(ne))})}else if(Ru in ee){var K=ee[Ru];return Cn(K,function(H,Q){var U=H.invoke(Q,K);return Q.def(H.shared.vao+".getVAO("+U+")")})}return null}function pr(j){var D=j.static,q=j.dynamic,ee={};return Object.keys(D).forEach(function(ne){var K=D[ne];ee[ne]=kr(function(H,Q){return typeof K=="number"||typeof K=="boolean"?""+K:H.link(K)})}),Object.keys(q).forEach(function(ne){var K=q[ne];ee[ne]=Cn(K,function(H,Q){return H.invoke(Q,K)})}),ee}function Or(j,D,q,ee,ne){var K=j.static,H=j.dynamic;N.optional(function(){var at=[wo,Du,Pu,xo,Eo,Xl,_o,Wl,Lu,Ru].concat(Ae);function yt(Ct){Object.keys(Ct).forEach(function(Jt){N.command(at.indexOf(Jt)>=0,'unknown parameter "'+Jt+'"',ne.commandStr)})}yt(K),yt(H)});var Q=At(j,D),U=nt(j),Y=Rt(j,U,ne),G=Qt(j,ne),J=Nr(j,ne),ae=Pt(j,ne,Q);function ye(at){var yt=Y[at];yt&&(J[at]=yt)}ye(ai),ye(je($l));var we=Object.keys(J).length>0,pe={framebuffer:U,draw:G,shader:ae,state:J,dirty:we,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(pe.profile=It(j),pe.uniforms=$r(q,ne),pe.drawVAO=pe.scopeVAO=Gr(j),!pe.drawVAO&&ae.program&&!Q&&W.angle_instanced_arrays){var Le=!0,ut=ae.program.attributes.map(function(at){var yt=D.static[at];return Le=Le&&!!yt,yt});if(Le&&ut.length>0){var Nt=Pe.getVAO(Pe.createVAO(ut));pe.drawVAO=new En(null,null,null,function(at,yt){return at.link(Nt)}),pe.useVAO=!0}}return Q?pe.useVAO=!0:pe.attributes=zt(D,ne),pe.context=pr(ee),pe}function zr(j,D,q){var ee=j.shared,ne=ee.context,K=j.scope();Object.keys(q).forEach(function(H){D.save(ne,"."+H);var Q=q[H],U=Q.append(j,D);Array.isArray(U)?K(ne,".",H,"=[",U.join(),"];"):K(ne,".",H,"=",U,";")}),D(K)}function jr(j,D,q,ee){var ne=j.shared,K=ne.gl,H=ne.framebuffer,Q;He&&(Q=D.def(ne.extensions,".webgl_draw_buffers"));var U=j.constants,Y=U.drawBuffer,G=U.backBuffer,J;q?J=q.append(j,D):J=D.def(H,".next"),ee||D("if(",J,"!==",H,".cur){"),D("if(",J,"){",K,".bindFramebuffer(",Yb,",",J,".framebuffer);"),He&&D(Q,".drawBuffersWEBGL(",Y,"[",J,".colorAttachments.length]);"),D("}else{",K,".bindFramebuffer(",Yb,",null);"),He&&D(Q,".drawBuffersWEBGL(",G,");"),D("}",H,".cur=",J,";"),ee||D("}")}function Yr(j,D,q){var ee=j.shared,ne=ee.gl,K=j.current,H=j.next,Q=ee.current,U=ee.next,Y=j.cond(Q,".dirty");Ae.forEach(function(G){var J=je(G);if(!(J in q.state)){var ae,ye;if(J in H){ae=H[J],ye=K[J];var we=rn(Ee[J].length,function(Le){return Y.def(ae,"[",Le,"]")});Y(j.cond(we.map(function(Le,ut){return Le+"!=="+ye+"["+ut+"]"}).join("||")).then(ne,".",Me[J],"(",we,");",we.map(function(Le,ut){return ye+"["+ut+"]="+Le}).join(";"),";"))}else{ae=Y.def(U,".",J);var pe=j.cond(ae,"!==",Q,".",J);Y(pe),J in ze?pe(j.cond(ae).then(ne,".enable(",ze[J],");").else(ne,".disable(",ze[J],");"),Q,".",J,"=",ae,";"):pe(ne,".",Me[J],"(",ae,");",Q,".",J,"=",ae,";")}}}),Object.keys(q.state).length===0&&Y(Q,".dirty=false;"),D(Y)}function an(j,D,q,ee){var ne=j.shared,K=j.current,H=ne.current,Q=ne.gl;Zb(Object.keys(q)).forEach(function(U){var Y=q[U];if(!(ee&&!ee(Y))){var G=Y.append(j,D);if(ze[U]){var J=ze[U];ki(Y)?G?D(Q,".enable(",J,");"):D(Q,".disable(",J,");"):D(j.cond(G).then(Q,".enable(",J,");").else(Q,".disable(",J,");")),D(H,".",U,"=",G,";")}else if(Mr(G)){var ae=K[U];D(Q,".",Me[U],"(",G,");",G.map(function(ye,we){return ae+"["+we+"]="+ye}).join(";"),";")}else D(Q,".",Me[U],"(",G,");",H,".",U,"=",G,";")}})}function Ar(j,D){De&&(j.instancing=D.def(j.shared.extensions,".angle_instanced_arrays"))}function kt(j,D,q,ee,ne){var K=j.shared,H=j.stats,Q=K.current,U=K.timer,Y=q.profile;function G(){return typeof performance>"u"?"Date.now()":"performance.now()"}var J,ae;function ye(at){J=D.def(),at(J,"=",G(),";"),typeof ne=="string"?at(H,".count+=",ne,";"):at(H,".count++;"),Te&&(ee?(ae=D.def(),at(ae,"=",U,".getNumPendingQueries();")):at(U,".beginQuery(",H,");"))}function we(at){at(H,".cpuTime+=",G(),"-",J,";"),Te&&(ee?at(U,".pushScopeStats(",ae,",",U,".getNumPendingQueries(),",H,");"):at(U,".endQuery();"))}function pe(at){var yt=D.def(Q,".profile");D(Q,".profile=",at,";"),D.exit(Q,".profile=",yt,";")}var Le;if(Y){if(ki(Y)){Y.enable?(ye(D),we(D.exit),pe("true")):pe("false");return}Le=Y.append(j,D),pe(Le)}else Le=D.def(Q,".profile");var ut=j.block();ye(ut),D("if(",Le,"){",ut,"}");var Nt=j.block();we(Nt),D.exit("if(",Le,"){",Nt,"}")}function on(j,D,q,ee,ne){var K=j.shared;function H(U){switch(U){case Vl:case Hl:case Ql:return 2;case Yl:case Zl:case Jl:return 3;case ql:case Kl:case ec:return 4;default:return 1}}function Q(U,Y,G){var J=K.gl,ae=D.def(U,".location"),ye=D.def(K.attributes,"[",ae,"]"),we=G.state,pe=G.buffer,Le=[G.x,G.y,G.z,G.w],ut=["buffer","normalized","offset","stride"];function Nt(){D("if(!",ye,".buffer){",J,".enableVertexAttribArray(",ae,");}");var yt=G.type,Ct;if(G.size?Ct=D.def(G.size,"||",Y):Ct=Y,D("if(",ye,".type!==",yt,"||",ye,".size!==",Ct,"||",ut.map(function(xr){return ye+"."+xr+"!=="+G[xr]}).join("||"),"){",J,".bindBuffer(",ys,",",pe,".buffer);",J,".vertexAttribPointer(",[ae,Ct,yt,G.normalized,G.stride,G.offset],");",ye,".type=",yt,";",ye,".size=",Ct,";",ut.map(function(xr){return ye+"."+xr+"="+G[xr]+";"}).join(""),"}"),De){var Jt=G.divisor;D("if(",ye,".divisor!==",Jt,"){",j.instancing,".vertexAttribDivisorANGLE(",[ae,Jt],");",ye,".divisor=",Jt,";}")}}function at(){D("if(",ye,".buffer){",J,".disableVertexAttribArray(",ae,");",ye,".buffer=null;","}if(",ds.map(function(yt,Ct){return ye+"."+yt+"!=="+Le[Ct]}).join("||"),"){",J,".vertexAttrib4f(",ae,",",Le,");",ds.map(function(yt,Ct){return ye+"."+yt+"="+Le[Ct]+";"}).join(""),"}")}we===vs?Nt():we===zv?at():(D("if(",we,"===",vs,"){"),Nt(),D("}else{"),at(),D("}"))}ee.forEach(function(U){var Y=U.name,G=q.attributes[Y],J;if(G){if(!ne(G))return;J=G.append(j,D)}else{if(!ne(Kb))return;var ae=j.scopeAttrib(Y);N.optional(function(){j.assert(D,ae+".state","missing attribute "+Y)}),J={},Object.keys(new re).forEach(function(ye){J[ye]=D.def(ae,".",ye)})}Q(j.link(U),H(U.info.type),J)})}function ir(j,D,q,ee,ne){for(var K=j.shared,H=K.gl,Q,U=0;U1?D(rn(yt,function(_n){return Array.isArray(pe)?pe[_n]:pe+"["+_n+"]"})):(N(!Array.isArray(pe),"uniform value must not be an array"),D(pe));D(");")}}function vt(j,D,q,ee){var ne=j.shared,K=ne.gl,H=ne.draw,Q=ee.draw;function U(){var Ct=Q.elements,Jt,xr=D;return Ct?((Ct.contextDep&&ee.contextDynamic||Ct.propDep)&&(xr=q),Jt=Ct.append(j,xr)):Jt=xr.def(H,".",xo),Jt&&xr("if("+Jt+")"+K+".bindBuffer("+VD+","+Jt+".buffer.buffer);"),Jt}function Y(){var Ct=Q.count,Jt,xr=D;return Ct?((Ct.contextDep&&ee.contextDynamic||Ct.propDep)&&(xr=q),Jt=Ct.append(j,xr),N.optional(function(){Ct.MISSING&&j.assert(D,"false","missing vertex count"),Ct.DYNAMIC&&j.assert(xr,Jt+">=0","missing vertex count")})):(Jt=xr.def(H,".",_o),N.optional(function(){j.assert(xr,Jt+">=0","missing vertex count")})),Jt}var G=U();function J(Ct){var Jt=Q[Ct];return Jt?Jt.contextDep&&ee.contextDynamic||Jt.propDep?Jt.append(j,q):Jt.append(j,D):D.def(H,".",Ct)}var ae=J(Eo),ye=J(Xl),we=Y();if(typeof we=="number"){if(we===0)return}else q("if(",we,"){"),q.exit("}");var pe,Le;De&&(pe=J(Wl),Le=j.instancing);var ut=G+".type",Nt=Q.elements&&ki(Q.elements);function at(){function Ct(){q(Le,".drawElementsInstancedANGLE(",[ae,we,ut,ye+"<<(("+ut+"-"+wb+")>>1)",pe],");")}function Jt(){q(Le,".drawArraysInstancedANGLE(",[ae,ye,we,pe],");")}G?Nt?Ct():(q("if(",G,"){"),Ct(),q("}else{"),Jt(),q("}")):Jt()}function yt(){function Ct(){q(K+".drawElements("+[ae,we,ut,ye+"<<(("+ut+"-"+wb+")>>1)"]+");")}function Jt(){q(K+".drawArrays("+[ae,ye,we]+");")}G?Nt?Ct():(q("if(",G,"){"),Ct(),q("}else{"),Jt(),q("}")):Jt()}De&&(typeof pe!="number"||pe>=0)?typeof pe=="string"?(q("if(",pe,">0){"),at(),q("}else if(",pe,"<0){"),yt(),q("}")):at():yt()}function Gt(j,D,q,ee,ne){var K=xt(),H=K.proc("body",ne);return N.optional(function(){K.commandStr=D.commandStr,K.command=K.link(D.commandStr)}),De&&(K.instancing=H.def(K.shared.extensions,".angle_instanced_arrays")),j(K,H,q,ee),K.compile().body}function Vt(j,D,q,ee){Ar(j,D),q.useVAO?q.drawVAO?D(j.shared.vao,".setVAO(",q.drawVAO.append(j,D),");"):D(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(D(j.shared.vao,".setVAO(null);"),on(j,D,q,ee.attributes,function(){return!0})),ir(j,D,q,ee.uniforms,function(){return!0}),vt(j,D,D,q)}function Cr(j,D){var q=j.proc("draw",1);Ar(j,q),zr(j,q,D.context),jr(j,q,D.framebuffer),Yr(j,q,D),an(j,q,D.state),kt(j,q,D,!1,!0);var ee=D.shader.progVar.append(j,q);if(q(j.shared.gl,".useProgram(",ee,".program);"),D.shader.program)Vt(j,q,D,D.shader.program);else{q(j.shared.vao,".setVAO(null);");var ne=j.global.def("{}"),K=q.def(ee,".id"),H=q.def(ne,"[",K,"]");q(j.cond(H).then(H,".call(this,a0);").else(H,"=",ne,"[",K,"]=",j.link(function(Q){return Gt(Vt,j,D,Q,1)}),"(",ee,");",H,".call(this,a0);"))}Object.keys(D.state).length>0&&q(j.shared.current,".dirty=true;")}function Ia(j,D,q,ee){j.batchId="a1",Ar(j,D);function ne(){return!0}on(j,D,q,ee.attributes,ne),ir(j,D,q,ee.uniforms,ne),vt(j,D,D,q)}function Mo(j,D,q,ee){Ar(j,D);var ne=q.contextDep,K=D.def(),H="a0",Q="a1",U=D.def();j.shared.props=U,j.batchId=K;var Y=j.scope(),G=j.scope();D(Y.entry,"for(",K,"=0;",K,"<",Q,";++",K,"){",U,"=",H,"[",K,"];",G,"}",Y.exit);function J(ut){return ut.contextDep&&ne||ut.propDep}function ae(ut){return!J(ut)}if(q.needsContext&&zr(j,G,q.context),q.needsFramebuffer&&jr(j,G,q.framebuffer),an(j,G,q.state,J),q.profile&&J(q.profile)&&kt(j,G,q,!1,!0),ee)q.useVAO?q.drawVAO?J(q.drawVAO)?G(j.shared.vao,".setVAO(",q.drawVAO.append(j,G),");"):Y(j.shared.vao,".setVAO(",q.drawVAO.append(j,Y),");"):Y(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(Y(j.shared.vao,".setVAO(null);"),on(j,Y,q,ee.attributes,ae),on(j,G,q,ee.attributes,J)),ir(j,Y,q,ee.uniforms,ae),ir(j,G,q,ee.uniforms,J),vt(j,Y,G,q);else{var ye=j.global.def("{}"),we=q.shader.progVar.append(j,G),pe=G.def(we,".id"),Le=G.def(ye,"[",pe,"]");G(j.shared.gl,".useProgram(",we,".program);","if(!",Le,"){",Le,"=",ye,"[",pe,"]=",j.link(function(ut){return Gt(Ia,j,q,ut,2)}),"(",we,");}",Le,".call(this,a0[",K,"],",K,");")}}function $(j,D){var q=j.proc("batch",2);j.batchId="0",Ar(j,q);var ee=!1,ne=!0;Object.keys(D.context).forEach(function(ye){ee=ee||D.context[ye].propDep}),ee||(zr(j,q,D.context),ne=!1);var K=D.framebuffer,H=!1;K?(K.propDep?ee=H=!0:K.contextDep&&ee&&(H=!0),H||jr(j,q,K)):jr(j,q,null),D.state.viewport&&D.state.viewport.propDep&&(ee=!0);function Q(ye){return ye.contextDep&&ee||ye.propDep}Yr(j,q,D),an(j,q,D.state,function(ye){return!Q(ye)}),(!D.profile||!Q(D.profile))&&kt(j,q,D,!1,"a1"),D.contextDep=ee,D.needsContext=ne,D.needsFramebuffer=H;var U=D.shader.progVar;if(U.contextDep&&ee||U.propDep)Mo(j,q,D,null);else{var Y=U.append(j,q);if(q(j.shared.gl,".useProgram(",Y,".program);"),D.shader.program)Mo(j,q,D,D.shader.program);else{q(j.shared.vao,".setVAO(null);");var G=j.global.def("{}"),J=q.def(Y,".id"),ae=q.def(G,"[",J,"]");q(j.cond(ae).then(ae,".call(this,a0,a1);").else(ae,"=",G,"[",J,"]=",j.link(function(ye){return Gt(Mo,j,D,ye,2)}),"(",Y,");",ae,".call(this,a0,a1);"))}}Object.keys(D.state).length>0&&q(j.shared.current,".dirty=true;")}function fe(j,D){var q=j.proc("scope",3);j.batchId="a2";var ee=j.shared,ne=ee.current;zr(j,q,D.context),D.framebuffer&&D.framebuffer.append(j,q),Zb(Object.keys(D.state)).forEach(function(H){var Q=D.state[H],U=Q.append(j,q);Mr(U)?U.forEach(function(Y,G){q.set(j.next[H],"["+G+"]",Y)}):q.set(ee.next,"."+H,U)}),kt(j,q,D,!0,!0),[xo,Xl,_o,Wl,Eo].forEach(function(H){var Q=D.draw[H];Q&&q.set(ee.draw,"."+H,""+Q.append(j,q))}),Object.keys(D.uniforms).forEach(function(H){var Q=D.uniforms[H].append(j,q);Array.isArray(Q)&&(Q="["+Q.join()+"]"),q.set(ee.uniforms,"["+F.id(H)+"]",Q)}),Object.keys(D.attributes).forEach(function(H){var Q=D.attributes[H].append(j,q),U=j.scopeAttrib(H);Object.keys(new re).forEach(function(Y){q.set(U,"."+Y,Q[Y])})}),D.scopeVAO&&q.set(ee.vao,".targetVAO",D.scopeVAO.append(j,q));function K(H){var Q=D.shader[H];Q&&q.set(ee.shader,"."+H,Q.append(j,q))}K(Du),K(Pu),Object.keys(D.state).length>0&&(q(ne,".dirty=true;"),q.exit(ne,".dirty=true;")),q("a1(",j.shared.context,",a0,",j.batchId,");")}function oe(j){if(!(typeof j!="object"||Mr(j))){for(var D=Object.keys(j),q=0;q=0;--vt){var Gt=xe[vt];Gt&&Gt(Te,null,0)}W.flush(),Pe&&Pe.update()}function Pt(){!Rt&&xe.length>0&&(Rt=or.next(At))}function Qt(){Rt&&(or.cancel(At),Rt=null)}function Nr(vt){vt.preventDefault(),be=!0,Qt(),xt.forEach(function(Gt){Gt()})}function $r(vt){W.getError(),be=!1,se.restore(),Ae.restore(),De.restore(),ze.restore(),Me.restore(),je.restore(),He.restore(),Pe&&Pe.restore(),ct.procs.refresh(),Pt(),It.forEach(function(Gt){Gt()})}Re&&(Re.addEventListener(Jb,Nr,!1),Re.addEventListener(ew,$r,!1));function zt(){xe.length=0,Qt(),Re&&(Re.removeEventListener(Jb,Nr),Re.removeEventListener(ew,$r)),Ae.clear(),je.clear(),Me.clear(),ze.clear(),et.clear(),De.clear(),He.clear(),Pe&&Pe.clear(),nt.forEach(function(vt){vt()})}function Gr(vt){N(!!vt,"invalid args to regl({...})"),N.type(vt,"object","invalid args to regl({...})");function Gt(ne){var K=n({},ne);delete K.uniforms,delete K.attributes,delete K.context,delete K.vao,"stencil"in K&&K.stencil.op&&(K.stencil.opBack=K.stencil.opFront=K.stencil.op,delete K.stencil.op);function H(Q){if(Q in K){var U=K[Q];delete K[Q],Object.keys(U).forEach(function(Y){K[Q+"."+Y]=U[Y]})}}return H("blend"),H("depth"),H("cull"),H("stencil"),H("polygonOffset"),H("scissor"),H("sample"),"vao"in ne&&(K.vao=ne.vao),K}function Vt(ne,K){var H={},Q={};return Object.keys(ne).forEach(function(U){var Y=ne[U];if(fr.isDynamic(Y)){Q[U]=fr.unbox(Y,U);return}else if(K&&Array.isArray(Y)){for(var G=0;G0)return Ft.call(this,q(ne|0),ne|0)}else if(Array.isArray(ne)){if(ne.length)return Ft.call(this,ne,ne.length)}else return rt.call(this,ne)}return n(ee,{stats:fe,destroy:function(){oe.destroy()}})}var pr=je.setFBO=Gr({framebuffer:fr.define.call(null,tw,"framebuffer")});function Or(vt,Gt){var Vt=0;ct.procs.poll();var Cr=Gt.color;Cr&&(W.clearColor(+Cr[0]||0,+Cr[1]||0,+Cr[2]||0,+Cr[3]||0),Vt|=pP),"depth"in Gt&&(W.clearDepth(+Gt.depth),Vt|=gP),"stencil"in Gt&&(W.clearStencil(Gt.stencil|0),Vt|=yP),N(!!Vt,"called regl.clear with no buffer specified"),W.clear(Vt)}function zr(vt){if(N(typeof vt=="object"&&vt,"regl.clear() takes an object as input"),"framebuffer"in vt)if(vt.framebuffer&&vt.framebuffer_reglType==="framebufferCube")for(var Gt=0;Gt<6;++Gt)pr(n({framebuffer:vt.framebuffer.faces[Gt]},vt),Or);else pr(vt,Or);else Or(null,vt)}function jr(vt){N.type(vt,"function","regl.frame() callback must be a function"),xe.push(vt);function Gt(){var Vt=rw(xe,vt);N(Vt>=0,"cannot cancel a frame twice");function Cr(){var Ia=rw(xe,Cr);xe[Ia]=xe[xe.length-1],xe.length-=1,xe.length<=0&&Qt()}xe[Vt]=Cr}return Pt(),{cancel:Gt}}function Yr(){var vt=We.viewport,Gt=We.scissor_box;vt[0]=vt[1]=Gt[0]=Gt[1]=0,Te.viewportWidth=Te.framebufferWidth=Te.drawingBufferWidth=vt[2]=Gt[2]=W.drawingBufferWidth,Te.viewportHeight=Te.framebufferHeight=Te.drawingBufferHeight=vt[3]=Gt[3]=W.drawingBufferHeight}function an(){Te.tick+=1,Te.time=kt(),Yr(),ct.procs.poll()}function Ar(){ze.refresh(),Yr(),ct.procs.refresh(),Pe&&Pe.update()}function kt(){return(gr()-Oe)/1e3}Ar();function on(vt,Gt){N.type(Gt,"function","listener callback must be a function");var Vt;switch(vt){case"frame":return jr(Gt);case"lost":Vt=xt;break;case"restore":Vt=It;break;case"destroy":Vt=nt;break;default:N.raise("invalid event, must be one of frame,lost,restore,destroy")}return Vt.push(Gt),{cancel:function(){for(var Cr=0;Cr=0},read:Mt,destroy:zt,_gl:W,_refresh:Ar,poll:function(){an(),Pe&&Pe.update()},now:kt,stats:Ce});return F.onDone(null,ir),ir}return xP})})(tO);var Vie=tO.exports;const Yie=bi(Vie);var qie=function(){function t(e,r){Ma(this,t),this.attribute=void 0,this.buffer=void 0;var n=r.buffer,a=r.offset,i=r.stride,o=r.normalized,s=r.size,u=r.divisor;this.buffer=n,this.attribute={buffer:n.get(),offset:a||0,stride:i||0,normalized:o||!1,divisor:u||0},s&&(this.attribute.size=s)}return Aa(t,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(r){this.buffer.subData(r)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),t}(),si,tf,ui,Kn,rf,Di,nf,zc,Oa,To,vn,La,Da,jc,Hie=(si={},Ke(si,ke.POINTS,"points"),Ke(si,ke.LINES,"lines"),Ke(si,ke.LINE_LOOP,"line loop"),Ke(si,ke.LINE_STRIP,"line strip"),Ke(si,ke.TRIANGLES,"triangles"),Ke(si,ke.TRIANGLE_FAN,"triangle fan"),Ke(si,ke.TRIANGLE_STRIP,"triangle strip"),si),rO=(tf={},Ke(tf,ke.STATIC_DRAW,"static"),Ke(tf,ke.DYNAMIC_DRAW,"dynamic"),Ke(tf,ke.STREAM_DRAW,"stream"),tf),r1=(ui={},Ke(ui,ke.BYTE,"int8"),Ke(ui,ke.UNSIGNED_INT,"int16"),Ke(ui,ke.INT,"int32"),Ke(ui,ke.UNSIGNED_BYTE,"uint8"),Ke(ui,ke.UNSIGNED_SHORT,"uint16"),Ke(ui,ke.UNSIGNED_INT,"uint32"),Ke(ui,ke.FLOAT,"float"),ui),Zie=(Kn={},Ke(Kn,ke.ALPHA,"alpha"),Ke(Kn,ke.LUMINANCE,"luminance"),Ke(Kn,ke.LUMINANCE_ALPHA,"luminance alpha"),Ke(Kn,ke.RGB,"rgb"),Ke(Kn,ke.RGBA,"rgba"),Ke(Kn,ke.RGBA4,"rgba4"),Ke(Kn,ke.RGB5_A1,"rgb5 a1"),Ke(Kn,ke.RGB565,"rgb565"),Ke(Kn,ke.DEPTH_COMPONENT,"depth"),Ke(Kn,ke.DEPTH_STENCIL,"depth stencil"),Kn),Kie=(rf={},Ke(rf,ke.DONT_CARE,"dont care"),Ke(rf,ke.NICEST,"nice"),Ke(rf,ke.FASTEST,"fast"),rf),x2=(Di={},Ke(Di,ke.NEAREST,"nearest"),Ke(Di,ke.LINEAR,"linear"),Ke(Di,ke.LINEAR_MIPMAP_LINEAR,"mipmap"),Ke(Di,ke.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),Ke(Di,ke.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),Ke(Di,ke.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),Di),E2=(nf={},Ke(nf,ke.REPEAT,"repeat"),Ke(nf,ke.CLAMP_TO_EDGE,"clamp"),Ke(nf,ke.MIRRORED_REPEAT,"mirror"),nf),Qie=(zc={},Ke(zc,ke.NONE,"none"),Ke(zc,ke.BROWSER_DEFAULT_WEBGL,"browser"),zc),Jie=(Oa={},Ke(Oa,ke.NEVER,"never"),Ke(Oa,ke.ALWAYS,"always"),Ke(Oa,ke.LESS,"less"),Ke(Oa,ke.LEQUAL,"lequal"),Ke(Oa,ke.GREATER,"greater"),Ke(Oa,ke.GEQUAL,"gequal"),Ke(Oa,ke.EQUAL,"equal"),Ke(Oa,ke.NOTEQUAL,"notequal"),Oa),_2=(To={},Ke(To,ke.FUNC_ADD,"add"),Ke(To,ke.MIN_EXT,"min"),Ke(To,ke.MAX_EXT,"max"),Ke(To,ke.FUNC_SUBTRACT,"subtract"),Ke(To,ke.FUNC_REVERSE_SUBTRACT,"reverse subtract"),To),Uc=(vn={},Ke(vn,ke.ZERO,"zero"),Ke(vn,ke.ONE,"one"),Ke(vn,ke.SRC_COLOR,"src color"),Ke(vn,ke.ONE_MINUS_SRC_COLOR,"one minus src color"),Ke(vn,ke.SRC_ALPHA,"src alpha"),Ke(vn,ke.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),Ke(vn,ke.DST_COLOR,"dst color"),Ke(vn,ke.ONE_MINUS_DST_COLOR,"one minus dst color"),Ke(vn,ke.DST_ALPHA,"dst alpha"),Ke(vn,ke.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),Ke(vn,ke.CONSTANT_COLOR,"constant color"),Ke(vn,ke.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),Ke(vn,ke.CONSTANT_ALPHA,"constant alpha"),Ke(vn,ke.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),Ke(vn,ke.SRC_ALPHA_SATURATE,"src alpha saturate"),vn),eoe=(La={},Ke(La,ke.NEVER,"never"),Ke(La,ke.ALWAYS,"always"),Ke(La,ke.LESS,"less"),Ke(La,ke.LEQUAL,"lequal"),Ke(La,ke.GREATER,"greater"),Ke(La,ke.GEQUAL,"gequal"),Ke(La,ke.EQUAL,"equal"),Ke(La,ke.NOTEQUAL,"notequal"),La),As=(Da={},Ke(Da,ke.ZERO,"zero"),Ke(Da,ke.KEEP,"keep"),Ke(Da,ke.REPLACE,"replace"),Ke(Da,ke.INVERT,"invert"),Ke(Da,ke.INCR,"increment"),Ke(Da,ke.DECR,"decrement"),Ke(Da,ke.INCR_WRAP,"increment wrap"),Ke(Da,ke.DECR_WRAP,"decrement wrap"),Da),toe=(jc={},Ke(jc,ke.FRONT,"front"),Ke(jc,ke.BACK,"back"),jc),roe=function(){function t(e,r){Ma(this,t),this.buffer=void 0;var n=r.data,a=r.usage,i=r.type;this.buffer=e.buffer({data:n,usage:rO[a||ke.STATIC_DRAW],type:r1[i||ke.UNSIGNED_BYTE]})}return Aa(t,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(r){var n=r.data,a=r.offset;this.buffer.subdata(n,a)}}]),t}();function jg(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r16)throw new Error("invalid data type ".concat(c));a[l]=function(){return f.data}}});var i=this.getOuputDataTexture(),o=i.textureWidth,s=i.texelCount;a.u_OutputTextureSize=[o,o],a.u_OutputTexelCount=s,this.context.output.textureSize=[o,o];var u={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH precision highp float; #else precision mediump float; #endif `.concat(this.context.shader),uniforms:a,vert:uoe,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(u)}return Aa(t,[{key:"run",value:function(){var r=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(){r.computeCommand()})}},{key:"readData",value:function(){var e=Xi(mn.mark(function n(){var a=this,i,o,s,u,f,l,c,h;return mn.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(this.reGl({framebuffer:this.texFBO})(function(){i=a.reGl.read()}),!i){v.next=6;break}if(o=this.getOuputDataTexture(),s=o.originalDataLength,u=o.elementsPerTexel,f=o.typedArrayConstructor,l=f===void 0?Float32Array:f,c=[],u!==4)for(h=0;h0&&arguments[0]!==void 0?arguments[0]:{},n=new t;return n.setConfig(r),n.setEngine(new koe),n}}]),t}();const Ooe=Object.freeze(Object.defineProperty({__proto__:null,Kernel:eO,World:Noe},Symbol.toStringTag,{value:"Module"})),aO=Ka(Ooe);var jn={};Object.defineProperty(jn,"__esModule",{value:!0});jn.arrayToTextureData=jn.attributesToTextureData=jn.buildTextureDataWithTwoEdgeAttr=jn.buildTextureData=jn.proccessToFunc=void 0;var Loe=Ir(),hd=Gd,Doe=function(t,e){var r;return t?(0,Loe.isNumber)(t)?r=function(){return t}:r=t:r=function(){return e||1},r};jn.proccessToFunc=Doe;var Poe=function(t,e){var r=[],n=[],a={},i=0;for(i=0;i 0.0) { dx += param * xDist; dy += param * yDist; if (xDist == 0 && yDist == 0) { const sign = i < j ? 1 : -1; dx += param * sign; dy += param * sign; } } } } return [dx, dy]; } calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { // let dx = 0, dy = 0; const vx = currentNode[0] - this.u_Center[0]; const vy = currentNode[1] - this.u_Center[1]; const gf = 0.01 * this.u_K * this.u_Gravity; dx = gf * vx; dy = gf * vy; if (this.u_Clustering == 1) { const clusterIdx = int(nodeAttributes[0]); const center = this.u_ClusterCenters[clusterIdx]; const cvx = currentNode[0] - center[0]; const cvy = currentNode[1] - center[1]; const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01; const parma = this.u_K * this.u_ClusterGravity / dist; dx += parma * cvx; dy += parma * cvy; } return [dx, dy]; } calcAttractive(i: int, currentNode: vec4): vec2 { let dx = 0, dy = 0; const arr_offset = int(floor(currentNode[2] + 0.5)); const length = int(floor(currentNode[3] + 0.5)); const node_buffer: vec4; for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) { if (p >= length) break; const arr_idx = arr_offset + p; // when arr_idx % 4 == 0 update currentNodedx_buffer const buf_offset = arr_idx - arr_idx / 4 * 4; if (p == 0 || buf_offset == 0) { node_buffer = this.u_Data[int(arr_idx / 4)]; } const float_j = buf_offset == 0 ? node_buffer[0] : buf_offset == 1 ? node_buffer[1] : buf_offset == 2 ? node_buffer[2] : node_buffer[3]; const nextNode = this.u_Data[int(float_j)]; const xDist = currentNode[0] - nextNode[0]; const yDist = currentNode[1] - nextNode[1]; const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01; let attractiveF = dist / this.u_K; if (dist > 0.0) { dx -= xDist * attractiveF; dy -= yDist * attractiveF; if (xDist == 0 && yDist == 0) { const sign = i < int(float_j) ? 1 : -1; dx -= sign * attractiveF; dy -= sign * attractiveF; } } } return [dx, dy]; } @main compute() { const i = globalInvocationID.x; const currentNode = this.u_Data[i]; let dx = 0, dy = 0; if (i >= VERTEX_COUNT) { this.u_Data[i] = currentNode; return; } // [gravity, fx, fy, 0] const nodeAttributes = this.u_AttributeArray[i]; if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) { // the node is fixed this.u_Data[i] = [ nodeAttributes[1], nodeAttributes[2], currentNode[2], currentNode[3] ]; return; } // repulsive const repulsive = this.calcRepulsive(i, currentNode); dx += repulsive[0]; dy += repulsive[1]; // attractive const attractive = this.calcAttractive(i, currentNode); dx += attractive[0]; dy += attractive[1]; // gravity const gravity = this.calcGravity(currentNode, nodeAttributes); dx -= gravity[0]; dy -= gravity[1]; // speed dx *= this.u_Speed; dy *= this.u_Speed; // move const distLength = sqrt(dx * dx + dy * dy); if (distLength > 0.0) { const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength); this.u_Data[i] = [ currentNode[0] + dx / distLength * limitedDist, currentNode[1] + dy / distLength * limitedDist, currentNode[2], currentNode[3] ]; } } } `;Xa.fruchtermanBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}';Xa.clusterCode=` import { globalInvocationID } from 'g-webgpu'; const VERTEX_COUNT; const CLUSTER_COUNT; @numthreads(1, 1, 1) class CalcCenter { @in u_Data: vec4[]; @in u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...] @in @out u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...] @main compute() { const i = globalInvocationID.x; const center = this.u_ClusterCenters[i]; let sumx = 0; let sumy = 0; let count = 0; for (let j = 0; j < VERTEX_COUNT; j++) { const attributes = this.u_NodeAttributes[j]; const clusterIdx = int(attributes[0]); const vertex = this.u_Data[j]; if (clusterIdx == i) { sumx += vertex.x; sumy += vertex.y; count += 1; } } this.u_ClusterCenters[i] = [ sumx / count, sumy / count, count, i ]; } } `;Xa.clusterBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}';var Goe=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),$c=me&&me.__awaiter||function(t,e,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{f(n.next(l))}catch(c){o(c)}}function u(l){try{f(n.throw(l))}catch(c){o(c)}}function f(l){l.done?i(l.value):a(l.value).then(s,u)}f((n=n.apply(t,e||[])).next())})},Xc=me&&me.__generator||function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(l){return u([f,l])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(r=0)),r;)try{if(n=1,a&&(i=f[0]&2?a.return:f[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,f[1])).done)return i;switch(a=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,a=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]= length) break; const arr_idx = arr_offset + 4 * p; // i 节点的第 p 条边开始的小格子位置 const buf_offset = arr_idx - arr_idx / 4 * 4; if (p == 0 || buf_offset == 0) { node_buffer = this.u_Data[int(arr_idx / 4)]; // 大格子,大格子位置=小个子位置 / 4, } let float_j: float = node_buffer[0]; const nextNode = this.u_Data[int(float_j)]; const vx = nextNode[0] - currentNode[0]; const vy = nextNode[1] - currentNode[1]; const dist = sqrt(vx * vx + vy * vy) + 0.01; const direx = vx / dist; const direy = vy / dist; const edgeLength = node_buffer[1]; const edgeStrength = node_buffer[2]; const diff: float = edgeLength - dist;//edgeLength // const param = diff * this.u_stiffness / mass; // const param = diff * edgeStrength / mass; // ax -= direx * param; ay -= direy * param; } return [ax, ay]; } @main compute() { const i = globalInvocationID.x; const currentNode = this.u_Data[i]; const movement = u_AveMovement[0]; let ax = 0, ay = 0; if (i >= VERTEX_COUNT || movement.x < u_minMovement) { this.u_Data[i] = currentNode; return; } // 每个节点属性占两个数组中各一格 // [mass, degree, nodeStrength, fx] const nodeAttributes1 = this.u_NodeAttributeArray1[i]; // [centerX, centerY, centerGravity, fy] const nodeAttributes2 = this.u_NodeAttributeArray2[i]; // repulsive const repulsive = this.calcRepulsive(i, currentNode); ax += repulsive[0]; ay += repulsive[1]; // attractive const attractive = this.calcAttractive(i, currentNode, nodeAttributes1); ax += attractive[0]; ay += attractive[1]; // gravity const gravity = this.calcGravity(i, currentNode, nodeAttributes2); ax -= gravity[0]; ay -= gravity[1]; // speed const param = this.u_interval * this.u_damping; let vx = ax * param; let vy = ay * param; const vlength = sqrt(vx * vx + vy * vy) + 0.0001; if (vlength > this.u_maxSpeed) { const param2 = this.u_maxSpeed / vlength; vx = param2 * vx; vy = param2 * vy; } // move if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) { this.u_Data[i] = [ nodeAttributes1[3], nodeAttributes2[3], currentNode[2], 0 ]; } else { const distx = vx * this.u_interval; const disty = vy * this.u_interval; const distLength = sqrt(distx * distx + disty * disty); this.u_Data[i] = [ currentNode[0] + distx, currentNode[1] + disty, currentNode[2], distLength ]; } // the avarage move distance // need to share memory } } `;Wa.gForceBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {float distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\ngl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}';Wa.aveMovementCode=` const VERTEX_COUNT; @numthreads(1, 1, 1) class CalcAveMovement { @in u_Data: vec4[]; @in u_iter: float; @in @out u_AveMovement: vec4[]; @main compute() { let movement = 0; for (let j: int = 0; j < VERTEX_COUNT; j++) { const vertex = this.u_Data[j]; movement += vertex[3]; } movement = movement / float(VERTEX_COUNT); this.u_AveMovement[0] = [movement, 0, 0, 0]; } } `;Wa.aveMovementBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}';var $oe=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),h0=me&&me.__awaiter||function(t,e,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function s(l){try{f(n.next(l))}catch(c){o(c)}}function u(l){try{f(n.throw(l))}catch(c){o(c)}}function f(l){l.done?i(l.value):a(l.value).then(s,u)}f((n=n.apply(t,e||[])).next())})},d0=me&&me.__generator||function(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(f){return function(l){return u([f,l])}}function u(f){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,f[0]&&(r=0)),r;)try{if(n=1,a&&(i=f[0]&2?a.return:f[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,f[1])).done)return i;switch(a=0,i&&(f=[f[0]&2,i.value]),f[0]){case 0:case 1:i=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,a=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]z.size[1]?z.size[0]:z.size[1];return X/2}if((0,Ut.isObject)(z.size)){var X=z.size.width>z.size.height?z.size.width:z.size.height;return X/2}return z.size/2}return 10};else if((0,Ut.isFunction)(g))m=function(z){return g(z)};else if((0,Ut.isArray)(g)){var w=g[0]>g[1]?g[0]:g[1],x=w/2;m=function(z){return x}}else{var E=g/2;m=function(z){return E}}this.nodeSize=m;var _=r.comboSpacing,S;(0,Ut.isNumber)(_)?S=function(){return _}:(0,Ut.isFunction)(_)?S=_:S=function(){return 0},this.comboSpacing=S;var A=r.comboPadding,M;(0,Ut.isNumber)(A)?M=function(){return A}:(0,Ut.isArray)(A)?M=function(){return Math.max.apply(null,A)}:(0,Ut.isFunction)(A)?M=A:M=function(){return 0},this.comboPadding=M;var C=this.linkDistance,I;C||(C=10),(0,Ut.isNumber)(C)?I=function(z){return C}:I=C,this.linkDistance=I;var k=this.edgeStrength,O;k||(k=1),(0,Ut.isNumber)(k)?O=function(z){return k}:O=k,this.edgeStrength=O;var B=this.nodeStrength,L;B||(B=30),(0,Ut.isNumber)(B)?L=function(z){return B}:L=B,this.nodeStrength=L},e.prototype.initPos=function(r){var n=this,a=n.nodes;a.forEach(function(i,o){var s=i.comboId,u=r[s];s&&u?(i.x=u.cx+100/(o+1),i.y=u.cy+100/(o+1)):(i.x=100/(o+1),i.y=100/(o+1))})},e.prototype.getComboMap=function(){var r=this,n=r.nodeMap,a=r.comboTrees,i=r.oriComboMap,o={};return(a||[]).forEach(function(s){var u=[];(0,Ut.traverseTreeUp)(s,function(f){if(f.itemType==="node"||!i[f.id])return!0;if(o[f.id]===void 0){var l={id:f.id,name:f.id,cx:0,cy:0,count:0,depth:r.oriComboMap[f.id].depth||0,children:[]};o[f.id]=l}var c=f.children;c&&c.forEach(function(v){if(!o[v.id]&&!n[v.id])return!0;u.push(v)});var h=o[f.id];if(h.cx=0,h.cy=0,u.length===0){h.empty=!0;var d=i[f.id];h.cx=d.x,h.cy=d.y}return u.forEach(function(v){if(h.count++,v.itemType!=="node"){var p=o[v.id];(0,Ut.isNumber)(p.cx)&&(h.cx+=p.cx),(0,Ut.isNumber)(p.cy)&&(h.cy+=p.cy);return}var g=n[v.id];g&&((0,Ut.isNumber)(g.x)&&(h.cx+=g.x),(0,Ut.isNumber)(g.y)&&(h.cy+=g.y))}),h.cx/=h.count||1,h.cy/=h.count||1,h.children=u,!0})}),o},e.prototype.applyComboCenterForce=function(r){var n=this,a=n.gravity,i=n.comboGravity||a,o=this.alpha,s=n.comboTrees,u=n.indexMap,f=n.nodeMap,l=n.comboMap;(s||[]).forEach(function(c){(0,Ut.traverseTreeUp)(c,function(h){if(h.itemType==="node")return!0;var d=l[h.id];if(!d)return!0;var v=l[h.id],p=(v.depth+1)/10*.5,g=v.cx,y=v.cy;return v.cx=0,v.cy=0,v.children.forEach(function(m){if(m.itemType!=="node"){var b=l[m.id];b&&(0,Ut.isNumber)(b.cx)&&(v.cx+=b.cx),b&&(0,Ut.isNumber)(b.cy)&&(v.cy+=b.cy);return}var w=f[m.id],x=w.x-g||.005,E=w.y-y||.005,_=Math.sqrt(x*x+E*E),S=u[w.id],A=i*o/_*p;r[S].x-=x*A,r[S].y-=E*A,(0,Ut.isNumber)(w.x)&&(v.cx+=w.x),(0,Ut.isNumber)(w.y)&&(v.cy+=w.y)}),v.cx/=v.count||1,v.cy/=v.count||1,!0})})},e.prototype.applyCalculate=function(r){var n=this,a=n.comboMap,i=n.nodes,o={};i.forEach(function(u,f){i.forEach(function(l,c){if(!(fb&&(h.minX=b),h.minY>w&&(h.minY=w),h.maxX1&&l.forEach(function(c,h){if(c.itemType==="node")return!1;var d=n[c.id];d&&l.forEach(function(v,p){if(h<=p||v.itemType==="node")return!1;var g=n[v.id];if(!g)return!1;var y=d.cx-g.cx||.005,m=d.cy-g.cy||.005,b=y*y+m*m,w=d.r||1,x=g.r||1,E=w+x,_=x*x,S=w*w;if(bo)){var M=n["".concat(p.id,"-").concat(x.id)],C=M.vx,I=M.vy,k=Math.log(Math.abs(x.depth-p.depth)/10)+1||1;k=k<1?1:k,x.comboId!==p.comboId&&(k+=1);var O=k?Math.pow(d,k):1,B=s(x)*u/S*O;if(r[g].x+=C*B,r[g].y+=I*B,g=0;O--)k(O);return{nodes:c,edges:h,combos:d,comboEdges:v}},u.prototype.getInnerGraphs=function(f){var l=this,c=l.comboTrees,h=l.nodeSize,d=l.edges,v=l.comboPadding,p=l.spacing,g={},y=this.innerLayout||new i.ConcentricLayout({type:"concentric",sortBy:"id"});return y.center=[0,0],y.preventOverlap=!0,y.nodeSpacing=p,(c||[]).forEach(function(m){(0,a.traverseTreeUp)(m,function(b){var w,x=(v==null?void 0:v(b))||10;if((0,a.isArray)(x)&&(x=Math.max.apply(Math,x)),!((w=b.children)===null||w===void 0)&&w.length){var _=b.children.map(function(R){if(R.itemType==="combo")return g[R.id];var V=f[R.id]||{};return e(e({},V),R)}),S=_.map(function(R){return R.id}),A={nodes:_,edges:d.filter(function(R){return S.includes(R.source)&&S.includes(R.target)})},M=1/0;_.forEach(function(R){var V;R.size||(R.size=((V=g[R.id])===null||V===void 0?void 0:V.size)||(h==null?void 0:h(R))||[30,30]),(0,a.isNumber)(R.size)&&(R.size=[R.size,R.size]),M>R.size[0]&&(M=R.size[0]),M>R.size[1]&&(M=R.size[1])}),y.layout(A);var C=(0,a.getLayoutBBox)(_),I=C.minX,k=C.minY,O=C.maxX,B=C.maxY,L={x:(O+I)/2,y:(B+k)/2};A.nodes.forEach(function(R){R.x-=L.x,R.y-=L.y});var z=Math.max(O-I,M)+x*2,X=Math.max(B-k,M)+x*2;g[b.id]={id:b.id,nodes:_,size:[z,X]}}else if(b.itemType==="combo"){var E=x?[x*2,x*2]:[30,30];g[b.id]={id:b.id,nodes:[],size:E}}return!0})}),g},u.prototype.initVals=function(){var f=this,l=f.nodeSize,c=f.spacing,h,d;if((0,a.isNumber)(c)?d=function(){return c}:(0,a.isFunction)(c)?d=c:d=function(){return 0},this.spacing=d,!l)h=function(b){var w=d(b);if(b.size){if((0,a.isArray)(b.size)){var x=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(x+w)/2}if((0,a.isObject)(b.size)){var x=b.size.width>b.size.height?b.size.width:b.size.height;return(x+w)/2}return(b.size+w)/2}return 10+w/2};else if((0,a.isFunction)(l))h=function(b){var w=l(b),x=d(b);if((0,a.isArray)(b.size)){var E=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(E+x)/2}return((w||10)+x)/2};else if((0,a.isArray)(l)){var v=l[0]>l[1]?l[0]:l[1],p=v/2;h=function(b){return p+d(b)/2}}else{var g=l/2;h=function(b){return g+d(b)/2}}this.nodeSize=h;var y=f.comboPadding,m;(0,a.isNumber)(y)?m=function(){return y}:(0,a.isArray)(y)?m=function(){return Math.max.apply(null,y)}:(0,a.isFunction)(y)?m=y:m=function(){return 0},this.comboPadding=m},u.prototype.getType=function(){return"comboCombined"},u}(n.Base);return af.ComboCombinedLayout=o,af}var Ml={},n1={};Object.defineProperty(n1,"__esModule",{value:!0});var Koe=function(){function t(e){this.id=e.id||0,this.rx=e.rx,this.ry=e.ry,this.fx=0,this.fy=0,this.mass=e.mass,this.degree=e.degree,this.g=e.g||0}return t.prototype.distanceTo=function(e){var r=this.rx-e.rx,n=this.ry-e.ry;return Math.hypot(r,n)},t.prototype.setPos=function(e,r){this.rx=e,this.ry=r},t.prototype.resetForce=function(){this.fx=0,this.fy=0},t.prototype.addForce=function(e){var r=e.rx-this.rx,n=e.ry-this.ry,a=Math.hypot(r,n);a=a<1e-4?1e-4:a;var i=this.g*(this.degree+1)*(e.degree+1)/a;this.fx+=i*r/a,this.fy+=i*n/a},t.prototype.in=function(e){return e.contains(this.rx,this.ry)},t.prototype.add=function(e){var r=this.mass+e.mass,n=(this.rx*this.mass+e.rx*e.mass)/r,a=(this.ry*this.mass+e.ry*e.mass)/r,i=this.degree+e.degree,o={rx:n,ry:a,mass:r,degree:i};return new t(o)},t}();n1.default=Koe;var a1={};Object.defineProperty(a1,"__esModule",{value:!0});var Qoe=function(){function t(e){this.xmid=e.xmid,this.ymid=e.ymid,this.length=e.length,this.massCenter=e.massCenter||[0,0],this.mass=e.mass||1}return t.prototype.getLength=function(){return this.length},t.prototype.contains=function(e,r){var n=this.length/2;return e<=this.xmid+n&&e>=this.xmid-n&&r<=this.ymid+n&&r>=this.ymid-n},t.prototype.NW=function(){var e=this.xmid-this.length/4,r=this.ymid+this.length/4,n=this.length/2,a={xmid:e,ymid:r,length:n},i=new t(a);return i},t.prototype.NE=function(){var e=this.xmid+this.length/4,r=this.ymid+this.length/4,n=this.length/2,a={xmid:e,ymid:r,length:n},i=new t(a);return i},t.prototype.SW=function(){var e=this.xmid-this.length/4,r=this.ymid-this.length/4,n=this.length/2,a={xmid:e,ymid:r,length:n},i=new t(a);return i},t.prototype.SE=function(){var e=this.xmid+this.length/4,r=this.ymid-this.length/4,n=this.length/2,a={xmid:e,ymid:r,length:n},i=new t(a);return i},t}();a1.default=Qoe;var i1={};Object.defineProperty(i1,"__esModule",{value:!0});var Joe=function(){function t(e){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,e!=null&&(this.quad=e)}return t.prototype.insert=function(e){if(this.body==null){this.body=e;return}this._isExternal()?(this.quad&&(this.NW=new t(this.quad.NW()),this.NE=new t(this.quad.NE()),this.SW=new t(this.quad.SW()),this.SE=new t(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e))},t.prototype._putBody=function(e){this.quad&&(e.in(this.quad.NW())&&this.NW?this.NW.insert(e):e.in(this.quad.NE())&&this.NE?this.NE.insert(e):e.in(this.quad.SW())&&this.SW?this.SW.insert(e):e.in(this.quad.SE())&&this.SE&&this.SE.insert(e))},t.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},t.prototype.updateForce=function(e){if(!(this.body==null||e===this.body))if(this._isExternal())e.addForce(this.body);else{var r=this.quad?this.quad.getLength():0,n=this.body.distanceTo(e);r/n250&&(r.barnesHut=!0),r.prune===void 0&&u>100&&(r.prune=!0),this.maxIteration===0&&!r.prune?(o=250,u<=200&&u>100?o=1e3:u>200&&(o=1200),this.maxIteration=o):this.maxIteration===0&&i&&(o=100,u<=200&&u>100?o=500:u>200&&(o=950),this.maxIteration=o),r.kr||(r.kr=50,u>100&&u<=500?r.kr=20:u>500&&(r.kr=1)),r.kg||(r.kg=20,u>100&&u<=500?r.kg=10:u>500&&(r.kg=1)),this.nodes=r.updateNodesByForces(s),a()},e.prototype.updateNodesByForces=function(r){for(var n=this,a=n.edges,i=n.maxIteration,o=n.nodes,s=a.filter(function(_){var S=(0,ci.getEdgeTerminal)(_,"source"),A=(0,ci.getEdgeTerminal)(_,"target");return S!==A}),u=o.length,f=s.length,l=[],c={},h={},d=[],v=0;v0;){for(var x=0;xy||!c)?m=this.getOptRepGraForces(m,w,o):m=this.getRepGraForces(g,y,m,p,s,o);var _=this.updatePos(m,b,v,o);f=_.nodes,v=_.sg,g--,u.tick&&u.tick()}return f},e.prototype.getAttrForces=function(r,n,a,i,o,s,u,f){for(var l=this,c=l.nodes,h=l.preventOverlap,d=l.dissuadeHubs,v=l.mode,p=l.prune,g=0;g0&&(_=E,S=E),f[2*i[y.id]]+=_*x[0],f[2*i[b.id]]-=S*x[0],f[2*i[y.id]+1]+=_*x[1],f[2*i[b.id]+1]-=S*x[1]}}return f},e.prototype.getRepGraForces=function(r,n,a,i,o,s){for(var u=this,f=u.nodes,l=u.preventOverlap,c=u.kr,h=u.kg,d=u.center,v=u.prune,p=f.length,g=0;g0&&(w=c*(s[g]+1)*(s[y]+1)/b),a[2*g]-=w*m[0],a[2*y]+=w*m[0],a[2*g+1]-=w*m[1],a[2*y+1]+=w*m[1]}var x=[f[g].x-d[0],f[g].y-d[1]],E=Math.hypot(x[0],x[1]);x[0]=x[0]/E,x[1]=x[1]/E;var _=h*(s[g]+1);a[2*g]-=_*x[0],a[2*g+1]-=_*x[1]}return a},e.prototype.getOptRepGraForces=function(r,n,a){for(var i=this,o=i.nodes,s=i.kg,u=i.center,f=i.prune,l=o.length,c=9e10,h=-9e10,d=9e10,v=-9e10,p=0;p=h&&(h=o[p].x),o[p].x<=c&&(c=o[p].x),o[p].y>=v&&(v=o[p].y),o[p].y<=d&&(d=o[p].y));for(var g=Math.max(h-c,v-d),y={xmid:(h+c)/2,ymid:(v+d)/2,length:g,massCenter:u,mass:l},m=new nse.default(y),b=new ase.default(m),p=0;p1.5*E?1.5*E:a);for(var y=0;yA?A:_;var M=_*r[2*y],C=_*r[2*y+1];s[y].x+=M,s[y].y+=C}return{nodes:s,sg:a}},e}(tse.Base);Ml.ForceAtlas2Layout=ise;var Al={},s1={},u1={},f1={},js=me&&me.__assign||function(){return js=Object.assign||function(t){for(var e,r=1,n=arguments.length;re;n--)for(var a=0;a=e&&(this.additionColumn[a]+=r);for(var n=0;ne;n--)this.cells[a][n+r]=js(js({},this.cells[a][n]),{dx:a,dy:n+r,x:a*this.CELL_W,y:(n+r)*this.CELL_H}),this.cells[a][n]={dx:a,dy:n,x:a*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(var n=0;n=e&&(this.additionRow[n]+=r);for(var a=0;ai){for(var d=Math.ceil((f.size[0]+a)/i)-1,v=d,p=0;p-1;if(g&&!s.cells[c+p+1][h].node)v--;else break}s.insertColumn(c,v)}if(f.size[1]+a>o){for(var d=Math.ceil((f.size[1]+a)/o)-1,v=d,p=0;p-1;if(g&&!s.cells[c][h+p+1].node)v--;else break}s.insertRow(h,v)}}for(var u=0;uv0?(m=a-l,y=s-i,b=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)),w=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):0y?b=w=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=w=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):g<-v0?(m=a-l,y=-(f-n),m>y?b=w=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=w=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):(m=u-o,Math.abs(p)>(i-n)/2?y=n-f:y=p,m>y?b=w=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=w=parseFloat(y&&g!==0?(y/Math.sin(g)).toFixed(2):m.toFixed(2)));var x=parseFloat(g.toFixed(2)),E=r;return r&&(E=lsei?e:t,s=a>i?t:e,u=o.x-o.size[0]/2,f=o.y-o.size[1]/2,l=o.x+o.size[0]/2,c=o.y+o.size[1]/2,h=s.x-s.size[0]/2,d=s.y-s.size[1]/2,v=s.x+s.size[0]/2,p=s.y+s.size[1]/2,g=o.x,y=o.y,m=s.x,b=s.y,w=l>=h&&v>=u&&c>=d&&p>=f,x=0,E=0;if(w){E=Math.sqrt(Math.pow(m-g,2)+Math.pow(b-y,2));var _=u>h?u:h,S=f>d?f:d,A=loO||n.y>sO)&&(e+=1e12);for(var a=r+1;a150,d=c<30||c>150,v=l>70&&l<110,p=c>70&&c<110;if(h&&!d||l*c<0){s=!1;break}else if(v&&!p||l*c<0){s=!1;break}else if((f.x-t.x)*(f.x-e.x)<0){s=!1;break}else if((f.y-t.y)*(f.y-e.y)<0){s=!1;break}}return s}function yse(t,e){for(var r=!1,n=1,a=hse*n,i=dse*n,o=[a,-a,0,0],s=[0,0,i,-i],u=0;uD2?(l=d,r=!0):(f.x-=o[c],f.y-=s[c])}}return p0>D2&&(p0*=vse),r?lO(t):0}function P2(t,e){var r=0;(t.x<0||t.y<0||t.x+t.size[0]+20>oO||t.y+t.size[1]+20>sO)&&(r+=1e12);for(var n=0;n0&&(s++,!(s>=o));){var u=yse(t,e);u!==0&&(i=u),a=i-r,r=i,a===0?--n:n=20}return t.forEach(function(f){f.x=f.x-f.size[0]/2,f.y=f.y-f.size[1]/2}),{nodes:t,edges:e}}l1.default=mse;var $g=me&&me.__assign||function(){return $g=Object.assign||function(t){for(var e,r=1,n=arguments.length;r1){var g=$g({},v);delete g.size,o.push(g)}});var s=[];n.forEach(function(v){var p=o.find(function(y){return y.id===v.source}),g=o.find(function(y){return y.id===v.target});p&&g&&s.push(v)});var u=new Sse.DagreLayout({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}),f=u.layout({nodes:o,edges:s}).nodes;r.forEach(function(v){var p=(f||[]).find(function(g){return g.id===v.id});v.x=(p==null?void 0:p.x)||a/2,v.y=(p==null?void 0:p.y)||i/2});var l=JSON.parse(JSON.stringify(r)),c=JSON.parse(JSON.stringify(n)),h=Is.forceSimulation().nodes(l).force("link",Is.forceLink(c).id(function(v){return v.id}).distance(function(v){var p=s.find(function(g){return g.source===v.source&&g.target===v.target});return p?30:20})).force("charge",Is.forceManyBody()).force("center",Is.forceCenter(a/2,i/2)).force("x",Is.forceX(a/2)).force("y",Is.forceY(i/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),d=new Promise(function(v){h.on("end",function(){r.forEach(function(x){var E=l.find(function(_){return _.id===x.id});E&&(x.x=E.x,x.y=E.y)});var p=Math.min.apply(Math,r.map(function(x){return x.x})),g=Math.max.apply(Math,r.map(function(x){return x.x})),y=Math.min.apply(Math,r.map(function(x){return x.y})),m=Math.max.apply(Math,r.map(function(x){return x.y})),b=a/(g-p),w=i/(m-y);r.forEach(function(x){x.x!==void 0&&b<1&&(x.x=(x.x-p)*b),x.y!==void 0&&w<1&&(x.y=(x.y-y)*w)}),r.forEach(function(x){x.sizeTemp=x.size,x.size=[10,10]}),(0,_se.default)(r,n),r.forEach(function(x){x.size=x.sizeTemp||[],delete x.sizeTemp}),(0,Ese.default)({nodes:r,edges:n},e),v()})});return d}s1.default=Mse;var Ase=me&&me.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},t(e,r)};return function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),Cse=me&&me.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Al,"__esModule",{value:!0});Al.ERLayout=void 0;var Tse=Rr,Ise=Cse(s1),kse=function(t){Ase(e,t);function e(r){var n=t.call(this)||this;return n.width=300,n.height=300,n.nodeMinGap=50,n.onLayoutEnd=function(){},r&&n.updateCfg(r),n}return e.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},e.prototype.execute=function(){var r=this,n=r.nodes,a=r.edges;return n==null||n.forEach(function(i){i.size||(i.size=[50,50])}),(0,Ise.default)({nodes:n,edges:a},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then(function(){r.onLayoutEnd&&r.onLayoutEnd()})},e.prototype.getType=function(){return"er"},e}(Tse.Base);Al.ERLayout=kse;var Io={},R2;function Nse(){if(R2)return Io;R2=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.Layouts=Io.Layout=void 0;var t=gi,e=sl,r=ul,n=ll,a=fl,i=rm,o=cl,s=yu,u=Km,f=bl,l=wl,c=xl,h=El,d=_l,v=Sl,p=iO(),g=Ml,y=Al,m=vl,b=Ir(),w=function(){function x(E){var _=(0,t.getLayoutByName)(E.type);this.layoutInstance=new _(E)}return x.prototype.layout=function(E){return this.layoutInstance.layout(E)},x.prototype.updateCfg=function(E){this.layoutInstance.updateCfg(E)},x.prototype.init=function(E){this.correctLayers(E.nodes),this.layoutInstance.init(E)},x.prototype.correctLayers=function(E){if(E!=null&&E.length){var _=1/0,S=[];if(E.forEach(function(M){(0,b.isString)(M.layer)&&(M.layer=parseInt(M.layer,10)),!(M.layer===void 0||isNaN(M.layer))&&(S.push(M),M.layer<_&&(_=M.layer))}),_<=0){var A=Math.abs(_)+1;S.forEach(function(M){return M.layer+=A})}}},x.prototype.execute=function(){this.layoutInstance.execute()},x.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},x.prototype.destroy=function(){return this.layoutInstance.destroy()},x}();return Io.Layout=w,Io.Layouts={force:i.ForceLayout,fruchterman:c.FruchtermanLayout,forceAtlas2:g.ForceAtlas2Layout,gForce:a.GForceLayout,force2:n.Force2Layout,dagre:s.DagreLayout,dagreCompound:m.DagreCompoundLayout,circular:o.CircularLayout,radial:u.RadialLayout,concentric:f.ConcentricLayout,grid:e.GridLayout,mds:l.MDSLayout,comboForce:v.ComboForceLayout,comboCombined:p.ComboCombinedLayout,random:r.RandomLayout,"gForce-gpu":d.GForceGPULayout,"fruchterman-gpu":h.FruchtermanGPULayout,er:y.ERLayout},Io}var hO={};Object.defineProperty(hO,"__esModule",{value:!0});var F2;function dO(){return F2||(F2=1,function(t){var e=me&&me.__createBinding||(Object.create?function(E,_,S,A){A===void 0&&(A=S);var M=Object.getOwnPropertyDescriptor(_,S);(!M||("get"in M?!_.__esModule:M.writable||M.configurable))&&(M={enumerable:!0,get:function(){return _[S]}}),Object.defineProperty(E,A,M)}:function(E,_,S,A){A===void 0&&(A=S),E[A]=_[S]}),r=me&&me.__exportStar||function(E,_){for(var S in E)S!=="default"&&!Object.prototype.hasOwnProperty.call(_,S)&&e(_,E,S)};Object.defineProperty(t,"__esModule",{value:!0}),t.ERLayout=t.ForceAtlas2Layout=t.ComboCombinedLayout=t.ComboForceLayout=t.GForceGPULayout=t.FruchtermanGPULayout=t.FruchtermanLayout=t.MDSLayout=t.ConcentricLayout=t.RadialLayout=t.DagreCompoundLayout=t.DagreLayout=t.CircularLayout=t.ForceLayout=t.Force2Layout=t.GForceLayout=t.RandomLayout=t.GridLayout=t.Layouts=t.Layout=void 0;var n=sl;Object.defineProperty(t,"GridLayout",{enumerable:!0,get:function(){return n.GridLayout}});var a=ul;Object.defineProperty(t,"RandomLayout",{enumerable:!0,get:function(){return a.RandomLayout}});var i=fl;Object.defineProperty(t,"GForceLayout",{enumerable:!0,get:function(){return i.GForceLayout}});var o=ll;Object.defineProperty(t,"Force2Layout",{enumerable:!0,get:function(){return o.Force2Layout}});var s=rm;Object.defineProperty(t,"ForceLayout",{enumerable:!0,get:function(){return s.ForceLayout}});var u=cl;Object.defineProperty(t,"CircularLayout",{enumerable:!0,get:function(){return u.CircularLayout}});var f=yu;Object.defineProperty(t,"DagreLayout",{enumerable:!0,get:function(){return f.DagreLayout}});var l=vl;Object.defineProperty(t,"DagreCompoundLayout",{enumerable:!0,get:function(){return l.DagreCompoundLayout}});var c=Km;Object.defineProperty(t,"RadialLayout",{enumerable:!0,get:function(){return c.RadialLayout}});var h=bl;Object.defineProperty(t,"ConcentricLayout",{enumerable:!0,get:function(){return h.ConcentricLayout}});var d=wl;Object.defineProperty(t,"MDSLayout",{enumerable:!0,get:function(){return d.MDSLayout}});var v=xl;Object.defineProperty(t,"FruchtermanLayout",{enumerable:!0,get:function(){return v.FruchtermanLayout}});var p=El;Object.defineProperty(t,"FruchtermanGPULayout",{enumerable:!0,get:function(){return p.FruchtermanGPULayout}});var g=_l;Object.defineProperty(t,"GForceGPULayout",{enumerable:!0,get:function(){return g.GForceGPULayout}});var y=Sl;Object.defineProperty(t,"ComboForceLayout",{enumerable:!0,get:function(){return y.ComboForceLayout}});var m=iO();Object.defineProperty(t,"ComboCombinedLayout",{enumerable:!0,get:function(){return m.ComboCombinedLayout}});var b=Ml;Object.defineProperty(t,"ForceAtlas2Layout",{enumerable:!0,get:function(){return b.ForceAtlas2Layout}});var w=Al;Object.defineProperty(t,"ERLayout",{enumerable:!0,get:function(){return w.ERLayout}});var x=Nse();Object.defineProperty(t,"Layout",{enumerable:!0,get:function(){return x.Layout}}),Object.defineProperty(t,"Layouts",{enumerable:!0,get:function(){return x.Layouts}}),r(hO,t)}(Fp)),Fp}(function(t){var e=me&&me.__createBinding||(Object.create?function(a,i,o,s){s===void 0&&(s=o);var u=Object.getOwnPropertyDescriptor(i,o);(!u||("get"in u?!i.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(a,s,u)}:function(a,i,o,s){s===void 0&&(s=o),a[s]=i[o]}),r=me&&me.__exportStar||function(a,i){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,a,o)};Object.defineProperty(t,"__esModule",{value:!0}),t.getLayoutByName=t.unRegisterLayout=t.registerLayout=void 0;var n=gi;Object.defineProperty(t,"registerLayout",{enumerable:!0,get:function(){return n.registerLayout}}),Object.defineProperty(t,"unRegisterLayout",{enumerable:!0,get:function(){return n.unRegisterLayout}}),Object.defineProperty(t,"getLayoutByName",{enumerable:!0,get:function(){return n.getLayoutByName}}),r(dO(),t)})(Kt);function Ose(t,e,r,n){return n===void 0&&(n="height"),r==="center"?(t[n]+e[n])/2:t.height}var oo={assign:Object.assign,getHeight:Ose},vO=oo,c1=18,Lse=c1*2,B2=c1,Dse={getId:function(e){return e.id||e.name},getPreH:function(e){return e.preH||0},getPreV:function(e){return e.preV||0},getHGap:function(e){return e.hgap||B2},getVGap:function(e){return e.vgap||B2},getChildren:function(e){return e.children},getHeight:function(e){return e.height||Lse},getWidth:function(e){var r=e.label||" ";return e.width||r.split("").length*c1}};function dd(t,e){var r=this;if(r.vgap=r.hgap=0,t instanceof dd)return t;r.data=t;var n=e.getHGap(t),a=e.getVGap(t);return r.preH=e.getPreH(t),r.preV=e.getPreV(t),r.width=e.getWidth(t),r.height=e.getHeight(t),r.width+=r.preH,r.height+=r.preV,r.id=e.getId(t),r.x=r.y=0,r.depth=0,r.children||(r.children=[]),r.addGap(n,a),r}vO.assign(dd.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(e,r){var n=this;n.hgap+=e,n.vgap+=r,n.width+=2*e,n.height+=2*r},eachNode:function(e){for(var r=this,n=[r],a;a=n.shift();)e(a),n=a.children.concat(n)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var r=this,n=[r],a;a=n.shift();)e(a),n=n.concat(a.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(r){e.left=Math.min(e.left,r.x),e.top=Math.min(e.top,r.y),e.width=Math.max(e.width,r.x+r.width),e.height=Math.max(e.height,r.y+r.height)}),e},translate:function(e,r){e===void 0&&(e=0),r===void 0&&(r=0),this.eachNode(function(n){n.x+=e,n.y+=r,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var e=this,r=e.getBoundingBox();e.eachNode(function(n){n.x=n.x-(n.x-r.left)*2-n.width}),e.translate(r.width,0)},bottom2top:function(){var e=this,r=e.getBoundingBox();e.eachNode(function(n){n.y=n.y-(n.y-r.top)*2-n.height}),e.translate(0,r.height)}});function Pse(t,e,r){e===void 0&&(e={}),e=vO.assign({},Dse,e);var n=new dd(t,e),a=[n],i;if(!r&&!t.collapsed){for(;i=a.shift();)if(!i.data.collapsed){var o=e.getChildren(i.data),s=o?o.length:0;if(i.children=new Array(s),o&&s)for(var u=0;uw.low&&(w=w.nxt);var A=E+x.prelim+x.w-(S+_.prelim);A>0&&(S+=A,o(m,b,w.index,A));var M=f(x),C=f(_);M<=C&&(x=u(x),x!==null&&(E+=x.mod)),M>=C&&(_=s(_),_!==null&&(S+=_.mod))}!x&&_?l(m,b,_,S):x&&!_&&c(m,b,x,E)}function o(m,b,w,x){m.c[b].mod+=x,m.c[b].msel+=x,m.c[b].mser+=x,v(m,b,w,x)}function s(m){return m.cs===0?m.tl:m.c[0]}function u(m){return m.cs===0?m.tr:m.c[m.cs-1]}function f(m){return m.y+m.h}function l(m,b,w,x){var E=m.c[0].el;E.tl=w;var _=x-w.mod-m.c[0].msel;E.mod+=_,E.prelim-=_,m.c[0].el=m.c[b].el,m.c[0].msel=m.c[b].msel}function c(m,b,w,x){var E=m.c[b].er;E.tr=w;var _=x-w.mod-m.c[b].mser;E.mod+=_,E.prelim-=_,m.c[b].er=m.c[b-1].er,m.c[b].mser=m.c[b-1].mser}function h(m){m.prelim=(m.c[0].prelim+m.c[0].mod+m.c[m.cs-1].mod+m.c[m.cs-1].prelim+m.c[m.cs-1].w)/2-m.w/2}function d(m,b){b+=m.mod,m.x=m.prelim+b,p(m);for(var w=0;w=w.low;)w=w.nxt;return{low:m,index:b,nxt:w}}bO(t,r);var y=mf.fromNode(t,r);return n(y),d(y,0),mO(y,t,r),Bse(t,r),t},G2=pO,wO=function(t,e){for(var r=G2(t.data,e,!0),n=G2(t.data,e,!0),a=t.children.length,i=Math.round(a/2),o=e.getSide||function(l,c){return c-1},$se=Fi[0],h1=function(t,e,r){var n=e.direction||$se;if(e.isHorizontal=Use(n),Fi.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===Fi[0])r(t,e);else if(n===Fi[1])r(t,e),t.right2left();else if(n===Fi[2])r(t,e);else if(n===Fi[3])r(t,e),t.bottom2top();else if(n===Fi[4]||n===Fi[5]){var a=zse(t,e),i=a.left,o=a.right;r(i,e),r(o,e),e.isHorizontal?i.right2left():i.bottom2top(),o.translate(i.x-o.x,i.y-o.y),t.x=i.x,t.y=o.y;var s=t.getBoundingBox();e.isHorizontal?s.top<0&&t.translate(0,-s.top):s.left<0&&t.translate(-s.left,0)}var u=e.fixedRoot;return u===void 0&&(u=!0),u&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),Xse(t,e),t};function Xse(t,e){if(e.radial){var r=e.isHorizontal?["x","y"]:["y","x"],n=r[0],a=r[1],i={x:1/0,y:1/0},o={x:-1/0,y:-1/0},s=0;t.DFTraverse(function(l){s++;var c=l.x,h=l.y;i.x=Math.min(i.x,c),i.y=Math.min(i.y,h),o.x=Math.max(o.x,c),o.y=Math.max(o.y,h)});var u=o[a]-i[a];if(u===0)return;var f=Math.PI*2/s;t.DFTraverse(function(l){var c=(l[a]-i[a])/u*(Math.PI*2-f)+f,h=l[n]-t[n];l.x=Math.cos(c)*h,l.y=Math.sin(c)*h})}}function Wse(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Xg(t,e)}function Xg(t,e){return Xg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Xg(t,e)}var Vse=hv,Yse=Gse,qse=h1,Hse=oo,Zse=function(t){function e(){return t.apply(this,arguments)||this}Wse(e,t);var r=e.prototype;return r.execute=function(){var a=this;return qse(a.rootNode,a.options,Yse)},e}(Vse),Kse={};function Qse(t,e){return e=Hse.assign({},Kse,e),new Zse(t,e).execute()}var Jse=Qse,eue=oo;function tue(t,e){e===void 0&&(e=[]);var r=this;r.x=r.y=0,r.leftChild=r.rightChild=null,r.height=0,r.children=e}var rue={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function xO(t,e,r){r?(e.x=t.x,e.y=t.y):(e.x=t.y,e.y=t.x),t.children.forEach(function(n,a){xO(n,e.children[a],r)})}var nue=function(t,e){e===void 0&&(e={}),e=eue.assign({},rue,e);var r=0;function n(u){if(!u)return null;u.width=0,u.depth&&u.depth>r&&(r=u.depth);var f=u.children,l=f.length,c=new tue(u.height,[]);return f.forEach(function(h,d){var v=n(h);c.children.push(v),d===0&&(c.leftChild=v),d===l-1&&(c.rightChild=v)}),c.originNode=u,c.isLeaf=u.isLeaf(),c}function a(u){if(u.isLeaf||u.children.length===0)u.drawingDepth=r;else{var f=u.children.map(function(c){return a(c)}),l=Math.min.apply(null,f);u.drawingDepth=l-1}return u.drawingDepth}var i;function o(u){u.x=u.drawingDepth*e.rankSep,u.isLeaf?(u.y=0,i&&(u.y=i.y+i.height+e.nodeSep,u.originNode.parent!==i.originNode.parent&&(u.y+=e.subTreeSep)),i=u):(u.children.forEach(function(f){o(f)}),u.y=(u.leftChild.y+u.rightChild.y)/2)}var s=n(t);return a(s),o(s),xO(s,t,e.isHorizontal),t};function aue(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Wg(t,e)}function Wg(t,e){return Wg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Wg(t,e)}var iue=hv,oue=nue,sue=h1,uue=oo,fue=function(t){function e(){return t.apply(this,arguments)||this}aue(e,t);var r=e.prototype;return r.execute=function(){var a=this;return a.rootNode.width=0,sue(a.rootNode,a.options,oue)},e}(iue),lue={};function cue(t,e){return e=uue.assign({},lue,e),new fue(t,e).execute()}var hue=cue,z2=oo;function due(t,e,r,n,a){var i=(typeof r=="function"?r(t):r)*t.depth;if(!n)try{if(t.id===t.parent.children[0].id){t.x+=i,t.y=e?e.y:0;return}}catch{}if(t.x+=i,e){if(t.y=e.y+z2.getHeight(e,t,a),e.parent&&t.parent.id!==e.parent.id){var o=e.parent,s=o.y+z2.getHeight(o,t,a);t.y=s>t.y?s:t.y}}else t.y=0}var vue=function(t,e,r,n){var a=null;t.eachNode(function(i){due(i,a,e,r,n),a=i})};function pue(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Vg(t,e)}function Vg(t,e){return Vg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Vg(t,e)}var gue=hv,Vc=vue,yue=wO,mue=oo,bf=["LR","RL","H"],bue=bf[0],wue=function(t){function e(){return t.apply(this,arguments)||this}pue(e,t);var r=e.prototype;return r.execute=function(){var a=this,i=a.options,o=a.rootNode;i.isHorizontal=!0;var s=i.indent,u=s===void 0?20:s,f=i.dropCap,l=f===void 0?!0:f,c=i.direction,h=c===void 0?bue:c,d=i.align;if(h&&bf.indexOf(h)===-1)throw new TypeError("Invalid direction: "+h);if(h===bf[0])Vc(o,u,l,d);else if(h===bf[1])Vc(o,u,l,d),o.right2left();else if(h===bf[2]){var v=yue(o,i),p=v.left,g=v.right;Vc(p,u,l,d),p.right2left(),Vc(g,u,l,d);var y=p.getBoundingBox();g.translate(y.width,0),o.x=g.x-o.width/2}return o},e}(gue),xue={};function Eue(t,e){return e=mue.assign({},xue,e),new wue(t,e).execute()}var _ue=Eue,Sue=oo;function EO(t,e){var r=0;return t.children.length?t.children.forEach(function(n){r+=EO(n,e)}):r=t.height,t._subTreeSep=e.getSubTreeSep(t.data),t.totalHeight=Math.max(t.height,r)+2*t._subTreeSep,t.totalHeight}function _O(t){var e=t.children,r=e.length;if(r){e.forEach(function(u){_O(u)});var n=e[0],a=e[r-1],i=a.y-n.y+a.height,o=0;if(e.forEach(function(u){o+=u.totalHeight}),i>t.height)t.y=n.y+i/2-t.height/2;else if(e.length!==1||t.height>o){var s=t.y+(t.height-i)/2-n.y;e.forEach(function(u){u.translate(0,s)})}else t.y=(n.y+n.height/2+a.y+a.height/2)/2-t.height/2}}var Mue={getSubTreeSep:function(){return 0}},Aue=function(t,e){e===void 0&&(e={}),e=Sue.assign({},Mue,e),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse(function(r){r.x=r.parent.x+r.parent.width}),t.parent=null,EO(t,e),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode(function(r){var n=r.children,a=n.length;if(a){var i=n[0];if(i.startY=r.startY+r._subTreeSep,a===1)i.y=r.y+r.height/2-i.height/2;else{i.y=i.startY+i.totalHeight/2-i.height/2;for(var o=1;o=0&&(s="x",o="y");var u=0;U2(e,function(c){return u++,c.x>i.x&&(i.x=c.x),c.xi.y&&(i.y=c.y),c.y"u"||typeof document>"u"?{}:{canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{var e=document.createElement("canvas");return!!(window.WebGLRenderingContext&&(e.getContext("webgl")||e.getContext("experimental-webgl")))}catch{return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var r=document.createElement("div");return r.id="webgl-error-message",r.style.fontFamily="monospace",r.style.fontSize="13px",r.style.fontWeight="normal",r.style.textAlign="center",r.style.background="#fff",r.style.color="#000",r.style.padding="1.5em",r.style.width="400px",r.style.margin="5em auto 0",this.webgl||(r.innerHTML=window.WebGLRenderingContext?['Your graphics card does not seem to support WebGL.
','Find out how to get it here.'].join(` `):['Your browser does not seem to support WebGL.
','Find out how to get it here.'].join(` `)),r},addGetWebGLMessage:function(r){r=r||{};var n=r.parent!==void 0?r.parent:document.body,a=r.id!==void 0?r.id:"oldie",i=d1().getWebGLErrorMessage();i.id=a,n.appendChild(i)}}};const Vue=Object.freeze(Object.defineProperty({__proto__:null,gpuDetector:d1},Symbol.toStringTag,{value:"Module"}));var SO=function(){var e=navigator.userAgent.toLowerCase();return e.indexOf("firefox")>-1?"firefox":e.indexOf("safari")>-1?"safari":e.indexOf("opr")>-1?"opera":e.indexOf("chrome")>-1?"chrome":e.indexOf("trident")>-1?"ie 11":e.indexOf("ie")>-1?"ie":"unknown"};const Yue=Object.freeze(Object.defineProperty({__proto__:null,getBrowserName:SO},Symbol.toStringTag,{value:"Module"}));var so=P(P(P(P(P({},Za),yX),Wue),Vue),Yue);so.radialLayout;Kt.registerLayout("grid",Kt.GridLayout);Kt.registerLayout("random",Kt.RandomLayout);Kt.registerLayout("force",Kt.ForceLayout);Kt.registerLayout("circular",Kt.CircularLayout);Kt.registerLayout("dagre",Kt.DagreLayout);Kt.registerLayout("dagreCompound",Kt.DagreCompoundLayout);Kt.registerLayout("radial",Kt.RadialLayout);Kt.registerLayout("concentric",Kt.ConcentricLayout);Kt.registerLayout("mds",Kt.MDSLayout);Kt.registerLayout("fruchterman",Kt.FruchtermanLayout);Kt.registerLayout("fruchterman-gpu",Kt.FruchtermanGPULayout);Kt.registerLayout("gForce",Kt.GForceLayout);Kt.registerLayout("force2",Kt.Force2Layout);Kt.registerLayout("gForce-gpu",Kt.GForceGPULayout);Kt.registerLayout("comboForce",Kt.ComboForceLayout);Kt.registerLayout("comboCombined",Kt.ComboCombinedLayout);Kt.registerLayout("forceAtlas2",Kt.ForceAtlas2Layout);var que=function(){function t(e,r){var n=e.toString(),a=new Blob(["importScripts('".concat(r,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(a))}return t}(),Hue=function(e){e===void 0&&(e="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js");function r(){var a={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",GPURUN:"GPU_LAYOUT_RUN"};layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout);function i(s){var u=s.data.type;return u===a.RUN||u===a.GPURUN}function o(s){var u=this,f=s.data.type;switch(f){case a.RUN:{var l=s.data,c=l.nodes,h=l.edges,d=l.layoutCfg,v=d===void 0?{}:d,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:a.ERROR,message:"layout ".concat(p," not found")});break}var y;v.onLayoutEnd=function(){u.postMessage({type:a.END,nodes:c}),y==null||y.destroy()},y=new g(v),y.init({nodes:c,edges:h}),y.execute();break}case a.GPURUN:{var m=s.data,b=m.nodes,h=m.edges,w=m.layoutCfg,v=w===void 0?{}:w,x=m.canvas,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:a.ERROR,message:"layout ".concat(p," not found")});break}if(p.split("-")[1]!=="gpu"){this.postMessage({type:a.ERROR,message:"layout ".concat(p," does not support GPU")});break}var E=new g(v);E.init({nodes:b,edges:h}),E.executeWithWorker(x,this);break}}}onmessage=function(u){i(u)&&o(u)}}var n=new que(r,e);return n},ks={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function qg(t){"@babel/helpers - typeof";return qg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qg(t)}var $2=function(e){return setTimeout(e,16)},X2=function(e){return clearTimeout(e)},Yc={requestAnimationFrame:function(e){var r=typeof window<"u"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||$2;return r(e)},cancelAnimationFrame:function(e){var r=typeof window<"u"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||X2;return r(e)}},Zue=["fruchterman","gForce"],Kue=["force","grid","circular"],Que=function(t){jt(e,t);function e(r){var n=t.call(this,r)||this;return n.graph=r,n.layoutCfg=r.get("layout")||{},n.layoutType=n.getLayoutType(),n.worker=null,n.workerData={},n.initLayout(),n}return e.prototype.initLayout=function(){},e.prototype.getWorker=function(){return this.worker?this.worker:(typeof Worker>"u"?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=Hue(this.layoutCfg.workerScriptURL),this.worker)},e.prototype.stopWorker=function(){var r=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,r.requestId&&(Yc.cancelAnimationFrame(r.requestId),r.requestId=null),r.requestId2&&(Yc.cancelAnimationFrame(r.requestId2),r.requestId2=null))},e.prototype.execLayoutMethod=function(r,n){var a=this;return new Promise(function(i,o){return Bn(a,void 0,void 0,function(){var s,u,f,l,c,p,h,d,v,p,g;return Gn(this,function(y){switch(y.label){case 0:if(s=this.graph,!s||s.get("destroyed"))return[2];u=r.type,r.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),i()},u&&this.isGPU&&(MO(u)?u="".concat(u,"-gpu"):console.warn("The '".concat(u,"' layout does not support GPU calculation for now, it will run in CPU."))),Za.isForce(u)?(f=r.onTick,l=r.animate,c=l===void 0&&(u==="force"||u==="force2"),p=function(){f&&f(),(l||c)&&s.refreshPositions()},r.tick=p):(u==="comboForce"||u==="comboCombined")&&(r.comboTrees=s.get("comboTrees")),h=!1;try{d=new Kt.Layouts[u](r),this.layoutMethods[n]&&this.layoutMethods[n].destroy(),this.layoutMethods[n]=d}catch{console.warn("The layout method: '".concat(u,"' does not exist! Please specify it first.")),o()}return h=d.enableTick,h&&(v=r.onTick,p=function(){v&&v(),s.refreshPositions()},d.tick=p),g=this.filterLayoutData(this.data,r),tfe(g,n),d.init(g),s.emit("beforesublayout",{type:u}),[4,d.execute()];case 1:return y.sent(),d.isCustomLayout&&r.onLayoutEnd&&r.onLayoutEnd(),[2]}})})})},e.prototype.updateLayoutMethod=function(r,n){var a=this;return new Promise(function(i,o){return Bn(a,void 0,void 0,function(){var s,u,f,l,c,h,d;return Gn(this,function(v){switch(v.label){case 0:return s=this.graph,u=n==null?void 0:n.type,n.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),i()},Za.isForce(u)&&(f=n.onTick,l=n.animate,c=l===void 0&&(u==="force"||u==="force2"),h=function(){f==null||f(),(l||c)&&s.refreshPositions()},n.tick=h),d=this.filterLayoutData(this.data,n),r.init(d),r.updateCfg(n),s.emit("beforesublayout",{type:u}),[4,r.execute()];case 1:return v.sent(),r.isCustomLayout&&n.onLayoutEnd&&n.onLayoutEnd(),[2]}})})})},e.prototype.layout=function(r){var n=this,a,i=this.graph;if(!(!i||i.get("destroyed"))){this.data=this.setDataFromGraph();var o=this.data,s=o.nodes,u=o.hiddenNodes;if(!s)return!1;var f=i.get("width"),l=i.get("height"),c={};Object.assign(c,{width:f,height:l,center:[f/2,l/2]},this.layoutCfg),this.layoutCfg=c;var h=c.type,d=!1;(a=this.layoutMethods)===null||a===void 0||a.forEach(function(x){var E;return d=!!(!((E=x.nodes)===null||E===void 0)&&E.length)||d});var v=this.destoryLayoutMethods();i.emit("beforelayout");var p=Promise.resolve();d&&h&&(v==null?void 0:v.length)===1&&v[0]===h?this.tweakInit():p=this.initPositions(c.center,s);var g=this.initPositions(c.center,u);g.then(),this.isGPU=W2(c,h);var y=c.onLayoutEnd,m=c.layoutEndFormatted,b=c.adjust;if(m||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return Bn(n,void 0,void 0,function(){return Gn(this,function(x){switch(x.label){case 0:return y&&y(s),this.refreshLayout(),b&&c.pipes?[4,this.adjustPipesBox(this.data,b)]:[3,2];case 1:x.sent(),this.refreshLayout(),x.label=2;case 2:return i.emit("afterlayout"),[2]}})})}),this.stopWorker(),c.workerEnabled&&this.layoutWithWorker(this.data,r))return!0;var w=!1;return c.type?(w=!0,p=p.then(function(){return Bn(n,void 0,void 0,function(){return Gn(this,function(x){switch(x.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,x.sent()]}})})})):c.pipes&&(w=!0,c.pipes.forEach(function(x,E){p=p.then(function(){return Bn(n,void 0,void 0,function(){return Gn(this,function(_){switch(_.label){case 0:return[4,this.execLayoutMethod(x,E)];case 1:return[2,_.sent()]}})})})})),w?p.then(function(){c.onAllLayoutEnd&&c.onAllLayoutEnd(),r&&r()}).catch(function(x){console.warn("graph layout failed,",x)}):(i.refreshPositions(),r==null||r()),!1}},e.prototype.tweakInit=function(){var r=this,n=r.data,a=r.graph,i=n.nodes,o=n.edges;if(i!=null&&i.length){var s={};i.forEach(function(l){var c=l.x,h=l.y;!isNaN(c)&&!isNaN(h)&&(s[l.id]={x:c,y:h},l.mass=l.mass||2)}),o.forEach(function(l){var c=l.source,h=l.target,d=s[c],v=s[h];!d&&v?s[c]={x:v.x+(Math.random()-.5)*80,y:v.y+(Math.random()-.5)*80}:!v&&d&&(s[h]={x:d.x+(Math.random()-.5)*80,y:d.y+(Math.random()-.5)*80})});var u=a.get("width"),f=a.get("height");i.forEach(function(l){var c=s[l.id]||{x:u/2+(Math.random()-.5)*20,y:f/2+(Math.random()-.5)*20};l.x=c.x,l.y=c.y})}},e.prototype.initWithPreset=function(r,n){var a=this;return new Promise(function(i,o){return Bn(a,void 0,void 0,function(){var s,u,f,l,c,h,d;return Gn(this,function(v){switch(v.label){case 0:return s=this,u=s.layoutCfg,f=s.data,l=u.preset,!(l!=null&&l.type)||!Kt.Layouts[l==null?void 0:l.type]?(n==null||n(),i(),[2,!1]):(c=W2(l,l.type),h=c?"".concat(l.type,"-gpu"):l.type,d=new Kt.Layouts[h](l),delete u.preset,d.init(f),[4,d.execute()]);case 1:return v.sent(),r==null||r(),i(),[2,!0]}})})})},e.prototype.layoutWithWorker=function(r,n){var a=this,i=this,o=i.layoutCfg,s=i.graph,u=this.getWorker(),f=this.workerData;if(!u)return!1;f.requestId=null,f.requestId2=null,f.currentTick=null,f.currentTickData=null,s.emit("beforelayout");var l=Promise.resolve(),c=!1;if(o.type)c=!0,l=l.then(function(){return a.runWebworker(u,r,o)});else if(o.pipes){c=!0;for(var h=function(y){l=l.then(function(){return a.runWebworker(u,r,y)})},d=0,v=o.pipes;d'),l=a?a.backgroundColor:void 0,c=a?a.padding:void 0;c?Ot(c)&&(c=[c,c,c,c]):c=[0,0,0,0];var h=o+c[0]+c[2],d=s+c[1]+c[3],v={container:f,height:h,width:d,quickHit:!0},p=u==="svg"?new Tp(v):new qu(v),g=this.get("group"),y=g.clone(),m=rr(y.getMatrix());m||(m=[1,0,0,0,1,0,0,0,1]);var b=(i.maxX+i.minX)/2,w=(i.maxY+i.minY)/2;m=V2(m,[["t",-b,-w],["t",s/2+c[3],o/2+c[0]]]),y.resetMatrix(),y.setMatrix(m),p.add(y);var x=p.get("el"),E="";n||(n="image/png"),setTimeout(function(){if(u==="svg"){var _=x.cloneNode(!0),S=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),A=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",S);A.replaceChild(_,A.documentElement);var M=new XMLSerializer().serializeToString(A);E="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(M))}else{var C=void 0,I=x.getContext("2d"),k=void 0;if(l){var O=typeof window<"u"?window.devicePixelRatio:1;try{C=I.getImageData(0,0,d*O,h*O),k=I.globalCompositeOperation,I.globalCompositeOperation="destination-over",I.fillStyle=l,I.fillRect(0,0,d,h)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}E=x.toDataURL(n),l&&(I.clearRect(0,0,d,h),I.putImageData(C,0,0),I.globalCompositeOperation=k)}r&&r(E)},16)},e.prototype.downloadFullImage=function(r,n,a){var i=this,o=this.get("group").getCanvasBBox(),s=o.height,u=o.width,f=this.get("renderer"),l=cg('
'),c=document.querySelector(".g6-graph-watermarker"),h=a?a.backgroundColor:void 0,d=a?a.padding:void 0;d?Ot(d)&&(d=[d,d,d,d]):d=[0,0,0,0];var v=s+d[0]+d[2],p=u+d[1]+d[3];if(c){var g=this.get("graphWaterMarker").cfg||{},y=g.width,m=g.height;v=Math.ceil(v/m)*m,p=Math.ceil(p/y)*y}var b={container:l,height:v,width:p},w=f==="svg"?new Tp(b):new qu(b),x=this.get("group"),E=wX(x),_=rr(E.getMatrix());_||(_=[1,0,0,0,1,0,0,0,1]);var S=(o.maxX+o.minX)/2,A=(o.maxY+o.minY)/2;_=V2(_,[["t",-S,-A],["t",u/2+d[3],s/2+d[0]]]),E.resetMatrix(),E.setMatrix(_),w.add(E);var M=w.get("el");n||(n="image/png"),this.asyncToDataUrl(n,h,function(C){var I=document.createElement("a"),k=(r||"graph")+(f==="svg"?".svg":".".concat(n.split("/")[1]));i.dataURLToImage(C,f,I,k);var O=document.createEvent("MouseEvents");O.initEvent("click",!1,!1),I.dispatchEvent(O)},p,v,M)},e.prototype.downloadImage=function(r,n,a){var i=this,o=this;o.stopAnimate();var s=o.get("canvas"),u=s.getRenderer();n||(n="image/png");var f=(r||"graph")+(u==="svg"?".svg":".".concat(n.split("/")[1])),l=document.createElement("a");o.asyncToDataUrl(n,a,function(c){i.dataURLToImage(c,u,l,f);var h=document.createEvent("MouseEvents");h.initEvent("click",!1,!1),l.dispatchEvent(h)})},e.prototype.dataURLToImage=function(r,n,a,i){if(!r||r==="data:"){console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items");return}if(typeof window<"u")if(window.Blob&&window.URL&&n!=="svg"){var o=r.split(","),s="";if(o&&o.length>0){var u=o[0].match(/:(.*?);/);u&&u.length>=2&&(s=u[1])}for(var f=atob(o[1]),l=f.length,c=new Uint8Array(l);l--;)c[l]=f.charCodeAt(l);var h=new Blob([c],{type:s});window.navigator.msSaveBlob?window.navigator.msSaveBlob(h,i):a.addEventListener("click",function(){a.download=i,a.href=window.URL.createObjectURL(h)})}else a.addEventListener("click",function(){a.download=i,a.href=r})},e.prototype.addPlugin=function(r){var n=this;r.destroyed||(n.get("plugins").push(r),r.initPlugin(n))},e.prototype.removePlugin=function(r){var n=this.get("plugins"),a=n.indexOf(r);a>=0&&(r.destroyPlugin(),n.splice(a,1))},e.prototype.setImageWaterMarker=function(r,n){r===void 0&&(r=Mf.waterMarkerImage);var a=this.get("container");Ye(a)&&(a=document.getElementById(a)),a.style.position||(a.style.position="relative");var i=this.get("graphWaterMarker"),o=_r({},Mf.imageWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.image;if(!r){var c=f?a:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),i&&i.clear();return}if(i)i.clear();else{var h={container:a,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),i=new qu(h),this.set("graphWaterMarker",i)}i.get("el").style.display="none";var v=i.get("context"),p=l.rotate,g=l.x,y=l.y;v.rotate(-p*Math.PI/180);var m=new Image;m.crossOrigin="anonymous",m.src=r,m.onload=function(){if(v.drawImage(m,g,y,l.width,l.height),v.rotate(p*Math.PI/180),f)a.style.cssText="background-image: url(".concat(i.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var b=document.querySelector(".g6-graph-watermarker");b||(b=document.createElement("div"),b.className="g6-graph-watermarker"),b.className="g6-graph-watermarker",i.destroyed||(b.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;"),a.appendChild(b))}}},e.prototype.setTextWaterMarker=function(r,n){var a=this.get("container");Ye(a)&&(a=document.getElementById(a)),a.style.position||(a.style.position="relative");var i=this.get("graphWaterMarker"),o=_r({},Mf.textWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.text;if(!(r!=null&&r.length)){var c=f?a:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),i&&i.clear();return}if(i)i.clear();else{var h={container:a,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),i=new qu(h),this.set("graphWaterMarker",i)}i.get("el").style.display="none";var v=i.get("context"),p=l.rotate,g=l.fill,y=l.fontFamily,m=l.fontSize,b=l.baseline,w=l.x,x=l.y,E=l.lineHeight;v.rotate(-p*Math.PI/180),v.font="".concat(m,"px ").concat(y),v.fillStyle=g,v.textBaseline=b;for(var _=Ye(r)?[r]:r,S=_.length-1;S>=0;S--)v.fillText(_[S],w,x+S*E);if(v.rotate(p*Math.PI/180),f)a.style.cssText="background-image: url(".concat(i.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var A=document.querySelector(".g6-graph-watermarker");A||(A=document.createElement("div"),A.className="g6-graph-watermarker"),A.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;"),a.appendChild(A)}},e.prototype.destroy=function(){var r,n,a,i;_e(this.get("plugins"),function(l){l.destroyPlugin()});var o=this.get("tooltips");if(o)for(var s=0;s0)for(var f=s.length-1;f>=0;f--){var l=s[f].getModel();e.indexOfChild(r.children||[],l.id)===-1&&(i.innerRemoveChild(l.id,{x:r.x,y:r.y},a),s.splice(f,1))}}var c,h;o.get("originAttrs")&&(c=o.get("originAttrs").x,h=o.get("originAttrs").y);var d=o.getModel();a&&o.set("originAttrs",{x:d.x,y:d.y}),o.set("model",Object.assign(d,r.data)),(c!==r.x||h!==r.y)&&o.updatePosition({x:r.x,y:r.y})},e.prototype.innerRemoveChild=function(r,n,a){var i=this,o=i.findById(r);if(o)if(_e(o.get("children"),function(u){i.innerRemoveChild(u.getModel().id,n,a)}),a){var s=o.getModel();o.set("to",n),o.set("originAttrs",{x:s.x,y:s.y}),i.get("removeList").push(o)}else i.removeItem(o,!1)},e.prototype.changeData=function(r,n){n===void 0&&(n=!0);var a=this;this.getNodes().map(function(i){return a.clearItemStates(i)}),this.getEdges().map(function(i){return a.clearItemStates(i)}),n&&this.get("enabledStack")&&this.pushStack("changedata",{before:a.get("originData"),after:r||a.get("data")}),r?(a.data(r),a.render(!1)):a.layout(this.get("fitView"))},e.prototype.changeLayout=function(r){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");var n=this;n.updateLayout(r)},e.prototype.updateLayout=function(r,n,a,i){i===void 0&&(i=!0);var o=this;if(!r){console.warn("layout cannot be null");return}if(i&&this.get("enabledStack")&&this.pushStack("layout",{before:o.get("layout"),after:r}),o.set("layout",r),o.set("layoutMethod",o.getLayout()),o.layout(),n){var s=a;s||(n==="begin"?s={x:0,y:0}:s={x:this.getWidth()/2,y:this.getHeight()/2}),s=this.getPointByCanvas(s.x,s.y);var u=this.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];s.x=s.x*u[0]+u[6],s.y=s.y*u[0]+u[7];var f=this.getGroup().getCanvasBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY,v={x:(l+c)/2,y:(h+d)/2};n==="begin"&&(v.x=l,v.y=h),this.translate(s.x-v.x,s.y-v.y)}},e.prototype.refreshLayout=function(r){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");var n=this;n.layout(r)},e.prototype.layout=function(r){var n=this,a=this,i=a.get("data"),o=a.get("layoutMethod"),s=a.get("layout"),u=i;if(s!=null&&s.excludeInvisibles){i=rr(a.get("data"));var f={};y0(i,function(h){var d=h.children;if(!(d!=null&&d.length))return!0;for(var v=d.length-1;v>=0;v--){var p=n.findById(d[v].id),g=p?!p.isVisible():d[v].visible===!1;g&&(f[h.id]=f[h.id]||[],f[h.id].push({idx:v,child:d.splice(v,1)[0]}))}}),u=o?o(i,a.get("layout")):i,y0(u,function(h){var d=f[h.id];if(d!=null&&d.length)for(var v=d.length-1;v>=0;v--){var p=d[v],g=p.idx,y=p.child;h.children.splice(g,0,y)}})}else u=o?o(i,a.get("layout")):i;var l=a.get("animate");if(a.emit("beforerefreshlayout",{data:i,layoutData:u}),a.emit("beforelayout"),a.innerUpdateChild(u,void 0,l),r){var c=a.get("viewController");c.fitView()}l?a.layoutAnimate(u):(a.refresh(),a.paint()),a.emit("afterrefreshlayout",{data:i,layoutData:u}),a.emit("afterlayout")},e.prototype.addChild=function(r,n,a){a===void 0&&(a=!0);var i=this;i.emit("beforeaddchild",{model:r,parent:n}),Ye(n)||(n=n.get("id"));var o=i.findDataById(n);if(o){o.children||(o.children=[]),o.children.push(r);var s=i.findById(n);s.refresh(),i.changeData(void 0,a)}},e.prototype.updateChildren=function(r,n,a){a===void 0&&(a=!0);var i=this,o=i.findById(n);if(!n||!o){console.warn("Update children failed! There is no node with id '".concat(n,"'"));return}var s=i.findDataById(n);s.children=r,o.refresh(),i.changeData(void 0,a)},e.prototype.updateChild=function(r,n,a){a===void 0&&(a=!0);var i=this;if(!n||!i.findById(n)){i.changeData(r,a);return}var o=i.findDataById(n),s=i.findById(r.id);if(o.children||(o.children=[]),!s)o.children.push(r);else{var u=e.indexOfChild(o.children,r.id);u>-1&&(o.children[u]=r)}var f=i.findById(n);f==null||f.refresh(),i.changeData(void 0,a)},e.prototype.removeChild=function(r,n){n===void 0&&(n=!0);var a=this,i=a.findById(r),o;if(i?o=i==null?void 0:i.get("parent"):o=a.getNodes().find(function(c){var h=c.getModel().children||[];return!!h.find(function(d){return d.id===r})}),o&&!o.destroyed){var s=o.get("id"),u=a.findDataById(s),f=u&&u.children||[],l=e.indexOfChild(f,r);f.splice(l,1),o.refresh()}a.changeData(void 0,n)},e.prototype.findDataById=function(r,n){var a=this;if(n||(n=a.get("data")),r===n.id)return n;var i=null;return _e(n.children||[],function(o){if(o.id===r)return i=o,!1;if(i=a.findDataById(r,o),i)return!1}),i},e.prototype.layoutAnimate=function(r,n){var a=this,i=this.get("animateCfg");a.emit("beforeanimate",{data:r}),a.getEdges().forEach(function(o){var s=o.get("model");s.sourceAnchor||(s.sourceAnchor=o.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(o){y0(r,function(s){var u=a.findById(s.id);if(u){var f=u.get("originAttrs"),l=u.get("model");if(f||(f={x:l.x,y:l.y},u.set("originAttrs",f)),n){var c=n(u,o,f,r);u.set("model",Object.assign(l,c))}else l.x=f.x+(s.x-f.x)*o,l.y=f.y+(s.y-f.y)*o}return!0}),_e(a.get("removeList"),function(s){var u=s.getModel(),f=s.get("originAttrs"),l=s.get("to");u.x=f.x+(l.x-f.x)*o,u.y=f.y+(l.y-f.y)*o}),a.refreshPositions()},{duration:i.duration,easing:i.ease,callback:function(){_e(a.getNodes(),function(s){s.set("originAttrs",null)}),_e(a.get("removeList"),function(s){a.removeItem(s,!1)}),a.set("removeList",[]),i.callback&&i.callback(),a.emit("afteranimate",{data:r})},delay:i.delay})},e.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},e.prototype.isLayoutAnimating=function(){return this.layoutAnimating},e.prototype.render=function(r){r===void 0&&(r=!0);var n=this,a=n.get("data");if(!a||!gn(a)||!Object.keys(a).length)throw new Error("data must be defined first");n.clear(),r&&this.get("enabledStack")&&this.clearStack(),n.emit("beforerender"),n.layout(this.get("fitView")),n.emit("afterrender")},e.prototype.save=function(){return this.get("data")},e.prototype.data=function(r){t.prototype.data.call(this,r),this.set("originData",nfe(r))},e})(AO);ro("circle",{options:{size:Qe.defaultNode.size,style:{x:0,y:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:P({},Qe.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).icon,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=_r({},a,e.icon),s="".concat(this.type,"-keyShape"),u=r.addShape("circle",{attrs:i,className:s,name:s,draggable:!0});r.shapeMap[s]=u;var f=o.width,l=o.height,c=o.show,h=o.text;if(c){var d="".concat(this.type,"-icon");h?r.shapeMap[d]=r.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:d,name:d,draggable:!0}):r.shapeMap[d]=r.addShape("image",{attrs:P({x:-f/2,y:-l/2},o),className:d,name:d,draggable:!0})}return this.drawLinkPoints(e,r),u},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints;if(n){var a=n||{},i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2;if(o){var v="link-point-left";r.shapeMap[v]=r.addShape("circle",{attrs:P(P({},c),{x:-d,y:0,r:f/2||l||5}),className:v,name:v,isAnchorPoint:!0})}if(s){var p="link-point-right";r.shapeMap[p]=r.addShape("circle",{attrs:P(P({},c),{x:d,y:0,r:f/2||l||5}),className:p,name:p,isAnchorPoint:!0})}if(i){var g="link-point-top";r.shapeMap[g]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-d,r:f/2||l||5}),className:g,name:g,isAnchorPoint:!0})}if(u){var y="link-point-bottom";r.shapeMap[y]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:d,r:f/2||l||5}),className:y,name:y,isAnchorPoint:!0})}}},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=_r({},r,n),i=this.getSize(e),o=i[0]/2,s=P({x:0,y:0,r:o},a);return s},update:function(e,r,n){var a=r.getContainer(),i=this.getSize(e),o=P({},e.style);e.style.stroke===void 0&&e.color&&(o.stroke=e.color),e.style.r===void 0&&!isNaN(i[0])&&(o.r=i[0]/2),this.updateShape(e,r,o,!0,n),this.updateLinkPoints(e,a)}},"single-node");ro("rect",{options:{size:[100,30],style:{radius:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:P({},Qe.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(e,r){var n=this.getShapeStyle(e),a=r.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return r.shapeMap["".concat(this.type,"-keyShape")]=a,this.drawLinkPoints(e,r),a},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getSize(e),o=a.width||i[0],s=a.height||i[1],u=P({x:-o/2,y:-s/2,width:o,height:s},a);return u},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getSize(e),s=r.get("keyShape");e.size||(o[0]=s.attr("width")||i.width,o[1]=s.attr("height")||i.height);var u={stroke:e.color,x:-o[0]/2,y:-o[1]/2,width:o[0],height:o[1]},f=Et({},i,s.attr(),u);f=Et(f,e.style),this.updateShape(e,r,f,!1,n),this.updateLinkPoints(e,a)}},"single-node");ro("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:P({},Qe.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).icon,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=r.addShape("ellipse",{attrs:i,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});r.shapeMap["ellipse-keyShape"]=o;var s=a.width,u=a.height,f=a.show,l=a.text;return f&&(l?r.shapeMap["".concat(this.type,"-icon")]=r.addShape("text",{attrs:P({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}):r.shapeMap["".concat(this.type,"-icon")]=r.addShape("image",{attrs:P({x:-s/2,y:-u/2},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,r),o},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2,v=h[1]/2;o&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},c),{x:-d,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},c),{x:d,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-v,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:v,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getSize(e),o=i[0]/2,s=i[1]/2,u=P({x:0,y:0,rx:o,ry:s},a);return u},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getSize(e),s={stroke:e.color,rx:o[0]/2,ry:o[1]/2},u=r.get("keyShape"),f=Et({},i,u.attr(),s);f=Et(f,e.style),this.updateShape(e,r,f,!0,n),this.updateLinkPoints(e,a)}},"single-node");ro("diamond",{options:{size:[80,80],style:{stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:P({},Qe.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).icon,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=r.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});r.shapeMap["".concat(this.type,"-keyShape")]=o;var s=a.width,u=a.height,f=a.show,l=a.text;return f&&(l?r.shapeMap["".concat(this.type,"-icon")]=r.addShape("text",{attrs:P({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}):r.shapeMap["".concat(this.type,"-icon")]=r.addShape("image",{attrs:P({x:-s/2,y:-u/2},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,r),o},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(e){var r=this.getSize(e),n=r[0],a=r[1],i=[["M",0,-a/2],["L",n/2,0],["L",0,a/2],["L",-n/2,0],["Z"]];return i},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getPath(e),o=P({path:i},a);return o},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=r.get("keyShape"),f=Et({},i,u.attr(),s);f=Et(f,e.style),this.updateShape(e,r,f,!0,n),this.updateLinkPoints(e,a)}},"single-node");ro("triangle",{options:{size:40,direction:"up",style:{stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:P({},Qe.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(e,r){var n=this.mergeStyle||this.getOptions(e),a=n.icon,i=a===void 0?{}:a,o=n.direction,s=this.getShapeStyle(e),u=e.direction||o,f=r.addShape("path",{attrs:s,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});r.shapeMap["".concat(this.type,"-keyShape")]=f;var l=i.width,c=i.height,h=i.show,d=i.offset,v=i.text;if(h)if(v)r.shapeMap["".concat(this.type,"-icon")]=r.addShape("text",{attrs:P({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 p=-l/2,g=-c/2;(u==="up"||u==="down")&&(g+=d),(u==="left"||u==="right")&&(p+=d),r.shapeMap["".concat(this.type,"-icon")]=r.addShape("image",{attrs:P({x:p,y:g},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(e,r),f},drawLinkPoints:function(e,r){var n=this.mergeStyle||this.getOptions(e),a=n.linkPoints,i=a===void 0?{}:a,o=n.direction,s=e.direction||o,u=i.top,f=i.left,l=i.right,c=i.bottom,h=i.size,d=i.r,v=Kr(i,["top","left","right","bottom","size","r"]),p=this.getSize(e),g=p[0];if(f){var y=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?y=[-b,m]:s==="down"?y=[-b,-m]:s==="left"&&(y=[-b,b-m]),y&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},v),{x:y[0],y:y[1],r:h/2||d||5}),className:"link-point-left",name:"link-point-left"}))}if(l){var w=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?w=[b,m]:s==="down"?w=[b,-m]:s==="right"&&(w=[b,b-m]),w&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},v),{x:w[0],y:w[1],r:h/2||d||5}),className:"link-point-right",name:"link-point-right"}))}if(u){var x=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?x=[b-m,-m]:s==="left"?x=[b,-m]:s==="right"&&(x=[-b,-m]),x&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},v),{x:x[0],y:x[1],r:h/2||d||5}),className:"link-point-top",name:"link-point-top"}))}if(c){var E=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="down"?E=[-b+m,m]:s==="left"?E=[b,m]:s==="right"&&(E=[-b,m]),E&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},v),{x:E[0],y:E[1],r:h/2||d||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(e){var r=(this.mergeStyle||this.getOptions(e)).direction,n=e.direction||r,a=this.getSize(e),i=a[0],o=i*Math.sin(1/3*Math.PI),s=i*Math.sin(1/3*Math.PI),u=[["M",-s,o],["L",0,-o],["L",s,o],["Z"]];return n==="down"?u=[["M",-s,-o],["L",s,-o],["L",0,o],["Z"]]:n==="left"?u=[["M",-s,s-o],["L",s,-s],["L",s,s],["Z"]]:n==="right"&&(u=[["M",s,s-o],["L",-s,s],["L",-s,-s],["Z"]]),u},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getPath(e),o=P({path:i},a);return o},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=r.get("keyShape"),f=Et({},i,u.attr(),s);f=Et(f,e.style),this.updateShape(e,r,f,!0,n),this.updateLinkPoints(e,a)},updateLinkPoints:function(e,r){var n=this.getOptions({}),a=n.linkPoints,i=n.direction,o=e.direction||i,s=r.shapeMap["link-point-left"]||r.find(function(L){return L.get("className")==="link-point-left"}),u=r.shapeMap["link-point-right"]||r.find(function(L){return L.get("className")==="link-point-right"}),f=r.shapeMap["link-point-top"]||r.find(function(L){return L.get("className")==="link-point-top"}),l=r.shapeMap["link-point-bottom"]||r.find(function(L){return L.get("className")==="link-point-bottom"}),c=a,h=s||u||f||l;h&&(c=h.attr());var d=Et({},c,e.linkPoints),v=d.fill,p=d.stroke,g=d.lineWidth,y=d.size/2;y||(y=d.r);var m=e.linkPoints?e.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},b=m.left,w=m.right,x=m.top,E=m.bottom,_=this.getSize(e),S=_[0],A={r:y,fill:v,stroke:p,lineWidth:g},M=null,C=S*Math.sin(1/3*Math.PI),I=S*Math.sin(1/3*Math.PI);o==="up"?M=[-I,C]:o==="down"?M=[-I,-C]:o==="left"&&(M=[-I,I-C]),M&&(s?!b&&b!==void 0?(s.remove(),delete r.shapeMap["link-point-left"]):s.attr(P(P({},A),{x:M[0],y:M[1]})):b&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},A),{x:M[0],y:M[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var k=null;o==="up"?k=[I,C]:o==="down"?k=[I,-C]:o==="right"&&(k=[I,I-C]),k&&(u?!w&&w!==void 0?(u.remove(),delete r.shapeMap["link-point-right"]):u.attr(P(P({},A),{x:k[0],y:k[1]})):w&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},A),{x:k[0],y:k[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var O=null;o==="up"?O=[I-C,-C]:o==="left"?O=[I,-C]:o==="right"&&(O=[-I,-C]),O&&(f?!x&&x!==void 0?(f.remove(),delete r.shapeMap["link-point-top"]):f.attr(P(P({},A),{x:O[0],y:O[1]})):x&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},A),{x:O[0],y:O[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var B=null;o==="down"?B=[-I+C,C]:o==="left"?B=[I,C]:o==="right"&&(B=[-I,C]),B&&(l?!E&&E!==void 0?(l.remove(),delete r.shapeMap["link-point-bottom"]):l.attr(P(P({},A),{x:B[0],y:B[1]})):E&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},A),{x:B[0],y:B[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node");ro("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:Qe.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:Qe.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:Qe.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(e,r){var n=(this.mergeStyle||this.getOptions(e)).preRect,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=this.getSize(e),s=o[0],u=o[1],f=r.addShape("rect",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});r.shapeMap["".concat(this.type,"-keyShape")]=f;var l=a.show,c=Kr(a,["show"]);return l&&(r.shapeMap["pre-rect"]=r.addShape("rect",{attrs:P({x:-s/2,y:-u/2,height:u},c),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(e,r),this.drawStateIcon(e,r),this.drawLinkPoints(e,r),f},drawLogoIcon:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).logoIcon,a=n===void 0?{}:n,i=this.getSize(e),o=i[0];if(a.show){var s=a.width,u=a.height,f=a.x,l=a.y,c=a.offset,h=a.text,d=Kr(a,["width","height","x","y","offset","text"]);h?r.shapeMap["rect-logo-icon"]=r.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},d),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):r.shapeMap["rect-logo-icon"]=r.addShape("image",{attrs:P(P({},d),{x:f||-o/2+s+c,y:l||-u/2,width:s,height:u}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).stateIcon,a=n===void 0?{}:n,i=this.getSize(e),o=i[0];if(a.show){var s=a.width,u=a.height,f=a.x,l=a.y,c=a.offset,h=a.text,d=Kr(a,["width","height","x","y","offset","text"]);h?r.shapeMap["rect-state-icon"]=r.addShape("text",{attrs:P({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},d),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):r.shapeMap["rect-state-icon"]=r.addShape("image",{attrs:P(P({},d),{x:f||o/2-s+c,y:l||-u/2,width:s,height:u}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.bottom,f=a.size,l=a.r,c=Kr(a,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),i&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(e,r){var n=this.getOptions(e),a=n.labelCfg,i=a===void 0?{}:a,o=n.logoIcon,s=o===void 0?{}:o,u=n.descriptionCfg,f=u===void 0?{}:u,l=this.getSize(e),c=l[0],h=null,d=s.show,v=s.width,p=-c/2+i.offset;d&&(p=-c/2+v+i.offset);var g=i.style,y=f.style,m=f.paddingTop;return Ye(e.description)?(h=r.addShape("text",{attrs:P(P({},g),{x:p,y:-5,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),r.shapeMap["text-shape"]=h,r.shapeMap["rect-description"]=r.addShape("text",{attrs:P(P({},y),{x:p,y:17+(m||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(h=r.addShape("text",{attrs:P(P({},g),{x:p,y:7,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),r.shapeMap["text-shape"]=h),h},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getSize(e),o=a.width||i[0],s=a.height||i[1],u=P({x:-o/2,y:-s/2,width:o,height:s},a);return u},update:function(e,r){var n=this.mergeStyle||this.getOptions(e),a=n.style,i=a===void 0?{}:a,o=n.labelCfg,s=o===void 0?{}:o,u=n.descriptionCfg,f=u===void 0?{}:u,l=this.getSize(e),c=l[0],h=l[1],d=r.get("keyShape");d.attr(P(P({},i),{x:-c/2,y:-h/2,width:c,height:h}));var v=r.getContainer(),p=v.shapeMap["rect-logo-icon"]||v.find(function(qe){return qe.get("className")==="rect-logo-icon"}),g=p?p.attr():{},y=Et({},g,e.logoIcon),m=y.width;m===void 0&&(m=this.options.logoIcon.width);var b=e.logoIcon?e.logoIcon.show:void 0,w=s.offset,x=-c/2+m+w;!b&&b!==void 0&&(x=-c/2+w);var E=v.shapeMap["node-label"]||v.find(function(qe){return qe.get("className")==="node-label"}),_=v.shapeMap["rect-description"]||v.find(function(qe){return qe.get("className")==="rect-description"});if(e.label)if(!E)v.shapeMap["node-label"]=v.addShape("text",{attrs:P(P({},s.style),{x,y:e.description?-5:7,text:e.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var S=e.labelCfg?e.labelCfg.style:{},A=Et({},E.attr(),S);e.label&&(A.text=e.label),A.x=x,Ye(e.description)&&(A.y=-5),_&&(_.resetMatrix(),_.attr({x})),E.resetMatrix(),E.attr(A)}if(Ye(e.description)){var M=f.paddingTop;if(!_)v.shapeMap["rect-description"]=v.addShape("text",{attrs:P(P({},f.style),{x,y:17+(M||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var S=e.descriptionCfg?e.descriptionCfg.style:{},C=Et({},_.attr(),S);Ye(e.description)&&(C.text=e.description),C.x=x,_.resetMatrix(),_.attr(P(P({},C),{y:17+(M||0)}))}}var I=v.shapeMap["pre-rect"]||v.find(function(qe){return qe.get("className")==="pre-rect"});if(I&&!I.destroyed){var k=Et({},I.attr(),e.preRect);I.attr(P(P({},k),{x:-c/2,y:-h/2,height:h}))}if(p&&!p.destroyed)if(!b&&b!==void 0)p.remove(),delete v.shapeMap["pre-rect"];else{var O=y.width,B=y.height,L=y.x,z=y.y,X=y.offset,R=Kr(y,["width","height","x","y","offset"]);p.attr(P(P({},R),{x:L||-c/2+O+X,y:z||-B/2,width:O,height:B}))}else b&&this.drawLogoIcon(e,v);var V=v.shapeMap["rect-state-icon"]||v.find(function(qe){return qe.get("className")==="rect-state-icon"}),he=V?V.attr():{},ce=Et({},he,e.stateIcon);if(V){!ce.show&&ce.show!==void 0&&(V.remove(),delete v.shapeMap["rect-state-icon"]);var le=ce.width,B=ce.height,L=ce.x,z=ce.y,ie=ce.offset,Ie=Kr(ce,["width","height","x","y","offset"]);V.attr(P(P({},Ie),{x:L||c/2-le+ie,y:z||-B/2,width:le,height:B}))}else ce.show&&this.drawStateIcon(e,v);this.updateLinkPoints(e,v)},getOptions:function(e,r){return r==="move"?e:_r({},this.options,this.getCustomConfig(e)||{},e)}},"single-node");ro("star",{options:{size:60,style:{stroke:Qe.defaultNode.style.stroke,fill:Qe.defaultNode.style.fill,lineWidth:Qe.defaultNode.style.lineWidth},labelCfg:{style:{fill:Qe.nodeLabel.style.fill,fontSize:Qe.nodeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Qe.defaultNode.linkPoints.size,lineWidth:Qe.defaultNode.linkPoints.lineWidth,fill:Qe.defaultNode.linkPoints.fill,stroke:Qe.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:P({},Qe.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).icon,a=n===void 0?{}:n,i=this.getShapeStyle(e),o=r.addShape("path",{attrs:i,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});r.shapeMap["".concat(this.type,"-keyShape")]=o;var s=a.width,u=a.height,f=a.show,l=a.text;return f&&(l?r.shapeMap["".concat(this.type,"-icon")]=r.addShape("text",{attrs:P({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}):r.shapeMap["".concat(this.type,"-icon")]=r.addShape("image",{attrs:P({x:-s/2,y:-u/2},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,r),o},drawLinkPoints:function(e,r){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,a=n===void 0?{}:n,i=a.top,o=a.left,s=a.right,u=a.leftBottom,f=a.rightBottom,l=a.size,c=a.r,h=Kr(a,["top","left","right","leftBottom","rightBottom","size","r"]),d=this.getSize(e),v=d[0];if(s){var p=Math.cos(.1*Math.PI)*v,g=Math.sin((18+72*0)/180*Math.PI)*v;r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right",name:"link-point-right"})}if(i){var p=Math.cos(.5*Math.PI)*v,g=Math.sin((18+72*1)/180*Math.PI)*v;r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-top",name:"link-point-top"})}if(o){var p=Math.cos(.9*Math.PI)*v,g=Math.sin((18+72*2)/180*Math.PI)*v;r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-left",name:"link-point-left"})}if(u){var p=Math.cos(1.3*Math.PI)*v,g=Math.sin((18+72*3)/180*Math.PI)*v;r.shapeMap["link-point-bottom"]=r.addShape("circle",{attrs:P(P({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(f){var p=Math.cos(1.7*Math.PI)*v,g=Math.sin((18+72*4)/180*Math.PI)*v;r.shapeMap["link-point-right-bottom"]=r.addShape("circle",{attrs:P(P({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(e){var r=this.getSize(e),n=r[0],a=n*3/8,i=e.innerR||a;return Za.getStarPath(n,i)},getShapeStyle:function(e){var r=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},a=Et({},r,n),i=this.getPath(e),o=P({path:i},a);return o},update:function(e,r,n){var a=r.getContainer(),i=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=r.get("keyShape"),f=Et({},i,u.attr(),s);f=Et(f,e.style),this.updateShape(e,r,f,!0,n),this.updateLinkPoints(e,a)},updateLinkPoints:function(e,r){var n=this.getOptions({}).linkPoints,a=r.shapeMap["link-point-left"]||r.find(function(C){return C.get("className")==="link-point-left"}),i=r.shapeMap["link-point-right"]||r.find(function(C){return C.get("className")==="link-point-right"}),o=r.shapeMap["link-point-top"]||r.find(function(C){return C.get("className")==="link-point-top"}),s=r.shapeMap["link-point-left-bottom"]||r.find(function(C){return C.get("className")==="link-point-left-bottom"}),u=r.shapeMap["link-point-left-bottom"]||r.find(function(C){return C.get("className")==="link-point-right-bottom"}),f=n,l=a||i||o||s||u;l&&(f=l.attr());var c=Et({},f,e.linkPoints),h=c.fill,d=c.stroke,v=c.lineWidth,p=c.size/2;p||(p=c.r);var g=e.linkPoints?e.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},y=g.left,m=g.right,b=g.top,w=g.leftBottom,x=g.rightBottom,E=this.getSize(e),_=E[0],S={r:p,fill:h,stroke:d,lineWidth:v},A=Math.cos((18+72*0)/180*Math.PI)*_,M=Math.sin((18+72*0)/180*Math.PI)*_;i?!m&&m!==void 0?(i.remove(),delete r.shapeMap["link-point-right"]):i.attr(P(P({},S),{x:A,y:-M})):m&&(r.shapeMap["link-point-right"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),A=Math.cos((18+72*1)/180*Math.PI)*_,M=Math.sin((18+72*1)/180*Math.PI)*_,o?!b&&b!==void 0?(o.remove(),delete r.shapeMap["link-point-top"]):o.attr(P(P({},S),{x:A,y:-M})):b&&(r.shapeMap["link-point-top"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),A=Math.cos((18+72*2)/180*Math.PI)*_,M=Math.sin((18+72*2)/180*Math.PI)*_,a?!y&&y!==void 0?(a.remove(),delete r.shapeMap["link-point-left"]):a.attr(P(P({},S),{x:A,y:-M})):y&&(r.shapeMap["link-point-left"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),A=Math.cos((18+72*3)/180*Math.PI)*_,M=Math.sin((18+72*3)/180*Math.PI)*_,s?!w&&w!==void 0?(s.remove(),delete r.shapeMap["link-point-left-bottom"]):s.attr(P(P({},S),{x:A,y:-M})):w&&(r.shapeMap["link-point-left-bottom"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),A=Math.cos((18+72*4)/180*Math.PI)*_,M=Math.sin((18+72*4)/180*Math.PI)*_,u?!x&&x!==void 0?(u.remove(),delete r.shapeMap["link-point-right-bottom"]):u.attr(P(P({},S),{x:A,y:-M})):x&&(r.shapeMap["link-point-right-bottom"]=r.addShape("circle",{attrs:P(P({},S),{x:A,y:-M}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var Y2=Za.defaultSubjectColors,If="fan-shape-",TO=function(e,r){var n=0,a=[];return Object.keys(e).forEach(function(i){var o=+e[i];isNaN(o)||(a.push({key:i,value:o,color:r[i]}),n+=o)}),{totalValue:n,configs:a}},IO=function(e){var r=e.attr("r"),n=.6*r,a=(r+n)/2,i=r-n;return{lineWidth:i,arcR:a}},Zg=function(e,r){var n=r.arcR,a=r.arcBegin,i=r.beginAngle,o=r.config,s=r.fanIndex,u=r.lineWidth,f=r.totalValue,l=r.drawWhole,c=l===void 0?!1:l,h=r.updateShape,d=h===void 0?void 0:h,v=o.value/f;if(v<.001)return{beginAngle:i,arcBegin:a,shape:void 0,shouldEnd:!1};var p,g,y;if(c||v>.999)p=[n,1e-4],y=1;else{var m=v*Math.PI*2;g=i+m,p=[n*Math.cos(g),-n*Math.sin(g)],y=m>Math.PI?1:0}var b={path:[["M",a[0],a[1]],["A",n,n,0,y,0,p[0],p[1]]],stroke:o.color||(d==null?void 0:d.attr("stroke"))||Y2[s%Y2.length],lineWidth:u};return d?d.attr(b):e.shapeMap["".concat(If).concat(s)]=e.addShape("path",{attrs:b,name:"".concat(If).concat(s),draggable:!0}),{beginAngle:g,arcBegin:p,shape:e.shapeMap["".concat(If).concat(s)],shouldEnd:c||v>.999}},ife=function(e,r,n){var a=e.donutAttrs,i=a===void 0?{}:a,o=e.donutColorMap,s=o===void 0?{}:o,u=Object.keys(i).length;if(i&&u>1){var f=TO(i,s),l=f.configs,c=f.totalValue;if(c){var h=IO(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0;if(u===1){Zg(r,{arcR:v,arcBegin:p,beginAngle:g,config:l[0],fanIndex:0,lineWidth:d,totalValue:c,drawWhole:!0});return}for(var y=0;y=0;i--){var o=e[i];o.id="".concat(o.x,"|||").concat(o.y),n[o.id]||(n[o.id]=o,r.push(o))}return r},kO=function(e){return v1(e)},vd=function(e,r){return e.width||e.height?{centerX:e.centerX,centerY:e.centerY,minX:e.minX-r,minY:e.minY-r,maxX:e.maxX+r,maxY:e.maxY+r,height:e.height+2*r,width:e.width+2*r}:e},ufe=function(e,r){var n=Math.abs(e.x-r.centerX),a=Math.abs(e.y-r.centerY);return n===0&&a===0?0:n/r.width>a/r.height},Kg=function(e,r,n){var a=ufe(r,e);if(a===0){var i=e.centerX,o=e.centerY;return n.yr.x?i=e.maxX:n.xe.centerX?e.maxX:e.minX,y:r.y}:{x:r.x,y:r.y>e.centerY?e.maxY:e.minY}},q2=function(e,r){var n=Math.min(e.minX,r.minX),a=Math.min(e.minY,r.minY),i=Math.max(e.maxX,r.maxX),o=Math.max(e.maxY,r.maxY);return{centerX:(n+i)/2,centerY:(a+o)/2,minX:n,minY:a,maxX:i,maxY:o,height:o-a,width:i-n}},Qg=function(e){return[{x:e.minX,y:e.minY},{x:e.maxX,y:e.minY},{x:e.maxX,y:e.maxY},{x:e.minX,y:e.maxY}]},Hc=function(e,r){var n=e.x,a=e.y;return nr.maxX||ar.maxY},ffe=function(e,r){return re.maxX?[]:[{x:r,y:e.minY},{x:r,y:e.maxY}]},lfe=function(e,r){return re.maxY?[]:[{x:e.minX,y:r},{x:e.maxX,y:r}]},cfe=function(e,r){return ffe(e,r.x).concat(lfe(e,r.y))},Kf=function(e,r){return Math.abs(e.x-r.x)+Math.abs(e.y-r.y)},hfe=function(e,r){var n=-2,a=0;return r.forEach(function(i){i&&(e.x===i.x&&(a+=n),e.y===i.y&&(a+=n))}),a},H2=function(e,r,n,a,i){return Kf(e,r)+Kf(e,n)+hfe(e,[r,n,a,i])},NO=function(e,r,n,a,i){i===void 0&&(i=0),e.unshift(r[a]),n[a]&&n[a]!==a&&i<=100&&NO(e,r,n,n[a],i+1)},Zc=function(e,r,n,a){var i=n.x-e.x,o=n.y-e.y,s=a.x-e.x,u=a.y-e.y,f=n.x-r.x,l=n.y-r.y,c=a.x-r.x,h=a.y-r.y,d=i*u-o*s,v=f*h-l*c,p=i*l-o*f,g=s*h-u*c;return d*v<=0&&p*g<=0},Jg=function(e,r,n){if(n.width||n.height){var a=Qg(n),i=a[0],o=a[1],s=a[2],u=a[3];return Zc(e,r,i,o)||Zc(e,r,i,u)||Zc(e,r,o,s)||Zc(e,r,s,u)}return!1},dfe=function(e,r,n,a){var i=[];return e.forEach(function(o){if(o!==r&&(o.x===r.x||o.y===r.y)){if(Jg(o,r,n)||Jg(o,r,a))return;i.push(o)}}),v1(i)},OO=function(){function t(){this.arr=[],this.map={},this.arr=[],this.map={}}return t.prototype._innerAdd=function(e,r){for(var n=[0,r-1];n[1]-n[0]>1;){var a=Math.floor((n[0]+n[1])/2);if(this.arr[a].value>e.value)n[1]=a;else if(this.arr[a].value=0;r--)this.map[this.arr[r].id]?e=this.arr[r].id:this.arr.splice(r,1);return e},t.prototype._findFirstId=function(){for(;this.arr.length;){var e=this.arr.shift();if(this.map[e.id])return e.id}},t.prototype.minId=function(e){return e?this._clearAndGetMinId():this._findFirstId()},t}(),vfe=function(e,r,n,a,i,o,s){var u,f=[],l=(u={},u[r.id]=r,u),c={},h={},d={};h[r.id]=0,d[r.id]=H2(r,n,r);var v=new OO;v.add({id:r.id,value:d[r.id]});var p={};e.forEach(function(x){p[x.id]=x});for(var g;Object.keys(l).length;){var y=v.minId(!1);if(y)g=l[y];else break;if(g===n){var m=[];return NO(m,p,c,n.id),m}delete l[g.id],v.remove(g.id),f.push(g);var b=dfe(e,g,a,i),w=function(E){E.forEach(function(_){if(f.indexOf(_)===-1){var S=_.id;l[S]||(l[S]=_);var A=d[g.id]+Kf(g,_);if(h[S]&&A>=h[S]){v.add({id:S,value:d[S]});return}c[S]=g.id,h[S]=A,d[S]=h[S]+H2(_,n,r,o,s),v.add({id:S,value:d[S]})}})};w(b)}return[r,n]},pfe=function(e,r,n){return!(e.x===r.x&&r.x===n.x||e.y===r.y&&r.y===n.y)},gfe=function(e,r,n,a){var i=Kf(e,r),o=Kf(n,r);i=0;o--){var s=e[o];if(s.x===n.x?a.push(s):(a=[s],n.x=s.x),s.y===n.y?i.push(s):(i=[s],n.y=s.y),a.length>2){var u=e.indexOf(a[1]);u>-1&&e.splice(u,1);continue}if(i.length>2){var u=e.indexOf(i[1]);u>-1&&e.splice(u,1)}}return e},mfe=function(e,r){return Math.abs(e.x-r.x)+Math.abs(e.y-r.y)},bfe=function(e,r,n,a,i){return kO(LO(e,r,n,a,i.offset))},wfe={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:mfe,fallbackRoute:bfe},vi=function(e,r){var n=Math.round(Math.abs(e/r)),a=e<0?-1:1;return n<0?0:a*n},xfe=function(e,r,n){var a={};return e.forEach(function(i){if(i)for(var o=vd(i.getBBox(),n),s=vi(o.minX,r);s<=vi(o.maxX,r);s+=1)for(var u=vi(o.minY,r);u<=vi(o.maxY,r);u+=1)a["".concat(s,"|||").concat(u)]=!0}),a},m0=function(e,r){var n=r.x-e.x,a=r.y-e.y;return n||a?Math.atan2(a,n):0},K2=function(e,r){var n=Math.abs(e-r);return n>Math.PI?2*Math.PI-n:n},Q2=function(e,r,n){for(var a=1/0,i=0,o=r.length;if.minX&&r.xf.minY&&r.y0&&E>0;){var B=b.minId((E+1)%30===0);if(B)_=v[B];else break;if(O["".concat(_.x,"|||").concat(_.y)])return Efe(_,g,l,r,e,c,u);delete v[_.id],b.remove(_.id),p[_.id]=!0;for(var w=0;wo.maxAllowedDirectionChange)&&!f[L])){v[L]||(v[L]=A);var z=s[I];M=o.distFunc(_,A)+(isNaN(z)?u:z),C=y[_.id]+M;var X=y[L];X&&C>=X||(g[L]=_,y[L]=C,m[L]=C+Q2(A,d,o.distFunc),b.add({id:L,value:m[L]}))}}E-=1}return o.fallbackRoute(e,r,n,a,o)};B8("polyline",{options:{color:Qe.defaultEdge.color,size:Qe.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:Qe.defaultEdge.style.stroke,lineAppendWidth:Qe.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Qe.edgeLabel.style.fill,fontSize:Qe.edgeLabel.style.fontSize,fontFamily:Qe.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:P({},Qe.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(e,r){var n=this.getShapeStyle(e);n.radius===0&&delete n.radius;var a=r.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return r.shapeMap["edge-shape"]=a,a},getShapeStyle:function(e){var r=this.options.style,n={stroke:e.color},a=Et({},r,n,e.style);e=this.getPathPoints(e),this.radius=a.radius,this.offset=a.offset;var i=e.startPoint,o=e.endPoint,s=this.getControlPoints(e),u=[i];s&&(u=u.concat(s)),u.push(o);var f=e.sourceNode,l=e.targetNode,c=a.radius,h=this.options.routeCfg,d=Et({},h,e.routeCfg);d.offset=a.offset;var v=this.getPath(u,f,l,c,d,!s);(bt(v)&&v.length<=1||Ye(v)&&v.indexOf("L")===-1)&&(v="M0 0, L0 0"),(isNaN(i.x)||isNaN(i.y)||isNaN(o.x)||isNaN(o.y))&&(v="M0 0, L0 0");var p=Et({},Qe.defaultEdge.style,a,{lineWidth:e.size,path:v});return p},updateShapeStyle:function(e,r){var n=r.getContainer();if(r.isVisible()){var a={stroke:e.color},i=n.shapeMap["edge-shape"]||n.find(function(w){return w.get("className")==="edge-shape"})||r.getKeyShape(),o=e.size;e=this.getPathPoints(e);var s=e.startPoint,u=e.endPoint,f=this.getControlPoints(e),l=[s];f&&(l=l.concat(f)),l.push(u);var c=i.attr(),h=Et({},a,c,e.style),d=e.sourceNode,v=e.targetNode,p=h.radius,g=this.options.routeCfg,y=Et({},g,e.routeCfg);y.offset=h.offset;var m=this.getPath(l,d,v,p,y,!f);(bt(m)&&m.length<=1||Ye(m)&&m.indexOf("L")===-1)&&(m="M0 0, L0 0"),(isNaN(s.x)||isNaN(s.y)||isNaN(u.x)||isNaN(u.y))&&(m="M0 0, L0 0"),c.endArrow&&h.endArrow===!1&&(e.style.endArrow={path:""}),c.startArrow&&h.startArrow===!1&&(e.style.startArrow={path:""});var b=Et(a,i.attr(),{lineWidth:o,path:m},e.style);i&&i.attr(b)}},getPath:function(e,r,n,a,i,o){var s=i.offset,u=i.obstacles,f=i.simple;if(!s||e.length>2||o===!1){if(a)return Z2(e,a);var l=[];return _e(e,function(v,p){p===0?l.push(["M",v.x,v.y]):l.push(["L",v.x,v.y])}),l}f!==!1&&!(u!=null&&u.length)&&(f=!0);var c=f?LO(e[e.length-1],e[0],n,r,s):_fe(e[0],e[e.length-1],r,n,i);if(!c||!c.length)return"M0 0, L0 0";if(a){var h=Z2(c,a);return h}c=yfe(c);var d=Za.pointsToPolygon(c);return d}},"single-edge");var eS=so.cloneEvent,tS=so.isNaN,rS=Math.abs,Sfe=10,Mfe=["shift","ctrl","alt","control"];const Afe={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{mousedown:"onMouseDown",drag:"onDragMove",dragend:"onMouseUp","canvas:click":"onMouseUp",keyup:"onKeyUp",focus:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onMouseUp"}},updateViewport:function(e){var r=this.origin,n=+e.clientX,a=+e.clientY;if(!(tS(n)||tS(a))){var i=n-r.x,o=a-r.y;this.get("direction")==="x"?o=0:this.get("direction")==="y"&&(i=0),this.origin={x:n,y:a};var s=this.graph.get("width"),u=this.graph.get("height"),f=this.graph.get("canvas").getCanvasBBox(),l=this.scalableRange,c=this.scalableRange;l<1&&l>-1&&(l=s*l,c=u*c),(f.minX<=s+l&&f.minX+i>s+l||f.maxX+l>=0&&f.maxX+l+i<0)&&(i=0),(f.minY<=u+c&&f.minY+o>u+c||f.maxY+c>=0&&f.maxY+c+o<0)&&(o=0),this.graph.translate(i,o)}},onTouchStart:function(e){var r=this,n=e.originalEvent.touches,a=n[0],i=n[1];a&&i||(e.preventDefault(),this.mousedown=!0,r.onDragStart(e))},onMouseDown:function(e){this.mousedown=!0},onDragMove:function(e){this.mousedown&&(this.dragstart?this.onDrag(e):(this.dragstart=!0,this.onDragStart(e)))},onDragStart:function(e){var r=this,n=e.originalEvent;if(!(n&&e.name!=="touchstart"&&n.button!==0)&&!(e.name!=="touchstart"&&typeof window<"u"&&window.event&&!window.event.buttons&&!window.event.button)&&this.shouldBegin(e,this)&&!r.keydown&&this.allowDrag(e)){if(r.origin={x:e.clientX,y:e.clientY},r.dragging=!1,this.enableOptimize){for(var a=this.graph,i=a.getEdges(),o=0,s=i.length;ou)for(var d=a.getNodes(),v=0,p=d.length;v-1?r.keydown=!0:r.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(e){var r,n,a=e.target,i=a&&a.isCanvas&&a.isCanvas();if(Qf(this.allowDragOnItem)&&!this.allowDragOnItem&&!i)return!1;if(gn(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(r=e.item)===null||r===void 0?void 0:r.getType)===null||n===void 0?void 0:n.call(r);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}},Cfe={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:mousedown":"onMouseDown",drag:"onDragMove",dragend:"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd",afterchangedata:"onDragEnd"}},validationCombo:function(e){if(!this.origin||!e||e.destroyed)return!1;var r=e.getType();return r==="combo"},onTouchStart:function(e){if(e.item){var r=this;try{var n=e.originalEvent.touches,a=n[0],i=n[1];if(a&&i)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}this.mousedown={item:e.item,target:e.target,origin:{x:e.x,y:e.y}},this.dragstart=!0,r.onDragStart(e)}},onTouchMove:function(e){var r=this;try{var n=e.originalEvent.touches,a=n[0],i=n[1];if(a&&i){r.onDragEnd(e);return}e.preventDefault()}catch{console.warn("Touch original event not exist!")}r.onDrag(e)},onMouseDown:function(e){this.mousedown={item:e.item,target:e.target,origin:{x:e.x,y:e.y}},typeof window<"u"&&!this.windowEventBinded&&(this.windowEventBinded=!0,document.body.addEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.addEventListener("mouseup",this.onDragEnd.bind(this)))},onDragMove:function(e){var r,n;if(((n=(r=e.item)===null||r===void 0?void 0:r.getType)===null||n===void 0?void 0:n.call(r))!=="node"){this.onDragEnd();return}this.mousedown&&(this.dragstart?this.onDrag(P(P({},e),this.mousedown)):(this.dragstart=!0,this.onDragStart(e)))},onDragStart:function(e){var r=this;if(this.currentShouldEnd=!0,!!this.shouldBegin(P(P({},e),this.mousedown),this)){var n=this.mousedown,a=n.item,i=n.target;if(!(!a||a.destroyed||a.hasLocked())){var o=a.getContainer();if(o.set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(a),i){var s=i.get("isAnchorPoint");if(s)return}var u=this.graph;this.targets=[],this.targetCombo=null;var f=u.findAllByState("node",this.selectedState),l=a.get("id"),c=f.filter(function(d){var v=d.get("id");return l===v});if(c.length===0?this.targets.push(a):f.length>1?f.forEach(function(d){var v=d.hasLocked();v||r.targets.push(d)}):this.targets.push(a),this.graph.get("enabledStack")&&this.enableStack){var h=[];this.targets.forEach(function(d){var v=d.getModel(),p=v.x,g=v.y,y=v.id;h.push({x:p,y:g,id:y})}),this.set("beforeDragNodes",h)}this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(d){var v=d.getEdges();v.forEach(function(p){p.isVisible()&&(r.hidenEdge[p.getID()]=!0,p.hide())})}),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(e){var r=this;if(!(!this.mousedown||!this.origin)&&this.shouldUpdate(e,this))if(this.get("enableDelegate"))this.updateDelegate(e);else if(this.enableDebounce)this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:e,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos});else{var n={};this.targets.map(function(a){r.update(a,e);var i=a.getModel().comboId;i&&(n[i]=r.graph.findById(i))}),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(e){var r=this,n;if(this.mousedown=!1,this.dragstart=!1,typeof window<"u"&&this.windowEventBinded&&(this.windowEventBinded=!1,document.body.removeEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.removeEventListener("mouseup",this.onDragEnd.bind(this))),!!this.origin){(n=this.cachedCaptureItems)===null||n===void 0||n.forEach(function(o){var s=o.getContainer();s.set("capture",!0)}),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(o){var s=o.getEdges();s.forEach(function(u){r.hidenEdge[u.getID()]&&u.show(),u.refresh()})}),this.hidenEdge={};var a=this.graph;if(a.get("enabledStack")&&this.enableStack){var i={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(o){i.before.nodes.push(o)}),this.targets.forEach(function(o){var s=o.getModel(),u=s.x,f=s.y,l=s.id;i.after.nodes.push({x:u,y:f,id:l})}),a.pushStack("update",rr(i))}a.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(e){var r=e.item;if(this.currentShouldEnd=this.shouldEnd(e,r,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!this.validationCombo(r))){var n=this.graph;if(this.comboActiveState&&n.setItemState(r,this.comboActiveState,!1),this.targetCombo=r,this.onlyChangeComboSize)n.updateCombos();else{var a=r.getModel();this.targets.map(function(i){var o=i.getModel();o.comboId!==a.id&&n.updateComboTree(i,a.id)}),n.updateCombo(r)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(e){var r=this.graph;this.currentShouldEnd=this.shouldEnd(e,void 0,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.targets||this.targets.length===0||!this.currentShouldEnd)&&(this.onlyChangeComboSize?this.updateParentCombos():this.targets.map(function(n){var a=n.getModel();a.comboId&&r.updateComboTree(n)}))},onDropNode:function(e){if(!(!this.targets||this.targets.length===0)){var r=this,n=e.item,a=r.graph,i=n.getModel().comboId,o=i?a.findById(i):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(i){var s=a.findById(i);r.comboActiveState&&a.setItemState(s,r.comboActiveState,!1),this.targets.map(function(u){var f=u.getModel();i!==f.comboId&&a.updateComboTree(u,i)}),a.updateCombo(s)}else this.targets.map(function(u){var f=u.getModel();f.comboId&&a.updateComboTree(u)});a.emit("dragnodeend",{items:this.targets,targetItem:n})}}},onDragEnter:function(e){var r=e.item;if(this.validationCombo(r)){var n=this.graph;this.comboActiveState&&n.setItemState(r,this.comboActiveState,!0)}},onDragLeave:function(e){var r=e.item;if(this.validationCombo(r)){var n=this.graph;this.comboActiveState&&n.setItemState(r,this.comboActiveState,!1)}},updatePositions:function(e,r){var n=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:e,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos}):r||this.targets.map(function(a){return n.update(a,e)}):this.targets.map(function(a){return n.update(a,e,r)}))},update:function(e,r,n){var a=this.origin,i=e.get("model"),o=e.get("id");this.point[o]||(this.point[o]={x:i.x||0,y:i.y||0});var s=r.x-a.x+this.point[o].x,u=r.y-a.y+this.point[o].y;n&&(s+=a.x-r.x,u+=a.y-r.y);var f={x:s,y:u};this.get("updateEdge")?this.graph.updateItem(e,f,!1):e.updatePosition(f)},debounceUpdate:oy(function(t){var e=t.targets,r=t.graph,n=t.point,a=t.origin,i=t.evt,o=t.updateEdge,s=t.onlyChangeComboSize,u=t.updateParentCombos;e.map(function(f){var l=f.get("model"),c=f.get("id");n[c]||(n[c]={x:l.x||0,y:l.y||0});var h=i.x-a.x+n[c].x,d=i.y-a.y+n[c].y,v={x:h,y:d};o?r.updateItem(f,v,!1):f.updatePosition(v)}),s&&u(r,e)},50,!0),updateDelegate:function(e){var r=this.graph;if(this.delegateRect){var h=e.x-this.origin.x+this.originPoint.minX,d=e.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:h,y:d})}else{var n=r.get("group"),a=_r({},Mf.delegateStyle,this.delegateStyle),i=this.calculationGroupPosition(e),o=i.x,s=i.y,u=i.width,f=i.height,l=i.minX,c=i.minY;this.originPoint={x:o,y:s,width:u,height:f,minX:l,minY:c},this.delegateRect=n.addShape("rect",{attrs:P({width:u,height:f,x:o,y:s},a),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(e){var r=this.targets;r.length===0&&r.push(e.item);for(var n=1/0,a=-1/0,i=1/0,o=-1/0,s=0;sa&&(a=h),d>o&&(o=d)}var v=Math.floor(n),p=Math.floor(i),g=Math.ceil(a)-Math.floor(n),y=Math.ceil(o)-Math.floor(i);return{x:v,y:p,width:g,height:y,minX:n,minY:i}},updateParentCombos:function(e,r){var n=e||this.graph,a=r||this.targets,i={};a==null||a.forEach(function(o){var s=o.getModel().comboId;s&&(i[s]=n.findById(s))}),Object.values(i).forEach(function(o){o&&n.updateCombo(o)})}};var Kc=null;const Tfe={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldClearStatusOnSecond:!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(e){var r=this;try{var n=e.originalEvent.touches,a=n[0],i=n[1];if(a&&i)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}r.setAllItemStates(e)},clearOnTouchStart:function(e){var r=this;try{var n=e.originalEvent.touches,a=n[0],i=n[1];if(a&&i)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}r.clearActiveState(e)},setAllItemStates:function(e){clearTimeout(this.timer),this.throttleSetAllItemStates(e,this)},clearActiveState:function(e){var r=this,n=this.shouldClearStatusOnSecond;n&&(Kc=null),this.timer=setTimeout(function(){r.throttleClearActiveState(e,r)},50)},throttleSetAllItemStates:Ch(function(t,e){var r=t.item,n=e.graph;if(!(!n||n.destroyed)&&(e.item=r,!!e.shouldUpdate(t.item,{event:t,action:"activate"},e))){var a=e.shouldClearStatusOnSecond,i=r.getModel().id;if(Kc===i&&a){e.throttleClearActiveState(t,e),Kc=null;return}for(var o=e.activeState,s=e.inactiveState,u=n.getNodes(),f=n.getCombos(),l=n.getEdges(),c=n.get("vedges"),h=u.length,d=f.length,v=l.length,p=c.length,g=e.inactiveItems||{},y=e.activeItems||{},m=0;m-1||(this.trigger=iS,console.warn("Behavior brush-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 '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(e){var r=e.item,n=this.brush,a=this.selectOnCombo,i=(r==null?void 0:r.getType())==="combo";i&&!a||!i&&r||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates(),n||(n=this.createBrush()),this.originPoint={x:e.canvasX,y:e.canvasY},n.attr({width:0,height:0}),n.show(),this.dragging=!0)},onMouseMove:function(e){this.dragging&&(this.trigger!=="drag"&&!this.keydown||this.updateBrush(e))},onMouseUp:function(e){this.graph,!(!this.brush&&!this.dragging)&&(this.trigger!=="drag"&&!this.keydown||(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(e),this.dragging=!1))},clearStates:function(){var e=this,r=e.graph,n=e.selectedState,a=r.findAllByState("node",n),i=r.findAllByState("edge",n),o=r.findAllByState("combo",n);a.forEach(function(s){return r.setItemState(s,n,!1)}),i.forEach(function(s){return r.setItemState(s,n,!1)}),o.forEach(function(s){return r.setItemState(s,n,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.selectedCombos=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges,this.selectedCombos),r.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},isBBoxCenterInRect:function(e,r,n,a,i){var o=e.getBBox();return o.centerX>=r&&o.centerX<=n&&o.centerY>=a&&o.centerY<=i},getSelectedNodes:function(e){var r=this,n=this,a=n.graph,i=n.originPoint,o=n.shouldUpdate,s=n.isBBoxCenterInRect,u=this.selectedState,f={x:e.x,y:e.y},l=a.getPointByCanvas(i.x,i.y),c=Qc(f.x,l.x),h=nS(f.x,l.x),d=Qc(f.y,l.y),v=nS(f.y,l.y),p=[],g=[];a.getNodes().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",r)){p.push(b);var w=b.getModel();g.push(w.id),a.setItemState(b,u,!0)}});var y=[];this.includeEdges&&p.forEach(function(b){var w=b.getOutEdges();w.forEach(function(x){if(x.isVisible()){var E=x.getModel(),_=E.source,S=E.target;g.includes(_)&&g.includes(S)&&o(x,"select",r)&&(y.push(x),a.setItemState(x,r.selectedState,!0))}})});var m=[];this.includeCombos&&a.getCombos().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",r)){m.push(b);var w=b.getModel();g.push(w.id),a.setItemState(b,u,!0)}}),this.selectedEdges=y,this.selectedNodes=p,this.selectedCombos=m,this.onSelect&&this.onSelect(p,y,m),a.emit("nodeselectchange",{selectedItems:{nodes:p,edges:y,combos:m},select:!0})},createBrush:function(){var e=this,r=e.graph.get("canvas").addShape("rect",{attrs:e.brushStyle,capture:!1,name:"brush-shape"});return this.brush=r,this.delegate=r,r},updateBrush:function(e){var r=this.originPoint;this.brush.attr({width:aS(e.canvasX-r.x),height:aS(e.canvasY-r.y),x:Qc(e.canvasX,r.x),y:Qc(e.canvasY,r.y)})},onKeyDown:function(e){var r=e.key;if(r){var n=this.trigger.toLowerCase(),a=r.toLowerCase();a===n||a==="control"&&n==="ctrl"||a==="ctrl"&&n==="control"?this.keydown=!0:this.keydown=!1}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}};var oS="shift",Nfe=["shift","ctrl","alt","control"];const Ofe={getDefaultCfg:function(){return{multiple:!0,trigger:oS,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var e=this;return Nfe.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=oS,console.warn("Behavior click-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'")),e.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(e){var r=this,n=e.item;if(!(!n||n.destroyed)){var a=n.getType(),i=r.graph,o=r.keydown,s=r.multiple,u=r.shouldUpdate,f=r.shouldBegin;if(f(e,r)){if(!o||!s){var l=i.findAllByState("node",r.selectedState).concat(i.findAllByState("edge",r.selectedState)).concat(i.findAllByState("combo",r.selectedState));_e(l,function(p){p!==n&&i.setItemState(p,r.selectedState,!1)})}var c=function(){switch(a){case"node":return r.selectNode;case"edge":return r.selectEdge;case"combo":return r.selectCombo;default:return!1}}();if(!c){var h=i.findAllByState("node",r.selectedState),d=i.findAllByState("edge",r.selectedState),v=i.findAllByState("combo",r.selectedState);i.emit("nodeselectchange",{selectedItems:{nodes:h,edges:d,combos:v},select:!1});return}if(n.hasState(r.selectedState)){u(e,r)&&i.setItemState(n,r.selectedState,!1);var h=i.findAllByState("node",r.selectedState),d=i.findAllByState("edge",r.selectedState),v=i.findAllByState("combo",r.selectedState);i.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!1})}else{u(e,r)&&i.setItemState(n,r.selectedState,!0);var h=i.findAllByState("node",r.selectedState),d=i.findAllByState("edge",r.selectedState),v=i.findAllByState("combo",r.selectedState);i.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!0})}}}},onCanvasClick:function(e){var r=this,n=this,a=n.graph,i=n.shouldBegin;if(i(e,this)){var o=a.findAllByState("node",this.selectedState);_e(o,function(f){a.setItemState(f,r.selectedState,!1)});var s=a.findAllByState("edge",this.selectedState);_e(s,function(f){a.setItemState(f,r.selectedState,!1)});var u=a.findAllByState("combo",this.selectedState);_e(u,function(f){a.setItemState(f,r.selectedState,!1)}),a.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(e){var r=this,n=e.key;n&&(n.toLowerCase()===this.trigger.toLowerCase()||n.toLowerCase()==="control"?r.keydown=!0:r.keydown=!1)},onKeyUp:function(){var e=this;e.keydown=!1}};var Lfe=eo,Jc=.05;const Dfe={getDefaultCfg:function(){return this.isFireFox=SO()==="firefox",{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 e=this.fixSelectedItems;return e.fixState||(e.fixState="selected"),e.fixAll&&(e.fixLineWidth=!0,e.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(e){var r=e.originalEvent.touches,n=r[0],a=r[1];e.preventDefault(),a&&(this.shouldBegin&&!this.shouldBegin(e,this)||(this.startPoint={pageX:n.pageX,pageY:n.pageY},this.moveable=!0,a&&(this.endPoint={pageX:a.pageX,pageY:a.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(e){if(this.moveable){e.preventDefault();var r=e.originalEvent.touches,n=r[0],a=r[1];if(a){this.endPoint||(this.endPoint={pageX:a.pageX,pageY:a.pageY});var i=function(p,g){return Math.hypot(g.x-p.x,g.y-p.y)},o=i({x:n.pageX,y:n.pageY},{x:a.pageX,y:a.pageY})/i({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),s=this.originScale*o;this.currentScale=s;var u=this.get("minZoom")||this.graph.get("minZoom"),f=this.get("maxZoom")||this.graph.get("maxZoom");if(!(s>f||s0||e.wheelDelta<0?l=1-Jc*u:l=1/(1-Jc*u):e.wheelDelta<0?l=1-Jc*u:l=1/(1-Jc*u),c=f*l;var h=this.get("minZoom")||a.get("minZoom"),d=this.get("maxZoom")||a.get("maxZoom");c>d?c=d:ca/2?l-=h.width:l+=this.offset,c>i/2?c-=h.height:c+=this.offset;var d="".concat(l,"px"),v="".concat(c,"px");Hu(this.container,{left:d,top:v,visibility:"visible"})},createTooltip:function(e){var r=e.get("el");r.style.position="relative";var n=cg('
'));return r.parentNode.appendChild(n),Hu(n,{position:"absolute",visibility:"visible"}),this.width=e.get("width"),this.height=e.get("height"),this.container=n,this.graph.get("tooltips").push(n),n}},Pfe=P({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(r){return r.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},DO),Rfe=P({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(r){return"source: ".concat(r.source," target: ").concat(r.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},DO);var sS="click",Ffe=["click","dblclick"];const Bfe={getDefaultCfg:function(){return{trigger:sS,onChange:function(){}}},getEvents:function(){var e,r;return Ffe.includes(this.trigger)?r=this.trigger:(r=sS,console.warn("Behavior collapse-expand 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),e={},e["node:".concat(r)]="onNodeClick",e.touchstart="onNodeClick",e},onNodeClick:function(e){var r=this;if(this.trigger==="click"){if(this.timer){clearTimeout(this.timer),this.timer=0;return}this.timer=setTimeout(function(){r.toggle(e),clearTimeout(r.timer),r.timer=0},200)}else this.toggle(e)},toggle:function(e){var r=e.item;if(r){var n=this.graph.findDataById(r.get("id"));if(n){var a=n.children;if(!(!a||a.length===0)){var i=!n.collapsed;this.shouldBegin(e,i,this)&&(n.collapsed=i,r.getModel().collapsed=i,this.graph.emit("itemcollapsed",{item:e.item,collapsed:i}),this.shouldUpdate(e,i,this)&&(this.onChange(r,i,this),this.graph.layout()))}}}}};var Gfe=so.calculationItemsBBox,PO=function(e,r){if(r(e)!==!1&&e){var n=e.get("combos");if(n.length===0)return!1;_e(n,function(a){PO(a,r)})}};const zfe={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected",enableStack:!0}},getEvents:function(){return{"combo:mousedown":"onMouseDown","combo:dragstart":"onDragStart","combo:drag":"onDrag","combo:dragend":"onDragEnd","combo:drop":"onDrop","node:drop":"onNodeDrop","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave"}},validationCombo:function(e){var r=e.item;if(!r||r.destroyed||!this.shouldUpdate(e,this))return!1;var n=r.getType();return n==="combo"},onMouseDown:function(e){this.origin={x:e.x,y:e.y}},onDragStart:function(e){var r=this,n=this.graph,a=e.item;if(this.currentShouldEnd=!0,!!this.validationCombo(e)&&!a.hasLocked()){this.targets=[];var i=n.findAllByState("combo",this.selectedState),o=a.get("id"),s=i.filter(function(f){var l=f.get("id");return o===l});s.length===0?this.targets.push(a):this.targets=i.filter(function(f){return!f.hasLocked()});var u=[];this.targets.forEach(function(f){var l=f.getModel(),c=l.x,h=l.y,d=l.id;u.push({x:c,y:h,id:d})}),this.set("beforeDragItems",u),this.activeState&&this.targets.map(function(f){var l=f.getModel();if(l.parentId){var c=n.findById(l.parentId);c&&n.setItemState(c,r.activeState,!0)}}),this.point={},this.originPoint={},this.currentItemChildCombos=[],PO(a,function(f){if(f.destroyed)return!1;var l=f.getModel();return r.currentItemChildCombos.push(l.id),!0})}},onDrag:function(e){var r=this;if(this.origin&&this.validationCombo(e))if(this.enableDelegate)this.updateDelegate(e);else{if(this.activeState){var n=this.graph,a=e.item,i=a.getModel(),o=n.getCombos(),s=a.getBBox(),u=s.centerX,f=s.centerY,l=s.width,c=o.filter(function(h){var d=h.getModel();return i.parentId,d.id!==i.id&&!r.currentItemChildCombos.includes(d.id)});c.map(function(h){var d=h.getBBox(),v=d.centerX,p=d.centerY,g=d.width,y=u-v,m=f-p,b=2*Math.sqrt(y*y+m*m);l+g-b>.8*l?n.setItemState(h,r.activeState,!0):n.setItemState(h,r.activeState,!1)})}_e(this.targets,function(h){r.updateCombo(h,e)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(e,r){var n=this;(this.enableDelegate||r)&&_e(this.targets,function(a){n.updateCombo(a,e,r)})},onDrop:function(e){var r=this,n=e.item;if(this.currentShouldEnd=this.shouldEnd(e,n,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!n||!this.targets||n.destroyed)){var a=this.graph,i=n.getModel();this.targets.map(function(o){var s=o.getModel();s.parentId!==i.id?(r.activeState&&a.setItemState(n,r.activeState,!1),r.onlyChangeComboSize?a.updateCombo(o):a.updateComboTree(o,i.id,!1)):a.updateCombo(n)}),this.end(n,e),this.endComparison=!0}},onNodeDrop:function(e){var r=this;if(!(!this.targets||this.targets.length===0)){var n=this.graph,a=e.item,i=a.getModel().comboId,o=i?n.findById(i):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){var s;if(i){if(this.activeState){var u=n.findById(i);n.setItemState(u,this.activeState,!1)}this.targets.map(function(f){r.onlyChangeComboSize?n.updateCombo(f):i!==f.getID()&&(s=n.findById(i),i!==f.getModel().parentId&&n.updateComboTree(f,i,!1))})}else this.targets.map(function(f){if(r.onlyChangeComboSize)n.updateCombo(f);else{var l=f.getModel();l.comboId&&n.updateComboTree(f,void 0,!1)}});this.endComparison=!0,this.end(s,e)}}},onDragEnter:function(e){if(this.origin&&this.validationCombo(e)){var r=e.item,n=this.graph;this.activeState&&n.setItemState(r,this.activeState,!0)}},onDragLeave:function(e){if(this.origin&&this.validationCombo(e)){var r=e.item,n=this.graph;this.activeState&&n.setItemState(r,this.activeState,!1)}},onDragEnd:function(e){if(!(!this.targets||this.targets.length===0)){var r=e.item;this.currentShouldEnd&&this.updatePositions(e);var n=this.getParentCombo(r.getModel().parentId),a=this.graph;n&&this.activeState&&a.setItemState(n,this.activeState,!1),this.end(void 0,e)}},end:function(e,r){var n=this;if(this.origin){var a=this.graph;if(this.delegateShape){var i=a.get("delegateGroup");i.clear(),this.delegateShape=null}if(e&&this.activeState&&a.setItemState(e,this.activeState,!1),!e){var o=a.get("enabledStack")&&this.enableStack,s={before:{nodes:[],edges:[],combos:[].concat(this.get("beforeDragItems"))},after:{nodes:[],edges:[],combos:[]}};this.targets.map(function(u){if(!n.onlyChangeComboSize)a.updateComboTree(u,void 0,o);else{a.updateCombo(u);var f=u.getModel(),l=f.x,c=f.y,h=f.id;s.after.combos.push({x:l,y:c,id:h}),a.pushStack("update",s)}})}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(e,r,n){var a=this;if(n===void 0&&(n={}),r(e,n)!==!1&&e){var i=e.get("combos");_e(i,function(s){a.traverse(s,r,n)});var o=e.get("nodes");_e(o,function(s){a.traverse(s,r,n)})}},updateCombo:function(e,r,n){this.updateSingleItem(e,r,n);var a={};this.traverse(e,function(i,o){return i.destroyed?!1:(i.getEdges().forEach(function(s){return o[s.getID()]=s}),!0)},a),Object.values(a).forEach(function(i){return i.refresh()})},updateSingleItem:function(e,r,n){var a=this.origin,i=this.graph,o=e.getModel(),s=e.get("id");this.point[s]||(this.point[s]={x:o.x,y:o.y});var u=r.x-a.x+this.point[s].x,f=r.y-a.y+this.point[s].y;n&&(u+=a.x-r.x,f+=a.y-r.y),i.updateItem(e,{x:u,y:f},!1)},getParentCombo:function(e){var r=this.graph;if(e){var n=r.findById(e);if(n)return n}},updateDelegate:function(e){var r=this.graph;if(this.delegateShape){var h=e.x-this.origin.x+this.originPoint.minX,d=e.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:h,y:d})}else{var n=r.get("delegateGroup"),a=null;this.targets.length>1?a=Gfe(this.targets):a=this.targets[0].getBBox();var i=a.x,o=a.y,s=a.width,u=a.height,f=a.minX,l=a.minY;this.originPoint={x:i,y:o,width:s,height:u,minX:f,minY:l};var c=P(P({},Mf.delegateStyle),this.delegateStyle);this.delegateShape=n.addShape("rect",{attrs:P({width:a.width,height:a.height,x:a.x,y:a.y},c),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var e=this,r=e.graph,n=e.targets,a={};n==null||n.forEach(function(i){var o=i.getModel().parentId;o&&(a[o]=r.findById(o))}),Object.values(a).forEach(function(i){i&&r.updateCombo(i)})}};var uS="dblclick",jfe=["click","dblclick"];const Ufe={getDefaultCfg:function(){return{trigger:uS,relayout:!0}},getEvents:function(){var e,r;return jfe.includes(this.trigger)?r=this.trigger:(r=uS,console.warn("Behavior collapse-expand-group 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),e={},e["combo:".concat(r)]="onComboClick",e},onComboClick:function(e){var r=e.item,n=this,a=n.graph,i=n.relayout;if(!(!r||r.destroyed||r.getType()!=="combo")){var o=r.getModel(),s=o.id;s&&(a.collapseExpandCombo(s),i&&a.get("layout")?a.layout():a.refreshPositions())}}};var $fe=so.isPolygonsIntersect,Xfe=so.pathToPoints,fS="shift",Wfe=["drag","shift","ctrl","alt","control"],Vfe=function(e,r){var n,a=e.getKeyShape();if(e.get("type")==="path")n=Xfe(a.attr("path"));else{var i=a.getCanvasBBox();n=[[i.minX,i.minY],[i.maxX,i.minY],[i.maxX,i.maxY],[i.minX,i.maxY]]}return $fe(r,n)};const Yfe={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:fS,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Wfe.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=fS,console.warn("Behavior lasso-select 的 trigger 参数不合法,请输入 'drag'、'shift'、'ctrl' 或 '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(e){var r=this.lasso,n=e.item;n||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates("dragstart"),r||(r=this.createLasso()),this.dragging=!0,this.originPoint={x:e.x,y:e.y},this.points.push(this.originPoint),r.show())},onDragMove:function(e){this.dragging&&(this.trigger!=="drag"&&!this.keydown||(this.points.push({x:e.x,y:e.y}),this.updateLasso(e)))},onDragEnd:function(e){!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 e=this.points,r=[];return e.length&&(e.forEach(function(n,a){a===0?r.push(["M",n.x,n.y]):r.push(["L",n.x,n.y])}),r.push(["L",e[0].x,e[0].y])),r},clearStates:function(e){e===void 0&&(e="canvas:click");var r=this,n=r.graph,a=r.selectedState,i=r.shouldDeselect,o=n.findAllByState("node",a),s=n.findAllByState("edge",a);(!i||i({action:e,nodes:o,edges:s}))&&(o.forEach(function(u){return n.setItemState(u,a,!1)}),s.forEach(function(u){return n.setItemState(u,a,!1)})),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],n.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var e=this,r=this,n=r.graph,a=r.shouldUpdate,i=this.points.map(function(l){return[n.getCanvasByPoint(l.x,l.y).x,n.getCanvasByPoint(l.x,l.y).y]}),o=this.selectedState,s=[],u=[];n.getNodes().forEach(function(l){if(l.isVisible()&&Vfe(l,i)&&a(l,"select",e)){s.push(l);var c=l.getModel();u.push(c.id),n.setItemState(l,o,!0)}});var f=[];this.includeEdges&&s.forEach(function(l){var c=l.getOutEdges();c.forEach(function(h){if(h.isVisible()){var d=h.getModel(),v=d.source,p=d.target;u.includes(v)&&u.includes(p)&&a(h,"select",e)&&(f.push(h),n.setItemState(h,e.selectedState,!0))}})}),this.selectedEdges=f,this.selectedNodes=s,this.onSelect&&this.onSelect(s,f),n.emit("nodeselectchange",{selectedItems:{nodes:s,edges:f},select:!0})},createLasso:function(){var e=this,r=e.graph.get("delegateGroup").addShape("path",{attrs:P({path:[]},e.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=r,this.delegate=r,this.points=[],r},updateLasso:function(e){var r=this;this.lasso.attr({path:r.getLassoPath()})},onKeyDown:function(e){var r=e.key;r&&(r.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}};var lS="click",qfe=["click","drag"],cS=void 0,Hfe=["shift","ctrl","control","alt","meta",void 0];const Zfe={getDefaultCfg:function(){return{trigger:lS,key:cS,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var e=this;qfe.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=lS,console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),e.key&&Hfe.indexOf(e.key.toLowerCase())===-1&&(e.trigger=cS,console.warn("Behavior create-edge 的 key 参数不合法,请输入 'shift','ctrl','alt','control',或 undefined"));var r;return e.trigger==="drag"?r={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:e.trigger==="click"&&(r={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),e.key&&(r.keydown="onKeyDown",r.keyup="onKeyUp"),r},onDragEnd:function(e){var r=this;if(!(r.key&&!r.keydown)){var n=e.item;(!n||n.getID()===r.source||n.getType()!=="node")&&r.cancelCreating({item:r.edge,x:e.x,y:e.y})}},onClick:function(e){var r=this;if(!(r.key&&!r.keydown)){var n=e.item,a=r.graph,i=n.getModel(),o=r.getEdgeConfig;if(r.addingEdge&&r.edge){if(!r.shouldEnd(e,r))return;var s=void 0;o&&Tr(o)?s=o({source:r.source,target:i.id},r):s=r.edgeConfig;var u=P({target:i.id},s);if(r.source===i.id&&(u.type="loop"),a.emit("beforecreateedge",{}),a.updateItem(r.edge,u,!1),a.get("enabledStack")){var f=P(P({},r.edge.getModel()),{itemType:"edge"}),l={};l.edges=[f],a.pushStack("add",{before:{},after:l})}a.emit("aftercreateedge",{edge:r.edge}),r.edge.getKeyShape().set("capture",!0),r.edge=null,r.addingEdge=!1}else{if(!r.shouldBegin(e,r))return;var s=void 0;o&&Tr(o)?s=o({source:i.id,target:i.id},r):s=r.edgeConfig,r.edge=a.addItem("edge",P({source:i.id,target:i.id},s),!1),r.source=i.id,r.addingEdge=!0,r.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(e){var r=this;if(!(r.key&&!r.keydown)){r.edge&&r.edge.destroyed&&r.cancelCreating({item:r.edge});var n={x:e.x,y:e.y};if(!r.graph.findById(r.source)){r.addingEdge=!1;return}r.addingEdge&&r.edge&&r.graph.updateItem(r.edge,{target:n},!1)}},cancelCreating:function(e){var r,n,a=this;if(!(a.key&&!a.keydown)){var i=a.graph,o=e.item;if(a.addingEdge&&(a.edge===o||!((n=(r=e.target)===null||r===void 0?void 0:r.isCanvas)===null||n===void 0)&&n.call(r))){a.edge&&!a.edge.destroyed&&i.removeItem(a.edge,!1),a.edge=null,a.addingEdge=!1;return}}},onKeyDown:function(e){var r=this,n=e.key;n&&(n.toLowerCase()===r.key.toLowerCase()?r.keydown=!0:r.keydown=!1)},onKeyUp:function(){var e=this;e.addingEdge&&e.edge&&(e.graph.removeItem(e.edge,!1),e.addingEdge=!1,e.edge=null),this.keydown=!1}};var hS="ctrl",Kfe=["shift","ctrl","alt","control"],Qfe="1";const Jfe={getDefaultCfg:function(){return{trigger:hS,combinedKey:Qfe,functionName:"fitView",functionParams:[]}},getEvents:function(){return Kfe.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=hS,console.warn("Behavior shortcuts-fit-view 的 trigger 参数 '".concat(this.trigger,"' 不合法,请输入 'drag'、'shift'、'ctrl' 或 'alt'"))),this.combinedKey===this.trigger&&(this.combinedKey=void 0),{keyup:"onKeyUp",keydown:"onKeyDown"}},onKeyDown:function(e){var r=e.key;if(r){var n=this.trigger.toLowerCase(),a=r.toLowerCase();this.triggerKeydown||(a===n||a==="control"&&n==="ctrl"||a==="ctrl"&&n==="control"?this.triggerKeydown=!0:this.triggerKeydown=!1);var i=this.graph;if(!i[this.functionName])return console.warn("Behavior shortcuts-fit-view 的 functionName 参数 '".concat(this.functionName,"' 不合法,它不是 Graph 的一个函数名")),{};if(this.triggerKeydown&&!this.combinedKey){this.functionParams&&this.functionParams.length?i[this.functionName].apply(i,this.functionParams):i[this.functionName]();return}var o=this.combinedKey.toLowerCase();this.triggerKeydown&&(a===o||a==="control"&&o==="ctrl"||a==="ctrl"&&o==="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}};var ele=["shift","ctrl","alt","control","meta"];const tle={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return(!this.zoomKey||ele.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(e){var r=this;if(this.allowDrag(e)){var n=this.graph,a=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];a.includes("control")&&a.push("ctrl");var i=a.some(function(V){return e["".concat(V,"Key")]});if(i){var o=n.get("canvas"),s=o.getPointByClient(e.clientX,e.clientY),u=n.getZoom();e.wheelDelta>0?u=u+u*.05:u=u-u*.05,n.zoomTo(u,{x:s.x,y:s.y})}else{var f=e.deltaX||e.movementX,l=e.deltaY||e.movementY;!l&&navigator.userAgent.indexOf("Firefox")>-1&&(l=-e.wheelDelta*125/3);var c=this.graph.get("width"),h=this.graph.get("height"),d=this.graph.get("canvas").getCanvasBBox(),v=this.scalableRange,p=this.scalableRange;v<1&&v>-1&&(v=c*v,p=h*p);var g=d.minX,y=d.maxX,m=d.minY,b=d.maxY;f>0?y<-v?f=0:y-f<-v&&(f=y+v):f<0&&(g>c+v?f=0:g-f>c+v&&(f=g-(c+v))),l>0?b<-p?l=0:b-l<-p&&(l=b+p):l<0&&(m>h+p?l=0:m-l>h+p&&(l=m-(h+p))),this.get("direction")==="x"?l=0:this.get("direction")==="y"&&(f=0),n.translate(-f,-l)}e.preventDefault();var w=this.get("enableOptimize");if(w){var x=this.get("optimizeZoom"),E=this.get("optimized"),_=n.getNodes(),S=n.getEdges(),A=_.length,M=S.length;if(!E){for(var C=0;C{const v=d.getModel();r.updateItem(d,{style:{fill:i(),stroke:l(v.os),lineWidth:2,radius:8,shadowColor:a()?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.06)",shadowBlur:8,shadowOffsetY:2},labelCfg:{style:{fill:o(),fontSize:13,fontWeight:600}},badgeCfg:{position:"topRight",style:{fill:v.online?"#22c55e":"#ef4444",stroke:i(),lineWidth:2}}})}),r.getEdges().forEach(d=>{const v=d.getModel(),g=String(v.id).startsWith("rel-")?"#f97316":"#3b82f6";r.updateItem(d,{labelCfg:{style:{fill:g,fontSize:11,fontWeight:500,background:{fill:i(),padding:[2,4],radius:4}}}})}),r.paint())}EP(async()=>{const[h,d,v]=await Promise.all([_P(),SP(),MP()]),p=h.data,g=d.data,y=v.data,m={};p.forEach(A=>m[A.id]=A);const b=a(),w=i(),x=o(),E=p.map(A=>({id:String(A.id),label:A.hostname,online:A.is_online,os:A.os_type,style:{fill:w,stroke:l(A.os_type),lineWidth:2,radius:8,shadowColor:b?"rgba(0,0,0,0.5)":"rgba(0,0,0,0.06)",shadowBlur:8,shadowOffsetY:2},labelCfg:{style:{fill:x,fontSize:13,fontWeight:600}},badgeCfg:{position:"topRight",style:{fill:A.is_online?"#22c55e":"#ef4444",stroke:w,lineWidth:2}}})),_=[];y.forEach(A=>{!m[A.source_machine_id]||!m[A.target_machine_id]||_.push({id:`rel-${A.id}`,source:String(A.source_machine_id),target:String(A.target_machine_id),label:c(A),style:{stroke:"#f97316",lineDash:[4,2],lineWidth:1.5,endArrow:{path:"M 0,0 L 8,4 L 8,-4 Z",fill:"#f97316"}},labelCfg:{style:{fill:"#f97316",fontSize:11,fontWeight:500,background:{fill:w,padding:[2,4],radius:4}}}})}),g.forEach(A=>{A.target_machine_id&&m[A.target_machine_id]&&_.push({id:`svc-${A.id}`,source:String(A.machine_id),target:String(A.target_machine_id),label:A.name,style:{stroke:"#3b82f6",lineWidth:2,endArrow:{path:"M 0,0 L 8,4 L 8,-4 Z",fill:"#3b82f6"}},labelCfg:{style:{fill:"#3b82f6",fontSize:11,fontWeight:500,background:{fill:w,padding:[2,4],radius:4}}}})});const S=document.getElementById("topo");S.style.background=s(),r=new AO({container:"topo",width:S.clientWidth,height:S.clientHeight,layout:{type:"force",preventOverlap:!0,linkDistance:140,nodeStrength:-80,edgeStrength:.2},defaultNode:{type:"rect",size:[110,40]},defaultEdge:{type:"line",style:{endArrow:!0}},modes:{default:["drag-node","drag-canvas","zoom-canvas"]},fitView:!0,fitViewPadding:20}),r.data({nodes:E,edges:_}),r.render(),r.on("node:click",A=>{const M=A.item.getModel().id;f(M)}),window.addEventListener("resize",()=>{const A=document.getElementById("topo");A&&r&&(r.changeSize(A.clientWidth,A.clientHeight),r.fitView())}),n=new MutationObserver(()=>{u()}),n.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]})}),AP(()=>{n&&n.disconnect(),r&&(r.destroy(),r=null)});function f(h){if(!r)return;const d=r.getEdges();d.forEach(v=>{const p=v.getModel();p.source===h||p.target===h?(r.setItemState(v,"active",!0),v.update({style:{opacity:1}})):(r.setItemState(v,"inactive",!0),v.update({style:{opacity:.15}}))}),setTimeout(()=>{d.forEach(v=>{r.clearItemStates(v),v.update({style:{opacity:1}})})},2e3)}function l(h){switch(h){case"Linux":return"#3b82f6";case"Windows":return"#06b6d4";case"macOS":return"#a855f7";default:return"#9ca3af"}}function c(h){const v={port_forward:"端口转发",dependency:"依赖",primary_secondary:"主从",custom:"自定义"}[h.relation_type]||h.relation_type;return h.source_port?`${v} (${h.source_port})`:v}return(h,d)=>{const v=DP("el-button");return iw(),CP("div",nle,[rc("div",ale,[d[2]||(d[2]=rc("div",null,[rc("div",{class:"page-title"},"拓扑图"),rc("div",{class:"page-subtitle"},"展示机器之间的服务指向和关联关系")],-1)),ow(e)?(iw(),TP(v,{key:0,type:"primary",icon:ow(kP),onClick:d[0]||(d[0]=p=>h.$router.push("/machines"))},{default:IP(()=>[...d[1]||(d[1]=[PP("添加机器",-1)])]),_:1},8,["icon"])):NP("",!0)]),d[3]||(d[3]=OP('
在线
离线
服务指向
关联关系
',1))])}}},ule=RP(ile,[["__scopeId","data-v-1d46321d"]]);export{ule as default};