(function(bi,Ka){typeof exports=="object"&&typeof module<"u"?Ka(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ka):(bi=typeof globalThis<"u"?globalThis:bi||self,Ka(bi.CwlComponentTest={},bi.Vue))})(this,function(bi,Ka){"use strict";function zD(r,e){for(var t=0;tn[i]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}const gp=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return Si},get Circle(){return Hj},get Ellipse(){return qj},get Image(){return Zj},get Line(){return Kj},get Marker(){return Jj},get Path(){return _0},get Polygon(){return oU},get Polyline(){return sU},get Rect(){return lU},get Text(){return cU}},Symbol.toStringTag,{value:"Module"})),yp=Object.freeze(Object.defineProperty({__proto__:null,get Base(){return oi},get Circle(){return pU},get Dom(){return gU},get Ellipse(){return yU},get Image(){return mU},get Line(){return bU},get Marker(){return xU},get Path(){return wU},get Polygon(){return EU},get Polyline(){return _U},get Rect(){return MU},get Text(){return IU}},Symbol.toStringTag,{value:"Module"}));var mp=function(r,e){return mp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},mp(r,e)};function It(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");mp(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var B=function(){return B=Object.assign||function(e){for(var t,n=1,i=arguments.length;n=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a}function kb(r,e){return function(t,n){e(t,n,r)}}function Lb(r,e,t,n,i,a){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&&r?n.static?r:r.prototype:null,l=e||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),c,h=!1,d=t.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");a.push(o(y||null))};var g=(0,t[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))&&i.unshift(c)}else(c=o(g))&&(s==="field"?i.unshift(c):l[u]=c)}f&&Object.defineProperty(f,n.name,l),h=!0}function Nb(r,e,t){for(var n=arguments.length>2,i=0;i0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function bp(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,a=[],o;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(s){o={error:s}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a}function Bb(){for(var r=[],e=0;e1||u(d,p)})},v&&(i[d]=v(i[d])))}function u(d,v){try{f(n[d](v))}catch(p){h(a[0][3],p)}}function f(d){d.value instanceof zs?Promise.resolve(d.value.v).then(l,c):h(a[0][2],d)}function l(d){u("next",d)}function c(d){u("throw",d)}function h(d,v){d(v),a.shift(),a.length&&u(a[0][0],a[0][1])}}function Gb(r){var e,t;return e={},n("next"),n("throw",function(i){throw i}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(i,a){e[i]=r[i]?function(o){return(t=!t)?{value:zs(r[i](o)),done:!1}:a?a(o):o}:a}}function zb(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof Ec=="function"?Ec(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(a){t[a]=r[a]&&function(o){return new Promise(function(s,u){o=r[a](o),i(s,u,o.done,o.value)})}}function i(a,o,s,u){Promise.resolve(u).then(function(f){a({value:f,done:s})},o)}}function $b(r,e){return Object.defineProperty?Object.defineProperty(r,"raw",{value:e}):r.raw=e,r}var $D=Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e};function jb(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wc(e,r,t);return $D(e,r),e}function Ub(r){return r&&r.__esModule?r:{default:r}}function Xb(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}function Yb(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t}function Wb(r,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?e===r:r.has(e)}function Vb(r,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n,i;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose],t&&(i=n)}if(typeof n!="function")throw new TypeError("Object not disposable.");i&&(n=function(){try{i.call(this)}catch(a){return Promise.reject(a)}}),r.stack.push({value:e,dispose:n,async:t})}else t&&r.stack.push({async:!0});return e}var jD=typeof SuppressedError=="function"?SuppressedError:function(r,e,t){var n=new Error(t);return n.name="SuppressedError",n.error=r,n.suppressed=e,n};function Hb(r){function e(a){r.error=r.hasError?new jD(a,r.error,"An error was suppressed during disposal."):a,r.hasError=!0}var t,n=0;function i(){for(;t=r.stack.pop();)try{if(!t.async&&n===1)return n=0,r.stack.push(t),Promise.resolve().then(i);if(t.dispose){var a=t.dispose.call(t.value);if(t.async)return n|=2,Promise.resolve(a).then(i,function(o){return e(o),i()})}else n|=1}catch(o){e(o)}if(n===1)return r.hasError?Promise.reject(r.error):Promise.resolve();if(r.hasError)throw r.error}return i()}function qb(r,e){return typeof r=="string"&&/^\.\.?\//.test(r)?r.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,n,i,a,o){return n?e?".jsx":".js":i&&(!a||!o)?t:i+a+"."+o.toLowerCase()+"js"}):r}const UD=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:Vb,get __assign(){return B},__asyncDelegator:Gb,__asyncGenerator:Fb,__asyncValues:zb,__await:zs,__awaiter:Un,__classPrivateFieldGet:Xb,__classPrivateFieldIn:Wb,__classPrivateFieldSet:Yb,__createBinding:wc,__decorate:Ib,__disposeResources:Hb,__esDecorate:Lb,__exportStar:Rb,__extends:It,__generator:Xn,__importDefault:Ub,__importStar:jb,__makeTemplateObject:$b,__metadata:Pb,__param:kb,__propKey:Ob,__read:bp,__rest:Jr,__rewriteRelativeImportExtension:qb,__runInitializers:Nb,__setFunctionName:Db,__spread:Bb,__spreadArray:Yn,__spreadArrays:_c,__values:Ec,default:{__extends:It,__assign:B,__rest:Jr,__decorate:Ib,__param:kb,__esDecorate:Lb,__runInitializers:Nb,__propKey:Ob,__setFunctionName:Db,__metadata:Pb,__awaiter:Un,__generator:Xn,__createBinding:wc,__exportStar:Rb,__values:Ec,__read:bp,__spread:Bb,__spreadArrays:_c,__spreadArray:Yn,__await:zs,__asyncGenerator:Fb,__asyncDelegator:Gb,__asyncValues:zb,__makeTemplateObject:$b,__importStar:jb,__importDefault:Ub,__classPrivateFieldGet:Xb,__classPrivateFieldSet:Yb,__classPrivateFieldIn:Wb,__addDisposableResource:Vb,__disposeResources:Hb,__rewriteRelativeImportExtension:qb}},Symbol.toStringTag,{value:"Module"}));var On=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},Sc=function(r,e){return On(r)?r.indexOf(e)>-1:!1},Mc=function(r,e){if(!On(r))return r;for(var t=[],n=0;n-1;)ZD.call(r,a,1);return r},JD=Array.prototype.splice,tx=function(e,t){if(!On(e))return[];for(var n=e?t.length:0,i=n-1;n--;){var a=void 0,o=t[n];(n===i||o!==a)&&(a=o,JD.call(e,o,1))}return e},rx=function(r,e,t){if(!vt(r)&&!fn(r))return r;var n=t;return ye(r,function(i,a){n=e(n,i,a)}),n},eP=function(r,e){var t=[];if(!On(r))return t;for(var n=-1,i=[],a=r.length;++na[s])return 1;if(i[s]t?t:r},Tc=function(r,e){var t=e.toString(),n=t.indexOf(".");if(n===-1)return Math.round(r);var i=t.substr(n+1).length;return i>20&&(i=20),parseFloat(r.toFixed(i))},ht=function(r){return xi(r,"Number")},vP=function(r){return ht(r)&&r%1!==0},pP=function(r){return ht(r)&&r%2===0},gP=Number.isInteger?Number.isInteger:function(r){return ht(r)&&r%1===0},yP=function(r){return ht(r)&&r<0},mP=1e-5;function ax(r,e,t){return t===void 0&&(t=mP),Math.abs(r-e)0};const wP=function(r,e){if(vt(r)){for(var t,n=-1/0,i=0;in&&(t=a,n=o)}return t}},EP=function(r,e){if(vt(r)){for(var t,n=1/0,i=0;ie?(n&&(clearTimeout(n),n=null),s=l,o=r.apply(i,a),n||(i=a=null)):!n&&t.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=i=a=null},f},vx=function(r){return On(r)?Array.prototype.slice.call(r):[]};var Lc={};const Yi=function(r){return r=r||"g",Lc[r]?Lc[r]+=1:Lc[r]=1,r+Lc[r]},ff=function(){},QP=function(r){return r};function Nc(r){return ct(r)?0:On(r)?r.length:Object.keys(r).length}var Oc;const lf=cx(function(r,e){e===void 0&&(e={});var t=e.fontSize,n=e.fontFamily,i=e.fontWeight,a=e.fontStyle,o=e.fontVariant;return Oc||(Oc=document.createElement("canvas").getContext("2d")),Oc.font=[a,o,i,t+"px",n].join(" "),Oc.measureText(Pe(r)?r:"").width},function(r,e){return e===void 0&&(e={}),_c([r],xp(e)).join("")}),JP=function(r,e,t,n){n===void 0&&(n="...");var i=16,a=lf(n,t),o=Pe(r)?r:$s(r),s=e,u=[],f,l;if(lf(r,t)<=e)return r;for(;f=o.substr(0,i),l=lf(f,t),!(l+a>s&&l>s);)if(u.push(f),s-=l,o=o.substr(i),!o)return u.join("");for(;f=o.substr(0,1),l=lf(f,t),!(l+a>s);)if(u.push(f),s-=l,o=o.substr(1),!o)return u.join("");return""+u.join("")+n};var e3=function(){function r(){this.map={}}return r.prototype.has=function(e){return this.map[e]!==void 0},r.prototype.get=function(e,t){var n=this.map[e];return n===void 0?t:n},r.prototype.set=function(e,t){this.map[e]=t},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(e){delete this.map[e]},r.prototype.size=function(){return Object.keys(this.map).length},r}();const t3=Object.freeze(Object.defineProperty({__proto__:null,Cache:e3,assign:gt,augment:$P,clamp:dP,clearAnimationFrame:lx,clone:Vt,contains:Sc,debounce:sf,deepMix:gr,difference:XD,each:ye,endsWith:aP,every:oP,extend:UP,filter:Mc,find:WD,findIndex:VD,firstValue:HD,fixedBase:Tc,flatten:qD,flattenDeep:Qb,forIn:ye,get:Ea,getEllipsisText:JP,getRange:Jb,getType:sx,getWrapBehavior:lP,group:fP,groupBy:Ac,groupToMap:nx,has:ox,hasKey:ox,hasValue:AP,head:Xi,identity:QP,includes:Sc,indexOf:_p,isArguments:OP,isArray:vt,isArrayLike:On,isBoolean:of,isDate:wp,isDecimal:vP,isElement:zP,isEmpty:dx,isEqual:Qa,isEqualWith:YP,isError:DP,isEven:pP,isFinite:PP,isFunction:_r,isInteger:gP,isMatch:Kb,isNegative:yP,isNil:ct,isNull:RP,isNumber:ht,isNumberEqual:ax,isObject:un,isObjectLike:Cc,isOdd:bP,isPlainObject:fn,isPositive:xP,isPrototype:ux,isRegExp:FP,isString:Pe,isType:xi,isUndefined:GP,keys:Zb,last:ri,lowerCase:TP,lowerFirst:IP,map:zo,mapValues:VP,max:ji,maxBy:wP,measureTextWidth:lf,memoize:cx,min:Ui,minBy:EP,mix:gt,mod:Ic,noop:ff,number2color:cP,omit:KP,parseRadius:hP,pick:ZP,pull:QD,pullAt:tx,reduce:rx,remove:eP,requestAnimationFrame:fx,set:HP,size:Nc,some:sP,sortBy:tP,startsWith:iP,substitute:kP,throttle:uf,toArray:vx,toDegree:SP,toInteger:MP,toRadian:kc,toString:$s,union:rP,uniq:af,uniqueId:Yi,upperCase:LP,upperFirst:js,values:xp,valuesOfKey:nP,wrapBehavior:Go},Symbol.toStringTag,{value:"Module"})),r3={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 t=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),ye(n,function(i,a){e.on(a,i)}),document.addEventListener("visibilitychange",function(){t.keydown=!1})},unbind:function(e){var t=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),ye(t,function(i,a){e.off(a,i)}),e.get("canvas").set("draggable",n)},get:function(e){return this[e]},set:function(e,t){return this[e]=t,this}};var Sp=function(){function r(){}return r.registerBehavior=function(e,t){if(!t)throw new Error("please specify handler for this behavior: ".concat(e));var n=Vt(r3);Object.assign(n,t);var i=function(o){var s=this;Object.assign(this,this.getDefaultCfg(),o);var u=this.getEvents();this.events=null;var f={};u&&(ye(u,function(l,c){f[c]=Go(s,l)}),this.events=f)};i.prototype=n,r.types[e]=i},r.hasBehavior=function(e){return!!r.types[e]},r.getBehavior=function(e){return r.types[e]},r.types={},r}(),n3="*",px=function(){function r(){this._events={}}return r.prototype.on=function(e,t,n){return this._events[e]||(this._events[e]=[]),this._events[e].push({callback:t,once:!!n}),this},r.prototype.once=function(e,t){return this.on(e,t,!0)},r.prototype.emit=function(e){for(var t=this,n=[],i=1;i0?(t[0]=(s*o+l*n+u*a-f*i)*2/c,t[1]=(u*o+l*i+f*n-s*a)*2/c,t[2]=(f*o+l*a+s*i-u*n)*2/c):(t[0]=(s*o+l*n+u*a-f*i)*2,t[1]=(u*o+l*i+f*n-s*a)*2,t[2]=(f*o+l*a+s*i-u*n)*2),Mx(r,e,t),r}function Cx(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}function Ax(r,e){var t=e[0],n=e[1],i=e[2],a=e[4],o=e[5],s=e[6],u=e[8],f=e[9],l=e[10];return r[0]=Math.hypot(t,n,i),r[1]=Math.hypot(a,o,s),r[2]=Math.hypot(u,f,l),r}function Tx(r,e){var t=new Zt(3);Ax(t,e);var n=1/t[0],i=1/t[1],a=1/t[2],o=e[0]*n,s=e[1]*i,u=e[2]*a,f=e[4]*n,l=e[5]*i,c=e[6]*a,h=e[8]*n,d=e[9]*i,v=e[10]*a,p=o+l+v,g=0;return p>0?(g=Math.sqrt(p+1)*2,r[3]=.25*g,r[0]=(c-d)/g,r[1]=(h-u)/g,r[2]=(s-f)/g):o>l&&o>v?(g=Math.sqrt(1+o-l-v)*2,r[3]=(c-d)/g,r[0]=.25*g,r[1]=(s+f)/g,r[2]=(h+u)/g):l>v?(g=Math.sqrt(1+l-o-v)*2,r[3]=(h-u)/g,r[0]=(s+f)/g,r[1]=.25*g,r[2]=(c+d)/g):(g=Math.sqrt(1+v-o-l)*2,r[3]=(s-f)/g,r[0]=(h+u)/g,r[1]=(c+d)/g,r[2]=.25*g),r}function K5(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3],u=i+i,f=a+a,l=o+o,c=i*u,h=i*f,d=i*l,v=a*f,p=a*l,g=o*l,y=s*u,m=s*f,b=s*l,x=n[0],w=n[1],E=n[2];return r[0]=(1-(v+g))*x,r[1]=(h+b)*x,r[2]=(d-m)*x,r[3]=0,r[4]=(h-b)*w,r[5]=(1-(c+g))*w,r[6]=(p+y)*w,r[7]=0,r[8]=(d+m)*E,r[9]=(p-y)*E,r[10]=(1-(c+v))*E,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function Q5(r,e,t,n,i){var a=e[0],o=e[1],s=e[2],u=e[3],f=a+a,l=o+o,c=s+s,h=a*f,d=a*l,v=a*c,p=o*l,g=o*c,y=s*c,m=u*f,b=u*l,x=u*c,w=n[0],E=n[1],_=n[2],M=i[0],C=i[1],S=i[2],A=(1-(p+y))*w,T=(d+x)*w,k=(v-b)*w,O=(d-x)*E,G=(1-(h+y))*E,D=(g+m)*E,$=(v+b)*_,Y=(g-m)*_,N=(1-(h+p))*_;return r[0]=A,r[1]=T,r[2]=k,r[3]=0,r[4]=O,r[5]=G,r[6]=D,r[7]=0,r[8]=$,r[9]=Y,r[10]=N,r[11]=0,r[12]=t[0]+M-(A*M+O*C+$*S),r[13]=t[1]+C-(T*M+G*C+Y*S),r[14]=t[2]+S-(k*M+D*C+N*S),r[15]=1,r}function J5(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t+t,s=n+n,u=i+i,f=t*o,l=n*o,c=n*s,h=i*o,d=i*s,v=i*u,p=a*o,g=a*s,y=a*u;return r[0]=1-c-v,r[1]=l+y,r[2]=h-g,r[3]=0,r[4]=l-y,r[5]=1-f-v,r[6]=d+p,r[7]=0,r[8]=h+g,r[9]=d-p,r[10]=1-f-c,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function eR(r,e,t,n,i,a,o){var s=1/(t-e),u=1/(i-n),f=1/(a-o);return r[0]=a*2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*u,r[6]=0,r[7]=0,r[8]=(t+e)*s,r[9]=(i+n)*u,r[10]=(o+a)*f,r[11]=-1,r[12]=0,r[13]=0,r[14]=o*a*2*f,r[15]=0,r}function Ix(r,e,t,n,i){var a=1/Math.tan(e/2),o;return r[0]=a/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(o=1/(n-i),r[10]=(i+n)*o,r[14]=2*i*n*o):(r[10]=-1,r[14]=-2*n),r}var tR=Ix;function rR(r,e,t,n,i){var a=1/Math.tan(e/2),o;return r[0]=a/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(o=1/(n-i),r[10]=i*o,r[14]=i*n*o):(r[10]=-1,r[14]=-n),r}function nR(r,e,t,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=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/(i+a);return r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=f,r[6]=0,r[7]=0,r[8]=-((o-s)*u*.5),r[9]=(i-a)*f*.5,r[10]=n/(t-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*t/(t-n),r[15]=0,r}function kx(r,e,t,n,i,a,o){var s=1/(e-t),u=1/(n-i),f=1/(a-o);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*f,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*u,r[14]=(o+a)*f,r[15]=1,r}var iR=kx;function aR(r,e,t,n,i,a,o){var s=1/(e-t),u=1/(n-i),f=1/(a-o);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=f,r[11]=0,r[12]=(e+t)*s,r[13]=(i+n)*u,r[14]=a*f,r[15]=1,r}function oR(r,e,t,n){var i,a,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],x=t[0],w=t[1],E=t[2];return Math.abs(v-x)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),r[0]=v,r[1]=p,r[2]=g,r[3]=0,r[4]=c*g-h*p,r[5]=h*v-l*g,r[6]=l*p-c*v,r[7]=0,r[8]=l,r[9]=c,r[10]=h,r[11]=0,r[12]=i,r[13]=a,r[14]=o,r[15]=1,r}function uR(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function fR(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function lR(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r}function Lx(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r}function cR(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r}function hR(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r[3]=e[3]+t[3]*n,r[4]=e[4]+t[4]*n,r[5]=e[5]+t[5]*n,r[6]=e[6]+t[6]*n,r[7]=e[7]+t[7]*n,r[8]=e[8]+t[8]*n,r[9]=e[9]+t[9]*n,r[10]=e[10]+t[10]*n,r[11]=e[11]+t[11]*n,r[12]=e[12]+t[12]*n,r[13]=e[13]+t[13]*n,r[14]=e[14]+t[14]*n,r[15]=e[15]+t[15]*n,r}function dR(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]}function vR(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[7],l=r[8],c=r[9],h=r[10],d=r[11],v=r[12],p=r[13],g=r[14],y=r[15],m=e[0],b=e[1],x=e[2],w=e[3],E=e[4],_=e[5],M=e[6],C=e[7],S=e[8],A=e[9],T=e[10],k=e[11],O=e[12],G=e[13],D=e[14],$=e[15];return Math.abs(t-m)<=bt*Math.max(1,Math.abs(t),Math.abs(m))&&Math.abs(n-b)<=bt*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-x)<=bt*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-w)<=bt*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(o-E)<=bt*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(s-_)<=bt*Math.max(1,Math.abs(s),Math.abs(_))&&Math.abs(u-M)<=bt*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(f-C)<=bt*Math.max(1,Math.abs(f),Math.abs(C))&&Math.abs(l-S)<=bt*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(c-A)<=bt*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(h-T)<=bt*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(d-k)<=bt*Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(v-O)<=bt*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(p-G)<=bt*Math.max(1,Math.abs(p),Math.abs(G))&&Math.abs(g-D)<=bt*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(y-$)<=bt*Math.max(1,Math.abs(y),Math.abs($))}var pR=Sx,gR=Lx;const yR=Object.freeze(Object.defineProperty({__proto__:null,add:lR,adjoint:R5,clone:k5,copy:L5,create:I5,determinant:B5,equals:vR,exactEquals:dR,frob:fR,fromQuat:J5,fromQuat2:Z5,fromRotation:W5,fromRotationTranslation:Mx,fromRotationTranslationScale:K5,fromRotationTranslationScaleOrigin:Q5,fromScaling:Y5,fromTranslation:X5,fromValues:N5,fromXRotation:V5,fromYRotation:H5,fromZRotation:q5,frustum:eR,getRotation:Tx,getScaling:Ax,getTranslation:Cx,identity:_x,invert:P5,lookAt:oR,mul:pR,multiply:Sx,multiplyScalar:cR,multiplyScalarAndAdd:hR,ortho:iR,orthoNO:kx,orthoZO:aR,perspective:tR,perspectiveFromFieldOfView:nR,perspectiveNO:Ix,perspectiveZO:rR,rotate:z5,rotateX:$5,rotateY:j5,rotateZ:U5,scale:G5,set:O5,str:uR,sub:gR,subtract:Lx,targetTo:sR,translate:F5,transpose:D5},Symbol.toStringTag,{value:"Module"}));function Ip(){var r=new Zt(3);return Zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function mR(r){var e=new Zt(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Nx(r){var e=r[0],t=r[1],n=r[2];return Math.hypot(e,t,n)}function kp(r,e,t){var n=new Zt(3);return n[0]=r,n[1]=e,n[2]=t,n}function bR(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function xR(r,e,t,n){return r[0]=e,r[1]=t,r[2]=n,r}function wR(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function Ox(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function Dx(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function Px(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function ER(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function _R(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function SR(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function MR(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function CR(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r}function AR(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function TR(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r}function Rx(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return Math.hypot(t,n,i)}function Bx(r,e){var t=e[0]-r[0],n=e[1]-r[1],i=e[2]-r[2];return t*t+n*n+i*i}function Fx(r){var e=r[0],t=r[1],n=r[2];return e*e+t*t+n*n}function IR(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function kR(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function Gx(r,e){var t=e[0],n=e[1],i=e[2],a=t*t+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r[2]=e[2]*a,r}function Lp(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function Dc(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[0],s=t[1],u=t[2];return r[0]=i*u-a*s,r[1]=a*o-n*u,r[2]=n*s-i*o,r}function LR(r,e,t,n){var i=e[0],a=e[1],o=e[2];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r[2]=o+n*(t[2]-o),r}function NR(r,e,t,n,i,a){var o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,f=o*(a-1),l=o*(3-2*a);return r[0]=e[0]*s+t[0]*u+n[0]*f+i[0]*l,r[1]=e[1]*s+t[1]*u+n[1]*f+i[1]*l,r[2]=e[2]*s+t[2]*u+n[2]*f+i[2]*l,r}function OR(r,e,t,n,i,a){var o=1-a,s=o*o,u=a*a,f=s*o,l=3*a*s,c=3*u*o,h=u*a;return r[0]=e[0]*f+t[0]*l+n[0]*c+i[0]*h,r[1]=e[1]*f+t[1]*l+n[1]*c+i[1]*h,r[2]=e[2]*f+t[2]*l+n[2]*c+i[2]*h,r}function DR(r,e){e=e||1;var t=wi()*2*Math.PI,n=wi()*2-1,i=Math.sqrt(1-n*n)*e;return r[0]=Math.cos(t)*i,r[1]=Math.sin(t)*i,r[2]=n*e,r}function PR(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[3]*n+t[7]*i+t[11]*a+t[15];return o=o||1,r[0]=(t[0]*n+t[4]*i+t[8]*a+t[12])/o,r[1]=(t[1]*n+t[5]*i+t[9]*a+t[13])/o,r[2]=(t[2]*n+t[6]*i+t[10]*a+t[14])/o,r}function Pc(r,e,t){var n=e[0],i=e[1],a=e[2];return r[0]=n*t[0]+i*t[3]+a*t[6],r[1]=n*t[1]+i*t[4]+a*t[7],r[2]=n*t[2]+i*t[5]+a*t[8],r}function RR(r,e,t){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0],u=e[1],f=e[2],l=i*f-a*u,c=a*s-n*f,h=n*u-i*s,d=i*h-a*c,v=a*l-n*h,p=n*c-i*l,g=o*2;return l*=g,c*=g,h*=g,d*=2,v*=2,p*=2,r[0]=s+l+d,r[1]=u+c+v,r[2]=f+h+p,r}function BR(r,e,t,n){var i=[],a=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),r[0]=a[0]+t[0],r[1]=a[1]+t[1],r[2]=a[2]+t[2],r}function FR(r,e,t,n){var i=[],a=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),r[0]=a[0]+t[0],r[1]=a[1]+t[1],r[2]=a[2]+t[2],r}function GR(r,e,t,n){var i=[],a=[];return i[0]=e[0]-t[0],i[1]=e[1]-t[1],i[2]=e[2]-t[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],r[0]=a[0]+t[0],r[1]=a[1]+t[1],r[2]=a[2]+t[2],r}function zR(r,e){var t=r[0],n=r[1],i=r[2],a=e[0],o=e[1],s=e[2],u=Math.sqrt(t*t+n*n+i*i),f=Math.sqrt(a*a+o*o+s*s),l=u*f,c=l&&Lp(r,e)/l;return Math.acos(Math.min(Math.max(c,-1),1))}function $R(r){return r[0]=0,r[1]=0,r[2]=0,r}function jR(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function UR(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function XR(r,e){var t=r[0],n=r[1],i=r[2],a=e[0],o=e[1],s=e[2];return Math.abs(t-a)<=bt*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(n-o)<=bt*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=bt*Math.max(1,Math.abs(i),Math.abs(s))}var YR=Ox,WR=Dx,VR=Px,HR=Rx,qR=Bx,zx=Nx,ZR=Fx,KR=function(){var r=Ip();return function(e,t,n,i,a,o){var s,u;for(t||(t=3),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s0&&(o=1/Math.sqrt(o)),r[0]=t*o,r[1]=n*o,r[2]=i*o,r[3]=a*o,r}function ew(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function sB(r,e,t,n){var i=t[0]*n[1]-t[1]*n[0],a=t[0]*n[2]-t[2]*n[0],o=t[0]*n[3]-t[3]*n[0],s=t[1]*n[2]-t[2]*n[1],u=t[1]*n[3]-t[3]*n[1],f=t[2]*n[3]-t[3]*n[2],l=e[0],c=e[1],h=e[2],d=e[3];return r[0]=c*f-h*u+d*s,r[1]=-(l*f)+h*o-d*a,r[2]=l*u-c*o+d*i,r[3]=-(l*s)+c*a-h*i,r}function tw(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r[2]=o+n*(t[2]-o),r[3]=s+n*(t[3]-s),r}function uB(r,e){e=e||1;var t,n,i,a,o,s;do t=wi()*2-1,n=wi()*2-1,o=t*t+n*n;while(o>=1);do i=wi()*2-1,a=wi()*2-1,s=i*i+a*a;while(s>=1);var u=Math.sqrt((1-o)/s);return r[0]=e*t,r[1]=e*n,r[2]=e*i*u,r[3]=e*a*u,r}function fB(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3];return r[0]=t[0]*n+t[4]*i+t[8]*a+t[12]*o,r[1]=t[1]*n+t[5]*i+t[9]*a+t[13]*o,r[2]=t[2]*n+t[6]*i+t[10]*a+t[14]*o,r[3]=t[3]*n+t[7]*i+t[11]*a+t[15]*o,r}function lB(r,e,t){var n=e[0],i=e[1],a=e[2],o=t[0],s=t[1],u=t[2],f=t[3],l=f*n+s*a-u*i,c=f*i+u*n-o*a,h=f*a+o*i-s*n,d=-o*n-s*i-u*a;return r[0]=l*f+d*-o+c*-u-h*-s,r[1]=c*f+d*-s+h*-o-l*-u,r[2]=h*f+d*-u+l*-s-c*-o,r[3]=e[3],r}function cB(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function hB(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function rw(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function nw(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=e[0],s=e[1],u=e[2],f=e[3];return Math.abs(t-o)<=bt*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(n-s)<=bt*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=bt*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-f)<=bt*Math.max(1,Math.abs(a),Math.abs(f))}var dB=Vx,vB=Hx,pB=qx,gB=Kx,yB=Qx,mB=Np,bB=Op,xB=function(){var r=$x();return function(e,t,n,i,a,o){var s,u;for(t||(t=4),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;sbt?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=1,r[1]=0,r[2]=0),t}function SB(r,e){var t=Pp(r,e);return Math.acos(2*t*t-1)}function aw(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],f=t[2],l=t[3];return r[0]=n*l+o*s+i*f-a*u,r[1]=i*l+o*u+a*s-n*f,r[2]=a*l+o*f+n*u-i*s,r[3]=o*l-n*s-i*u-a*f,r}function ow(r,e,t){t*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+o*s,r[1]=i*u+a*s,r[2]=a*u-i*s,r[3]=o*u-n*s,r}function sw(r,e,t){t*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u-a*s,r[1]=i*u+o*s,r[2]=a*u+n*s,r[3]=o*u-i*s,r}function uw(r,e,t){t*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(t),u=Math.cos(t);return r[0]=n*u+i*s,r[1]=i*u-n*s,r[2]=a*u+o*s,r[3]=o*u-a*s,r}function MB(r,e){var t=e[0],n=e[1],i=e[2];return r[0]=t,r[1]=n,r[2]=i,r[3]=Math.sqrt(Math.abs(1-t*t-n*n-i*i)),r}function fw(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=Math.sqrt(t*t+n*n+i*i),s=Math.exp(a),u=o>0?s*Math.sin(o)/o:0;return r[0]=t*u,r[1]=n*u,r[2]=i*u,r[3]=s*Math.cos(o),r}function lw(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=Math.sqrt(t*t+n*n+i*i),s=o>0?Math.atan2(o,a)/o:0;return r[0]=t*s,r[1]=n*s,r[2]=i*s,r[3]=.5*Math.log(t*t+n*n+i*i+a*a),r}function CB(r,e,t){return lw(r,e),hw(r,r,t),fw(r,r),r}function Bc(r,e,t,n){var i=e[0],a=e[1],o=e[2],s=e[3],u=t[0],f=t[1],l=t[2],c=t[3],h,d,v,p,g;return d=i*u+a*f+o*l+s*c,d<0&&(d=-d,u=-u,f=-f,l=-l,c=-c),1-d>bt?(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),r[0]=p*i+g*u,r[1]=p*a+g*f,r[2]=p*o+g*l,r[3]=p*s+g*c,r}function AB(r){var e=wi(),t=wi(),n=wi(),i=Math.sqrt(1-e),a=Math.sqrt(e);return r[0]=i*Math.sin(2*Math.PI*t),r[1]=i*Math.cos(2*Math.PI*t),r[2]=a*Math.sin(2*Math.PI*n),r[3]=a*Math.cos(2*Math.PI*n),r}function TB(r,e){var t=e[0],n=e[1],i=e[2],a=e[3],o=t*t+n*n+i*i+a*a,s=o?1/o:0;return r[0]=-t*s,r[1]=-n*s,r[2]=-i*s,r[3]=a*s,r}function IB(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r}function cw(r,e){var t=e[0]+e[4]+e[8],n;if(t>0)n=Math.sqrt(t+1),r[3]=.5*n,n=.5/n,r[0]=(e[5]-e[7])*n,r[1]=(e[6]-e[2])*n,r[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[i*3+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(e[i*3+i]-e[a*3+a]-e[o*3+o]+1),r[i]=.5*n,n=.5/n,r[3]=(e[a*3+o]-e[o*3+a])*n,r[a]=(e[a*3+i]+e[i*3+a])*n,r[o]=(e[o*3+i]+e[i*3+o])*n}return r}function kB(r,e,t,n){var i=.5*Math.PI/180;e*=i,t*=i,n*=i;var a=Math.sin(e),o=Math.cos(e),s=Math.sin(t),u=Math.cos(t),f=Math.sin(n),l=Math.cos(n);return r[0]=a*u*l-o*s*f,r[1]=o*s*l+a*u*f,r[2]=o*u*f-a*s*l,r[3]=o*u*l+a*s*f,r}function LB(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}var NB=jx,OB=Ux,Dp=Xx,DB=Yx,PB=Wx,RB=aw,hw=Zx,Pp=ew,BB=tw,Rp=Np,FB=Rp,Bp=Op,GB=Bp,Fp=Jx,zB=rw,$B=nw,jB=function(){var r=Ip(),e=kp(1,0,0),t=kp(0,1,0);return function(n,i,a){var o=Lp(i,a);return o<-.999999?(Dc(r,e,i),zx(r)<1e-6&&Dc(r,t,i),Gx(r,r),iw(n,r,Math.PI),n):o>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Dc(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+o,Fp(n,n))}}(),UB=function(){var r=Rc(),e=Rc();return function(t,n,i,a,o,s){return Bc(r,n,o,s),Bc(e,i,a,s),Bc(t,r,e,2*s*(1-s)),t}}(),XB=function(){var r=xx();return function(e,t,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-t[0],r[5]=-t[1],r[8]=-t[2],Fp(e,cw(e,r))}}();const YB=Object.freeze(Object.defineProperty({__proto__:null,add:PB,calculateW:MB,clone:NB,conjugate:IB,copy:Dp,create:Rc,dot:Pp,equals:$B,exactEquals:zB,exp:fw,fromEuler:kB,fromMat3:cw,fromValues:OB,getAngle:SB,getAxisAngle:_B,identity:EB,invert:TB,len:FB,length:Rp,lerp:BB,ln:lw,mul:RB,multiply:aw,normalize:Fp,pow:CB,random:AB,rotateX:ow,rotateY:sw,rotateZ:uw,rotationTo:jB,scale:hw,set:DB,setAxes:XB,setAxisAngle:iw,slerp:Bc,sqlerp:UB,sqrLen:GB,squaredLength:Bp,str:LB},Symbol.toStringTag,{value:"Module"}));function WB(){var r=new Zt(8);return Zt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[4]=0,r[5]=0,r[6]=0,r[7]=0),r[3]=1,r}function VB(r){var e=new Zt(8);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e}function HB(r,e,t,n,i,a,o,s){var u=new Zt(8);return u[0]=r,u[1]=e,u[2]=t,u[3]=n,u[4]=i,u[5]=a,u[6]=o,u[7]=s,u}function qB(r,e,t,n,i,a,o){var s=new Zt(8);s[0]=r,s[1]=e,s[2]=t,s[3]=n;var u=i*.5,f=a*.5,l=o*.5;return s[4]=u*n+f*t-l*e,s[5]=f*n+l*r-u*t,s[6]=l*n+u*e-f*r,s[7]=-u*r-f*e-l*t,s}function dw(r,e,t){var n=t[0]*.5,i=t[1]*.5,a=t[2]*.5,o=e[0],s=e[1],u=e[2],f=e[3];return r[0]=o,r[1]=s,r[2]=u,r[3]=f,r[4]=n*f+i*u-a*s,r[5]=i*f+a*o-n*u,r[6]=a*f+n*s-i*o,r[7]=-n*o-i*s-a*u,r}function ZB(r,e){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r[4]=e[0]*.5,r[5]=e[1]*.5,r[6]=e[2]*.5,r[7]=0,r}function KB(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=0,r[5]=0,r[6]=0,r[7]=0,r}function QB(r,e){var t=Rc();Tx(t,e);var n=new Zt(3);return Cx(n,e),dw(r,t,n),r}function vw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r}function JB(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r[4]=0,r[5]=0,r[6]=0,r[7]=0,r}function eF(r,e,t,n,i,a,o,s,u){return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r[4]=a,r[5]=o,r[6]=s,r[7]=u,r}var tF=Dp;function rF(r,e){return r[0]=e[4],r[1]=e[5],r[2]=e[6],r[3]=e[7],r}var nF=Dp;function iF(r,e){return r[4]=e[0],r[5]=e[1],r[6]=e[2],r[7]=e[3],r}function aF(r,e){var t=e[4],n=e[5],i=e[6],a=e[7],o=-e[0],s=-e[1],u=-e[2],f=e[3];return r[0]=(t*f+a*o+n*u-i*s)*2,r[1]=(n*f+a*s+i*o-t*u)*2,r[2]=(i*f+a*u+t*s-n*o)*2,r}function oF(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0]*.5,u=t[1]*.5,f=t[2]*.5,l=e[4],c=e[5],h=e[6],d=e[7];return r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=o*s+i*f-a*u+l,r[5]=o*u+a*s-n*f+c,r[6]=o*f+n*u-i*s+h,r[7]=-n*s-i*u-a*f+d,r}function sF(r,e,t){var n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*a-f*i,h=u*o+l*i+f*n-s*a,d=f*o+l*a+s*i-u*n,v=l*o-s*n-u*i-f*a;return ow(r,e,t),n=r[0],i=r[1],a=r[2],o=r[3],r[4]=c*o+v*n+h*a-d*i,r[5]=h*o+v*i+d*n-c*a,r[6]=d*o+v*a+c*i-h*n,r[7]=v*o-c*n-h*i-d*a,r}function uF(r,e,t){var n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*a-f*i,h=u*o+l*i+f*n-s*a,d=f*o+l*a+s*i-u*n,v=l*o-s*n-u*i-f*a;return sw(r,e,t),n=r[0],i=r[1],a=r[2],o=r[3],r[4]=c*o+v*n+h*a-d*i,r[5]=h*o+v*i+d*n-c*a,r[6]=d*o+v*a+c*i-h*n,r[7]=v*o-c*n-h*i-d*a,r}function fF(r,e,t){var n=-e[0],i=-e[1],a=-e[2],o=e[3],s=e[4],u=e[5],f=e[6],l=e[7],c=s*o+l*n+u*a-f*i,h=u*o+l*i+f*n-s*a,d=f*o+l*a+s*i-u*n,v=l*o-s*n-u*i-f*a;return uw(r,e,t),n=r[0],i=r[1],a=r[2],o=r[3],r[4]=c*o+v*n+h*a-d*i,r[5]=h*o+v*i+d*n-c*a,r[6]=d*o+v*a+c*i-h*n,r[7]=v*o-c*n-h*i-d*a,r}function lF(r,e,t){var n=t[0],i=t[1],a=t[2],o=t[3],s=e[0],u=e[1],f=e[2],l=e[3];return r[0]=s*o+l*n+u*a-f*i,r[1]=u*o+l*i+f*n-s*a,r[2]=f*o+l*a+s*i-u*n,r[3]=l*o-s*n-u*i-f*a,s=e[4],u=e[5],f=e[6],l=e[7],r[4]=s*o+l*n+u*a-f*i,r[5]=u*o+l*i+f*n-s*a,r[6]=f*o+l*a+s*i-u*n,r[7]=l*o-s*n-u*i-f*a,r}function cF(r,e,t){var n=e[0],i=e[1],a=e[2],o=e[3],s=t[0],u=t[1],f=t[2],l=t[3];return r[0]=n*l+o*s+i*f-a*u,r[1]=i*l+o*u+a*s-n*f,r[2]=a*l+o*f+n*u-i*s,r[3]=o*l-n*s-i*u-a*f,s=t[4],u=t[5],f=t[6],l=t[7],r[4]=n*l+o*s+i*f-a*u,r[5]=i*l+o*u+a*s-n*f,r[6]=a*l+o*f+n*u-i*s,r[7]=o*l-n*s-i*u-a*f,r}function hF(r,e,t,n){if(Math.abs(n)0){t=Math.sqrt(t);var n=e[0]/t,i=e[1]/t,a=e[2]/t,o=e[3]/t,s=e[4],u=e[5],f=e[6],l=e[7],c=n*s+i*u+a*f+o*l;r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=(s-n*c)/t,r[5]=(u-i*c)/t,r[6]=(f-a*c)/t,r[7]=(l-o*c)/t}return r}function EF(r){return"quat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+")"}function _F(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]}function SF(r,e){var t=r[0],n=r[1],i=r[2],a=r[3],o=r[4],s=r[5],u=r[6],f=r[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(t-l)<=bt*Math.max(1,Math.abs(t),Math.abs(l))&&Math.abs(n-c)<=bt*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(i-h)<=bt*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(a-d)<=bt*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(o-v)<=bt*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(s-p)<=bt*Math.max(1,Math.abs(s),Math.abs(p))&&Math.abs(u-g)<=bt*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(f-y)<=bt*Math.max(1,Math.abs(f),Math.abs(y))}const MF=Object.freeze(Object.defineProperty({__proto__:null,add:dF,clone:VB,conjugate:mF,copy:vw,create:WB,dot:gw,equals:SF,exactEquals:_F,fromMat4:QB,fromRotation:KB,fromRotationTranslation:dw,fromRotationTranslationValues:qB,fromTranslation:ZB,fromValues:HB,getDual:rF,getReal:tF,getTranslation:aF,identity:JB,invert:yF,len:bF,length:yw,lerp:gF,mul:vF,multiply:pw,normalize:wF,rotateAroundAxis:hF,rotateByQuatAppend:lF,rotateByQuatPrepend:cF,rotateX:sF,rotateY:uF,rotateZ:fF,scale:pF,set:eF,setDual:iF,setReal:nF,sqrLen:xF,squaredLength:Fc,str:EF,translate:oF},Symbol.toStringTag,{value:"Module"}));function mw(){var r=new Zt(2);return Zt!=Float32Array&&(r[0]=0,r[1]=0),r}function CF(r){var e=new Zt(2);return e[0]=r[0],e[1]=r[1],e}function AF(r,e){var t=new Zt(2);return t[0]=r,t[1]=e,t}function TF(r,e){return r[0]=e[0],r[1]=e[1],r}function IF(r,e,t){return r[0]=e,r[1]=t,r}function ln(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function bw(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function xw(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}function ww(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}function kF(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}function LF(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}function Ja(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function eo(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}function NF(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}function Sn(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function OF(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r}function Gc(r,e){var t=e[0]-r[0],n=e[1]-r[1];return Math.hypot(t,n)}function Ew(r,e){var t=e[0]-r[0],n=e[1]-r[1];return t*t+n*n}function _w(r){var e=r[0],t=r[1];return Math.hypot(e,t)}function Sw(r){var e=r[0],t=r[1];return e*e+t*t}function DF(r,e){return r[0]=-e[0],r[1]=-e[1],r}function PF(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}function to(r,e){var t=e[0],n=e[1],i=t*t+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=e[0]*i,r[1]=e[1]*i,r}function Gp(r,e){return r[0]*e[0]+r[1]*e[1]}function RF(r,e,t){var n=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=n,r}function BF(r,e,t,n){var i=e[0],a=e[1];return r[0]=i+n*(t[0]-i),r[1]=a+n*(t[1]-a),r}function FF(r,e){e=e||1;var t=wi()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}function GF(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i,r[1]=t[1]*n+t[3]*i,r}function zF(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[2]*i+t[4],r[1]=t[1]*n+t[3]*i+t[5],r}function $F(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[3]*i+t[6],r[1]=t[1]*n+t[4]*i+t[7],r}function jF(r,e,t){var n=e[0],i=e[1];return r[0]=t[0]*n+t[4]*i+t[12],r[1]=t[1]*n+t[5]*i+t[13],r}function UF(r,e,t,n){var i=e[0]-t[0],a=e[1]-t[1],o=Math.sin(n),s=Math.cos(n);return r[0]=i*s-a*o+t[0],r[1]=i*o+a*s+t[1],r}function Mw(r,e){var t=r[0],n=r[1],i=e[0],a=e[1],o=Math.sqrt(t*t+n*n)*Math.sqrt(i*i+a*a),s=o&&(t*i+n*a)/o;return Math.acos(Math.min(Math.max(s,-1),1))}function XF(r){return r[0]=0,r[1]=0,r}function YF(r){return"vec2("+r[0]+", "+r[1]+")"}function zp(r,e){return r[0]===e[0]&&r[1]===e[1]}function WF(r,e){var t=r[0],n=r[1],i=e[0],a=e[1];return Math.abs(t-i)<=bt*Math.max(1,Math.abs(t),Math.abs(i))&&Math.abs(n-a)<=bt*Math.max(1,Math.abs(n),Math.abs(a))}var VF=_w,zc=bw,HF=xw,qF=ww,ZF=Gc,KF=Ew,QF=Sw,JF=function(){var r=mw();return function(e,t,n,i,a,o){var s,u;for(t||(t=2),n||(n=0),i?u=Math.min(i*t+n,e.length):u=e.length,s=n;s0&&d(w[0])}},y=0;y0;)h.push(u.pop());o.push(h)}}return o},kw=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,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=Wn(y.id,a,"target").filter(function(_){return n.map(function(M){return M.id}).indexOf(_)>-1}),b=function(M){var C=m[M];if(!u[C]&&u[C]!==0){var S=n.filter(function(A){return A.id===C});S.length>0&&g(S[0]),f[y.id]=Math.min(f[y.id],f[C])}else s[C]&&(f[y.id]=Math.min(f[y.id],u[C]))},x=0;x0;){var E=o.pop();if(s[E.id]=!1,w.push(E),E===y)break}w.length>0&&l.push(w)}},d=0,v=n;d0;)for(var g=d.pop(),y=g.id,m=Wn(y,e.edges),b=function(E){var _,M=m[E],C=e.nodes.find(function(G){return G.id===M});if(M===y)o.push((_={},_[M]=g,_));else if(!(M in p))v[M]=g,d.push(C),p[M]=new Set([g]);else if(!p[y].has(C)){for(var S=!0,A=[C,g],T=v[y];p[M].size&&!p[M].has(T)&&(A.push(T),T!==v[T.id]);)T=v[T.id];if(A.push(T),t&&n?(S=!1,A.findIndex(function(G){return t.indexOf(G.id)>-1})>-1&&(S=!0)):t&&!n&&A.findIndex(function(G){return t.indexOf(G.id)>-1})>-1&&(S=!1),S){for(var k={},O=1;O0;){var O=k.pop();a.has(O)&&(a.delete(O),o[O.id].forEach(function(G){k.push(G)}),o[O.id].clear())}},c=function A(T,k,O){var G=!1;if(t&&n===!1&&t.indexOf(T.id)>-1)return G;i.push(T),a.add(T);for(var D=O[T.id],$=0;$-1});te-1)?s.push((k={},k[J.id]=J,k)):W[J.id].push(f[pe])}}return{component:P,adjList:W,minIdx:G}},b=0;b=b}),w=kw({nodes:x,edges:e.edges}).filter(function(A){return A.length>1});if(w.length===0)break;var E=m(w),_=E.minIdx,M=E.adjList,C=E.component;if(C.length>1){C.forEach(function(A){o[A.id]=new Set});var S=u[_];if(t&&n&&t.indexOf(S.id)===-1)return s;c(S,S,M),b=_+1}else break}return s},Dw=function(e,t,n,i){return i===void 0&&(i=!0),t?Yp(e,n,i):Xp(e,n,i)},c4=function(e,t,n){for(var i=1/0,a,o=0;ol[x.id]+A?(l[S]=l[x.id]+A,c[S]=[x.id]):l[S]===l[x.id]+A&&c[S].push(x.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=i?Wn(v,s,"target"):Wn(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},hf=function(e,t){for(var n=$o(e,t),i=[],a=n.length,o=0;oi[o][u]+i[u][s]&&(i[o][s]=i[o][u]+i[u][s]);return i},Fw=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,x){var w=Tw();b.clusterId=w,f[w]={id:w,nodes:[b]},l[b.id]={node:b,idx:x}});var c=$o(e,t),h={};c.forEach(function(b,x){var w=o[x].id;h[w]={},b.forEach(function(E,_){if(E){var M=o[_].id;h[w][M]=E}})});for(var d=0,v=function(){var x=!1;if(o.forEach(function(w){var E={};Object.keys(h[w.id]).forEach(function(O){var G=h[w.id][O],D=l[O].node,$=D.clusterId;E[$]||(E[$]=0),E[$]+=G});var _=-1/0,M=[];if(Object.keys(E).forEach(function(O){_=0&&M.splice(C,1),M&&M.length){x=!0;var S=f[w.clusterId],A=S.nodes.indexOf(w);S.nodes.splice(A,1);var T=Math.floor(Math.random()*M.length),k=f[M[T]];k.nodes.push(w),w.clusterId=k.id}}}),!x)return"break";d++};d0&&M>C&&M-CC&&(A=c.map(function(N){return{node:N,clusterId:N.clusterId}}),T=Vt(m),C=M),k||S>100)break;S++,Object.keys(m).forEach(function(N){var P=0;d.forEach(function(W){var J=W.source,te=W.target,H=b[J].node.clusterId,pe=b[te].node.clusterId;(H===N&&pe!==N||pe===N&&H!==N)&&(P=P+(W[n]||1))}),m[N].sumTot=P}),c.forEach(function(N,P){var W=m[N.clusterId],J=0,te,H=w[P]/(2*_),pe=0,Te=W.nodes;Te.forEach(function(Wt){var dr=b[Wt.id].idx;pe+=x[P][dr]||0});var Ne=pe-W.sumTot*H,Ze=Te.filter(function(Wt){return Wt.id!==N.id});Ze.forEach(function(Wt,dr){v[Wt.originIndex]});var at=Hp(Ze,v)*f,nt=E[N.id];if(Object.keys(nt).forEach(function(Wt){var dr=b[Wt].node,lr=dr.clusterId;if(lr!==N.clusterId){var Ut=m[lr],ar=Ut.nodes;if(!(!ar||!ar.length)){var Zr=0;ar.forEach(function(Ge){var me=b[Ge.id].idx;Zr+=x[P][me]||0});var tt=Zr-Ut.sumTot*H,ae=ar.concat([N]);ae.forEach(function(Ge,me){v[Ge.originIndex]});var L=Hp(ae,v)*f,Se=tt-Ne;a&&(Se=tt+L-(Ne+at)),Se>J&&(J=Se,te=Ut)}}}),J>0){te.nodes.push(N);var St=N.clusterId;N.clusterId=te.id;var Mt=W.nodes.indexOf(N);W.nodes.splice(Mt,1);var fr=0,Ft=0;d.forEach(function(Wt){var dr=Wt.source,lr=Wt.target,Ut=b[dr].node.clusterId,ar=b[lr].node.clusterId;(Ut===te.id&&ar!==te.id||ar===te.id&&Ut!==te.id)&&(fr=fr+(Wt[n]||1)),(Ut===St&&ar!==St||ar===St&&Ut!==St)&&(Ft=Ft+(Wt[n]||1))}),te.sumTot=fr,W.sumTot=Ft}})}var O={},G=0;Object.keys(T).forEach(function(N){var P=T[N];if(!P.nodes||!P.nodes.length){delete T[N];return}var W=String(G+1);W!==N&&(P.id=W,P.nodes=P.nodes.map(function(J){return{id:J.id,clusterId:W}}),T[W]=P,O[N]=W,delete T[N],G++)}),A.forEach(function(N){var P=N.node,W=N.clusterId;P&&(P.clusterId=W,P.clusterId&&O[P.clusterId]&&(P.clusterId=O[P.clusterId]))});var D=[],$={};d.forEach(function(N){var P=N.source,W=N.target,J=N[n]||1,te=b[P].node.clusterId,H=b[W].node.clusterId;if(!(!te||!H)){var pe="".concat(te,"---").concat(H);if($[pe])$[pe].weight+=J,$[pe].count++;else{var Te={source:te,target:H,weight:J,count:1};$[pe]=Te,D.push(Te)}}});var Y=[];return Object.keys(T).forEach(function(N){Y.push(T[N])}),{clusters:Y,clusterEdges:D}},$w=function(e,t,n,i,a,o,s,u){return t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4),a===void 0&&(a=void 0),o===void 0&&(o=[]),s===void 0&&(s=["id"]),u===void 0&&(u=1),qp(e,t,n,i,!0,a,o,s,u)},jw=function(e,t){var n;t===void 0&&(t=1);for(var i=Vt(e),a=i.nodes,o=a===void 0?[]:a,s=i.edges,u=s===void 0?[]:s,f=function(){var h=_a({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)>=t)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}},Uw=function(e,t,n){var i=[];switch(e){case Ei.EuclideanDistance:i=t[n];break;default:i=[];break}return i},Xw=function(e,t,n,i,a,o){t===void 0&&(t=3),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=["id"]),o===void 0&&(o=Ei.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===Ei.EuclideanDistance&&!u.every(function(W){return W.hasOwnProperty(n)}))return c;var h=[],d=[];if(o===Ei.EuclideanDistance&&(h=Wp(u,n),d=Vp(h,i,a)),!d.length)return c;for(var v=af(d.map(function(W){return W.join("")})),p=Math.min(t,u.length,v.length),g=0;gw&&!y.find(function(Ze){return Qa(Ze,Uw(o,d,u[te].originIndex))})&&(w=Ne,E=te)}},M=0;M=0;O--)b[Number(u[g].clusterId)][O].id===u[g].id&&b[Number(u[g].clusterId)].splice(O,1);u[g].clusterId=String(S),b[S].push(u[g])}}for(var G=!1,g=0;g=1e3)break}var N=[],P={};return l.forEach(function(W){var J,te,H=W.source,pe=W.target,Te=(J=u.find(function(nt){return nt.id===H}))===null||J===void 0?void 0:J.clusterId,Ne=(te=u.find(function(nt){return nt.id===pe}))===null||te===void 0?void 0:te.clusterId,Ze="".concat(Te,"---").concat(Ne);if(P[Ze])P[Ze].count++;else{var at={source:Te,target:Ne,count:1};P[Ze]=at,N.push(at)}}),{clusters:b,clusterEdges:N}},Zp=function(e,t){var n=new ii(t),i=n.norm2(),a=new ii(e),o=a.norm2(),s=n.dot(a),u=i*o,f=u?s/u:0;return f},Yw=function(e,t,n,i,a){e===void 0&&(e=[]),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=[]);var o=Vt(e.filter(function(h){return h.id!==t.id})),s=e.findIndex(function(h){return h.id===t.id}),u=Wp(e,n),f=Vp(u,i,a),l=f[s],c=[];return o.forEach(function(h,d){if(h.id!==t.id){var v=f[d],p=Zp(v,l);c.push(p),h.cosineSimilarity=p}}),o.sort(function(h,d){return d.cosineSimilarity-h.cosineSimilarity}),{allCosineSimilarity:c,similarNodes:o}},d4=function(){function r(e){this.count=e.length,this.parent={};for(var t=0,n=e;t0&&(this.list[0]=t,this.moveDown(0)),e},r.prototype.insert=function(e){if(e!==null){this.list.push(e);var t=this.list.length-1;return this.moveUp(t),!0}return!1},r.prototype.moveUp=function(e){for(var t=this.getParent(e);e&&e>0&&this.compareFn(this.list[t],this.list[e])>0;){var n=this.list[t];this.list[t]=this.list[e],this.list[e]=n,e=t,t=this.getParent(e)}},r.prototype.moveDown=function(e){var t,n=e,i=this.getLeft(e),a=this.getRight(e),o=this.list.length;i!==null&&i0?n=i:a!==null&&a0&&(n=a),e!==n&&(t=[this.list[n],this.list[e]],this.list[e]=t[0],this.list[n]=t[1],this.moveDown(n))},r}(),g4=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=a[0],f=new Set;f.add(u);var l=function(g,y){return t?g.weight-y.weight:0},c=new p4(l);for($c(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),$c(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),$c(v,s).forEach(function(p){c.insert(p)})))}return n},Ww=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(d){return d});t&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new d4(a.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},Vw=function(e,t,n){var i={prim:g4,kruskal:Ww};return n?i[n](e,t):Ww(e,t)},Hw=function(e,t,n){typeof t!="number"&&(t=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=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&&i>t;){a=0;for(var p=0;p0&&(h+=v[w]/E)}d[y]=n*h,a+=d[y]}}a=(1-a)/c,i=0;for(var p=0;p=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;ad||i.hasNode(o[h.to])||(t.labelb;w--){var E=x(w);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new jo(p,m,Vi,_.edgeLabel,Vi));var M=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[M]!==o.dfsEdgeList[M]?!1:c(g[_.edgeLabel].projected)}var C={};y=!1;var S=0;h.forEach(function(D){var $=new Uc(D),Y=e.findForwardPureEdges(i,$.edges[d[0]],v,$);Y.length>0&&(y=!0,S=p,Y.forEach(function(N){var P="".concat(N.label,"-").concat(a[N.to].label);C[P]||(C[P]={projected:[],edgeLabel:N.label,nodeLabel2:a[N.to].label}),C[P].projected.push({graphId:i.id,edge:N,preNode:D})}))});for(var A=d.length,T=function($){if(y)return"break";var Y=d[$];h.forEach(function(N){var P=new Uc(N),W=e.findForwardRmpathEdges(i,P.edges[Y],v,P);W.length>0&&(y=!0,S=o.dfsEdgeList[Y].fromNode,W.forEach(function(J){var te="".concat(J.label,"-").concat(a[J.to].label);C[te]||(C[te]={projected:[],edgeLabel:J.label,nodeLabel2:a[J.to].label}),C[te].projected.push({graphId:i.id,edge:J,preNode:N})}))})},w=0;w=0;v--){var p=t.findBackwardEdge(c,d.edges[a[v]],d.edges[a[0]],d);if(p){var g="".concat(t.dfsCode.dfsEdgeList[a[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:t.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(i>=t.maxNodeNum)){var y=t.findForwardPureEdges(c,d.edges[a[0]],s,d);y.forEach(function(b){var x="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[x]||(u[x]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[x].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(x){var w=t.findForwardRmpathEdges(c,d.edges[a[x]],s,d);w.forEach(function(E){var _="".concat(t.dfsCode.dfsEdgeList[a[x]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:t.dfsCode.dfsEdgeList[a[x]].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 x=g.label,w="".concat(y,"-").concat(x,"-").concat(m);if(!o[w]){var E=o[w]||0;E++,o[w]=E}})})}),Object.keys(a).forEach(function(u){var f=a[u];if(!(f2*t)););if(g<2*t&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:a[l][p]},c++,u++,u>=n))return s;if(h++,h>2*t)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[t]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},sE=function(e,t,n,i,a,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=hf(e,n),c=hf(t,n),h=aE(e.nodes,l,n),d=aE(t.nodes,c,n),v=nE(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=nE(t.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;iE(e.edges,s,p);var x=iE(t.edges,s,m).edgeLabelMap,w=[];c==null||c.forEach(function(tt){w=w.concat(tt)}),a||(a=Math.max.apply(Math,Yn(Yn([],w,!1),[2],!1))),i||(i=a);var E=tE(e,l,o,i),_=tE(t,c,o,i),M=Math.min(100,f*(f-1)/2),C=_4(i,f,M,E,l),S=Xc(C,E,e),A=10,T=1,k=1,O=4,G={graphs:S,nodeLabelProp:o,edgeLabelProp:s,minSupport:T,minNodeNum:k,maxNodeNum:O,directed:n},D=E4(G).slice(0,A),$=D.length,Y=[];D.forEach(function(tt,ae){Y[ae]={},Object.keys(S).forEach(function(L){var Se=S[L],Ge=Yc(Se,tt,o,s);Y[ae][L]=Ge})});var N=S4(Y,$,D),P=N.structure,W=N.structureCountMap,J=t.nodes[0],te=[],H=(u=t.nodes[0])===null||u===void 0?void 0:u[o],pe=-1/0;t.nodes.forEach(function(tt){var ae=tt[o],L=g[ae];(L==null?void 0:L.length)>pe&&(pe=L.length,te=L,H=ae,J=tt)});var Te={},Ne={},Ze={},at={},nt={},St={};Object.keys(b).forEach(function(tt,ae){nt[tt]=[],n&&(St[tt]=[]);var L=b[tt],Se={};L.forEach(function(qe){var et=d["".concat(J.id,"-").concat(qe.id)];if(et&&nt[tt].push(et),Se["".concat(J.id,"-").concat(qe.id)]={start:0,end:m[qe.id].idx,distance:et},n){var yt=d["".concat(qe.id,"-").concat(J.id)];yt&&St[tt].push(yt)}}),nt[tt]=nt[tt].sort(function(qe,et){return qe-et}),n&&(St[tt]=St[tt].sort(function(qe,et){return qe-et})),Ne=Xc(Se,_,t,Ne);var Ge=[];if(Object.keys(Se).forEach(function(qe){if(Ze[qe]){Ge.push(Ze[qe]);return}var et=Ne[qe];Ze[qe]=Yc(et,P,o,s),Ge.push(Ze[qe])}),Ge=Ge.sort(function(qe,et){return et-qe}),at["".concat(J.id,"-").concat(tt)]=Ge,tt!==H)for(var me=(te==null?void 0:te.length)||0,Ye=function(et){var yt=te[et],Pt=E[p[yt.id].idx],cr=Pt.nodeLabelCountMap[tt],Rt=b[tt].length;if(!cr||cr.countnt[tt][ur]){hr=!0;break}if(hr)return te.splice(et,1),"continue";var xr={};Pt.neighbors.forEach(function(or){var jr=h["".concat(yt.id,"-").concat(or.id)];xr["".concat(yt.id,"-").concat(or.id)]={start:p[yt.id].idx,end:p[or.id].idx,distance:jr}}),S=Xc(xr,E,e,S);var vr=[];Object.keys(xr).forEach(function(or){if(W[or]){vr.push(W[or]);return}var jr=S[or];W[or]=Yc(jr,P,o,s),vr.push(W[or])}),vr=vr.sort(function(or,jr){return jr-or});for(var En=!1,ur=0;ur=0;We--)Ye(We)});var Mt=[];te==null||te.forEach(function(tt){for(var ae=p[tt.id].idx,L=rE(e.nodes,l[ae],ae,o,a),Se=L.neighbors,Ge=Se.length,me=!1,Ye=Ge-1;Ye>=0;Ye--){if(Se.length+1cr){Se.splice(Ye,1);continue}if(n){var Rt="".concat(We.id,"-").concat(tt.id),hr=h[Rt];Pt=St[qe].length-1;var ur=St[qe][Pt];if(hr>ur){Se.splice(Ye,1);continue}}var xr=W[et]?W[et]:M4(e,tt,We,p,yt,E,P,o,s,W,S),vr="".concat(J.id,"-").concat(qe),En=at[vr][at[vr].length-1];if(xr=0;yt--){var ur=hr(yt);if(ur==="break")break}if(Rt)return Mt.splice(ae,1),"continue";L.edges=Ye;var xr=cf(L,L.nodes[0].id,!1).length;if(Object.keys(xr).reverse().forEach(function(At){if(!(At===L.nodes[0].id||Rt)){if(xr[At]===1/0){var pr=me[At].node[o];if(Ge[pr]--,Ge[pr]Ft[kr][Ft[kr].length-1]){var pr=me[At].node[o];if(Ge[pr]--,Ge[pr]=0;Ri--){var Kr=L.nodes[Ri],Oo=me[Kr.id].degree,Jl=me[Kr.id].inDegree,ec=me[Kr.id].outDegree,pn=Kr[o],Va=oE(Te,pn,m,b),_s=Va.minPatternNodeLabelDegree,tc=Va.minPatternNodeLabelInDegree,rc=Va.minPatternNodeLabelOutDegree,nc=n?Oo<_s||Jl=0;Bi--){var Ur=Ye[Bi];if(!me[Ur.source]||!me[Ur.target]){Ye.splice(Bi,1);var Fi=Ur[s];if(We[Fi]--,me[Ur.source]&&(me[Ur.source].degree--,me[Ur.source].outDegree--),me[Ur.target]&&(me[Ur.target].degree--,me[Ur.target].inDegree--),x[Fi]&&We[Fi]=0;lr--){var Ut=dr(lr);if(Ut==="break")break}for(var ar=Mt.length,Zr=function(ae){var L=Mt[ae],Se={};L.edges.forEach(function(Ye){var We="".concat(Ye.source,"-").concat(Ye.target,"-").concat(Ye.label);Se[We]?Se[We]++:Se[We]=1});for(var Ge=function(We){var qe=Mt[We],et={};qe.edges.forEach(function(Pt){var cr="".concat(Pt.source,"-").concat(Pt.target,"-").concat(Pt.label);et[cr]?et[cr]++:et[cr]=1});var yt=!0;Object.keys(et).length!==Object.keys(Se).length?yt=!1:Object.keys(Se).forEach(function(Pt){et[Pt]!==Se[Pt]&&(yt=!1)}),yt&&Mt.splice(We,1)},me=ar-1;me>ae;me--)Ge(me);ar=Mt.length},lr=0;lr<=ar-1;lr++)Zr(lr);return Mt}}},Us=function(){function r(e){e===void 0&&(e=10),this.linkedList=new Aw,this.maxStep=e}return Object.defineProperty(r.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},r.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},r.prototype.push=function(e){this.linkedList.prepend(e),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var e=this.linkedList.deleteHead();return e?e.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(e){return e.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r}(),uE=Up;const C4=Object.freeze(Object.defineProperty({__proto__:null,GADDI:sE,Stack:Us,breadthFirstSearch:Iw,connectedComponent:$p,cosineSimilarity:Zp,default:{getAdjMatrix:$o,breadthFirstSearch:Iw,connectedComponent:$p,getDegree:_a,getInDegree:Lw,getOutDegree:Nw,detectCycle:Up,detectDirectedCycle:uE,detectAllCycles:Dw,detectAllDirectedCycle:Yp,detectAllUndirectedCycle:Xp,depthFirstSearch:jp,dijkstra:cf,findAllPath:Bw,findShortestPath:Rw,floydWarshall:hf,labelPropagation:Fw,louvain:qp,iLouvain:$w,kCore:jw,kMeans:Xw,cosineSimilarity:Zp,nodesCosineSimilarity:Yw,minimumSpanningTree:Vw,pageRank:Hw,getNeighbors:Wn,Stack:Us,GADDI:sE},depthFirstSearch:jp,detectAllCycles:Dw,detectAllDirectedCycle:Yp,detectAllUndirectedCycle:Xp,detectCycle:Up,detectDirectedCycle:uE,dijkstra:cf,findAllPath:Bw,findShortestPath:Rw,floydWarshall:hf,getAdjMatrix:$o,getDegree:_a,getInDegree:Lw,getNeighbors:Wn,getOutDegree:Nw,iLouvain:$w,kCore:jw,kMeans:Xw,labelPropagation:Fw,louvain:qp,minimumSpanningTree:Vw,nodesCosineSimilarity:Yw,pageRank:Hw},Symbol.toStringTag,{value:"Module"}));var Wc=ni,A4=function(e){return function(t,n){return t[e]-n[e]}},fE=function(e,t,n){return e>=t&&e<=n},Vc=function(e,t,n,i){var a=1e-4,o={x:n.x-e.x,y:n.y-e.y},s={x:t.x-e.x,y:t.y-e.y},u={x:i.x-n.x,y:i.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>a*h*d){var v=(o.x*u.y-o.y*u.x)*c,p=(o.x*s.y-o.y*s.x)*c;return!fE(v,0,1)||!fE(p,0,1)?null:{x:e.x+v*s.x,y:e.y+v*s.y}}return null},lE=function(e,t){var n=e.x,i=e.y,a=e.width,o=e.height,s=n+a/2,u=i+o/2,f=[],l={x:s,y:u};f.push({x:n,y:i}),f.push({x:n+a,y:i}),f.push({x:n+a,y:i+o}),f.push({x:n,y:i+o}),f.push({x:n,y:i});for(var c=null,h=1;ht[i][o]+t[o][a]&&(t[i][a]=t[i][o]+t[o][a]);return t},k4=function(e,t){var n=e.nodes,i=e.edges,a=[],o={};if(!n)throw new Error("invalid nodes data!");return n&&n.forEach(function(s,u){o[s.id]=u;var f=[];a.push(f)}),i&&i.forEach(function(s){var u=s.source,f=s.target,l=o[u],c=o[f];a[l][c]=1,t||(a[c][l]=1)}),a},vE=function(e,t){e.translate(t.x,t.y)},Qp=function(e,t,n,i){i===void 0&&(i={duration:500});var a=e.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]);var o=e.getCanvasBBox(),s=t.x-o.minX,u=t.y-o.minY;if(n){var f=s*a[0],l=u*a[4],c=0,h=0,d=0,v=0;e.animate(function(g){return d=f*g,v=l*g,a=Wc(a,[["t",d-c,v-h]]),c=d,h=v,{matrix:a}},i)}else{var p=Wc(a,[["t",s,u]]);e.setMatrix(p)}},L4=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var i=t;vt(t)||(i=[t,t]),vt(t)&&t.length===1&&(i=[t[0],t[0]]),n=Wc(n,[["s",i[0],i[1]]]),e.setMatrix(n)},N4=function(e,t){var n=e.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]),n=Wc(n,[["r",t]]),e.setMatrix(n)},O4=function(e,t,n){for(var i=[],a=0;a0!=s(l[1]-n)>0&&s(t-(n-f[1])*(f[0]-l[0])/(f[1]-l[1])-f[0])<0&&(i=!i)}return i},pE=function(e,t){return!(t.minX>e.maxX||t.maxXe.maxY||t.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||t.length<2)return!1;var a=n(e),o=n(t);if(!pE(a,o))return!1;var s=!1;if(ye(t,function(c){if(df(e,c[0],c[1]))return s=!0,!1}),s||(ye(e,function(c){if(df(t,c[0],c[1]))return s=!0,!1}),s))return!0;var u=i(e),f=i(t),l=!1;return ye(f,function(c){if(P4(u,c))return l=!0,!1}),l},Uo=function(){function r(e,t,n,i){this.x1=e,this.y1=t,this.x2=n,this.y2=i}return r.prototype.getBBox=function(){var e=Math.min(this.x1,this.x2),t=Math.min(this.y1,this.y2),n=Math.max(this.x1,this.x2),i=Math.max(this.y1,this.y2),a={x:e,y:t,minX:e,minY:t,maxX:n,maxY:i,width:n-e,height:i-t};return a},r}(),Jp=function(e,t){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[t]},R4=function(e,t){var n=(t.x2-t.x1)*(e.y1-t.y1)-(t.y2-t.y1)*(e.x1-t.x1),i=(e.x2-e.x1)*(e.y1-t.y1)-(e.y2-e.y1)*(e.x1-t.x1),a=(t.y2-t.y1)*(e.x2-e.x1)-(t.x2-t.x1)*(e.y2-e.y1);if(a){var o=n/a,s=i/a;if(o>=0&&o<=1&&s>=0&&s<=1)return o}return Number.POSITIVE_INFINITY},yE=function(e,t){for(var n=["top","left","bottom","right"],i=e.getBBox(),a=0,o=[],s=0;s<4;s++){var u=Jp(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3];o[s]=Vc({x:t.x1,y:t.y1},{x:t.x2,y:t.y2},{x:f,y:l},{x:c,y:h}),o[s]&&(a+=1)}return[o,a]},eg=function(e,t){for(var n=["top","left","bottom","right"],i=e.getBBox(),a=Number.POSITIVE_INFINITY,o=0,s=0;s<4;s++){var u=Jp(i,n[s]),f=u[0],l=u[1],c=u[2],h=u[3],d=R4(t,new Uo(f,l,c,h));d=Math.abs(d-.5),d>=0&&d<=1&&(o+=1,a=d0){for(var i=0,a=e;it.x+t.width,a=e.y>t.y+t.height,o=e.y":.604998779296875,"/":.5,"?":.53699951171875};var Hi=Math.PI,ag=Math.sin,og=Math.cos,cn=ag(Hi/8),hn=og(Hi/8),Qc=function(e,t){var n=e.getBBox(),i={x:n.minX,y:n.minY},a={x:n.maxX,y:n.maxY};if(t){var o=t.getMatrix();o||(o=[1,0,0,0,1,0,0,0,1]),i=Xs(i,o),a=Xs(a,o)}var s=i.x,u=i.y,f=a.x,l=a.y;return{x:s,y:u,minX:s,minY:u,maxX:f,maxY:l,width:f-s,height:l-u}},CE=function(e){var t=e.sourceNode||e.targetNode,n=t.get("group"),i=n.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]);var a=t.getKeyShape(),o=a.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+i[6],(o.minY+o.maxY)/2+i[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*cn,m=p*hn,b=g*cn,x=g*hn,w=a.get("type"),E=Math.min(d/2,v/2),_=Math.min(d,v),M=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":w==="circle"?(c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-x]):(c=[l[0]-M,l[1]-d],h=[l[0]+M,l[1]-d]);break;case"top-right":p=d,g=v,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]+y,l[1]-m],h=[l[0]+x,l[1]-b]):(c=[l[0]+v-M,l[1]-d],h=[l[0]+v,l[1]-d+M]);break;case"right":p=v,g=v,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]+m,l[1]-y],h=[l[0]+x,l[1]+b]):(c=[l[0]+v,l[1]-M],h=[l[0]+v,l[1]+M]);break;case"bottom-right":p=v,g=d,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]+m,l[1]+y],h=[l[0]+b,l[1]+x]):(c=[l[0]+v,l[1]+d-M],h=[l[0]+v-M,l[1]+d]);break;case"bottom":p=d,g=d,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]+y,l[1]+m],h=[l[0]-b,l[1]+x]):(c=[l[0]-M,l[1]+d],h=[l[0]+M,l[1]+d]);break;case"bottom-left":p=d,g=v,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]-y,l[1]+m],h=[l[0]-x,l[1]+b]):(c=[l[0]-v,l[1]+d-M],h=[l[0]-v+M,l[1]+d]);break;case"left":p=v,g=v,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]-m,l[1]+y],h=[l[0]-x,l[1]-b]):(c=[l[0]-v,l[1]-M],h=[l[0]-v,l[1]+M]);break;case"top-left":p=v,g=d,w==="circle"?(y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]-m,l[1]-y],h=[l[0]-b,l[1]-x]):(c=[l[0]-v+M,l[1]-d],h=[l[0]-v,l[1]-d+M]);break;default:p=v,g=v,y=p*cn,m=p*hn,b=g*cn,x=g*hn,c=[l[0]-y,l[1]-m],h=[l[0]+b,l[1]-x]}if(s.clockwise===!1){var C=[c[0],c[1]];c=[h[0],h[1]],h=[C[0],C[1]]}}var S=[c[0]-l[0],c[1]-l[1]],A=(p+u)/p,T=(g+u)/g;s.clockwise===!1&&(A=(g+u)/g,T=(p+u)/p);var k=Sn([0,0],S,A),O=[l[0]+k[0],l[1]+k[1]],G=[h[0]-l[0],h[1]-l[1]],D=Sn([0,0],G,T),$=[l[0]+D[0],l[1]+D[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:$[0],y:$[1]}],e},AE=function(e,t,n,i,a){var o=1e-4,s=[],u=e==null?void 0:e.getPoint(t);if(!u)return{x:0,y:0,angle:0};if(t1-o)s=e.getEndTangent();else{var f=e==null?void 0:e.getPoint(t+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+=Hi*2),n&&(u.x+=og(l)*n,u.y+=ag(l)*n),i){var c=l-Hi/2;l>1/2*Hi&&l<3*1/2*Hi&&(c-=Hi),u.x+=og(c)*i,u.y+=ag(c)*i}var h={x:u.x,y:u.y,angle:l};return a?(l>.5*Hi&&l<1.5*Hi&&(l-=Hi),B({rotate:l},h)):h},X4=function r(e,t,n,i){if(i(e,t,n)===!1)return!1;if(e&&e.children){for(var a=e.children.length-1;a>=0;a--)if(!r(e.children[a],e,a,i))return!1}return!0},Y4=function r(e,t,n,i){if(e&&e.children){for(var a=e.children.length-1;a>=0;a--)if(!r(e.children[a],e,a,i))return}return i(e,t,n)!==!1},Mn=function(e,t){typeof t=="function"&&X4(e,null,-1,t)},qi=function(e,t){typeof t=="function"&&Y4(e,null,-1,t)},TE=function(e,t){return t*(U4[e]||1)},IE=function(e,t){var n=0,i=new RegExp("[一-龥]+");return e.split("").forEach(function(a){i.test(a)?n+=t:n+=TE(a,t)}),[n,t]},kE=function(e,t){return typeof t!="number"||t<=0||t>=e.length?e:e.substring(0,t)+"..."},sg=function(e,t){var n=[],i={},a={};e.forEach(function(u){a[u.id]=u}),e.forEach(function(u,f){var l=Vt(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&&!a[l.parentId]&&(console.warn("The parent combo for combo ".concat(l.id," does not exist!")),delete l.parentId);var c=i[l.id];if(c){if(l.children=c.children,i[l.id]=l,c=l,!c.parentId){n.push(c);return}var h=i[c.parentId];if(h)h.children?h.children.push(l):h.children=[l];else{var d={id:c.parentId,children:[c]};i[c.parentId]=d,i[l.id]=l}return}if(Pe(u.parentId)){var v=i[u.parentId];if(v)v.children?v.children.push(l):v.children=[l],i[l.id]=l;else{var p={id:u.parentId,children:[l]};i[p.id]=p,i[l.id]=l}}else n.push(l),i[l.id]=l});var o={};(t||[]).forEach(function(u){o[u.id]=u;var f=i[u.comboId];if(f){var l={id:u.id,comboId:u.comboId};f.children?f.children.push(l):f.children=[l],l.itemType="node",i[u.id]=l}});var s=0;return n.forEach(function(u){u.depth=s+10,Mn(u,function(f){var l,c=i[f.id].itemType;c==="node"?l=i[f.comboId]:l=i[f.parentId],l&&c==="node"?f.depth=s+1:f.depth=s+10,s-1&&a.splice(l,1),u||(o={id:t,itemType:"node",comboId:n},s[t]={children:void 0}),t){var c=!1;if(n){var h=0;(e||[]).forEach(function(v){c||Mn(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;Mn(o,function(v){return v.itemType==="node"?d+=2:d+=1,v.depth=d,!0})}return e},Jc=function(e,t,n){var i={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 a=n==null?void 0:n.getModel(),o=a||{},s=o.x,u=o.y,f=o.fixSize,l=o.collapsed,c=o.fixCollapseSize,h=l?c:f,d=vt(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=t.findById(y.id);if(!(!m||!m.isVisible())){m.set("bboxCanvasCache",void 0);var b=m.getCanvasBBox();b.x&&i.minX>b.minX&&(i.minX=b.minX),b.y&&i.minY>b.minY&&(i.minY=b.minY),b.x&&i.maxX2&&(t.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&t.push([i,o[0]]),s==="r")t.push([i].concat(o));else for(;o.length>=e[s]&&(t.push([i].concat(o.splice(0,e[s]))),!!e[s]););return r}),t},fg=function(r,e){for(var t=[],n=0,i=r.length;i-2*!e>n;n+=2){var a=[{x:+r[n-2],y:+r[n-1]},{x:+r[n],y:+r[n+1]},{x:+r[n+2],y:+r[n+3]},{x:+r[n+4],y:+r[n+5]}];e?n?i-4===n?a[3]={x:+r[0],y:+r[1]}:i-2===n&&(a[2]={x:+r[0],y:+r[1]},a[3]={x:+r[2],y:+r[3]}):a[0]={x:+r[i-2],y:+r[i-1]}:i-4===n?a[3]=a[2]:n||(a[0]={x:+r[n],y:+r[n+1]}),t.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return t},th=function(r,e,t,n,i){var a=[];if(i===null&&n===null&&(n=t),r=+r,e=+e,t=+t,n=+n,i!==null){var o=Math.PI/180,s=r+t*Math.cos(-n*o),u=r+t*Math.cos(-i*o),f=e+t*Math.sin(-n*o),l=e+t*Math.sin(-i*o);a=[["M",s,f],["A",t,t,0,+(i-n>180),0,u,l]]}else a=[["M",r,e],["m",0,-n],["a",t,n,0,1,1,0,2*n],["a",t,n,0,1,1,0,-2*n],["z"]];return a},lg=function(r){if(r=Ys(r),!r||!r.length)return[["M",0,0]];var e=[],t=0,n=0,i=0,a=0,o=0,s,u;r[0][0]==="M"&&(t=+r[0][1],n=+r[0][2],i=t,a=n,o++,e[0]=["M",t,n]);for(var f=r.length===3&&r[0][0]==="M"&&r[1][0].toUpperCase()==="R"&&r[2][0].toUpperCase()==="Z",l=void 0,c=void 0,h=o,d=r.length;h1&&(w=Math.sqrt(w),t=w*t,n=w*n);var E=t*t,_=n*n,M=(a===o?-1:1)*Math.sqrt(Math.abs((E*_-E*x*x-_*b*b)/(E*x*x+_*b*b)));g=M*t*x/n+(r+s)/2,y=M*-n*b/t+(e+u)/2,v=Math.asin(((e-y)/n).toFixed(9)),p=Math.asin(((u-y)/n).toFixed(9)),v=rp&&(v=v-Math.PI*2),!o&&p>v&&(p=p-Math.PI*2)}var C=p-v;if(Math.abs(C)>l){var S=p,A=s,T=u;p=v+l*(o&&p>v?1:-1),s=g+t*Math.cos(p),u=y+n*Math.sin(p),h=OE(s,u,t,n,i,0,o,A,T,[p,S,g,y])}C=p-v;var k=Math.cos(v),O=Math.sin(v),G=Math.cos(p),D=Math.sin(p),$=Math.tan(C/4),Y=4/3*t*$,N=4/3*n*$,P=[r,e],W=[r+Y*O,e-N*k],J=[s+Y*D,u-N*G],te=[s,u];if(W[0]=2*P[0]-W[0],W[1]=2*P[1]-W[1],f)return[W,J,te].concat(h);h=[W,J,te].concat(h).join().split(",");for(var H=[],pe=0,Te=h.length;pe7){b[x].shift();for(var w=b[x];w.length;)o[x]="A",n&&(s[x]="A"),b.splice(x++,0,["C"].concat(w.splice(0,6)));b.splice(x,1),l=Math.max(t.length,n&&n.length||0)}},d=function(b,x,w,E,_){b&&x&&b[_][0]==="M"&&x[_][0]!=="M"&&(x.splice(_,0,["M",E.x,E.y]),w.bx=0,w.by=0,w.x=b[_][1],w.y=b[_][2],l=Math.max(t.length,n&&n.length||0))};l=Math.max(t.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,x=b,w;b--;)d=u[b],w=1-d,f[0][b]=w*w*w*r+3*w*w*d*t+3*w*d*d*i+d*d*d*o,f[1][b]=w*w*w*e+3*w*w*d*n+3*w*d*d*a+d*d*d*s;return f[0][x]=r,f[1][x]=e,f[0][x+1]=o,f[1][x+1]=s,f[0].length=f[1].length=x+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])}}},eG=function(r,e,t,n,i,a,o,s){if(!(Math.max(r,t)Math.max(i,o)||Math.max(e,n)Math.max(a,s))){var u=(r*n-e*t)*(i-o)-(r-t)*(i*s-a*o),f=(r*n-e*t)*(a-s)-(e-n)*(i*s-a*o),l=(r-t)*(a-s)-(e-n)*(i-o);if(l){var c=u/l,h=f/l,d=+c.toFixed(2),v=+h.toFixed(2);if(!(d<+Math.min(r,t).toFixed(2)||d>+Math.max(r,t).toFixed(2)||d<+Math.min(i,o).toFixed(2)||d>+Math.max(i,o).toFixed(2)||v<+Math.min(e,n).toFixed(2)||v>+Math.max(e,n).toFixed(2)||v<+Math.min(a,s).toFixed(2)||v>+Math.max(a,s).toFixed(2)))return{x:c,y:h}}}},no=function(r,e,t){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height},BE=function(r,e,t,n,i){if(i)return[["M",+r+ +i,e],["l",t-i*2,0],["a",i,i,0,0,1,i,i],["l",0,n-i*2],["a",i,i,0,0,1,-i,i],["l",i*2-t,0],["a",i,i,0,0,1,-i,-i],["l",0,i*2-n],["a",i,i,0,0,1,i,-i],["z"]];var a=[["M",r,e],["l",t,0],["l",0,n],["l",-t,0],["z"]];return a.parsePathArray=DE,a},hg=function(r,e,t,n){return r===null&&(r=e=t=n=0),e===null&&(e=r.y,t=r.width,n=r.height,r=r.x),{x:r,y:e,width:t,w:t,height:n,h:n,x2:r+t,y2:e+n,cx:r+t/2,cy:e+n/2,r1:Math.min(t,n)/2,r2:Math.max(t,n)/2,r0:Math.sqrt(t*t+n*n)/2,path:BE(r,e,t,n),vb:[r,e,t,n].join(" ")}},tG=function(r,e){return r=hg(r),e=hg(e),no(e,r.x,r.y)||no(e,r.x2,r.y)||no(e,r.x,r.y2)||no(e,r.x2,r.y2)||no(r,e.x,e.y)||no(r,e.x2,e.y)||no(r,e.x,e.y2)||no(r,e.x2,e.y2)||(r.xe.x||e.xr.x)&&(r.ye.y||e.yr.y)},FE=function(r,e,t,n,i,a,o,s){vt(r)||(r=[r,e,t,n,i,a,o,s]);var u=J4.apply(null,r);return hg(u.min.x,u.min.y,u.max.x-u.min.x,u.max.y-u.min.y)},GE=function(r,e,t,n,i,a,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*r+c*3*u*t+f*3*u*u*i+d*o,p=l*e+c*3*u*n+f*3*u*u*a+d*s,g=r+2*u*(t-r)+h*(i-2*t+r),y=e+2*u*(n-e)+h*(a-2*n+e),m=t+2*u*(i-t)+h*(o-2*i+t),b=n+2*u*(a-n)+h*(s-2*a+n),x=f*r+u*t,w=f*e+u*n,E=f*i+u*o,_=f*a+u*s,M=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,y:w},end:{x:E,y:_},alpha:M}},rG=function(r,e,t){var n=FE(r),i=FE(e);if(!tG(n,i))return t?0:[];for(var a=RE.apply(0,r),o=RE.apply(0,e),s=~~(a/8),u=~~(o/8),f=[],l=[],c={},h=t?0:[],d=0;d=0&&_<=1&&M>=0&&M<=1&&(t?h+=1:h.push({x:E.x,y:E.y,t1:_,t2:M}))}}return h},nG=function(r,e,t){r=cg(r),e=cg(e);for(var n,i,a,o,s,u,f,l,c,h,d=t?0:[],v=0,p=r.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 sG=function(r,e,t){if(t===1)return[[].concat(r)];var n=[];if(e[0]==="L"||e[0]==="C"||e[0]==="Q")n=n.concat(oG(r,e,t));else{var i=[].concat(r);i[0]==="M"&&(i[0]="L");for(var a=0;a<=t-1;a++)n.push(i)}return n},uG=function(r,e){if(r.length===1)return r;var t=r.length-1,n=e.length-1,i=t/n,a=[];if(r.length===1&&r[0][0]==="M"){for(var o=0;o=0;u--)o=a[u].index,a[u].type==="add"?r.splice(o,0,[].concat(r[o])):r.splice(o,1)}n=r.length;var c=i-n;if(n0)t=dg(t,r[n-1],1);else{r[n]=e[n];break}r[n]=["Q"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;case"T":r[n]=["T"].concat(t[0]);break;case"C":if(t.length<3)if(n>0)t=dg(t,r[n-1],2);else{r[n]=e[n];break}r[n]=["C"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;case"S":if(t.length<2)if(n>0)t=dg(t,r[n-1],1);else{r[n]=e[n];break}r[n]=["S"].concat(t.reduce(function(i,a){return i.concat(a)},[]));break;default:r[n]=e[n]}return r};const hG=Object.freeze(Object.defineProperty({__proto__:null,catmullRomToBezier:fg,fillPath:uG,fillPathByDiff:zE,formatPath:vg,intersection:iG,parsePathArray:DE,parsePathString:Ys,pathToAbsolute:lg,pathToCurve:cg,rectPath:BE},Symbol.toStringTag,{value:"Module"}));var jE=function(){function r(e,t){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=t,this.timeStamp=t.timeStamp}return r.prototype.preventDefault=function(){this.defaultPrevented=!0,this.originalEvent.preventDefault&&this.originalEvent.preventDefault()},r.prototype.stopPropagation=function(){this.propagationStopped=!0},r.prototype.toString=function(){var e=this.type;return"[Event (type="+e+")]"},r.prototype.save=function(){},r.prototype.restore=function(){},r}();function UE(r,e){var t=r.indexOf(e);t!==-1&&r.splice(t,1)}var XE=typeof window<"u"&&typeof window.document<"u";function YE(r,e){if(r.isCanvas())return!0;for(var t=e.getParent(),n=!1;t;){if(t===r){n=!0;break}t=t.getParent()}return n}function pg(r){return r.cfg.visible&&r.cfg.capture}var dG=function(r){It(e,r);function e(t){var n=r.call(this)||this;n.destroyed=!1;var i=n.getDefaultCfg();return n.cfg=gt(i,t),n}return e.prototype.getDefaultCfg=function(){return{}},e.prototype.get=function(t){return this.cfg[t]},e.prototype.set=function(t,n){this.cfg[t]=n},e.prototype.destroy=function(){this.cfg={destroyed:!0},this.off(),this.destroyed=!0},e}(px),WE=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new mG:typeof navigator<"u"?_G(navigator.userAgent):MG()}function EG(r){return r!==""&&wG.reduce(function(e,t){var n=t[0],i=t[1];if(e)return e;var a=i.exec(r);return!!a&&[n,a]},!1)}function _G(r){var e=EG(r);if(!e)return null;var t=e[0],n=e[1];if(t==="searchbot")return new yG;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.lengtho.delay&&ye(e.toAttrs,function(s,u){a.call(o.toAttrs,u)&&(delete o.toAttrs[u],delete o.fromAttrs[u])})}),r}var QE=function(r){It(e,r);function e(t){var n=r.call(this,t)||this;n.attrs={};var i=n.getDefaultAttrs();return gt(i,t.attrs),n.attrs=i,n.initAttrs(i),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(t){},e.prototype.initAttrs=function(t){},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 t,n=[],i=0;i0?a=DG(a,x):i.addAnimator(this),a.push(x),this.set("animations",a),this.set("_pause",{isPaused:!1})}},e.prototype.stopAnimate=function(t){var n=this;t===void 0&&(t=!0);var i=this.get("animations");ye(i,function(a){t&&(a.onFrame?n.attr(a.onFrame(1)):n.attr(a.toAttrs)),a.callback&&a.callback()}),this.set("animating",!1),this.set("animations",[])},e.prototype.pauseAnimate=function(){var t=this.get("timeline"),n=this.get("animations"),i=t.getTime();return ye(n,function(a){a._paused=!0,a._pauseTime=i,a.pauseCallback&&a.pauseCallback()}),this.set("_pause",{isPaused:!0,pauseTime:i}),this},e.prototype.resumeAnimate=function(){var t=this.get("timeline"),n=t.getTime(),i=this.get("animations"),a=this.get("_pause").pauseTime;return ye(i,function(o){o.startTime=o.startTime+(n-a),o._paused=!1,o._pauseTime=null,o.resumeCallback&&o.resumeCallback()}),this.set("_pause",{isPaused:!1}),this.set("animations",i),this},e.prototype.emitDelegation=function(t,n){var i=this,a=n.propagationPath;this.getEvents();var o;t==="mouseenter"?o=n.fromShape:t==="mouseleave"&&(o=n.toShape);for(var s=function(c){var h=a[c],d=h.get("name");if(d){if((h.isGroup()||h.isCanvas&&h.isCanvas())&&o&&YE(h,o))return"break";vt(d)?ye(d,function(v){i.emitDelegateEvent(h,v,n)}):u.emitDelegateEvent(h,d,n)}},u=this,f=0;f0)});o.length>0?ye(o,function(u){var f=u.getBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;ln&&(n=c),ha&&(a=d)}):(t=0,n=0,i=0,a=0);var s={x:t,y:i,minX:t,minY:i,maxX:n,maxY:a,width:n-t,height:a-i};return s},e.prototype.getCanvasBBox=function(){var t=1/0,n=-1/0,i=1/0,a=-1/0,o=this.getChildren().filter(function(u){return u.get("visible")&&(!u.isGroup()||u.isGroup()&&u.getChildren().length>0)});o.length>0?ye(o,function(u){var f=u.getCanvasBBox(),l=f.minX,c=f.maxX,h=f.minY,d=f.maxY;ln&&(n=c),ha&&(a=d)}):(t=0,n=0,i=0,a=0);var s={x:t,y:i,minX:t,minY:i,maxX:n,maxY:a,width:n-t,height:a-i};return s},e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.children=[],t},e.prototype.onAttrChange=function(t,n,i){if(r.prototype.onAttrChange.call(this,t,n,i),t==="matrix"){var a=this.getTotalMatrix();this._applyChildrenMarix(a)}},e.prototype.applyMatrix=function(t){var n=this.getTotalMatrix();r.prototype.applyMatrix.call(this,t);var i=this.getTotalMatrix();i!==n&&this._applyChildrenMarix(i)},e.prototype._applyChildrenMarix=function(t){var n=this.getChildren();ye(n,function(i){i.applyMatrix(t)})},e.prototype.addShape=function(){for(var t=[],n=0;n=0;s--){var u=t[s];if(pg(u)&&(u.isGroup()?o=u.getShape(n,i,a):u.isHit(n,i)&&(o=u)),o)break}return o},e.prototype.add=function(t){var n=this.getCanvas(),i=this.getChildren(),a=this.get("timeline"),o=t.getParent();o&&PG(o,t),t.set("parent",this),n&&e2(t,n),a&&t2(t,a),i.push(t),t.onCanvasChange("add"),this._applyElementMatrix(t)},e.prototype._applyElementMatrix=function(t){var n=this.getTotalMatrix();n&&t.applyMatrix(n)},e.prototype.getChildren=function(){return this.get("children")||[]},e.prototype.sort=function(){var t=this.getChildren();ye(t,function(n,i){return n[yg]=i,n}),t.sort(RG(function(n,i){return n.get("zIndex")-i.get("zIndex")})),this.onCanvasChange("sort")},e.prototype.clear=function(){if(this.set("clearing",!0),!this.destroyed){for(var t=this.getChildren(),n=t.length-1;n>=0;n--)t[n].destroy();this.set("children",[]),this.onCanvasChange("clear"),this.set("clearing",!1)}},e.prototype.destroy=function(){this.get("destroyed")||(this.clear(),r.prototype.destroy.call(this))},e.prototype.getFirst=function(){return this.getChildByIndex(0)},e.prototype.getLast=function(){var t=this.getChildren();return this.getChildByIndex(t.length-1)},e.prototype.getChildByIndex=function(t){var n=this.getChildren();return n[t]},e.prototype.getCount=function(){var t=this.getChildren();return t.length},e.prototype.contain=function(t){var n=this.getChildren();return n.indexOf(t)>-1},e.prototype.removeChild=function(t,n){n===void 0&&(n=!0),this.contain(t)&&t.remove(n)},e.prototype.findAll=function(t){var n=[],i=this.getChildren();return ye(i,function(a){t(a)&&n.push(a),a.isGroup()&&(n=n.concat(a.findAll(t)))}),n},e.prototype.find=function(t){var n=null,i=this.getChildren();return ye(i,function(a){if(t(a)?n=a:a.isGroup()&&(n=a.find(t)),n)return!1}),n},e.prototype.findById=function(t){return this.find(function(n){return n.get("id")===t})},e.prototype.findByClassName=function(t){return this.find(function(n){return n.get("className")===t})},e.prototype.findAllByName=function(t){return this.findAll(function(n){return n.get("name")===t})},e}(QE),Ws=0,yf=0,mf=0,n2=1e3,nh,bf,ih=0,Yo=0,ah=0,xf=typeof performance=="object"&&performance.now?performance:Date,i2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function a2(){return Yo||(i2(BG),Yo=xf.now()+ah)}function BG(){Yo=0}function mg(){this._call=this._time=this._next=null}mg.prototype=o2.prototype={constructor:mg,restart:function(r,e,t){if(typeof r!="function")throw new TypeError("callback is not a function");t=(t==null?a2():+t)+(e==null?0:+e),!this._next&&bf!==this&&(bf?bf._next=this:nh=this,bf=this),this._call=r,this._time=t,bg()},stop:function(){this._call&&(this._call=null,this._time=1/0,bg())}};function o2(r,e,t){var n=new mg;return n.restart(r,e,t),n}function FG(){a2(),++Ws;for(var r=nh,e;r;)(e=Yo-r._time)>=0&&r._call.call(null,e),r=r._next;--Ws}function s2(){Yo=(ih=xf.now())+ah,Ws=yf=0;try{FG()}finally{Ws=0,zG(),Yo=0}}function GG(){var r=xf.now(),e=r-ih;e>n2&&(ah-=e,ih=r)}function zG(){for(var r,e=nh,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:nh=t);bf=r,bg(n)}function bg(r){if(!Ws){yf&&(yf=clearTimeout(yf));var e=r-Yo;e>24?(r<1/0&&(yf=setTimeout(s2,r-xf.now()-ah)),mf&&(mf=clearInterval(mf))):(mf||(ih=xf.now(),mf=setInterval(GG,n2)),Ws=1,i2(s2))}}function xg(r,e,t){r.prototype=e.prototype=t,t.constructor=r}function u2(r,e){var t=Object.create(r.prototype);for(var n in e)t[n]=e[n];return t}function wf(){}var Ef=.7,oh=1/Ef,Vs="\\s*([+-]?\\d+)\\s*",_f="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$G=/^#([0-9a-f]{3,8})$/,jG=new RegExp(`^rgb\\(${Vs},${Vs},${Vs}\\)$`),UG=new RegExp(`^rgb\\(${Zi},${Zi},${Zi}\\)$`),XG=new RegExp(`^rgba\\(${Vs},${Vs},${Vs},${_f}\\)$`),YG=new RegExp(`^rgba\\(${Zi},${Zi},${Zi},${_f}\\)$`),WG=new RegExp(`^hsl\\(${_f},${Zi},${Zi}\\)$`),VG=new RegExp(`^hsla\\(${_f},${Zi},${Zi},${_f}\\)$`),f2={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};xg(wf,Sf,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:l2,formatHex:l2,formatHex8:HG,formatHsl:qG,formatRgb:c2,toString:c2});function l2(){return this.rgb().formatHex()}function HG(){return this.rgb().formatHex8()}function qG(){return g2(this).formatHsl()}function c2(){return this.rgb().formatRgb()}function Sf(r){var e,t;return r=(r+"").trim().toLowerCase(),(e=$G.exec(r))?(t=e[1].length,e=parseInt(e[1],16),t===6?h2(e):t===3?new Dn(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?sh(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?sh(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=jG.exec(r))?new Dn(e[1],e[2],e[3],1):(e=UG.exec(r))?new Dn(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=XG.exec(r))?sh(e[1],e[2],e[3],e[4]):(e=YG.exec(r))?sh(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=WG.exec(r))?p2(e[1],e[2]/100,e[3]/100,1):(e=VG.exec(r))?p2(e[1],e[2]/100,e[3]/100,e[4]):f2.hasOwnProperty(r)?h2(f2[r]):r==="transparent"?new Dn(NaN,NaN,NaN,0):null}function h2(r){return new Dn(r>>16&255,r>>8&255,r&255,1)}function sh(r,e,t,n){return n<=0&&(r=e=t=NaN),new Dn(r,e,t,n)}function ZG(r){return r instanceof wf||(r=Sf(r)),r?(r=r.rgb(),new Dn(r.r,r.g,r.b,r.opacity)):new Dn}function wg(r,e,t,n){return arguments.length===1?ZG(r):new Dn(r,e,t,n??1)}function Dn(r,e,t,n){this.r=+r,this.g=+e,this.b=+t,this.opacity=+n}xg(Dn,wg,u2(wf,{brighter(r){return r=r==null?oh:Math.pow(oh,r),new Dn(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Ef:Math.pow(Ef,r),new Dn(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Dn(Wo(this.r),Wo(this.g),Wo(this.b),uh(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:d2,formatHex:d2,formatHex8:KG,formatRgb:v2,toString:v2}));function d2(){return`#${Vo(this.r)}${Vo(this.g)}${Vo(this.b)}`}function KG(){return`#${Vo(this.r)}${Vo(this.g)}${Vo(this.b)}${Vo((isNaN(this.opacity)?1:this.opacity)*255)}`}function v2(){const r=uh(this.opacity);return`${r===1?"rgb(":"rgba("}${Wo(this.r)}, ${Wo(this.g)}, ${Wo(this.b)}${r===1?")":`, ${r})`}`}function uh(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Wo(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Vo(r){return r=Wo(r),(r<16?"0":"")+r.toString(16)}function p2(r,e,t,n){return n<=0?r=e=t=NaN:t<=0||t>=1?r=e=NaN:e<=0&&(r=NaN),new _i(r,e,t,n)}function g2(r){if(r instanceof _i)return new _i(r.h,r.s,r.l,r.opacity);if(r instanceof wf||(r=Sf(r)),!r)return new _i;if(r instanceof _i)return r;r=r.rgb();var e=r.r/255,t=r.g/255,n=r.b/255,i=Math.min(e,t,n),a=Math.max(e,t,n),o=NaN,s=a-i,u=(a+i)/2;return s?(e===a?o=(t-n)/s+(t0&&u<1?0:o,new _i(o,s,u,r.opacity)}function QG(r,e,t,n){return arguments.length===1?g2(r):new _i(r,e,t,n??1)}function _i(r,e,t,n){this.h=+r,this.s=+e,this.l=+t,this.opacity=+n}xg(_i,QG,u2(wf,{brighter(r){return r=r==null?oh:Math.pow(oh,r),new _i(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Ef:Math.pow(Ef,r),new _i(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,e=isNaN(r)||isNaN(this.s)?0:this.s,t=this.l,n=t+(t<.5?t:1-t)*e,i=2*t-n;return new Dn(Eg(r>=240?r-240:r+120,i,n),Eg(r,i,n),Eg(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new _i(y2(this.h),fh(this.s),fh(this.l),uh(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 r=uh(this.opacity);return`${r===1?"hsl(":"hsla("}${y2(this.h)}, ${fh(this.s)*100}%, ${fh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function y2(r){return r=(r||0)%360,r<0?r+360:r}function fh(r){return Math.max(0,Math.min(1,r||0))}function Eg(r,e,t){return(r<60?e+(t-e)*r/60:r<180?t:r<240?e+(t-e)*(240-r)/60:e)*255}const _g=r=>()=>r;function JG(r,e){return function(t){return r+t*e}}function e6(r,e,t){return r=Math.pow(r,t),e=Math.pow(e,t)-r,t=1/t,function(n){return Math.pow(r+n*e,t)}}function t6(r){return(r=+r)==1?m2:function(e,t){return t-e?e6(e,t,r):_g(isNaN(e)?t:e)}}function m2(r,e){var t=e-r;return t?JG(r,t):_g(isNaN(r)?e:r)}const b2=function r(e){var t=t6(e);function n(i,a){var o=t((i=wg(i)).r,(a=wg(a)).r),s=t(i.g,a.g),u=t(i.b,a.b),f=m2(i.opacity,a.opacity);return function(l){return i.r=o(l),i.g=s(l),i.b=u(l),i.opacity=f(l),i+""}}return n.gamma=r,n}(1);function x2(r,e){e||(e=[]);var t=r?Math.min(e.length,r.length):0,n=e.slice(),i;return function(a){for(i=0;it&&(a=e.slice(t,a),s[o]?s[o]+=a:s[++o]=a),(n=n[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,u.push({i:o,x:Sg(n,i)})),t=Cg.lastIndex;return tf.length?(u=Ys(a[s]),f=Ys(i[s]),f=zE(f,u),f=vg(f,u),e.fromAttrs.path=f,e.toAttrs.path=u):e.pathFormatted||(u=Ys(a[s]),f=Ys(i[s]),f=vg(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()){i=n.get("animations");for(var u=i.length-1;u>=0;u--)a=i[u],t=$6(n,a,o),t&&(i.splice(u,1),t=!1,a.callback&&a.callback())}i.length===0&&e.removeAnimator(s)}var f=e.canvas.get("autoDraw");f||e.canvas.draw()}})},r.prototype.addAnimator=function(e){this.animators.push(e)},r.prototype.removeAnimator=function(e){this.animators.splice(e,1)},r.prototype.isAnimating=function(){return!!this.animators.length},r.prototype.stop=function(){this.timer&&this.timer.stop()},r.prototype.stopAllAnimations=function(e){e===void 0&&(e=!0),this.animators.forEach(function(t){t.stopAnimate(e)}),this.animators=[],this.canvas.draw()},r.prototype.getTime=function(){return this.current},r}(),U6=40,D2=0,P2=["mousedown","mouseup","dblclick","mouseout","mouseover","mousemove","mouseleave","mouseenter","touchstart","touchmove","touchend","dragenter","dragover","dragleave","drop","contextmenu","mousewheel"];function R2(r,e,t){t.name=e,t.target=r,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}function X6(r,e,t){if(t.bubbles){var n=void 0,i=!1;if(e==="mouseenter"?(n=t.fromShape,i=!0):e==="mouseleave"&&(i=!0,n=t.toShape),r.isCanvas()&&i)return;if(n&&YE(r,n)){t.bubbles=!1;return}t.name=e,t.currentTarget=r,t.delegateTarget=r,r.emit(e,t)}}var Y6=function(){function r(e){var t=this;this.draggingShape=null,this.dragging=!1,this.currentShape=null,this.mousedownShape=null,this.mousedownPoint=null,this._eventCallback=function(n){var i=n.type;t._triggerEvent(i,n)},this._onDocumentMove=function(n){var i=t.canvas,a=i.get("el");if(a!==n.target&&(t.dragging||t.currentShape)){var o=t._getPointInfo(n);t.dragging&&t._emitEvent("drag",n,o,t.draggingShape)}},this._onDocumentMouseUp=function(n){var i=t.canvas,a=i.get("el");if(a!==n.target&&t.dragging){var o=t._getPointInfo(n);t.draggingShape&&t._emitEvent("drop",n,o,null),t._emitEvent("dragend",n,o,t.draggingShape),t._afterDrag(t.draggingShape,o,n)}},this.canvas=e.canvas}return r.prototype.init=function(){this._bindEvents()},r.prototype._bindEvents=function(){var e=this,t=this.canvas.get("el");ye(P2,function(n){t.addEventListener(n,e._eventCallback)}),document&&(document.addEventListener("mousemove",this._onDocumentMove),document.addEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._clearEvents=function(){var e=this,t=this.canvas.get("el");ye(P2,function(n){t.removeEventListener(n,e._eventCallback)}),document&&(document.removeEventListener("mousemove",this._onDocumentMove),document.removeEventListener("mouseup",this._onDocumentMouseUp))},r.prototype._getEventObj=function(e,t,n,i,a,o){var s=new jE(e,t);return s.fromShape=a,s.toShape=o,s.x=n.x,s.y=n.y,s.clientX=n.clientX,s.clientY=n.clientY,s.propagationPath.push(i),s},r.prototype._getShape=function(e,t){return this.canvas.getShape(e.x,e.y,t)},r.prototype._getPointInfo=function(e){var t=this.canvas,n=t.getClientByEvent(e),i=t.getPointByEvent(e);return{x:i.x,y:i.y,clientX:n.x,clientY:n.y}},r.prototype._triggerEvent=function(e,t){var n=this._getPointInfo(t),i=this._getShape(n,t),a=this["_on"+e],o=!1;if(a)a.call(this,n,i,t);else{var s=this.currentShape;e==="mouseenter"||e==="dragenter"||e==="mouseover"?(this._emitEvent(e,t,n,null,null,i),i&&this._emitEvent(e,t,n,i,null,i),e==="mouseenter"&&this.draggingShape&&this._emitEvent("dragenter",t,n,null)):e==="mouseleave"||e==="dragleave"||e==="mouseout"?(o=!0,s&&this._emitEvent(e,t,n,s,s,null),this._emitEvent(e,t,n,null,s,null),e==="mouseleave"&&this.draggingShape&&this._emitEvent("dragleave",t,n,null)):this._emitEvent(e,t,n,i,null,null)}if(o||(this.currentShape=i),i&&!i.get("destroyed")){var u=this.canvas,f=u.get("el");f.style.cursor=i.attr("cursor")||u.get("cursor")}},r.prototype._onmousedown=function(e,t,n){n.button===D2&&(this.mousedownShape=t,this.mousedownPoint=e,this.mousedownTimeStamp=n.timeStamp),this._emitEvent("mousedown",n,e,t,null,null)},r.prototype._emitMouseoverEvents=function(e,t,n,i){var a=this.canvas.get("el");n!==i&&(n&&(this._emitEvent("mouseout",e,t,n,n,i),this._emitEvent("mouseleave",e,t,n,n,i),(!i||i.get("destroyed"))&&(a.style.cursor=this.canvas.get("cursor"))),i&&(this._emitEvent("mouseover",e,t,i,n,i),this._emitEvent("mouseenter",e,t,i,n,i)))},r.prototype._emitDragoverEvents=function(e,t,n,i,a){i?(i!==n&&(n&&this._emitEvent("dragleave",e,t,n,n,i),this._emitEvent("dragenter",e,t,i,n,i)),a||this._emitEvent("dragover",e,t,i)):n&&this._emitEvent("dragleave",e,t,n,n,i),a&&this._emitEvent("dragover",e,t,i)},r.prototype._afterDrag=function(e,t,n){e&&(e.set("capture",!0),this.draggingShape=null),this.dragging=!1;var i=this._getShape(t,n);i!==e&&this._emitMouseoverEvents(n,t,e,i),this.currentShape=i},r.prototype._onmouseup=function(e,t,n){if(n.button===D2){var i=this.draggingShape;this.dragging?(i&&this._emitEvent("drop",n,e,t),this._emitEvent("dragend",n,e,i),this._afterDrag(i,e,n)):(this._emitEvent("mouseup",n,e,t),t===this.mousedownShape&&this._emitEvent("click",n,e,t),this.mousedownShape=null,this.mousedownPoint=null)}},r.prototype._ondragover=function(e,t,n){n.preventDefault();var i=this.currentShape;this._emitDragoverEvents(n,e,i,t,!0)},r.prototype._onmousemove=function(e,t,n){var i=this.canvas,a=this.currentShape,o=this.draggingShape;if(this.dragging)o&&this._emitDragoverEvents(n,e,a,t,!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>U6?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&&i.get("draggable")?(this.dragging=!0,this._emitEvent("dragstart",n,e,null),this.mousedownShape=null,this.mousedownPoint=null):(this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t)):(this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t))}else this._emitMouseoverEvents(n,e,a,t),this._emitEvent("mousemove",n,e,t)}},r.prototype._emitEvent=function(e,t,n,i,a,o){var s=this._getEventObj(e,t,n,i,a,o);if(i){s.shape=i,R2(i,e,s);for(var u=i.getParent();u;)u.emitDelegation(e,s),s.propagationStopped||X6(u,e,s),s.propagationPath.push(u),u=u.getParent()}else{var f=this.canvas;R2(f,e,s)}},r.prototype.destroy=function(){this._clearEvents(),this.canvas=null,this.currentShape=null,this.draggingShape=null,this.mousedownPoint=null,this.mousedownShape=null,this.mousedownTimeStamp=null},r}(),B2="px",F2=qE(),W6=F2&&F2.name==="firefox",G2=function(r){It(e,r);function e(t){var n=r.call(this,t)||this;return n.initContainer(),n.initDom(),n.initEvents(),n.initTimeline(),n}return e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.cursor="default",t.supportCSSTransform=!1,t},e.prototype.initContainer=function(){var t=this.get("container");Pe(t)&&(t=document.getElementById(t),this.set("container",t))},e.prototype.initDom=function(){var t=this.createDom();this.set("el",t);var n=this.get("container");n.appendChild(t),this.setDOMSize(this.get("width"),this.get("height"))},e.prototype.initEvents=function(){var t=new Y6({canvas:this});t.init(),this.set("eventController",t)},e.prototype.initTimeline=function(){var t=new j6(this);this.set("timeline",t)},e.prototype.setDOMSize=function(t,n){var i=this.get("el");XE&&(i.style.width=t+B2,i.style.height=n+B2)},e.prototype.changeSize=function(t,n){this.setDOMSize(t,n),this.set("width",t),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(t){this.set("cursor",t);var n=this.get("el");XE&&n&&(n.style.cursor=t)},e.prototype.getPointByEvent=function(t){var n=this.get("supportCSSTransform");if(n){if(W6&&!ct(t.layerX)&&t.layerX!==t.offsetX)return{x:t.layerX,y:t.layerY};if(!ct(t.offsetX))return{x:t.offsetX,y:t.offsetY}}var i=this.getClientByEvent(t),a=i.x,o=i.y;return this.getPointByClient(a,o)},e.prototype.getClientByEvent=function(t){var n=t;return t.touches&&(t.type==="touchend"?n=t.changedTouches[0]:n=t.touches[0]),{x:n.clientX,y:n.clientY}},e.prototype.getPointByClient=function(t,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:t-a.left,y:n-a.top}},e.prototype.getClientByPoint=function(t,n){var i=this.get("el"),a=i.getBoundingClientRect();return{x:t+a.left,y:n+a.top}},e.prototype.draw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.parentNode.removeChild(t)},e.prototype.clearEvents=function(){var t=this.get("eventController");t.destroy()},e.prototype.isCanvas=function(){return!0},e.prototype.getParent=function(){return null},e.prototype.destroy=function(){var t=this.get("timeline");this.get("destroyed")||(this.clear(),t&&t.stop(),this.clearEvents(),this.removeDom(),r.prototype.destroy.call(this))},e}(r2),z2=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.isGroup=function(){return!0},e.prototype.isEntityGroup=function(){return!1},e.prototype.clone=function(){for(var t=r.prototype.clone.call(this),n=this.getChildren(),i=0;i=t&&i.minY<=n&&i.maxY>=n},e.prototype.afterAttrsChange=function(t){r.prototype.afterAttrsChange.call(this,t),this.clearCacheBBox()},e.prototype.getBBox=function(){var t=this.cfg.bbox;return t||(t=this.calculateBBox(),this.set("bbox",t)),t},e.prototype.getCanvasBBox=function(){var t=this.cfg.canvasBBox;return t||(t=this.calculateCanvasBBox(),this.set("canvasBBox",t)),t},e.prototype.applyMatrix=function(t){r.prototype.applyMatrix.call(this,t),this.set("canvasBBox",null)},e.prototype.calculateCanvasBBox=function(){var t=this.getBBox(),n=this.getTotalMatrix(),i=t.minX,a=t.minY,o=t.maxX,s=t.maxY;if(n){var u=Xo(n,[t.minX,t.minY]),f=Xo(n,[t.maxX,t.minY]),l=Xo(n,[t.minX,t.maxY]),c=Xo(n,[t.maxX,t.maxY]);i=Math.min(u[0],f[0],l[0],c[0]),o=Math.max(u[0],f[0],l[0],c[0]),a=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=i-v+g,x=o+v+g,w=a-v+m,E=s+v+m;i=Math.min(i,b),o=Math.max(o,x),a=Math.min(a,w),s=Math.max(s,E)}return{x:i,y:a,minX:i,minY:a,maxX:o,maxY:s,width:o-i,height:s-a}},e.prototype.clearCacheBBox=function(){this.set("bbox",null),this.set("canvasBBox",null)},e.prototype.isClipShape=function(){return this.get("isClipShape")},e.prototype.isInShape=function(t,n){return!1},e.prototype.isOnlyHitBox=function(){return!1},e.prototype.isHit=function(t,n){var i=this.get("startArrowShape"),a=this.get("endArrowShape"),o=[t,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)||i&&i.isHit(s,u)||a&&a.isHit(s,u)))},e}(QE),j2=new Map;function Ki(r,e){j2.set(r,e)}function U2(r){return j2.get(r)}function X2(r){var e=r.attr(),t=e.x,n=e.y,i=e.width,a=e.height;return{x:t,y:n,width:i,height:a}}function Y2(r){var e=r.attr(),t=e.x,n=e.y,i=e.r;return{x:t-i,y:n-i,width:i*2,height:i*2}}function Cn(r,e,t,n){var i=r-t,a=e-n;return Math.sqrt(i*i+a*a)}function hh(r,e){return Math.abs(r-e)<.001}function qs(r,e){var t=Ui(r),n=Ui(e),i=ji(r),a=ji(e);return{x:t,y:n,width:i-t,height:a-n}}function dh(r){return(r+Math.PI*2)%(Math.PI*2)}const dn={box:function(r,e,t,n){return qs([r,t],[e,n])},length:function(r,e,t,n){return Cn(r,e,t,n)},pointAt:function(r,e,t,n,i){return{x:(1-i)*r+i*t,y:(1-i)*e+i*n}},pointDistance:function(r,e,t,n,i,a){var o=(t-r)*(i-r)+(n-e)*(a-e);if(o<0)return Cn(r,e,i,a);var s=(t-r)*(t-r)+(n-e)*(n-e);return o>s?Cn(t,n,i,a):this.pointToLine(r,e,t,n,i,a)},pointToLine:function(r,e,t,n,i,a){var o=[t-r,n-e];if(zp(o,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-e)*(a-e));var s=[-o[1],o[0]];to(s,s);var u=[i-r,a-e];return Math.abs(Gp(u,s))},tangentAngle:function(r,e,t,n){return Math.atan2(n-e,t-r)}};var V6=1e-4;function W2(r,e,t,n,i,a){var o,s=1/0,u=[t,n],f=20;a&&a>200&&(f=a/10);for(var l=1/f,c=l/10,h=0;h<=f;h++){var d=h*l,v=[i.apply(null,r.concat([d])),i.apply(null,e.concat([d]))],p=Cn(u[0],u[1],v[0],v[1]);p=0&&p=0?[i]:[]}function H2(r,e,t,n){return 2*(1-n)*(e-r)+2*n*(t-e)}function q2(r,e,t,n,i,a,o){var s=ao(r,t,i,o),u=ao(e,n,a,o),f=dn.pointAt(r,e,t,n,o),l=dn.pointAt(t,n,i,a,o);return[[r,e,f.x,f.y,s,u],[s,u,l.x,l.y,i,a]]}function Ng(r,e,t,n,i,a,o){if(o===0)return(Cn(r,e,t,n)+Cn(t,n,i,a)+Cn(r,e,i,a))/2;var s=q2(r,e,t,n,i,a,.5),u=s[0],f=s[1];return u.push(o-1),f.push(o-1),Ng.apply(null,u)+Ng.apply(null,f)}const Z2={box:function(r,e,t,n,i,a){var o=V2(r,t,i)[0],s=V2(e,n,a)[0],u=[r,i],f=[e,a];return o!==void 0&&u.push(ao(r,t,i,o)),s!==void 0&&f.push(ao(e,n,a,s)),qs(u,f)},length:function(r,e,t,n,i,a){return Ng(r,e,t,n,i,a,3)},nearestPoint:function(r,e,t,n,i,a,o,s){return W2([r,t,i],[e,n,a],o,s,ao)},pointDistance:function(r,e,t,n,i,a,o,s){var u=this.nearestPoint(r,e,t,n,i,a,o,s);return Cn(u.x,u.y,o,s)},interpolationAt:ao,pointAt:function(r,e,t,n,i,a,o){return{x:ao(r,t,i,o),y:ao(e,n,a,o)}},divide:function(r,e,t,n,i,a,o){return q2(r,e,t,n,i,a,o)},tangentAngle:function(r,e,t,n,i,a,o){var s=H2(r,t,i,o),u=H2(e,n,a,o),f=Math.atan2(u,s);return dh(f)}};function oo(r,e,t,n,i){var a=1-i;return a*a*a*r+3*e*i*a*a+3*t*i*i*a+n*i*i*i}function K2(r,e,t,n,i){var a=1-i;return 3*(a*a*(e-r)+2*a*i*(t-e)+i*i*(n-t))}function Og(r,e,t,n){var i=-3*r+9*e-9*t+3*n,a=6*r-12*e+6*t,o=3*e-3*r,s=[],u,f,l;if(hh(i,0))hh(a,0)||(u=-o/a,u>=0&&u<=1&&s.push(u));else{var c=a*a-4*i*o;hh(c,0)?s.push(-a/(2*i)):c>0&&(l=Math.sqrt(c),u=(-a+l)/(2*i),f=(-a-l)/(2*i),u>=0&&u<=1&&s.push(u),f>=0&&f<=1&&s.push(f))}return s}function Q2(r,e,t,n,i,a,o,s,u){var f=oo(r,t,i,o,u),l=oo(e,n,a,s,u),c=dn.pointAt(r,e,t,n,u),h=dn.pointAt(t,n,i,a,u),d=dn.pointAt(i,a,o,s,u),v=dn.pointAt(c.x,c.y,h.x,h.y,u),p=dn.pointAt(h.x,h.y,d.x,d.y,u);return[[r,e,c.x,c.y,v.x,v.y,f,l],[f,l,p.x,p.y,d.x,d.y,o,s]]}function Dg(r,e,t,n,i,a,o,s,u){if(u===0)return H6([r,t,i,o],[e,n,a,s]);var f=Q2(r,e,t,n,i,a,o,s,.5),l=f[0],c=f[1];return l.push(u-1),c.push(u-1),Dg.apply(null,l)+Dg.apply(null,c)}const Cf={extrema:Og,box:function(r,e,t,n,i,a,o,s){for(var u=[r,o],f=[e,s],l=Og(r,t,i,o),c=Og(e,n,a,s),h=0;h0?t:t*-1}const q6={box:function(r,e,t,n){return{x:r-t,y:e-n,width:t*2,height:n*2}},length:function(r,e,t,n){return Math.PI*(3*(t+n)-Math.sqrt((3*t+n)*(t+3*n)))},nearestPoint:function(r,e,t,n,i,a){var o=t,s=n;if(o===0||s===0)return{x:r,y:e};for(var u=i-r,f=a-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,x=p-m,w=g-b,E=l-m,_=c-b,M=Math.hypot(w,x),C=Math.hypot(_,E),S=M*Math.asin((x*_-w*E)/(M*C)),A=S/Math.sqrt(h+d-p*p-g*g);v+=A,v=Math.min(Math.PI/2,Math.max(0,v))}return{x:r+J2(p,u),y:e+J2(g,f)}},pointDistance:function(r,e,t,n,i,a){var o=this.nearestPoint(r,e,t,n,i,a);return Cn(o.x,o.y,i,a)},pointAt:function(r,e,t,n,i){var a=2*Math.PI*i;return{x:r+t*Math.cos(a),y:e+n*Math.sin(a)}},tangentAngle:function(r,e,t,n,i){var a=2*Math.PI*i,o=Math.atan2(n*Math.cos(a),-t*Math.sin(a));return dh(o)}};function Z6(r,e,t,n,i,a,o,s){return-1*t*Math.cos(i)*Math.sin(s)-n*Math.sin(i)*Math.cos(s)}function K6(r,e,t,n,i,a,o,s){return-1*t*Math.sin(i)*Math.sin(s)+n*Math.cos(i)*Math.cos(s)}function Q6(r,e,t){return Math.atan(-e/r*Math.tan(t))}function J6(r,e,t){return Math.atan(e/(r*Math.tan(t)))}function e_(r,e,t,n,i,a){return t*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function t_(r,e,t,n,i,a){return t*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+e}function ez(r,e,t,n){var i=Math.atan2(n*r,t*e);return(i+Math.PI*2)%(Math.PI*2)}function r_(r,e,t){return{x:r*Math.cos(t),y:e*Math.sin(t)}}function n_(r,e,t){var n=Math.cos(t),i=Math.sin(t);return[r*n-e*i,r*i+e*n]}const tz={box:function(r,e,t,n,i,a,o){for(var s=Q6(t,n,i),u=1/0,f=-1/0,l=[a,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var h=s+c;af&&(f=d)}for(var v=J6(t,n,i),p=1/0,g=-1/0,y=[a,o],c=-Math.PI*2;c<=Math.PI*2;c+=Math.PI){var m=v+c;ag&&(g=b)}return{x:u,y:p,width:f-u,height:g-p}},length:function(r,e,t,n,i,a,o){},nearestPoint:function(r,e,t,n,i,a,o,s,u){var f=n_(s-r,u-e,-i),l=f[0],c=f[1],h=q6.nearestPoint(0,0,t,n,l,c),d=ez(t,n,h.x,h.y);do&&(h=r_(t,n,o));var v=n_(h.x,h.y,i);return{x:v[0]+r,y:v[1]+e}},pointDistance:function(r,e,t,n,i,a,o,s,u){var f=this.nearestPoint(r,e,t,n,s,u);return Cn(f.x,f.y,s,u)},pointAt:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a;return{x:e_(r,e,t,n,i,u),y:t_(r,e,t,n,i,u)}},tangentAngle:function(r,e,t,n,i,a,o,s){var u=(o-a)*s+a,f=Z6(r,e,t,n,i,a,o,u),l=K6(r,e,t,n,i,a,o,u);return dh(Math.atan2(l,f))}};function i_(r){for(var e=0,t=[],n=0;n1||e<0||r.length<2)return null;var t=i_(r),n=t.segments,i=t.totalLength;if(i===0)return{x:r[0][0],y:r[0][1]};for(var a=0,o=null,s=0;s=a&&e<=a+c){var h=(e-a)/c;o=dn.pointAt(f[0],f[1],l[0],l[1],h);break}a+=c}return o}function iz(r,e){if(e>1||e<0||r.length<2)return 0;for(var t=i_(r),n=t.segments,i=t.totalLength,a=0,o=0,s=0;s=a&&e<=a+c){o=Math.atan2(l[1]-f[1],l[0]-f[0]);break}a+=c}return o}function az(r,e,t){for(var n=1/0,i=0;i1){var i=uz(e,t);return e*n+i*(n-1)}return e}function uz(r,e){return e?e-r:r*.14}function fz(r,e){var t=s_(),n=0;if(ct(r)||r==="")return n;if(t.save(),t.font=e,Pe(r)&&r.includes(` `)){var i=r.split(` `);ye(i,function(a){var o=t.measureText(a).width;n1){var i=t[0].charAt(0);t.splice(1,0,t[0].substr(1)),t[0]=i}ye(t,function(a,o){isNaN(a)||(t[o]=+a)}),e[n]=t}),e}function vz(r,e,t,n){var i=[],a=!!n,o,s,u,f,l,c,h;if(a){u=n[0],f=n[1];for(var d=0,v=r.length;d2&&(t.push([i].concat(o.splice(0,2))),s="l",i=i==="m"?"l":"L"),s==="o"&&o.length===1&&t.push([i,o[0]]),s==="r")t.push([i].concat(o));else for(;o.length>=e[s]&&(t.push([i].concat(o.splice(0,e[s]))),!!e[s]););return""}),t}var yz=/[a-z]/;function c_(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function h_(r){var e=Bg(r);if(!e||!e.length)return[["M",0,0]];for(var t=!1,n=0;n=0){t=!0;break}}if(!t)return e;var a=[],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++,a[0]=["M",o,s]);for(var n=l,h=e.length;n1&&(t*=Math.sqrt(d),n*=Math.sqrt(d));var v=t*t*(h*h)+n*n*(c*c),p=v?Math.sqrt((t*t*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*t*h/n:0,y=t?p*-n*c/t:0,m=(s+f)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,x=[(c-g)/t,(h-y)/n],w=[(-1*c-g)/t,(-1*h-y)/n],E=d_([1,0],x),_=d_(x,w);return Fg(x,w)<=-1&&(_=Math.PI),Fg(x,w)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:Gg(r,[f,l])?0:t,ry:Gg(r,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:i,arcFlag:a,sweepFlag:o}}function v_(r,e){return[e[0]+(e[0]-r[0]),e[1]+(e[1]-r[1])]}function p_(r){r=dz(r);for(var e=[],t=null,n=null,i=null,a=0,o=r.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 xz(r){var e=r.attr(),t=e.path,n=e.stroke,i=n?e.lineWidth:0,a=r.get("segments")||p_(t),o=bz(a,i),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=Pg(r,c),{x:c.minX,y:c.minY,width:c.maxX-c.minX,height:c.maxY-c.minY}}function wz(r){var e=r.attr(),t=e.x1,n=e.y1,i=e.x2,a=e.y2,o=Math.min(t,i),s=Math.max(t,i),u=Math.min(n,a),f=Math.max(n,a),l={minX:o,maxX:s,minY:u,maxY:f};return l=Pg(r,l),{x:l.minX,y:l.minY,width:l.maxX-l.minX,height:l.maxY-l.minY}}function Ez(r){var e=r.attr(),t=e.x,n=e.y,i=e.rx,a=e.ry;return{x:t-i,y:n-a,width:i*2,height:a*2}}Ki("rect",X2),Ki("image",X2),Ki("circle",Y2),Ki("marker",Y2),Ki("polyline",oz),Ki("polygon",sz),Ki("text",lz),Ki("path",xz),Ki("line",wz),Ki("ellipse",Ez);var _z=function(r){It(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.item=n.item,i.canvasX=n.canvasX,i.canvasY=n.canvasY,i.wheelDelta=n.wheelDelta,i.detail=n.detail,i}return e}(jE),zg=function(e){return"".concat(e,"-").concat(Math.random()).concat(Date.now())},$g=function(e){if(vt(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(ht(e))return[e,e,e,e];if(Pe(e)){var t=parseInt(e,10);return[t,t,t,t]}return[0,0,0,0]},Sz=function(e){var t=new _z(e.type,e);return t.clientX=e.clientX,t.clientY=e.clientY,t.x=e.x,t.y=e.y,t.target=e.target,t.currentTarget=e.currentTarget,t.bubbles=!0,t.item=e.item,t},Mz=function(e){if(!e)return!1;for(var t=9,n=[1,0,0,0,1,0,0,0,1],i=0;in&&(n=c),h>a&&(a=h)}var d=Math.floor(t),v=Math.floor(i),p=Math.ceil(n)-Math.floor(t),g=Math.ceil(a)-Math.floor(i);return{x:d,y:v,width:p,height:g,minX:t,minY:i,maxX:n,maxY:a}},Cz=function(e,t,n,i,a){t===void 0&&(t=15),n===void 0&&(n="quadratic"),i===void 0&&(i=void 0),a===void 0&&(a=void 0);for(var o=e.length,s=t*2,u=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],f={},l=[],c={},h=0;h=0;return t?i?Math.PI*2-n:n:i?n:Math.PI*2-n}so.angleTo=Lz;function Nz(r,e,t){return t?(r[0]=e[1],r[1]=-1*e[0]):(r[0]=-1*e[1],r[1]=e[0]),r}so.vertical=Nz;var Oz=function(){function r(e){this.destroyed=!1,this.graph=e,this.destroyed=!1}return r.prototype.getViewCenter=function(){var e=this.getFormatPadding(),t=this.graph,n=this.graph.get("width"),i=t.get("height");return{x:(n-e[1]-e[3])/2+e[3],y:(i-e[0]-e[2])/2+e[0]}},r.prototype.fitCenter=function(e,t){var n=this.graph,i=n.get("group"),a,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(x){var w=x.getModel(),E=w.x,_=w.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=x_(d,[["t",-a.x,-a.y],["s",y,y],["t",a.x,a.y]]),b=vf({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(t),e.animate(function(x){return{matrix:ng(t,m,x)}},b)}},r.prototype.fitView=function(e,t){var n=this.graph,i=this.getFormatPadding(),a=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(),M=_.x,C=_.y;c>M&&(c=M),h>C&&(h=C),dm&&(b=m),e)this.animatedFitView(s,u,t,f,p,g,b,!0);else{var x=p.x-g.x,w=p.y-g.y;if(Qi(x)||Qi(w))return;n.translate(x,w),n.zoom(b,p)||console.warn("zoom failed, ratio out of range, ratio: %f",b)}}},r.prototype.fitViewByRules=function(e,t,n){var i=e.onlyOutOfViewPort,a=i===void 0?!1:i,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,x=-1/0,w=-1/0;y.forEach(function(O){var G=O.getModel(),D=G.x,$=G.y;m>D&&(m=D),b>$&&(b=$),xc.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,x=m;m>b&&(x=b),n?this.animatedFitView(f,l,i,c,g,y,x,t):(a.translate(g.x-y.x,g.y-y.y),t&&!a.zoom(x,g)&&console.warn("zoom failed, ratio out of range, ratio: %f",x))}}},r.prototype.changeSize=function(e,t){var n=this.graph;if(!ht(e)||!ht(t))throw Error("invalid canvas width & height, please make sure width & height type is number");n.set({width:e,height:t});var i=n.get("canvas");i.changeSize(e,t);var a=n.get("plugins");a.forEach(function(o){o.get("gridContainer")&&o.positionInit()})},r.prototype.destroy=function(){this.graph=null,this.destroyed=!1},r}();function jg(r){"@babel/helpers - typeof";return jg=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},jg(r)}function E_(r){if(typeof r!="string")return r;var e=function(_){if(typeof _!="string")return _;try{return JSON.parse(_.trim())}catch{return _.trim()}},t=e(r);if(typeof t!="string")return t;for(var n=function(_){return _[_.length-1]},i=r.trim(),a=[],o=[],s=function(){for(var _=[],M=0;M=0&&(a.height=o),s>=0&&(a.width=s),i.marginTop&&(a.y+=i.marginTop),i.marginLeft&&(a.x+=i.marginLeft),a}function S_(r,e){var t;e===void 0&&(e={x:0,y:0});var n=B({x:0,y:0,width:0,height:0},e);if(!((t=r.children)===null||t===void 0)&&t.length){var i=r.attrs,a=i===void 0?{}:i,o=a.marginTop,s=B({},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 r.bbox=Rz(r,e,n),r.attrs=B(B({},r.attrs),r.bbox),r}function M_(r,e){var t,n,i,a,o=(r||{}).type,s=((e==null?void 0:e.attrs)||{}).key;if(s&&r&&(r.attrs.key=s),!r&&e)return{action:"delete",val:e,type:o,key:s};if(r&&!e)return{action:"add",val:r,type:o};if(!r&&!e)return{action:"same",type:o};var u=[];if(((t=r.children)===null||t===void 0?void 0:t.length)>0||((n=e.children)===null||n===void 0?void 0:n.length)>0)for(var f=Math.max((i=r.children)===null||i===void 0?void 0:i.length,(a=e.children)===null||a===void 0?void 0:a.length),l=e.children||[],c=r.children||[],h=0;h"u"?i=zg(a):typeof i!="string"&&(i=String(i)),this.get("model").id=i,this.set("id",i);var o=e.group;o&&(o.set("item",this),o.set("id",i)),this.init(),this.draw();var s=n.shape||n.type||(a==="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=gr({},f.stateStyles,l),this.set("styles",l)}}}return r.prototype.calculateBBox=function(){var e=this.get("keyShape"),t=this.get("group"),n=Qc(e,t);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},r.prototype.calculateCanvasBBox=function(){var e=this.get("keyShape"),t=this.get("group"),n=Qc(e,t);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},r.prototype.drawInner=function(){var e=this,t=e.get("shapeFactory"),n=e.get("group"),i=e.get("model");n.clear();var a=i.visible;if(a!==void 0&&!a&&e.changeVisibility(a),!!t){e.updatePosition(i);var o=e.getShapeCfg(i),s=o.type,u=t.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(t,s)}},r.prototype.setOriginStyle=function(){var e=this.get("group"),t=e.get("children"),n=this.getKeyShape(),i=this,a=n.get("name");if(this.get("originStyle")){var d=this.get("originStyle");a&&!d[a]&&(d[a]={});for(var v=this.getCurrentStatesStyle(),p=function(y){var m=t[y],b=m.get("name"),x=m.attr();if(b&&b!==a){var w=v[b];d[b]||(d[b]={}),w?Object.keys(x).forEach(function(M){var C=x[M];C!==w[M]&&(d[b][M]=C)}):d[b]=m.get("type")!=="image"?Vt(x):i.getShapeStyleByName(b)}else{var E=m.attr(),_={};Object.keys(v).forEach(function(M){var C=v[M];(M===a||!fn(C))&&(_[M]=C)}),Object.keys(E).forEach(function(M){var C=E[M];_[M]!==C&&(a?d[a][M]=C:d[M]=C)})}},s=0;s-1)return;n.push(a)}else u>-1&&n.splice(u,1)}else if(Pe(t)){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(a),this.set("states",s)}if(i){var l=this.get("model"),c=l.type;i.setState(c,e,t,this)}},r.prototype.clearStates=function(e){var t=this,n=t.getStates(),i=t.get("shapeFactory"),a=t.get("model"),o=a.type;e||(e=n),Pe(e)&&(e=[e]);var s=n.filter(function(u){return e.indexOf(u)===-1});t.set("states",s),e.forEach(function(u){i.setState(o,u,!1,t)})},r.prototype.setOptimize=function(e){this.optimize=e},r.prototype.getContainer=function(){return this.get("group")},r.prototype.getKeyShape=function(){return this.get("keyShape")},r.prototype.getModel=function(){return this.get("model")},r.prototype.getType=function(){return this.get("type")},r.prototype.getID=function(){return this.get("id")},r.prototype.isItem=function(){return!0},r.prototype.getStates=function(){return this.get("states")},r.prototype.hasState=function(e){var t=this.getStates();return t.indexOf(e)>=0},r.prototype.refresh=function(e){var t=this.get("model");this.updatePosition(t),this.updateShape(e),this.afterUpdate(),this.clearCache()},r.prototype.getUpdateType=function(e){},r.prototype.update=function(e,t){t===void 0&&(t=void 0);var n=this.get("model");if(t==="move")this.updatePosition(e);else{var i=n.visible,a=e.visible;i!==a&&a!==void 0&&this.changeVisibility(a);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;gt(s,u),delete e.stateStyles}Object.assign(n,e),(o.x!==e.x||o.y!==e.y)&&this.updatePosition(e),this.updateShape(t)}this.afterUpdate(),this.clearCache()},r.prototype.updateShape=function(e){var t=this.get("shapeFactory"),n=this.get("model"),i=n.type;if(t.shouldUpdate(i)&&i===this.get("currentShape")){var a=this.getShapeCfg(n,e);t.baseUpdate(i,a,this,e),e!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(t,i)},r.prototype.updatePosition=function(e){var t=this.get("model"),n=isNaN(+e.x)?+t.x:+e.x,i=isNaN(+e.y)?+t.y:+e.y,a=this.get("group");if(isNaN(n)||isNaN(i))return!1;t.x=n,t.y=i;var o=a.getMatrix();return o&&o[6]===n&&o[7]===i?!1:(a.resetMatrix(),vE(a,{x:n,y:i}),this.clearCache(),!0)},r.prototype.getBBox=function(){var e=this.get(Yg);return e||(e=this.calculateBBox(),this.set(Yg,e)),e},r.prototype.getCanvasBBox=function(){var e=this.get(Wg);return e||(e=this.calculateCanvasBBox(),this.set(Wg,e)),e},r.prototype.toFront=function(){var e=this.get("group");e.toFront()},r.prototype.toBack=function(){var e=this.get("group");e.toBack()},r.prototype.show=function(){this.changeVisibility(!0)},r.prototype.hide=function(){this.changeVisibility(!1)},r.prototype.changeVisibility=function(e){var t=this.get("group");e?t.show():t.hide(),this.set("visible",e)},r.prototype.isVisible=function(){return this.get("visible")},r.prototype.enableCapture=function(e){var t=this.get("group");t&&t.set("capture",e)},r.prototype.destroy=function(){if(!this.destroyed){var e=this.get("animate"),t=this.get("group");e&&t.stopAnimate(),t.shapeMap={},this.clearCache(),t.remove(),this._cfg=null,this.destroyed=!0}},r}(),gh={source:"start",target:"end"},ta="Node",Zs="Point",Fz="Anchor",I_=function(r){It(e,r);function e(){return r!==null&&r.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(t,n){var i=gh[t]+Zs,a=t+ta,o=this.get(a);o&&!o.destroyed&&o.removeEdge(this),fn(n)?(this.set(i,n),this.set(a,null)):n&&(n.addEdge(this),this.set(a,n),this.set(i,null))},e.prototype.getLinkPoint=function(t,n,i){var a=gh[t]+Zs,o=t+ta,s=this.get(a);if(!s){var u=this.get(o),f=t+Fz,l=this.getPrePoint(t,i),c=n[f];ct(c)||(s=u.getLinkPointByAnchor(c)),s=s||u.getLinkPoint(l),ct(s.index)||this.set("".concat(t,"AnchorIndex"),s.index)}return s},e.prototype.getPrePoint=function(t,n){if(n&&n.length){var i=t==="source"?0:n.length-1;return n[i]}var a=t==="source"?"target":"source";return this.getEndPoint(a)},e.prototype.getEndPoint=function(t){var n=t+ta,i=gh[t]+Zs,a=this.get(n);return a&&!a.destroyed?a.get("model"):this.get(i)},e.prototype.getControlPointsByCenter=function(t){var n=this.getEndPoint("source"),i=this.getEndPoint("target"),a=this.get("shapeFactory"),o=t.type;return a.getControlPoints(o,{startPoint:n,endPoint:i})},e.prototype.getEndCenter=function(t){var n=t+ta,i=gh[t]+Zs,a=this.get(n);if(a){var o=a.getBBox();return{x:o.centerX,y:o.centerY}}return this.get(i)},e.prototype.init=function(){r.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},e.prototype.getShapeCfg=function(t,n){var i=this,a=i.get("linkCenter"),o=n!=null&&n.includes("move")?t:r.prototype.getShapeCfg.call(this,t);if(a)o.startPoint=i.getEndCenter("source"),o.endPoint=i.getEndCenter("target");else{var s=o.controlPoints||i.getControlPointsByCenter(o);o.startPoint=i.getLinkPoint("source",t,s),o.endPoint=i.getLinkPoint("target",t,s)}return o.sourceNode=i.get("sourceNode"),o.targetNode=i.get("targetNode"),o},e.prototype.getModel=function(){var t=this.get("model"),n=this.get("source".concat(ta)),i=this.get("target".concat(ta));return n?delete t["source".concat(ta)]:t.source=this.get("start".concat(Zs)),i?delete t["target".concat(ta)]:t.target=this.get("end".concat(Zs)),!Pe(t.source)&&!fn(t.source)&&(t.source=t.source.getID()),!Pe(t.target)&&!fn(t.target)&&(t.target=t.target.getID()),t},e.prototype.setSource=function(t){this.setEnd("source",t),this.set("source",t)},e.prototype.setTarget=function(t){this.setEnd("target",t),this.set("target",t)},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(t,n){n===void 0&&(n=void 0);var i=this.get("model"),a=i.visible,o=t.visible;a!==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(t.stateStyles){var l=t.stateStyles;gt(f,l),delete t.stateStyles}Object.assign(i,t),this.updateShape(n),this.afterUpdate(),this.clearCache()}},e.prototype.destroy=function(){var t=this.get("source".concat(ta)),n=this.get("target".concat(ta));t&&!t.destroyed&&t.removeEdge(this),n&&!n.destroyed&&n.removeEdge(this),r.prototype.destroy.call(this)},e}(T_),Vg="anchorPointsCache",Gz="bboxCache",Hg=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getNearestPoint=function(t,n){for(var i=0,a=t[0],o=Hc(t[0],n),s=0;s-1&&n.splice(i,1)},e.prototype.clearCache=function(){this.set(Gz,null),this.set(Vg,null)},e.prototype.getUpdateType=function(t){var n,i,a,o,s;if(t){var u=!ct(t.x),f=!ct(t.y),l=Object.keys(t);if(l.length===1&&(u||f)||l.length===2&&u&&f)return"move";if(ht(t.x)||ht(t.y)||t.type||t.anchorPoints||t.size||t!=null&&t.style&&(!((n=t==null?void 0:t.style)===null||n===void 0)&&n.r||!((i=t==null?void 0:t.style)===null||i===void 0)&&i.width||!((a=t==null?void 0:t.style)===null||a===void 0)&&a.height||!((o=t==null?void 0:t.style)===null||o===void 0)&&o.rx||!((s=t==null?void 0:t.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(t,n){var i=this;if(this.optimize){r.prototype.setState.call(this,t,n);return}this.runWithBBoxAffected(function(){return r.prototype.setState.call(i,t,n)})},e.prototype.clearStates=function(t){var n=this;if(this.optimize){r.prototype.clearStates.call(this,t);return}this.runWithBBoxAffected(function(){return r.prototype.clearStates.call(n,t)})},e.prototype.runWithBBoxAffected=function(t){var n=["r","width","height","rx","ry","lineWidth"],i=this.getKeyShape().attr(),a={};Object.keys(this.getKeyShape().attr()).forEach(function(f){n.includes(f)&&(a[f]=i[f])}),t();for(var o=this.getKeyShape().attr(),s=0;s-1?(n.splice(i,1),!0):!1}},e.prototype.removeNode=function(t){if(t){var n=this.getNodes(),i=n.indexOf(t);return i>-1?(n.splice(i,1),!0):!1}},e.prototype.getUpdateType=function(t){},e.prototype.getBBox=function(){this.set(L_,null);var t=this.calculateCanvasBBox();return t},e.prototype.clearCache=function(){this.set(k_,null),this.set(L_,null),this.set(N_,null)},e.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),n=this.get("group");t&&n.stopAnimate(),n.shapeMap={},this.clearCache(),this.set(yh,null),this.set("bbox",null),n.remove(),this._cfg=null,this.destroyed=!0}},e}(Hg),mh="node",bh="edge",D_="vedge",Tf="combo",zz="default",P_="Mapper",Sa="stateStyles",$z=function(){function r(e){var t=this;this.edgeToBeUpdateMap={},this.throttleRefresh=uf(function(n){var i=t.graph;if(!(!i||i.get("destroyed"))){var a=t.edgeToBeUpdateMap;if(a){var o=Object.values(a);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)}}),t.edgeToBeUpdateMap={})}}},16,{trailing:!0,leading:!0}),this.graph=e,this.destroyed=!1}return r.prototype.addItem=function(e,t){var n=this.graph,i=e===D_?bh:e,a=n.get("".concat(i,"Group"))||n.get("group"),o=js(i),s=null,u=n.get(i+js(Sa))||{},f=n.get(zz+o);t[Sa]&&(u=t[Sa]),f&&ye(f,function(E,_){un(E)&&!vt(E)?t[_]=gr({},E,t[_]):vt(E)?t[_]=t[_]||Vt(f[_]):t[_]=t[_]||f[_]});var l=n.get(i+P_);if(l){var c=l(t);c[Sa]&&(u=c[Sa],delete c[Sa]),ye(c,function(E,_){un(E)&&!vt(E)?t[_]=gr({},t[_],E):t[_]=c[_]||t[_]})}if(n.emit("beforeadditem",{type:e,model:t}),e===bh||e===D_){var h=void 0,d=void 0;if(h=t.source,d=t.target,h&&Pe(h)&&(h=n.findById(h)),d&&Pe(d)&&(d=n.findById(d)),!h||!d){console.warn("The source or target node of edge ".concat(t.id," does not exist!"));return}h.getType&&h.getType()==="combo"&&(t.isComboEdge=!0),d.getType&&d.getType()==="combo"&&(t.isComboEdge=!0),s=new I_({model:t,source:h,target:d,styles:u,linkCenter:n.get("linkCenter"),group:a.addGroup()})}else if(e===mh)s=new Hg({model:t,styles:u,group:a.addGroup()});else if(e===Tf){var v=t.children,p=Jc(v,n),g=void 0,y=void 0;if(isNaN(p.x)?isNaN(t.x)&&(g=Math.random()*100):g=p.x,isNaN(p.y)?isNaN(t.y)&&(y=Math.random()*100):y=p.y,isNaN(t.x)||isNaN(t.y))t.x=g,t.y=y;else{var m=t.x-g,b=t.y-y;this.updateComboSucceeds(t.id,m,b,v)}var x=a.addGroup();x.setZIndex(t.depth),s=new O_({model:t,styles:u,animate:n.get("animate"),bbox:t.collapsed?Jc([],n):p,group:x}),!t.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 w=s.getModel();(v||[]).forEach(function(E){var _=n.findById(E.id);s.addChild(_),E.depth=w.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:t}),s},r.prototype.updateItem=function(e,t){var n=this,i,a,o=this.graph;if(Pe(e)&&(e=o.findById(e)),!(!e||e.destroyed)){var s="";e.getType&&(s=e.getType());var u=o.get(s+P_),f=e.getModel(),l=f.x,c=f.y,h=e.getUpdateType(t);if(u){var d=gr({},f,t),v=u(d),p=gr({},f,v,t);v[Sa]&&(e.set("styles",p[Sa]),delete p[Sa]),ye(p,function(S,A){t[A]=S})}else ye(t,function(S,A){f[A]&&un(S)&&!vt(S)&&(t[A]=B(B({},f[A]),t[A]))});if(o.emit("beforeupdateitem",{item:e,cfg:t}),s===bh){if(t.source){var g=t.source;Pe(g)&&(g=o.findById(g)),e.setSource(g)}if(t.target){var y=t.target;Pe(y)&&(y=o.findById(y)),e.setTarget(y)}e.update(t)}else if(s===mh){e.update(t,h);var m=e.getEdges();h==="move"?ye(m,function(S){n.edgeToBeUpdateMap[S.getID()]={edge:S,updateType:h},n.throttleRefresh()}):h!=null&&h.includes("bbox")&&ye(m,function(S){S.refresh(h)})}else if(s===Tf){if(e.update(t,h),!isNaN(t.x)||!isNaN(t.y)){var b=t.x-l||0,x=t.y-c||0;this.updateComboSucceeds(f.id,b,x)}var w=e.getEdges(),E=(h==null?void 0:h.includes("bbox"))||h==="move";if(E&&s===Tf){var _=e.get("shapeFactory"),M=f.type||"circle",C=f.animate===void 0||t.animate===void 0?(a=(i=_[M])===null||i===void 0?void 0:i.options)===null||a===void 0?void 0:a.animate:f.animate||t.animate;C?setTimeout(function(){if(!(!e||e.destroyed)){var S=e.getKeyShape();!S||S.destroyed||ye(w,function(A){A&&!A.destroyed&&A.refresh()})}},201):ye(w,function(S){S.refresh()})}}e.setOptimize(o.getNodes().length>o.get("optimizeThreshold")),o.emit("afterupdateitem",{item:e,cfg:t})}},r.prototype.updateCombo=function(e,t,n){var i=this,a,o,s=this.graph;if(Pe(e)&&(e=s.findById(e)),!(!e||e.destroyed)){var u=e.getModel(),f=Jc(t,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=(a=v[p])===null||a===void 0?void 0:a.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),i.updateComboEdges(e))}},201):this.updateComboEdges(e)}},r.prototype.updateComboEdges=function(e){for(var t,n,i=e.getEdges()||[],a=0;a-1&&o.splice(s,1),a===bh){var u=n.get("v".concat(a,"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(a===mh){var v=e.getModel().comboId;if(h&&v){var p=h,g=!1;h.forEach(function(E){g||Mn(E,function(_){if(_.id===d&&p){var M=p.indexOf(_);return p.splice(M,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(a===Tf){var b=e.getModel().parentId,x,w=!1;(h||[]).forEach(function(_){w||Mn(_,function(M){return M.id===d?(x=M,w=!0,!1):!0})}),x.removed=!0,x&&x.children&&x.children.forEach(function(_){t.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:i,type:a})}},r.prototype.setItemState=function(e,t,n){var i=this.graph,a=t;Pe(n)&&(a="".concat(t,":").concat(n)),!(e.hasState(a)===n&&n||Pe(n)&&e.hasState(a))&&(i.emit("beforeitemstatechange",{item:e,state:a,enabled:n}),e.setState(t,n),i.autoPaint(),i.emit("afteritemstatechange",{item:e,state:a,enabled:n}))},r.prototype.priorityState=function(e,t){var n=this.graph,i=e;Pe(e)&&(i=n.findById(e)),this.setItemState(i,t,!1),this.setItemState(i,t,!0)},r.prototype.clearItemStates=function(e,t){var n=this.graph;Pe(e)&&(e=n.findById(e)),n.emit("beforeitemstatesclear",{item:e,states:t}),e.clearStates(t),n.emit("afteritemstatesclear",{item:e,states:t})},r.prototype.refreshItem=function(e){var t=this.graph;Pe(e)&&(e=t.findById(e)),t.emit("beforeitemrefresh",{item:e}),e.refresh(),t.emit("afteritemrefresh",{item:e})},r.prototype.addCombos=function(e,t){var n=this,i=this.graph;(e||[]).forEach(function(o){qi(o,function(s){var u;return t.forEach(function(f){f.id===s.id&&(f.children=s.children,f.depth=s.depth,u=f)}),u&&n.addItem("combo",u),!0})});var a=i.get("comboGroup");a&&a.sort()},r.prototype.changeItemVisibility=function(e,t){var n=this,i=this.graph;if(Pe(e)&&(e=i.findById(e)),!e){console.warn("The item to be shown or hidden does not exist!");return}if(i.emit("beforeitemvisibilitychange",{item:e,visible:t}),e.changeVisibility(t),e.getType&&e.getType()===mh){var a=e.getEdges();ye(a,function(l){t&&!(l.get("source").isVisible()&&l.get("target").isVisible())||n.changeItemVisibility(l,t)})}else if(e.getType&&e.getType()===Tf){var o=i.get("comboTrees"),s=e.get("id"),u=[],f=!1;(o||[]).forEach(function(c){f||!c.children||c.children.length===0||Mn(c,function(h){return h.id===s?(u=h.children,f=!0,!1):!0})}),u&&(!t||t&&!e.getModel().collapsed)&&u.forEach(function(c){var h=i.findById(c.id);n.changeItemVisibility(h,t)});var a=e.getEdges();ye(a,function(c){t&&!(c.get("source").isVisible()&&c.get("target").isVisible())||n.changeItemVisibility(c,t)})}return i.emit("afteritemvisibilitychange",{item:e,visible:t}),e},r.prototype.destroy=function(){this.graph=null,this.destroyed=!0},r}(),jz=function(){function r(e){this.graph=e,this.destroyed=!1}return r.prototype.updateState=function(e,t,n){var i=this.graph.get("states"),a=t;Pe(n)&&(a="".concat(t,":").concat(n)),i[a]||(i[a]=[]),n?i[a].push(e):i[a]=i[a].filter(function(o){return o!==e}),this.graph.set("states",i),this.graph.emit("graphstatechange",{states:i})},r.prototype.updateStates=function(e,t,n){var i=this.graph.get("states"),a=Pe(t)?[t]:t;a.forEach(function(o){var s=o;i[s]||(i[s]=[]),Pe(n)&&(s="".concat(o,":").concat(n)),n?i[s].push(e):i[s]=i[s].filter(function(u){return u!==e})}),this.graph.set("states",i),this.graph.emit("graphstatechange",{states:t})},r.prototype.destroy=function(){this.graph=null,this.destroyed=!0},r}(),Uz=function(e,t){return!e||!t?e:e.replace(/\\?\{([^{}]+)\}/g,function(n,i){if(n.charAt(0)==="\\")return n.slice(1);var a=t[i];return a===0&&(a="0"),a||""})},R_=function(e){var t=[];if(e.length<2)throw new Error("point length must largn than 2, now it's ".concat(e.length));for(var n=0,i=e;n0?o-1:t-1,u=to([0,0],ln([0,0],a[s].v,Sn([0,0],a[o].v,-1)));a[o].p=ln([0,0],a[o].p,Sn([0,0],u,e))}return a.map(function(f){var l=f.p;return{x:l[0],y:l[1]}})}var Yz=function(e,t){for(var n=[],i=0;i<5;i++){var a=Math.cos((18+72*i)/180*Math.PI)*e,o=Math.sin((18+72*i)/180*Math.PI)*e,s=Math.cos((54+72*i)/180*Math.PI)*t,u=Math.sin((54+72*i)/180*Math.PI)*t;i===0?n.push(["M",a,-o]):n.push(["L",a,-o]),n.push(["L",s,-u])}return n.push(["Z"]),n};const Wz=Object.freeze(Object.defineProperty({__proto__:null,getClosedSpline:Zg,getControlPoint:xh,getSpline:R_,getStarPath:Yz,paddedHull:z_,pathToPoints:qg,pointsToPolygon:Xz,roundedHull:Kg},Symbol.toStringTag,{value:"Module"}));var $_=function(e,t,n){return(e.y-n.y)*(t.x-n.x)-(e.x-n.x)*(t.y-n.y)},j_=function(e){var t=e.map(function(c){return{x:c.getModel().x,y:c.getModel().y}});t.sort(function(c,h){return c.x===h.x?c.y-h.y:c.x-h.x});for(var n={},i=t.length-1;i>=0;i--){var a=t[i],o=a.x,s=a.y;n["".concat(o,"-").concat(s)]&&t.splice(i,1),n["".concat(o,"-").concat(s)]=!0}if(t.length===1)return t;for(var u=[],i=0;i=2&&$_(u[u.length-2],u[u.length-1],t[i])<=0;)u.pop();u.push(t[i])}for(var f=[],i=t.length-1;i>=0;i--){for(;f.length>=2&&$_(f[f.length-2],f[f.length-1],t[i])<=0;)f.pop();f.push(t[i])}f.pop(),u.pop();var l=u.concat(f);return l},Vz={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 Hz(r,e,t){var n=!1,i=function(u,f){return e.cells[u+f*e.width]},a=function(u,f){var l=0;return i(u-1,f-1)>=t&&(l+=1),i(u,f-1)>t&&(l+=2),i(u-1,f)>t&&(l+=4),i(u,f)>t&&(l+=8),l},o=function(u,f){for(var l=u,c=f,h,d,v=0;v-1){if(!(r[0].x!==l||r[0].y!==c))return!0}else r.push({x:l,y:c});var p=a(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;st&&a(s,u)!==15&&(n=o(s,u));return n}}var qz=function(e,t,n){var i=Math.ceil(e/n),a=Math.ceil(t/n),o=new Float32Array(Math.max(0,i*a)).fill(0);return{cells:o,width:i,height:a}},Zz=function(e,t,n){var i=null,a=Number.POSITIVE_INFINITY;return t.forEach(function(o){var s={x:e.getModel().x,y:e.getModel().y},u={x:o.getModel().x,y:o.getModel().y},f=qc(s,u),l=new Uo(s.x,s.y,u.x,u.y),c=n.reduce(function(h,d){return eg(d,l)>0?h+1:h},0);f*Math.pow(c+1,2)=0&&o=1;)w/=1.5,E=X_(v,w,g,x),_=f(E,o)||f(E,a),M=l(E,t);E&&!_&&(!x||!M)&&(o.push(new Uo(d.x1,d.y1,E.x,E.y)),o.push(new Uo(E.x,E.y,d.x2,d.y2)),s=!0)};m(!0),s||m(!1)}}s||a.push(d),u+=1};!s&&o.length;)c()}for(;o.length;)a.push(o.pop());return a};function Qz(r,e,t,n,i){var a=Zz(r,t,e);if(a===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 Uo(d.x1,d.y1,v.x2,v.y2),g=U_(e,p);g?(h.push(d),c.push(v)):c.push(p)}return h},s=new Uo(r.getModel().x,r.getModel().y,a.getModel().x,a.getModel().y),u=Kz(s,e,n,i),f=o(u);return f}var Jz=function(e,t,n){var i=Object.assign(Vz,n),a=mE(e.map(function(m){return{x:m.getModel().x,y:m.getModel().y}}));e=e.sort(function(m,b){return qc({x:m.getModel().x,y:m.getModel().y},a)-qc({x:b.getModel().x,y:b.getModel().y},a)});var o=[],s=[];e.forEach(function(m){var b=Qz(m,t,o,i.maxRoutingIterations,i.morphBuffer);b.forEach(function(x){s.push(x)}),o.push(m)});for(var u=e8(e,s,i.nodeR0),f=qz(u.width,u.height,i.pixelGroupSize),l=[],c=[],h=0;h1)for(v=Math.floor(d.length/i.skip);v<3&&i.skip>1;)i.skip-=1,v=Math.floor(d.length/i.skip);for(var p=0,g=0;g0)i.nonMemberInfluenceFactor*=.8;else break}return c};function e8(r,e,t){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},i=[];r.forEach(function(u){i.push(u.getBBox())}),e.forEach(function(u){i.push(u.getBBox())});for(var a=0,o=i;an.maxX?s.maxX:n.maxX)+t,n.maxY=(s.maxY>n.maxY?s.maxY:n.maxY)+t}return n.width=n.maxX-n.minX,n.height=n.maxY-n.minY,n.x=n.minX,n.y=n.minY,n}function t8(r,e,t,n,i,a){function o(d,v){var p=Math.floor((d-v)/a.pixelGroupSize);return p<0?0:p}function s(d,v){return d*a.pixelGroupSize+v}var u=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),f=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1),l=function(v,p){var g=Math.min(o(v.minX,p+n.minX),i.width),y=Math.min(o(v.minY,p+n.minY),i.height),m=Math.min(o(v.maxX,-p+n.minX),i.width),b=Math.min(o(v.maxY,-p+n.minY),i.height);return[g,y,m,b]},c=function(v,p){for(var g=v.getBBox(),y=l(g,a.nodeR1),m=y[0],b=y[1],x=y[2],w=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:a.x0?this.cfg.padding+e:10+e,this.cfg.bubbleCfg={nodeR0:this.padding-e,nodeR1:this.padding-e,morphBuffer:this.padding-e}},r.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")},r.prototype.calcPath=function(e,t){var n,i,a;switch(this.type){case"round-convex":n=j_(e),a=Kg(n.map(function(o){return[o.x,o.y]}),this.padding),i=Bg(a);break;case"smooth-convex":n=j_(e),n.length===2?(a=Kg(n.map(function(o){return[o.x,o.y]}),this.padding),i=Bg(a)):n.length>2&&(a=z_(n.map(function(o){return[o.x,o.y]}),this.padding),i=Zg(a));break;case"bubble":n=Jz(e,t,this.cfg.bubbleCfg),i=n.length>=2&&Zg(n);break}return i},r.prototype.render=function(){this.group.addShape("path",{attrs:B({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},r.prototype.addMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e)),this.members.push(e);var t=this.nonMembers.indexOf(e);return t>-1&&this.nonMembers.splice(t,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.addNonMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e)),this.nonMembers.push(e);var t=this.members.indexOf(e);return t>-1&&this.members.splice(t,1),this.updateData(this.members,this.nonMembers),!0}},r.prototype.removeMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e));var t=this.members.indexOf(e);return t>-1?(this.members.splice(t,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.removeNonMember=function(e){if(e){Pe(e)&&(e=this.graph.findById(e));var t=this.nonMembers.indexOf(e);return t>-1?(this.nonMembers.splice(t,1),this.updateData(this.members,this.nonMembers),!0):!1}},r.prototype.updateData=function(e,t){var n=this;this.group.findById(this.id).remove(),e&&(this.members=e.map(function(i){return Pe(i)?n.graph.findById(i):i})),t&&(this.nonMembers=t.map(function(i){return Pe(i)?n.graph.findById(i):i})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.updateStyle=function(e){var t=this.group.findById(this.id);t.attr(B({},e))},r.prototype.updateCfg=function(e){var t=this;this.cfg=gr(this.cfg,e),this.id=this.cfg.id,this.group=this.cfg.group,e.members&&(this.members=this.cfg.members.map(function(n){return Pe(n)?t.graph.findById(n):n})),e.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(n){return Pe(n)?t.graph.findById(n):n})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},r.prototype.contain=function(e){var t=this,n;Pe(e)?n=this.graph.findById(e):n=e;var i,a=n.getKeyShape();if(n.get("type")==="path")i=qg(a.attr("path"));else{var o=a.getCanvasBBox();i=[[o.minX,o.minY],[o.maxX,o.minY],[o.maxX,o.maxY],[o.minX,o.maxY]]}return i=i.map(function(s){var u=t.graph.getPointByCanvas(s[0],s[1]);return[u.x,u.y]}),gE(i,qg(this.path))},r.prototype.destroy=function(){this.group.remove(),this.cfg=null},r}(),If=ni,r8="node",W_=function(r){It(e,r);function e(t){var n=r.call(this)||this;return n.sortCombos=sf(function(){var i=n.get("comboSorted");if(!(!n||n.destroyed||i)){n.set("comboSorted",!0);var a=[],o={},s=n.get("comboTrees");(s||[]).forEach(function(f){Mn(f,function(l){return a[l.depth]?a[l.depth].push(l.id):a[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);a[d]?a[d].push(l.id):a[d]=[l.id]}),a.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=gr(n.getDefaultCfg(),t),n.init(),n.animating=!1,n.destroyed=!1,n.cfg.enabledStack&&(n.undoStack=new Us(n.cfg.maxStep),n.redoStack=new Us(n.cfg.maxStep)),n}return e.prototype.init=function(){this.initCanvas();var t=new Oz(this),n=new q4(this),i=new $z(this),a=new jz(this);this.set({viewController:t,modeController:n,itemController:i,stateController:a}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},e.prototype.initGroups=function(){var t=this.get("canvas");if(t){var n=t.get("el"),i=(n||{}).id,a=i===void 0?"g6":i,o=t.addGroup({id:"".concat(a,"-root"),className:ft.rootContainerClassName});if(this.get("groupByTypes")){var s=o.addGroup({id:"".concat(a,"-edge"),className:ft.edgeContainerClassName}),u=o.addGroup({id:"".concat(a,"-node"),className:ft.nodeContainerClassName}),f=o.addGroup({id:"".concat(a,"-combo"),className:ft.comboContainerClassName});f.toBack(),this.set({nodeGroup:u,edgeGroup:s,comboGroup:f})}var l=o.addGroup({id:"".concat(a,"-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(t,n){return fn(t)?this.cfg=B(B({},this.cfg),t):this.cfg[t]=n,t==="enabledStack"&&n&&!this.undoStack&&!this.redoStack&&(this.undoStack=new Us(this.cfg.maxStep),this.redoStack=new Us(this.cfg.maxStep)),this},e.prototype.get=function(t){var n;return(n=this.cfg)===null||n===void 0?void 0:n[t]},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(t){return this.set("minZoom",t)},e.prototype.getMaxZoom=function(){return this.get("maxZoom")},e.prototype.setMaxZoom=function(t){return this.set("maxZoom",t)},e.prototype.getWidth=function(){return this.get("width")},e.prototype.getHeight=function(){return this.get("height")},e.prototype.clearItemStates=function(t,n){Pe(t)&&(t=this.findById(t));var i=this.get("itemController");n||(n=t.get("states")),i.clearItemStates(t,n);var a=this.get("stateController");a.updateStates(t,n,!1)},e.prototype.node=function(t){typeof t=="function"&&this.set("nodeMapper",t)},e.prototype.edge=function(t){typeof t=="function"&&this.set("edgeMapper",t)},e.prototype.combo=function(t){typeof t=="function"&&this.set("comboMapper",t)},e.prototype.findById=function(t){return this.get("itemMap")[t]},e.prototype.find=function(t,n){var i,a=this.get("".concat(t,"s"));return ye(a,function(o,s){if(n(o,s))return i=o,i}),i},e.prototype.findAll=function(t,n){var i=[];return ye(this.get("".concat(t,"s")),function(a,o){n(a,o)&&i.push(a)}),i},e.prototype.findAllByState=function(t,n,i){return i?this.findAll(t,function(a){return a.hasState(n)&&i(a)}):this.findAll(t,function(a){return a.hasState(n)})},e.prototype.translate=function(t,n,i,a){var o=this,s=this.get("group"),u=Vt(s.getMatrix());if(u||(u=[1,0,0,0,1,0,0,0,1]),i){var f=vf({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"translate",matrix:s.getMatrix()})}});Qp(s,{x:s.getCanvasBBox().x+t,y:s.getCanvasBBox().y+n},i,f||{duration:500,easing:"easeCubic"})}else u=If(u,[["t",t,n]]),s.setMatrix(u),this.emit("viewportchange",{action:"translate",matrix:u}),this.autoPaint()},e.prototype.moveTo=function(t,n,i,a){var o=this.get("group");Qp(o,{x:t,y:n},i,a||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:o.getMatrix()})},e.prototype.fitView=function(t,n,i,a){t&&this.set("fitViewPadding",t);var o=this.get("viewController");n?o.fitViewByRules(n,i,a):o.fitView(i,a),this.autoPaint()},e.prototype.fitCenter=function(t,n){var i=this.get("viewController");i.fitCenter(t,n),this.autoPaint()},e.prototype.addBehaviors=function(t,n){var i=this.get("modeController");return i.manipulateBehaviors(t,n,!0),this},e.prototype.removeBehaviors=function(t,n){var i=this.get("modeController");return i.manipulateBehaviors(t,n,!1),this},e.prototype.updateBehavior=function(t,n,i){var a=this.get("modeController");return a.updateBehavior(t,n,i),this},e.prototype.zoom=function(t,n,i,a){var o=this,s=this.get("group"),u=Vt(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*t,d=t,v=!1;if(f&&hl&&(d=l/c,v=!0),n?u=If(u,[["t",-n.x,-n.y],["s",d,d],["t",n.x,n.y]]):u=If(u,[["s",d,d]]),i){var p=Vt(s.getMatrix());p||(p=[1,0,0,0,1,0,0,0,1]);var g=p[0],y=g*d,m=vf({animateCfg:a,callback:function(){return o.emit("viewportchange",{action:"zoom",matrix:s.getMatrix()})}});s.animate(function(b){if(b===1)p=u;else{var x=rg(g,y,b)/p[0];n?p=If(p,[["t",-n.x,-n.y],["s",x,x],["t",n.x,n.y]]):p=If(p,[["s",x,x]])}return{matrix:p}},m)}else s.setMatrix(u),this.emit("viewportchange",{action:"zoom",matrix:u}),this.autoPaint();return!v},e.prototype.zoomTo=function(t,n,i,a){var o=t/this.getZoom();return this.zoom(o,n,i,a)},e.prototype.focusItem=function(t,n,i){var a=this.get("viewController"),o=!1;n?o=!0:n===void 0&&(o=this.get("animate"));var s={};i?s=i:i===void 0&&(s=this.get("animateCfg")),a.focus(t,o,s),this.autoPaint()},e.prototype.focusItems=function(t,n,i,a){var o=this.get("viewController");o.focusItems(t,n,i,a)},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(t,n){var i=this.get("viewController");return i.getPointByClient(t,n)},e.prototype.getClientByPoint=function(t,n){var i=this.get("viewController");return i.getClientByPoint(t,n)},e.prototype.getPointByCanvas=function(t,n){var i=this.get("viewController");return i.getPointByCanvas(t,n)},e.prototype.getCanvasByPoint=function(t,n){var i=this.get("viewController");return i.getCanvasByPoint(t,n)},e.prototype.getGraphCenterPoint=function(){var t=this.get("group").getCanvasBBox();return{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}},e.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},e.prototype.showItem=function(t,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(t,!0);if(n&&this.get("enabledStack")){var o=a.getID(),s=a.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(t,n){n===void 0&&(n=!0);var i=this.get("itemController"),a=i.changeItemVisibility(t,!1);if(n&&this.get("enabledStack")){var o=a.getID(),s=a.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(t){var n=this.get("itemController");n.refreshItem(t)},e.prototype.setAutoPaint=function(t){var n=this;n.set("autoPaint",t);var i=n.get("canvas");i.set("autoDraw",t)},e.prototype.remove=function(t,n){n===void 0&&(n=!0),this.removeItem(t,n)},e.prototype.removeItem=function(t,n){n===void 0&&(n=!0);var i=t;if(Pe(t)&&(i=this.findById(t)),!i&&Pe(t))console.warn("The item ".concat(t," to be removed does not exist!"));else if(i){var a="";if(i.getType&&(a=i.getType()),n&&this.get("enabledStack")){var o=B(B({},i.getModel()),{itemType:a}),s={};switch(a){case"node":{s.nodes=[o],s.edges=[];for(var u=i.getEdges(),f=u.length-1;f>=0;f--)s.edges.push(B(B({},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(a==="node"){var l=i.getModel();l.comboId&&this.updateComboTree(i,void 0,!1)}var c=this.get("itemController");if(c.removeItem(i),a==="combo"){var h=ug(this.get("comboTrees"));this.set("comboTrees",h)}}},e.prototype.innerAddItem=function(t,n,i){if(!H4(t,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 a,o=this.get("comboTrees")||[];if(t==="combo"){var s=this.get("itemMap"),u=!1;if(o.forEach(function(v){u||qi(v,function(p){if(n.parentId===p.id){u=!0;var g=B({id:n.id,depth:p.depth+2},n);p.children?p.children.push(g):p.children=[g],n.depth=g.depth,a=i.addItem(t,n)}var y=s[p.id];return u&&y&&y.getType&&y.getType()==="combo"&&i.updateCombo(y,p.children),!0})}),!u){var f=B({id:n.id,depth:0},n);n.depth=f.depth,o.push(f),a=i.addItem(t,n)}this.set("comboTrees",o),n.collapsed&&(this.collapseCombo(a,!1),this.updateCombo(a))}else if(t==="node"&&Pe(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.")),a=i.addItem(t,n);var c=this.get("itemMap"),h=!1,d=!1;o.forEach(function(v){d||h||qi(v,function(p){if(p.id===n.id)return d=!0,!1;if(n.comboId===p.id&&!d){h=!0;var g=Vt(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"&&i.updateCombo(c[p.id],p.children),!0})})}else a=i.addItem(t,n);if(t==="node"&&n.comboId||t==="combo"&&n.parentId){var l=this.findById(n.comboId||n.parentId);l&&l.getType&&l.getType()==="combo"&&l.addChild(a)}return a},e.prototype.addItem=function(t,n,i,a){i===void 0&&(i=!0),a===void 0&&(a=!0);var o=this.get("comboSorted");this.set("comboSorted",o&&!a);var s=this.get("itemController"),u=this.innerAddItem(t,n,s);if(u===!1||u===!0)return u;var f=this.get("combos");if(f&&f.length>0&&this.sortCombos(),this.autoPaint(),i&&this.get("enabledStack")){var l=B(B({},u.getModel()),{itemType:t}),c={};switch(t){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(t,n,i){t===void 0&&(t=[]),n===void 0&&(n=!0),i===void 0&&(i=!0);var a=this.get("comboSorted");this.set("comboSorted",a&&!i);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),ye(l,function(m,b){m.getType&&(m.getType()==="node"||m.getType()==="combo")||c.edges.indexOf(m)<0&&(delete l[b],o.remove(m,!1))}),(this.get("comboTrees")||[]).forEach(function(m){qi(m,function(b){var x=i.findById(b.id);return x.getType()==="combo"&&b.collapsed&&i.collapseCombo(b.id,!1),!0})}),this.set({nodes:c.nodes,edges:c.edges});var y=this.get("layoutController");return y&&(y.changeData(function(){setTimeout(function(){var m;(m=o.getCombos())===null||m===void 0||m.forEach(function(b){b.set("animate",!0)})},0)}),o.get("animate")&&!y.getLayoutType()?(o.positionsAnimate(),(a=o.getCombos())===null||a===void 0||a.forEach(function(m){return m.set("animate",!0)})):o.autoPaint()),setTimeout(function(){u.set("localRefresh",f)},16),this.set("data",s),this.emit("afterchangedata"),this},e.prototype.addCombos=function(t){var n=this,i=n.get("comboTrees"),a=this.get("itemController");a.addCombos(i,t)},e.prototype.createCombo=function(t,n,i){var a=this;i===void 0&&(i=!0);var o=this.get("itemController");this.set("comboSorted",!1);var s="",u;if(t){if(Pe(t))s=t,u={id:t};else{if(s=t.id,!s){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}u=t}var f=i&&this.get("enabledStack"),l={nodes:[],combos:[]};f&&n.forEach(function(y){var m=a.findById(y),b=m.getType();if(!(b!=="node"&&b!=="combo")){var x=m.getModel();l["".concat(b,"s")].push({id:y,parentId:b==="node"?x.comboId:x.parentId})}});var c=this.get("comboTrees"),h=new Set(n),d=new Map;c&&(c.forEach(function(y){qi(y,function(m,b,x){if(h.has(m.id)){if(b){var w=a.findById(b.id),E=a.findById(m.id);b.children.splice(x,1),w.removeChild(E),o.updateCombo(w,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=a.findById(y),b=m.getModel(),x="";m.getType&&(x=m.getType());var w=d.get(y)||{id:m.getID(),itemType:x};return x==="combo"?(w.parentId=s,b.parentId=s):x==="node"&&(w.comboId=s,b.comboId=s),f&&v["".concat(x,"s")].push({id:b.id,parentId:s}),w});u.children=p,this.addItem("combo",u,!1),this.set("comboSorted",!1),c&&(c.forEach(function(y){Mn(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(t,n){var i=this,a,o;n===void 0&&(n=!0);var s=this,u=t;if(Pe(t)&&(u=this.findById(t)),!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=Vt(f),b.children=[]),c.forEach(function(_){v||qi(_,function(M){var C;if(M.id===d){v=M;var S=u.getEdges().map(function(k){return k.getID()});S.forEach(function(k){i.removeItem(k,!1)});var A=g.indexOf(u);g.splice(A,1),delete h[d];var T=Vt(u.getModel());u.destroy(),i.emit("afterremoveitem",{item:T,type:"combo"})}if(l&&v&&M.id===l){y.removeCombo(u),p=M.children;var A=p.indexOf(v);return A!==-1&&p.splice(A,1),(C=v.children)===null||C===void 0||C.forEach(function(O){var G=i.findById(O.id),D=G.getModel();G.getType&&G.getType()==="combo"?(O.parentId=l,delete O.comboId,D.parentId=l,delete D.comboId):G.getType&&G.getType()==="node"&&(O.comboId=l,D.comboId=l),y.addChild(G),p.push(O)}),i.updateCombo(y),!1}return!0})}),!l&&v){var x=c.indexOf(v);c.splice(x,1),(a=v.children)===null||a===void 0||a.forEach(function(_){_.parentId=void 0;var M=i.findById(_.id).getModel();delete M.parentId,delete M.comboId,_.itemType!=="node"&&c.push(_)})}if(m){var w={nodes:[],combos:[]},E={nodes:[],combos:[]};(o=v.children)===null||o===void 0||o.forEach(function(_){var M=i.findById(_.id),C=M.getType();C!=="node"&&C!=="combo"||(w["".concat(C,"s")].push({id:_.id,parentId:d}),E["".concat(C,"s")].push({id:_.id,parentId:l}))}),w.combos.push(b),this.pushStack("uncombo",{before:w,after:E})}},e.prototype.updateCombos=function(t){var n=this;t===void 0&&(t=!1);var i=this,a=this.get("comboTrees"),o=i.get("itemController"),s=i.get("itemMap");(a||[]).forEach(function(u){qi(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=Yn([],c.getStates(),!0);ye(h,function(d){return n.setItemState(c,d,!1)}),o.updateCombo(c,f.children,t),ye(h,function(d){return n.setItemState(c,d,!0)})}return!0})}),i.sortCombos()},e.prototype.updateCombo=function(t){var n=this,i=this,a=t,o;if(Pe(t)&&(a=this.findById(t)),!a||a.getType&&a.getType()!=="combo"){console.warn("The item to be updated is not a combo!");return}o=a.get("id");var s=this.get("comboTrees"),u=i.get("itemController"),f=i.get("itemMap");(s||[]).forEach(function(l){qi(l,function(c){if(!c)return!0;var h=f[c.id];if(o===c.id&&h&&h.getType&&h.getType()==="combo"){var d=Yn([],h.getStates(),!0);ye(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!1)}),u.updateCombo(h,c.children),ye(d,function(v){h.getStateStyle(v)&&n.setItemState(h,v,!0)}),o&&(o=c.parentId)}return!0})})},e.prototype.updateComboTree=function(t,n,i){i===void 0&&(i=!0);var a=this;this.set("comboSorted",!1);var o;Pe(t)?o=a.findById(t):o=t;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||Mn(m,function(b){if(!h)return b.id===o.getID()&&(h=b),!0})}),Mn(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(i&&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=ug(this.get("comboTrees"),s.id,n);this.set("comboTrees",y),this.updateCombos()},e.prototype.save=function(){var t=[],n=[],i=[];return ye(this.get("nodes"),function(a){t.push(a.getModel())}),ye(this.get("edges"),function(a){n.push(a.getModel())}),ye(this.get("combos"),function(a){i.push(a.getModel())}),{nodes:t,edges:n,combos:i}},e.prototype.changeSize=function(t,n){var i=this.get("viewController");return i.changeSize(t,n),this},e.prototype.refresh=function(){var t=this;if(t.emit("beforegraphrefresh"),t.get("animate"))t.positionsAnimate();else{var n=t.get("nodes"),i=t.get("edges"),a=t.get("edges");ye(n,function(o){o.refresh()}),ye(i,function(o){o.refresh()}),ye(a,function(o){o.refresh()})}t.emit("aftergraphrefresh"),t.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(t){if(Pe(t)&&(t=this.findById(t)),!t||t.getType&&t.getType()!=="combo"){console.warn("The combo does not exist!");return}return t.getChildren()},e.prototype.positionsAnimate=function(t){var n=this;n.emit("beforeanimate");var i=n.get("animateCfg"),a=i.onFrame,o=t?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){ye(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)),a){var p=a(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(t)},{duration:i.duration,easing:i.easing,callback:function(){ye(o,function(l){l.set("originAttrs",null)}),i.callback&&i.callback(),n.emit("afteranimate"),n.animating=!1}})},0)},e.prototype.refreshPositions=function(t){var n=this;n.emit("beforegraphrefreshposition");var i=n.get("nodes"),a=n.get("edges"),o=n.get("vedges"),s=n.get("combos"),u,f={},l=function(h){ye(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(i),s&&s.length!==0&&(t&&l(s),n.updateCombos()),ye(a,function(c){var h=c.getSource().getModel(),d=c.getTarget();if(!fn(d)){var v=d.getModel();(f[h.id]||f[v.id]||c.getModel().isComboEdge)&&c.refresh()}}),ye(o,function(c){c.refresh()}),n.emit("aftergraphrefreshposition"),n.autoPaint()},e.prototype.stopAnimate=function(){var t=this.get("canvas"),n=t.cfg.timeline;n&&n.stopAllAnimations()},e.prototype.isAnimating=function(){return this.animating},e.prototype.getZoom=function(){var t=this.get("group").getMatrix();return t?t[0]:1},e.prototype.getCurrentMode=function(){var t=this.get("modeController");return t.getMode()},e.prototype.setMode=function(t){var n=this.get("modeController");return n.setMode(t),this},e.prototype.clear=function(t){var n;return t===void 0&&(t=!1),(n=this.get("canvas"))===null||n===void 0||n.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),t||this.emit("afterrender"),this},e.prototype.updateLayout=function(t,n,i,a){var o=this;t===void 0&&(t={}),a===void 0&&(a=!0);var s=this.get("layoutController");if(Pe(t)&&(t={type:t}),n){var u=i;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(t.type)||!t.type&&f.includes(s==null?void 0:s.layoutType)?t.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=B({},this.get("layout")),c={};Object.assign(c,l,t),t.pipes&&!t.type?delete c.type:!t.pipes&&c.type&&delete c.pipes,this.set("layout",c),s&&(s.isLayoutTypeSame(c)&&c.gpuEnabled===l.gpuEnabled?s.updateLayoutCfg(c):s.changeLayout(c),a&&this.get("enabledStack")&&this.pushStack("layout",{before:l,after:c}))},e.prototype.destroyLayout=function(){var t=this.get("layoutController");t==null||t.destroyLayout()},e.prototype.layout=function(){var t,n=this.get("layoutController"),i=this.get("layout");if(!(!i||!n)){if(i.workerEnabled){n.layout();return}!((t=n.layoutMethods)===null||t===void 0)&&t.length?n.relayout(!0):n.layout()}},e.prototype.collapseCombo=function(t,n){var i=this;if(n===void 0&&(n=!0),!this.destroyed){if(Pe(t)&&(t=this.findById(t)),!t){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"collapse",item:t});var a=t.getModel(),o=this.get("itemController");o.collapseCombo(t,n),a.collapsed=!0;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||Mn(h,function(d){if(l&&d.depth<=a.depth)return!1;if(a.id===d.id&&(l=!0),l){var v=i.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,x;if(y.getModel().id===a.id||u.includes(y)&&!u.includes(m)?(b=m,x=!1):(m.getModel().id===a.id||!u.includes(y)&&u.includes(m))&&(b=y,x=!0),b){if(v){i.removeItem(h,!1);return}for(var w=b.getModel();!b.isVisible();){var E=w.parentId,_=w.comboId,M=E||_;if(b=i.findById(M),!b||!M)return;w=b.getModel()}var C=w.id,S=x?{source:C,target:a.id,size:g,isVEdge:!0}:{source:a.id,target:C,size:g,isVEdge:!0},A="".concat(S.source,"-").concat(S.target);if(c[A]){c[A].size+=g;return}c[A]=S}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:t})}},e.prototype.expandCombo=function(t,n){var i=this;if(n===void 0&&(n=!0),Pe(t)&&(t=this.findById(t)),!t||t.getType&&t.getType()!=="combo"){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:t});var a=t.getModel(),o=this.get("itemController");o.expandCombo(t,n),a.collapsed=!1;var s=this.getEdges().concat(this.get("vedges")),u=[],f=this.get("comboTrees"),l=!1;(f||[]).forEach(function(h){l||Mn(h,function(d){if(l&&d.depth<=a.depth)return!1;if(a.id===d.id&&(l=!0),l){var v=i.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===a.id||u.includes(d)&&!u.includes(v)?(y=v,m=!1):g===a.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(),x=b.isVEdge,w=b.size,E=w===void 0?1:w;if(x){i.removeItem(h,!1);return}for(var _=y.getModel();!y.isVisible();){var M=_.parentId,C=_.comboId,S=M||C;if(y=i.findById(S),!y||!S)return;_=y.getModel()}for(var A=_.id,T=m?v:d,k=T.getModel();!T.isVisible();){var O=k.parentId,G=k.comboId,D=O||G;if(T=i.findById(D),!T||!D)return;if(k.comboId===a.id||k.parentId===a.id)break;k=T.getModel()}var $=k.id;if(A){var Y=m?{source:A,target:$,isVEdge:!0,size:E}:{source:$,target:A,isVEdge:!0,size:E},N="".concat(Y.source,"-").concat(Y.target);if(c[N]){c[N].size+=E;return}c[N]=Y}}}}),this.addItems(Object.values(c).map(function(h){return{type:"vedge",model:h}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:t})},e.prototype.collapseExpandCombo=function(t,n){if(n===void 0&&(n=!0),Pe(t)&&(t=this.findById(t)),!(!t||t.getType&&t.getType()!=="combo")){for(var i=t.getModel(),a=this.findById(i.parentId);a;){var o=a.getModel();if(o.collapsed){console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),a=void 0;return}a=this.findById(o.parentId)}var s=i.collapsed;s?this.expandCombo(t,n):this.collapseCombo(t,n),this.updateCombo(t)}},e.prototype.getNeighbors=function(t,n){var i=t;return Pe(t)&&(i=this.findById(t)),i.getNeighbors(n)},e.prototype.getNodeDegree=function(t,n,i){n===void 0&&(n=void 0),i===void 0&&(i=!1);var a=t;Pe(t)&&(a=this.findById(t));var o=this.get("degrees");(!o||i)&&(o=_a(this.save()),this.set("degrees",o));var s=o[a.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(t,n,i){if(t===void 0&&(t="update"),i===void 0&&(i="undo"),!this.get("enabledStack")){console.warn("请先启用 undo & redo 功能,在实例化 Graph 时候配置 enabledStack: true !");return}var a=n?Vt(n):{before:{},after:Vt(this.save())};i==="redo"?this.redoStack.push({action:t,data:a}):this.undoStack.push({action:t,data:a}),this.emit("stackchange",{action:t,stackType:i,undoStack:this.undoStack,redoStack:this.redoStack})},e.prototype.getAdjMatrix=function(t,n){t===void 0&&(t=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix");return(!i||!t)&&(i=$o(this.save(),n),this.set("adjMatrix",i)),i},e.prototype.getShortestPathMatrix=function(t,n){t===void 0&&(t=!0),n===void 0&&(n=this.get("directed"));var i=this.get("adjMatrix"),a=this.get("shortestPathMatrix");return(!i||!t)&&(i=$o(this.save(),n),this.set("adjMatrix",i)),(!a||!t)&&(a=hf(this.save(),n),this.set("shortestPathMatrix",a)),a},e.prototype.on=function(t,n,i){return r.prototype.on.call(this,t,n,i)},e.prototype.destroy=function(){var t,n,i,a,o;this.emit("beforedestroy"),this.clear(),this.clearStack(),(t=this.get("itemController"))===null||t===void 0||t.destroy(),(n=this.get("modeController"))===null||n===void 0||n.destroy(),(i=this.get("viewController"))===null||i===void 0||i.destroy(),(a=this.get("stateController"))===null||a===void 0||a.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(t){if(!t.members||t.members.length<1){console.warn("Create hull failed! The members is empty.");return}var n=this.get("hullGroup"),i=this.get("hullMap");if(i||(i={},this.set("hullMap",i)),(!n||n.get("destroyed"))&&(n=this.get("group").addGroup({id:"hullGroup"}),n.toBack(),this.set("hullGroup",n)),i[t.id])return console.warn("Existed hull id."),i[t.id];var a=n.addGroup({id:"".concat(t.id,"-container")}),o=new Y_(this,B(B({},t),{group:a})),s=o.id;return i[s]=o,o},e.prototype.getHulls=function(){return this.get("hullMap")},e.prototype.getHullById=function(t){return this.get("hullMap")[t]},e.prototype.removeHull=function(t){var n,i;Pe(t)?i=this.getHullById(t):i=t,(n=this.get("hullMap"))===null||n===void 0||delete n[i.id],i.destroy()},e.prototype.removeHulls=function(){var t=this.getHulls();!t||!Object.keys(t).length||(Object.keys(t).forEach(function(n){var i=t[n];i.destroy()}),this.set("hullMap",{}))},e}(px);function Qg(r){"@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(r)}var Ks=ni,V_="-shape",Jg="-label",wh=["startArrow","endArrow"],H_={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},n8={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},Eh={edge:n8,node:H_,combo:H_},e0="-label-bg",t0={options:{labelCfg:{style:{fontFamily:ft.windowFontFamily}},descriptionCfg:{style:{fontFamily:ft.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(e){return{}},getOptions:function(e,t){return t==="move"||t!=null&&t.includes("bbox")?e:gr({},this.options,this.getCustomConfig(e)||{},e)},draw:function(e,t){t.shapeMap={},this.mergeStyle=this.getOptions(e);var n=this.drawShape(e,t);if(n.set("className",this.itemType+V_),t.shapeMap[this.itemType+V_]=n,e.label){var i=this.drawLabel(e,t);i.set("className",this.itemType+Jg),t.shapeMap[this.itemType+Jg]=i}return n},afterDraw:function(e,t,n){},drawShape:function(e,t){return null},drawLabel:function(e,t){var n=(this.mergeStyle||this.getOptions(e)||{}).labelCfg,i=n||{},a=this.getLabelStyle(e,i,t),o=a.rotate;delete a.rotate;var s=t.addShape("text",{attrs:a,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(t.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""){var u=s.getBBox(),f=[1,0,0,0,1,0,0,0,1];if(a.rotateCenter)switch(a.rotateCenter){case"center":f=Ks(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break;case"lefttop":f=Ks(f,[["t",-a.x,-a.y],["r",o],["t",a.x,a.y]]);break;case"leftcenter":f=Ks(f,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);break;default:f=Ks(f,[["t",-u.width/2,-u.height/2],["r",o],["t",u.width/2,u.height/2]]);break}else f=Ks(f,[["t",-a.x,-a.y-u.height/2],["r",o],["t",a.x,a.y+u.height/2]]);s.setMatrix(f)}if(a.background){var l=this.drawLabelBg(e,t,s),c=this.itemType+e0;l.set("classname",c),t.shapeMap[c]=l,s.toFront()}return s},drawLabelBg:function(e,t,n){var i=this.options.labelCfg,a=gt({},i,e.labelCfg),o=this.getLabelBgStyleByPosition(n,a),s=t.addShape("rect",{name:"text-bg-shape",attrs:o,labelRelated:!0});return t.shapeMap["text-bg-shape"]=s,s},getLabelStyleByPosition:function(e,t,n){return{text:e.label}},getLabelBgStyleByPosition:function(e,t){return{}},getLabelStyle:function(e,t,n){var i=this.getLabelStyleByPosition(e,t,n),a="".concat(this.itemType,"Label"),o=ft[a]?ft[a].style:null;return B(B(B({},o),i),t.style)},getShapeStyle:function(e){return e.style},update:function(e,t,n){this.updateShapeStyle(e,t,n),this.updateLabel(e,t,n)},updateShapeStyle:function(e,t,n){var i,a=t.getContainer(),o=t.getKeyShape(),s=gt({},o.attr(),e.style),u=function(c){var h,d=s[c];if(fn(d)){var v=((i=a.shapeMap)===null||i===void 0?void 0:i[c])||a.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,t,n){var i,a,o=t.getContainer(),s=(this.mergeStyle||this.getOptions({},n)||{}).labelCfg,u=s===void 0?{}:s,f=this.itemType+Jg,l=o.shapeMap[f]||o.find(function(x){return x.get("className")===f}),c=this.itemType+e0,h=o.shapeMap[c]||o.find(function(x){return x.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=gr(u,e.labelCfg));var v=this.getLabelStyleByPosition(e,u,o),p=(i=e.labelCfg)===null||i===void 0?void 0:i.style,g=B(B({},v),p),y=g.rotate;if(delete g.rotate,!isNaN(y)&&y!==""){var m=[1,0,0,0,1,0,0,0,1];m=Ks(m,[["t",-g.x,-g.y],["r",y],["t",g.x,g.y]]),g.matrix=m,l.attr(g)}else((a=l.getMatrix())===null||a===void 0?void 0:a[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,t){},setState:function(e,t,n){var i,a,o,s=n.get("keyShape");if(!(!s||s.destroyed)){var u=n.getType(),f=of(t)?e:"".concat(e,":").concat(t),l=this.getStateStyle(f,n),c=n.getStateStyle(f);if(!(!c&&!l)){var h=gt({},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),t){var p=function(D){var $,Y=h[D];if(fn(Y)&&!wh.includes(D)){var N=((o=d.shapeMap)===null||o===void 0?void 0:o[D])||d.find(function(P){return P.get("name")===D});N==null||N.attr(Y)}else s.attr(($={},$[D]=Y,$))};for(var g in h)p(g)}else{var y=eh(n.getCurrentStatesStyle()),m=n.getModel(),b=gt({},m.style,eh(n.getOriginStyle())),x=s.get("name"),w=s.attr(),E={};Object.keys(w).forEach(function(G){if(G!=="img"){var D=w[G];D&&Qg(D)==="object"?E[G]=Vt(D):E[G]=D}});var _={},M=function(D){var $=h[D];if(fn($)&&!wh.includes(D)){var Y=d.shapeMap[D]||d.find(function(W){return W.get("name")===D});if(Y){var N=eh(Y.attr());ye($,function(W,J){if(D===x&&E[J]&&!v[J]){delete E[J];var te=b[D][J]||Eh[u][J];s.attr(J,te)}else if(N[J]||N[J]===0){delete N[J];var H=b[D][J]||Eh[u][J];Y.attr(J,H)}}),_[D]=N}}else if(E[D]&&!v[D]){delete E[D];var P=b[D]||(b[x]?b[x][D]:void 0)||Eh[u][D];s.attr(D,P)}};for(var C in h)M(C);x?_[x]=E:gt(_,E);for(var g in y)if(!v[g]){var S=y[g];(!fn(S)||wh.includes(g))&&(x?(gt(b[x],(a={},a[g]=S,a)),delete b[g]):gt(b,(i={},i[g]=S,i)),delete y[g])}var A={};gr(A,b,_,y);var T=!1,k=function(D){var $,Y,N=A[D];if(fn(N)&&!wh.includes(D)){var P=d.shapeMap[D]||d.find(function(J){return J.get("name")===D});P&&((P.get("type")==="text"||P.get("labelRelated"))&&(delete N.x,delete N.y,delete N.matrix),D===x&&(u==="combo"&&(delete N.r,delete N.width,delete N.height),T=!0),P.attr(N))}else if(!T){var W=N||Eh[u][D];u==="combo"?x||s.attr(($={},$[D]=W,$)):s.attr((Y={},Y[D]=W,Y))}};for(var O in A)k(O)}}}},getStateStyle:function(e,t){var n=t.getModel(),i=t.getType(),a=this.getOptions(n),o=a.stateStyles,s=a.style,u=s===void 0?{}:s,f=n.stateStyles?n.stateStyles[e]:o&&o[e];return i==="combo"?Vt(f):gt({},u,f)},getControlPoints:function(e){return e.controlPoints},getAnchorPoints:function(e){var t,n,i=(e==null?void 0:e.anchorPoints)||((t=this.getCustomConfig(e))===null||t===void 0?void 0:t.anchorPoints)||((n=this.options)===null||n===void 0?void 0:n.anchorPoints);return i}},i8={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:ft.nodeLabel.offset,getSize:function(e){var t,n=((t=this.mergeStyle)===null||t===void 0?void 0:t.size)||e.size||this.getOptions({}).size||ft.defaultNode.size;return vt(n)&&n.length===1&&(n=[n[0],n[0]]),vt(n)||(n=[n,n]),n},getLabelStyleByPosition:function(e,t){var n=t.maxLength,i=e.label;n&&(i=kE(i,n));var a=t.position||this.labelPosition;if(a==="center")return{x:0,y:0,text:i,textBaseline:"middle",textAlign:"center"};var o=t.offset;ct(o)&&(o=this.offset);var s=this.getSize(e),u;switch(a){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=i,u},getLabelBgStyleByPosition:function(e,t){var n;if(!e)return{};var i=(n=t.style)===null||n===void 0?void 0:n.background;if(!i)return{};var a=e.getBBox(),o=$g(i.padding),s=a.width+o[1]+o[3],u=a.height+o[0]+o[2];return B(B({x:a.minX-o[3],y:a.minY-o[0]},i),{width:s,height:u})},drawShape:function(e,t){var n=this.shapeType,i=this.getShapeStyle(e),a=t.addShape(n,{attrs:i,draggable:!0,name:"node-shape"});return t.shapeMap["node-shape"]=a,a},updateLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=t.shapeMap["link-point-left"]||t.find(function(A){return A.get("className")==="link-point-left"}),a=t.shapeMap["link-point-right"]||t.find(function(A){return A.get("className")==="link-point-right"}),o=t.shapeMap["link-point-top"]||t.find(function(A){return A.get("className")==="link-point-top"}),s=t.shapeMap["link-point-bottom"]||t.find(function(A){return A.get("className")==="link-point-bottom"}),u;i&&(u=i.attr()),a&&!u&&(u=a.attr()),o&&!u&&(u=o.attr()),s&&!u&&(u=s.attr()),u||(u=n);var f=gt({},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),x=b[0],w=b[1],E={r:d,fill:l,stroke:c,lineWidth:h};if(i)!p&&p!==void 0?(i.remove(),delete t.shapeMap["link-point-left"]):i.attr(B(B({},E),{x:-x/2,y:0}));else if(p){var _="link-point-left";t.shapeMap[_]=t.addShape("circle",{attrs:B(B({},E),{x:-x/2,y:0}),className:_,name:_,isAnchorPoint:!0})}if(a)!g&&g!==void 0&&(a.remove(),delete t.shapeMap["link-point-right"]),a.attr(B(B({},E),{x:x/2,y:0}));else if(g){var M="link-point-right";t.shapeMap[M]=t.addShape("circle",{attrs:B(B({},E),{x:x/2,y:0}),className:M,name:M,isAnchorPoint:!0})}if(o)!y&&y!==void 0&&(o.remove(),delete t.shapeMap["link-point-top"]),o.attr(B(B({},E),{x:0,y:-w/2}));else if(y){var C="link-point-top";t.shapeMap[C]=t.addShape("circle",{attrs:B(B({},E),{x:0,y:-w/2}),className:C,name:C,isAnchorPoint:!0})}if(s)!m&&m!==void 0?(s.remove(),delete t.shapeMap["link-point-bottom"]):s.attr(B(B({},E),{x:0,y:w/2}));else if(m){var S="link-point-bottom";t.shapeMap[S]=t.addShape("circle",{attrs:B(B({},E),{x:0,y:w/2}),className:S,name:S,isAnchorPoint:!0})}},updateShape:function(e,t,n,i,a){var o=t.get("keyShape");o.attr(B({},n)),this.updateLabel(e,t,a),i&&this.updateIcon(e,t)},updateIcon:function(e,t){var n=this,i=t.getContainer(),a=(this.mergeStyle||this.getOptions(e)).icon,o=e.icon?e.icon:{show:void 0,text:void 0},s=o.show,u=o.text,f=i.shapeMap["".concat(this.type,"-icon")]||i.find(function(y){return y.get("name")==="".concat(n.type,"-icon")});if(f)if(s||s===void 0){var l=gt({},f.attr(),a),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(B(B({},l),{x:-h/2,y:-v/2}))}else f.remove(),delete i.shapeMap["".concat(this.type,"-icon")];else if(s){var p="".concat(this.type,"-icon");if(u)i.shapeMap[p]=i.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:p,name:p});else{var h=a.width,v=a.height;i.shapeMap[p]=i.addShape("image",{attrs:B(B({},a),{x:-h/2,y:-v/2}),className:p,name:p})}var g=i.shapeMap["node-label"]||i.find(function(y){return y.get("name")==="node-label"});g&&g.toFront()}}},a8=B(B({},t0),i8);yr.registerNode("single-node",a8);var _h="edge-shape";function o8(r){var e=r;return r==="start"?e="end":r==="end"&&(e="start"),e}var s8={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:B({},ft.edgeStateStyles)},getPath:function(e){var t=[];return ye(e,function(n,i){i===0?t.push(["M",n.x,n.y]):t.push(["L",n.x,n.y])}),t},getShapeStyle:function(e){var t=this.options.style,n={stroke:e.color},i=gt({},t,n,e.style),a=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=gt({},ft.defaultEdge.style,{stroke:ft.defaultEdge.color,lineWidth:a,path:l},i);return c},updateShapeStyle:function(e,t,n){var i,a=t.getContainer(),o=((i=t.getKeyShape)===null||i===void 0?void 0:i.call(t))||a.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=B({},e.style),m.lineWidth===void 0&&(m.lineWdith=(ht(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,t,n){var i=t.position||this.labelPosition,a={},o=n==null?void 0:n.shapeMap[_h],s;i==="start"?s=0:i==="end"?s=1:s=.5;var u=t.refX||this.refX,f=t.refY||this.refY;if(e.startPoint.x===e.endPoint.x&&e.startPoint.y===e.endPoint.y)return a.x=e.startPoint.x+u,a.y=e.startPoint.y+f,a.text=e.label,a;var l;ct(t.autoRotate)?l=this.labelAutoRotate:l=t.autoRotate;var c=AE(o,s,u,f,l);return a.x=c.x,a.y=c.y,a.rotate=c.rotate,a.textAlign=this._getTextAlign(i,c.angle),a.text=e.label,a},getLabelBgStyleByPosition:function(e,t){if(!e)return{};var n=e.getBBox(),i=t.style&&t.style.background;if(!i)return{};var a=i.padding,o=n.width+a[1]+a[3],s=n.height+a[0]+a[2],u=B(B({},i),{width:o,height:s,x:n.minX-a[3],y:n.minY-a[0],matrix:[1,0,0,0,1,0,0,0,1]}),f;return ct(t.autoRotate)?f=this.labelAutoRotate:f=t.autoRotate,f&&(u.matrix=e.attr("matrix")||[1,0,0,0,1,0,0,0,1]),u},_getTextAlign:function(e,t){var n="center";return t?(t=t%(Math.PI*2),e!=="center"&&(t>=0&&t<=Math.PI/2||t>=3/2*Math.PI&&t<2*Math.PI?n=e:n=o8(e)),n):e},getControlPoints:function(e){return e.controlPoints},getPathPoints:function(e){return e},drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("path",{className:_h,name:_h,attrs:n});return t.shapeMap[_h]=i,i},drawLabel:function(e,t){var n=this.options.labelCfg,i=gr({},n,e.labelCfg),a=this.getLabelStyle(e,i,t),o=a.rotate;delete a.rotate;var s=t.addShape("text",{attrs:a,name:"text-shape",labelRelated:!0,draggable:!0});if(t.shapeMap["text-shape"]=s,!isNaN(o)&&o!==""&&s.rotateAtStart(o),a.background){var u=this.drawLabelBg(e,t,s,a,o),f=this.itemType+e0;u.set("classname",f),t.shapeMap[f]=u,s.toFront()}return s},drawLabelBg:function(e,t,n,i,a){var o=this.options.labelCfg,s=gr({},o,e.labelCfg),u=this.getLabelBgStyleByPosition(n,s),f=t.addShape("rect",{name:"text-bg-shape",attrs:u,labelRelated:!0});return t.shapeMap["text-bg-shape"]=f,f}},u8=B(B({},t0),s8);yr.registerEdge("single-edge",u8),yr.registerEdge("line",{getControlPoints:function(){}},"single-edge"),yr.registerEdge("spline",{getPath:function(e){var t=R_(e);return t}},"single-edge"),yr.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(e){var t=e.startPoint,n=e.endPoint,i={x:(t.x+n.x)/2,y:(t.y+n.y)/2},a,o;if(e.controlPoints!==void 0){if(o=e.controlPoints[0],a=Kp(t,o,n),t.x<=n.x&&t.y>n.y?this.clockwise=a.x>o.x?0:1:t.x<=n.x&&t.yo.x?1:0:t.x>n.x&&t.y<=n.y?this.clockwise=a.y0&&d(w[0])}},y=0;y0;)h.push(u.pop());o.push(h)}}return o};lo.detectConnectedComponents=iS;var aS=function(e){for(var t=e.nodes,n=t===void 0?[]:t,i=e.edges,a=i===void 0?[]:i,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,nS.getNeighbors)(y.id,a,"target").filter(function(_){return n.map(function(M){return M.id}).indexOf(_)>-1}),b=function(M){var C=m[M];if(!u[C]&&u[C]!==0){var S=n.filter(function(A){return A.id===C});S.length>0&&g(S[0]),f[y.id]=Math.min(f[y.id],f[C])}else s[C]&&(f[y.id]=Math.min(f[y.id],u[C]))},x=0;x0;){var E=o.pop();if(s[E.id]=!1,w.push(E),E===y)break}w.length>0&&l.push(w)}},d=0,v=n;d0;)for(var g=d.pop(),y=g.id,m=(0,uS.getNeighbors)(y,e.edges),b=function(E){var _,M=m[E],C=e.nodes.find(function(G){return G.id===M});if(M===y)o.push((_={},_[M]=g,_));else if(!(M in p))v[M]=g,d.push(C),p[M]=new Set([g]);else if(!p[y].has(C)){for(var S=!0,A=[C,g],T=v[y];p[M].size&&!p[M].has(T)&&(A.push(T),T!==v[T.id]);)T=v[T.id];if(A.push(T),t&&n?(S=!1,A.findIndex(function(G){return t.indexOf(G.id)>-1})>-1&&(S=!0)):t&&!n&&A.findIndex(function(G){return t.indexOf(G.id)>-1})>-1&&(S=!1),S){for(var k={},O=1;O0;){var O=k.pop();a.has(O)&&(a.delete(O),o[O.id].forEach(function(G){k.push(G)}),o[O.id].clear())}},c=function A(T,k,O){var G=!1;if(t&&n===!1&&t.indexOf(T.id)>-1)return G;i.push(T),a.add(T);for(var D=O[T.id],$=0;$-1});te-1)?s.push((k={},k[J.id]=J,k)):W[J.id].push(f[pe])}}return{component:P,adjList:W,minIdx:G}},b=0;b=b}),w=(0,sS.detectStrongConnectComponents)({nodes:x,edges:e.edges}).filter(function(A){return A.length>1});if(w.length===0)break;var E=m(w),_=E.minIdx,M=E.adjList,C=E.component;if(C.length>1){C.forEach(function(A){o[A.id]=new Set});var S=u[_];if(t&&n&&t.indexOf(S.id)===-1)return s;c(S,S,M),b=_+1}else break}return s};ra.detectAllDirectedCycle=cS;var H8=function(e,t,n,i){return i===void 0&&(i=!0),t?cS(e,n,i):lS(e,n,i)};ra.detectAllCycles=H8;var q8=V8;ra.default=q8;var Js={};const hS=ea(UD),Lf=ea(t3);Object.defineProperty(Js,"__esModule",{value:!0}),Js.default=void 0;var dS=hS,Z8=Lf,vS=Vr,K8=function(e,t,n){for(var i=1/0,a,o=0;ol[x.id]+A?(l[S]=l[x.id]+A,c[S]=[x.id]):l[S]===l[x.id]+A&&c[S].push(x.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=i?(0,Ih.getNeighbors)(v,s,"target"):(0,Ih.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=n$;var Nf={};Object.defineProperty(Nf,"__esModule",{value:!0}),Nf.default=void 0;var i$=a$(Ho);function a$(r){return r&&r.__esModule?r:{default:r}}var o$=function(e,t){for(var n=(0,i$.default)(e,t),i=[],a=n.length,o=0;oi[o][u]+i[u][s]&&(i[o][s]=i[o][u]+i[u][s]);return i},s$=o$;Nf.default=s$;var kh={};Object.defineProperty(kh,"__esModule",{value:!0}),kh.default=void 0;var u$=l$(Ho),f$=Vr;function l$(r){return r&&r.__esModule?r:{default:r}}var c$=function(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=e.nodes,o=a===void 0?[]:a,s=e.edges,u=s===void 0?[]:s,f={},l={};o.forEach(function(b,x){var w=(0,f$.uniqueId)();b.clusterId=w,f[w]={id:w,nodes:[b]},l[b.id]={node:b,idx:x}});var c=(0,u$.default)(e,t),h={};c.forEach(function(b,x){var w=o[x].id;h[w]={},b.forEach(function(E,_){if(E){var M=o[_].id;h[w][M]=E}})});for(var d=0,v=function(){var x=!1;if(o.forEach(function(w){var E={};Object.keys(h[w.id]).forEach(function(O){var G=h[w.id][O],D=l[O].node,$=D.clusterId;E[$]||(E[$]=0),E[$]+=G});var _=-1/0,M=[];if(Object.keys(E).forEach(function(O){_=0&&M.splice(C,1),M&&M.length){x=!0;var S=f[w.clusterId],A=S.nodes.indexOf(w);S.nodes.splice(A,1);var T=Math.floor(Math.random()*M.length),k=f[M[T]];k.nodes.push(w),w.clusterId=k.id}}}),!x)return"break";d++};d0&&M>C&&M-CC&&(A=c.map(function(N){return{node:N,clusterId:N.clusterId}}),T=(0,E$.clone)(m),C=M),k||S>100)break;S++,Object.keys(m).forEach(function(N){var P=0;d.forEach(function(W){var J=W.source,te=W.target,H=b[J].node.clusterId,pe=b[te].node.clusterId;(H===N&&pe!==N||pe===N&&H!==N)&&(P=P+(W[n]||1))}),m[N].sumTot=P}),c.forEach(function(N,P){var W=m[N.clusterId],J=0,te,H=w[P]/(2*_),pe=0,Te=W.nodes;Te.forEach(function(Wt){var dr=b[Wt.id].idx;pe+=x[P][dr]||0});var Ne=pe-W.sumTot*H,Ze=Te.filter(function(Wt){return Wt.id!==N.id});Ze.forEach(function(Wt,dr){v[Wt.originIndex]});var at=u0(Ze,v)*f,nt=E[N.id];if(Object.keys(nt).forEach(function(Wt){var dr=b[Wt].node,lr=dr.clusterId;if(lr!==N.clusterId){var Ut=m[lr],ar=Ut.nodes;if(!(!ar||!ar.length)){var Zr=0;ar.forEach(function(Ge){var me=b[Ge.id].idx;Zr+=x[P][me]||0});var tt=Zr-Ut.sumTot*H,ae=ar.concat([N]);ae.forEach(function(Ge,me){v[Ge.originIndex]});var L=u0(ae,v)*f,Se=tt-Ne;a&&(Se=tt+L-(Ne+at)),Se>J&&(J=Se,te=Ut)}}}),J>0){te.nodes.push(N);var St=N.clusterId;N.clusterId=te.id;var Mt=W.nodes.indexOf(N);W.nodes.splice(Mt,1);var fr=0,Ft=0;d.forEach(function(Wt){var dr=Wt.source,lr=Wt.target,Ut=b[dr].node.clusterId,ar=b[lr].node.clusterId;(Ut===te.id&&ar!==te.id||ar===te.id&&Ut!==te.id)&&(fr=fr+(Wt[n]||1)),(Ut===St&&ar!==St||ar===St&&Ut!==St)&&(Ft=Ft+(Wt[n]||1))}),te.sumTot=fr,W.sumTot=Ft}})}var O={},G=0;Object.keys(T).forEach(function(N){var P=T[N];if(!P.nodes||!P.nodes.length){delete T[N];return}var W=String(G+1);W!==N&&(P.id=W,P.nodes=P.nodes.map(function(J){return{id:J.id,clusterId:W}}),T[W]=P,O[N]=W,delete T[N],G++)}),A.forEach(function(N){var P=N.node,W=N.clusterId;P&&(P.clusterId=W,P.clusterId&&O[P.clusterId]&&(P.clusterId=O[P.clusterId]))});var D=[],$={};d.forEach(function(N){var P=N.source,W=N.target,J=N[n]||1,te=b[P].node.clusterId,H=b[W].node.clusterId;if(!(!te||!H)){var pe="".concat(te,"---").concat(H);if($[pe])$[pe].weight+=J,$[pe].count++;else{var Te={source:te,target:H,weight:J,count:1};$[pe]=Te,D.push(Te)}}});var Y=[];return Object.keys(T).forEach(function(N){Y.push(T[N])}),{clusters:Y,clusterEdges:D}},A$=C$;Lh.default=A$;var Nh={},Oh={};Object.defineProperty(Oh,"__esModule",{value:!0}),Oh.default=void 0;var T$=function(){function r(e){this.count=e.length,this.parent={};for(var t=0,n=e;t0&&(this.list[0]=t,this.moveDown(0)),e},r.prototype.insert=function(e){if(e!==null){this.list.push(e);var t=this.list.length-1;return this.moveUp(t),!0}return!1},r.prototype.moveUp=function(e){for(var t=this.getParent(e);e&&e>0&&this.compareFn(this.list[t],this.list[e])>0;){var n=this.list[t];this.list[t]=this.list[e],this.list[e]=n,e=t,t=this.getParent(e)}},r.prototype.moveDown=function(e){var t,n=e,i=this.getLeft(e),a=this.getRight(e),o=this.list.length;i!==null&&i0?n=i:a!==null&&a0&&(n=a),e!==n&&(t=[this.list[n],this.list[e]],this.list[e]=t[0],this.list[n]=t[1],this.moveDown(n))},r}(),N$=L$;Dh.default=N$,Object.defineProperty(Nh,"__esModule",{value:!0}),Nh.default=void 0;var O$=CS(Oh),D$=CS(Dh),f0=Vr;function CS(r){return r&&r.__esModule?r:{default:r}}var P$=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=a[0],f=new Set;f.add(u);var l=function(g,y){return t?g.weight-y.weight:0},c=new D$.default(l);for((0,f0.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,f0.getEdgesByNodeId)(d,s).forEach(function(p){c.insert(p)})),f.has(v)||(f.add(v),(0,f0.getEdgesByNodeId)(v,s).forEach(function(p){c.insert(p)})))}return n},AS=function(e,t){var n=[],i=e.nodes,a=i===void 0?[]:i,o=e.edges,s=o===void 0?[]:o;if(a.length===0)return n;var u=s.map(function(d){return d});t&&u.sort(function(d,v){return d.weight-v.weight});for(var f=new O$.default(a.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},R$=function(e,t,n){var i={prim:P$,kruskal:AS};return n?i[n](e,t):AS(e,t)},B$=R$;Nh.default=B$;var Ph={};Object.defineProperty(Ph,"__esModule",{value:!0}),Ph.default=void 0;var F$=z$(Ca),G$=Vr;function z$(r){return r&&r.__esModule?r:{default:r}}var $$=function(e,t,n){typeof t!="number"&&(t=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=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&&i>t;){a=0;for(var p=0;p0&&(h+=v[w]/E)}d[y]=n*h,a+=d[y]}}a=(1-a)/c,i=0;for(var p=0;p=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,o=i.toNode;ad||i.hasNode(o[h.to])||(t.labelb;w--){var E=x(w);if(E==="break")break}if(y){var _=e.findMinLabel(g);o.dfsEdgeList.push(new qo(p,m,Pn.VACANT_NODE_LABEL,_.edgeLabel,Pn.VACANT_NODE_LABEL));var M=o.dfsEdgeList.length-1;return e.dfsCode.dfsEdgeList[M]!==o.dfsEdgeList[M]?!1:c(g[_.edgeLabel].projected)}var C={};y=!1;var S=0;h.forEach(function(D){var $=new Fh(D),Y=e.findForwardPureEdges(i,$.edges[d[0]],v,$);Y.length>0&&(y=!0,S=p,Y.forEach(function(N){var P="".concat(N.label,"-").concat(a[N.to].label);C[P]||(C[P]={projected:[],edgeLabel:N.label,nodeLabel2:a[N.to].label}),C[P].projected.push({graphId:i.id,edge:N,preNode:D})}))});for(var A=d.length,T=function($){if(y)return"break";var Y=d[$];h.forEach(function(N){var P=new Fh(N),W=e.findForwardRmpathEdges(i,P.edges[Y],v,P);W.length>0&&(y=!0,S=o.dfsEdgeList[Y].fromNode,W.forEach(function(J){var te="".concat(J.label,"-").concat(a[J.to].label);C[te]||(C[te]={projected:[],edgeLabel:J.label,nodeLabel2:a[J.to].label}),C[te].projected.push({graphId:i.id,edge:J,preNode:N})}))})},w=0;w=0;v--){var p=t.findBackwardEdge(c,d.edges[a[v]],d.edges[a[0]],d);if(p){var g="".concat(t.dfsCode.dfsEdgeList[a[v]].fromNode,"-").concat(p.label);f[g]||(f[g]={projected:[],toNodeId:t.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:p.label}),f[g].projected.push({graphId:l.graphId,edge:p,preNode:l})}}if(!(i>=t.maxNodeNum)){var y=t.findForwardPureEdges(c,d.edges[a[0]],s,d);y.forEach(function(b){var x="".concat(o,"-").concat(b.label,"-").concat(h[b.to].label);u[x]||(u[x]={projected:[],fromNodeId:o,edgeLabel:b.label,nodeLabel2:h[b.to].label}),u[x].projected.push({graphId:l.graphId,edge:b,preNode:l})});for(var m=function(x){var w=t.findForwardRmpathEdges(c,d.edges[a[x]],s,d);w.forEach(function(E){var _="".concat(t.dfsCode.dfsEdgeList[a[x]].fromNode,"-").concat(E.label,"-").concat(h[E.to].label);u[_]||(u[_]={projected:[],fromNodeId:t.dfsCode.dfsEdgeList[a[x]].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 x=g.label,w="".concat(y,"-").concat(x,"-").concat(m);if(!o[w]){var E=o[w]||0;E++,o[w]=E}})})}),Object.keys(a).forEach(function(u){var f=a[u];if(!(f2*t)););if(g<2*t&&(s["".concat(l,"-").concat(p)]={start:l,end:p,distance:a[l][p]},c++,u++,u>=n))return s;if(h++,h>2*t)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[t]={degree:u,inDegree:f,outDegree:l}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:f,minPatternNodeLabelOutDegree:l}},nj=function(e,t,n,i,a,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,PS.default)(e,n),c=(0,PS.default)(t,n),h=$S(e.nodes,l,n),d=$S(t.nodes,c,n),v=GS(e.nodes,o),p=v.nodeMap,g=v.nodeLabelMap,y=GS(t.nodes,o),m=y.nodeMap,b=y.nodeLabelMap;zS(e.edges,s,p);var x=zS(t.edges,s,m).edgeLabelMap,w=[];c==null||c.forEach(function(tt){w=w.concat(tt)}),a||(a=Math.max.apply(Math,(0,DS.__spreadArray)((0,DS.__spreadArray)([],w,!1),[2],!1))),i||(i=a);var E=BS(e,l,o,i),_=BS(t,c,o,i),M=Math.min(100,f*(f-1)/2),C=ej(i,f,M,E,l),S=Gh(C,E,e),A=10,T=1,k=1,O=4,G={graphs:S,nodeLabelProp:o,edgeLabelProp:s,minSupport:T,minNodeNum:k,maxNodeNum:O,directed:n},D=(0,Q$.default)(G).slice(0,A),$=D.length,Y=[];D.forEach(function(tt,ae){Y[ae]={},Object.keys(S).forEach(function(L){var Se=S[L],Ge=zh(Se,tt,o,s);Y[ae][L]=Ge})});var N=tj(Y,$,D),P=N.structure,W=N.structureCountMap,J=t.nodes[0],te=[],H=(u=t.nodes[0])===null||u===void 0?void 0:u[o],pe=-1/0;t.nodes.forEach(function(tt){var ae=tt[o],L=g[ae];(L==null?void 0:L.length)>pe&&(pe=L.length,te=L,H=ae,J=tt)});var Te={},Ne={},Ze={},at={},nt={},St={};Object.keys(b).forEach(function(tt,ae){nt[tt]=[],n&&(St[tt]=[]);var L=b[tt],Se={};L.forEach(function(qe){var et=d["".concat(J.id,"-").concat(qe.id)];if(et&&nt[tt].push(et),Se["".concat(J.id,"-").concat(qe.id)]={start:0,end:m[qe.id].idx,distance:et},n){var yt=d["".concat(qe.id,"-").concat(J.id)];yt&&St[tt].push(yt)}}),nt[tt]=nt[tt].sort(function(qe,et){return qe-et}),n&&(St[tt]=St[tt].sort(function(qe,et){return qe-et})),Ne=Gh(Se,_,t,Ne);var Ge=[];if(Object.keys(Se).forEach(function(qe){if(Ze[qe]){Ge.push(Ze[qe]);return}var et=Ne[qe];Ze[qe]=zh(et,P,o,s),Ge.push(Ze[qe])}),Ge=Ge.sort(function(qe,et){return et-qe}),at["".concat(J.id,"-").concat(tt)]=Ge,tt!==H)for(var me=(te==null?void 0:te.length)||0,Ye=function(et){var yt=te[et],Pt=E[p[yt.id].idx],cr=Pt.nodeLabelCountMap[tt],Rt=b[tt].length;if(!cr||cr.countnt[tt][ur]){hr=!0;break}if(hr)return te.splice(et,1),"continue";var xr={};Pt.neighbors.forEach(function(or){var jr=h["".concat(yt.id,"-").concat(or.id)];xr["".concat(yt.id,"-").concat(or.id)]={start:p[yt.id].idx,end:p[or.id].idx,distance:jr}}),S=Gh(xr,E,e,S);var vr=[];Object.keys(xr).forEach(function(or){if(W[or]){vr.push(W[or]);return}var jr=S[or];W[or]=zh(jr,P,o,s),vr.push(W[or])}),vr=vr.sort(function(or,jr){return jr-or});for(var En=!1,ur=0;ur=0;We--)Ye(We)});var Mt=[];te==null||te.forEach(function(tt){for(var ae=p[tt.id].idx,L=FS(e.nodes,l[ae],ae,o,a),Se=L.neighbors,Ge=Se.length,me=!1,Ye=Ge-1;Ye>=0;Ye--){if(Se.length+1cr){Se.splice(Ye,1);continue}if(n){var Rt="".concat(We.id,"-").concat(tt.id),hr=h[Rt];Pt=St[qe].length-1;var ur=St[qe][Pt];if(hr>ur){Se.splice(Ye,1);continue}}var xr=W[et]?W[et]:rj(e,tt,We,p,yt,E,P,o,s,W,S),vr="".concat(J.id,"-").concat(qe),En=at[vr][at[vr].length-1];if(xr=0;yt--){var ur=hr(yt);if(ur==="break")break}if(Rt)return Mt.splice(ae,1),"continue";L.edges=Ye;var xr=(0,RS.default)(L,L.nodes[0].id,!1).length;if(Object.keys(xr).reverse().forEach(function(At){if(!(At===L.nodes[0].id||Rt)){if(xr[At]===1/0){var pr=me[At].node[o];if(Ge[pr]--,Ge[pr]Ft[kr][Ft[kr].length-1]){var pr=me[At].node[o];if(Ge[pr]--,Ge[pr]=0;Ri--){var Kr=L.nodes[Ri],Oo=me[Kr.id].degree,Jl=me[Kr.id].inDegree,ec=me[Kr.id].outDegree,pn=Kr[o],Va=jS(Te,pn,m,b),_s=Va.minPatternNodeLabelDegree,tc=Va.minPatternNodeLabelInDegree,rc=Va.minPatternNodeLabelOutDegree,nc=n?Oo<_s||Jl=0;Bi--){var Ur=Ye[Bi];if(!me[Ur.source]||!me[Ur.target]){Ye.splice(Bi,1);var Fi=Ur[s];if(We[Fi]--,me[Ur.source]&&(me[Ur.source].degree--,me[Ur.source].outDegree--),me[Ur.target]&&(me[Ur.target].degree--,me[Ur.target].inDegree--),x[Fi]&&We[Fi]=0;lr--){var Ut=dr(lr);if(Ut==="break")break}for(var ar=Mt.length,Zr=function(ae){var L=Mt[ae],Se={};L.edges.forEach(function(Ye){var We="".concat(Ye.source,"-").concat(Ye.target,"-").concat(Ye.label);Se[We]?Se[We]++:Se[We]=1});for(var Ge=function(We){var qe=Mt[We],et={};qe.edges.forEach(function(Pt){var cr="".concat(Pt.source,"-").concat(Pt.target,"-").concat(Pt.label);et[cr]?et[cr]++:et[cr]=1});var yt=!0;Object.keys(et).length!==Object.keys(Se).length?yt=!1:Object.keys(Se).forEach(function(Pt){et[Pt]!==Se[Pt]&&(yt=!1)}),yt&&Mt.splice(We,1)},me=ar-1;me>ae;me--)Ge(me);ar=Mt.length},lr=0;lr<=ar-1;lr++)Zr(lr);return Mt}}},ij=nj;Rh.default=ij,function(r){function e(x){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w},e(x)}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"GADDI",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(r,"breadthFirstSearch",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(r,"connectedComponent",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(r,"depthFirstSearch",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(r,"detectCycle",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(r,"dijkstra",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(r,"findAllPath",{enumerable:!0,get:function(){return f.findAllPath}}),Object.defineProperty(r,"findShortestPath",{enumerable:!0,get:function(){return f.findShortestPath}}),Object.defineProperty(r,"floydWarshall",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(r,"getAdjMatrix",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(r,"getDegree",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(r,"getInDegree",{enumerable:!0,get:function(){return a.getInDegree}}),Object.defineProperty(r,"getNeighbors",{enumerable:!0,get:function(){return g.getNeighbors}}),Object.defineProperty(r,"getOutDegree",{enumerable:!0,get:function(){return a.getOutDegree}}),Object.defineProperty(r,"labelPropagation",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(r,"louvain",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(r,"minimumSpanningTree",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(r,"pageRank",{enumerable:!0,get:function(){return v.default}});var t=b(Ho),n=b(Ch),i=b(lo),a=m(Ca),o=b(ra),s=b(Th),u=b(Js),f=eu,l=b(Nf),c=b(kh),h=b(Lh),d=b(Nh),v=b(Ph),p=b(Rh),g=Vr;function y(x){if(typeof WeakMap!="function")return null;var w=new WeakMap,E=new WeakMap;return(y=function(M){return M?E:w})(x)}function m(x,w){if(x&&x.__esModule)return x;if(x===null||e(x)!=="object"&&typeof x!="function")return{default:x};var E=y(w);if(E&&E.has(x))return E.get(x);var _={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var C in x)if(C!=="default"&&Object.prototype.hasOwnProperty.call(x,C)){var S=M?Object.getOwnPropertyDescriptor(x,C):null;S&&(S.get||S.set)?Object.defineProperty(_,C,S):_[C]=x[C]}return _.default=x,E&&E.set(x,_),_}function b(x){return x&&x.__esModule?x:{default:x}}}(rS);function h0(r){"@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(r)}Object.defineProperty(Mh,"__esModule",{value:!0}),Mh.default=void 0;var d0=aj(rS),US=fo;function XS(r){if(typeof WeakMap!="function")return null;var e=new WeakMap,t=new WeakMap;return(XS=function(i){return i?t:e})(r)}function aj(r,e){if(r&&r.__esModule)return r;if(r===null||h0(r)!=="object"&&typeof r!="function")return{default:r};var t=XS(e);if(t&&t.has(r))return t.get(r);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in r)if(a!=="default"&&Object.prototype.hasOwnProperty.call(r,a)){var o=i?Object.getOwnPropertyDescriptor(r,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=r[a]}return n.default=r,t&&t.set(r,n),n}var v0=typeof self<"u"?self:{};v0.onmessage=function(r){var e=r.data,t=e._algorithmType,n=e.data;if(t){if(typeof d0[t]=="function"){var i=d0[t].apply(d0,n);v0.postMessage({_algorithmType:US.MESSAGE.SUCCESS,data:i});return}v0.postMessage({_algorithmType:US.MESSAGE.FAILURE})}};var oj=null;Mh.default=oj,Object.defineProperty(Sh,"__esModule",{value:!0}),Sh.default=void 0;var sj=fo,uj=fj(Mh);function fj(r){return r&&r.__esModule?r:{default:r}}var lj=function(e){return function(){for(var t=[],n=0;n=r&&i<=r+t&&a>=e&&a<=e+n}function Bf(r,e){return!(e.minX>r.maxX||e.maxXr.maxY||e.maxY=0&&i<1/2*Math.PI?(s={x:o.minX,y:o.minY},u={x:o.maxX,y:o.maxY}):1/2*Math.PI<=i&&i1&&(t*=Math.sqrt(d),n*=Math.sqrt(d));var v=t*t*(h*h)+n*n*(c*c),p=v?Math.sqrt((t*t*(n*n)-v)/v):1;a===o&&(p*=-1),isNaN(p)&&(p=0);var g=n?p*t*h/n:0,y=t?p*-n*c/t:0,m=(s+f)/2+Math.cos(i)*g-Math.sin(i)*y,b=(u+l)/2+Math.sin(i)*g+Math.cos(i)*y,x=[(c-g)/t,(h-y)/n],w=[(-1*c-g)/t,(-1*h-y)/n],E=qS([1,0],x),_=qS(x,w);return p0(x,w)<=-1&&(_=Math.PI),p0(x,w)>=1&&(_=0),o===0&&_>0&&(_=_-2*Math.PI),o===1&&_<0&&(_=_+2*Math.PI),{cx:m,cy:b,rx:WS(r,[f,l])?0:t,ry:WS(r,[f,l])?0:n,startAngle:E,endAngle:E+_,xRotation:i,arcFlag:a,sweepFlag:o}}var jh=Math.sin,Uh=Math.cos,g0=Math.atan2,Xh=Math.PI;function KS(r,e,t,n,i,a,o){var s=e.stroke,u=e.lineWidth,f=t-i,l=n-a,c=g0(l,f),h=new _0({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:{path:"M"+10*Uh(Xh/6)+","+10*jh(Xh/6)+" L0,0 L"+10*Uh(Xh/6)+",-"+10*jh(Xh/6),stroke:s,lineWidth:u}});h.translate(i,a),h.rotateAtPoint(i,a,c),r.set(o?"startArrowShape":"endArrowShape",h)}function QS(r,e,t,n,i,a,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=Jr(c,["d","fill","stroke","lineWidth"]),y=t-i,m=n-a,b=g0(m,y);h&&(i=i-Uh(b)*h,a=a-jh(b)*h);var x=new _0({type:"path",canvas:r.get("canvas"),isArrowShape:!0,attrs:B(B({},g),{stroke:v||f,lineWidth:p||l,fill:d})});x.translate(i,a),x.rotateAtPoint(i,a,b),r.set(o?"startArrowShape":"endArrowShape",x)}function Ko(r,e,t,n,i){var a=g0(n-e,t-r);return{dx:Uh(a)*i,dy:jh(a)*i}}function y0(r,e,t,n,i,a){typeof e.startArrow=="object"?QS(r,e,t,n,i,a,!0):e.startArrow?KS(r,e,t,n,i,a,!0):r.set("startArrowShape",null)}function m0(r,e,t,n,i,a){typeof e.endArrow=="object"?QS(r,e,t,n,i,a,!1):e.endArrow?KS(r,e,t,n,i,a,!1):r.set("startArrowShape",null)}var JS={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"};function ru(r,e){var t=e.attr();for(var n in t){var i=t[n],a=JS[n]?JS[n]:n;a==="matrix"&&i?r.transform(i[0],i[1],i[3],i[4],i[6],i[7]):a==="lineDash"&&r.setLineDash?vt(i)&&r.setLineDash(i):(a==="strokeStyle"||a==="fillStyle"?i=$j(r,e,i):a==="globalAlpha"&&(i=i*r.globalAlpha),r[a]=i)}}function b0(r,e,t){for(var n=0;nw?x:w,A=x>w?1:x/w,T=x>w?w/x:1;e.translate(m,b),e.rotate(M),e.scale(A,T),e.arc(0,0,S,E,_,1-C),e.scale(1/A,1/T),e.rotate(-M),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 rM(r,e){var t=r.get("canvas");t&&(e==="remove"&&(r._cacheCanvasBBox=r.get("cacheCanvasBBox")),r.get("hasChanged")||(r.set("hasChanged",!0),r.cfg.parent&&r.cfg.parent.get("hasChanged")||(t.refreshElement(r,e,t),t.get("autoDraw")&&t.draw())))}function Yj(r){var e;if(r.destroyed)e=r._cacheCanvasBBox;else{var t=r.get("cacheCanvasBBox"),n=t&&!!(t.width&&t.height),i=r.getCanvasBBox(),a=i&&!!(i.width&&i.height);n&&a?e=Dj(t,i):n?e=t:a&&(e=i)}return e}function Wj(r){if(!r.length)return null;var e=[],t=[],n=[],i=[];return ye(r,function(a){var o=Yj(a);o&&(e.push(o.minX),t.push(o.minY),n.push(o.maxX),i.push(o.maxY))}),{minX:Ui(e),minY:Ui(t),maxX:ji(n),maxY:ji(i)}}function Vj(r,e){return!r||!e||!Bf(r,e)?null:{minX:Math.max(r.minX,e.minX),minY:Math.max(r.minY,e.minY),maxX:Math.min(r.maxX,e.maxX),maxY:Math.min(r.maxY,e.maxY)}}var nM=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.onCanvasChange=function(t){rM(this,t)},e.prototype.getShapeBase=function(){return gp},e.prototype.getGroupBase=function(){return e},e.prototype._applyClip=function(t,n){n&&(t.save(),ru(t,n),n.createPath(t),t.restore(),t.clip(),n._afterDraw())},e.prototype.cacheCanvasBBox=function(){var t=this.cfg.children,n=[],i=[];ye(t,function(h){var d=h.cfg.cacheCanvasBBox;d&&h.cfg.isInView&&(n.push(d.minX,d.maxX),i.push(d.minY,d.maxY))});var a=null;if(n.length){var o=Ui(n),s=ji(n),u=Ui(i),f=ji(i);a={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",Bf(a,c))}}else this.set("isInView",!1);this.set("cacheCanvasBBox",a)},e.prototype.draw=function(t,n){var i=this.cfg.children,a=n?this.cfg.refresh:!0;i.length&&a&&(t.save(),ru(t,this),this._applyClip(t,this.getClip()),b0(t,i,n),t.restore(),this.cacheCanvasBBox()),this.cfg.refresh=null,this.set("hasChanged",!1)},e.prototype.skipDraw=function(){this.set("cacheCanvasBBox",null),this.set("hasChanged",!1)},e}(z2),Si=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{lineWidth:1,lineAppendWidth:0,strokeOpacity:1,fillOpacity:1})},e.prototype.getShapeBase=function(){return gp},e.prototype.getGroupBase=function(){return nM},e.prototype.onCanvasChange=function(t){rM(this,t)},e.prototype.calculateBBox=function(){var t=this.get("type"),n=this.getHitLineWidth(),i=U2(t),a=i(this),o=n/2,s=a.x-o,u=a.y-o,f=a.x+a.width+o,l=a.y+a.height+o;return{x:s,minX:s,y:u,minY:u,width:a.width+n,height:a.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(t,n){n&&(t.save(),ru(t,n),n.createPath(t),t.restore(),t.clip(),n._afterDraw())},e.prototype.draw=function(t,n){var i=this.cfg.clipShape;if(n){if(this.cfg.refresh===!1){this.set("hasChanged",!1);return}var a=this.getCanvasBBox();if(!Bf(n,a)){this.set("hasChanged",!1),this.cfg.isInView&&this._afterDraw();return}}t.save(),ru(t,this),this._applyClip(t,i),this.drawPath(t),t.restore(),this._afterDraw()},e.prototype.getCanvasViewBox=function(){var t=this.cfg.canvas;return t?t.getViewRange():null},e.prototype.cacheCanvasBBox=function(){var t=this.getCanvasViewBox();if(t){var n=this.getCanvasBBox(),i=Bf(n,t);this.set("isInView",i),i?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(t){this.createPath(t),this.strokeAndFill(t),this.afterDrawPath(t)},e.prototype.fill=function(t){t.fill()},e.prototype.stroke=function(t){t.stroke()},e.prototype.strokeAndFill=function(t){var n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isFill()&&(!ct(s)&&s!==1?(t.globalAlpha=s,this.fill(t),t.globalAlpha=a):this.fill(t)),this.isStroke()&&i>0&&(!ct(o)&&o!==1&&(t.globalAlpha=o),this.stroke(t)),this.afterDrawPath(t)},e.prototype.createPath=function(t){},e.prototype.afterDrawPath=function(t){},e.prototype.isInShape=function(t,n){var i=this.isStroke(),a=this.isFill(),o=this.getHitLineWidth();return this.isInStrokeOrPath(t,n,i,a,o)},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){return!1},e.prototype.getHitLineWidth=function(){if(!this.isStroke())return 0;var t=this.attrs;return t.lineWidth+t.lineAppendWidth},e}($2),Hj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,r:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=s.x,f=s.y,l=s.r,c=o/2,h=YS(u,f,t,n);return a&&i?h<=l+c:a?h<=l:i?h>=l-c&&h<=l+c:!1},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.r;t.beginPath(),t.arc(i,a,o,0,Math.PI*2,!1),t.closePath()},e}(Si);function Yh(r,e,t,n){return r/(t*t)+e/(n*n)}var qj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,rx:0,ry:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){var s=this.attr(),u=o/2,f=s.x,l=s.y,c=s.rx,h=s.ry,d=(t-f)*(t-f),v=(n-l)*(n-l);return a&&i?Yh(d,v,c+u,h+u)<=1:a?Yh(d,v,c,h)<=1:i?Yh(d,v,c-u,h-u)>=1&&Yh(d,v,c+u,h+u)<=1:!1},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.rx,s=n.ry;if(t.beginPath(),t.ellipse)t.ellipse(i,a,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;t.save(),t.translate(i,a),t.scale(f,l),t.arc(0,0,u,0,Math.PI*2),t.restore(),t.closePath()}},e}(Si);function iM(r){return r instanceof HTMLElement&&Pe(r.nodeName)&&r.nodeName.toUpperCase()==="CANVAS"}var Zj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0})},e.prototype.initAttrs=function(t){this._setImage(t.img)},e.prototype.isStroke=function(){return!1},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._afterLoading=function(){if(this.get("toDraw")===!0){var t=this.get("canvas");t?t.draw():this.createPath(this.get("context"))}},e.prototype._setImage=function(t){var n=this,i=this.attrs;if(Pe(t)){var a=new Image;a.onload=function(){if(n.destroyed)return!1;n.attr("img",a),n.set("loading",!1),n._afterLoading();var o=n.get("callback");o&&o.call(n)},a.crossOrigin="Anonymous",a.src=t,this.set("loading",!0)}else t instanceof Image?(i.width||(i.width=t.width),i.height||(i.height=t.height)):iM(t)&&(i.width||(i.width=Number(t.getAttribute("width"))),i.height||(i.height,Number(t.getAttribute("height"))))},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t==="img"&&this._setImage(n)},e.prototype.createPath=function(t){if(this.get("loading")){this.set("toDraw",!0),this.set("context",t);return}var n=this.attr(),i=n.x,a=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||iM(h))&&(!ct(u)&&!ct(f)&&!ct(l)&&!ct(c)?t.drawImage(h,u,f,l,c,i,a,o,s):t.drawImage(h,i,a,o,s))},e}(Si);function co(r,e,t,n,i,a,o){var s=Math.min(r,t),u=Math.max(r,t),f=Math.min(e,n),l=Math.max(e,n),c=i/2;return a>=s-c&&a<=u+c&&o>=f-c&&o<=l+c?dn.pointToLine(r,e,t,n,a,o)<=i/2:!1}var Kj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.initAttrs=function(t){this.setArrow()},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),this.setArrow()},e.prototype.setArrow=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2,s=t.startArrow,u=t.endArrow;s&&y0(this,t,a,o,n,i),u&&m0(this,t,n,i,a,o)},e.prototype.isInStrokeOrPath=function(t,n,i,a,o){if(!i||!o)return!1;var s=this.attr(),u=s.x1,f=s.y1,l=s.x2,c=s.y2;return co(u,f,l,c,o,t,n)},e.prototype.createPath=function(t){var n=this.attr(),i=n.x1,a=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=Ko(i,a,o,s,n.startArrow.d)),f&&f.d&&(c=Ko(i,a,o,s,n.endArrow.d)),t.beginPath(),t.moveTo(i+l.dx,a+l.dy),t.lineTo(o-c.dx,s-c.dy)},e.prototype.afterDrawPath=function(t){var n=this.get("startArrowShape"),i=this.get("endArrowShape");n&&n.draw(t),i&&i.draw(t)},e.prototype.getTotalLength=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2;return dn.length(n,i,a,o)},e.prototype.getPoint=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return dn.pointAt(i,a,o,s,t)},e}(Si),Qj={circle:function(r,e,t){return[["M",r-t,e],["A",t,t,0,1,0,r+t,e],["A",t,t,0,1,0,r-t,e]]},square:function(r,e,t){return[["M",r-t,e-t],["L",r+t,e-t],["L",r+t,e+t],["L",r-t,e+t],["Z"]]},diamond:function(r,e,t){return[["M",r-t,e],["L",r,e-t],["L",r+t,e],["L",r,e+t],["Z"]]},triangle:function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e+n],["L",r,e-n],["L",r+t,e+n],["Z"]]},"triangle-down":function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e-n],["L",r+t,e-n],["L",r,e+n],["Z"]]}},Jj=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.initAttrs=function(t){this._resetParamsCache()},e.prototype._resetParamsCache=function(){this.set("paramsCache",{})},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),["symbol","x","y","r","radius"].indexOf(t)!==-1&&this._resetParamsCache()},e.prototype.isOnlyHitBox=function(){return!0},e.prototype._getR=function(t){return ct(t.r)?t.radius:t.r},e.prototype._getPath=function(){var t=this.attr(),n=t.x,i=t.y,a=t.symbol||"circle",o=this._getR(t),s,u;if(_r(a))s=a,u=s(n,i,o),u=h_(u);else{if(s=e.Symbols[a],!s)return console.warn(a+" marker is not supported."),null;u=s(n,i,o)}return u},e.prototype.createPath=function(t){var n=this._getPath(),i=this.get("paramsCache");tM(this,t,{path:n},i)},e.Symbols=Qj,e}(Si);function aM(r,e,t){var n=s_();return r.createPath(n),n.isPointInPath(e,t)}var eU=1e-6;function E0(r){return Math.abs(r)0!=E0(s[1]-t)>0&&E0(e-(t-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}function Ff(r,e,t,n,i,a,o,s){var u=(Math.atan2(s-e,o-r)+Math.PI*2)%(Math.PI*2);if(ui)return!1;var f={x:r+t*Math.cos(u),y:e+t*Math.sin(u)};return YS(f.x,f.y,o,s)<=a/2}var rU=ni;function nU(r){for(var e=!1,t=r.length,n=0;nb?m:b,C=m>b?1:m/b,S=m>b?b/m:1,A=rU(null,[["t",-g,-y],["r",-E],["s",1/C,1/S]]);Pc(_,_,A),a=Ff(0,0,M,x,w,e,_[0],_[1]);break}if(a)break}}return a}function aU(r){for(var e=r.length,t=[],n=[],i=[],a=0;a0&&n.push(i),{polygons:t,polylines:n}}const Wh=B({hasArc:nU,extractPolygons:aU,isPointInStroke:iU},hG);function sM(r,e,t){for(var n=!1,i=0;i=l[0]&&t<=l[1]&&(i=(t-l[0])/(l[1]-l[0]),a=c)});var s=o[a];if(ct(s)||ct(a))return null;var u=s.length,f=o[a+1];return Cf.pointAt(s[u-2],s[u-1],f[1],f[2],f[3],f[4],f[5],f[6],i)},e.prototype._calculateCurve=function(){var t=this.attr().path;this.set("curve",Wh.pathToCurve(t))},e.prototype._setTcache=function(){var t=0,n=0,i=[],a,o,s,u,f=this.get("curve");if(f){if(ye(f,function(l,c){s=f[c+1],u=l.length,s&&(t+=Cf.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6])||0)}),this.set("totalLength",t),t===0){this.set("tCache",[]);return}ye(f,function(l,c){s=f[c+1],u=l.length,s&&(a=[],a[0]=n/t,o=Cf.length(l[u-2],l[u-1],s[1],s[2],s[3],s[4],s[5],s[6]),n+=o||0,a[1]=n/t,i.push(a))}),this.set("tCache",i)}},e.prototype.getStartTangent=function(){var t=this.getSegments(),n;if(t.length>1){var i=t[0].currentPoint,a=t[1].currentPoint,o=t[1].startTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([a[0],a[1]]),n.push([i[0],i[1]]))}return n},e.prototype.getEndTangent=function(){var t=this.getSegments(),n=t.length,i;if(n>1){var a=t[n-2].currentPoint,o=t[n-1].currentPoint,s=t[n-1].endTangent;i=[],s?(i.push([o[0]-s[0],o[1]-s[1]]),i.push([o[0],o[1]])):(i.push([a[0],a[1]]),i.push([o[0],o[1]]))}return i},e}(Si);function uM(r,e,t,n,i){var a=r.length;if(a<2)return!1;for(var o=0;o=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),dn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},e.prototype._setTcache=function(){var t=this.attr().points;if(!(!t||t.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;ye(t,function(u,f){t[f+1]&&(o=[],o[0]=i/n,s=dn.length(u[0],u[1],t[f+1][0],t[f+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,n=[];return n.push([t[1][0],t[1][1]]),n.push([t[0][0],t[0][1]]),n},e.prototype.getEndTangent=function(){var t=this.attr().points,n=t.length-1,i=[];return i.push([t[n-1][0],t[n-1][1]]),i.push([t[n][0],t[n][1]]),i},e}(Si);function uU(r,e,t,n,i,a,o){var s=i/2;return Zo(r-s,e-s,t,i,a,o)||Zo(r+t-s,e-s,i,n,a,o)||Zo(r+s,e+n-s,t,i,a,o)||Zo(r-s,e+s,i,n,a,o)}function fU(r,e,t,n,i,a,o,s){return co(r+i,e,r+t-i,e,a,o,s)||co(r+t,e+i,r+t,e+n-i,a,o,s)||co(r+t-i,e+n,r+i,e+n,a,o,s)||co(r,e+n-i,r,e+i,a,o,s)||Ff(r+t-i,e+i,i,1.5*Math.PI,2*Math.PI,a,o,s)||Ff(r+t-i,e+n-i,i,0,.5*Math.PI,a,o,s)||Ff(r+i,e+n-i,i,.5*Math.PI,Math.PI,a,o,s)||Ff(r+i,e+i,i,Math.PI,1.5*Math.PI,a,o,s)}var lU=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.isInStrokeOrPath=function(t,n,i,a,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 i&&(v=fU(u,f,l,c,h,o,t,n)),!v&&a&&(v=aM(this,t,n)),v}else{var d=o/2;if(a&&i)return Zo(u-d,f-d,l+d,c+d,t,n);if(a)return Zo(u,f,l,c,t,n);if(i)return uU(u,f,l,c,o,t,n)}},e.prototype.createPath=function(t){var n=this.attr(),i=n.x,a=n.y,o=n.width,s=n.height,u=n.radius;if(t.beginPath(),u===0)t.rect(i,a,o,s);else{var f=jj(u),l=f[0],c=f[1],h=f[2],d=f[3];t.moveTo(i+l,a),t.lineTo(i+o-c,a),c!==0&&t.arc(i+o-c,a+c,c,-Math.PI/2,0),t.lineTo(i+o,a+s-h),h!==0&&t.arc(i+o-h,a+s-h,h,0,Math.PI/2),t.lineTo(i+d,a+s),d!==0&&t.arc(i+d,a+s-d,d,Math.PI/2,Math.PI),t.lineTo(i,a+l),l!==0&&t.arc(i+l,a+l,l,Math.PI,Math.PI*1.5),t.closePath()}},e}(Si),cU=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{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(t){this._assembleFont(),t.text&&this._setText(t.text)},e.prototype._assembleFont=function(){var t=this.attrs;t.font=f_(t)},e.prototype._setText=function(t){var n=null;Pe(t)&&t.indexOf(` `)!==-1&&(n=t.split(` `)),this.set("textArr",n)},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),t.startsWith("font")&&this._assembleFont(),t==="text"&&this._setText(n)},e.prototype._getSpaceingY=function(){var t=this.attrs,n=t.lineHeight,i=t.fontSize*1;return n?n-i:i*.14},e.prototype._drawTextArr=function(t,n,i){var a=this.attrs,o=a.textBaseline,s=a.x,u=a.y,f=a.fontSize*1,l=this._getSpaceingY(),c=u_(a.text,a.fontSize,a.lineHeight),h;ye(n,function(d,v){h=u+v*(l+f)-c+f,o==="middle"&&(h+=c-f-(c-f)/2),o==="top"&&(h+=c-f),ct(d)||(i?t.fillText(d,s,h):t.strokeText(d,s,h))})},e.prototype._drawText=function(t,n){var i=this.attr(),a=i.x,o=i.y,s=this.get("textArr");if(s)this._drawTextArr(t,s,n);else{var u=i.text;ct(u)||(n?t.fillText(u,a,o):t.strokeText(u,a,o))}},e.prototype.strokeAndFill=function(t){var n=this.attrs,i=n.lineWidth,a=n.opacity,o=n.strokeOpacity,s=n.fillOpacity;this.isStroke()&&i>0&&(!ct(o)&&o!==1&&(t.globalAlpha=a),this.stroke(t)),this.isFill()&&(!ct(s)&&s!==1?(t.globalAlpha=s,this.fill(t),t.globalAlpha=a):this.fill(t)),this.afterDrawPath(t)},e.prototype.fill=function(t){this._drawText(t,!0)},e.prototype.stroke=function(t){this._drawText(t,!1)},e}(Si);function hU(r,e){if(e){var t=KE(e);return Xo(t,r)}return r}function fM(r,e,t){var n=r.getTotalMatrix();if(n){var i=hU([e,t,1],n),a=i[0],o=i[1];return[a,o]}return[e,t]}function lM(r,e,t){if(r.isCanvas&&r.isCanvas())return!0;if(!pg(r)||r.cfg.isInView===!1)return!1;if(r.cfg.clipShape){var n=fM(r,e,t),i=n[0],a=n[1];if(r.isClipped(i,a))return!1}var o=r.cfg.cacheCanvasBBox||r.getCanvasBBox();return e>=o.minX&&e<=o.maxX&&t>=o.minY&&t<=o.maxY}function cM(r,e,t){if(!lM(r,e,t))return null;for(var n=null,i=r.getChildren(),a=i.length,o=a-1;o>=0;o--){var s=i[o];if(s.isGroup())n=cM(s,e,t);else if(lM(s,e,t)){var u=s,f=fM(s,e,t),l=f[0],c=f[1];u.isInShape(l,c)&&(n=s)}if(n)break}return n}var Aa=function(r){It(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.getDefaultCfg=function(){var t=r.prototype.getDefaultCfg.call(this);return t.renderer="canvas",t.autoDraw=!0,t.localRefresh=!0,t.refreshElements=[],t.clipView=!0,t.quickHit=!1,t},e.prototype.onCanvasChange=function(t){(t==="attr"||t==="sort"||t==="changeSize")&&(this.set("refreshElements",[this]),this.draw())},e.prototype.getShapeBase=function(){return gp},e.prototype.getGroupBase=function(){return nM},e.prototype.getPixelRatio=function(){var t=this.get("pixelRatio")||Oj();return t>=1?Math.ceil(t):1},e.prototype.getViewRange=function(){return{minX:0,minY:0,maxX:this.cfg.width,maxY:this.cfg.height}},e.prototype.createDom=function(){var t=document.createElement("canvas"),n=t.getContext("2d");return this.set("context",n),t},e.prototype.setDOMSize=function(t,n){r.prototype.setDOMSize.call(this,t,n);var i=this.get("context"),a=this.get("el"),o=this.getPixelRatio();a.width=o*t,a.height=o*n,o>1&&i.scale(o,o)},e.prototype.clear=function(){r.prototype.clear.call(this),this._clearFrame();var t=this.get("context"),n=this.get("el");t.clearRect(0,0,n.width,n.height)},e.prototype.getShape=function(t,n){var i;return this.get("quickHit")?i=cM(this,t,n):i=r.prototype.getShape.call(this,t,n,null),i},e.prototype._getRefreshRegion=function(){var t=this.get("refreshElements"),n=this.getViewRange(),i;if(t.length&&t[0]===this)i=n;else if(i=Wj(t),i){i.minX=Math.floor(i.minX),i.minY=Math.floor(i.minY),i.maxX=Math.ceil(i.maxX),i.maxY=Math.ceil(i.maxY),i.maxY+=1;var a=this.get("clipView");a&&(i=Vj(i,n))}return i},e.prototype.refreshElement=function(t){var n=this.get("refreshElements");n.push(t)},e.prototype._clearFrame=function(){var t=this.get("drawFrame");t&&(lx(t),this.set("drawFrame",null),this.set("refreshElements",[]))},e.prototype.draw=function(){var t=this.get("drawFrame");this.get("autoDraw")&&t||this._startDraw()},e.prototype._drawAll=function(){var t=this.get("context"),n=this.get("el"),i=this.getChildren();t.clearRect(0,0,n.width,n.height),ru(t,this),b0(t,i),this.set("refreshElements",[])},e.prototype._drawRegion=function(){var t=this.get("context"),n=this.get("refreshElements"),i=this.getChildren(),a=this._getRefreshRegion();a?(t.clearRect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),t.save(),t.beginPath(),t.rect(a.minX,a.minY,a.maxX-a.minX,a.maxY-a.minY),t.clip(),ru(t,this),Uj(this,i,a),b0(t,i,a),t.restore()):n.length&&eM(n),ye(n,function(o){o.get("hasChanged")&&o.set("hasChanged",!1)}),this.set("refreshElements",[])},e.prototype._startDraw=function(){var t=this,n=this.get("drawFrame"),i=this.get("drawFrameCallback");n||(n=fx(function(){t.get("localRefresh")?t._drawRegion():t._drawAll(),t.set("drawFrame",null),i&&i()}),this.set("drawFrame",n))},e.prototype.skipDraw=function(){},e.prototype.removeDom=function(){var t=this.get("el");t.width=0,t.height=0,t.parentNode.removeChild(t)},e}(G2),S0={rect:"path",circle:"circle",line:"line",path:"path",marker:"path",text:"text",polyline:"polyline",polygon:"polygon",image:"image",ellipse:"ellipse",dom:"foreignObject"},ir={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 ai(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function hM(r){var e=S0[r.type],t=r.getParent();if(!e)throw new Error("the type "+r.type+" is not supported by svg");var n=ai(e);if(r.get("id")&&(n.id=r.get("id")),r.set("el",n),r.set("attrs",{}),t){var i=t.get("el");i||(i=t.createDom(),t.set("el",i)),i.appendChild(n)}return n}function dM(r,e){var t=r.get("el"),n=vx(t.children).sort(e),i=document.createDocumentFragment();n.forEach(function(a){i.appendChild(a)}),t.appendChild(i)}function dU(r,e){var t=r.parentNode,n=Array.from(t.childNodes).filter(function(s){return s.nodeType===1&&s.nodeName.toLowerCase()!=="defs"}),i=n[e],a=n.indexOf(r);if(i){if(a>e)t.insertBefore(r,i);else if(a0&&(n?"stroke"in i?this._setColor(t,"stroke",s):"strokeStyle"in i&&this._setColor(t,"stroke",u):this._setColor(t,"stroke",s||u),l&&h.setAttribute(ir.strokeOpacity,l),c&&h.setAttribute(ir.lineWidth,c))},e.prototype._setColor=function(t,n,i){var a=this.get("el");if(!i){a.setAttribute(ir[n],"none");return}if(i=i.trim(),/^[r,R,L,l]{1}[\s]*\(/.test(i)){var o=t.find("gradient",i);o||(o=t.addGradient(i)),a.setAttribute(ir[n],"url(#"+o+")")}else if(/^[p,P]{1}[\s]*\(/.test(i)){var o=t.find("pattern",i);o||(o=t.addPattern(i)),a.setAttribute(ir[n],"url(#"+o+")")}else a.setAttribute(ir[n],i)},e.prototype.shadow=function(t,n){var i=this.attr(),a=n||i,o=a.shadowOffsetX,s=a.shadowOffsetY,u=a.shadowBlur,f=a.shadowColor;(o||s||u||f)&&vU(this,t)},e.prototype.transform=function(t){var n=this.attr(),i=(t||n).matrix;i&&Gf(this)},e.prototype.isInShape=function(t,n){return this.isPointInPath(t,n)},e.prototype.isPointInPath=function(t,n){var i=this.get("el"),a=this.get("canvas"),o=a.get("el").getBoundingClientRect(),s=t+o.left,u=n+o.top,f=document.elementFromPoint(s,u);return!!(f&&f.isEqualNode(i))},e.prototype.getHitLineWidth=function(){var t=this.attrs,n=t.lineWidth,i=t.lineAppendWidth;return this.isStroke()?n+i:0},e}($2),pU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="circle",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,r:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):ir[s]&&a.setAttribute(ir[s],o)})},e}(oi),gU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dom",t.canFill=!1,t.canStroke=!1,t}return e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");if(ye(n||i,function(f,l){ir[l]&&a.setAttribute(ir[l],f)}),typeof i.html=="function"){var o=i.html.call(this,i);if(o instanceof Element||o instanceof HTMLDocument){for(var s=a.childNodes,u=s.length-1;u>=0;u--)a.removeChild(s[u]);a.appendChild(o)}else a.innerHTML=o}else a.innerHTML=i.html},e}(oi),yU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="ellipse",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,rx:0,ry:0})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){s==="x"||s==="y"?a.setAttribute("c"+s,o):ir[s]&&a.setAttribute(ir[s],o)})},e}(oi),mU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="image",t.canFill=!1,t.canStroke=!1,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");ye(n||a,function(s,u){u==="img"?i._setImage(a.img):ir[u]&&o.setAttribute(ir[u],s)})},e.prototype.setAttr=function(t,n){this.attrs[t]=n,t==="img"&&this._setImage(n)},e.prototype._setImage=function(t){var n=this.attr(),i=this.get("el");if(Pe(t))i.setAttribute("href",t);else if(t instanceof window.Image)n.width||(i.setAttribute("width",t.width),this.attr("width",t.width)),n.height||(i.setAttribute("height",t.height),this.attr("height",t.height)),i.setAttribute("href",t.src);else if(t instanceof HTMLElement&&Pe(t.nodeName)&&t.nodeName.toUpperCase()==="CANVAS")i.setAttribute("href",t.toDataURL());else if(t instanceof ImageData){var a=document.createElement("canvas");a.setAttribute("width",""+t.width),a.setAttribute("height",""+t.height),a.getContext("2d").putImageData(t,0,0),n.width||(i.setAttribute("width",""+t.width),this.attr("width",t.width)),n.height||(i.setAttribute("height",""+t.height),this.attr("height",t.height)),i.setAttribute("href",a.toDataURL())}},e}(oi),bU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="line",t.canFill=!1,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x1:0,y1:0,x2:0,y2:0,startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){if(s==="startArrow"||s==="endArrow")if(o){var u=un(o)?t.addArrow(i,ir[s]):t.getDefaultArrow(i,ir[s]);a.setAttribute(ir[s],"url(#"+u+")")}else a.removeAttribute(ir[s]);else ir[s]&&a.setAttribute(ir[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr(),n=t.x1,i=t.y1,a=t.x2,o=t.y2;return dn.length(n,i,a,o)},e.prototype.getPoint=function(t){var n=this.attr(),i=n.x1,a=n.y1,o=n.x2,s=n.y2;return dn.pointAt(i,a,o,s,t)},e}(oi),Vh={circle:function(r,e,t){return[["M",r,e],["m",-t,0],["a",t,t,0,1,0,t*2,0],["a",t,t,0,1,0,-t*2,0]]},square:function(r,e,t){return[["M",r-t,e-t],["L",r+t,e-t],["L",r+t,e+t],["L",r-t,e+t],["Z"]]},diamond:function(r,e,t){return[["M",r-t,e],["L",r,e-t],["L",r+t,e],["L",r,e+t],["Z"]]},triangle:function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e+n],["L",r,e-n],["L",r+t,e+n],["z"]]},triangleDown:function(r,e,t){var n=t*Math.sin(.3333333333333333*Math.PI);return[["M",r-t,e-n],["L",r+t,e-n],["L",r,e+n],["Z"]]}};const yM={get:function(r){return Vh[r]},register:function(r,e){Vh[r]=e},remove:function(r){delete Vh[r]},getAll:function(){return Vh}};var xU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="marker",t.canFill=!0,t.canStroke=!0,t}return e.prototype.createPath=function(t){var n=this.get("el");n.setAttribute("d",this._assembleMarker())},e.prototype._assembleMarker=function(){var t=this._getPath();return vt(t)?t.map(function(n){return n.join(" ")}).join(""):t},e.prototype._getPath=function(){var t=this.attr(),n=t.x,i=t.y,a=t.r||t.radius,o=t.symbol||"circle",s;return _r(o)?s=o:s=yM.get(o),s?s(n,i,a):(console.warn(s+" symbol is not exist."),null)},e.symbolsFactory=yM,e}(oi),wU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="path",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el");ye(n||a,function(s,u){if(u==="path"&&vt(s))o.setAttribute("d",i._formatPath(s));else if(u==="startArrow"||u==="endArrow")if(s){var f=un(s)?t.addArrow(a,ir[u]):t.getDefaultArrow(a,ir[u]);o.setAttribute(ir[u],"url(#"+f+")")}else o.removeAttribute(ir[u]);else ir[u]&&o.setAttribute(ir[u],s)})},e.prototype._formatPath=function(t){var n=t.map(function(i){return i.join(" ")}).join("");return~n.indexOf("NaN")?"":n},e.prototype.getTotalLength=function(){var t=this.get("el");return t?t.getTotalLength():null},e.prototype.getPoint=function(t){var n=this.get("el"),i=this.getTotalLength();if(i===0)return null;var a=n?n.getPointAtLength(t*i):null;return a?{x:a.x,y:a.y}:null},e}(oi),EU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="polygon",t.canFill=!0,t.canStroke=!0,t}return e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){s==="points"&&vt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):ir[s]&&a.setAttribute(ir[s],o)})},e}(oi),_U=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="polyline",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{startArrow:!1,endArrow:!1})},e.prototype.onAttrChange=function(t,n,i){r.prototype.onAttrChange.call(this,t,n,i),["points"].indexOf(t)!==-1&&this._resetCache()},e.prototype._resetCache=function(){this.set("totalLength",null),this.set("tCache",null)},e.prototype.createPath=function(t,n){var i=this.attr(),a=this.get("el");ye(n||i,function(o,s){s==="points"&&vt(o)&&o.length>=2?a.setAttribute("points",o.map(function(u){return u[0]+","+u[1]}).join(" ")):ir[s]&&a.setAttribute(ir[s],o)})},e.prototype.getTotalLength=function(){var t=this.attr().points,n=this.get("totalLength");return ct(n)?(this.set("totalLength",a_.length(t)),this.get("totalLength")):n},e.prototype.getPoint=function(t){var n=this.attr().points,i=this.get("tCache");i||(this._setTcache(),i=this.get("tCache"));var a,o;return ye(i,function(s,u){t>=s[0]&&t<=s[1]&&(a=(t-s[0])/(s[1]-s[0]),o=u)}),dn.pointAt(n[o][0],n[o][1],n[o+1][0],n[o+1][1],a)},e.prototype._setTcache=function(){var t=this.attr().points;if(!(!t||t.length===0)){var n=this.getTotalLength();if(!(n<=0)){var i=0,a=[],o,s;ye(t,function(u,f){t[f+1]&&(o=[],o[0]=i/n,s=dn.length(u[0],u[1],t[f+1][0],t[f+1][1]),i+=s,o[1]=i/n,a.push(o))}),this.set("tCache",a)}}},e.prototype.getStartTangent=function(){var t=this.attr().points,n=[];return n.push([t[1][0],t[1][1]]),n.push([t[0][0],t[0][1]]),n},e.prototype.getEndTangent=function(){var t=this.attr().points,n=t.length-1,i=[];return i.push([t[n-1][0],t[n-1][1]]),i.push([t[n][0],t[n][1]]),i},e}(oi);function SU(r){var e=0,t=0,n=0,i=0;return vt(r)?r.length===1?e=t=n=i=r[0]:r.length===2?(e=n=r[0],t=i=r[1]):r.length===3?(e=r[0],t=i=r[1],n=r[2]):(e=r[0],t=r[1],n=r[2],i=r[3]):e=t=n=i=r,{r1:e,r2:t,r3:n,r4:i}}var MU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="rect",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{x:0,y:0,width:0,height:0,radius:0})},e.prototype.createPath=function(t,n){var i=this,a=this.attr(),o=this.get("el"),s=!1,u=["x","y","width","height","radius"];ye(n||a,function(f,l){u.indexOf(l)!==-1&&!s?(o.setAttribute("d",i._assembleRect(a)),s=!0):u.indexOf(l)===-1&&ir[l]&&o.setAttribute(ir[l],f)})},e.prototype._assembleRect=function(t){var n=t.x,i=t.y,a=t.width,o=t.height,s=t.radius;if(!s)return"M "+n+","+i+" l "+a+",0 l 0,"+o+" l"+-a+" 0 z";var u=SU(s);vt(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)+","+i],["l "+(a-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-a)+",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}(oi),mM=.3,CU={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"baseline",hanging:"hanging"},AU={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",hanging:"hanging"},TU={left:"left",start:"left",center:"middle",right:"end",end:"end"},IU=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="text",t.canFill=!0,t.canStroke=!0,t}return e.prototype.getDefaultAttrs=function(){var t=r.prototype.getDefaultAttrs.call(this);return B(B({},t),{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(t,n){var i=this,a=this.attr(),o=this.get("el");this._setFont(),ye(n||a,function(s,u){u==="text"?i._setText(""+s):u==="matrix"&&s?Gf(i):ir[u]&&o.setAttribute(ir[u],s)}),o.setAttribute("paint-order","stroke"),o.setAttribute("style","stroke-linecap:butt; stroke-linejoin:miter;")},e.prototype._setFont=function(){var t=this.get("el"),n=this.attr(),i=n.textBaseline,a=n.textAlign,o=qE();o&&o.name==="firefox"?t.setAttribute("dominant-baseline",AU[i]||"alphabetic"):t.setAttribute("alignment-baseline",CU[i]||"baseline"),t.setAttribute("text-anchor",TU[a]||"left")},e.prototype._setText=function(t){var n=this.get("el"),i=this.attr(),a=i.x,o=i.textBaseline,s=o===void 0?"bottom":o;if(!t)n.innerHTML="";else if(~t.indexOf(` `)){var u=t.split(` `),f=u.length-1,l="";ye(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=t},e}(oi),kU=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,LU=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,NU=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function bM(r){var e=r.match(NU);if(!e)return"";var t="";return e.sort(function(n,i){return n=n.split(":"),i=i.split(":"),Number(n[0])-Number(i[0])}),ye(e,function(n){n=n.split(":"),t+=''}),t}function OU(r,e){var t=kU.exec(r),n=Ic(kc(parseFloat(t[1])),Math.PI*2),i=t[2],a,o;n>=0&&n<.5*Math.PI?(a={x:0,y:0},o={x:1,y:1}):.5*Math.PI<=n&&n`;t.innerHTML=n},r}(),xM=function(){function r(e,t){this.cfg={};var n=ai("marker"),i=Yi("marker_");n.setAttribute("id",i);var a=ai("path");a.setAttribute("stroke",e.stroke||"none"),a.setAttribute("fill",e.fill||"none"),n.appendChild(a),n.setAttribute("overflow","visible"),n.setAttribute("orient","auto-start-reverse"),this.el=n,this.child=a,this.id=i;var o=e[t==="marker-start"?"startArrow":"endArrow"];return this.stroke=e.stroke||"#000",o===!0?this._setDefaultPath(t,a):(this.cfg=o,this._setMarker(e.lineWidth,a)),this}return r.prototype.match=function(){return!1},r.prototype._setDefaultPath=function(e,t){var n=this.el;t.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")},r.prototype._setMarker=function(e,t){var n=this.el,i=this.cfg.path,a=this.cfg.d;vt(i)&&(i=i.map(function(o){return o.join(" ")}).join("")),t.setAttribute("d",i),n.appendChild(t),a&&n.setAttribute("refX",""+a/e)},r.prototype.update=function(e){var t=this.child;t.attr?t.attr("fill",e):t.setAttribute("fill",e)},r}(),GU=function(){function r(e){this.type="clip",this.cfg={};var t=ai("clipPath");this.el=t,this.id=Yi("clip_"),t.id=this.id;var n=e.cfg.el;return t.appendChild(n),this.cfg=e,this}return r.prototype.match=function(){return!1},r.prototype.remove=function(){var e=this.el;e.parentNode.removeChild(e)},r}(),zU=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,$U=function(){function r(e){this.cfg={};var t=ai("pattern");t.setAttribute("patternUnits","userSpaceOnUse");var n=ai("image");t.appendChild(n);var i=Yi("pattern_");t.id=i,this.el=t,this.id=i,this.cfg=e;var a=zU.exec(e),o=a[2];n.setAttribute("href",o);var s=new Image;o.match(/^data:/i)||(s.crossOrigin="Anonymous"),s.src=o;function u(){t.setAttribute("width",""+s.width),t.setAttribute("height",""+s.height)}return s.complete?u():(s.onload=u,s.src=s.src),this}return r.prototype.match=function(e,t){return this.cfg===t},r}(),jU=function(){function r(e){var t=ai("defs"),n=Yi("defs_");t.id=n,e.appendChild(t),this.children=[],this.defaultArrow={},this.el=t,this.canvas=e}return r.prototype.find=function(e,t){for(var n=this.children,i=null,a=0;a=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")},YU=XU,WU=Array.prototype.concat,VU=Array.prototype.slice,_M=EM.exports=function(e){for(var t=[],n=0,i=e.length;n=4&&r[3]!==1&&(e=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+e+")"},Vn.to.keyword=function(r){return MM[r.slice(0,3)]};function ho(r,e,t){return Math.min(Math.max(e,r),t)}function Hh(r){var e=Math.round(r).toString(16).toUpperCase();return e.length<2?"0"+e:e}var qU=wM.exports,CM={exports:{}},ZU={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]},Qo=ZU,AM={};for(var C0 in Qo)Qo.hasOwnProperty(C0)&&(AM[Qo[C0]]=C0);var Et=CM.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 Rn in Et)if(Et.hasOwnProperty(Rn)){if(!("channels"in Et[Rn]))throw new Error("missing channels property: "+Rn);if(!("labels"in Et[Rn]))throw new Error("missing channel labels property: "+Rn);if(Et[Rn].labels.length!==Et[Rn].channels)throw new Error("channel and label counts mismatch: "+Rn);var KU=Et[Rn].channels,QU=Et[Rn].labels;delete Et[Rn].channels,delete Et[Rn].labels,Object.defineProperty(Et[Rn],"channels",{value:KU}),Object.defineProperty(Et[Rn],"labels",{value:QU})}Et.rgb.hsl=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i=Math.min(e,t,n),a=Math.max(e,t,n),o=a-i,s,u,f;return a===i?s=0:e===a?s=(t-n)/o:t===a?s=2+(n-e)/o:n===a&&(s=4+(e-t)/o),s=Math.min(s*60,360),s<0&&(s+=360),f=(i+a)/2,a===i?u=0:f<=.5?u=o/(a+i):u=o/(2-a-i),[s,u*100,f*100]},Et.rgb.hsv=function(r){var e,t,n,i,a,o=r[0]/255,s=r[1]/255,u=r[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?i=a=0:(a=l/f,e=c(o),t=c(s),n=c(u),o===f?i=n-t:s===f?i=1/3+e-n:u===f&&(i=2/3+t-e),i<0?i+=1:i>1&&(i-=1)),[i*360,a*100,f*100]},Et.rgb.hwb=function(r){var e=r[0],t=r[1],n=r[2],i=Et.rgb.hsl(r)[0],a=1/255*Math.min(e,Math.min(t,n));return n=1-1/255*Math.max(e,Math.max(t,n)),[i,a*100,n*100]},Et.rgb.cmyk=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i,a,o,s;return s=Math.min(1-e,1-t,1-n),i=(1-e-s)/(1-s)||0,a=(1-t-s)/(1-s)||0,o=(1-n-s)/(1-s)||0,[i*100,a*100,o*100,s*100]};function JU(r,e){return Math.pow(r[0]-e[0],2)+Math.pow(r[1]-e[1],2)+Math.pow(r[2]-e[2],2)}Et.rgb.keyword=function(r){var e=AM[r];if(e)return e;var t=1/0,n;for(var i in Qo)if(Qo.hasOwnProperty(i)){var a=Qo[i],o=JU(r,a);o.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var i=e*.4124+t*.3576+n*.1805,a=e*.2126+t*.7152+n*.0722,o=e*.0193+t*.1192+n*.9505;return[i*100,a*100,o*100]},Et.rgb.lab=function(r){var e=Et.rgb.xyz(r),t=e[0],n=e[1],i=e[2],a,o,s;return t/=95.047,n/=100,i/=108.883,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=i>.008856?Math.pow(i,1/3):7.787*i+16/116,a=116*n-16,o=500*(t-n),s=200*(n-i),[a,o,s]},Et.hsl.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100,i,a,o,s,u;if(t===0)return u=n*255,[u,u,u];n<.5?a=n*(1+t):a=n+t-n*t,i=2*n-a,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=i+(a-i)*6*o:2*o<1?u=a:3*o<2?u=i+(a-i)*(2/3-o)*6:u=i,s[f]=u*255;return s},Et.hsl.hsv=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,i=t,a=Math.max(n,.01),o,s;return n*=2,t*=n<=1?n:2-n,i*=a<=1?a:2-a,s=(n+t)/2,o=n===0?2*i/(a+i):2*t/(n+t),[e,o*100,s*100]},Et.hsv.rgb=function(r){var e=r[0]/60,t=r[1]/100,n=r[2]/100,i=Math.floor(e)%6,a=e-Math.floor(e),o=255*n*(1-t),s=255*n*(1-t*a),u=255*n*(1-t*(1-a));switch(n*=255,i){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]}},Et.hsv.hsl=function(r){var e=r[0],t=r[1]/100,n=r[2]/100,i=Math.max(n,.01),a,o,s;return s=(2-t)*n,a=(2-t)*i,o=t*i,o/=a<=1?a:2-a,o=o||0,s/=2,[e,o*100,s*100]},Et.hwb.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100,i=t+n,a,o,s,u;i>1&&(t/=i,n/=i),a=Math.floor(6*e),o=1-n,s=6*e-a,a&1&&(s=1-s),u=t+s*(o-t);var f,l,c;switch(a){default:case 6:case 0:f=o,l=u,c=t;break;case 1:f=u,l=o,c=t;break;case 2:f=t,l=o,c=u;break;case 3:f=t,l=u,c=o;break;case 4:f=u,l=t,c=o;break;case 5:f=o,l=t,c=u;break}return[f*255,l*255,c*255]},Et.cmyk.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,i=r[3]/100,a,o,s;return a=1-Math.min(1,e*(1-i)+i),o=1-Math.min(1,t*(1-i)+i),s=1-Math.min(1,n*(1-i)+i),[a*255,o*255,s*255]},Et.xyz.rgb=function(r){var e=r[0]/100,t=r[1]/100,n=r[2]/100,i,a,o;return i=e*3.2406+t*-1.5372+n*-.4986,a=e*-.9689+t*1.8758+n*.0415,o=e*.0557+t*-.204+n*1.057,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[i*255,a*255,o*255]},Et.xyz.lab=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return e/=95.047,t/=100,n/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,i=116*t-16,a=500*(e-t),o=200*(t-n),[i,a,o]},Et.lab.xyz=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;a=(e+16)/116,i=t/500+a,o=a-n/200;var s=Math.pow(a,3),u=Math.pow(i,3),f=Math.pow(o,3);return a=s>.008856?s:(a-16/116)/7.787,i=u>.008856?u:(i-16/116)/7.787,o=f>.008856?f:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},Et.lab.lch=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return i=Math.atan2(n,t),a=i*360/2/Math.PI,a<0&&(a+=360),o=Math.sqrt(t*t+n*n),[e,o,a]},Et.lch.lab=function(r){var e=r[0],t=r[1],n=r[2],i,a,o;return o=n/360*2*Math.PI,i=t*Math.cos(o),a=t*Math.sin(o),[e,i,a]},Et.rgb.ansi16=function(r){var e=r[0],t=r[1],n=r[2],i=1 in arguments?arguments[1]:Et.rgb.hsv(r)[2];if(i=Math.round(i/50),i===0)return 30;var a=30+(Math.round(n/255)<<2|Math.round(t/255)<<1|Math.round(e/255));return i===2&&(a+=60),a},Et.hsv.ansi16=function(r){return Et.rgb.ansi16(Et.hsv.rgb(r),r[2])},Et.rgb.ansi256=function(r){var e=r[0],t=r[1],n=r[2];if(e===t&&t===n)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var i=16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5);return i},Et.ansi16.rgb=function(r){var e=r%10;if(e===0||e===7)return r>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var t=(~~(r>50)+1)*.5,n=(e&1)*t*255,i=(e>>1&1)*t*255,a=(e>>2&1)*t*255;return[n,i,a]},Et.ansi256.rgb=function(r){if(r>=232){var e=(r-232)*10+8;return[e,e,e]}r-=16;var t,n=Math.floor(r/36)/5*255,i=Math.floor((t=r%36)/6)/5*255,a=t%6/5*255;return[n,i,a]},Et.rgb.hex=function(r){var e=((Math.round(r[0])&255)<<16)+((Math.round(r[1])&255)<<8)+(Math.round(r[2])&255),t=e.toString(16).toUpperCase();return"000000".substring(t.length)+t},Et.hex.rgb=function(r){var e=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var t=e[0];e[0].length===3&&(t=t.split("").map(function(s){return s+s}).join(""));var n=parseInt(t,16),i=n>>16&255,a=n>>8&255,o=n&255;return[i,a,o]},Et.rgb.hcg=function(r){var e=r[0]/255,t=r[1]/255,n=r[2]/255,i=Math.max(Math.max(e,t),n),a=Math.min(Math.min(e,t),n),o=i-a,s,u;return o<1?s=a/(1-o):s=0,o<=0?u=0:i===e?u=(t-n)/o%6:i===t?u=2+(n-e)/o:u=4+(e-t)/o+4,u/=6,u%=1,[u*360,o*100,s*100]},Et.hsl.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=1,i=0;return t<.5?n=2*e*t:n=2*e*(1-t),n<1&&(i=(t-.5*n)/(1-n)),[r[0],n*100,i*100]},Et.hsv.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=e*t,i=0;return n<1&&(i=(t-n)/(1-n)),[r[0],n*100,i*100]},Et.hcg.rgb=function(r){var e=r[0]/360,t=r[1]/100,n=r[2]/100;if(t===0)return[n*255,n*255,n*255];var i=[0,0,0],a=e%1*6,o=a%1,s=1-o,u=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return u=(1-t)*n,[(t*i[0]+u)*255,(t*i[1]+u)*255,(t*i[2]+u)*255]},Et.hcg.hsv=function(r){var e=r[1]/100,t=r[2]/100,n=e+t*(1-e),i=0;return n>0&&(i=e/n),[r[0],i*100,n*100]},Et.hcg.hsl=function(r){var e=r[1]/100,t=r[2]/100,n=t*(1-e)+.5*e,i=0;return n>0&&n<.5?i=e/(2*n):n>=.5&&n<1&&(i=e/(2*(1-n))),[r[0],i*100,n*100]},Et.hcg.hwb=function(r){var e=r[1]/100,t=r[2]/100,n=e+t*(1-e);return[r[0],(n-e)*100,(1-n)*100]},Et.hwb.hcg=function(r){var e=r[1]/100,t=r[2]/100,n=1-t,i=n-e,a=0;return i<1&&(a=(n-i)/(1-i)),[r[0],i*100,a*100]},Et.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]},Et.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]},Et.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]},Et.gray.hsl=Et.gray.hsv=function(r){return[0,0,r[0]]},Et.gray.hwb=function(r){return[0,100,r[0]]},Et.gray.cmyk=function(r){return[0,0,0,r[0]]},Et.gray.lab=function(r){return[r[0],0,0]},Et.gray.hex=function(r){var e=Math.round(r[0]/100*255)&255,t=(e<<16)+(e<<8)+e,n=t.toString(16).toUpperCase();return"000000".substring(n.length)+n},Et.rgb.gray=function(r){var e=(r[0]+r[1]+r[2])/3;return[e/255*100]};var TM=CM.exports,qh=TM;function e9(){for(var r={},e=Object.keys(qh),t=e.length,n=0;n1&&(t=Array.prototype.slice.call(arguments)),r(t))};return"conversion"in r&&(e.conversion=r.conversion),e}function u9(r){var e=function(t){if(t==null)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=r(t);if(typeof n=="object")for(var i=n.length,a=0;a>16&255,r>>8&255,r&255],this.valpha=1;else{this.valpha=1;var o=Object.keys(r);"alpha"in r&&(o.splice(o.indexOf("alpha"),1),this.valpha=typeof r.alpha=="number"?r.alpha:0);var s=o.sort().join("");if(!(s in I0))throw new Error("Unable to parse color from object: "+JSON.stringify(r));this.model=I0[s];var u=Hn[this.model].labels,f=[];for(t=0;tt?(e+.05)/(t+.05):(t+.05)/(e+.05)},level:function(r){var e=this.contrast(r);return e>=7.1?"AAA":e>=4.5?"AA":""},isDark:function(){var r=this.rgb().color,e=(r[0]*299+r[1]*587+r[2]*114)/1e3;return e<128},isLight:function(){return!this.isDark()},negate:function(){for(var r=this.rgb(),e=0;e<3;e++)r.color[e]=255-r.color[e];return r},lighten:function(r){var e=this.hsl();return e.color[2]+=e.color[2]*r,e},darken:function(r){var e=this.hsl();return e.color[2]-=e.color[2]*r,e},saturate:function(r){var e=this.hsl();return e.color[1]+=e.color[1]*r,e},desaturate:function(r){var e=this.hsl();return e.color[1]-=e.color[1]*r,e},whiten:function(r){var e=this.hwb();return e.color[1]+=e.color[1]*r,e},blacken:function(r){var e=this.hwb();return e.color[2]+=e.color[2]*r,e},grayscale:function(){var r=this.rgb().color,e=r[0]*.3+r[1]*.59+r[2]*.11;return xn.rgb(e,e,e)},fade:function(r){return this.alpha(this.valpha-this.valpha*r)},opaquer:function(r){return this.alpha(this.valpha+this.valpha*r)},rotate:function(r){var e=this.hsl(),t=e.color[0];return t=(t+r)%360,t=t<0?360+t:t,e.color[0]=t,e},mix:function(r,e){if(!r||!r.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof r);var t=r.rgb(),n=this.rgb(),i=e===void 0?.5:e,a=2*i-1,o=t.alpha()-n.alpha(),s=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,u=1-s;return xn.rgb(s*t.red()+u*n.red(),s*t.green()+u*n.green(),s*t.blue()+u*n.blue(),t.alpha()*i+n.alpha()*(1-i))}},Object.keys(Hn).forEach(function(r){if(IM.indexOf(r)===-1){var e=Hn[r].channels;xn.prototype[r]=function(){if(this.model===r)return new xn(this);if(arguments.length)return new xn(arguments,r);var t=typeof arguments[e]=="number"?e:this.valpha;return new xn(h9(Hn[this.model][r].raw(this.color)).concat(t),r)},xn[r]=function(t){return typeof t=="number"&&(t=k0(T0.call(arguments),e)),new xn(t,r)}}});function l9(r,e){return Number(r.toFixed(e))}function c9(r){return function(e){return l9(e,r)}}function Dr(r,e,t){return r=Array.isArray(r)?r:[r],r.forEach(function(n){(Zh[n]||(Zh[n]=[]))[e]=t}),r=r[0],function(n){var i;return arguments.length?(t&&(n=t(n)),i=this[r](),i.color[e]=n,i):(i=this[r]().color[e],t&&(i=t(i)),i)}}function rn(r){return function(e){return Math.max(0,Math.min(r,e))}}function h9(r){return Array.isArray(r)?r:[r]}function k0(r,e){for(var t=0;t=0,a=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return a?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 _t(this.toString())},_applyModification:function(e,t){var n=e.apply(null,[this].concat([].slice.call(t)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(S9,arguments)},brighten:function(){return this._applyModification(M9,arguments)},darken:function(){return this._applyModification(C9,arguments)},desaturate:function(){return this._applyModification(w9,arguments)},saturate:function(){return this._applyModification(E9,arguments)},greyscale:function(){return this._applyModification(_9,arguments)},spin:function(){return this._applyModification(A9,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(k9,arguments)},complement:function(){return this._applyCombination(T9,arguments)},monochromatic:function(){return this._applyCombination(L9,arguments)},splitcomplement:function(){return this._applyCombination(I9,arguments)},triad:function(){return this._applyCombination(DM,[3])},tetrad:function(){return this._applyCombination(DM,[4])}},_t.fromRatio=function(r,e){if(Kh(r)=="object"){var t={};for(var n in r)r.hasOwnProperty(n)&&(n==="a"?t[n]=r[n]:t[n]=Wf(r[n]));r=t}return _t(r,e)};function g9(r){var e={r:0,g:0,b:0},t=1,n=null,i=null,a=null,o=!1,s=!1;return typeof r=="string"&&(r=R9(r)),Kh(r)=="object"&&(Ta(r.r)&&Ta(r.g)&&Ta(r.b)?(e=y9(r.r,r.g,r.b),o=!0,s=String(r.r).substr(-1)==="%"?"prgb":"rgb"):Ta(r.h)&&Ta(r.s)&&Ta(r.v)?(n=Wf(r.s),i=Wf(r.v),e=b9(r.h,n,i),o=!0,s="hsv"):Ta(r.h)&&Ta(r.s)&&Ta(r.l)&&(n=Wf(r.s),a=Wf(r.l),e=m9(r.h,n,a),o=!0,s="hsl"),r.hasOwnProperty("a")&&(t=r.a)),t=PM(t),{ok:o,format:r.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:t}}function y9(r,e,t){return{r:Cr(r,255)*255,g:Cr(e,255)*255,b:Cr(t,255)*255}}function kM(r,e,t){r=Cr(r,255),e=Cr(e,255),t=Cr(t,255);var n=Math.max(r,e,t),i=Math.min(r,e,t),a,o,s=(n+i)/2;if(n==i)a=o=0;else{var u=n-i;switch(o=s>.5?u/(2-n-i):u/(n+i),n){case r:a=(e-t)/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=i=a=t;else{var s=t<.5?t*(1+e):t+e-t*e,u=2*t-s;n=o(u,s,r+1/3),i=o(u,s,r),a=o(u,s,r-1/3)}return{r:n*255,g:i*255,b:a*255}}function LM(r,e,t){r=Cr(r,255),e=Cr(e,255),t=Cr(t,255);var n=Math.max(r,e,t),i=Math.min(r,e,t),a,o,s=n,u=n-i;if(o=n===0?0:u/n,n==i)a=0;else{switch(n){case r:a=(e-t)/u+(e>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(_t(n));return a}function L9(r,e){e=e||6;for(var t=_t(r).toHsv(),n=t.h,i=t.s,a=t.v,o=[],s=1/e;e--;)o.push(_t({h:n,s:i,v:a})),a=(a+s)%1;return o}_t.mix=function(r,e,t){t=t===0?0:t||50;var n=_t(r).toRgb(),i=_t(e).toRgb(),a=t/100,o={r:(i.r-n.r)*a+n.r,g:(i.g-n.g)*a+n.g,b:(i.b-n.b)*a+n.b,a:(i.a-n.a)*a+n.a};return _t(o)},_t.readability=function(r,e){var t=_t(r),n=_t(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)},_t.isReadable=function(r,e,t){var n=_t.readability(r,e),i,a;switch(a=!1,i=B9(t),i.level+i.size){case"AAsmall":case"AAAlarge":a=n>=4.5;break;case"AAlarge":a=n>=3;break;case"AAAsmall":a=n>=7;break}return a},_t.mostReadable=function(r,e,t){var n=null,i=0,a,o,s,u;t=t||{},o=t.includeFallbackColors,s=t.level,u=t.size;for(var f=0;fi&&(i=a,n=_t(e[f]));return _t.isReadable(r,n,{level:s,size:u})||!o?n:(t.includeFallbackColors=!1,_t.mostReadable(r,["#fff","#000"],t))};var L0=_t.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"},N9=_t.hexNames=O9(L0);function O9(r){var e={};for(var t in r)r.hasOwnProperty(t)&&(e[r[t]]=t);return e}function PM(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}function Cr(r,e){D9(r)&&(r="100%");var t=P9(r);return r=Math.min(e,Math.max(0,parseFloat(r))),t&&(r=parseInt(r*e,10)/100),Math.abs(r-e)<1e-6?1:r%e/parseFloat(e)}function Qh(r){return Math.min(1,Math.max(0,r))}function qn(r){return parseInt(r,16)}function D9(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}function P9(r){return typeof r=="string"&&r.indexOf("%")!=-1}function Mi(r){return r.length==1?"0"+r:""+r}function Wf(r){return r<=1&&(r=r*100+"%"),r}function RM(r){return Math.round(parseFloat(r)*255).toString(16)}function BM(r){return qn(r)/255}var Ci=function(){var r="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+r+")",n="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),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 Ta(r){return!!Ci.CSS_UNIT.exec(r)}function R9(r){r=r.replace(v9,"").replace(p9,"").toLowerCase();var e=!1;if(L0[r])r=L0[r],e=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Ci.rgb.exec(r))?{r:t[1],g:t[2],b:t[3]}:(t=Ci.rgba.exec(r))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Ci.hsl.exec(r))?{h:t[1],s:t[2],l:t[3]}:(t=Ci.hsla.exec(r))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Ci.hsv.exec(r))?{h:t[1],s:t[2],v:t[3]}:(t=Ci.hsva.exec(r))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Ci.hex8.exec(r))?{r:qn(t[1]),g:qn(t[2]),b:qn(t[3]),a:BM(t[4]),format:e?"name":"hex8"}:(t=Ci.hex6.exec(r))?{r:qn(t[1]),g:qn(t[2]),b:qn(t[3]),format:e?"name":"hex"}:(t=Ci.hex4.exec(r))?{r:qn(t[1]+""+t[1]),g:qn(t[2]+""+t[2]),b:qn(t[3]+""+t[3]),a:BM(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Ci.hex3.exec(r))?{r:qn(t[1]+""+t[1]),g:qn(t[2]+""+t[2]),b:qn(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function B9(r){var e,t;return r=r||{level:"AA",size:"small"},e=(r.level||"AA").toUpperCase(),t=(r.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var Jh=2,FM=.16,F9=.05,G9=.05,z9=.15,GM=5,zM=4,$9=[{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 $M(r,e,t){var n;return Math.round(r.h)>=60&&Math.round(r.h)<=240?n=t?Math.round(r.h)-Jh*e:Math.round(r.h)+Jh*e:n=t?Math.round(r.h)+Jh*e:Math.round(r.h)-Jh*e,n<0?n+=360:n>=360&&(n-=360),n}function jM(r,e,t){if(r.h===0&&r.s===0)return r.s;var n;return t?n=r.s-FM*e:e===zM?n=r.s+FM:n=r.s+F9*e,n>1&&(n=1),t&&e===GM&&n>.1&&(n=.1),n<.06&&(n=.06),Number(n.toFixed(2))}function UM(r,e,t){var n;return t?n=r.v+G9*e:n=r.v-z9*e,n>1&&(n=1),Number(n.toFixed(2))}function ed(r){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=[],n=_t(r),i=GM;i>0;i-=1){var a=n.toHsv(),o=_t({h:$M(a,i,!0),s:jM(a,i,!0),v:UM(a,i,!0)}).toHexString();t.push(o)}t.push(n.toHexString());for(var s=1;s<=zM;s+=1){var u=n.toHsv(),f=_t({h:$M(u,s),s:jM(u,s),v:UM(u,s)}).toHexString();t.push(f)}return e.theme==="dark"?$9.map(function(l){var c=l.index,h=l.opacity,d=_t.mix(e.backgroundColor||"#141414",t[c],h*100).toHexString();return d}):t}var N0={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"},O0={},D0={};Object.keys(N0).forEach(function(r){O0[r]=ed(N0[r]),O0[r].primary=O0[r][5],D0[r]=ed(N0[r],{theme:"dark",backgroundColor:"#141414"}),D0[r].primary=D0[r][5]});var nn=function(e,t,n){var i=Yf(e),a=Yf(t);return Yf([(1-n)*i.red()+n*a.red(),(1-n)*i.green()+n*a.green(),(1-n)*i.blue()+n*a.blue()]).rgb()},j9=function(e,t,n){t===void 0&&(t="#fff");var i=nn(t,e,.05).rgb().toString(),a=nn(t,e,.1).rgb().toString(),o=nn(t,e,.2).rgb().toString(),s=nn(t,e,.4).rgb().toString(),u=nn(t,n,.02).rgb().toString(),f=nn(t,n,.05).rgb().toString(),l=nn(t,n,.1).rgb().toString(),c=nn(t,n,.2).rgb().toString(),h=nn(t,n,.3).rgb().toString(),d=ed(e,{theme:"default",backgroundColor:t}),v=Yf(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:e,mainFill:a,activeStroke:e,activeFill:i,inactiveStroke:s,inactiveFill:i,selectedStroke:e,selectedFill:t,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:i,comboInactiveStroke:h,comboInactiveFill:u,comboSelectedStroke:e,comboSelectedFill:u,comboHighlightStroke:g,comboHighlightFill:u,comboDisableStroke:c,comboDisableFill:f}},U9=function(e,t,n){t===void 0&&(t="#fff");var i=nn(t,e,.2).rgb().toString(),a=nn(t,e,.3).rgb().toString(),o=nn(t,e,.6).rgb().toString(),s=nn(t,e,.8).rgb().toString(),u=nn(t,n,.2).rgb().toString(),f=nn(t,n,.25).rgb().toString(),l=nn(t,n,.3).rgb().toString(),c=nn(t,n,.4).rgb().toString(),h=nn(t,n,.5).rgb().toString(),d=ed(e,{theme:"dark",backgroundColor:t}),v=Yf(e).hex().toLowerCase(),p=d.indexOf(v),g=e;return p!==-1&&(g=d[p+1]),{mainStroke:s,mainFill:i,activeStroke:e,activeFill:a,inactiveStroke:s,inactiveFill:i,selectedStroke:e,selectedFill:i,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}},P0=function(e,t,n,i){return t===void 0&&(t="#fff"),n===void 0&&(n="default"),n==="default"?j9(e,t,"rgb(150, 150, 150)"):U9(e,t,"#777")},X9=function(e,t,n,i){t===void 0&&(t="#fff"),n===void 0&&(n="default");var a=[];return e.forEach(function(o){a.push(P0(o,t,n))}),a};const Y9=Object.freeze(Object.defineProperty({__proto__:null,getColorSetsBySubjectColors:X9,getColorsWithSubjectColor:P0,mixColor:nn},Symbol.toStringTag,{value:"Module"}));var W9="rgb(95, 149, 255)",V9="rgb(255, 255, 255)",XM="rgb(0, 0, 0)",Jt=P0(W9,V9);const Jo={version:"0.8.20",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:Jt.mainStroke,fill:Jt.mainFill},size:20,color:Jt.mainStroke,linkPoints:{size:8,lineWidth:1,fill:Jt.activeFill,stroke:Jt.activeStroke}},nodeStateStyles:{active:{fill:Jt.activeFill,stroke:Jt.activeStroke,lineWidth:2,shadowColor:Jt.mainStroke,shadowBlur:10},selected:{fill:Jt.selectedFill,stroke:Jt.selectedStroke,lineWidth:4,shadowColor:Jt.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:Jt.highlightFill,stroke:Jt.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:Jt.inactiveFill,stroke:Jt.inactiveStroke,lineWidth:1},disable:{fill:Jt.disableFill,stroke:Jt.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:XM,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:Jt.edgeMainStroke,lineAppendWidth:2},color:Jt.edgeMainStroke},edgeStateStyles:{active:{stroke:Jt.edgeActiveStroke,lineWidth:1},selected:{stroke:Jt.edgeSelectedStroke,lineWidth:2,shadowColor:Jt.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Jt.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:Jt.edgeInactiveStroke,lineWidth:1},disable:{stroke:Jt.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:XM,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:Jt.comboMainFill,lineWidth:1,stroke:Jt.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:Jt.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:Jt.comboActiveStroke,lineWidth:1,fill:Jt.comboActiveFill},selected:{stroke:Jt.comboSelectedStroke,lineWidth:2,fill:Jt.comboSelectedFill,shadowColor:Jt.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:Jt.comboHighlightStroke,lineWidth:2,fill:Jt.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:Jt.comboInactiveStroke,fill:Jt.comboInactiveFill,lineWidth:1},disable:{stroke:Jt.comboDisableStroke,fill:Jt.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},textWaterMarkerConfig:{width:150,height:100,compatible:!1,text:{x:0,y:60,lineHeight:20,rotate:20,fontSize:14,fontFamily:"Microsoft YaHei",fill:"rgba(0, 0, 0, 0.1)",baseline:"Middle"}},imageWaterMarkerConfig:{width:150,height:130,compatible:!1,image:{x:0,y:0,width:30,height:20,rotate:0}},waterMarkerImage:"https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"};function td(r,e,t){if(r){if(typeof r.addEventListener=="function")return r.addEventListener(e,t,!1),{remove:function(){r.removeEventListener(e,t,!1)}};if(typeof r.attachEvent=="function")return r.attachEvent("on"+e,t),{remove:function(){r.detachEvent("on"+e,t)}}}}var Vf,R0,YM,B0;function H9(){Vf=document.createElement("table"),R0=document.createElement("tr"),YM=/^\s*<(\w+|!)[^>]*>/,B0={tr:document.createElement("tbody"),tbody:Vf,thead:Vf,tfoot:Vf,td:R0,th:R0,"*":document.createElement("div")}}function wr(r){Vf||H9();var e=YM.test(r)&&RegExp.$1;(!e||!(e in B0))&&(e="*");var t=B0[e];r=typeof r=="string"?r.replace(/(^\s*)|(\s*$)/g,""):r,t.innerHTML=""+r;var n=t.childNodes[0];return n&&t.contains(n)&&t.removeChild(n),n}function jt(r,e){if(r)for(var t in e)e.hasOwnProperty(t)&&(r.style[t]=e[t]);return r}var q9=bn.cloneEvent,Z9=bn.isViewportChanged,K9=function(r){It(e,r);function e(t){var n=r.call(this,t)||this;return n.extendEvents=[],n.dragging=!1,n.mousedown=!1,n.preItem=null,n.destroy(),n.graph=t,n.destroyed=!1,n.initEvents(),n}return e.prototype.initEvents=function(){var t=this,n=t.graph,i=t.extendEvents,a=i===void 0?[]:i,o=n.get("canvas"),s=o.get("el"),u=Go(this,"onCanvasEvents"),f=Go(this,"onExtendEvents"),l=Go(this,"onWheelEvent");o.off("*").on("*",u),this.canvasHandler=u,a.push(td(s,"wheel",l)),typeof window<"u"&&(a.push(td(window,"keydown",f)),a.push(td(window,"keyup",f)),a.push(td(window,"focus",f))),this.resetHandler&&n.off("afterchangedata",this.resetHandler),this.resetHandler=Go(this,"resetStatus"),n.on("afterchangedata",this.resetHandler)},e.getItemRoot=function(t){for(;t&&!t.get("item");)t=t.get("parent");return t},e.prototype.onCanvasEvents=function(t){var n=this,i=this.graph,a=i.get("canvas"),o=t.target,s=t.type;switch(s){case"drag":this.onCanvasEvents(Object.assign({},t,{type:"mousemove"}));break;case"dragend":this.onCanvasEvents(Object.assign({},t,{type:"mouseup"}));break;case"mousedown":this.mousedown=!0;break;case"dragend":case"mouseup":setTimeout(function(){return n.mousedown=!1});break;case"click":if(!this.mousedown)return;break}t.canvasX=t.x,t.canvasY=t.y;var u={x:t.canvasX,y:t.canvasY},f=i.get("group"),l=f.getMatrix();if(l||(l=[1,0,0,0,1,0,0,0,1]),Z9(l)&&(u=i.getPointByClient(t.clientX,t.clientY)),t.x=u.x,t.y=u.y,t.currentTarget=i,o===a){(s==="mousemove"||s==="mouseleave")&&this.handleMouseMove(t,"canvas"),t.target=a,t.item=null,i.emit(s,t),i.emit("canvas:".concat(s),t);return}var c=e.getItemRoot(o);if(!c){i.emit(s,t);return}var h=c.get("item");if(!h.destroyed){var d=h.getType();if(t.target=o,t.item=h,t.canvasX===t.x&&t.canvasY===t.y){var v=i.getCanvasByPoint(t.x,t.y);t.canvasX=v.x,t.canvasY=v.y}t.name&&!t.name.includes(":")?(i.emit("".concat(d,":").concat(s),t),i.emit(s,t)):t.name&&i.emit(t.name,t),s==="dragstart"&&(this.dragging=!0),s==="dragend"&&(this.dragging=!1),s==="mousemove"&&this.handleMouseMove(t,d)}},e.prototype.onExtendEvents=function(t){this.graph.emit(t.type,t)},e.prototype.onWheelEvent=function(t){ct(t.wheelDelta)&&(t.wheelDelta=-t.detail),this.graph.emit("wheel",t)},e.prototype.handleMouseMove=function(t,n){var i=this,a=i.graph,o=i.preItem,s=a.get("canvas"),u=t.target===s?null:t.item;t=q9(t),o&&o!==u&&!o.destroyed&&(t.item=o,this.emitCustomEvent(o.getType(),"mouseleave",t),this.dragging&&this.emitCustomEvent(o.getType(),"dragleave",t)),u&&o!==u&&(t.item=u,this.emitCustomEvent(n,"mouseenter",t),this.dragging&&this.emitCustomEvent(n,"dragenter",t)),this.preItem=u},e.prototype.emitCustomEvent=function(t,n,i){i.type=n,this.graph.emit("".concat(t,":").concat(n),i)},e.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},e.prototype.destroy=function(){var t=this,n=t.graph,i=t.canvasHandler,a=t.extendEvents,o=n.get("canvas");o.off("*",i),ye(a,function(s){s.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},e}(J_),Ht={},Ia={},Pr={};Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.Base=void 0;var Q9=function(){function r(){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 r.prototype.layout=function(e){return this.init(e),this.execute(!0)},r.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||[]},r.prototype.execute=function(e){},r.prototype.executeWithWorker=function(){},r.prototype.getDefaultCfg=function(){return{}},r.prototype.updateCfg=function(e){e&&Object.assign(this,e)},r.prototype.getType=function(){return"base"},r.prototype.destroy=function(){this.nodes=null,this.edges=null,this.combos=null,this.positions=null,this.destroyed=!0},r}();Pr.Base=Q9;var F0={},iu={};Object.defineProperty(iu,"__esModule",{value:!0}),iu.camelize=iu.isString=void 0;var J9=function(r){return typeof r=="string"};iu.isString=J9;var e7=function(r){var e=Object.create(null);return function(t){var n=e[t];return n||(e[t]=r(t))}},t7=/-(\w)/g;iu.camelize=e7(function(r){return r.replace(t7,function(e,t){return t?t.toUpperCase():""})});var Hf={};Object.defineProperty(Hf,"__esModule",{value:!0}),Hf.isArray=void 0,Hf.isArray=Array.isArray;var rd={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.toNumber=r.isNaN=r.isNumber=void 0;var e=function(i){return typeof i=="number"};r.isNumber=e;var t=function(i){return Number.isNaN(Number(i))};r.isNaN=t;var n=function(i){var a=parseFloat(i);return(0,r.isNaN)(a)?i:a};r.toNumber=n})(rd);var nd={},G0={};(function(r){var e=xe&&xe.__assign||function(){return e=Object.assign||function(i){for(var a,o=1,s=arguments.length;ob[w][_]+b[_][E]&&(b[w][E]=b[w][_]+b[_][E]);return b};r.floydWarshall=s;var u=function(m,b){var x=m.nodes,w=m.edges,E=[],_={};if(!x)throw new Error("invalid nodes data!");return x&&x.forEach(function(M,C){_[M.id]=C;var S=[];E.push(S)}),w==null||w.forEach(function(M){var C=(0,r.getEdgeTerminal)(M,"source"),S=(0,r.getEdgeTerminal)(M,"target"),A=_[C],T=_[S];A===void 0||T===void 0||(E[A][T]=1,b||(E[T][A]=1))}),E};r.getAdjMatrix=u;var f=function(m,b){var x=[];return m.forEach(function(w){var E=[];w.forEach(function(_){E.push(_*b)}),x.push(E)}),x};r.scaleMatrix=f;var l=function(m,b){if(m&&m.children){for(var x=m.children.length-1;x>=0;x--)if(!l(m.children[x],b))return}return!!b(m)},c=function(m,b){typeof b=="function"&&l(m,b)};r.traverseTreeUp=c;var h=function(m){var b=1/0,x=1/0,w=-1/0,E=-1/0;return m.forEach(function(_){var M=_.size;(0,e.isArray)(M)?M.length===1&&(M=[M[0],M[0]]):(0,t.isNumber)(M)?M=[M,M]:(M===void 0||isNaN(M))&&(M=[30,30]);var C=[M[0]/2,M[1]/2],S=_.x-C[0],A=_.x+C[0],T=_.y-C[1],k=_.y+C[1];b>S&&(b=S),x>T&&(x=T),wf.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,r.isFunction)(s)?s:(0,t.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}};r.getFuncByUnknownType=a}(z0)),z0}var VM;function Ir(){return VM||(VM=1,function(r){var e=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),t=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&e(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),t(iu,r),t(Hf,r),t(rd,r),t(nd,r),t(G0,r),t(r7(),r)}(F0)),F0}var n7=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.getLayoutByName=Ia.unRegisterLayout=Ia.registerLayout=void 0;var i7=Pr,a7=Ir(),vo=new Map,o7=function(r,e){if(vo.get(r)&&console.warn("The layout with the name ".concat(r," exists already, it will be overridden")),(0,a7.isObject)(e)){var t=function(n){n7(i,n);function i(a){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,a),Object.keys(f).forEach(function(c){var h=f[c];u[c]=h}),o}return i}(i7.Base);vo.set(r,t)}else vo.set(r,e);return vo.get(r)};Ia.registerLayout=o7;var s7=function(r){vo.has(r)&&vo.delete(r)};Ia.unRegisterLayout=s7;var u7=function(r){return vo.has(r)?vo.get(r):null};Ia.getLayoutByName=u7;var $0={},qf={},f7=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(qf,"__esModule",{value:!0}),qf.GridLayout=void 0;var au=Ir(),l7=Pr,c7=function(r){f7(e,r);function e(t){var n=r.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(t),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 t=this,n=t.nodes,i=t.edges,a=t.begin,o=n.length;if(o===0)return t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i};if(o===1)return n[0].x=a[0],n[0].y=a[1],t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i};var s=t.sortBy,u=t.width,f=t.height,l=t.condense,c=t.preventOverlapPadding,h=t.preventOverlap,d=t.nodeSpacing,v=t.nodeSize,p=[];n.forEach(function(T){p.push(T)});var g={};if(p.forEach(function(T,k){g[T.id]=k}),(s==="degree"||!(0,au.isString)(s)||p[0][s]===void 0)&&(s="degree",(0,au.isNaN)(n[0].degree))){var y=(0,au.getDegree)(p.length,g,i);p.forEach(function(T,k){T.degree=y[k].all})}p.sort(function(T,k){return k[s]-T[s]}),!u&&typeof window<"u"&&(u=window.innerWidth),!f&&typeof window<"u"&&(f=window.innerHeight);var m=t.rows,b=t.cols!=null?t.cols:t.columns;if(t.cells=o,m!=null&&b!=null?(t.rows=m,t.cols=b):m!=null&&b==null?(t.rows=m,t.cols=Math.ceil(t.cells/t.rows)):m==null&&b!=null?(t.cols=b,t.rows=Math.ceil(t.cells/t.cols)):(t.splits=Math.sqrt(t.cells*t.height/t.width),t.rows=Math.round(t.splits),t.cols=Math.round(t.width/t.height*t.splits)),t.rows=Math.max(t.rows,1),t.cols=Math.max(t.cols,1),t.cols*t.rows>t.cells){var x=t.small(),w=t.large();(x-1)*w>=t.cells?t.small(x-1):(w-1)*x>=t.cells&&t.large(w-1)}else for(;t.cols*t.rows=t.cells?t.large(w+1):t.small(x+1)}if(t.cellWidth=u/t.cols,t.cellHeight=f/t.rows,l&&(t.cellWidth=0,t.cellHeight=0),h||d){var E=(0,au.getFuncByUnknownType)(10,d),_=(0,au.getFuncByUnknownType)(30,v,!1);p.forEach(function(T){(!T.x||!T.y)&&(T.x=0,T.y=0);var k=_(T)||30,O,G;(0,au.isArray)(k)?(O=k[0],G=k[1]):(O=k,G=k);var D=E!==void 0?E(T):c,$=O+D,Y=G+D;t.cellWidth=Math.max(t.cellWidth,$),t.cellHeight=Math.max(t.cellHeight,Y)})}t.cellUsed={},t.row=0,t.col=0,t.id2manPos={};for(var M=0;M=n&&(t.col=0,t.row++)},e.prototype.getPos=function(t){var n=this,i=n.begin,a=n.cellWidth,o=n.cellHeight,s,u,f=n.id2manPos[t.id];if(f)s=f.col*a+a/2+i[0],u=f.row*o+o/2+i[1];else{for(;n.used(n.row,n.col);)n.moveToNextCell();s=n.col*a+a/2+i[0],u=n.row*o+o/2+i[1],n.use(n.row,n.col),n.moveToNextCell()}t.x=s,t.y=u},e.prototype.getType=function(){return"grid"},e}(l7.Base);qf.GridLayout=c7;var Zf={},h7=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Zf,"__esModule",{value:!0}),Zf.RandomLayout=void 0;var d7=Pr,v7=function(r){h7(e,r);function e(t){var n=r.call(this)||this;return n.center=[0,0],n.width=300,n.height=300,n.nodes=[],n.edges=[],n.onLayoutEnd=function(){},n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},e.prototype.execute=function(){var t=this,n=t.nodes,i=.9,a=t.center;return!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),n&&n.forEach(function(o){o.x=(Math.random()-.5)*i*t.width+a[0],o.y=(Math.random()-.5)*i*t.height+a[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:this.edges}},e.prototype.getType=function(){return"random"},e}(d7.Base);Zf.RandomLayout=v7;var Kf={},p7=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(Kf,"__esModule",{value:!0}),Kf.GForceLayout=void 0;var g7=Pr,An=Ir(),j0=function(r,e){var t;return r?(0,An.isNumber)(r)?t=function(n){return r}:t=r:t=function(n){return e},t},y7=function(r){p7(e,r);function e(t){var n=r.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(t),n}return e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t,n,i=this,a=i.nodes;if(i.timeInterval!==void 0&&typeof window<"u"&&window.clearInterval(i.timeInterval),!a||a.length===0){(t=i.onLayoutEnd)===null||t===void 0||t.call(i);return}!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),i.center||(i.center=[i.width/2,i.height/2]);var o=i.center;if(a.length===1){a[0].x=o[0],a[0].y=o[1],(n=i.onLayoutEnd)===null||n===void 0||n.call(i);return}var s={},u={};a.forEach(function(v,p){(0,An.isNumber)(v.x)||(v.x=Math.random()*i.width),(0,An.isNumber)(v.y)||(v.y=Math.random()*i.height),s[v.id]=v,u[v.id]=p}),i.nodeMap=s,i.nodeIdxMap=u,i.linkDistance=j0(i.linkDistance,1),i.nodeStrength=j0(i.nodeStrength,1),i.edgeStrength=j0(i.edgeStrength,1);var f=i.nodeSize,l;if(i.preventOverlap){var c=i.nodeSpacing,h;(0,An.isNumber)(c)?h=function(){return c}:(0,An.isFunction)(c)?h=c:h=function(){return 0},f?(0,An.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,An.isArray)(v.size)?Math.max(v.size[0],v.size[1])+h(v):(0,An.isObject)(v.size)?Math.max(v.size.width,v.size.height)+h(v):v.size+h(v):10+h(v)}}i.nodeSize=l;var d=i.edges;i.degrees=(0,An.getDegree)(a.length,i.nodeIdxMap,d),i.getMass||(i.getMass=function(v){var p=v.mass||i.degrees[i.nodeIdxMap[v.id]].all||1;return p}),i.run()},e.prototype.run=function(){var t,n=this,i=n.maxIteration,a=n.nodes,o=n.workerEnabled,s=n.minMovement,u=n.animate;if(a)if(o||!u){for(var f=0;f"u")return;var c=0;this.timeInterval=window.setInterval(function(){var h,d;if(a){var v=n.runOneStep(c)||[];n.reachMoveThreshold(a,v,s)&&((h=n.onLayoutEnd)===null||h===void 0||h.call(n),window.clearInterval(n.timeInterval)),c++,c>=i&&((d=n.onLayoutEnd)===null||d===void 0||d.call(n),window.clearInterval(n.timeInterval))}},0)}},e.prototype.reachMoveThreshold=function(t,n,i){var a=0;return t.forEach(function(o,s){var u=o.x-n[s].x,f=o.y-n[s].y;a+=Math.sqrt(u*u+f*f)}),a/=t.length,a=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 x=m*m+b*b,w=Math.sqrt(x),E=(w+.1)*s,_=m/w,M=b/w,C=(c(d)+c(g))*.5*o/(E*E),S=a?a(g):1;if(t[2*v]+=_*C,t[2*v+1]+=M*C,t[2*y]-=_*C,t[2*y+1]-=M*C,u&&(h(d)+h(g))/2>w){var A=l*(c(d)+c(g))*.5/x;t[2*v]+=_*A/p,t[2*v+1]+=M*A/p,t[2*y]-=_*A/S,t[2*y+1]-=M*A/S}}})})},e.prototype.calAttractive=function(t,n){var i=this,a=i.nodeMap,o=i.nodeIdxMap,s=i.linkDistance,u=i.edgeStrength,f=i.nodeSize,l=i.getMass;n.forEach(function(c,h){var d=(0,An.getEdgeTerminal)(c,"source"),v=(0,An.getEdgeTerminal)(c,"target"),p=a[d],g=a[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),x=y/b,w=m/b,E=s(c,p,g)||1+(f(p)+f(g)||0)/2,_=E-b,M=_*u(c),C=o[d],S=o[v],A=l?l(p):1,T=l?l(g):1;t[2*C]-=x*M/A,t[2*C+1]-=w*M/A,t[2*S]+=x*M/T,t[2*S+1]+=w*M/T})},e.prototype.calGravity=function(t,n){for(var i=this,a=i.center,o=i.gravity,s=i.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(t,n,i){i.forEach(function(a,o){if((0,An.isNumber)(a.fx)&&(0,An.isNumber)(a.fy)){a.x=a.fx,a.y=a.fy;return}var s=t[2*o]*n,u=t[2*o+1]*n;a.x+=s,a.y+=u})},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"gForce"},e}(g7.Base);Kf.GForceLayout=y7;var Qf={},id={};function m7(r){const e=+this._x.call(null,r),t=+this._y.call(null,r);return HM(this.cover(e,t),e,t,r)}function HM(r,e,t,n){if(isNaN(e)||isNaN(t))return r;var i,a=r._root,o={data:n},s=r._x0,u=r._y0,f=r._x1,l=r._y1,c,h,d,v,p,g,y,m;if(!a)return r._root=o,r;for(;a.length;)if((p=e>=(c=(s+f)/2))?s=c:f=c,(g=t>=(h=(u+l)/2))?u=h:l=h,i=a,!(a=a[y=g<<1|p]))return i[y]=o,r;if(d=+r._x.call(null,a.data),v=+r._y.call(null,a.data),e===d&&t===v)return o.next=a,i?i[y]=o:r._root=o,r;do i=i?i[y]=new Array(4):r._root=new Array(4),(p=e>=(c=(s+f)/2))?s=c:f=c,(g=t>=(h=(u+l)/2))?u=h:l=h;while((y=g<<1|p)===(m=(v>=h)<<1|d>=c));return i[m]=a,i[y]=o,r}function b7(r){var e,t,n=r.length,i,a,o=new Array(n),s=new Array(n),u=1/0,f=1/0,l=-1/0,c=-1/0;for(t=0;tl&&(l=i),ac&&(c=a));if(u>l||f>c)return this;for(this.cover(u,f).cover(l,c),t=0;tr||r>=i||n>e||e>=a;)switch(f=(el||(s=v.y0)>c||(u=v.x1)=y)<<1|r>=g)&&(v=h[h.length-1],h[h.length-1]=h[h.length-1-p],h[h.length-1-p]=v)}else{var m=r-+this._x.call(null,d.data),b=e-+this._y.call(null,d.data),x=m*m+b*b;if(x=(h=(o+u)/2))?o=h:u=h,(p=c>=(d=(s+f)/2))?s=d:f=d,e=t,!(t=t[g=p<<1|v]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(n=e,y=g)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(a=t.next)&&delete t.next,i?(a?i.next=a:delete i.next,this):e?(a?e[g]=a:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[y]=t:this._root=t),this):(this._root=a,this)}function M7(r){for(var e=0,t=r.length;e1&&(M=(0,an.getAvgNodePosition)(S))}else M=void 0;return{x:M==null?void 0:M.x,y:M==null?void 0:M.y}}}}if(i){c||(c=this.getSameTypeLeafMap());var d=Array.from(new Set(o.map(function(b,x){return b[a]}))).filter(function(b){return b!==void 0}),v={};d.forEach(function(b){var x=o.filter(function(w){return w[a]===b}).map(function(w){return s[w.id]});v[b]=(0,an.getAvgNodePosition)(x)}),l={single:function(b){return f(b)},leaf:function(b){return f(b)},others:function(b){return f(b)},center:function(b,x,w){var E=v[b[a]];return{x:E==null?void 0:E.x,y:E==null?void 0:E.y}}}}this.centripetalOptions=Ai(Ai({},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(t){t&&Object.assign(this,t)},e.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},e.prototype.execute=function(){var t=this;t.stop();var n=t.nodes,i=t.edges,a=t.defSpringLen;if(t.judgingDistance=0,!n||n.length===0){t.onLayoutEnd([]);return}!t.width&&typeof window<"u"&&(t.width=window.innerWidth),!t.height&&typeof window<"u"&&(t.height=window.innerHeight),t.center||(t.center=[t.width/2,t.height/2]);var o=t.center;if(n.length===1){n[0].x=o[0],n[0].y=o[1],t.onLayoutEnd([Ai({},n[0])]);return}t.degreesMap=(0,an.getDegreeMap)(n,i),t.propsGetMass?t.getMass=t.propsGetMass:t.getMass=function(d){var v=1;(0,an.isNumber)(d.mass)&&(v=d.mass);var p=t.degreesMap[d.id].all;return!p||p<5?v:p*5*v};var s=t.nodeSize,u;if(t.preventOverlap){var f=t.nodeSpacing,l;(0,an.isNumber)(f)?l=function(){return f}:(0,an.isFunction)(f)?l=f:l=function(){return 0},s?(0,an.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,an.isArray)(d.size)?Math.max(d.size[0],d.size[1])+l(d):(0,an.isObject)(d.size)?Math.max(d.size.width,d.size.height)+l(d):d.size+l(d):10+l(d)}}t.nodeSize=u,t.linkDistance=X0(t.linkDistance,1),t.nodeStrength=X0(t.nodeStrength,1),t.edgeStrength=X0(t.edgeStrength,1);var c={},h={};n.forEach(function(d,v){(0,an.isNumber)(d.x)||(d.x=Math.random()*t.width),(0,an.isNumber)(d.y)||(d.y=Math.random()*t.height);var p=t.degreesMap[d.id];c[d.id]=Ai(Ai({},d),{data:Ai(Ai({},d.data),{size:t.nodeSize(d)||30,layout:{inDegree:p.in,outDegree:p.out,degree:p.all,tDegree:p.in,sDegree:p.out,force:{mass:t.getMass(d),nodeStrength:t.nodeStrength(d,i)}}})}),h[d.id]=v}),t.nodeMap=c,t.nodeIdxMap=h,t.edgeInfos=[],i==null||i.forEach(function(d){var v=c[d.source],p=c[d.target];!v||!p?elf.edgeInfos.push({}):t.edgeInfos.push({edgeStrength:t.edgeStrength(d),linkDistance:a?a(Ai(Ai({},d),{source:v,target:p}),v,p):t.linkDistance(d,v,p)||1+(s(v)+s(v)||0)/2})}),this.getCentripetalOptions(),t.onLayoutEnd=t.onLayoutEnd||function(){},t.run()},e.prototype.run=function(){var t=this,n=t.maxIteration,i=t.nodes,a=t.edges,o=t.workerEnabled,s=t.minMovement,u=t.animate,f=t.nodeMap,l=t.height;if(t.currentMinY=0,t.currentMaxY=l,!!i){var c=[];if(i.forEach(function(y,m){c[2*m]=0,c[2*m+1]=0}),this.defSideCoe&&typeof this.defSideCoe=="function"){var h={};a.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;(t.judgingDistance>s||p<1)&&p"u")return;var g=0;this.timeInterval=window.setInterval(function(){i&&(t.runOneStep(g,c),g++,(g>=d||t.judgingDistanceu){var v=u/d;c=v*c,h=v*h}n[2*l]=c,n[2*l+1]=h})},e.prototype.updatePosition=function(t,n){var i=this,a=i.nodes,o=i.distanceThresholdMode,s=i.nodeMap;if(!(a!=null&&a.length)){this.judgingDistance=0;return}var u=0;o==="max"?i.judgingDistance=-1/0:o==="min"&&(i.judgingDistance=1/0);var f=1/0,l=-1/0;a.forEach(function(c,h){var d=s[c.id];if((0,an.isNumber)(c.fx)&&(0,an.isNumber)(c.fy)){c.x=c.fx,c.y=c.fy,d.x=c.x,d.y=c.y;return}var v=t[2*h]*n,p=t[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":i.judgingDistanceg&&(i.judgingDistance=g);break;default:u=u+g;break}}),this.currentMinY=f,this.currentMaxY=l,(!o||o==="mean")&&(i.judgingDistance=u/a.length)},e.prototype.stop=function(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval)},e.prototype.destroy=function(){var t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"force2"},e.prototype.getSameTypeLeafMap=function(){var t=this,n=t.nodeClusterBy,i=t.nodes,a=t.edges,o=t.nodeMap,s=t.degreesMap;if(i!=null&&i.length){var u={};return i.forEach(function(f,l){var c=s[f.id].all;c===1&&(u[f.id]=(0,an.getCoreNodeAndRelativeLeafNodes)("leaf",f,a,n,s,o))}),u}},e}(j7.Base);Qf.Force2Layout=X7;var Y0={},od={};function Y7(r,e){var t,n=1;r==null&&(r=0),e==null&&(e=0);function i(){var a,o=t.length,s,u=0,f=0;for(a=0;ah.index){var A=d-M.x-M.vx,T=v-M.y-M.vy,k=A*A+T*T;kd+S||Ev+S||_f.r&&(f.r=f[l].r)}function u(){if(e){var f,l=e.length,c;for(t=new Array(l),f=0;f[e(w,E,o),w])),x;for(g=0,s=new Array(y);g{}};function QM(){for(var r=0,e=arguments.length,t={},n;r=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}sd.prototype=QM.prototype={constructor:sd,on:function(r,e){var t=this._,n=Q7(r+"",t),i,a=-1,o=n.length;if(arguments.length<2){for(;++a0)for(var t=new Array(i),n=0,i,a;n=0&&r._call.call(null,e),r=r._next;--ou}function iC(){es=(fd=rl.now())+ld,ou=Jf=0;try{tX()}finally{ou=0,nX(),es=0}}function rX(){var r=rl.now(),e=r-fd;e>eC&&(ld-=e,fd=r)}function nX(){for(var r,e=ud,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:ud=t);tl=r,V0(n)}function V0(r){if(!ou){Jf&&(Jf=clearTimeout(Jf));var e=r-es;e>24?(r<1/0&&(Jf=setTimeout(iC,r-rl.now()-ld)),el&&(el=clearInterval(el))):(el||(fd=rl.now(),el=setInterval(rX,eC)),ou=1,tC(iC))}}const iX=1664525,aX=1013904223,aC=4294967296;function oX(){let r=1;return()=>(r=(iX*r+aX)%aC)/aC}function sX(r){return r.x}function uX(r){return r.y}var fX=10,lX=Math.PI*(3-Math.sqrt(5));function cX(r){var e,t=1,n=.001,i=1-Math.pow(n,1/300),a=0,o=.6,s=new Map,u=nC(c),f=QM("tick","end"),l=oX();r==null&&(r=[]);function c(){h(),f.call("tick",e),t1?(g==null?s.delete(p):s.set(p,v(g)),e):s.get(p)},find:function(p,g,y){var m=0,b=r.length,x,w,E,_,M;for(y==null?y=1/0:y*=y,m=0;m1?(f.on(p,g),e):f.on(p)}}}function hX(){var r,e,t,n,i=on(-30),a,o=1,s=1/0,u=.81;function f(d){var v,p=r.length,g=ad(r,sX,uX).visitAfter(c);for(n=d,v=0;v=s)return;(d.data!==e||d.next)&&(y===0&&(y=po(t),x+=y*y),m===0&&(m=po(t),x+=m*m),x-1||(o[u]=a[u])}),o}),n.ticking=!1},e.prototype.execute=function(t){var n=this,i=n.nodes,a=n.edges;if(!n.ticking){var o=n.forceSimulation,s=n.alphaMin,u=n.alphaDecay,f=n.alpha;if(o){if(t){if(n.clustering&&n.clusterForce&&(n.clusterForce.nodes(i),n.clusterForce.links(a)),o.nodes(i),a&&n.edgeForce)n.edgeForce.links(a);else if(a&&!n.edgeForce){var h=uu.forceLink().id(function(g){return g.id}).links(a);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=uu.forceManyBody();if(n.nodeStrength&&l.strength(n.nodeStrength),o=uu.forceSimulation().nodes(i),n.clustering){var c=(0,MX.default)();c.centerX(n.center[0]).centerY(n.center[1]).template("force").strength(n.clusterFociStrength),a&&c.links(a),i&&c.nodes(i),c.forceLinkDistance(n.clusterEdgeDistance).forceLinkStrength(n.clusterEdgeStrength).forceCharge(n.clusterNodeStrength).forceNodeSize(n.clusterNodeSize),n.clusterForce=c,o.force("group",c)}if(o.force("center",uu.forceCenter(n.center[0],n.center[1])).force("charge",l).alpha(f).alphaDecay(u).alphaMin(s),n.preventOverlap&&n.overlapProcess(o),a){var h=uu.forceLink().id(function(p){return p.id}).links(a);n.edgeStrength&&h.strength(n.edgeStrength),n.linkDistance&&h.distance(n.linkDistance),n.edgeForce=h,o.force("link",h)}if(n.workerEnabled&&!kX()&&(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=IX(o),v=1;v<=d;v++)o.tick(),postMessage({nodes:i,currentTick:v,totalTicks:d,type:AX.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(t){var n=this,i=n.nodeSize,a=n.nodeSpacing,o,s,u=n.collideStrength;if((0,ts.isNumber)(a)?s=function(){return a}:(0,ts.isFunction)(a)?s=a:s=function(){return 0},!i)o=function(h){if(h.size){if((0,ts.isArray)(h.size)){var d=h.size[0]>h.size[1]?h.size[0]:h.size[1];return d/2+s(h)}if((0,ts.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,ts.isFunction)(i))o=function(h){var d=i(h);return d+s(h)};else if((0,ts.isArray)(i)){var f=i[0]>i[1]?i[0]:i[1],l=f/2;o=function(h){return l+s(h)}}else if((0,ts.isNumber)(i)){var c=i/2;o=function(h){return c+s(h)}}else o=function(){return 10};t.force("collisionForce",uu.forceCollide(o).strength(u))},e.prototype.updateCfg=function(t){var n=this;n.ticking&&(n.forceSimulation.stop(),n.ticking=!1),n.forceSimulation=null,Object.assign(n,t)},e.prototype.destroy=function(){var t=this;t.ticking&&(t.forceSimulation.stop(),t.ticking=!1),t.nodes=null,t.edges=null,t.destroyed=!0},e}(CX.Base);od.ForceLayout=TX;function IX(r){var e=r.alphaMin(),t=r.alphaTarget(),n=r.alpha(),i=Math.log((e-t)/(n-t))/Math.log(1-r.alphaDecay()),a=Math.ceil(i);return a}function kX(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}(function(r){var e=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),t=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&e(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),t(od,r)})(Y0);var nl={},LX=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(nl,"__esModule",{value:!0}),nl.CircularLayout=void 0;var NX=Pr,aa=Ir();function OX(r,e,t,n){r.forEach(function(i,a){r[a].children=[],r[a].parent=[]}),n?e.forEach(function(i){var a=(0,aa.getEdgeTerminal)(i,"source"),o=(0,aa.getEdgeTerminal)(i,"target"),s=0;a&&(s=t[a]);var u=0;o&&(u=t[o]);var f=r[s].children,l=r[u].parent;f.push(r[u].id),l.push(r[s].id)}):e.forEach(function(i){var a=(0,aa.getEdgeTerminal)(i,"source"),o=(0,aa.getEdgeTerminal)(i,"target"),s=0;a&&(s=t[a]);var u=0;o&&(u=t[o]);var f=r[s].children,l=r[u].children;f.push(r[u].id),l.push(r[s].id)})}function DX(r,e,t){for(var n=t.length,i=0;in?1:0}var RX=function(r){LX(e,r);function e(t){var n=r.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(t),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 t,n=this,i=n.nodes,a=n.edges,o=i.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){i[0].x=s[0],i[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,x={};i.forEach(function(D,$){x[D.id]=$}),n.nodeMap=x;var w=(0,aa.getDegree)(i.length,x,a);if(n.degrees=w,y){var E=(0,aa.getFuncByUnknownType)(10,y),_=(0,aa.getFuncByUnknownType)(10,m),M=-1/0;i.forEach(function(D){var $=_(D);M<$&&(M=$)});var C=0;i.forEach(function(D,$){$===0?C+=M||10:C+=(E(D)||0)+(M||10)}),u=C/(2*Math.PI)}else!u&&!f&&!l?u=n.height>n.width?n.width/2:n.height/2:!f&&l?f=l:f&&!l&&(l=f);var S=b*v,A=[];p==="topology"?A=n.topologyOrdering():p==="topology-directed"?A=n.topologyOrdering(!0):p==="degree"?A=n.degreeOrdering():A=i;for(var T=Math.ceil(o/c),k=0;k0?r.set(e,t):r.delete(e))}function fC(r,e,t,n){var i=String(e),a=String(t);if(!r&&i>a){var o=i;i=a,a=o}return i+lu.EDGE_KEY_DELIM+a+lu.EDGE_KEY_DELIM+(n===void 0?lu.DEFAULT_EDGE_NAME:n)}function lC(r,e,t,n){var i=String(e),a=String(t),o={v:e,w:t};if(!r&&i>a){var s=o.v;o.v=o.w,o.w=s}return n!==void 0&&(o.name=n),o}function ty(r,e){return fC(r,e.v,e.w,e.name)}function cC(r){return typeof r=="function"}var GX=function(e){return e.nodes().map(function(t){var n=e.node(t),i=e.parent(t),a={id:t,value:n,parent:i};return a.value===void 0&&delete a.value,a.parent===void 0&&delete a.parent,a})},zX=function(e){return e.edges().map(function(t){var n=e.edge(t),i={v:t.v,w:t.w,value:n,name:t.name};return i.name===void 0&&delete i.name,i.value===void 0&&delete i.value,i})},$X=function(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:GX(e),edges:zX(e),value:e.graph()};return t.value===void 0&&delete t.value,t},jX=function(e){var t=new rs(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(function(n){t.setNode(n.id,n.value),n.parent&&t.setParent(n.id,n.parent)}),e.edges.forEach(function(n){t.setEdge(n.v,n.w,n.value,n.name)}),t};function hC(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function dC(r){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};XX(this,r),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=lu.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(i){return e.label=i,e},this.graph=function(){return e.label},this.setDefaultNodeLabel=function(i){return cC(i)?e.defaultNodeLabelFn=i:e.defaultNodeLabelFn=function(){return i},e},this.nodeCount=function(){return e.nodeCountNum},this.node=function(i){return e.nodesLabelMap.get(i)},this.nodes=function(){return Array.from(e.nodesLabelMap.keys())},this.sources=function(){return e.nodes().filter(function(i){var a;return!(!((a=e.inEdgesMap.get(i))===null||a===void 0)&&a.size)})},this.sinks=function(){return e.nodes().filter(function(i){var a;return!(!((a=e.outEdgesMap.get(i))===null||a===void 0)&&a.size)})},this.setNodes=function(i,a){return i.map(function(o){return e.setNode(o,a)}),e},this.hasNode=function(i){return e.nodesLabelMap.has(i)},this.checkCompound=function(){if(!e.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(i){if(e.isCompound()){var a,o=(a=e.parentMap)===null||a===void 0?void 0:a.get(i);if(o!==e.GRAPH_NODE)return o}},this.removeFromParentsChildList=function(i){var a=e.parentMap.get(i);e.childrenMap.get(a).delete(i)},this.setParent=function(i,a){var o,s;e.checkCompound();for(var u=a===void 0?e.GRAPH_NODE:a,f=e.parent(u);f;){if(i===f)throw new Error("Setting "+a+" as parent of "+i+" would create a cycle");f=e.parent(f)}a&&e.setNode(a),e.setNode(i),e.removeFromParentsChildList(i),(o=e.parentMap)===null||o===void 0||o.set(i,u);var l=e.childrenMap.get(u);return l.set(i,!0),(s=e.childrenMap)===null||s===void 0||s.set(u,l),e},this.children=function(i){var a=i===void 0?e.GRAPH_NODE:i;if(e.isCompound()){var o,s=(o=e.childrenMap)===null||o===void 0?void 0:o.get(a);return s?Array.from(s.keys()):void 0}if(a===e.GRAPH_NODE)return e.nodes();if(i&&e.hasNode(i))return[]},this.predecessors=function(i){var a=e.predecessorsMap.get(i);return a?Array.from(a.keys()):void 0},this.successors=function(i){var a=e.successorsMap.get(i);return a?Array.from(a.keys()):void 0},this.neighbors=function(i){var a;if(e.hasNode(i))return Array.from(new Set((a=e.predecessors(i))===null||a===void 0?void 0:a.concat(e.successors(i))))},this.isLeaf=function(i){var a;if(e.isDirected()){var o;return!(!((o=e.successors(i))===null||o===void 0)&&o.length)}return!(!((a=e.neighbors(i))===null||a===void 0)&&a.length)},this.filterNodes=function(i){var a=e.directed,o=e.multigraph,s=e.compound,u=new r({directed:a,multigraph:o,compound:s});if(u.setGraph(e.graph()),e.nodes().forEach(function(l){i(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(i){return cC(i)?e.defaultEdgeLabelFn=i:e.defaultEdgeLabelFn=function(){return i},e},this.edgeCount=function(){return e.edgeCountNum},this.setEdgeObj=function(i,a){return e.setEdge(i.v,i.w,a,i.name)},this.setPath=function(i,a){return i.reduce(function(o,s){return e.setEdge(o,s,a),s}),e},this.edgeFromArgs=function(i,a,o){return e.edge({v:i,w:a,name:o})},this.edge=function(i){return e.edgesLabelsMap.get(ty(e.isDirected(),i))},this.hasEdge=function(i,a,o){return e.edgesLabelsMap.has(ty(e.isDirected(),{v:i,w:a,name:o}))},this.removeEdgeObj=function(i){var a=i.v,o=i.w,s=i.name;return e.removeEdge(a,o,s)},this.edges=function(){return Array.from(e.edgesMap.values())},this.inEdges=function(i,a){var o=e.inEdgesMap.get(i);if(o)return Array.from(o.values()).filter(function(s){return!a||s.v===a})},this.outEdges=function(i,a){var o=e.outEdgesMap.get(i);if(o)return Array.from(o.values()).filter(function(s){return!a||s.w===a})},this.nodeEdges=function(i,a){var o;if(e.hasNode(i))return(o=e.inEdges(i,a))===null||o===void 0?void 0:o.concat(e.outEdges(i,a))},this.toJSON=function(){return $X(e)},this.nodeInDegree=function(i){var a=e.inEdgesMap.get(i);return a?a.size:0},this.nodeOutDegree=function(i){var a=e.outEdgesMap.get(i);return a?a.size:0},this.nodeDegree=function(i){return e.nodeInDegree(i)+e.nodeOutDegree(i)},this.source=function(i){return i.v},this.target=function(i){return i.w};var n=dC(dC({},VX),t);this.compound=n.compound,this.directed=n.directed,this.multigraph=n.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return WX(r,[{key:"setNode",value:function(t,n){var i=this.nodesLabelMap,a=this.defaultNodeLabelFn,o=this.isCompound,s=this.parentMap,u=this.childrenMap,f=this.inEdgesMap,l=this.outEdgesMap,c=this.predecessorsMap,h=this.successorsMap;if(i.has(t))return n!==void 0&&i.set(t,n),this;if(i.set(t,n||a(t)),o()){var d;s==null||s.set(t,this.GRAPH_NODE),u==null||u.set(t,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(t,!0)}return[f,l,c,h].forEach(function(v){return v.set(t,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(t){var n=this;if(this.hasNode(t)){var i=function(g){n.removeEdge(g.v,g.w,g.name)},a=this.inEdgesMap,o=this.outEdgesMap,s=this.predecessorsMap,u=this.successorsMap,f=this.nodesLabelMap;if(this.isCompound()){var l,c,h;this.removeFromParentsChildList(t),(l=this.parentMap)===null||l===void 0||l.delete(t),(c=this.children(t))===null||c===void 0||c.forEach(function(p){return n.setParent(p)}),(h=this.childrenMap)===null||h===void 0||h.delete(t)}var d=a.get(t),v=o.get(t);Array.from(d.values()).forEach(function(p){return i(p)}),Array.from(v.values()).forEach(function(p){return i(p)}),f.delete(t),a.delete(t),o.delete(t),s.delete(t),u.delete(t),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(t,n,i,a){var o,s,u=lC(this.isDirected(),t,n,a),f=ty(this.isDirected(),u),l=u.v,c=u.w;if(this.edgesLabelsMap.has(f))return this.edgesLabelsMap.set(f,i),this;if(a!==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,i||this.defaultEdgeLabelFn(l,c,a)),Object.freeze(u),this.edgesMap.set(f,u);var h=this.predecessorsMap.get(c),d=this.successorsMap.get(l);return sC(h,l),sC(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(t,n,i){var a=fC(this.isDirected(),t,n,i),o=this.edgesMap.get(a);if(o){var s=lC(this.isDirected(),t,n,i),u=s.v,f=s.w;this.edgesLabelsMap.delete(a),this.edgesMap.delete(a);var l=this.predecessorsMap.get(f),c=this.successorsMap.get(u);uC(l,u),uC(c,f),this.inEdgesMap.get(f).delete(a),this.outEdgesMap.get(u).delete(a),this.edgeCountNum-=1}return this}}]),r}();rs.fromJSON=jX;function ry(r){"@babel/helpers - typeof";return ry=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},ry(r)}function HX(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function qX(r,e){for(var t=0;t"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 La(r){return La=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},La(r)}var nY=function(r){QX(t,r);var e=JX(t);function t(){var n;HX(this,t);for(var i=arguments.length,a=new Array(i),o=0;o-1&&this.eventPool[i].splice(o,1)}}},{key:"emitEvent",value:function(i){for(var a=arguments.length,o=new Array(a>1?a-1:0),s=1;s>1,((s=n[a])===null||s===void 0?void 0:s.priority)e.arr[i].priority)throw new Error("New priority is greater than current priority.Key: ".concat(t," Old: + ").concat(e.arr[i].priority," New: ").concat(n));e.arr[i].priority=n,e.innerDecrease(i)}}),oY=function(e,t){var n=new rs,i=new Map,a=new vC,o;function s(l){var c=l.v===o?l.w:l.v,h=a.priority(c);if(h!==void 0){var d=t(l);d0;){var f;if(o=a.removeMin(),i.has(o))n.setEdge(o,i.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},sY=function(e){var t=new Set,n=[],i=e.nodes();return i.forEach(function(a){for(var o=[],s=[a];s.length>0;){var u=s.pop();if(!t.has(u)){var f,l;t.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},uY=function r(e,t,n,i,a,o){i.includes(t)||(i.push(t),n||o.push(t),a(t).forEach(function(s){return r(e,s,n,i,a,o)}),n&&o.push(t))},iy=function(e,t,n){var i=Array.isArray(t)?t:[t],a=function(f){return e.isDirected()?e.successors(f):e.neighbors(f)},o=[],s=[];return i.forEach(function(u){if(e.hasNode(u))uY(e,u,n==="post",s,a,o);else throw new Error("Graph does not have node: "+u)}),o};function fY(r,e){return dY(r)||hY(r,e)||cY(r,e)||lY()}function lY(){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 cY(r,e){if(r){if(typeof r=="string")return pC(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return pC(r,e)}}function pC(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t0&&(s=o.removeMin(),u=a.get(s),!(u&&u.distance===Number.POSITIVE_INFINITY));)i(s).forEach(f);var l={};return Array.from(a.entries()).forEach(function(c){var h=fY(c,2),d=h[0],v=h[1];return l[String(d)]=v,l}),l},gY=function(e,t,n){var i={};return e.nodes().forEach(function(a){return i[String(a)]=gC(e,a,t,n),i}),i},yC=function(e){var t=0,n=[],i=new Map,a=[];function o(s){var u,f={onStack:!0,lowlink:t,index:t};if(i.set(s,f),t+=1,n.push(s),(u=e.successors(s))===null||u===void 0||u.forEach(function(d){var v;if(i.has(d)){if(!((v=i.get(d))===null||v===void 0)&&v.onStack){var g=i.get(d);f.lowlink=Math.min(f.lowlink,g.index)}}else{o(d);var p=i.get(d);f.lowlink=Math.min(f.lowlink,p.lowlink)}}),f.lowlink===f.index){var l=[],c;do{c=n.pop();var h=i.get(c);h.onStack=!1,l.push(c)}while(s!==c);a.push(l)}}return e.nodes().forEach(function(s){i.has(s)||o(s)}),a},yY=function(e){return yC(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})};function ay(r){"@babel/helpers - typeof";return ay=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},ay(r)}function mY(r,e,t){return Object.defineProperty(r,"prototype",{writable:!1}),r}function bY(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function xY(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&il(r,e)}function wY(r){var e=mC();return function(){var n=al(r),i;if(e){var a=al(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return EY(this,i)}}function EY(r,e){if(e&&(ay(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _Y(r)}function _Y(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function oy(r){var e=typeof Map=="function"?new Map:void 0;return oy=function(n){if(n===null||!SY(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,i)}function i(){return hd(n,arguments,al(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),il(i,n)},oy(r)}function hd(r,e,t){return mC()?hd=Reflect.construct:hd=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),f=new u;return o&&il(f,o.prototype),f},hd.apply(null,arguments)}function mC(){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 SY(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function il(r,e){return il=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},il(r,e)}function al(r){return al=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},al(r)}var sy=function(r){xY(t,r);var e=wY(t);function t(){return bY(this,t),e.apply(this,arguments)}return mY(t)}(oy(Error));function bC(r){var e=new Set,t=new Set,n=[];function i(a){if(t.has(a))throw new sy;if(!e.has(a)){var o;t.add(a),e.add(a),(o=r.predecessors(a))===null||o===void 0||o.forEach(i),t.delete(a),n.push(a)}}if(r.sinks().forEach(i),e.size!==r.nodeCount())throw new sy;return n}var MY=function(e){try{bC(e)}catch(t){if(t instanceof sy)return!1;throw t}return!0},CY=function(e,t){return iy(e,t,"post")},AY=function(e,t){return iy(e,t,"pre")},TY=function(){return 1};function IY(r,e,t){return kY(r,e||TY,t||function(n){return r.outEdges(n)})}function kY(r,e,t){var n={},i=r.nodes();return i.forEach(function(a){var o=String(a);n[o]={},n[o][o]={distance:0},i.forEach(function(s){a!==s&&(n[o][String(s)]={distance:Number.POSITIVE_INFINITY})}),t(a).forEach(function(s){var u=s.v===a?s.w:s.v,f=e(s);n[o][String(u)]={distance:f,predecessor:a}})}),i.forEach(function(a){var o=String(a),s=n[o];i.forEach(function(u){var f=String(u),l=n[f];i.forEach(function(c){var h=String(c),d=l[o],v=s[h],p=l[h],g=d.distance+v.distance;gr.length)&&(e=r.length);for(var t=0,n=new Array(e);t0;--s)if(o=e[s].dequeue(),o){n=n.concat(fy(r,e,t,o,!0));break}}}return n},fy=function(r,e,t,n,i){var a,o,s=[];return(a=r.inEdges(n.v))===null||a===void 0||a.forEach(function(u){var f=r.edge(u),l=r.node(u.v);i&&s.push({v:u.v,w:u.w,in:0,out:0}),l.out===void 0&&(l.out=0),l.out-=f,ly(e,t,l)}),(o=r.outEdges(n.v))===null||o===void 0||o.forEach(function(u){var f=r.edge(u),l=u.w,c=r.node(l);c.in===void 0&&(c.in=0),c.in-=f,ly(e,t,c)}),r.removeNode(n.v),i?s:void 0},tW=function(r,e){var t=new KY,n=0,i=0;r.nodes().forEach(function(f){t.setNode(f,{v:f,in:0,out:0})}),r.edges().forEach(function(f){var l=t.edge(f)||0,c=(e==null?void 0:e(f))||1,h=l+c;t.setEdge(f.v,f.w,h),i=Math.max(i,t.node(f.v).out+=c),n=Math.max(n,t.node(f.w).in+=c)});for(var a=[],o=i+n+3,s=0;sMath.abs(M)*A?(C<0&&(A=-A),T=A*M/C,k=A):(M<0&&(S=-S),T=S,k=S*C/M),{x:E+T,y:_+k}};r.intersectRect=l;var c=function(x){for(var w=[],E=(0,r.maxRank)(x)+1,_=0;_w)&&(w=M)}),w||(w=0),w};r.maxRank=p;var g=function(x,w){var E={lhs:[],rhs:[]};return x==null||x.forEach(function(_){w(_)?E.lhs.push(_):E.rhs.push(_)}),E};r.partition=g;var y=function(x,w){var E=Date.now();try{return w()}finally{console.log("".concat(x," time: ").concat(Date.now()-E,"ms"))}};r.time=y;var m=function(x,w){return w()};r.notime=m;var b=function(x,w){return x.reduce(function(E,_){var M=w(E),C=w(_);return M>C?_:E})};r.minBy=b}(Zn),Object.defineProperty(cy,"__esModule",{value:!0});var lW=Zn,cW=function(r){r.graph().dummyChains=[],r.edges().forEach(function(e){return hW(r,e)})},hW=function(r,e){var t=e.v,n=r.node(t).rank,i=e.w,a=r.node(i).rank,o=e.name,s=r.edge(e),u=s.labelRank;if(a!==n+1){r.removeEdgeObj(e);var f=r.graph(),l,c,h;for(h=0,++n;nC.lim&&(S=C,A=!0);var T=x.edges().filter(function(k){return A===m(b,b.node(k.v),S)&&A!==m(b,b.node(k.w),S)});return(0,n.minBy)(T,function(k){return(0,t.slack)(x,k)})};r.enterEdge=v;var p=function(b,x,w,E){var _=w.v,M=w.w;b.removeEdge(_,M),b.setEdge(E.v,E.w,{}),(0,r.initLowLimValues)(b),(0,r.initCutValues)(b,x),g(b,x)};r.exchangeEdges=p;var g=function(b,x){var w=b.nodes().find(function(_){var M;return!(!((M=x.node(_))===null||M===void 0)&&M.parent)}),E=a(b,w);E=E==null?void 0:E.slice(1),E==null||E.forEach(function(_){var M=b.node(_).parent,C=x.edgeFromArgs(_,M),S=!1;C||(C=x.edgeFromArgs(M,_),S=!0),x.node(_).rank=x.node(M).rank+(S?C.minlen:-C.minlen)})},y=function(b,x,w){return b.hasEdge(x,w)},m=function(b,x,w){return w.low<=x.lim&&x.lim<=w.lim};r.default=s})(DC);var yW=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(hy,"__esModule",{value:!0});var PC=Ti,mW=go,bW=yW(DC),xW=function(r){switch(r.graph().ranker){case"network-simplex":EW(r);break;case"tight-tree":RC(r);break;case"longest-path":wW(r);break;default:RC(r)}},wW=PC.longestPath,RC=function(r){(0,PC.longestPathWithLayer)(r),(0,mW.feasibleTreeWithLayer)(r)},EW=function(r){(0,bW.default)(r)};hy.default=xW;var dy={};Object.defineProperty(dy,"__esModule",{value:!0});var _W=function(r){var e,t={},n=0,i=function(a){var o,s=n;(o=r.children(a))===null||o===void 0||o.forEach(i),t[a]={low:s,lim:n++}};return(e=r.children())===null||e===void 0||e.forEach(i),t},SW=function(r,e,t,n){var i=[],a=[],o=Math.min(e[t].low,e[n].low),s=Math.max(e[t].lim,e[n].lim),u,f;u=t;do u=r.parent(u),i.push(u);while(u&&(e[u].low>o||s>e[u].lim));for(f=u,u=n;u&&u!==f;)a.push(u),u=r.parent(u);return{lca:f,path:i.concat(a.reverse())}},MW=function(r){var e,t=_W(r);(e=r.graph().dummyChains)===null||e===void 0||e.forEach(function(n){var i,a,o=n,s=r.node(o),u=s.edgeObj;if(u)for(var f=SW(r,t,u.v,u.w),l=f.path,c=f.lca,h=0,d=l[h],v=!0;o!==u.w;){if(s=r.node(o),v){for(;d!==c&&((i=r.node(d))===null||i===void 0?void 0:i.maxRank)-1:!1},UC=function(r,e){if(!Bn(r))return r;for(var t=[],n=0;n-1;)UW.call(r,a,1);return r},WW=Array.prototype.splice,ZC=function(e,t){if(!Bn(e))return[];for(var n=e?t.length:0,i=n-1;n--;){var a=void 0,o=t[n];(n===i||o!==a)&&(a=o,WW.call(e,o,1))}return e},KC=function(r,e,t){if(!qr(r)&&!du(r))return r;var n=t;return cu(r,function(i,a){n=e(n,i,a)}),n},VW=function(r,e){var t=[];if(!Bn(r))return t;for(var n=-1,i=[],a=r.length;++na[s])return 1;if(i[s]t?t:r},lV=function(r,e){var t=e.toString(),n=t.indexOf(".");if(n===-1)return Math.round(r);var i=t.substr(n+1).length;return i>20&&(i=20),parseFloat(r.toFixed(i))};function Oa(r){return typeof r=="number"}function cV(r){return Oa(r)&&r%1!==0}function hV(r){return Oa(r)&&r%2===0}function dV(r){return Oa(r)&&r%1===0}function vV(r){return Oa(r)&&r<0}var pV=1e-5;function gV(r,e,t){return t===void 0&&(t=pV),r===e||Math.abs(r-e)0};const bV=function(r,e){if(qr(r)){for(var t,n=-1/0,i=0;in&&(t=a,n=o)}return t}},xV=function(r,e){if(qr(r)){for(var t,n=1/0,i=0;ii&&(n=t,o(1),++e),t[s]=u}function o(s){e=0,t=Object.create(null),s||(n=Object.create(null))}return o(),{clear:o,has:function(s){return t[s]!==void 0||n[s]!==void 0},get:function(s){var u=t[s];if(u!==void 0)return u;if((u=n[s])!==void 0)return a(s,u),u},set:function(s,u){t[s]!==void 0?t[s]=u:a(s,u)}}}var My=new Map;function oA(r,e,t){t===void 0&&(t=128);var n=function(){for(var i=[],a=0;ae?(n&&(clearTimeout(n),n=null),s=l,o=r.apply(i,a),n||(i=a=null)):!n&&t.trailing!==!1&&(n=setTimeout(u,c)),o};return f.cancel=function(){clearTimeout(n),s=0,n=i=a=null},f},hH=function(r){return Bn(r)?Array.prototype.slice.call(r):[]};var xd={};const dH=function(r){return r=r||"g",xd[r]?xd[r]+=1:xd[r]=1,r+xd[r]},vH=function(){},pH=function(r){return r};function gH(r){return yo(r)?0:Bn(r)?r.length:Object.keys(r).length}var yH=function(){function r(){this.map={}}return r.prototype.has=function(e){return this.map[e]!==void 0},r.prototype.get=function(e,t){var n=this.map[e];return n===void 0?t:n},r.prototype.set=function(e,t){this.map[e]=t},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(e){delete this.map[e]},r.prototype.size=function(){return Object.keys(this.map).length},r}(),mH=/rgba?\(([\s.,0-9]+)\)/;function bH(){var r=document.getElementById("antv-web-colour-picker");return r||(r=document.createElement("i"),r.id="antv-web-colour-picker",r.title="Web Colour Picker",r.style.display="none",document.body.appendChild(r),r)}function xH(r){if(r[0]==="#"&&r.length===7)return r;var e=bH();e.style.color=r;var t=document.defaultView.getComputedStyle(e,"").getPropertyValue("color"),n=mH.exec(t),i=n[1].split(/\s*,\s*/).map(function(a){return Number(a)});return t=jC(i),t}var uA=oA(xH,function(r){return r},256);function Cy(r,e,t,n){return r[n]+(e[n]-r[n])*t}function wH(r,e){var t=isNaN(Number(e))||e<0?0:e>1?1:Number(e),n=r.length-1,i=Math.floor(n*t),a=n*t-i,o=r[i],s=i===n?o:r[i+1];return jC([Cy(o,s,a,0),Cy(o,s,a,1),Cy(o,s,a,2)])}function EH(r){var e=typeof r=="string"?r.split("-"):r,t=e.map(function(n){return $C(n.indexOf("#")===-1?uA(n):n)});return function(n){return wH(t,n)}}var _H=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,SH=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,MH=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function CH(r){return/^[r,R,L,l]{1}[\s]*\(/.test(r)}function AH(r){if(CH(r)){var e,t=void 0;if(r[0]==="l"){var n=_H.exec(r),i=+n[1]+90;t=n[2],e="linear-gradient(".concat(i,"deg, ")}else if(r[0]==="r"){e="radial-gradient(";var n=SH.exec(r);t=n[4]}var a=t.match(MH);return a.forEach(function(o,s){var u=o.split(":");e+="".concat(u[1]," ").concat(Number(u[0])*100,"%"),s!==a.length-1&&(e+=", ")}),e+=")",e}return r}function TH(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Cp(n,t),Wi(r,n,e)}function IH(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Ap(n,t),Wi(r,n,e)}function kH(r,e,t){var n=[0,0,0,0,0,0,0,0,0];return Tp(n,t),Wi(r,n,e)}function LH(r,e,t){return Wi(r,t,e)}function NH(r,e){for(var t=r?[].concat(r):[1,0,0,0,1,0,0,0,1],n=0,i=e.length;n=0;return t?i?Math.PI*2-n:n:i?n:Math.PI*2-n}function DH(r,e,t){return t?(r[0]=e[1],r[1]=-1*e[0]):(r[0]=-1*e[1],r[1]=e[0]),r}function PH(r,e){if(e==="off")return[].concat(r);var t=typeof e=="number"&&e>=1?Math.pow(10,e):1;return r.map(function(n){var i=n.slice(1).map(Number).map(function(a){return e?Math.round(a*t)/t:Math.round(a)});return[n[0]].concat(i)})}function RH(r,e){return e===void 0&&(e="off"),PH(r,e).map(function(t){return t[0]+t.slice(1).join(" ")}).join("")}var lA={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function BH(r,e,t){if(r[t].length>7){r[t].shift();for(var n=r[t],i=t;n.length;)e[t]="A",r.splice(i+=1,0,["C"].concat(n.splice(0,6)));r.splice(t,1)}}var sl={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function cA(r){return Array.isArray(r)&&r.every(function(e){var t=e[0].toLowerCase();return sl[t]===e.length-1&&"achlmqstvz".includes(t)})}function hA(r){return cA(r)&&r.every(function(e){var t=e[0];return t===t.toUpperCase()})}function dA(r){return hA(r)&&r.every(function(e){var t=e[0];return"ACLMQZ".includes(t)})}function vA(r){for(var e=r.pathValue[r.segmentStart],t=e.toLowerCase(),n=r.data;n.length>=sl[t]&&(t==="m"&&n.length>2?(r.segments.push([e].concat(n.splice(0,2))),t="l",e=e==="m"?"l":"L"):r.segments.push([e].concat(n.splice(0,sl[t]))),!!sl[t]););}function FH(r){var e=r.index,t=r.pathValue,n=t.charCodeAt(e);if(n===48){r.param=0,r.index+=1;return}if(n===49){r.param=1,r.index+=1;return}r.err='[path-util]: invalid Arc flag "'.concat(t[e],'", expecting 0 or 1 at index ').concat(e)}function GH(r){return r>=48&&r<=57||r===43||r===45||r===46}function pu(r){return r>=48&&r<=57}function zH(r){var e=r.max,t=r.pathValue,n=r.index,i=n,a=!1,o=!1,s=!1,u=!1,f;if(i>=e){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(f=t.charCodeAt(i),(f===43||f===45)&&(i+=1,f=t.charCodeAt(i)),!pu(f)&&f!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(t[i],'" is not a number');return}if(f!==46){if(a=f===48,i+=1,f=t.charCodeAt(i),a&&i=5760&&e.includes(r)}function wd(r){for(var e=r.pathValue,t=r.max;r.index0;o-=1){if(UH(i)&&(o===3||o===4)?FH(r):zH(r),r.err.length)return;r.data.push(r.param),wd(r),r.index=r.max||!GH(t.charCodeAt(r.index)))break}vA(r)}var YH=function(){function r(e){this.pathValue=e,this.segments=[],this.max=e.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return r}();function Ed(r){if(cA(r))return[].concat(r);var e=new YH(r);for(wd(e);e.index1&&(S=Math.sqrt(S),h*=S,d*=S);var A=h*h,T=d*d,k=(a===o?-1:1)*Math.sqrt(Math.abs((A*T-A*C*C-T*M*M)/(A*C*C+T*M*M)));E=k*h*C/d+(l+v)/2,_=k*-d*M/h+(c+p)/2,x=Math.asin(((c-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),w=Math.asin(((p-_)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),x=lw&&(x-=Math.PI*2),!o&&w>x&&(w-=Math.PI*2)}var O=w-x;if(Math.abs(O)>g){var G=w,D=v,$=p;w=x+g*(o&&w>x?1:-1),v=E+h*Math.cos(w),p=_+d*Math.sin(w),m=Ay(v,p,h,d,i,0,o,D,$,[w,G,E,_])}O=w-x;var Y=Math.cos(x),N=Math.sin(x),P=Math.cos(w),W=Math.sin(w),J=Math.tan(O/4),te=4/3*h*J,H=4/3*d*J,pe=[l,c],Te=[l+te*N,c-H*Y],Ne=[v+te*W,p-H*P],Ze=[v,p];if(Te[0]=2*pe[0]-Te[0],Te[1]=2*pe[1]-Te[1],f)return Te.concat(Ne,Ze,m);m=Te.concat(Ne,Ze,m);for(var at=[],nt=0,St=m.length;nt=a)o={x:t,y:n};else{var s=bo([r,e],[t,n],i/a),u=s[0],f=s[1];o={x:u,y:f}}return{length:a,point:o,min:{x:Math.min(r,t),y:Math.min(e,n)},max:{x:Math.max(r,t),y:Math.max(e,n)}}}function mA(r,e){var t=r.x,n=r.y,i=e.x,a=e.y,o=t*i+n*a,s=Math.sqrt((Math.pow(t,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),u=t*a-n*i<0?-1:1,f=u*Math.acos(o/s);return f}function JH(r,e,t,n,i,a,o,s,u,f){var l=Math.abs,c=Math.sin,h=Math.cos,d=Math.sqrt,v=Math.PI,p=l(t),g=l(n),y=(i%360+360)%360,m=y*(v/180);if(r===s&&e===u)return{x:r,y:e};if(p===0||g===0)return Ty(r,e,s,u,f).point;var b=(r-s)/2,x=(e-u)/2,w={x:h(m)*b+c(m)*x,y:-c(m)*b+h(m)*x},E=Math.pow(w.x,2)/Math.pow(p,2)+Math.pow(w.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(w.y,2)-Math.pow(g,2)*Math.pow(w.x,2),M=Math.pow(p,2)*Math.pow(w.y,2)+Math.pow(g,2)*Math.pow(w.x,2),C=_/M;C=C<0?0:C;var S=(a!==o?1:-1)*d(C),A={x:S*(p*w.y/g),y:S*(-(g*w.x)/p)},T={x:h(m)*A.x-c(m)*A.y+(r+s)/2,y:c(m)*A.x+h(m)*A.y+(e+u)/2},k={x:(w.x-A.x)/p,y:(w.y-A.y)/g},O=mA({x:1,y:0},k),G={x:(-w.x-A.x)/p,y:(-w.y-A.y)/g},D=mA(k,G);!o&&D>0?D-=2*v:o&&D<0&&(D+=2*v),D%=2*v;var $=O+D*f,Y=p*h($),N=g*c($),P={x:h(m)*Y-c(m)*N+T.x,y:c(m)*Y+h(m)*N+T.y};return P}function eq(r,e,t,n,i,a,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=r,x=e,w=0,E=[b,x,w],_=[b,x],M=0,C={x:0,y:0},S=[{x:b,y:x}];m&&f<=0&&(C={x:b,y:x});for(var A=0;A<=y;A+=1){if(M=A/y,c=JH(r,e,t,n,i,a,o,s,u,M),b=c.x,x=c.y,d&&S.push({x:b,y:x}),p&&(w+=gu(_,[b,x])),_=[b,x],m&&w>=f&&f>E[2]){var T=(w-f)/(w-E[2]);C={x:_[0]*(1-T)+E[0]*T,y:_[1]*(1-T)+E[1]*T}}E=[b,x,w]}return m&&f>=w&&(C={x:s,y:u}),{length:w,point:C,min:{x:Math.min.apply(null,S.map(function(k){return k.x})),y:Math.min.apply(null,S.map(function(k){return k.y}))},max:{x:Math.max.apply(null,S.map(function(k){return k.x})),y:Math.max.apply(null,S.map(function(k){return k.y}))}}}function tq(r,e,t,n,i,a,o,s,u){var f=1-u;return{x:Math.pow(f,3)*r+3*Math.pow(f,2)*u*t+3*f*Math.pow(u,2)*i+Math.pow(u,3)*o,y:Math.pow(f,3)*e+3*Math.pow(f,2)*u*n+3*f*Math.pow(u,2)*a+Math.pow(u,3)*s}}function bA(r,e,t,n,i,a,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=r,b=e,x=0,w=[m,b,x],E=[m,b],_=0,M={x:0,y:0},C=[{x:m,y:b}];y&&u<=0&&(M={x:m,y:b});for(var S=0;S<=g;S+=1){if(_=S/g,l=tq(r,e,t,n,i,a,o,s,_),m=l.x,b=l.y,h&&C.push({x:m,y:b}),v&&(x+=gu(E,[m,b])),E=[m,b],y&&x>=u&&u>w[2]){var A=(x-u)/(x-w[2]);M={x:E[0]*(1-A)+w[0]*A,y:E[1]*(1-A)+w[1]*A}}w=[m,b,x]}return y&&u>=x&&(M={x:o,y:s}),{length:x,point:M,min:{x:Math.min.apply(null,C.map(function(T){return T.x})),y:Math.min.apply(null,C.map(function(T){return T.y}))},max:{x:Math.max.apply(null,C.map(function(T){return T.x})),y:Math.max.apply(null,C.map(function(T){return T.y}))}}}function rq(r,e,t,n,i,a,o){var s=1-o;return{x:Math.pow(s,2)*r+2*s*o*t+Math.pow(o,2)*i,y:Math.pow(s,2)*e+2*s*o*n+Math.pow(o,2)*a}}function nq(r,e,t,n,i,a,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=r,y=e,m=0,b=[g,y,m],x=[g,y],w=0,E={x:0,y:0},_=[{x:g,y}];p&&o<=0&&(E={x:g,y});for(var M=0;M<=v;M+=1){if(w=M/v,u=rq(r,e,t,n,i,a,w),g=u.x,y=u.y,l&&_.push({x:g,y}),h&&(m+=gu(x,[g,y])),x=[g,y],p&&m>=o&&o>b[2]){var C=(m-o)/(m-b[2]);E={x:x[0]*(1-C)+b[0]*C,y:x[1]*(1-C)+b[1]*C}}b=[g,y,m]}return p&&o>=m&&(E={x:i,y:a}),{length:m,point:E,min:{x:Math.min.apply(null,_.map(function(S){return S.x})),y:Math.min.apply(null,_.map(function(S){return S.y}))},max:{x:Math.max.apply(null,_.map(function(S){return S.x})),y:Math.max.apply(null,_.map(function(S){return S.y}))}}}function Md(r,e,t){for(var n,i,a,o,s,u,f=_d(r),l=typeof e=="number",c,h=[],d,v=0,p=0,g=0,y=0,m,b=[],x=[],w=0,E={x:0,y:0},_=E,M=E,C=E,S=0,A=0,T=f.length;A=e&&(C=M),x.push(_),b.push(E),S+=w,u=d!=="Z"?m.slice(-2):[g,y],v=u[0],p=u[1];return l&&e>=S&&(C={x:v,y:p}),{length:S,point:C,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,x.map(function(k){return k.x})),y:Math.max.apply(null,x.map(function(k){return k.y}))}}}function iq(r,e){if(!r)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var t=Md(r,void 0,B(B({},e),{length:!1})),n=t.min,i=n.x,a=n.y,o=t.max,s=o.x,u=o.y,f=s-i,l=u-a;return{width:f,height:l,x:i,y:a,x2:s,y2:u,cx:i+f/2,cy:a+l/2,cz:Math.max(f,l)+Math.min(f,l)/2}}function ul(r,e){return Md(r,void 0,B(B({},e),{bbox:!1,length:!0})).length}function aq(r,e){if(!r)return{length:0,x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var t=Md(r,void 0,B(B({},e),{bbox:!0,length:!0})),n=t.length,i=t.min,a=i.x,o=i.y,s=t.max,u=s.x,f=s.y,l=u-a,c=f-o;return{length:n,width:l,height:c,x:a,y:o,x2:u,y2:f,cx:a+l/2,cy:o+c/2,cz:Math.max(l,c)+Math.min(l,c)/2}}function oq(r){var e=r.length,t=e-1;return r.map(function(n,i){return r.map(function(a,o){var s=i+o,u;return o===0||r[s]&&r[s][0]==="M"?(u=r[s],["M"].concat(u.slice(-2))):(s>=e&&(s-=t),r[s])})})}function sq(r,e){var t=r.length-1,n=[],i=0,a=0,o=oq(r);return o.forEach(function(s,u){r.slice(1).forEach(function(f,l){a+=gu(r[(u+l)%t].slice(-2),e[l%t].slice(-2))}),n[u]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),o[i]}function uq(r,e,t,n,i,a,o,s){return 3*((s-e)*(t+i)-(o-r)*(n+a)+n*(r-i)-t*(e-a)+s*(i+r/3)-o*(a+e/3))/20}function xA(r){var e=0,t=0,n=0;return yA(r).map(function(i){var a;switch(i[0]){case"M":return e=i[1],t=i[2],0;default:var o=i.slice(1),s=o[0],u=o[1],f=o[2],l=o[3],c=o[4],h=o[5];return n=uq(e,t,s,u,f,l,c,h),a=i.slice(-2),e=a[0],t=a[1],n}}).reduce(function(i,a){return i+a},0)}function fq(r){return xA(r)>=0}function Cd(r,e,t){return Md(r,e,B(B({},t),{bbox:!1,length:!0})).point}function lq(r,e){var t=Ed(r);if(typeof t=="string")throw TypeError(t);var n=t.slice(),i=ul(n),a=n.length-1,o=0,s=0,u=t[0],f=u.slice(-2),l=f[0],c=f[1],h={x:l,y:c};if(a<=0||!e||!Number.isFinite(e))return{segment:u,index:0,length:s,point:h,lengthAtSegment:o};if(e>=i)return n=t.slice(0,-1),o=ul(n),s=i-o,{segment:t[a],index:a,length:s,lengthAtSegment:o};for(var d=[];a>0;)u=n[a],n=n.slice(0,-1),o=ul(n),s=i-o,i=o,d.push({segment:u,index:a,length:s,lengthAtSegment:o}),a-=1;return d.find(function(v){var p=v.lengthAtSegment;return p<=e})}function cq(r,e){for(var t=Ed(r),n=_d(t),i=ul(t),a=function(w){var E=w.x-e.x,_=w.y-e.y;return E*E+_*_},o=8,s,u=0,f,l=0,c=1/0,h=0;h<=i;h+=o)s=Cd(n,h),u=a(s),u.5;)p=l-o,d=Cd(n,p),y=a(d),g=l+o,v=Cd(n,g),m=a(v),p>=0&&y=h[y],d[y]-=v?1:0,v?m.ss:[m.s]}).flat()});return p[0].length===p[1].length?p:EA(p[0],p[1],c)}var vq=1e-6;function Iy(r){return Math.abs(r)0!=Iy(s[1]-t)>0&&Iy(e-(t-o[1])*(o[0]-s[0])/(o[1]-s[1])-o[0])<0&&(n=!n)}return n}var _A=function(r,e,t){return r>=e&&r<=t};function gq(r,e,t,n){var i=.001,a={x:t.x-r.x,y:t.y-r.y},o={x:e.x-r.x,y:e.y-r.y},s={x:n.x-t.x,y:n.y-t.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>i*l*c){var d=(a.x*s.y-a.y*s.x)/u,v=(a.x*o.y-a.y*o.x)/u;_A(d,0,1)&&_A(v,0,1)&&(h={x:r.x+d*o.x,y:r.y+d*o.y})}return h}function SA(r){for(var e=[],t=r.length,n=0;n1){var o=r[0],s=r[t-1];e.push({from:{x:s[0],y:s[1]},to:{x:o[0],y:o[1]}})}return e}function yq(r,e){var t=!1;return r.forEach(function(n){if(gq(n.from,n.to,e.from,e.to))return t=!0,!1}),t}function MA(r){var e=r.map(function(n){return n[0]}),t=r.map(function(n){return n[1]});return{minX:Math.min.apply(null,e),maxX:Math.max.apply(null,e),minY:Math.min.apply(null,t),maxY:Math.max.apply(null,t)}}function mq(r,e){return!(e.minX>r.maxX||e.maxXr.maxY||e.maxY0;)c%2&&(h+=u[c+1]),c=c-1>>1,u[c]+=l.weight;f+=l.weight*h}}),f},Cq=function(r,e){for(var t=0,n=1;n<(e==null?void 0:e.length);n+=1)t+=Mq(r,e[n-1],e[n]);return t};Ly.default=Cq;var Ny={};Object.defineProperty(Ny,"__esModule",{value:!0});var Aq=Na,Tq=function(r,e,t){var n=Iq(r),i=new Aq.Graph({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return r.nodes().forEach(function(a){var o,s=r.node(a),u=r.parent(a);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(i.setNode(a),i.setParent(a,u||n),(o=r[t](a))===null||o===void 0||o.forEach(function(f){var l=f.v===a?f.w:f.v,c=i.edgeFromArgs(l,a),h=c!==void 0?c.weight:0;i.setEdge(l,a,{weight:r.edge(f).weight+h})}),s.hasOwnProperty("minRank")&&i.setNode(a,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))}),i},Iq=function(r){for(var e;r.hasNode(e="_root".concat(Math.random())););return e};Ny.default=Tq;var Oy={};Object.defineProperty(Oy,"__esModule",{value:!0});var kq=function(r,e,t){var n={},i;t==null||t.forEach(function(a){for(var o=r.parent(a),s,u;o;){if(s=r.parent(o),s?(u=n[s],n[s]=o):(u=i,i=o),u&&u!==o){e.setEdge(u,o);return}o=s}})};Oy.default=kq;var Dy={},Py={};Object.defineProperty(Py,"__esModule",{value:!0});var Lq=function(r,e){return e.map(function(t){var n=r.inEdges(t);if(!(n!=null&&n.length))return{v:t};{var i={sum:0,weight:0};return n==null||n.forEach(function(a){var o=r.edge(a),s=r.node(a.v);i.sum+=o.weight*s.order,i.weight+=o.weight}),{v:t,barycenter:i.sum/i.weight,weight:i.weight}}})};Py.default=Lq;var Ry={};Object.defineProperty(Ry,"__esModule",{value:!0});var Nq=function(r,e){var t,n,i,a={};r==null||r.forEach(function(s,u){a[s.v]={i:u,indegree:0,in:[],out:[],vs:[s.v]};var f=a[s.v];s.barycenter!==void 0&&(f.barycenter=s.barycenter,f.weight=s.weight)}),(t=e.edges())===null||t===void 0||t.forEach(function(s){var u=a[s.v],f=a[s.w];u!==void 0&&f!==void 0&&(f.indegree++,u.out.push(a[s.w]))});var o=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,function(s){return!s.indegree});return Oq(o)},Oq=function(r){for(var e,t,n=[],i=function(f){return function(l){l.merged||(l.barycenter===void 0||f.barycenter===void 0||l.barycenter>=f.barycenter)&&Dq(f,l)}},a=function(f){return function(l){l.in.push(f),--l.indegree===0&&r.push(l)}},o=function(){var f=r.pop();n.push(f),(e=f.in.reverse())===null||e===void 0||e.forEach(function(l){return i(f)(l)}),(t=f.out)===null||t===void 0||t.forEach(function(l){return a(f)(l)})};r!=null&&r.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})},Dq=function(r,e){var t,n=0,i=0;r.weight&&(n+=r.barycenter*r.weight,i+=r.weight),e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),r.vs=(t=e.vs)===null||t===void 0?void 0:t.concat(r.vs),r.barycenter=n/i,r.weight=i,r.i=Math.min(e.i,r.i),e.merged=!0};Ry.default=Nq;var By={};Object.defineProperty(By,"__esModule",{value:!0});var Pq=Zn,Rq=function(r,e,t,n){var i=(0,Pq.partition)(r,function(h){var d=h.hasOwnProperty("fixorder")&&!isNaN(h.fixorder);return n?!d&&h.hasOwnProperty("barycenter"):d||h.hasOwnProperty("barycenter")}),a=i.lhs,o=i.rhs.sort(function(h,d){return-h.i- -d.i}),s=[],u=0,f=0,l=0;a==null||a.sort(Bq(!!e,!!t)),l=AA(s,o,l),a==null||a.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=AA(s,o,l)});var c={vs:s.flat()};return f&&(c.barycenter=u/f,c.weight=f),c},AA=function(r,e,t){for(var n=t,i;e.length&&(i=e[e.length-1]).i<=n;)e.pop(),r==null||r.push(i.vs),n++;return n},Bq=function(r,e){return function(t,n){if(t.fixorder!==void 0&&n.fixorder!==void 0)return t.fixorder-n.fixorder;if(t.barycentern.barycenter)return 1;if(e&&t.order!==void 0&&n.order!==void 0){if(t.ordern.order)return 1}return r?n.i-t.i:t.i-n.i}};By.default=Rq;var Fy=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Dy,"__esModule",{value:!0});var Fq=Fy(Py),Gq=Fy(Ry),zq=Fy(By),TA=function(r,e,t,n,i,a){var o,s,u,f,l=r.children(e),c=r.node(e),h=c?c.borderLeft:void 0,d=c?c.borderRight:void 0,v={};h&&(l=l==null?void 0:l.filter(function(x){return x!==h&&x!==d}));var p=(0,Fq.default)(r,l||[]);p==null||p.forEach(function(x){var w;if(!((w=r.children(x.v))===null||w===void 0)&&w.length){var E=TA(r,x.v,t,n,a);v[x.v]=E,E.hasOwnProperty("barycenter")&&jq(x,E)}});var g=(0,Gq.default)(p,t);$q(g,v),(o=g.filter(function(x){return x.vs.length>0}))===null||o===void 0||o.forEach(function(x){var w=r.node(x.vs[0]);w&&(x.fixorder=w.fixorder,x.order=w.order)});var y=(0,zq.default)(g,n,i,a);if(h&&(y.vs=[h,y.vs,d].flat(),!((s=r.predecessors(h))===null||s===void 0)&&s.length)){var m=r.node(((u=r.predecessors(h))===null||u===void 0?void 0:u[0])||""),b=r.node(((f=r.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},$q=function(r,e){r==null||r.forEach(function(t){var n,i=(n=t.vs)===null||n===void 0?void 0:n.map(function(a){return e[a]?e[a].vs:a});t.vs=i.flat()})},jq=function(r,e){r.barycenter!==void 0?(r.barycenter=(r.barycenter*r.weight+e.barycenter*e.weight)/(r.weight+e.weight),r.weight+=e.weight):(r.barycenter=e.barycenter,r.weight=e.weight)};Dy.default=TA;var fl=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(xy,"__esModule",{value:!0});var IA=fl(wy),kA=fl(Ly),Uq=fl(Ny),Xq=fl(Oy),Yq=fl(Dy),LA=Ir(),Wq=Na,Gy=Zn,Vq=function(r,e){for(var t=(0,Gy.maxRank)(r),n=[],i=[],a=1;a-1;a--)i.push(a);var o=NA(r,n,"inEdges"),s=NA(r,i,"outEdges"),u=(0,IA.default)(r);zy(r,u);for(var f=Number.POSITIVE_INFINITY,l,a=0,c=0;c<4;++a,++c){OA(a%2?o:s,a%4>=2,!1,e),u=(0,Gy.buildLayerMatrix)(r);var h=(0,kA.default)(r,u);h=2,!0,e),u=(0,Gy.buildLayerMatrix)(r);var h=(0,kA.default)(r,u);hG)&&(0,r.addConflict)(E,P,Y)}))}function M(A){return JSON.stringify(A.slice(1))}function C(A,T){var k=M(A);T.get(k)||(_.apply(void 0,A),T.set(k,!0))}var S=function(A,T){var k=-1,O,G=0,D=new Map;return T==null||T.forEach(function($,Y){var N;if(((N=x.node($))===null||N===void 0?void 0:N.dummy)==="border"){var P=x.predecessors($)||[];P.length&&(O=x.node(P[0]).order,C([T,G,Y,k,O],D),G=Y,k=O)}C([T,G,T.length,O,A.length],D)}),T};return w!=null&&w.length&&w.reduce(S),E};r.findType2Conflicts=s;var u=function(x,w){var E,_;if(!((E=x.node(w))===null||E===void 0)&&E.dummy)return(_=x.predecessors(w))===null||_===void 0?void 0:_.find(function(M){return x.node(M).dummy})};r.findOtherInnerSegmentNode=u;var f=function(x,w,E){var _=w,M=E;if(_>M){var C=_;_=M,M=C}var S=x[_];S||(x[_]=S={}),S[M]=!0};r.addConflict=f;var l=function(x,w,E){var _=w,M=E;if(_>M){var C=w;_=M,M=C}return!!x[_]};r.hasConflict=l;var c=function(x,w,E,_){var M={},C={},S={};return w==null||w.forEach(function(A){A==null||A.forEach(function(T,k){M[T]=T,C[T]=T,S[T]=k})}),w==null||w.forEach(function(A){var T=-1;A==null||A.forEach(function(k){var O=_(k);if(O.length){O=O.sort(function(N,P){return S[N]-S[P]});for(var G=(O.length-1)/2,D=Math.floor(G),$=Math.ceil(G);D<=$;++D){var Y=O[D];C[k]===k&&TL.x&&(G=L.x),D>L.y&&(D=L.y)}),b.edges().forEach(function(ae){var L,Se=b.edge(ae);(L=Se.points)===null||L===void 0||L.forEach(function(Ge){G>Ge.x&&(G=Ge.x),D>Ge.y&&(D=Ge.y)})}),O[0]=h[0]-G,O[1]=h[1]-D}var $=l==="LR"||l==="RL";if(d){var Y=this,N=Y.focusNode,P=Y.ranksep,W=Y.getRadialPos,J=(0,Kn.isString)(N)?N:N==null?void 0:N.id,te=J?(o=b.node(J))===null||o===void 0?void 0:o._rank:0,H=[],pe=$?"y":"x",Te=$?"height":"width",Ne=1/0,Ze=-1/0;b.nodes().forEach(function(ae){var L=b.node(ae);if(s.nodeMap[ae]){var Se=C(s.nodeMap[ae]);if(te===0)H[L._rank]||(H[L._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),H[L._rank].nodes.push(ae),H[L._rank].totalWidth+=Se*2+L[Te],H[L._rank].maxSizeZe&&(Ze=We)}});var at=P||50,nt={},St=(Ze-Ne)/.9,Mt=[(Ne+Ze-St)*.5,(Ne+Ze+St)*.5],fr=function(ae,L,Se,Ge){Se===void 0&&(Se=-1/0),Ge===void 0&&(Ge=[0,1]);var me=Se;return ae.forEach(function(Ye){var We=b.node(Ye);nt[Ye]=L;var qe=W(We[pe],Mt,St,L,Ge),et=qe.x,yt=qe.y;if(s.nodeMap[Ye]){s.nodeMap[Ye].x=et+O[0],s.nodeMap[Ye].y=yt+O[1],s.nodeMap[Ye]._order=We._order;var Pt=M(s.nodeMap[Ye]);me=me})}:function(ae,L,Se){var Ge=Math.max(L.x,Se.x),me=Math.min(L.x,Se.x);return ae.filter(function(Ye){return Ye.x<=Ge&&Ye.x>=me})};b.edges().forEach(function(ae){var L,Se=b.edge(ae),Ge=m.findIndex(function(We){var qe=(0,Kn.getEdgeTerminal)(We,"source"),et=(0,Kn.getEdgeTerminal)(We,"target");return qe===ae.v&&et===ae.w});if(!(Ge<=-1)&&s.edgeLabelSpace&&s.controlPoints&&m[Ge].type!=="loop"){(L=Se==null?void 0:Se.points)===null||L===void 0||L.forEach(function(We){We.x+=O[0],We.y+=O[1]});var me=s.nodeMap[ae.v],Ye=s.nodeMap[ae.w];m[Ge].controlPoints=PZ(Se==null?void 0:Se.points,me,Ye,ar,$,Zr,tt)}})}return s.onLayoutEnd&&s.onLayoutEnd(),{nodes:u,edges:m}}},e.prototype.getRadialPos=function(t,n,i,a,o){o===void 0&&(o=[0,1]);var s=(t-n[0])/i;s=s*(o[1]-o[0])+o[0];var u=s*2*Math.PI;return{x:Math.cos(u)*a,y:Math.sin(u)*a}},e.prototype.getType=function(){return"dagre"},e}(OZ.Base);fu.DagreLayout=DZ;var PZ=function(r,e,t,n,i,a,o){var s=(r==null?void 0:r.slice(1,r.length-1))||[];if(e&&t){var u=e.x,f=e.y,l=t.x,c=t.y;if(i&&(u=e.y,f=e.x,l=t.y,c=t.x),c!==f&&u!==l){var h=n.indexOf(f),d=n[h+1];if(d){var v=s[0],p=i?{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||a(v,p))&&s.unshift(p)}var g=n.indexOf(c),y=Math.abs(g-h);if(y===1)s=o(s,e,t),s.length||s.push(i?{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],x=i?{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||a(b,x))&&s.push(x)}}}}return s},ll={};const Td={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 Hy(r={},e=Td){var t,n,i,a;const o=JSON.parse(JSON.stringify(e)),s=((t=r==null?void 0:r.graph)===null||t===void 0?void 0:t.meta)||{},u=((n=r==null?void 0:r.subScene)===null||n===void 0?void 0:n.meta)||{},f=((i=r==null?void 0:r.nodeSize)===null||i===void 0?void 0:i.meta)||{},l=((a=r==null?void 0:r.nodeSize)===null||a===void 0?void 0:a.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 jA(r){return`◬${r}◬`}const yu=jA("ROOT"),UA=jA("BRIDGE_GRAPH");var Fn,os,mu,qy;(function(r){r[r.META=0]="META",r[r.NODE=1]="NODE",r[r.BRIDGE=2]="BRIDGE"})(Fn||(Fn={})),function(r){r[r.INCLUDE=0]="INCLUDE",r[r.EXCLUDE=1]="EXCLUDE",r[r.UNSPECIFIED=2]="UNSPECIFIED"}(os||(os={})),function(r){r[r.META=0]="META",r[r.CORE=1]="CORE",r[r.BRIDGE=2]="BRIDGE"}(mu||(mu={})),function(r){r[r.META=0]="META",r[r.OP=1]="OP",r[r.SERIES=2]="SERIES"}(qy||(qy={}));var Id=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zy(r,e){return r(e={exports:{}},e.exports),e.exports}var RZ=function(){this.__data__=[],this.size=0},bu=function(r,e){return r===e||r!=r&&e!=e},kd=function(r,e){for(var t=r.length;t--;)if(bu(r[t][0],e))return t;return-1},BZ=Array.prototype.splice,FZ=function(r){var e=this.__data__,t=kd(e,r);return!(t<0)&&(t==e.length-1?e.pop():BZ.call(e,t,1),--this.size,!0)},GZ=function(r){var e=this.__data__,t=kd(e,r);return t<0?void 0:e[t][1]},zZ=function(r){return kd(this.__data__,r)>-1},$Z=function(r,e){var t=this.__data__,n=kd(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this};function xu(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e-1&&r%1==0&&r-1&&r%1==0&&r<=9007199254740991},Sr={};Sr["[object Float32Array]"]=Sr["[object Float64Array]"]=Sr["[object Int8Array]"]=Sr["[object Int16Array]"]=Sr["[object Int32Array]"]=Sr["[object Uint8Array]"]=Sr["[object Uint8ClampedArray]"]=Sr["[object Uint16Array]"]=Sr["[object Uint32Array]"]=!0,Sr["[object Arguments]"]=Sr["[object Array]"]=Sr["[object ArrayBuffer]"]=Sr["[object Boolean]"]=Sr["[object DataView]"]=Sr["[object Date]"]=Sr["[object Error]"]=Sr["[object Function]"]=Sr["[object Map]"]=Sr["[object Number]"]=Sr["[object Object]"]=Sr["[object RegExp]"]=Sr["[object Set]"]=Sr["[object String]"]=Sr["[object WeakMap]"]=!1;var TK=function(r){return ki(r)&&Jy(r.length)&&!!Sr[xo(r)]},Fd=function(r){return function(e){return r(e)}},Cu=Zy(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t&&XA.process,a=function(){try{var o=n&&n.require&&n.require("util").types;return o||i&&i.binding&&i.binding("util")}catch{}}();r.exports=a}),QA=Cu&&Cu.isTypedArray,gl=QA?Fd(QA):TK,IK=Object.prototype.hasOwnProperty,JA=function(r,e){var t=Rr(r),n=!t&&Mu(r),i=!t&&!n&&fs(r),a=!t&&!n&&!i&&gl(r),o=t||n||i||a,s=o?_K(r.length,String):[],u=s.length;for(var f in r)!e&&!IK.call(r,f)||o&&(f=="length"||i&&(f=="offset"||f=="parent")||a&&(f=="buffer"||f=="byteLength"||f=="byteOffset")||Bd(f,u))||s.push(f);return s},kK=Object.prototype,Gd=function(r){var e=r&&r.constructor;return r===(typeof e=="function"&&e.prototype||kK)},eT=function(r,e){return function(t){return r(e(t))}},LK=eT(Object.keys,Object),NK=Object.prototype.hasOwnProperty,em=function(r){if(!Gd(r))return LK(r);var e=[];for(var t in Object(r))NK.call(r,t)&&t!="constructor"&&e.push(t);return e},Da=function(r){return r!=null&&Jy(r.length)&&!hl(r)},wo=function(r){return Da(r)?JA(r):em(r)},OK=function(r,e){return r&&pl(e,wo(e),r)},DK=function(r){var e=[];if(r!=null)for(var t in Object(r))e.push(t);return e},PK=Object.prototype.hasOwnProperty,RK=function(r){if(!Gn(r))return DK(r);var e=Gd(r),t=[];for(var n in r)(n!="constructor"||!e&&PK.call(r,n))&&t.push(n);return t},ls=function(r){return Da(r)?JA(r,!0):RK(r)},BK=function(r,e){return r&&pl(e,ls(e),r)},tT=Zy(function(r,e){var t=e&&!e.nodeType&&e,n=t&&r&&!r.nodeType&&r,i=n&&n.exports===t?Ii.Buffer:void 0,a=i?i.allocUnsafe:void 0;r.exports=function(o,s){if(s)return o.slice();var u=o.length,f=a?a(u):new o.constructor(u);return o.copy(f),f}}),rT=function(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++ts))return!1;var f=a.get(r),l=a.get(e);if(f&&l)return f==e&&l==r;var c=-1,h=!0,d=2&t?new xT:void 0;for(a.set(r,e),a.set(e,r);++c0){if(++e>=800)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}(HQ),Wd=function(r,e){return HT(VT(r,e,ds),r+"")},qT=function(r,e,t,n){for(var i=r.length,a=t+-1;++a-1},eJ=function(){},tJ=Au&&1/cm(new Au([,-0]))[1]==1/0?function(r){return new Au(r)}:eJ,rJ=function(r,e,t){var n=-1,i=JQ,a=r.length,o=!0,s=[],u=s;if(a>=200){var f=tJ(r);if(f)return cm(f);o=!1,i=wT,u=new xT}else u=s;e:for(;++na){var o=i;i=a,a=o}return i+""+a+""+(ut.isUndefined(n)?"\0":n)}function aJ(r,e,t,n){var i=""+e,a=""+t;if(!r&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return n&&(s.name=n),s}function bm(r,e){return ml(r,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(r){return this._label=r,this},tr.prototype.graph=function(){return this._label},tr.prototype.setDefaultNodeLabel=function(r){return ut.isFunction(r)||(r=ut.constant(r)),this._defaultNodeLabelFn=r,this},tr.prototype.nodeCount=function(){return this._nodeCount},tr.prototype.nodes=function(){return ut.keys(this._nodes)},tr.prototype.sources=function(){var r=this;return ut.filter(this.nodes(),function(e){return ut.isEmpty(r._in[e])})},tr.prototype.sinks=function(){var r=this;return ut.filter(this.nodes(),function(e){return ut.isEmpty(r._out[e])})},tr.prototype.setNodes=function(r,e){var t=arguments,n=this;return ut.each(r,function(i){t.length>1?n.setNode(i,e):n.setNode(i)}),this},tr.prototype.setNode=function(r,e){return ut.has(this._nodes,r)?(arguments.length>1&&(this._nodes[r]=e),this):(this._nodes[r]=arguments.length>1?e:this._defaultNodeLabelFn(r),this._isCompound&&(this._parent[r]="\0",this._children[r]={},this._children["\0"][r]=!0),this._in[r]={},this._preds[r]={},this._out[r]={},this._sucs[r]={},++this._nodeCount,this)},tr.prototype.node=function(r){return this._nodes[r]},tr.prototype.hasNode=function(r){return ut.has(this._nodes,r)},tr.prototype.removeNode=function(r){var e=this;if(ut.has(this._nodes,r)){var t=function(n){e.removeEdge(e._edgeObjs[n])};delete this._nodes[r],this._isCompound&&(this._removeFromParentsChildList(r),delete this._parent[r],ut.each(this.children(r),function(n){e.setParent(n)}),delete this._children[r]),ut.each(ut.keys(this._in[r]),t),delete this._in[r],delete this._preds[r],ut.each(ut.keys(this._out[r]),t),delete this._out[r],delete this._sucs[r],--this._nodeCount}return this},tr.prototype.setParent=function(r,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(ut.isUndefined(e))e="\0";else{for(var t=e+="";!ut.isUndefined(t);t=this.parent(t))if(t===r)throw new Error("Setting "+e+" as parent of "+r+" would create a cycle");this.setNode(e)}return this.setNode(r),this._removeFromParentsChildList(r),this._parent[r]=e,this._children[e][r]=!0,this},tr.prototype._removeFromParentsChildList=function(r){delete this._children[this._parent[r]][r]},tr.prototype.parent=function(r){if(this._isCompound){var e=this._parent[r];if(e!=="\0")return e}},tr.prototype.children=function(r){if(ut.isUndefined(r)&&(r="\0"),this._isCompound){var e=this._children[r];if(e)return ut.keys(e)}else{if(r==="\0")return this.nodes();if(this.hasNode(r))return[]}},tr.prototype.predecessors=function(r){var e=this._preds[r];if(e)return ut.keys(e)},tr.prototype.successors=function(r){var e=this._sucs[r];if(e)return ut.keys(e)},tr.prototype.neighbors=function(r){var e=this.predecessors(r);if(e)return ut.union(e,this.successors(r))},tr.prototype.isLeaf=function(r){return(this.isDirected()?this.successors(r):this.neighbors(r)).length===0},tr.prototype.filterNodes=function(r){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var t=this;ut.each(this._nodes,function(a,o){r(o)&&e.setNode(o,a)}),ut.each(this._edgeObjs,function(a){e.hasNode(a.v)&&e.hasNode(a.w)&&e.setEdge(a,t.edge(a))});var n={};function i(a){var o=t.parent(a);return o===void 0||e.hasNode(o)?(n[a]=o,o):o in n?n[o]:i(o)}return this._isCompound&&ut.each(e.nodes(),function(a){e.setParent(a,i(a))}),e},tr.prototype.setDefaultEdgeLabel=function(r){return ut.isFunction(r)||(r=ut.constant(r)),this._defaultEdgeLabelFn=r,this},tr.prototype.edgeCount=function(){return this._edgeCount},tr.prototype.edges=function(){return ut.values(this._edgeObjs)},tr.prototype.setPath=function(r,e){var t=this,n=arguments;return ut.reduce(r,function(i,a){return n.length>1?t.setEdge(i,a,e):t.setEdge(i,a),a}),this},tr.prototype.setEdge=function(){var r,e,t,n,i=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(r=a.v,e=a.w,t=a.name,arguments.length===2&&(n=arguments[1],i=!0)):(r=a,e=arguments[1],t=arguments[3],arguments.length>2&&(n=arguments[2],i=!0)),r=""+r,e=""+e,ut.isUndefined(t)||(t=""+t);var o=ml(this._isDirected,r,e,t);if(ut.has(this._edgeLabels,o))return i&&(this._edgeLabels[o]=n),this;if(!ut.isUndefined(t)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(e),this._edgeLabels[o]=i?n:this._defaultEdgeLabelFn(r,e,t);var s=aJ(this._isDirected,r,e,t);return r=s.v,e=s.w,Object.freeze(s),this._edgeObjs[o]=s,QT(this._preds[e],r),QT(this._sucs[r],e),this._in[e][o]=s,this._out[r][o]=s,this._edgeCount++,this},tr.prototype.edge=function(r,e,t){var n=arguments.length===1?bm(this._isDirected,arguments[0]):ml(this._isDirected,r,e,t);return this._edgeLabels[n]},tr.prototype.hasEdge=function(r,e,t){var n=arguments.length===1?bm(this._isDirected,arguments[0]):ml(this._isDirected,r,e,t);return ut.has(this._edgeLabels,n)},tr.prototype.removeEdge=function(r,e,t){var n=arguments.length===1?bm(this._isDirected,arguments[0]):ml(this._isDirected,r,e,t),i=this._edgeObjs[n];return i&&(r=i.v,e=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],JT(this._preds[e],r),JT(this._sucs[r],e),delete this._in[e][n],delete this._out[r][n],this._edgeCount--),this},tr.prototype.inEdges=function(r,e){var t=this._in[r];if(t){var n=ut.values(t);return e?ut.filter(n,function(i){return i.v===e}):n}},tr.prototype.outEdges=function(r,e){var t=this._out[r];if(t){var n=ut.values(t);return e?ut.filter(n,function(i){return i.w===e}):n}},tr.prototype.nodeEdges=function(r,e){var t=this.inEdges(r,e);if(t)return t.concat(this.outEdges(r,e))};var eI={Graph:mm,version:"2.1.8"},oJ={write:function(r){var e={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:sJ(r),edges:uJ(r)};return ut.isUndefined(r.graph())||(e.value=ut.clone(r.graph())),e},read:function(r){var e=new mm(r.options).setGraph(r.value);return ut.each(r.nodes,function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),ut.each(r.edges,function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}};function sJ(r){return ut.map(r.nodes(),function(e){var t=r.node(e),n=r.parent(e),i={v:e};return ut.isUndefined(t)||(i.value=t),ut.isUndefined(n)||(i.parent=n),i})}function uJ(r){return ut.map(r.edges(),function(e){var t=r.edge(e),n={v:e.v,w:e.w};return ut.isUndefined(e.name)||(n.name=e.name),ut.isUndefined(t)||(n.value=t),n})}var fJ=function(r){var e,t={},n=[];function i(a){ut.has(t,a)||(t[a]=!0,e.push(a),ut.each(r.successors(a),i),ut.each(r.predecessors(a),i))}return ut.each(r.nodes(),function(a){e=[],i(a),e.length&&n.push(e)}),n},tI=fi;function fi(){this._arr=[],this._keyIndices={}}fi.prototype.size=function(){return this._arr.length},fi.prototype.keys=function(){return this._arr.map(function(r){return r.key})},fi.prototype.has=function(r){return ut.has(this._keyIndices,r)},fi.prototype.priority=function(r){var e=this._keyIndices[r];if(e!==void 0)return this._arr[e].priority},fi.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},fi.prototype.add=function(r,e){var t=this._keyIndices;if(r=String(r),!ut.has(t,r)){var n=this._arr,i=n.length;return t[r]=i,n.push({key:r,priority:e}),this._decrease(i),!0}return!1},fi.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},fi.prototype.decrease=function(r,e){var t=this._keyIndices[r];if(e>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[t].priority+" New: "+e);this._arr[t].priority=e,this._decrease(t)},fi.prototype._heapify=function(r){var e=this._arr,t=2*r,n=t+1,i=r;t>1].priority0&&(u=c.removeMin(),(f=l[u]).distance!==Number.POSITIVE_INFINITY);)s(u).forEach(h);return l}(r,String(e),t||lJ,n||function(i){return r.outEdges(i)})},lJ=ut.constant(1),cJ=function(r,e,t){return ut.transform(r.nodes(),function(n,i){n[i]=rI(r,i,e,t)},{})},nI=function(r){var e=0,t=[],n={},i=[];function a(o){var s=n[o]={onStack:!0,lowlink:e,index:e++};if(t.push(o),r.successors(o).forEach(function(l){ut.has(n,l)?n[l].onStack&&(s.lowlink=Math.min(s.lowlink,n[l].index)):(a(l),s.lowlink=Math.min(s.lowlink,n[l].lowlink))}),s.lowlink===s.index){var u,f=[];do u=t.pop(),n[u].onStack=!1,f.push(u);while(o!==u);i.push(f)}}return r.nodes().forEach(function(o){ut.has(n,o)||a(o)}),i},hJ=function(r){return ut.filter(nI(r),function(e){return e.length>1||e.length===1&&r.hasEdge(e[0],e[0])})},dJ=function(r,e,t){return function(n,i,a){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})}),a(u).forEach(function(f){var l=f.v===u?f.w:f.v,c=i(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(t=a.removeMin(),ut.has(i,t))n.setEdge(t,i[t]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(t).forEach(o)}return n},tarjan:nI,topsort:xm},version:eI.version};try{qd=pJ}catch{}qd||(qd=window.graphlib);var Li=qd,gJ=function(r){return gT(r,5)},bl=function(r,e,t){if(!Gn(t))return!1;var n=typeof e;return!!(n=="number"?Da(t)&&Bd(e,t.length):n=="string"&&e in t)&&bu(t[e],r)},sI=Object.prototype,yJ=sI.hasOwnProperty,mJ=Wd(function(r,e){r=Object(r);var t=-1,n=e.length,i=n>2?e[2]:void 0;for(i&&bl(e[0],e[1],i)&&(n=1);++t-1?i[a?e[o]:o]:void 0}},xJ=/^\s+|\s+$/g,wJ=/^[-+]0x[0-9a-f]+$/i,EJ=/^0b[01]+$/i,_J=/^0o[0-7]+$/i,SJ=parseInt,MJ=function(r){if(typeof r=="number")return r;if(vs(r))return NaN;if(Gn(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=Gn(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=r.replace(xJ,"");var t=EJ.test(r);return t||_J.test(r)?SJ(r.slice(2),t?2:8):wJ.test(r)?NaN:+r},Zd=function(r){return r?(r=MJ(r))===1/0||r===-1/0?17976931348623157e292*(r<0?-1:1):r==r?r:0:r===0?r:0},CJ=function(r){var e=Zd(r),t=e%1;return e==e?t?e-t:e:0},AJ=Math.max,TJ=bJ(function(r,e,t){var n=r==null?0:r.length;if(!n)return-1;var i=t==null?0:CJ(t);return i<0&&(i=AJ(n+i,0)),qT(r,Pa(e),i)}),uI=function(r){return r!=null&&r.length?ym(r):[]},IJ=function(r,e){return r==null?r:fm(r,yT(e),ls)},kJ=function(r){var e=r==null?0:r.length;return e?r[e-1]:void 0},LJ=function(r,e){var t={};return e=Pa(e),lm(r,function(n,i,a){Pd(t,i,e(n,i,a))}),t},wm=function(r,e,t){for(var n=-1,i=r.length;++ne},OJ=function(r){return r&&r.length?wm(r,ds,NJ):void 0},Em=function(r,e,t){(t!==void 0&&!bu(r[e],t)||t===void 0&&!(e in r))&&Pd(r,e,t)},DJ=Function.prototype,PJ=Object.prototype,fI=DJ.toString,RJ=PJ.hasOwnProperty,BJ=fI.call(Object),FJ=function(r){if(!ki(r)||xo(r)!="[object Object]")return!1;var e=zd(r);if(e===null)return!0;var t=RJ.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&fI.call(t)==BJ},lI=function(r,e){if((e!=="constructor"||typeof r[e]!="function")&&e!="__proto__")return r[e]},GJ=function(r){return pl(r,ls(r))},zJ=function(r,e,t,n,i,a,o){var s=lI(r,t),u=lI(e,t),f=o.get(u);if(f)Em(r,t,f);else{var l=void 0,c=l===void 0;if(c){var h=Rr(u),d=!h&&fs(u),v=!h&&!d&&gl(u);l=u,h||d||v?Rr(s)?l=s:ZT(s)?l=rT(s):d?(c=!1,l=tT(u,!0)):v?(c=!1,l=lT(u,!0)):l=[]:FJ(u)||Mu(u)?(l=s,Mu(s)?l=GJ(s):Gn(s)&&!hl(s)||(l=dT(u))):c=!1}c&&(o.set(u,l),i(l,u,n,a,o),o.delete(u)),Em(r,t,l)}},$J=function r(e,t,n,i,a){e!==t&&fm(t,function(o,s){if(a||(a=new Su),Gn(o))zJ(e,t,s,n,r,i,a);else{var u=void 0;u===void 0&&(u=o),Em(e,s,u)}},ls)},jJ=function(r){return Wd(function(e,t){var n=-1,i=t.length,a=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(a=r.length>3&&typeof a=="function"?(i--,a):void 0,o&&bl(t[0],t[1],o)&&(a=i<3?void 0:a,i=1),e=Object(e);++ne||a&&o&&u&&!s&&!f||n&&o&&u||!t&&u||!i)return 1;if(!n&&!a&&!f&&r=s?u:u*(t[n]=="desc"?-1:1)}return r.index-e.index},nee=function(r,e,t){e=e.length?Tu(e,function(a){return Rr(a)?function(o){return Yd(o,a.length===1?a[0]:a)}:a}):[ds];var n=-1;e=Tu(e,Fd(Pa));var i=BT(r,function(a,o,s){return{criteria:Tu(e,function(u){return u(a)}),index:++n,value:a}});return eee(i,function(a,o){return ree(a,o,t)})},iee=Wd(function(r,e){if(r==null)return[];var t=e.length;return t>1&&bl(r,e[0],e[1])?e=[]:t>2&&bl(e[0],e[1],e[2])&&(e=[e[0]]),nee(r,ym(e),[])}),aee=0,oee=function(r){var e=++aee;return kT(r)+e},see=function(r,e,t){for(var n=-1,i=r.length,a=e.length,o={};++n0;--c)if(s=a[c].dequeue()){u=u.concat(_m(i,a,o,s,!0));break}}}return u}(t.graph,t.buckets,t.zeroIdx);return K.flatten(K.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)},dee=K.constant(1);function _m(r,e,t,n,i){var a=i?[]:void 0;return K.forEach(r.inEdges(n.v),function(o){var s=r.edge(o),u=r.node(o.v);i&&a.push({v:o.v,w:o.w}),u.out-=s,Sm(e,t,u)}),K.forEach(r.outEdges(n.v),function(o){var s=r.edge(o),u=o.w,f=r.node(u);f.in-=s,Sm(e,t,f)}),r.removeNode(n.v),a}function Sm(r,e,t){t.out?t.in?r[t.out-t.in+e].enqueue(t):r[r.length-1].enqueue(t):r[0].enqueue(t)}var dI={run:function(r){var e=r.graph().acyclicer==="greedy"?hee(r,function(t){return function(n){return t.edge(n).weight}}(r)):function(t){var n=[],i={},a={};function o(s){K.has(a,s)||(a[s]=!0,i[s]=!0,K.forEach(t.outEdges(s),function(u){K.has(i,u.w)?n.push(u):o(u.w)}),delete i[s])}return K.forEach(t.nodes(),o),n}(r);K.forEach(e,function(t){var n=r.edge(t);r.removeEdge(t),n.forwardName=t.name,n.reversed=!0,r.setEdge(t.w,t.v,n,K.uniqueId("rev"))})},undo:function(r){K.forEach(r.edges(),function(e){var t=r.edge(e);if(t.reversed){r.removeEdge(e);var n=t.forwardName;delete t.reversed,delete t.forwardName,r.setEdge(e.w,e.v,t,n)}})}},vI=Li.Graph,vn={addDummyNode:pI,simplify:function(r){var e=new vI().setGraph(r.graph());return K.forEach(r.nodes(),function(t){e.setNode(t,r.node(t))}),K.forEach(r.edges(),function(t){var n=e.edge(t.v,t.w)||{weight:0,minlen:1},i=r.edge(t);e.setEdge(t.v,t.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),e},asNonCompoundGraph:function(r){var e=new vI({multigraph:r.isMultigraph()}).setGraph(r.graph());return K.forEach(r.nodes(),function(t){r.children(t).length||e.setNode(t,r.node(t))}),K.forEach(r.edges(),function(t){e.setEdge(t,r.edge(t))}),e},successorWeights:function(r){var e=K.map(r.nodes(),function(t){var n={};return K.forEach(r.outEdges(t),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return K.zipObject(r.nodes(),e)},predecessorWeights:function(r){var e=K.map(r.nodes(),function(t){var n={};return K.forEach(r.inEdges(t),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return K.zipObject(r.nodes(),e)},intersectRect:function(r,e){var t,n,i=r.x,a=r.y,o=e.x-i,s=e.y-a,u=r.width/2,f=r.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),t=f*o/s,n=f):(o<0&&(u=-u),t=u,n=u*s/o),{x:i+t,y:a+n}},buildLayerMatrix:function(r){var e=K.map(K.range(gI(r)+1),function(){return[]});return K.forEach(r.nodes(),function(t){var n=r.node(t),i=n.rank;K.isUndefined(i)||(e[i][n.order]=t)}),e},normalizeRanks:function(r){var e=K.min(K.map(r.nodes(),function(t){return r.node(t).rank}));K.forEach(r.nodes(),function(t){var n=r.node(t);K.has(n,"rank")&&(n.rank-=e)})},removeEmptyRanks:function(r){var e=K.min(K.map(r.nodes(),function(a){return r.node(a).rank})),t=[];K.forEach(r.nodes(),function(a){var o=r.node(a).rank-e;t[o]||(t[o]=[]),t[o].push(a)});var n=0,i=r.graph().nodeRankFactor;K.forEach(t,function(a,o){K.isUndefined(a)&&o%i!=0?--n:n&&K.forEach(a,function(s){r.node(s).rank+=n})})},addBorderNode:function(r,e,t,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=t,i.order=n),pI(r,"border",i,e)},maxRank:gI,partition:function(r,e){var t={lhs:[],rhs:[]};return K.forEach(r,function(n){e(n)?t.lhs.push(n):t.rhs.push(n)}),t},time:function(r,e){var t=K.now();try{return e()}finally{console.log(r+" time: "+(K.now()-t)+"ms")}},notime:function(r,e){return e()}};function pI(r,e,t,n){var i;do i=K.uniqueId(n);while(r.hasNode(i));return t.dummy=e,r.setNode(i,t),i}function gI(r){return K.max(K.map(r.nodes(),function(e){var t=r.node(e).rank;if(!K.isUndefined(t))return t}))}var yI={run:function(r){r.graph().dummyChains=[],K.forEach(r.edges(),function(e){(function(t,n){var i,a,o,s=n.v,u=t.node(s).rank,f=n.w,l=t.node(f).rank,c=n.name,h=t.edge(n),d=h.labelRank;if(l!==u+1){for(t.removeEdge(n),o=0,++u;uo.lim&&(s=o,u=!0);var f=K.filter(e.edges(),function(l){return u===CI(r,r.node(l.v),s)&&u!==CI(r,r.node(l.w),s)});return K.minBy(f,function(l){return mee(e,l)})}function MI(r,e,t,n){var i=t.v,a=t.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),Cm(r),Mm(r,e),function(o,s){var u=K.find(o.nodes(),function(l){return!s.node(l).parent}),f=xee(o,u);f=f.slice(1),K.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)})}(r,e)}function CI(r,e,t){return t.low<=e.lim&&e.lim<=t.lim}ps.initLowLimValues=Cm,ps.initCutValues=Mm,ps.calcCutValue=wI,ps.leaveEdge=_I,ps.enterEdge=SI,ps.exchangeEdges=MI;var AI=mI,See=function(r){switch(r.graph().ranker){case"network-simplex":TI(r);break;case"tight-tree":(function(e){AI(e),xI(e)})(r);break;case"longest-path":Mee(r);break;default:TI(r)}},Mee=AI;function TI(r){_ee(r)}var Cee=function(r){var e=function(t){var n={},i=0;function a(o){var s=i;K.forEach(t.children(o),a),n[o]={low:s,lim:i++}}return K.forEach(t.children(),a),n}(r);K.forEach(r.graph().dummyChains,function(t){for(var n=r.node(t),i=n.edgeObj,a=function(c,h,d,v){var p,g,y=[],m=[],b=Math.min(h[d].low,h[v].low),x=Math.max(h[d].lim,h[v].lim);p=d;do p=c.parent(p),y.push(p);while(p&&(h[p].low>b||x>h[p].lim));for(g=p,p=v;(p=c.parent(p))!==g;)m.push(p);return{path:y.concat(m.reverse()),lca:g}}(r,e,i.v,i.w),o=a.path,s=a.lca,u=0,f=o[u],l=!0;t!==i.w;){if(n=r.node(t),l){for(;(f=o[u])!==s&&r.node(f).maxRank0;)l%2&&(c+=s[l+1]),s[l=l-1>>1]+=f.weight;u+=f.weight*c})),u}var Lee=function(r,e){return K.map(e,function(t){var n=r.inEdges(t);if(n.length){var i=K.reduce(n,function(a,o){var s=r.edge(o),u=r.node(o.v);return{sum:a.sum+s.weight*u.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:t,barycenter:i.sum/i.weight,weight:i.weight}}return{v:t}})},Nee=function(r,e){var t={};return K.forEach(r,function(n,i){var a=t[n.v]={indegree:0,in:[],out:[],vs:[n.v],i};K.isUndefined(n.barycenter)||(a.barycenter=n.barycenter,a.weight=n.weight)}),K.forEach(e.edges(),function(n){var i=t[n.v],a=t[n.w];K.isUndefined(i)||K.isUndefined(a)||(a.indegree++,i.out.push(t[n.w]))}),function(n){var i=[];function a(u){return function(f){f.merged||(K.isUndefined(f.barycenter)||K.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();i.push(s),K.forEach(s.in.reverse(),a(s)),K.forEach(s.out,o(s))}return K.map(K.filter(i,function(u){return!u.merged}),function(u){return K.pick(u,["vs","i","barycenter","weight"])})}(K.filter(t,function(n){return!n.indegree}))},Oee=function(r,e){var t=vn.partition(r,function(c){return K.has(c,"barycenter")}),n=t.lhs,i=K.sortBy(t.rhs,function(c){return-c.i}),a=[],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=PI(a,i,u),K.forEach(n,function(c){u+=c.vs.length,a.push(c.vs),o+=c.barycenter*c.weight,s+=c.weight,u=PI(a,i,u)});var f,l={vs:K.flatten(a,!0)};return s&&(l.barycenter=o/s,l.weight=s),l};function PI(r,e,t){for(var n;e.length&&(n=K.last(e)).i<=t;)e.pop(),r.push(n.vs),t++;return t}var Dee=function r(e,t,n,i){var a=e.children(t),o=e.node(t),s=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,f={};s&&(a=K.filter(a,function(p){return p!==s&&p!==u}));var l=Lee(e,a);K.forEach(l,function(p){if(e.children(p.v).length){var g=r(e,p.v,n,i);f[p.v]=g,K.has(g,"barycenter")&&(y=p,m=g,K.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=Nee(l,n);(function(p,g){K.forEach(p,function(y){y.vs=K.flatten(y.vs.map(function(m){return g[m]?g[m].vs:m}),!0)})})(c,f);var h=Oee(c,i);if(s&&(h.vs=K.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]);K.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},Pee=Li.Graph,Ree=function(r,e,t){var n=function(a){for(var o;a.hasNode(o=K.uniqueId("_root")););return o}(r),i=new Pee({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return K.forEach(r.nodes(),function(a){var o=r.node(a),s=r.parent(a);(o.rank===e||o.minRank<=e&&e<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||n),K.forEach(r[t](a),function(u){var f=u.v===a?u.w:u.v,l=i.edge(f,a),c=K.isUndefined(l)?0:l.weight;i.setEdge(f,a,{weight:r.edge(u).weight+c})}),K.has(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))}),i},Bee=function(r,e,t){var n,i={};K.forEach(t,function(a){for(var o,s,u=r.parent(a);u;){if((o=r.parent(u))?(s=i[o],i[o]=u):(s=n,n=u),s&&s!==u)return void e.setEdge(s,u);u=o}})},Fee=Li.Graph,Gee=function(r){var e=vn.maxRank(r),t=RI(r,K.range(1,e+1),"inEdges"),n=RI(r,K.range(e-1,-1,-1),"outEdges"),i=Tee(r);BI(r,i);for(var a,o=Number.POSITIVE_INFINITY,s=0,u=0;u<4;++s,++u){zee(s%2?t:n,s%4>=2),i=vn.buildLayerMatrix(r);var f=Iee(r,i);fu)&&FI(t,c,f)})})}return K.reduce(e,function(i,a){var o,s=-1,u=0;return K.forEach(a,function(f,l){if(r.node(f).dummy==="border"){var c=r.predecessors(f);c.length&&(o=r.node(c[0]).order,n(a,u,l,s,o),u=l,s=o)}n(a,u,a.length,o,i.length)}),a}),t}function FI(r,e,t){if(e>t){var n=e;e=t,t=n}var i=r[e];i||(r[e]=i={}),i[t]=!0}function Yee(r,e,t){if(e>t){var n=e;e=t,t=n}return K.has(r[e],t)}function Wee(r,e,t,n){var i={},a={},o={};return K.forEach(e,function(s){K.forEach(s,function(u,f){i[u]=u,a[u]=u,o[u]=f})}),K.forEach(e,function(s){var u=-1;K.forEach(s,function(f){var l=n(f);if(l.length)for(var c=((l=K.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];a[f]===f&&unew vte(t)).forEach(t=>{e.nodes[t.name]=t,t.inputs.forEach(n=>{(function(i,a,o){o.name!==a.name&&i.edges.push(Object.assign(Object.assign({},o.attr),{v:o.name,w:a.name}))})(e,t,n)})}),e}class yte{constructor(e,t={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=os.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=Fn.META,this.path=[],this.name=e,this.metaGraph=Lm(e,mu.META,t)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map(e=>this.metaGraph.node(e))}leaves(){let e,t=[],n=[this];for(;n.length;){let i=n.shift();i.isGroupNode?(e=i.metaGraph,e.nodes().forEach(a=>n.push(e.node(a)))):t.push(i.name)}return t}}class mte{constructor(e,t){this.v=e,this.w=t,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(e,t){this.baseEdgeList.push(e)}}function zI(r,e={}){return new yte(r,e)}function $I(r,e){return new mte(r,e)}function Lm(r,e,t){const n=t||{},i=new hte.Graph(n);return i.setGraph({name:r,rankdir:n.rankdir,type:e,align:n.align}),i}class bte{constructor(e={}){this.graphOptions=e,this.index={},this.graphOptions.compound=!0,this.root=zI(yu,this.graphOptions),this.index[yu]=this.root}getNodeMap(){return this.index}node(e){return this.index[e]}setNode(e,t){this.index[e]=t}getBridgeGraph(e){const t=this.index[e];if(!t)throw Error("Could not find node in hierarchy: "+e);if(!("metaGraph"in t))return null;const n=t;if(n.bridgeGraph)return n.bridgeGraph;const i=Lm(UA,mu.BRIDGE,this.graphOptions);if(n.bridgeGraph=i,!t.parentNode||!("metaGraph"in t.parentNode))return i;const a=t.parentNode;return[a.metaGraph,this.getBridgeGraph(a.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=i.edge(d);v||(v=$I(d.v,d.w),v.inbound=u,i.setEdge(d.v,d.w,v)),v.addBaseEdge(f,this)})})}),i}getChildName(e,t){let n=this.index[t];for(;n;){if(n.parentNode&&n.parentNode.name===e)return n.name;n=n.parentNode}throw Error("Could not find immediate child for descendant: "+t)}getPredecessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!0)}getSuccessors(e){const t=this.index[e];if(!t)throw Error("Could not find node with name: "+e);return this.getOneWayEdges(t,!1)}getOneWayEdges(e,t){const n=[];if(!e.parentNode||!e.parentNode.isGroupNode)return n;const i=e.parentNode,a=i.metaGraph,o=this.getBridgeGraph(i.name);return jI(a,e,t,n),jI(o,e,t,n),n}}function xte(r,e){const{rankDirection:t,align:n}=e,i=new bte({rankdir:t,align:n});return function(a,o){Object.keys(o.nodes).forEach(s=>{const u=o.nodes[s],f=u.path;let l=a.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=$I(p,g),v.metaGraph.setEdge(p,g,y)),y.addBaseEdge(c,a)})}(i,r),i}function jI(r,e,t,n){(t?r.inEdges(e.name):r.outEdges(e.name)).forEach(i=>{const a=r.edge(i);n.push(a)})}class wte{constructor(e){this.hierarchy=e,this.index={},this.hasSubHierarchy={},this.root=new XI(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 t=this.index[e];if(t.node.type!==Fn.META)return;const n=t,i=n.node.metaGraph,a=n.coreGraph;i.nodes().forEach(l=>{const c=this.getOrCreateRenderNodeByName(l);a.setNode(l,c)}),i.edges().forEach(l=>{const c=i.edge(l),h=new UI(c);a.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=!!i.node(l.w),[d,v]=h?[l.w,l.v]:[l.v,l.w],p=w=>{const E=h?{v:w,w:e}:{v:e,w};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=a.node(m);if(!b){let w=a.node(y);if(!w){const _={name:y,type:Fn.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:os.UNSPECIFIED,inbound:h,attr:{}};w=new ev(_),this.index[y]=w,a.setNode(y,w)}const E={name:m,type:Fn.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:os.UNSPECIFIED,inbound:h,attr:{}};b=new ev(E),this.index[m]=b,a.setNode(m,b),a.setParent(m,y),w.node.cardinality++}const x=new UI(c);x.adjoiningMetaEdge=g,h?a.setEdge(m,d,x):a.setEdge(d,m,x)})}getOrCreateRenderNodeByName(e){if(!e)return null;if(e in this.index)return this.index[e];const t=this.getNodeByName(e);return t?(this.index[e]=t.isGroupNode?new XI(t,this.hierarchy.graphOptions):new ev(t),this.index[e]):null}getRenderNodeByName(e){return this.index[e]}getNodeByName(e){return this.hierarchy.node(e)}}class ev{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 UI{constructor(e){this.metaEdge=e,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class XI extends ev{constructor(e,t){super(e);const n=e.metaGraph.graph();t.compound=!0,this.coreGraph=Lm(n.name,mu.CORE,t)}}function YI(r,e){r.node.isGroupNode&&function(t,n){const i=Hy(n);t.coreGraph.nodes().map(a=>t.coreGraph.node(a)).forEach(a=>{var o,s,u,f,l,c;const{height:h,width:d}=a;switch(a.node.type){case Fn.NODE:Object.assign(a,i.nodeSize.node),a.height=h||i.nodeSize.node.height,a.width=d||i.nodeSize.node.width;break;case Fn.BRIDGE:Object.assign(a,i.nodeSize.bridge);break;case Fn.META:a.expanded?YI(a,n):(Object.assign(a,i.nodeSize.meta),a.height=i.nodeSize.meta.height,a.width=i.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+a.node.type)}if(!a.expanded){const v=a.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)}})(a,n&&(a.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)||a.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)||a.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)))}})}(r,e),r.node.type===Fn.META&&function(t,n){const i=Hy(n),a=i.subScene.meta;Object.assign(t,a);const{nodeSep:o,rankSep:s,edgeSep:u,align:f}=i.graph.meta,l={nodesep:o,ranksep:s,edgesep:u,align:f};Object.assign(t.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(M=>{d.node(M).node.type!==Fn.BRIDGE&&b.push(M)}),!b.length)return{width:0,height:0};dte(d);let x=1/0,w=1/0,E=-1/0,_=-1/0;return b.forEach(M=>{const C=d.node(M),S=.5*C.width,A=C.x-S,T=C.x+S;x=AE?T:E;const k=.5*C.height,O=C.y-k,G=C.y+k;w=O_?G:_}),d.edges().forEach(M=>{const C=d.edge(M),S=d.node(C.metaEdge.v),A=d.node(C.metaEdge.w);if(C.points.length===3&&function(O){let G=WI(O[0],O[1]);for(let D=1;D1)return!1;G=$}return!0}(C.points)){if(S!=null){const O=S.expanded?S.x:Nm(S);C.points[0].x=O}if(A!=null){const O=A.expanded?A.x:Nm(A);C.points[2].x=O}C.points=[C.points[0],C.points[1]]}const T=C.points[C.points.length-2];A!=null&&(C.points[C.points.length-1]=VI(T,A));const k=C.points[1];S!=null&&(C.points[0]=VI(k,S)),C.points.forEach(O=>{x=O.xE?O.x:E,w=O.y_?O.y:_})}),d.nodes().forEach(M=>{const C=d.node(M);C.x-=x,C.y-=w}),d.edges().forEach(M=>{d.edge(M).points.forEach(C=>{C.x-=x,C.y-=w})}),{width:E-x,height:_-w}}(t.coreGraph,l));let c=0;t.coreGraph.nodeCount()>0&&c++;const h=c<=1?0:c;t.coreBox.width+=h+h,t.coreBox.height=a.labelHeight+t.coreBox.height,t.width=t.coreBox.width+a.paddingLeft+a.paddingRight,t.height=t.paddingTop+t.coreBox.height+t.paddingBottom}(r,e)}function WI(r,e){const t=e.x-r.x,n=e.y-r.y;return 180*Math.atan(n/t)/Math.PI}function Nm(r){return r.expanded?r.x:r.x-r.width/2+0+r.coreBox.width/2}function VI(r,e){const t=e.expanded?e.x:Nm(e),n=e.y,i=r.x-t,a=r.y-n;let o,s,u=e.expanded?e.width:e.coreBox.width,f=e.expanded?e.height:e.coreBox.height;return Math.abs(a)*u/2>Math.abs(i)*f/2?(a<0&&(f=-f),o=a===0?0:f/2*i/a,s=f/2):(i<0&&(u=-u),o=u/2,s=i===0?0:u/2*a/i),{x:t+o,y:n+s}}function Ete(r,e,t){var n,i,a,o;const s=r.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 x=0;xc.edges.filter(b=>b.w===m).map(b=>({name:b.v}));return c.nodes.forEach(m=>{const b=m.id,x=[...g(b),b];let w=y(b);h.nodes.push({name:b,path:x,inputs:w,width:m.width,height:m.height,attr:Object.assign({},m)})}),h}(r),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,x]of y)d(b,y)?m[b]=x:g=g.concat(b,x);return v(m,g)};return v(c).filter(p=>h.includes(p))}(r.compound||{},(e==null?void 0:e.expanded)||[]),l=function(c,h){return function(d){return new wte(d)}(xte(gte(c),h))}(u,{rankDirection:((i=(n=t==null?void 0:t.graph)===null||n===void 0?void 0:n.meta)===null||i===void 0?void 0:i.rankDir)||(e==null?void 0:e.rankDirection)||Td.graph.meta.rankDir,align:((o=(a=t==null?void 0:t.graph)===null||a===void 0?void 0:a.meta)===null||o===void 0?void 0:o.align)||Td.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),YI(l.root,t),HI(l.root)}function _te(r,e=!1){const t=JSON.parse(JSON.stringify(r)),n={nodes:[t],edges:[...t.edges]};return t.nodes.forEach(function i(a){(a.type===0||a.type===1)&&n.nodes.push(a),a.type===0&&(n.edges=n.edges.concat(a.edges)),Array.isArray(a.nodes)&&a.nodes.forEach(i)}),e&&n.nodes.forEach(i=>{const a=n.nodes.find(o=>o.id===i.parentNodeName);if(a){const o=a.x-a.width/2+a.paddingLeft,s=a.y-a.height/2+a.labelHeight+a.paddingTop;a.id!==yu&&(i.x+=o,i.y+=s),i.type===0&&i.edges.forEach(u=>{u.points.forEach(f=>{f.x+=i.x-i.width/2+i.paddingLeft,f.y+=i.y-i.height/2+i.labelHeight+i.paddingTop})})}}),n}function Ste(r,e,t,n){var i,a;let o=[];const s=((i=t.find(c=>c.id===r))===null||i===void 0?void 0:i.path)||[],u=((a=t.find(c=>c.id===e))===null||a===void 0?void 0:a.path)||[],f=[yu,...s].slice(0,s.length).reverse(),l=[yu,...u].slice(0,u.length);return f.forEach(c=>{const h=t.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||r)&&v.w===((n==null?void 0:n.w)||e))))}),l.filter(c=>!f.includes(c)).forEach(c=>{const h=t.find(d=>d.id===c);o=o.concat(h.edges.filter(d=>d.baseEdgeList.some(v=>v.v===((n==null?void 0:n.v)||r)&&v.w===((n==null?void 0:n.w)||e))))}),o}function HI(r){const e=r.coreGraph.nodes().map(n=>r.coreGraph.node(n));return Object.assign(Object.assign({},qI(r)),{expanded:r.expanded,nodes:r.expanded?(t=e,t.map(n=>n.node.type===Fn.META?HI(n):qI(n))):[],edges:r.expanded?Mte(r):[]});var t}function qI(r){return{id:r.node.name,name:r.node.name,type:r.node.type,cardinality:r.node.cardinality,attr:r.attr,parentNodeName:r.node.parentNode?r.node.parentNode.name:null,coreBox:Object.assign({},r.coreBox),x:r.x,y:r.y,width:r.width,height:r.height,radius:r.radius,labelHeight:r.labelHeight,labelOffset:r.labelOffset,outboxWidth:r.outboxWidth,paddingLeft:r.paddingLeft,paddingTop:r.paddingTop,paddingRight:r.paddingRight,paddingBottom:r.paddingBottom,path:r.node.path}}function Mte(r){return r.coreGraph.edges().map(e=>({renderInfoEdge:r.coreGraph.edge(e),edge:e})).filter(({renderInfoEdge:e})=>e.metaEdge).map(({edge:e,renderInfoEdge:t})=>{const n=function(i,a){const o=a.points.map(s=>Object.assign({},s));if(a.adjoiningMetaEdge){const s=a.adjoiningMetaEdge.points,u=a.metaEdge.inbound,f=u?s[s.length-1]:s[0],l=o[u?0:o.length-1],c=i.x-i.width/2,h=i.y-i.height/2,d=f.x-c,v=f.y-h,p=-i.paddingLeft,g=-(i.paddingTop+i.labelHeight);l.x=d+p,l.y=v+g}return o}(r,t);return{adjoiningEdge:t.adjoiningMetaEdge?{w:t.adjoiningMetaEdge.metaEdge.w,v:t.adjoiningMetaEdge.metaEdge.v}:null,inbound:t.metaEdge.inbound,w:e.w,v:e.v,points:n,weight:t.weight,baseEdgeList:t.metaEdge.baseEdgeList,parentNodeName:r.node.name}})}const Cte=ea(Object.freeze(Object.defineProperty({__proto__:null,BRIDGE_GRAPH_NAME:UA,get GraphType(){return mu},get HierarchyNodeType(){return qy},get InclusionType(){return os},LAYOUT_CONFIG:Td,get NodeType(){return Fn},ROOT_NAME:yu,buildGraph:Ete,flatGraph:_te,getEdges:Ste,mergeConfig:Hy},Symbol.toStringTag,{value:"Module"})));var Ate=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ni=xe&&xe.__assign||function(){return Ni=Object.assign||function(r){for(var e,t=1,n=arguments.length;tf.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]=a[0]-s,o[1]=a[1]-u}return o},e.prototype.updateNodePosition=function(t,n){var i=this,a=i.combos,o=i.nodes,s=i.edges,u=i.anchorPoint,f=i.graphSettings,l=this.getBegin(t,n);t.forEach(function(c){var h,d=c.x,v=c.y,p=c.id,g=c.type,y=c.coreBox;if(g===li.HierarchyNodeType.META&&p!==li.ROOT_NAME){var m=a.findIndex(function(_){return _.id===p}),b=(h=f==null?void 0:f.subScene)===null||h===void 0?void 0:h.meta;a[m].offsetX=d+l[0],a[m].offsetY=v+l[1],a[m].fixSize=[y.width,y.height],a[m].fixCollapseSize=[y.width,y.height],c.expanded?a[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]:a[m].padding=[0,0,0,0]}else if(g===li.HierarchyNodeType.OP){var m=o.findIndex(function(M){return M.id===p});if(o[m].x=d+l[0],o[m].y=v+l[1],u){var x=[],w=n.filter(function(M){return M.v===p}),E=n.filter(function(M){return M.w===p});w.length>0&&w.forEach(function(M){var C=M.points[0],S=(C.x-d)/c.width+.5,A=(C.y-v)/c.height+.5;x.push([S,A]),M.baseEdgeList.forEach(function(T){var k=s.find(function(O){return O.source===T.v&&O.target===T.w});k&&(k.sourceAnchor=x.length-1)})}),E.length>0&&E.forEach(function(M){var C=M.points[M.points.length-1],S=(C.x-d)/c.width+.5,A=(C.y-v)/c.height+.5;x.push([S,A]),M.baseEdgeList.forEach(function(T){var k=s.find(function(O){return O.source===T.v&&O.target===T.w});k&&(k.targetAnchor=x.length-1)})}),o[m].anchorPoints=x.length>0?x:o[m].anchorPoints||[]}}})},e.prototype.updateEdgePosition=function(t,n){var i=this,a=i.combos,o=i.edges,s=i.controlPoints,u=this.getBegin(t,n);s&&(a.forEach(function(f){f.inEdges=[],f.outEdges=[]}),o.forEach(function(f){var l,c,h,d,v=t.find(function(_){return _.id===f.source}),p=t.find(function(_){return _.id===f.target}),g=[],y=[];if(v&&p)y=(0,li.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,t);else if(!v||!p){var m=i.getNodePath(f.source),b=i.getNodePath(f.target),x=m.reverse().slice(v?0:1).find(function(_){return t.find(function(M){return M.id===_})}),w=b.reverse().slice(p?0:1).find(function(_){return t.find(function(M){return M.id===_})});v=t.find(function(_){return _.id===x}),p=t.find(function(_){return _.id===w}),y=(0,li.getEdges)(v==null?void 0:v.id,p==null?void 0:p.id,t,{v:f.source,w:f.target})}if(g=y.reduce(function(_,M){return Iu(Iu([],_,!0),M.points.map(function(C){return Ni(Ni({},C),{x:C.x+u[0],y:C.y+u[1]})}),!0)},[]),g=g.slice(1,-1),f.controlPoints=g,(p==null?void 0:p.type)===li.NodeType.META){var E=a.findIndex(function(_){return _.id===(p==null?void 0:p.id)});if(!a[E]||!((l=a[E].inEdges)===null||l===void 0)&&l.some(function(_){return _.source===v.id&&_.target===p.id}))return;(c=a[E].inEdges)===null||c===void 0||c.push({source:v.id,target:p.id,controlPoints:g})}if((v==null?void 0:v.type)===li.NodeType.META){var E=a.findIndex(function(M){return M.id===(v==null?void 0:v.id)});if(!a[E]||!((h=a[E].outEdges)===null||h===void 0)&&h.some(function(M){return M.source===v.id&&M.target===p.id}))return;(d=a[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(t){return t.every(function(n){return n.layoutOrder!==void 0})||t.forEach(function(n,i){n.layoutOrder=i}),t.sort(function(n,i){return n.layoutOrder-i.layoutOrder})},e}(Tte.Base);ll.DagreCompoundLayout=Ite;var Om={},rv={},Dm={};const kte=Object.prototype.toString;function nv(r){const e=kte.call(r);return e.endsWith("Array]")&&!e.includes("Big")}function Lte(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!nv(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,n=t===void 0?0:t,i=e.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=r[n],s=n+1;so&&(o=r[s]);return o}function Nte(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!nv(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var t=e.fromIndex,n=t===void 0?0:t,i=e.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var o=r[n],s=n+1;s1&&arguments[1]!==void 0?arguments[1]:{};if(nv(r)){if(r.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var t;if(e.output!==void 0){if(!nv(e.output))throw new TypeError("output option must be an array if specified");t=e.output}else t=new Array(r.length);var n=Nte(r),i=Lte(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=e.min,o=a===void 0?e.autoMinMax?n:0:a,s=e.max,u=s===void 0?e.autoMinMax?i:1:s;if(o>=u)throw new RangeError("min option must be smaller than max option");for(var f=(u-o)/(i-n),l=0;l>n);return this},r.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 i=0;i>n.get(i,a));return this},r.signPropagatingRightShift=function(n,i){return new e(n).signPropagatingRightShift(i)},r.prototype.rightShift=function(n){return typeof n=="number"?this.rightShiftS(n):this.rightShiftM(n)},r.prototype.rightShiftS=function(n){for(let i=0;i>>n);return this},r.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 i=0;i>>n.get(i,a));return this},r.rightShift=function(n,i){return new e(n).rightShift(i)},r.prototype.zeroFillRightShift=r.prototype.rightShift,r.prototype.zeroFillRightShiftS=r.prototype.rightShiftS,r.prototype.zeroFillRightShiftM=r.prototype.rightShiftM,r.zeroFillRightShift=r.rightShift,r.prototype.not=function(){for(let n=0;nn)throw new RangeError("Row index out of range")}function hi(r,e,t){let n=t?r.columns:r.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function ku(r,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==r.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function Lu(r,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==r.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function JI(r,e,t){return{row:ek(r,e),column:tk(r,t)}}function ek(r,e){if(typeof e!="object")throw new TypeError("unexpected type for row indices");if(e.some(n=>n<0||n>=r.rows))throw new RangeError("row indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function tk(r,e){if(typeof e!="object")throw new TypeError("unexpected type for column indices");if(e.some(n=>n<0||n>=r.columns))throw new RangeError("column indices are out of range");return Array.isArray(e)||(e=Array.from(e)),e}function Pm(r,e,t,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(ov("startRow",e),ov("endRow",t),ov("startColumn",n),ov("endColumn",i),e>t||n>i||e<0||e>=r.rows||t<0||t>=r.rows||n<0||n>=r.columns||i<0||i>=r.columns)throw new RangeError("Submatrix indices are out of range")}function av(r,e=0){let t=[];for(let n=0;n=a)throw new RangeError("min must be smaller than max");let s=a-i,u=new dt(e,t);for(let f=0;fn?(a=!0,n=t):(i=!1,a=!0);e++}return i}isReducedEchelonForm(){let e=0,t=0,n=-1,i=!0,a=!1;for(;en?(a=!0,n=t):(i=!1,a=!0);for(let o=t+1;oe.get(i,n)&&(i=a);if(e.get(i,n)===0)n++;else{e.swapRows(t,i);let a=e.get(t,n);for(let o=n;o=0;)if(e.maxRow(i)===0)i--;else{let a=0,o=!1;for(;ae&&(e=this.get(t,n));return e}maxIndex(){let e=this.get(0,0),t=[0,0];for(let n=0;ne&&(e=this.get(n,i),t[0]=n,t[1]=i);return t}min(){let e=this.get(0,0);for(let t=0;tt&&(t=this.get(e,n));return t}maxRowIndex(e){ci(this,e);let t=this.get(e,0),n=[e,0];for(let i=1;it&&(t=this.get(e,i),n[1]=i);return n}minRow(e){ci(this,e);let t=this.get(e,0);for(let n=1;nt&&(t=this.get(n,e));return t}maxColumnIndex(e){hi(this,e);let t=this.get(0,e),n=[0,e];for(let i=1;it&&(t=this.get(i,e),n[0]=i);return n}minColumn(e){hi(this,e);let t=this.get(0,e);for(let n=1;n=n)throw new RangeError("min must be smaller than max");let i=new dt(this.rows,this.columns);for(let a=0;a=n)throw new RangeError("min must be smaller than max");let i=new dt(this.rows,this.columns);for(let a=0;an||t<0||t>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new dt(e.length,n-t+1);for(let a=0;a=this.rows)throw new RangeError(`Row index out of range: ${e[a]}`);i.set(a,o-t,this.get(e[a],o))}return i}subMatrixColumn(e,t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.rows-1),t>n||t<0||t>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new dt(n-t+1,e.length);for(let a=0;a=this.columns)throw new RangeError(`Column index out of range: ${e[a]}`);i.set(o-t,a,this.get(o,e[a]))}return i}setSubMatrix(e,t,n){e=dt.checkMatrix(e);let i=t+e.rows-1,a=n+e.columns-1;Pm(this,t,i,n,a);for(let o=0;o0)if(this.data=[],Number.isInteger(t)&&t>0)for(let n=0;n"u"&&(t=e,e=this.columns),hi(this,e,!0),t=Lu(this,t);for(let n=0;nMath.abs(v[l])&&(l=s);if(l!==u){for(f=0;f=0;f--){for(u=0;uo?i.set(a,o,e.get(a,o)):a===o?i.set(a,o,1):i.set(a,o,0);return i}get upperTriangularMatrix(){let e=this.LU,t=e.rows,n=e.columns,i=new dt(t,n);for(let a=0;aMath.abs(e)?(t=e/r,Math.abs(r)*Math.sqrt(1+t*t)):e!==0?(t=r/e,Math.abs(e)*Math.sqrt(1+t*t)):0}class Rm{constructor(e){e=Qn.checkMatrix(e);let t=e.clone(),n=e.rows,i=e.columns,a=new Float64Array(i),o,s,u,f;for(u=0;u=0;f--){for(u=0;u=0;s--){for(a=0;a=0;S--)if(v[S]!==0){for(let A=S+1;A=0;S--){if(S0;){let S,A;for(S=_-2;S>=-1&&S!==-1;S--){const T=Number.MIN_VALUE+C*Math.abs(v[S]+Math.abs(v[S+1]));if(Math.abs(y[S])<=T||Number.isNaN(y[S])){y[S]=0;break}}if(S===_-2)A=4;else{let T;for(T=_-1;T>=S&&T!==S;T--){let k=(T!==_?Math.abs(y[T]):0)+(T!==S+1?Math.abs(y[T-1]):0);if(Math.abs(v[T])<=C*k){v[T]=0;break}}T===S?A=3:T===_-1?A=1:(A=2,S=T)}switch(S++,A){case 1:{let T=y[_-2];y[_-2]=0;for(let k=_-2;k>=S;k--){let O=Ba(v[k],T),G=v[k]/O,D=T/O;if(v[k]=O,k!==S&&(T=-D*y[k-1],y[k-1]=G*y[k-1]),f)for(let $=0;$=v[S+1]);){let T=v[S];if(v[S]=v[S+1],v[S+1]=T,f&&St&&a.set(l,c,e.get(l,c)/this.s[c]);let o=this.U,s=o.rows,u=o.columns,f=new dt(n,s);for(let l=0;le&&t++;return t}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 dt.diag(this.s)}}function lre(r,e=!1){return r=Qn.checkMatrix(r),e?new Nu(r).inverse():ik(r,dt.eye(r.rows))}function ik(r,e,t=!1){return r=Qn.checkMatrix(r),e=Qn.checkMatrix(e),t?new Nu(r).solve(e):r.isSquare()?new uv(r).solve(e):new Rm(r).solve(e)}function fv(r){if(r=dt.checkMatrix(r),r.isSquare()){let e,t,n,i;if(r.columns===2)return e=r.get(0,0),t=r.get(0,1),n=r.get(1,0),i=r.get(1,1),e*i-t*n;if(r.columns===3){let a,o,s;return a=new sv(r,[1,2],[1,2]),o=new sv(r,[1,2],[0,2]),s=new sv(r,[1,2],[0,1]),e=r.get(0,0),t=r.get(0,1),n=r.get(0,2),e*fv(a)-t*fv(o)+n*fv(s)}else return new uv(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function cre(r,e){let t=[];for(let n=0;ni)return new Array(e.rows+1).fill(0);{let a=e.addRow(t,[0]);for(let o=0;oe?a[o]=1/a[o]:a[o]=0;return i.mmul(dt.diag(a).mmul(n.transpose()))}function pre(r,e=r,t={}){r=new dt(r);let n=!1;if(typeof e=="object"&&!dt.isMatrix(e)&&!Array.isArray(e)?(t=e,e=r,n=!0):e=new dt(e),r.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=t;i&&(r=r.center("column"),n||(e=e.center("column")));const a=r.transpose().mmul(e);for(let o=0;o0?i.set(a,a+1,t[a]):t[a]<0&&i.set(a,a-1,t[a])}return i}}function yre(r,e,t,n){let i,a,o,s,u,f,l,c;for(u=0;u0;s--){for(c=0,o=0,f=0;f0&&(a=-a),e[s]=c*a,o=o-i*a,t[s-1]=i-a,u=0;uf)do{for(i=t[f],c=(t[f+1]-i)/(2*e[f]),h=Ba(c,1),c<0&&(h=-h),t[f]=e[f]/(c+h),t[f+1]=e[f]*(c+h),d=t[f+1],a=i-t[f],o=f+2;o=f;o--)for(g=p,p=v,b=m,i=v*e[o],a=v*c,h=Ba(c,e[o]),e[o+1]=m*h,m=e[o]/h,v=c/h,c=v*t[o]-m*i,t[o+1]=a+m*(v*i+m*t[o]),u=0;uE*w);t[f]=t[f]+x,e[f]=0}for(o=0;o=c;f--)t[f]=e.get(f,c-1)/h,u+=t[f]*t[f];for(s=Math.sqrt(u),t[c]>0&&(s=-s),u=u-t[c]*s,t[c]=t[c]-s,l=c;l=c;f--)o+=t[f]*e.get(f,l);for(o=o/u,f=c;f<=a;f++)e.set(f,l,e.get(f,l)-o*t[f])}for(f=0;f<=a;f++){for(o=0,l=a;l>=c;l--)o+=t[l]*e.get(f,l);for(o=o/u,l=c;l<=a;l++)e.set(f,l,e.get(f,l)-o*t[l])}t[c]=h*t[c],e.set(c,c-1,h*s)}}for(f=0;f=i+1;c--)if(e.get(c,c-1)!==0){for(f=c+1;f<=a;f++)t[f]=e.get(f,c-1);for(l=c;l<=a;l++){for(s=0,f=c;f<=a;f++)s+=t[f]*n.get(f,l);for(s=s/t[c]/e.get(c,c-1),f=c;f<=a;f++)n.set(f,l,n.get(f,l)+s*t[f])}}}function xre(r,e,t,n,i){let a=r-1,o=0,s=r-1,u=Number.EPSILON,f=0,l=0,c=0,h=0,d=0,v=0,p=0,g=0,y,m,b,x,w,E,_,M,C,S,A,T,k,O,G;for(y=0;ys)&&(t[y]=i.get(y,y),e[y]=0),m=Math.max(y-1,0);m=o;){for(x=a;x>o&&(v=Math.abs(i.get(x-1,x-1))+Math.abs(i.get(x,x)),v===0&&(v=l),!(Math.abs(i.get(x,x-1))=0){for(p=c>=0?c+p:c-p,t[a-1]=M+p,t[a]=t[a-1],p!==0&&(t[a]=M-_/p),e[a-1]=0,e[a]=0,M=i.get(a,a-1),v=Math.abs(M)+Math.abs(p),c=M/v,h=p/v,d=Math.sqrt(c*c+h*h),c=c/d,h=h/d,m=a-1;m0)){for(v=Math.sqrt(v),C=x&&(p=i.get(w,w),d=M-p,v=C-p,c=(d*v-_)/i.get(w+1,w)+i.get(w,w+1),h=i.get(w+1,w+1)-p-d-v,d=i.get(w+2,w+1),v=Math.abs(c)+Math.abs(h)+Math.abs(d),c=c/v,h=h/v,d=d/v,!(w===x||Math.abs(i.get(w,w-1))*(Math.abs(h)+Math.abs(d))w+2&&i.set(y,y-3,0);for(b=w;b<=a-1&&(O=b!==a-1,b!==w&&(c=i.get(b,b-1),h=i.get(b+1,b-1),d=O?i.get(b+2,b-1):0,M=Math.abs(c)+Math.abs(h)+Math.abs(d),M!==0&&(c=c/M,h=h/M,d=d/M)),M!==0);b++)if(v=Math.sqrt(c*c+h*h+d*d),c<0&&(v=-v),v!==0){for(b!==w?i.set(b,b-1,-v*M):x!==w&&i.set(b,b-1,-i.get(b,b-1)),c=c+v,M=c/v,C=h/v,p=d/v,h=h/c,d=d/c,m=b;m=0;a--)if(c=t[a],h=e[a],h===0)for(x=a,i.set(a,a,1),y=a-1;y>=0;y--){for(_=i.get(y,y)-c,d=0,m=x;m<=a;m++)d=d+i.get(y,m)*i.get(m,a);if(e[y]<0)p=_,v=d;else if(x=y,e[y]===0?i.set(y,a,_!==0?-d/_:-d/(u*l)):(M=i.get(y,y+1),C=i.get(y+1,y),h=(t[y]-c)*(t[y]-c)+e[y]*e[y],E=(M*v-p*d)/h,i.set(y,a,E),i.set(y+1,a,Math.abs(M)>Math.abs(p)?(-d-_*E)/M:(-v-C*E)/p)),E=Math.abs(i.get(y,a)),u*E*E>1)for(m=y;m<=a;m++)i.set(m,a,i.get(m,a)/E)}else if(h<0)for(x=a-1,Math.abs(i.get(a,a-1))>Math.abs(i.get(a-1,a))?(i.set(a-1,a-1,h/i.get(a,a-1)),i.set(a-1,a,-(i.get(a,a)-c)/i.get(a,a-1))):(G=lv(0,-i.get(a-1,a),i.get(a-1,a-1)-c,h),i.set(a-1,a-1,G[0]),i.set(a-1,a,G[1])),i.set(a,a-1,0),i.set(a,a,1),y=a-2;y>=0;y--){for(S=0,A=0,m=x;m<=a;m++)S=S+i.get(y,m)*i.get(m,a-1),A=A+i.get(y,m)*i.get(m,a);if(_=i.get(y,y)-c,e[y]<0)p=_,d=S,v=A;else if(x=y,e[y]===0?(G=lv(-S,-A,_,h),i.set(y,a-1,G[0]),i.set(y,a,G[1])):(M=i.get(y,y+1),C=i.get(y+1,y),T=(t[y]-c)*(t[y]-c)+e[y]*e[y]-h*h,k=(t[y]-c)*2*h,T===0&&k===0&&(T=u*l*(Math.abs(_)+Math.abs(h)+Math.abs(M)+Math.abs(C)+Math.abs(p))),G=lv(M*d-p*S+h*A,M*v-p*A-h*S,T,k),i.set(y,a-1,G[0]),i.set(y,a,G[1]),Math.abs(M)>Math.abs(p)+Math.abs(h)?(i.set(y+1,a-1,(-S-_*i.get(y,a-1)+h*i.get(y,a))/M),i.set(y+1,a,(-A-_*i.get(y,a)-h*i.get(y,a-1))/M)):(G=lv(-d-C*i.get(y,a-1),-v-C*i.get(y,a),p,h),i.set(y+1,a-1,G[0]),i.set(y+1,a,G[1]))),E=Math.max(Math.abs(i.get(y,a-1)),Math.abs(i.get(y,a))),u*E*E>1)for(m=y;m<=a;m++)i.set(m,a-1,i.get(m,a-1)/E),i.set(m,a,i.get(m,a)/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)*i.get(b,m);n.set(y,m,p)}}}function lv(r,e,t,n){let i,a;return Math.abs(t)>Math.abs(n)?(i=n/t,a=t+i*n,[(r+i*e)/a,(e-i*r)/a]):(i=t/n,a=n+i*t,[(i*r+e)/a,(i*e-r)/a])}class ok{constructor(e){if(e=Qn.checkMatrix(e),!e.isSymmetric())throw new Error("Matrix is not symmetric");let t=e,n=t.rows,i=new dt(n,n),a=!0,o,s,u;for(s=0;s0,i.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(),i?this.t=f.clone().div(this.s.get(0,0)):this.t=f,this.xResidual=e.sub(f.mmul(c.transpose()))}}const uk=ea(Object.freeze(Object.defineProperty({__proto__:null,AbstractMatrix:qt,CHO:ok,CholeskyDecomposition:ok,EVD:ak,EigenvalueDecomposition:ak,LU:uv,LuDecomposition:uv,Matrix:dt,MatrixColumnSelectionView:rre,MatrixColumnView:tre,MatrixFlipColumnView:nre,MatrixFlipRowView:ire,MatrixRowSelectionView:ore,MatrixRowView:are,MatrixSelectionView:sv,MatrixSubView:sre,MatrixTransposeView:ure,NIPALS:sk,Nipals:sk,QR:Rm,QrDecomposition:Rm,SVD:Nu,SingularValueDecomposition:Nu,WrapperMatrix1D:nk,WrapperMatrix2D:Qn,correlation:gre,covariance:pre,default:dt,determinant:fv,inverse:lre,linearDependencies:dre,pseudoInverse:vre,solve:ik,wrap:fre},Symbol.toStringTag,{value:"Module"})));Object.defineProperty(Dm,"__esModule",{value:!0});var xl=uk,wre=function(){function r(e){this.distances=e.distances,this.dimension=e.dimension||2,this.linkDistance=e.linkDistance}return r.prototype.layout=function(){var e=this,t=e.dimension,n=e.distances,i=e.linkDistance;try{var a=xl.Matrix.mul(xl.Matrix.pow(n,2),-.5),o=a.mean("row"),s=a.mean("column"),u=a.mean();a.add(u).subRowVector(o).subColumnVector(s);var f=new xl.SingularValueDecomposition(a),l=xl.Matrix.sqrt(f.diagonalMatrix).diagonal();return f.leftSingularVectors.toJSON().map(function(p){return xl.Matrix.mul([p],[l]).toJSON()[0].splice(0,t)})}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;t.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*(i/Ere),c);if(f[0]+=n[l].x/c*h,f[1]+=n[l].y/c*h,a){var d=f[0]-t[o][0],v=f[1]-t[o][1],p=Math.sqrt(d*d+v*v);d=d/p*u[l],v=v/p*u[l],f[0]=t[o][0]+d,f[1]=t[o][1]+v}}}})},r}();Bm.default=_re;var Sre=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),fk=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(rv,"__esModule",{value:!0}),rv.RadialLayout=void 0;var di=Ir(),Mre=Pr,Cre=fk(Dm),Are=fk(Bm);function Tre(r){for(var e=r.length,t=r[0].length,n=[],i=0;ia[0]?a[0]:p-a[0],m=g-a[1]>a[1]?a[1]:g-a[1];y===0&&(y=p/2),m===0&&(m=g/2);var b=m>y?y:m,x=Math.max.apply(Math,v),w=[];v.forEach(function(Y,N){t.unitRadius||(t.unitRadius=b/x),w[N]=Y*t.unitRadius}),t.radii=w;var E=t.eIdealDisMatrix();t.eIdealDistances=E;var _=Tre(E);t.weights=_;var M=new Cre.default({linkDistance:o,distances:E}),C=M.layout();C.forEach(function(Y){(0,di.isNaN)(Y[0])&&(Y[0]=Math.random()*o),(0,di.isNaN)(Y[1])&&(Y[1]=Math.random()*o)}),t.positions=C,C.forEach(function(Y,N){n[N].x=Y[0]+a[0],n[N].y=Y[1]+a[1]}),C.forEach(function(Y){Y[0]-=C[l][0],Y[1]-=C[l][1]}),t.run();var S=t.preventOverlap,A=t.nodeSize,T,k=t.strictRadial;if(S){var O=t.nodeSpacing,G;(0,di.isNumber)(O)?G=function(){return O}:(0,di.isFunction)(O)?G=O:G=function(){return 0},A?(0,di.isArray)(A)?T=function(Y){var N=A[0]>A[1]?A[0]:A[1];return N+G(Y)}:T=function(Y){return A+G(Y)}:T=function(Y){if(Y.size){if((0,di.isArray)(Y.size)){var N=Y.size[0]>Y.size[1]?Y.size[0]:Y.size[1];return N+G(Y)}if((0,di.isObject)(Y.size)){var N=Y.size.width>Y.size.height?Y.size.width:Y.size.height;return N+G(Y)}return Y.size+G(Y)}return 10+G(Y)};var D={nodes:n,nodeSizeFunc:T,adjMatrix:c,positions:C,radii:w,height:g,width:p,strictRadial:k,focusID:l,iterations:t.maxPreventOverlapIteration||200,k:C.length/4.5},$=new Are.default(D);C=$.layout()}return C.forEach(function(Y,N){n[N].x=Y[0]+a[0],n[N].y=Y[1]+a[1]}),t.onLayoutEnd&&t.onLayoutEnd(),{nodes:n,edges:i}},e.prototype.run=function(){for(var t=this,n=t.maxIteration,i=t.positions||[],a=t.weights||[],o=t.eIdealDistances||[],s=t.radii||[],u=0;u<=n;u++){var f=u/n;t.oneIteration(f,i,s,o,a)}},e.prototype.oneIteration=function(t,n,i,a,o){var s=this,u=1-t,f=s.focusIndex;n.forEach(function(l,c){var h=lk(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 x=lk(l,m),w=x===0?0:1/x,E=a[b][c];g+=o[c][b],v+=o[c][b]*(m[0]+E*(l[0]-m[0])*w),p+=o[c][b]*(m[1]+E*(l[1]-m[1])*w)}});var y=i[c]===0?0:1/i[c];g*=u,g+=t*y*y,v*=u,v+=t*y*l[0]*d,l[0]=v/g,p*=u,p+=t*y*l[1]*d,l[1]=p/g}})},e.prototype.eIdealDisMatrix=function(){var t=this,n=t.nodes;if(!n)return[];var i=t.distances,a=t.linkDistance,o=t.radii||[],s=t.unitRadius||50,u=[];return i&&i.forEach(function(f,l){var c=[];f.forEach(function(h,d){if(l===d)c.push(0);else if(o[l]===o[d])if(t.sortBy==="data")c.push(h*(Math.abs(l-d)*t.sortStrength)/(o[l]/s));else if(t.sortBy){var v=n[l][t.sortBy]||0,p=n[d][t.sortBy]||0;(0,di.isString)(v)&&(v=v.charCodeAt(0)),(0,di.isString)(p)&&(p=p.charCodeAt(0)),c.push(h*(Math.abs(v-p)*t.sortStrength)/(o[l]/s))}else c.push(h*a/(o[l]/s));else{var g=(a+s)/2;c.push(h*g)}}),u.push(c)}),u},e.prototype.handleInfinity=function(t,n,i){for(var a=t.length,o=0;oi?t[n][a]:i);return i},e.prototype.getType=function(){return"radial"},e}(Mre.Base);rv.RadialLayout=kre,function(r){var e=xe&&xe.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),t=xe&&xe.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&e(i,n,a)};Object.defineProperty(r,"__esModule",{value:!0}),t(rv,r)}(Om);var wl={},Lre=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(wl,"__esModule",{value:!0}),wl.ConcentricLayout=void 0;var ua=Ir(),Nre=Pr,Ore=function(r){Lre(e,r);function e(t){var n=r.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(t),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 t,n,i=this,a=i.nodes,o=i.edges,s=a.length;if(s===0){(t=i.onLayoutEnd)===null||t===void 0||t.call(i);return}!i.width&&typeof window<"u"&&(i.width=window.innerWidth),!i.height&&typeof window<"u"&&(i.height=window.innerHeight),i.center||(i.center=[i.width/2,i.height/2]);var u=i.center;if(s===1){a[0].x=u[0],a[0].y=u[1],(n=i.onLayoutEnd)===null||n===void 0||n.call(i);return}var f=i.nodeSize,l=i.nodeSpacing,c=[],h,d=0;(0,ua.isArray)(f)?h=Math.max(f[0],f[1]):h=f,(0,ua.isArray)(l)?d=Math.max(l[0],l[1]):(0,ua.isNumber)(l)&&(d=l),a.forEach(function(k){c.push(k);var O=h;(0,ua.isArray)(k.size)?O=Math.max(k.size[0],k.size[1]):(0,ua.isNumber)(k.size)?O=k.size:(0,ua.isObject)(k.size)&&(O=Math.max(k.size.width,k.size.height)),h=Math.max(h,O),(0,ua.isFunction)(l)&&(d=Math.max(l(k),d))}),i.clockwise=i.counterclockwise!==void 0?!i.counterclockwise:i.clockwise;var v={},p={};if(c.forEach(function(k,O){v[k.id]=k,p[k.id]=O}),(i.sortBy==="degree"||!(0,ua.isString)(i.sortBy)||c[0][i.sortBy]===void 0)&&(i.sortBy="degree",!(0,ua.isNumber)(a[0].degree))){var g=(0,ua.getDegree)(a.length,p,o);c.forEach(function(k,O){k.degree=g[O].all})}c.sort(function(k,O){return O[i.sortBy]-k[i.sortBy]}),i.maxValueNode=c[0],i.maxLevelDiff=i.maxLevelDiff||i.maxValueNode[i.sortBy]/4;var y=[[]],m=y[0];c.forEach(function(k){if(m.length>0){var O=Math.abs(m[0][i.sortBy]-k[i.sortBy]);i.maxLevelDiff&&O>=i.maxLevelDiff&&(m=[],y.push(m))}m.push(k)});var b=h+(d||i.minNodeSpacing);if(!i.preventOverlap){var x=y.length>0&&y[0].length>1,w=Math.min(i.width,i.height)/2-b,E=w/(y.length+(x?1:0));b=Math.min(b,E)}var _=0;if(y.forEach(function(k){var O=i.sweep;O===void 0&&(O=2*Math.PI-2*Math.PI/k.length);var G=k.dTheta=O/Math.max(1,k.length-1);if(k.length>1&&i.preventOverlap){var D=Math.cos(G)-Math.cos(0),$=Math.sin(G)-Math.sin(0),Y=Math.sqrt(b*b/(D*D+$*$));_=Math.max(Y,_)}k.r=_,_+=b}),i.equidistant){for(var M=0,C=0,S=0;S"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:i,edges:a}}},e.prototype.runOneStep=function(t){var n,i=this,a=i.nodes;if(a){var o=i.edges,s=i.center,u=i.gravity,f=i.speed,l=i.clustering,c=i.height*i.width,h=Math.sqrt(c)/10,d=c/(a.length+1),v=Math.sqrt(d),p=[];if(a.forEach(function(m,b){p[b]={x:0,y:0}}),i.applyCalculate(a,o,p,v,d),l){for(var g in t)t[g].cx=0,t[g].cy=0,t[g].count=0;a.forEach(function(m){var b=t[m.cluster];(0,Br.isNumber)(m.x)&&(b.cx+=m.x),(0,Br.isNumber)(m.y)&&(b.cy+=m.y),b.count++});for(var g in t)t[g].cx/=t[g].count,t[g].cy/=t[g].count;var y=i.clusterGravity||u;a.forEach(function(m,b){if(!(!(0,Br.isNumber)(m.x)||!(0,Br.isNumber)(m.y))){var x=t[m.cluster],w=Math.sqrt((m.x-x.cx)*(m.x-x.cx)+(m.y-x.cy)*(m.y-x.cy)),E=v*y;p[b].x-=E*(m.x-x.cx)/w,p[b].y-=E*(m.y-x.cy)/w}})}a.forEach(function(m,b){if(!(!(0,Br.isNumber)(m.x)||!(0,Br.isNumber)(m.y))){var x=.01*v*u;p[b].x-=x*(m.x-s[0]),p[b].y-=x*(m.y-s[1])}}),a.forEach(function(m,b){if((0,Br.isNumber)(m.fx)&&(0,Br.isNumber)(m.fy)){m.x=m.fx,m.y=m.fy;return}if(!(!(0,Br.isNumber)(m.x)||!(0,Br.isNumber)(m.y))){var x=Math.sqrt(p[b].x*p[b].x+p[b].y*p[b].y);if(x>0){var w=Math.min(h*(f/Gre),x);m.x+=p[b].x/x*w,m.y+=p[b].y/x*w}}}),(n=i.tick)===null||n===void 0||n.call(i)}},e.prototype.applyCalculate=function(t,n,i,a,o){var s=this;s.calRepulsive(t,i,o),n&&s.calAttractive(n,i,a)},e.prototype.calRepulsive=function(t,n,i){t.forEach(function(a,o){n[o]={x:0,y:0},t.forEach(function(s,u){if(o!==u&&!(!(0,Br.isNumber)(a.x)||!(0,Br.isNumber)(s.x)||!(0,Br.isNumber)(a.y)||!(0,Br.isNumber)(s.y))){var f=a.x-s.x,l=a.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=i/c;n[o].x+=f*d,n[o].y+=l*d}})})},e.prototype.calAttractive=function(t,n,i){var a=this;t.forEach(function(o){var s=(0,Br.getEdgeTerminal)(o,"source"),u=(0,Br.getEdgeTerminal)(o,"target");if(!(!s||!u)){var f=a.nodeIdxMap[s],l=a.nodeIdxMap[u];if(f!==l){var c=a.nodeMap[s],h=a.nodeMap[u];if(!(!(0,Br.isNumber)(h.x)||!(0,Br.isNumber)(c.x)||!(0,Br.isNumber)(h.y)||!(0,Br.isNumber)(c.y))){var d=h.x-c.x,v=h.y-c.y,p=Math.sqrt(d*d+v*v),g=p*p/i;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 t=this;t.stop(),t.tick=null,t.nodes=null,t.edges=null,t.destroyed=!0},e.prototype.getType=function(){return"fruchterman"},e}(Fre.Base);Sl.FruchtermanLayout=zre;var Ml={};function ck(r,e,t,n,i,a,o){try{var s=r[a](o),u=s.value}catch(f){return void t(f)}s.done?e(u):Promise.resolve(u).then(n,i)}function _o(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(u){ck(a,n,i,o,s,"next",u)}function s(u){ck(a,n,i,o,s,"throw",u)}o(void 0)})}}function Ou(r){"@babel/helpers - typeof";return Ou=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},Ou(r)}function $re(r,e){if(Ou(r)!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(Ou(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function hk(r){var e=$re(r,"string");return Ou(e)=="symbol"?e:e+""}function Je(r,e,t){return(e=hk(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Oi(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function dk(r,e){for(var t=0;t-1&&r%1==0&&r<=une}var lne=fne;function cne(r){return r!=null&&typeof r=="object"}var zm=cne,hne=Gm,dne=lne,vne=zm,pne="[object Arguments]",gne="[object Array]",yne="[object Boolean]",mne="[object Date]",bne="[object Error]",xne="[object Function]",wne="[object Map]",Ene="[object Number]",_ne="[object Object]",Sne="[object RegExp]",Mne="[object Set]",Cne="[object String]",Ane="[object WeakMap]",Tne="[object ArrayBuffer]",Ine="[object DataView]",kne="[object Float32Array]",Lne="[object Float64Array]",Nne="[object Int8Array]",One="[object Int16Array]",Dne="[object Int32Array]",Pne="[object Uint8Array]",Rne="[object Uint8ClampedArray]",Bne="[object Uint16Array]",Fne="[object Uint32Array]",Mr={};Mr[kne]=Mr[Lne]=Mr[Nne]=Mr[One]=Mr[Dne]=Mr[Pne]=Mr[Rne]=Mr[Bne]=Mr[Fne]=!0,Mr[pne]=Mr[gne]=Mr[Tne]=Mr[yne]=Mr[Ine]=Mr[mne]=Mr[bne]=Mr[xne]=Mr[wne]=Mr[Ene]=Mr[_ne]=Mr[Sne]=Mr[Mne]=Mr[Cne]=Mr[Ane]=!1;function Gne(r){return vne(r)&&dne(r.length)&&!!Mr[hne(r)]}var zne=Gne;function $ne(r){return function(e){return r(e)}}var jne=$ne,cv={exports:{}};cv.exports,function(r,e){var t=vk,n=e&&!e.nodeType&&e,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,o=a&&t.process,s=function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}}();r.exports=s}(cv,cv.exports);var Une=cv.exports,Xne=zne,Yne=jne,xk=Une,wk=xk&&xk.isTypedArray,Wne=wk?Yne(wk):Xne,Vne=Wne;const hv=Ji(Vne);var Hne=Gm,qne=zm,Zne="[object Number]";function Kne(r){return typeof r=="number"||qne(r)&&Hne(r)==Zne}var Qne=Kne;const Jne=Ji(Qne);var eie=Array.isArray,tie=eie;const rie=Ji(tie);var Ek={exports:{}},_k={exports:{}};(function(r){function e(t){"@babel/helpers - typeof";return r.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},r.exports.__esModule=!0,r.exports.default=r.exports,e(t)}r.exports=e,r.exports.__esModule=!0,r.exports.default=r.exports})(_k);var nie=_k.exports;(function(r){var e=nie.default;function t(){r.exports=t=function(){return i},r.exports.__esModule=!0,r.exports.default=r.exports;var n,i={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(N,P,W){N[P]=W.value},u=typeof Symbol=="function"?Symbol:{},f=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",c=u.toStringTag||"@@toStringTag";function h(N,P,W){return Object.defineProperty(N,P,{value:W,enumerable:!0,configurable:!0,writable:!0}),N[P]}try{h({},"")}catch{h=function(W,J,te){return W[J]=te}}function d(N,P,W,J){var te=P&&P.prototype instanceof x?P:x,H=Object.create(te.prototype),pe=new $(J||[]);return s(H,"_invoke",{value:k(N,W,pe)}),H}function v(N,P,W){try{return{type:"normal",arg:N.call(P,W)}}catch(J){return{type:"throw",arg:J}}}i.wrap=d;var p="suspendedStart",g="suspendedYield",y="executing",m="completed",b={};function x(){}function w(){}function E(){}var _={};h(_,f,function(){return this});var M=Object.getPrototypeOf,C=M&&M(M(Y([])));C&&C!==a&&o.call(C,f)&&(_=C);var S=E.prototype=x.prototype=Object.create(_);function A(N){["next","throw","return"].forEach(function(P){h(N,P,function(W){return this._invoke(P,W)})})}function T(N,P){function W(te,H,pe,Te){var Ne=v(N[te],N,H);if(Ne.type!=="throw"){var Ze=Ne.arg,at=Ze.value;return at&&e(at)=="object"&&o.call(at,"__await")?P.resolve(at.__await).then(function(nt){W("next",nt,pe,Te)},function(nt){W("throw",nt,pe,Te)}):P.resolve(at).then(function(nt){Ze.value=nt,pe(Ze)},function(nt){return W("throw",nt,pe,Te)})}Te(Ne.arg)}var J;s(this,"_invoke",{value:function(H,pe){function Te(){return new P(function(Ne,Ze){W(H,pe,Ne,Ze)})}return J=J?J.then(Te,Te):Te()}})}function k(N,P,W){var J=p;return function(te,H){if(J===y)throw Error("Generator is already running");if(J===m){if(te==="throw")throw H;return{value:n,done:!0}}for(W.method=te,W.arg=H;;){var pe=W.delegate;if(pe){var Te=O(pe,W);if(Te){if(Te===b)continue;return Te}}if(W.method==="next")W.sent=W._sent=W.arg;else if(W.method==="throw"){if(J===p)throw J=m,W.arg;W.dispatchException(W.arg)}else W.method==="return"&&W.abrupt("return",W.arg);J=y;var Ne=v(N,P,W);if(Ne.type==="normal"){if(J=W.done?m:g,Ne.arg===b)continue;return{value:Ne.arg,done:W.done}}Ne.type==="throw"&&(J=m,W.method="throw",W.arg=Ne.arg)}}}function O(N,P){var W=P.method,J=N.iterator[W];if(J===n)return P.delegate=null,W==="throw"&&N.iterator.return&&(P.method="return",P.arg=n,O(N,P),P.method==="throw")||W!=="return"&&(P.method="throw",P.arg=new TypeError("The iterator does not provide a '"+W+"' method")),b;var te=v(J,N.iterator,P.arg);if(te.type==="throw")return P.method="throw",P.arg=te.arg,P.delegate=null,b;var H=te.arg;return H?H.done?(P[N.resultName]=H.value,P.next=N.nextLoc,P.method!=="return"&&(P.method="next",P.arg=n),P.delegate=null,b):H:(P.method="throw",P.arg=new TypeError("iterator result is not an object"),P.delegate=null,b)}function G(N){var P={tryLoc:N[0]};1 in N&&(P.catchLoc=N[1]),2 in N&&(P.finallyLoc=N[2],P.afterLoc=N[3]),this.tryEntries.push(P)}function D(N){var P=N.completion||{};P.type="normal",delete P.arg,N.completion=P}function $(N){this.tryEntries=[{tryLoc:"root"}],N.forEach(G,this),this.reset(!0)}function Y(N){if(N||N===""){var P=N[f];if(P)return P.call(N);if(typeof N.next=="function")return N;if(!isNaN(N.length)){var W=-1,J=function te(){for(;++W=0;--te){var H=this.tryEntries[te],pe=H.completion;if(H.tryLoc==="root")return J("end");if(H.tryLoc<=this.prev){var Te=o.call(H,"catchLoc"),Ne=o.call(H,"finallyLoc");if(Te&&Ne){if(this.prev=0;--J){var te=this.tryEntries[J];if(te.tryLoc<=this.prev&&o.call(te,"finallyLoc")&&this.prev=0;--W){var J=this.tryEntries[W];if(J.finallyLoc===P)return this.complete(J.completion,J.afterLoc),D(J),b}},catch:function(P){for(var W=this.tryEntries.length-1;W>=0;--W){var J=this.tryEntries[W];if(J.tryLoc===P){var te=J.completion;if(te.type==="throw"){var H=te.arg;D(J)}return H}}throw Error("illegal catch attempt")},delegateYield:function(P,W,J){return this.delegate={iterator:Y(P),resultName:W,nextLoc:J},this.method==="next"&&(this.arg=n),b}},i}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports})(Ek);var iie=Ek.exports,dv=iie(),aie=dv;try{regeneratorRuntime=dv}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=dv:Function("r","regeneratorRuntime = r")(dv)}const Tn=Ji(aie);var oie=1;function Sk(){return oie++}var Le;(function(r){r[r.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",r[r.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",r[r.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r[r.ZERO=0]="ZERO",r[r.ONE=1]="ONE",r[r.SRC_COLOR=768]="SRC_COLOR",r[r.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",r[r.SRC_ALPHA=770]="SRC_ALPHA",r[r.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",r[r.DST_ALPHA=772]="DST_ALPHA",r[r.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",r[r.DST_COLOR=774]="DST_COLOR",r[r.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",r[r.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",r[r.FUNC_ADD=32774]="FUNC_ADD",r[r.BLEND_EQUATION=32777]="BLEND_EQUATION",r[r.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",r[r.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",r[r.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",r[r.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",r[r.MAX_EXT=32776]="MAX_EXT",r[r.MIN_EXT=32775]="MIN_EXT",r[r.BLEND_DST_RGB=32968]="BLEND_DST_RGB",r[r.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",r[r.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",r[r.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",r[r.CONSTANT_COLOR=32769]="CONSTANT_COLOR",r[r.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",r[r.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",r[r.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",r[r.BLEND_COLOR=32773]="BLEND_COLOR",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",r[r.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",r[r.STREAM_DRAW=35040]="STREAM_DRAW",r[r.STATIC_DRAW=35044]="STATIC_DRAW",r[r.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",r[r.BUFFER_SIZE=34660]="BUFFER_SIZE",r[r.BUFFER_USAGE=34661]="BUFFER_USAGE",r[r.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",r[r.FRONT=1028]="FRONT",r[r.BACK=1029]="BACK",r[r.FRONT_AND_BACK=1032]="FRONT_AND_BACK",r[r.CULL_FACE=2884]="CULL_FACE",r[r.BLEND=3042]="BLEND",r[r.DITHER=3024]="DITHER",r[r.STENCIL_TEST=2960]="STENCIL_TEST",r[r.DEPTH_TEST=2929]="DEPTH_TEST",r[r.SCISSOR_TEST=3089]="SCISSOR_TEST",r[r.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",r[r.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",r[r.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",r[r.NO_ERROR=0]="NO_ERROR",r[r.INVALID_ENUM=1280]="INVALID_ENUM",r[r.INVALID_VALUE=1281]="INVALID_VALUE",r[r.INVALID_OPERATION=1282]="INVALID_OPERATION",r[r.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",r[r.CW=2304]="CW",r[r.CCW=2305]="CCW",r[r.LINE_WIDTH=2849]="LINE_WIDTH",r[r.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",r[r.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",r[r.CULL_FACE_MODE=2885]="CULL_FACE_MODE",r[r.FRONT_FACE=2886]="FRONT_FACE",r[r.DEPTH_RANGE=2928]="DEPTH_RANGE",r[r.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",r[r.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",r[r.DEPTH_FUNC=2932]="DEPTH_FUNC",r[r.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",r[r.STENCIL_FUNC=2962]="STENCIL_FUNC",r[r.STENCIL_FAIL=2964]="STENCIL_FAIL",r[r.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",r[r.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",r[r.STENCIL_REF=2967]="STENCIL_REF",r[r.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",r[r.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",r[r.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",r[r.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",r[r.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",r[r.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",r[r.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",r[r.VIEWPORT=2978]="VIEWPORT",r[r.SCISSOR_BOX=3088]="SCISSOR_BOX",r[r.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",r[r.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",r[r.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",r[r.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",r[r.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",r[r.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",r[r.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",r[r.RED_BITS=3410]="RED_BITS",r[r.GREEN_BITS=3411]="GREEN_BITS",r[r.BLUE_BITS=3412]="BLUE_BITS",r[r.ALPHA_BITS=3413]="ALPHA_BITS",r[r.DEPTH_BITS=3414]="DEPTH_BITS",r[r.STENCIL_BITS=3415]="STENCIL_BITS",r[r.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",r[r.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",r[r.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",r[r.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",r[r.SAMPLES=32937]="SAMPLES",r[r.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",r[r.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",r[r.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",r[r.DONT_CARE=4352]="DONT_CARE",r[r.FASTEST=4353]="FASTEST",r[r.NICEST=4354]="NICEST",r[r.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",r[r.BYTE=5120]="BYTE",r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.SHORT=5122]="SHORT",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.INT=5124]="INT",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.FLOAT=5126]="FLOAT",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.ALPHA=6406]="ALPHA",r[r.RGB=6407]="RGB",r[r.RGBA=6408]="RGBA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",r[r.VERTEX_SHADER=35633]="VERTEX_SHADER",r[r.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",r[r.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",r[r.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",r[r.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",r[r.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",r[r.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",r[r.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",r[r.SHADER_TYPE=35663]="SHADER_TYPE",r[r.DELETE_STATUS=35712]="DELETE_STATUS",r[r.LINK_STATUS=35714]="LINK_STATUS",r[r.VALIDATE_STATUS=35715]="VALIDATE_STATUS",r[r.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",r[r.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",r[r.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",r[r.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",r[r.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",r[r.NEVER=512]="NEVER",r[r.LESS=513]="LESS",r[r.EQUAL=514]="EQUAL",r[r.LEQUAL=515]="LEQUAL",r[r.GREATER=516]="GREATER",r[r.NOTEQUAL=517]="NOTEQUAL",r[r.GEQUAL=518]="GEQUAL",r[r.ALWAYS=519]="ALWAYS",r[r.KEEP=7680]="KEEP",r[r.REPLACE=7681]="REPLACE",r[r.INCR=7682]="INCR",r[r.DECR=7683]="DECR",r[r.INVERT=5386]="INVERT",r[r.INCR_WRAP=34055]="INCR_WRAP",r[r.DECR_WRAP=34056]="DECR_WRAP",r[r.VENDOR=7936]="VENDOR",r[r.RENDERER=7937]="RENDERER",r[r.VERSION=7938]="VERSION",r[r.NEAREST=9728]="NEAREST",r[r.LINEAR=9729]="LINEAR",r[r.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",r[r.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",r[r.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",r[r.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",r[r.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",r[r.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",r[r.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",r[r.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE=5890]="TEXTURE",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r[r.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",r[r.TEXTURE0=33984]="TEXTURE0",r[r.TEXTURE1=33985]="TEXTURE1",r[r.TEXTURE2=33986]="TEXTURE2",r[r.TEXTURE3=33987]="TEXTURE3",r[r.TEXTURE4=33988]="TEXTURE4",r[r.TEXTURE5=33989]="TEXTURE5",r[r.TEXTURE6=33990]="TEXTURE6",r[r.TEXTURE7=33991]="TEXTURE7",r[r.TEXTURE8=33992]="TEXTURE8",r[r.TEXTURE9=33993]="TEXTURE9",r[r.TEXTURE10=33994]="TEXTURE10",r[r.TEXTURE11=33995]="TEXTURE11",r[r.TEXTURE12=33996]="TEXTURE12",r[r.TEXTURE13=33997]="TEXTURE13",r[r.TEXTURE14=33998]="TEXTURE14",r[r.TEXTURE15=33999]="TEXTURE15",r[r.TEXTURE16=34e3]="TEXTURE16",r[r.TEXTURE17=34001]="TEXTURE17",r[r.TEXTURE18=34002]="TEXTURE18",r[r.TEXTURE19=34003]="TEXTURE19",r[r.TEXTURE20=34004]="TEXTURE20",r[r.TEXTURE21=34005]="TEXTURE21",r[r.TEXTURE22=34006]="TEXTURE22",r[r.TEXTURE23=34007]="TEXTURE23",r[r.TEXTURE24=34008]="TEXTURE24",r[r.TEXTURE25=34009]="TEXTURE25",r[r.TEXTURE26=34010]="TEXTURE26",r[r.TEXTURE27=34011]="TEXTURE27",r[r.TEXTURE28=34012]="TEXTURE28",r[r.TEXTURE29=34013]="TEXTURE29",r[r.TEXTURE30=34014]="TEXTURE30",r[r.TEXTURE31=34015]="TEXTURE31",r[r.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",r[r.REPEAT=10497]="REPEAT",r[r.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r[r.FLOAT_VEC2=35664]="FLOAT_VEC2",r[r.FLOAT_VEC3=35665]="FLOAT_VEC3",r[r.FLOAT_VEC4=35666]="FLOAT_VEC4",r[r.INT_VEC2=35667]="INT_VEC2",r[r.INT_VEC3=35668]="INT_VEC3",r[r.INT_VEC4=35669]="INT_VEC4",r[r.BOOL=35670]="BOOL",r[r.BOOL_VEC2=35671]="BOOL_VEC2",r[r.BOOL_VEC3=35672]="BOOL_VEC3",r[r.BOOL_VEC4=35673]="BOOL_VEC4",r[r.FLOAT_MAT2=35674]="FLOAT_MAT2",r[r.FLOAT_MAT3=35675]="FLOAT_MAT3",r[r.FLOAT_MAT4=35676]="FLOAT_MAT4",r[r.SAMPLER_2D=35678]="SAMPLER_2D",r[r.SAMPLER_CUBE=35680]="SAMPLER_CUBE",r[r.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",r[r.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",r[r.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",r[r.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",r[r.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",r[r.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",r[r.COMPILE_STATUS=35713]="COMPILE_STATUS",r[r.LOW_FLOAT=36336]="LOW_FLOAT",r[r.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",r[r.HIGH_FLOAT=36338]="HIGH_FLOAT",r[r.LOW_INT=36339]="LOW_INT",r[r.MEDIUM_INT=36340]="MEDIUM_INT",r[r.HIGH_INT=36341]="HIGH_INT",r[r.FRAMEBUFFER=36160]="FRAMEBUFFER",r[r.RENDERBUFFER=36161]="RENDERBUFFER",r[r.RGBA4=32854]="RGBA4",r[r.RGB5_A1=32855]="RGB5_A1",r[r.RGB565=36194]="RGB565",r[r.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",r[r.STENCIL_INDEX=6401]="STENCIL_INDEX",r[r.STENCIL_INDEX8=36168]="STENCIL_INDEX8",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r[r.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",r[r.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",r[r.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",r[r.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",r[r.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",r[r.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",r[r.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",r[r.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",r[r.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",r[r.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",r[r.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",r[r.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",r[r.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",r[r.NONE=0]="NONE",r[r.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",r[r.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",r[r.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",r[r.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",r[r.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",r[r.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",r[r.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",r[r.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",r[r.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",r[r.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",r[r.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",r[r.COPY_SRC=1]="COPY_SRC",r[r.COPY_DST=2]="COPY_DST",r[r.SAMPLED=4]="SAMPLED",r[r.STORAGE=8]="STORAGE",r[r.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"})(Le||(Le={}));var sie=function(){function r(){Oi(this,r),this.config=void 0}return Di(r,[{key:"get",value:function(){return this.config}},{key:"set",value:function(t){this.config=t}}]),r}(),Al;(function(r){r.Void="Void",r.Boolean="Boolean",r.Float="Float",r.Uint32="Uint32",r.Int32="Int32",r.Vector="Vector",r.Vector2Float="vec2",r.Vector3Float="vec3",r.Vector4Float="vec4",r.Vector2Boolean="vec2",r.Vector3Boolean="vec3",r.Vector4Boolean="vec4",r.Vector2Uint="vec2",r.Vector3Uint="vec3",r.Vector4Uint="vec4",r.Vector2Int="vec2",r.Vector3Int="vec3",r.Vector4Int="vec4",r.Matrix="Matrix",r.Matrix3x3Float="mat3x3",r.Matrix4x4Float="mat4x4",r.Struct="Struct",r.FloatArray="Float[]",r.Vector4FloatArray="vec4[]"})(Al||(Al={}));var Mk;(function(r){r.Program="Program",r.Identifier="Identifier",r.VariableDeclaration="VariableDeclaration",r.BlockStatement="BlockStatement",r.ReturnStatement="ReturnStatement",r.FunctionDeclaration="FunctionDeclaration",r.VariableDeclarator="VariableDeclarator",r.AssignmentExpression="AssignmentExpression",r.LogicalExpression="LogicalExpression",r.BinaryExpression="BinaryExpression",r.ArrayExpression="ArrayExpression",r.UnaryExpression="UnaryExpression",r.UpdateExpression="UpdateExpression",r.FunctionExpression="FunctionExpression",r.MemberExpression="MemberExpression",r.ConditionalExpression="ConditionalExpression",r.ExpressionStatement="ExpressionStatement",r.CallExpression="CallExpression",r.NumThreadStatement="NumThreadStatement",r.StorageStatement="StorageStatement",r.DoWhileStatement="DoWhileStatement",r.WhileStatement="WhileStatement",r.ForStatement="ForStatement",r.BreakStatement="BreakStatement",r.ContinueStatement="ContinueStatement",r.IfStatement="IfStatement",r.ImportedFunctionStatement="ImportedFunctionStatement"})(Mk||(Mk={}));var Du;(function(r){r.Input="Input",r.Output="Output",r.Uniform="Uniform",r.Workgroup="Workgroup",r.UniformConstant="UniformConstant",r.Image="Image",r.StorageBuffer="StorageBuffer",r.Private="Private",r.Function="Function"})(Du||(Du={}));var Tl;(function(r){r.GLSL100="GLSL100",r.GLSL450="GLSL450",r.WGSL="WGSL"})(Tl||(Tl={}));var uie="__DefineValuePlaceholder__";function fie(){if(typeof document<"u")return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}function Ck(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ak(r){for(var e=1;e0&&s[0]!==void 0?s[0]:1,!this.dirty){f.next=6;break}return this.compiledBundle.context&&(a>1?this.compiledBundle.context.maxIteration=a: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;i.model.confirmInput(c.model,h)}),o=0;o"u";case"symbol":return typeof I=="symbol"}}function h(I,F,V){c(I,F)||o("invalid parameter type"+u(V)+". expected "+F+", got "+typeof I)}function d(I,F){I>=0&&(I|0)===I||o("invalid parameter type, ("+I+")"+u(F)+". must be a nonnegative integer")}function v(I,F,V){F.indexOf(I)<0&&o("invalid value"+u(V)+". must be one of: "+F)}var p=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(I){Object.keys(I).forEach(function(F){p.indexOf(F)<0&&o('invalid regl constructor argument "'+F+'". must be one of '+p)})}function y(I,F){for(I=I+"";I.length0&&F.push(new x("unknown",0,V))}}),F}function C(I,F){F.forEach(function(V){var ce=I[V.file];if(ce){var we=ce.index[V.line];if(we){we.errors.push(V),ce.hasErrors=!0;return}}I.unknown.hasErrors=!0,I.unknown.lines[0].errors.push(V)})}function S(I,F,V,ce,we){if(!I.getShaderParameter(F,I.COMPILE_STATUS)){var le=I.getShaderInfoLog(F),de=ce===I.FRAGMENT_SHADER?"fragment":"vertex";$(V,"string",de+" shader source must be a string",we);var Ie=_(V,we),Oe=M(le);C(Ie,Oe),Object.keys(Ie).forEach(function(Fe){var De=Ie[Fe];if(!De.hasErrors)return;var $e=[""],Ve=[""];function ke(je,oe){$e.push(je),Ve.push(oe||"")}ke("file number "+Fe+": "+De.name+` `,"color:red;text-decoration:underline;font-weight:bold"),De.lines.forEach(function(je){if(je.errors.length>0){ke(y(je.number,4)+"| ","background-color:yellow; font-weight:bold"),ke(je.line+i,"color:red; background-color:yellow; font-weight:bold");var oe=0;je.errors.forEach(function(ve){var Be=ve.message,Ke=/^\s*'(.*)'\s*:\s*(.*)$/.exec(Be);if(Ke){var Me=Ke[1];switch(Be=Ke[2],Me){case"assign":Me="=";break}oe=Math.max(je.line.indexOf(Me,oe),0)}else oe=0;ke(y("| ",6)),ke(y("^^^",oe+3)+i,"font-weight:bold"),ke(y("| ",6)),ke(Be+i,"font-weight:bold")}),ke(y("| ",6)+i)}else ke(y(je.number,4)+"| "),ke(je.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(Ve[0]=$e.join("%c"),console.log.apply(console,Ve)):console.log($e.join(""))}),s.raise("Error compiling "+de+" shader, "+Ie[0].name)}}function A(I,F,V,ce,we){if(!I.getProgramParameter(F,I.LINK_STATUS)){var le=I.getProgramInfoLog(F),de=_(V,we),Ie=_(ce,we),Oe='Error linking program with vertex shader, "'+Ie[0].name+'", and fragment shader "'+de[0].name+'"';typeof document<"u"?console.log("%c"+Oe+i+"%c"+le,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Oe+i+le),s.raise(Oe)}}function T(I){I._commandRef=w()}function k(I,F,V,ce){T(I);function we(Oe){return Oe?ce.id(Oe):0}I._fragId=we(I.static.frag),I._vertId=we(I.static.vert);function le(Oe,Fe){Object.keys(Fe).forEach(function(De){Oe[ce.id(De)]=!0})}var de=I._uniformSet={};le(de,F.static),le(de,F.dynamic);var Ie=I._attributeSet={};le(Ie,V.static),le(Ie,V.dynamic),I._hasCount="count"in I.static||"count"in I.dynamic||"elements"in I.static||"elements"in I.dynamic}function O(I,F){var V=E();o(I+" in command "+(F||w())+(V==="unknown"?"":" called from "+V))}function G(I,F,V){I||O(F,V||w())}function D(I,F,V,ce){I in F||O("unknown parameter ("+I+")"+u(V)+". possible values: "+Object.keys(F).join(),ce||w())}function $(I,F,V,ce){c(I,F)||O("invalid parameter type"+u(V)+". expected "+F+", got "+typeof I,ce||w())}function Y(I){I()}function N(I,F,V){I.texture?v(I.texture._texture.internalformat,F,"unsupported texture format for attachment"):v(I.renderbuffer._renderbuffer.format,V,"unsupported renderbuffer format for attachment")}var P=33071,W=9728,J=9984,te=9985,H=9986,pe=9987,Te=5120,Ne=5121,Ze=5122,at=5123,nt=5124,St=5125,Mt=5126,fr=32819,Ft=32820,Wt=33635,dr=34042,lr=36193,Ut={};Ut[Te]=Ut[Ne]=1,Ut[Ze]=Ut[at]=Ut[lr]=Ut[Wt]=Ut[fr]=Ut[Ft]=2,Ut[nt]=Ut[St]=Ut[Mt]=Ut[dr]=4;function ar(I,F){return I===Ft||I===fr||I===Wt?2:I===dr?4:Ut[I]*F}function Zr(I){return!(I&I-1)&&!!I}function tt(I,F,V){var ce,we=F.width,le=F.height,de=F.channels;s(we>0&&we<=V.maxTextureSize&&le>0&&le<=V.maxTextureSize,"invalid texture shape"),(I.wrapS!==P||I.wrapT!==P)&&s(Zr(we)&&Zr(le),"incompatible wrap mode for texture, both width and height must be power of 2"),F.mipmask===1?we!==1&&le!==1&&s(I.minFilter!==J&&I.minFilter!==H&&I.minFilter!==te&&I.minFilter!==pe,"min filter requires mipmap"):(s(Zr(we)&&Zr(le),"texture must be a square power of 2 to support mipmapping"),s(F.mipmask===(we<<1)-1,"missing or incomplete mipmap data")),F.type===Mt&&(V.extensions.indexOf("oes_texture_float_linear")<0&&s(I.minFilter===W&&I.magFilter===W,"filter not supported, must enable oes_texture_float_linear"),s(!I.genMipmaps,"mipmap generation not supported with float textures"));var Ie=F.images;for(ce=0;ce<16;++ce)if(Ie[ce]){var Oe=we>>ce,Fe=le>>ce;s(F.mipmask&1<0&&we<=ce.maxTextureSize&&le>0&&le<=ce.maxTextureSize,"invalid texture shape"),s(we===le,"cube map must be square"),s(F.wrapS===P&&F.wrapT===P,"wrap mode not supported by cube map");for(var Ie=0;Ie>De,ke=le>>De;s(Oe.mipmask&1<1&&F===V&&(F==='"'||F==="'"))return['"'+qe(I.substr(1,I.length-2))+'"'];var ce=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(I);if(ce)return et(I.substr(0,ce.index)).concat(et(ce[1])).concat(et(I.substr(ce.index+ce[0].length)));var we=I.split(".");if(we.length===1)return['"'+qe(I)+'"'];for(var le=[],de=0;deRt(V,F+"["+ce+"]")));if(I instanceof We)return I;L(!1,"invalid option type in uniform "+F)}var hr={DynamicVariable:We,define:Pt,isDynamic:cr,unbox:Rt,accessor:yt},ur={next:typeof requestAnimationFrame=="function"?function(I){return requestAnimationFrame(I)}:function(I){return setTimeout(I,16)},cancel:typeof cancelAnimationFrame=="function"?function(I){return cancelAnimationFrame(I)}:clearTimeout},xr=typeof performance<"u"&&performance.now?function(){return performance.now()}:function(){return+new Date};function vr(){var I={"":0},F=[""];return{id:function(V){var ce=I[V];return ce||(ce=I[V]=F.length,F.push(V),ce)},str:function(V){return F[V]}}}function En(I,F,V){var ce=document.createElement("canvas");n(ce.style,{border:0,margin:0,padding:0,top:0,left:0}),I.appendChild(ce),I===document.body&&(ce.style.position="absolute",n(I.style,{margin:0,padding:0}));function we(){var Ie=window.innerWidth,Oe=window.innerHeight;if(I!==document.body){var Fe=I.getBoundingClientRect();Ie=Fe.right-Fe.left,Oe=Fe.bottom-Fe.top}ce.width=V*Ie,ce.height=V*Oe,n(ce.style,{width:Ie+"px",height:Oe+"px"})}var le;I!==document.body&&typeof ResizeObserver=="function"?(le=new ResizeObserver(function(){setTimeout(we)}),le.observe(I)):window.addEventListener("resize",we,!1);function de(){le?le.disconnect():window.removeEventListener("resize",we),I.removeChild(ce)}return we(),{canvas:ce,onDestroy:de}}function or(I,F){function V(ce){try{return I.getContext(ce,F)}catch{return null}}return V("webgl")||V("experimental-webgl")||V("webgl-experimental")}function jr(I){return typeof I.nodeName=="string"&&typeof I.appendChild=="function"&&typeof I.getBoundingClientRect=="function"}function Ri(I){return typeof I.drawArrays=="function"||typeof I.drawElements=="function"}function Kr(I){return typeof I=="string"?I.split():(L(Array.isArray(I),"invalid extension array"),I)}function Oo(I){return typeof I=="string"?(L(typeof document<"u","not supported outside of DOM"),document.querySelector(I)):I}function Jl(I){var F=I||{},V,ce,we,le,de={},Ie=[],Oe=[],Fe=typeof window>"u"?1:window.devicePixelRatio,De=!1,$e=function(je){je&&L.raise(je)},Ve=function(){};if(typeof F=="string"?(L(typeof document<"u","selector queries only supported in DOM enviroments"),V=document.querySelector(F),L(V,"invalid query string for element")):typeof F=="object"?jr(F)?V=F:Ri(F)?(le=F,we=le.canvas):(L.constructor(F),"gl"in F?le=F.gl:"canvas"in F?we=Oo(F.canvas):"container"in F&&(ce=Oo(F.container)),"attributes"in F&&(de=F.attributes,L.type(de,"object","invalid context attributes")),"extensions"in F&&(Ie=Kr(F.extensions)),"optionalExtensions"in F&&(Oe=Kr(F.optionalExtensions)),"onDone"in F&&(L.type(F.onDone,"function","invalid or missing onDone callback"),$e=F.onDone),"profile"in F&&(De=!!F.profile),"pixelRatio"in F&&(Fe=+F.pixelRatio,L(Fe>0,"invalid pixel ratio"))):L.raise("invalid arguments to regl"),V&&(V.nodeName.toLowerCase()==="canvas"?we=V:ce=V),!le){if(!we){L(typeof document<"u","must manually specify webgl context outside of DOM environments");var ke=En(ce||document.body,$e,Fe);if(!ke)return null;we=ke.canvas,Ve=ke.onDestroy}de.premultipliedAlpha===void 0&&(de.premultipliedAlpha=!0),le=or(we,de)}return le?{gl:le,canvas:we,container:ce,extensions:Ie,optionalExtensions:Oe,pixelRatio:Fe,profile:De,onDone:$e,onDestroy:Ve}:(Ve(),$e("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function ec(I,F){var V={};function ce(de){L.type(de,"string","extension name must be string");var Ie=de.toLowerCase(),Oe;try{Oe=V[Ie]=I.getExtension(Ie)}catch{}return!!Oe}for(var we=0;we65535)<<4,I>>>=F,V=(I>255)<<3,I>>>=V,F|=V,V=(I>15)<<2,I>>>=V,F|=V,V=(I>3)<<1,I>>>=V,F|=V,F|I>>1}function pr(){var I=pn(8,function(){return[]});function F(le){var de=Fi(le),Ie=I[At(de)>>2];return Ie.length>0?Ie.pop():new ArrayBuffer(de)}function V(le){I[At(le.byteLength)>>2].push(le)}function ce(le,de){var Ie=null;switch(le){case Va:Ie=new Int8Array(F(de),0,de);break;case _s:Ie=new Uint8Array(F(de),0,de);break;case tc:Ie=new Int16Array(F(2*de),0,de);break;case rc:Ie=new Uint16Array(F(2*de),0,de);break;case nc:Ie=new Int32Array(F(4*de),0,de);break;case Bi:Ie=new Uint32Array(F(4*de),0,de);break;case Ur:Ie=new Float32Array(F(4*de),0,de);break;default:return null}return Ie.length!==de?Ie.subarray(0,de):Ie}function we(le){V(le.buffer)}return{alloc:F,free:V,allocType:ce,freeType:we}}var xt=pr();xt.zero=pr();var kr=3408,_n=3410,Ss=3411,Ms=3412,Ha=3413,Cs=3414,As=3415,Ts=33901,oce=33902,sce=3379,uce=3386,fce=34921,lce=36347,cce=36348,hce=35661,dce=35660,vce=34930,pce=36349,gce=34076,yce=34024,mce=7936,bce=7937,xce=7938,wce=35724,Ece=34047,_ce=36063,Sce=34852,$v=3553,ZN=34067,Mce=34069,Cce=33984,ic=6408,D1=5126,KN=5121,P1=36160,Ace=36053,Tce=36064,Ice=16384,kce=function(I,F){var V=1;F.ext_texture_filter_anisotropic&&(V=I.getParameter(Ece));var ce=1,we=1;F.webgl_draw_buffers&&(ce=I.getParameter(Sce),we=I.getParameter(_ce));var le=!!F.oes_texture_float;if(le){var de=I.createTexture();I.bindTexture($v,de),I.texImage2D($v,0,ic,1,1,0,ic,D1,null);var Ie=I.createFramebuffer();if(I.bindFramebuffer(P1,Ie),I.framebufferTexture2D(P1,Tce,$v,de,0),I.bindTexture($v,null),I.checkFramebufferStatus(P1)!==Ace)le=!1;else{I.viewport(0,0,1,1),I.clearColor(1,0,0,1),I.clear(Ice);var Oe=xt.allocType(D1,4);I.readPixels(0,0,1,1,ic,D1,Oe),I.getError()?le=!1:(I.deleteFramebuffer(Ie),I.deleteTexture(de),le=Oe[0]===1),xt.freeType(Oe)}}var Fe=typeof navigator<"u"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),De=!0;if(!Fe){var $e=I.createTexture(),Ve=xt.allocType(KN,36);I.activeTexture(Cce),I.bindTexture(ZN,$e),I.texImage2D(Mce,0,ic,3,3,0,ic,KN,Ve),xt.freeType(Ve),I.bindTexture(ZN,null),I.deleteTexture($e),De=!I.getError()}return{colorBits:[I.getParameter(_n),I.getParameter(Ss),I.getParameter(Ms),I.getParameter(Ha)],depthBits:I.getParameter(Cs),stencilBits:I.getParameter(As),subpixelBits:I.getParameter(kr),extensions:Object.keys(F).filter(function(ke){return!!F[ke]}),maxAnisotropic:V,maxDrawbuffers:ce,maxColorAttachments:we,pointSizeDims:I.getParameter(Ts),lineWidthDims:I.getParameter(oce),maxViewportDims:I.getParameter(uce),maxCombinedTextureUnits:I.getParameter(hce),maxCubeMapSize:I.getParameter(gce),maxRenderbufferSize:I.getParameter(yce),maxTextureUnits:I.getParameter(vce),maxTextureSize:I.getParameter(sce),maxAttributes:I.getParameter(fce),maxVertexUniforms:I.getParameter(lce),maxVertexTextureUnits:I.getParameter(dce),maxVaryingVectors:I.getParameter(cce),maxFragmentUniforms:I.getParameter(pce),glsl:I.getParameter(wce),renderer:I.getParameter(bce),vendor:I.getParameter(mce),version:I.getParameter(xce),readFloat:le,npotTextureCube:De}};function Gi(I){return!!I&&typeof I=="object"&&Array.isArray(I.shape)&&Array.isArray(I.stride)&&typeof I.offset=="number"&&I.shape.length===I.stride.length&&(Array.isArray(I.data)||t(I.data))}var ti=function(I){return Object.keys(I).map(function(F){return I[F]})},jv={shape:Dce,flatten:Oce};function Lce(I,F,V){for(var ce=0;ce0){var Ue;if(Array.isArray(ve[0])){Ae=eO(ve);for(var Ce=1,Xe=1;Xe0)if(typeof Ce[0]=="number"){var He=xt.allocType(Me.dtype,Ce.length);rO(He,Ce),Ae(He,pt),xt.freeType(He)}else if(Array.isArray(Ce[0])||t(Ce[0])){Tt=eO(Ce);var ze=B1(Ce,Tt,Me.dtype);Ae(ze,pt),xt.freeType(ze)}else L.raise("invalid buffer data")}else if(Gi(Ce)){Tt=Ce.shape;var _e=Ce.stride,Ct=0,Nt=0,ot=0,Gt=0;Tt.length===1?(Ct=Tt[0],Nt=1,ot=_e[0],Gt=0):Tt.length===2?(Ct=Tt[0],Nt=Tt[1],ot=_e[0],Gt=_e[1]):L.raise("invalid shape");var kt=Array.isArray(Ce.data)?Me.dtype:Xv(Ce.data),Bt=xt.allocType(kt,Ct*Nt);nO(Bt,Ce.data,Ct,Nt,ot,Gt,Ce.offset),Ae(Bt,pt),xt.freeType(Bt)}else L.raise("invalid data for buffer subdata");return rt}return Be||rt(oe),rt._reglType="buffer",rt._buffer=Me,rt.subdata=Ue,V.profile&&(rt.stats=Me.stats),rt.destroy=function(){Ve(Me)},rt}function je(){ti(le).forEach(function(oe){oe.buffer=I.createBuffer(),I.bindBuffer(oe.type,oe.buffer),I.bufferData(oe.type,oe.persistentData||oe.byteLength,oe.usage)})}return V.profile&&(F.getTotalBufferSize=function(){var oe=0;return Object.keys(le).forEach(function(ve){oe+=le[ve].stats.size}),oe}),{create:ke,createStream:Oe,destroyStream:Fe,clear:function(){ti(le).forEach(Ve),Ie.forEach(Ve)},getBuffer:function(oe){return oe&&oe._buffer instanceof de?oe._buffer:null},restore:je,_initBuffer:$e}}var Vce=0,Hce=0,qce=1,Zce=1,Kce=4,Qce=4,ju={points:Vce,point:Hce,lines:qce,line:Zce,triangles:Kce,triangle:Qce,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Jce=0,ehe=1,ac=4,the=5120,Uu=5121,iO=5122,Xu=5123,aO=5124,ks=5125,z1=34963,rhe=35040,nhe=35044;function ihe(I,F,V,ce){var we={},le=0,de={uint8:Uu,uint16:Xu};F.oes_element_index_uint&&(de.uint32=ks);function Ie(je){this.id=le++,we[this.id]=this,this.buffer=je,this.primType=ac,this.vertCount=0,this.type=0}Ie.prototype.bind=function(){this.buffer.bind()};var Oe=[];function Fe(je){var oe=Oe.pop();return oe||(oe=new Ie(V.create(null,z1,!0,!1)._buffer)),$e(oe,je,rhe,-1,-1,0,0),oe}function De(je){Oe.push(je)}function $e(je,oe,ve,Be,Ke,Me,rt){je.buffer.bind();var Ae;if(oe){var Ue=rt;!rt&&(!t(oe)||Gi(oe)&&!t(oe.data))&&(Ue=F.oes_element_index_uint?ks:Xu),V._initBuffer(je.buffer,oe,ve,Ue,3)}else I.bufferData(z1,Me,ve),je.buffer.dtype=Ae||Uu,je.buffer.usage=ve,je.buffer.dimension=3,je.buffer.byteLength=Me;if(Ae=rt,!rt){switch(je.buffer.dtype){case Uu:case the:Ae=Uu;break;case Xu:case iO:Ae=Xu;break;case ks:case aO:Ae=ks;break;default:L.raise("unsupported type for element array")}je.buffer.dtype=Ae}je.type=Ae,L(Ae!==ks||!!F.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Ce=Ke;Ce<0&&(Ce=je.buffer.byteLength,Ae===Xu?Ce>>=1:Ae===ks&&(Ce>>=2)),je.vertCount=Ce;var Xe=Be;if(Be<0){Xe=ac;var pt=je.buffer.dimension;pt===1&&(Xe=Jce),pt===2&&(Xe=ehe),pt===3&&(Xe=ac)}je.primType=Xe}function Ve(je){ce.elementsCount--,L(je.buffer!==null,"must not double destroy elements"),delete we[je.id],je.buffer.destroy(),je.buffer=null}function ke(je,oe){var ve=V.create(null,z1,!0),Be=new Ie(ve._buffer);ce.elementsCount++;function Ke(Me){if(!Me)ve(),Be.primType=ac,Be.vertCount=0,Be.type=Uu;else if(typeof Me=="number")ve(Me),Be.primType=ac,Be.vertCount=Me|0,Be.type=Uu;else{var rt=null,Ae=nhe,Ue=-1,Ce=-1,Xe=0,pt=0;Array.isArray(Me)||t(Me)||Gi(Me)?rt=Me:(L.type(Me,"object","invalid arguments for elements"),"data"in Me&&(rt=Me.data,L(Array.isArray(rt)||t(rt)||Gi(rt),"invalid data for element buffer")),"usage"in Me&&(L.parameter(Me.usage,Uv,"invalid element buffer usage"),Ae=Uv[Me.usage]),"primitive"in Me&&(L.parameter(Me.primitive,ju,"invalid element buffer primitive"),Ue=ju[Me.primitive]),"count"in Me&&(L(typeof Me.count=="number"&&Me.count>=0,"invalid vertex count for elements"),Ce=Me.count|0),"type"in Me&&(L.parameter(Me.type,de,"invalid buffer type"),pt=de[Me.type]),"length"in Me?Xe=Me.length|0:(Xe=Ce,pt===Xu||pt===iO?Xe*=2:(pt===ks||pt===aO)&&(Xe*=4))),$e(Be,rt,Ae,Ue,Ce,Xe,pt)}return Ke}return Ke(je),Ke._reglType="elements",Ke._elements=Be,Ke.subdata=function(Me,rt){return ve.subdata(Me,rt),Ke},Ke.destroy=function(){Ve(Be)},Ke}return{create:ke,createStream:Fe,destroyStream:De,getElements:function(je){return typeof je=="function"&&je._elements instanceof Ie?je._elements:null},clear:function(){ti(we).forEach(Ve)}}}var oO=new Float32Array(1),ahe=new Uint32Array(oO.buffer),ohe=5123;function sO(I){for(var F=xt.allocType(ohe,I.length),V=0;V>>31<<15,le=(ce<<1>>>24)-127,de=ce>>13&1023;if(le<-24)F[V]=we;else if(le<-14){var Ie=-14-le;F[V]=we+(de+1024>>Ie)}else le>15?F[V]=we+31744:F[V]=we+(le+15<<10)+de}return F}function Lr(I){return Array.isArray(I)||t(I)}var uO=function(I){return!(I&I-1)&&!!I},she=34467,ba=3553,$1=34067,Yv=34069,Ls=6408,j1=6406,Wv=6407,oc=6409,Vv=6410,fO=32854,U1=32855,lO=36194,uhe=32819,fhe=32820,lhe=33635,che=34042,X1=6402,Hv=34041,Y1=35904,W1=35906,Yu=36193,V1=33776,H1=33777,q1=33778,Z1=33779,cO=35986,hO=35987,dO=34798,vO=35840,pO=35841,gO=35842,yO=35843,mO=36196,Wu=5121,K1=5123,Q1=5125,sc=5126,hhe=10242,dhe=10243,vhe=10497,J1=33071,phe=33648,ghe=10240,yhe=10241,eb=9728,mhe=9729,tb=9984,bO=9985,xO=9986,rb=9987,bhe=33170,qv=4352,xhe=4353,whe=4354,Ehe=34046,_he=3317,She=37440,Mhe=37441,Che=37443,wO=37444,uc=33984,Ahe=[tb,xO,bO,rb],Zv=[0,oc,Vv,Wv,Ls],yi={};yi[oc]=yi[j1]=yi[X1]=1,yi[Hv]=yi[Vv]=2,yi[Wv]=yi[Y1]=3,yi[Ls]=yi[W1]=4;function Vu(I){return"[object "+I+"]"}var EO=Vu("HTMLCanvasElement"),_O=Vu("OffscreenCanvas"),SO=Vu("CanvasRenderingContext2D"),MO=Vu("ImageBitmap"),CO=Vu("HTMLImageElement"),AO=Vu("HTMLVideoElement"),The=Object.keys(R1).concat([EO,_O,SO,MO,CO,AO]),Hu=[];Hu[Wu]=1,Hu[sc]=4,Hu[Yu]=2,Hu[K1]=2,Hu[Q1]=4;var gn=[];gn[fO]=2,gn[U1]=2,gn[lO]=2,gn[Hv]=4,gn[V1]=.5,gn[H1]=.5,gn[q1]=1,gn[Z1]=1,gn[cO]=.5,gn[hO]=1,gn[dO]=1,gn[vO]=.5,gn[pO]=.25,gn[gO]=.5,gn[yO]=.25,gn[mO]=.5;function TO(I){return Array.isArray(I)&&(I.length===0||typeof I[0]=="number")}function IO(I){if(!Array.isArray(I))return!1;var F=I.length;return!(F===0||!Lr(I[0]))}function Ns(I){return Object.prototype.toString.call(I)}function kO(I){return Ns(I)===EO}function LO(I){return Ns(I)===_O}function Ihe(I){return Ns(I)===SO}function khe(I){return Ns(I)===MO}function Lhe(I){return Ns(I)===CO}function Nhe(I){return Ns(I)===AO}function nb(I){if(!I)return!1;var F=Ns(I);return The.indexOf(F)>=0?!0:TO(I)||IO(I)||Gi(I)}function NO(I){return R1[Object.prototype.toString.call(I)]|0}function Ohe(I,F){var V=F.length;switch(I.type){case Wu:case K1:case Q1:case sc:var ce=xt.allocType(I.type,V);ce.set(F),I.data=ce;break;case Yu:I.data=sO(F);break;default:L.raise("unsupported texture type, must specify a typed array")}}function OO(I,F){return xt.allocType(I.type===Yu?sc:I.type,F)}function DO(I,F){I.type===Yu?(I.data=sO(F),xt.freeType(F)):I.data=F}function Dhe(I,F,V,ce,we,le){for(var de=I.width,Ie=I.height,Oe=I.channels,Fe=de*Ie*Oe,De=OO(I,Fe),$e=0,Ve=0;Ve=1;)Ie+=de*Oe*Oe,Oe/=2;return Ie}else return de*V*ce}function Phe(I,F,V,ce,we,le,de){var Ie={"don't care":qv,"dont care":qv,nice:whe,fast:xhe},Oe={repeat:vhe,clamp:J1,mirror:phe},Fe={nearest:eb,linear:mhe},De=n({mipmap:rb,"nearest mipmap nearest":tb,"linear mipmap nearest":bO,"nearest mipmap linear":xO,"linear mipmap linear":rb},Fe),$e={none:0,browser:wO},Ve={uint8:Wu,rgba4:uhe,rgb565:lhe,"rgb5 a1":fhe},ke={alpha:j1,luminance:oc,"luminance alpha":Vv,rgb:Wv,rgba:Ls,rgba4:fO,"rgb5 a1":U1,rgb565:lO},je={};F.ext_srgb&&(ke.srgb=Y1,ke.srgba=W1),F.oes_texture_float&&(Ve.float32=Ve.float=sc),F.oes_texture_half_float&&(Ve.float16=Ve["half float"]=Yu),F.webgl_depth_texture&&(n(ke,{depth:X1,"depth stencil":Hv}),n(Ve,{uint16:K1,uint32:Q1,"depth stencil":che})),F.webgl_compressed_texture_s3tc&&n(je,{"rgb s3tc dxt1":V1,"rgba s3tc dxt1":H1,"rgba s3tc dxt3":q1,"rgba s3tc dxt5":Z1}),F.webgl_compressed_texture_atc&&n(je,{"rgb atc":cO,"rgba atc explicit alpha":hO,"rgba atc interpolated alpha":dO}),F.webgl_compressed_texture_pvrtc&&n(je,{"rgb pvrtc 4bppv1":vO,"rgb pvrtc 2bppv1":pO,"rgba pvrtc 4bppv1":gO,"rgba pvrtc 2bppv1":yO}),F.webgl_compressed_texture_etc1&&(je["rgb etc1"]=mO);var oe=Array.prototype.slice.call(I.getParameter(she));Object.keys(je).forEach(function(X){var he=je[X];oe.indexOf(he)>=0&&(ke[X]=he)});var ve=Object.keys(ke);V.textureFormats=ve;var Be=[];Object.keys(ke).forEach(function(X){var he=ke[X];Be[he]=X});var Ke=[];Object.keys(Ve).forEach(function(X){var he=Ve[X];Ke[he]=X});var Me=[];Object.keys(Fe).forEach(function(X){var he=Fe[X];Me[he]=X});var rt=[];Object.keys(De).forEach(function(X){var he=De[X];rt[he]=X});var Ae=[];Object.keys(Oe).forEach(function(X){var he=Oe[X];Ae[he]=X});var Ue=ve.reduce(function(X,he){var fe=ke[he];return fe===oc||fe===j1||fe===oc||fe===Vv||fe===X1||fe===Hv||F.ext_srgb&&(fe===Y1||fe===W1)?X[fe]=fe:fe===U1||he.indexOf("rgba")>=0?X[fe]=Ls:X[fe]=Wv,X},{});function Ce(){this.internalformat=Ls,this.format=Ls,this.type=Wu,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=wO,this.width=0,this.height=0,this.channels=0}function Xe(X,he){X.internalformat=he.internalformat,X.format=he.format,X.type=he.type,X.compressed=he.compressed,X.premultiplyAlpha=he.premultiplyAlpha,X.flipY=he.flipY,X.unpackAlignment=he.unpackAlignment,X.colorSpace=he.colorSpace,X.width=he.width,X.height=he.height,X.channels=he.channels}function pt(X,he){if(!(typeof he!="object"||!he)){if("premultiplyAlpha"in he&&(L.type(he.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),X.premultiplyAlpha=he.premultiplyAlpha),"flipY"in he&&(L.type(he.flipY,"boolean","invalid texture flip"),X.flipY=he.flipY),"alignment"in he&&(L.oneOf(he.alignment,[1,2,4,8],"invalid texture unpack alignment"),X.unpackAlignment=he.alignment),"colorSpace"in he&&(L.parameter(he.colorSpace,$e,"invalid colorSpace"),X.colorSpace=$e[he.colorSpace]),"type"in he){var fe=he.type;L(F.oes_texture_float||!(fe==="float"||fe==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),L(F.oes_texture_half_float||!(fe==="half float"||fe==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),L(F.webgl_depth_texture||!(fe==="uint16"||fe==="uint32"||fe==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),L.parameter(fe,Ve,"invalid texture type"),X.type=Ve[fe]}var it=X.width,zt=X.height,j=X.channels,R=!1;"shape"in he?(L(Array.isArray(he.shape)&&he.shape.length>=2,"shape must be an array"),it=he.shape[0],zt=he.shape[1],he.shape.length===3&&(j=he.shape[2],L(j>0&&j<=4,"invalid number of channels"),R=!0),L(it>=0&&it<=V.maxTextureSize,"invalid width"),L(zt>=0&&zt<=V.maxTextureSize,"invalid height")):("radius"in he&&(it=zt=he.radius,L(it>=0&&it<=V.maxTextureSize,"invalid radius")),"width"in he&&(it=he.width,L(it>=0&&it<=V.maxTextureSize,"invalid width")),"height"in he&&(zt=he.height,L(zt>=0&&zt<=V.maxTextureSize,"invalid height")),"channels"in he&&(j=he.channels,L(j>0&&j<=4,"invalid number of channels"),R=!0)),X.width=it|0,X.height=zt|0,X.channels=j|0;var Z=!1;if("format"in he){var ie=he.format;L(F.webgl_depth_texture||!(ie==="depth"||ie==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),L.parameter(ie,ke,"invalid texture format");var se=X.internalformat=ke[ie];X.format=Ue[se],ie in Ve&&("type"in he||(X.type=Ve[ie])),ie in je&&(X.compressed=!0),Z=!0}!R&&Z?X.channels=yi[X.format]:R&&!Z?X.channels!==Zv[X.format]&&(X.format=X.internalformat=Zv[X.channels]):Z&&R&&L(X.channels===yi[X.format],"number of channels inconsistent with specified format")}}function Tt(X){I.pixelStorei(She,X.flipY),I.pixelStorei(Mhe,X.premultiplyAlpha),I.pixelStorei(Che,X.colorSpace),I.pixelStorei(_he,X.unpackAlignment)}function He(){Ce.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function ze(X,he){var fe=null;if(nb(he)?fe=he:he&&(L.type(he,"object","invalid pixel data type"),pt(X,he),"x"in he&&(X.xOffset=he.x|0),"y"in he&&(X.yOffset=he.y|0),nb(he.data)&&(fe=he.data)),L(!X.compressed||fe instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),he.copy){L(!fe,"can not specify copy and data field for the same texture");var it=we.viewportWidth,zt=we.viewportHeight;X.width=X.width||it-X.xOffset,X.height=X.height||zt-X.yOffset,X.needsCopy=!0,L(X.xOffset>=0&&X.xOffset=0&&X.yOffset0&&X.width<=it&&X.height>0&&X.height<=zt,"copy texture read out of bounds")}else if(!fe)X.width=X.width||1,X.height=X.height||1,X.channels=X.channels||4;else if(t(fe))X.channels=X.channels||4,X.data=fe,!("type"in he)&&X.type===Wu&&(X.type=NO(fe));else if(TO(fe))X.channels=X.channels||4,Ohe(X,fe),X.alignment=1,X.needsFree=!0;else if(Gi(fe)){var j=fe.data;!Array.isArray(j)&&X.type===Wu&&(X.type=NO(j));var R=fe.shape,Z=fe.stride,ie,se,ee,Q,re,U;R.length===3?(ee=R[2],U=Z[2]):(L(R.length===2,"invalid ndarray pixel data, must be 2 or 3D"),ee=1,U=1),ie=R[0],se=R[1],Q=Z[0],re=Z[1],X.alignment=1,X.width=ie,X.height=se,X.channels=ee,X.format=X.internalformat=Zv[ee],X.needsFree=!0,Dhe(X,j,Q,re,U,fe.offset)}else if(kO(fe)||LO(fe)||Ihe(fe))kO(fe)||LO(fe)?X.element=fe:X.element=fe.canvas,X.width=X.element.width,X.height=X.element.height,X.channels=4;else if(khe(fe))X.element=fe,X.width=fe.width,X.height=fe.height,X.channels=4;else if(Lhe(fe))X.element=fe,X.width=fe.naturalWidth,X.height=fe.naturalHeight,X.channels=4;else if(Nhe(fe))X.element=fe,X.width=fe.videoWidth,X.height=fe.videoHeight,X.channels=4;else if(IO(fe)){var q=X.width||fe[0].length,z=X.height||fe.length,ne=X.channels;Lr(fe[0][0])?ne=ne||fe[0][0].length:ne=ne||1;for(var ue=jv.shape(fe),be=1,Ee=0;Ee=0,"oes_texture_float extension not enabled"):X.type===Yu&&L(V.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function _e(X,he,fe){var it=X.element,zt=X.data,j=X.internalformat,R=X.format,Z=X.type,ie=X.width,se=X.height;Tt(X),it?I.texImage2D(he,fe,R,R,Z,it):X.compressed?I.compressedTexImage2D(he,fe,j,ie,se,0,zt):X.needsCopy?(ce(),I.copyTexImage2D(he,fe,R,X.xOffset,X.yOffset,ie,se,0)):I.texImage2D(he,fe,R,ie,se,0,R,Z,zt||null)}function Ct(X,he,fe,it,zt){var j=X.element,R=X.data,Z=X.internalformat,ie=X.format,se=X.type,ee=X.width,Q=X.height;Tt(X),j?I.texSubImage2D(he,zt,fe,it,ie,se,j):X.compressed?I.compressedTexSubImage2D(he,zt,fe,it,Z,ee,Q,R):X.needsCopy?(ce(),I.copyTexSubImage2D(he,zt,fe,it,X.xOffset,X.yOffset,ee,Q)):I.texSubImage2D(he,zt,fe,it,ee,Q,ie,se,R)}var Nt=[];function ot(){return Nt.pop()||new He}function Gt(X){X.needsFree&&xt.freeType(X.data),He.call(X),Nt.push(X)}function kt(){Ce.call(this),this.genMipmaps=!1,this.mipmapHint=qv,this.mipmask=0,this.images=Array(16)}function Bt(X,he,fe){var it=X.images[0]=ot();X.mipmask=1,it.width=X.width=he,it.height=X.height=fe,it.channels=X.channels=4}function rr(X,he){var fe=null;if(nb(he))fe=X.images[0]=ot(),Xe(fe,X),ze(fe,he),X.mipmask=1;else if(pt(X,he),Array.isArray(he.mipmap))for(var it=he.mipmap,zt=0;zt>=zt,fe.height>>=zt,ze(fe,it[zt]),X.mipmask|=1<=0&&!("faces"in he)&&(X.genMipmaps=!0)}if("mag"in he){var it=he.mag;L.parameter(it,Fe),X.magFilter=Fe[it]}var zt=X.wrapS,j=X.wrapT;if("wrap"in he){var R=he.wrap;typeof R=="string"?(L.parameter(R,Oe),zt=j=Oe[R]):Array.isArray(R)&&(L.parameter(R[0],Oe),L.parameter(R[1],Oe),zt=Oe[R[0]],j=Oe[R[1]])}else{if("wrapS"in he){var Z=he.wrapS;L.parameter(Z,Oe),zt=Oe[Z]}if("wrapT"in he){var ie=he.wrapT;L.parameter(ie,Oe),j=Oe[ie]}}if(X.wrapS=zt,X.wrapT=j,"anisotropic"in he){var se=he.anisotropic;L(typeof se=="number"&&se>=1&&se<=V.maxAnisotropic,"aniso samples must be between 1 and "),X.anisotropic=he.anisotropic}if("mipmap"in he){var ee=!1;switch(typeof he.mipmap){case"string":L.parameter(he.mipmap,Ie,"invalid mipmap hint"),X.mipmapHint=Ie[he.mipmap],X.genMipmaps=!0,ee=!0;break;case"boolean":ee=X.genMipmaps=he.mipmap;break;case"object":L(Array.isArray(he.mipmap),"invalid mipmap type"),X.genMipmaps=!1,ee=!0;break;default:L.raise("invalid mipmap type")}ee&&!("min"in he)&&(X.minFilter=tb)}}function Yr(X,he){I.texParameteri(he,yhe,X.minFilter),I.texParameteri(he,ghe,X.magFilter),I.texParameteri(he,hhe,X.wrapS),I.texParameteri(he,dhe,X.wrapT),F.ext_texture_filter_anisotropic&&I.texParameteri(he,Ehe,X.anisotropic),X.genMipmaps&&(I.hint(bhe,X.mipmapHint),I.generateMipmap(he))}var Wr=0,sn={},yn=V.maxTextureUnits,Nr=Array(yn).map(function(){return null});function Ot(X){Ce.call(this),this.mipmask=0,this.internalformat=Ls,this.id=Wr++,this.refCount=1,this.target=X,this.texture=I.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new mr,de.profile&&(this.stats={size:0})}function mn(X){I.activeTexture(uc),I.bindTexture(X.target,X.texture)}function sr(){var X=Nr[0];X?I.bindTexture(X.target,X.texture):I.bindTexture(ba,null)}function mt(X){var he=X.texture;L(he,"must not double destroy texture");var fe=X.unit,it=X.target;fe>=0&&(I.activeTexture(uc+fe),I.bindTexture(it,null),Nr[fe]=null),I.deleteTexture(he),X.texture=null,X.params=null,X.pixels=null,X.refCount=0,delete sn[X.id],le.textureCount--}n(Ot.prototype,{bind:function(){var X=this;X.bindCount+=1;var he=X.unit;if(he<0){for(var fe=0;fe0)continue;it.unit=-1}Nr[fe]=X,he=fe;break}he>=yn&&L.raise("insufficient number of texture units"),de.profile&&le.maxTextureUnits>re)-ee,U.height=U.height||(fe.height>>re)-Q,L(fe.type===U.type&&fe.format===U.format&&fe.internalformat===U.internalformat,"incompatible format for texture.subimage"),L(ee>=0&&Q>=0&&ee+U.width<=fe.width&&Q+U.height<=fe.height,"texture.subimage write out of bounds"),L(fe.mipmask&1<>ee;++ee){var Q=ie>>ee,re=se>>ee;if(!Q||!re)break;I.texImage2D(ba,ee,fe.format,Q,re,0,fe.format,fe.type,null)}return sr(),de.profile&&(fe.stats.size=Kv(fe.internalformat,fe.type,ie,se,!1,!1)),it}return it(X,he),it.subimage=zt,it.resize=j,it._reglType="texture2d",it._texture=fe,de.profile&&(it.stats=fe.stats),it.destroy=function(){fe.decRef()},it}function Qt(X,he,fe,it,zt,j){var R=new Ot($1);sn[R.id]=R,le.cubeCount++;var Z=new Array(6);function ie(Q,re,U,q,z,ne){var ue,be=R.texInfo;for(mr.call(be),ue=0;ue<6;++ue)Z[ue]=Xt();if(typeof Q=="number"||!Q){var Ee=Q|0||1;for(ue=0;ue<6;++ue)Bt(Z[ue],Ee,Ee)}else if(typeof Q=="object")if(re)rr(Z[0],Q),rr(Z[1],re),rr(Z[2],U),rr(Z[3],q),rr(Z[4],z),rr(Z[5],ne);else if(zr(be,Q),pt(R,Q),"faces"in Q){var ge=Q.faces;for(L(Array.isArray(ge)&&ge.length===6,"cube faces must be a length 6 array"),ue=0;ue<6;++ue)L(typeof ge[ue]=="object"&&!!ge[ue],"invalid input for cube map face"),Xe(Z[ue],R),rr(Z[ue],ge[ue])}else for(ue=0;ue<6;++ue)rr(Z[ue],Q);else L.raise("invalid arguments to cube map");for(Xe(R,Z[0]),V.npotTextureCube||L(uO(R.width)&&uO(R.height),"your browser does not support non power or two texture dimensions"),be.genMipmaps?R.mipmask=(Z[0].width<<1)-1:R.mipmask=Z[0].mipmask,L.textureCube(R,be,Z,V),R.internalformat=Z[0].internalformat,ie.width=Z[0].width,ie.height=Z[0].height,mn(R),ue=0;ue<6;++ue)Gr(Z[ue],Yv+ue);for(Yr(be,$1),sr(),de.profile&&(R.stats.size=Kv(R.internalformat,R.type,ie.width,ie.height,be.genMipmaps,!0)),ie.format=Be[R.internalformat],ie.type=Ke[R.type],ie.mag=Me[be.magFilter],ie.min=rt[be.minFilter],ie.wrapS=Ae[be.wrapS],ie.wrapT=Ae[be.wrapT],ue=0;ue<6;++ue)Xr(Z[ue]);return ie}function se(Q,re,U,q,z){L(!!re,"must specify image data"),L(typeof Q=="number"&&Q===(Q|0)&&Q>=0&&Q<6,"invalid face");var ne=U|0,ue=q|0,be=z|0,Ee=ot();return Xe(Ee,R),Ee.width=0,Ee.height=0,ze(Ee,re),Ee.width=Ee.width||(R.width>>be)-ne,Ee.height=Ee.height||(R.height>>be)-ue,L(R.type===Ee.type&&R.format===Ee.format&&R.internalformat===Ee.internalformat,"incompatible format for texture.subimage"),L(ne>=0&&ue>=0&&ne+Ee.width<=R.width&&ue+Ee.height<=R.height,"texture.subimage write out of bounds"),L(R.mipmask&1<>q;++q)I.texImage2D(Yv+U,q,R.format,re>>q,re>>q,0,R.format,R.type,null);return sr(),de.profile&&(R.stats.size=Kv(R.internalformat,R.type,ie.width,ie.height,!1,!0)),ie}}return ie(X,he,fe,it,zt,j),ie.subimage=se,ie.resize=ee,ie._reglType="textureCube",ie._texture=R,de.profile&&(ie.stats=R.stats),ie.destroy=function(){R.decRef()},ie}function Or(){for(var X=0;X>it,fe.height>>it,0,fe.internalformat,fe.type,null);else for(var zt=0;zt<6;++zt)I.texImage2D(Yv+zt,it,fe.internalformat,fe.width>>it,fe.height>>it,0,fe.internalformat,fe.type,null);Yr(fe.texInfo,fe.target)})}function Gs(){for(var X=0;X=2,"invalid renderbuffer shape"),rt=Xe[0]|0,Ae=Xe[1]|0}else"radius"in Ce&&(rt=Ae=Ce.radius|0),"width"in Ce&&(rt=Ce.width|0),"height"in Ce&&(Ae=Ce.height|0);"format"in Ce&&(L.parameter(Ce.format,le,"invalid renderbuffer format"),Ue=le[Ce.format])}else typeof Ke=="number"?(rt=Ke|0,typeof Me=="number"?Ae=Me|0:Ae=rt):Ke?L.raise("invalid arguments to renderbuffer constructor"):rt=Ae=1;if(L(rt>0&&Ae>0&&rt<=V.maxRenderbufferSize&&Ae<=V.maxRenderbufferSize,"invalid renderbuffer size"),!(rt===oe.width&&Ae===oe.height&&Ue===oe.format))return ve.width=oe.width=rt,ve.height=oe.height=Ae,oe.format=Ue,I.bindRenderbuffer(Po,oe.renderbuffer),I.renderbufferStorage(Po,Ue,rt,Ae),L(I.getError()===0,"invalid render buffer format"),we.profile&&(oe.stats.size=XO(oe.format,oe.width,oe.height)),ve.format=de[oe.format],ve}function Be(Ke,Me){var rt=Ke|0,Ae=Me|0||rt;return rt===oe.width&&Ae===oe.height||(L(rt>0&&Ae>0&&rt<=V.maxRenderbufferSize&&Ae<=V.maxRenderbufferSize,"invalid renderbuffer size"),ve.width=oe.width=rt,ve.height=oe.height=Ae,I.bindRenderbuffer(Po,oe.renderbuffer),I.renderbufferStorage(Po,oe.format,rt,Ae),L(I.getError()===0,"invalid render buffer format"),we.profile&&(oe.stats.size=XO(oe.format,oe.width,oe.height))),ve}return ve(ke,je),ve.resize=Be,ve._reglType="renderbuffer",ve._renderbuffer=oe,we.profile&&(ve.stats=oe.stats),ve.destroy=function(){oe.decRef()},ve}we.profile&&(ce.getTotalRenderbufferSize=function(){var ke=0;return Object.keys(Oe).forEach(function(je){ke+=Oe[je].stats.size}),ke});function Ve(){ti(Oe).forEach(function(ke){ke.renderbuffer=I.createRenderbuffer(),I.bindRenderbuffer(Po,ke.renderbuffer),I.renderbufferStorage(Po,ke.format,ke.width,ke.height)}),I.bindRenderbuffer(Po,null)}return{create:$e,clear:function(){ti(Oe).forEach(De)},restore:Ve}},qa=36160,ib=36161,Os=3553,Jv=34069,YO=36064,WO=36096,VO=36128,HO=33306,qO=36053,Bhe=36054,Fhe=36055,Ghe=36057,zhe=36061,$he=36193,jhe=5121,Uhe=5126,ZO=6407,KO=6408,Xhe=6402,Yhe=[ZO,KO],ab=[];ab[KO]=4,ab[ZO]=3;var ep=[];ep[jhe]=1,ep[Uhe]=4,ep[$he]=2;var Whe=32854,Vhe=32855,Hhe=36194,qhe=33189,Zhe=36168,QO=34041,Khe=35907,Qhe=34836,Jhe=34842,ede=34843,tde=[Whe,Vhe,Hhe,Khe,Jhe,ede,Qhe],qu={};qu[qO]="complete",qu[Bhe]="incomplete attachment",qu[Ghe]="incomplete dimensions",qu[Fhe]="incomplete, missing attachment",qu[zhe]="unsupported";function rde(I,F,V,ce,we,le){var de={cur:null,next:null,dirty:!1,setFBO:null},Ie=["rgba"],Oe=["rgba4","rgb565","rgb5 a1"];F.ext_srgb&&Oe.push("srgba"),F.ext_color_buffer_half_float&&Oe.push("rgba16f","rgb16f"),F.webgl_color_buffer_float&&Oe.push("rgba32f");var Fe=["uint8"];F.oes_texture_half_float&&Fe.push("half float","float16"),F.oes_texture_float&&Fe.push("float","float32");function De(He,ze,_e){this.target=He,this.texture=ze,this.renderbuffer=_e;var Ct=0,Nt=0;ze?(Ct=ze.width,Nt=ze.height):_e&&(Ct=_e.width,Nt=_e.height),this.width=Ct,this.height=Nt}function $e(He){He&&(He.texture&&He.texture._texture.decRef(),He.renderbuffer&&He.renderbuffer._renderbuffer.decRef())}function Ve(He,ze,_e){if(He)if(He.texture){var Ct=He.texture._texture,Nt=Math.max(1,Ct.width),ot=Math.max(1,Ct.height);L(Nt===ze&&ot===_e,"inconsistent width/height for supplied texture"),Ct.refCount+=1}else{var Gt=He.renderbuffer._renderbuffer;L(Gt.width===ze&&Gt.height===_e,"inconsistent width/height for renderbuffer"),Gt.refCount+=1}}function ke(He,ze){ze&&(ze.texture?I.framebufferTexture2D(qa,He,ze.target,ze.texture._texture.texture,0):I.framebufferRenderbuffer(qa,He,ib,ze.renderbuffer._renderbuffer.renderbuffer))}function je(He){var ze=Os,_e=null,Ct=null,Nt=He;typeof He=="object"&&(Nt=He.data,"target"in He&&(ze=He.target|0)),L.type(Nt,"function","invalid attachment data");var ot=Nt._reglType;return ot==="texture2d"?(_e=Nt,L(ze===Os)):ot==="textureCube"?(_e=Nt,L(ze>=Jv&&ze=2,"invalid shape for framebuffer"),Bt=mn[0],rr=mn[1]}else"radius"in Ot&&(Bt=rr=Ot.radius),"width"in Ot&&(Bt=Ot.width),"height"in Ot&&(rr=Ot.height);("color"in Ot||"colors"in Ot)&&(Xt=Ot.color||Ot.colors,Array.isArray(Xt)&&L(Xt.length===1||F.webgl_draw_buffers,"multiple render targets not supported")),Xt||("colorCount"in Ot&&(Yr=Ot.colorCount|0,L(Yr>0,"invalid color buffer count")),"colorTexture"in Ot&&(Xr=!!Ot.colorTexture,mr="rgba4"),"colorType"in Ot&&(zr=Ot.colorType,Xr?(L(F.oes_texture_float||!(zr==="float"||zr==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),L(F.oes_texture_half_float||!(zr==="half float"||zr==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):zr==="half float"||zr==="float16"?(L(F.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),mr="rgba16f"):(zr==="float"||zr==="float32")&&(L(F.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),mr="rgba32f"),L.oneOf(zr,Fe,"invalid color type")),"colorFormat"in Ot&&(mr=Ot.colorFormat,Ie.indexOf(mr)>=0?Xr=!0:Oe.indexOf(mr)>=0?Xr=!1:Xr?L.oneOf(Ot.colorFormat,Ie,"invalid color format for texture"):L.oneOf(Ot.colorFormat,Oe,"invalid color format for renderbuffer"))),("depthTexture"in Ot||"depthStencilTexture"in Ot)&&(Nr=!!(Ot.depthTexture||Ot.depthStencilTexture),L(!Nr||F.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in Ot&&(typeof Ot.depth=="boolean"?Gr=Ot.depth:(Wr=Ot.depth,Qr=!1)),"stencil"in Ot&&(typeof Ot.stencil=="boolean"?Qr=Ot.stencil:(sn=Ot.stencil,Gr=!1)),"depthStencil"in Ot&&(typeof Ot.depthStencil=="boolean"?Gr=Qr=Ot.depthStencil:(yn=Ot.depthStencil,Gr=!1,Qr=!1))}var sr=null,mt=null,$t=null,Qt=null;if(Array.isArray(Xt))sr=Xt.map(je);else if(Xt)sr=[je(Xt)];else for(sr=new Array(Yr),kt=0;kt=0||sr[kt].renderbuffer&&tde.indexOf(sr[kt].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+kt+" is invalid"),sr[kt]&&sr[kt].texture){var wa=ab[sr[kt].texture._texture.format]*ep[sr[kt].texture._texture.type];Or===null?Or=wa:L(Or===wa,"all color attachments much have the same number of bits per pixel.")}return Ve(mt,Bt,rr),L(!mt||mt.texture&&mt.texture._texture.format===Xhe||mt.renderbuffer&&mt.renderbuffer._renderbuffer.format===qhe,"invalid depth attachment for framebuffer object"),Ve($t,Bt,rr),L(!$t||$t.renderbuffer&&$t.renderbuffer._renderbuffer.format===Zhe,"invalid stencil attachment for framebuffer object"),Ve(Qt,Bt,rr),L(!Qt||Qt.texture&&Qt.texture._texture.format===QO||Qt.renderbuffer&&Qt.renderbuffer._renderbuffer.format===QO,"invalid depth-stencil attachment for framebuffer object"),Ae(_e),_e.width=Bt,_e.height=rr,_e.colorAttachments=sr,_e.depthAttachment=mt,_e.stencilAttachment=$t,_e.depthStencilAttachment=Qt,Ct.color=sr.map(ve),Ct.depth=ve(mt),Ct.stencil=ve($t),Ct.depthStencil=ve(Qt),Ct.width=_e.width,Ct.height=_e.height,Ce(_e),Ct}function Nt(ot,Gt){L(de.next!==_e,"can not resize a framebuffer which is currently in use");var kt=Math.max(ot|0,1),Bt=Math.max(Gt|0||kt,1);if(kt===_e.width&&Bt===_e.height)return Ct;for(var rr=_e.colorAttachments,Gr=0;Gr=2,"invalid shape for framebuffer"),L(Xr[0]===Xr[1],"cube framebuffer must be square"),kt=Xr[0]}else"radius"in Xt&&(kt=Xt.radius|0),"width"in Xt?(kt=Xt.width|0,"height"in Xt&&L(Xt.height===kt,"must be square")):"height"in Xt&&(kt=Xt.height|0);("color"in Xt||"colors"in Xt)&&(Bt=Xt.color||Xt.colors,Array.isArray(Bt)&&L(Bt.length===1||F.webgl_draw_buffers,"multiple render targets not supported")),Bt||("colorCount"in Xt&&(Qr=Xt.colorCount|0,L(Qr>0,"invalid color buffer count")),"colorType"in Xt&&(L.oneOf(Xt.colorType,Fe,"invalid color type"),Gr=Xt.colorType),"colorFormat"in Xt&&(rr=Xt.colorFormat,L.oneOf(Xt.colorFormat,Ie,"invalid color format for texture"))),"depth"in Xt&&(Gt.depth=Xt.depth),"stencil"in Xt&&(Gt.stencil=Xt.stencil),"depthStencil"in Xt&&(Gt.depthStencil=Xt.depthStencil)}var mr;if(Bt)if(Array.isArray(Bt))for(mr=[],ot=0;ot0&&(Gt.depth=ze[0].depth,Gt.stencil=ze[0].stencil,Gt.depthStencil=ze[0].depthStencil),ze[ot]?ze[ot](Gt):ze[ot]=Xe(Gt)}return n(_e,{width:kt,height:kt,color:mr})}function Ct(Nt){var ot,Gt=Nt|0;if(L(Gt>0&&Gt<=V.maxCubeMapSize,"invalid radius for cube fbo"),Gt===_e.width)return _e;var kt=_e.color;for(ot=0;ot0,"must specify at least one attribute");var pt={},Tt=Ue.attributes;Tt.length=Xe.length;for(var He=0;He=Ct.byteLength?Nt.subdata(Ct):(Nt.destroy(),Ue.buffers[He]=null)),Ue.buffers[He]||(Nt=Ue.buffers[He]=we.create(ze,JO,!1,!0)),_e.buffer=we.getBuffer(Nt),_e.size=_e.buffer.dimension|0,_e.normalized=!1,_e.type=_e.buffer.dtype,_e.offset=0,_e.stride=0,_e.divisor=0,_e.state=1,pt[He]=1}else we.getBuffer(ze)?(_e.buffer=we.getBuffer(ze),_e.size=_e.buffer.dimension|0,_e.normalized=!1,_e.type=_e.buffer.dtype,_e.offset=0,_e.stride=0,_e.divisor=0,_e.state=1):we.getBuffer(ze.buffer)?(_e.buffer=we.getBuffer(ze.buffer),_e.size=(+ze.size||_e.buffer.dimension)|0,_e.normalized=!!ze.normalized||!1,"type"in ze?(L.parameter(ze.type,Is,"invalid buffer type"),_e.type=Is[ze.type]):_e.type=_e.buffer.dtype,_e.offset=(ze.offset||0)|0,_e.stride=(ze.stride||0)|0,_e.divisor=(ze.divisor||0)|0,_e.state=1,L(_e.size>=1&&_e.size<=4,"size must be between 1 and 4"),L(_e.offset>=0,"invalid offset"),L(_e.stride>=0&&_e.stride<=255,"stride must be between 0 and 255"),L(_e.divisor>=0,"divisor must be positive"),L(!_e.divisor||!!F.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in ze?(L(He>0,"first attribute must not be a constant"),_e.x=+ze.x||0,_e.y=+ze.y||0,_e.z=+ze.z||0,_e.w=+ze.w||0,_e.state=2):L(!1,"invalid attribute spec for location "+He)}for(var ot=0;ot1)for(var Tt=0;Ttoe&&(oe=ve.stats.uniformsCount)}),oe},V.getMaxAttributesCount=function(){var oe=0;return De.forEach(function(ve){ve.stats.attributesCount>oe&&(oe=ve.stats.attributesCount)}),oe});function je(){we={},le={};for(var oe=0;oe=0,"missing vertex shader",Be),L.command(ve>=0,"missing fragment shader",Be);var Me=Fe[ve];Me||(Me=Fe[ve]={});var rt=Me[oe];if(rt&&(rt.refCount++,!Ke))return rt;var Ae=new Ve(ve,oe);return V.shaderCount++,ke(Ae,Be,Ke),rt||(Me[oe]=Ae),De.push(Ae),n(Ae,{destroy:function(){if(Ae.refCount--,Ae.refCount<=0){I.deleteProgram(Ae.program);var Ue=De.indexOf(Ae);De.splice(Ue,1),V.shaderCount--}Me[Ae.vertId].refCount<=0&&(I.deleteShader(le[Ae.vertId]),delete le[Ae.vertId],delete Fe[Ae.fragId][Ae.vertId]),Object.keys(Fe[Ae.fragId]).length||(I.deleteShader(we[Ae.fragId]),delete we[Ae.fragId],delete Fe[Ae.fragId])}})},restore:je,shader:Oe,frag:-1,vert:-1}}var fde=6408,fc=5121,lde=3333,tp=5126;function cde(I,F,V,ce,we,le,de){function Ie(De){var $e;F.next===null?(L(we.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),$e=fc):(L(F.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),$e=F.next.colorAttachments[0].texture._texture.type,le.oes_texture_float?(L($e===fc||$e===tp,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),$e===tp&&L(de.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):L($e===fc,"Reading from a framebuffer is only allowed for the type 'uint8'"));var Ve=0,ke=0,je=ce.framebufferWidth,oe=ce.framebufferHeight,ve=null;t(De)?ve=De:De&&(L.type(De,"object","invalid arguments to regl.read()"),Ve=De.x|0,ke=De.y|0,L(Ve>=0&&Ve=0&&ke0&&je+Ve<=ce.framebufferWidth,"invalid width for read pixels"),L(oe>0&&oe+ke<=ce.framebufferHeight,"invalid height for read pixels"),V();var Be=je*oe*4;return ve||($e===fc?ve=new Uint8Array(Be):$e===tp&&(ve=ve||new Float32Array(Be))),L.isTypedArray(ve,"data buffer for regl.read() must be a typedarray"),L(ve.byteLength>=Be,"data buffer for regl.read() too small"),I.pixelStorei(lde,4),I.readPixels(Ve,ke,je,oe,fde,$e,ve),ve}function Oe(De){var $e;return F.setFBO({framebuffer:De.framebuffer},function(){$e=Ie(De)}),$e}function Fe(De){return!De||!("framebuffer"in De)?Ie(De):Oe(De)}return Fe}function Zu(I){return Array.prototype.slice.call(I)}function Ku(I){return Zu(I).join("")}function hde(){var I=0,F=[],V=[];function ce($e){for(var Ve=0;Ve0&&($e.push(oe,"="),$e.push.apply($e,Zu(arguments)),$e.push(";")),oe}return n(Ve,{def:je,toString:function(){return Ku([ke.length>0?"var "+ke.join(",")+";":"",Ku($e)])}})}function le(){var $e=we(),Ve=we(),ke=$e.toString,je=Ve.toString;function oe(ve,Be){Ve(ve,Be,"=",$e.def(ve,Be),";")}return n(function(){$e.apply($e,Zu(arguments))},{def:$e.def,entry:$e,exit:Ve,save:oe,set:function(ve,Be,Ke){oe(ve,Be),$e(ve,Be,"=",Ke,";")},toString:function(){return ke()+je()}})}function de(){var $e=Ku(arguments),Ve=le(),ke=le(),je=Ve.toString,oe=ke.toString;return n(Ve,{then:function(){return Ve.apply(Ve,Zu(arguments)),this},else:function(){return ke.apply(ke,Zu(arguments)),this},toString:function(){var ve=oe();return ve&&(ve="else{"+ve+"}"),Ku(["if(",$e,"){",je(),"}",ve])}})}var Ie=we(),Oe={};function Fe($e,Ve){var ke=[];function je(){var Me="a"+ke.length;return ke.push(Me),Me}Ve=Ve||0;for(var oe=0;oe":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Bo={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},kD={frag:yde,vert:mde},Ab={cw:SD,ccw:Cb};function pp(I){return Array.isArray(I)||t(I)||Gi(I)}function LD(I){return I.sort(function(F,V){return F===Za?-1:V===Za?1:F=1,ce>=2,F)}else if(V===rp){var we=I.data;return new Ln(we.thisDep,we.contextDep,we.propDep,F)}else{if(V===rD)return new Ln(!1,!1,!1,F);if(V===nD){for(var le=!1,de=!1,Ie=!1,Oe=0;Oe=1&&(de=!0),De>=2&&(Ie=!0)}else Fe.type===rp&&(le=le||Fe.data.thisDep,de=de||Fe.data.contextDep,Ie=Ie||Fe.data.propDep)}return new Ln(le,de,Ie,F)}else return new Ln(V===cb,V===lb,V===fb,F)}}var ND=new Ln(!1,!1,!1,function(){});function Dde(I,F,V,ce,we,le,de,Ie,Oe,Fe,De,$e,Ve,ke,je){var oe=Fe.Record,ve={add:32774,subtract:32778,"reverse subtract":32779};V.ext_blend_minmax&&(ve.min=Ide,ve.max=kde);var Be=V.angle_instanced_arrays,Ke=V.webgl_draw_buffers,Me={dirty:!0,profile:je.profile},rt={},Ae=[],Ue={},Ce={};function Xe(j){return j.replace(".","_")}function pt(j,R,Z){var ie=Xe(j);Ae.push(j),rt[ie]=Me[ie]=!!Z,Ue[ie]=R}function Tt(j,R,Z){var ie=Xe(j);Ae.push(j),Array.isArray(Z)?(Me[ie]=Z.slice(),rt[ie]=Z.slice()):Me[ie]=rt[ie]=Z,Ce[ie]=R}pt(iD,Ede),pt(aD,wde),Tt(oD,"blendColor",[0,0,0,0]),Tt(hb,"blendEquationSeparate",[AD,AD]),Tt(db,"blendFuncSeparate",[CD,MD,CD,MD]),pt(sD,Sde,!0),Tt(uD,"depthFunc",Nde),Tt(fD,"depthRange",[0,1]),Tt(lD,"depthMask",!0),Tt(vb,vb,[!0,!0,!0,!0]),pt(cD,xde),Tt(hD,"cullFace",Fs),Tt(pb,pb,Cb),Tt(gb,gb,1),pt(dD,Cde),Tt(yb,"polygonOffset",[0,0]),pt(vD,Ade),pt(pD,Tde),Tt(mb,"sampleCoverage",[1,!1]),pt(gD,_de),Tt(yD,"stencilMask",-1),Tt(bb,"stencilFunc",[Lde,0,-1]),Tt(xb,"stencilOpSeparate",[xc,Ro,Ro,Ro]),Tt(lc,"stencilOpSeparate",[Fs,Ro,Ro,Ro]),pt(mD,Mde),Tt(np,"scissor",[0,0,I.drawingBufferWidth,I.drawingBufferHeight]),Tt(Za,Za,[0,0,I.drawingBufferWidth,I.drawingBufferHeight]);var He={gl:I,context:Ve,strings:F,next:rt,current:Me,draw:$e,elements:le,buffer:we,shader:De,attributes:Fe.state,vao:Fe,uniforms:Oe,framebuffer:Ie,extensions:V,timer:ke,isBufferArgs:pp},ze={primTypes:ju,compareFuncs:nf,blendFuncs:xa,blendEquations:ve,stencilOps:Bo,glTypes:Is,orientationType:Ab};L.optional(function(){He.isArrayLike=Lr}),Ke&&(ze.backBuffer=[Fs],ze.drawBuffer=pn(ce.maxDrawbuffers,function(j){return j===0?[0]:pn(j,function(R){return Ode+R})}));var _e=0;function Ct(){var j=hde(),R=j.link,Z=j.global;j.id=_e++,j.batchId="0";var ie=R(He),se=j.shared={props:"a0"};Object.keys(He).forEach(function(q){se[q]=Z.def(ie,".",q)}),L.optional(function(){j.CHECK=R(L),j.commandStr=L.guessCommand(),j.command=R(j.commandStr),j.assert=function(q,z,ne){q("if(!(",z,"))",this.CHECK,".commandRaise(",R(ne),",",this.command,");")},ze.invalidBlendCombinations=ID});var ee=j.next={},Q=j.current={};Object.keys(Ce).forEach(function(q){Array.isArray(Me[q])&&(ee[q]=Z.def(se.next,".",q),Q[q]=Z.def(se.current,".",q))});var re=j.constants={};Object.keys(ze).forEach(function(q){re[q]=Z.def(JSON.stringify(ze[q]))}),j.invoke=function(q,z){switch(z.type){case ub:var ne=["this",se.context,se.props,j.batchId];return q.def(R(z.data),".call(",ne.slice(0,Math.max(z.data.length+1,4)),")");case fb:return q.def(se.props,z.data);case lb:return q.def(se.context,z.data);case cb:return q.def("this",z.data);case rp:return z.data.append(j,q),z.data.ref;case rD:return z.data.toString();case nD:return z.data.map(function(ue){return j.invoke(q,ue)})}},j.attribCache={};var U={};return j.scopeAttrib=function(q){var z=F.id(q);if(z in U)return U[z];var ne=Fe.scope[z];ne||(ne=Fe.scope[z]=new oe);var ue=U[z]=R(ne);return ue},j}function Nt(j){var R=j.static,Z=j.dynamic,ie;if(cc in R){var se=!!R[cc];ie=Fr(function(Q,re){return se}),ie.enable=se}else if(cc in Z){var ee=Z[cc];ie=jn(ee,function(Q,re){return Q.invoke(re,ee)})}return ie}function ot(j,R){var Z=j.static,ie=j.dynamic;if(Ds in Z){var se=Z[Ds];return se?(se=Ie.getFramebuffer(se),L.command(se,"invalid framebuffer object"),Fr(function(Q,re){var U=Q.link(se),q=Q.shared;re.set(q.framebuffer,".next",U);var z=q.context;return re.set(z,"."+ef,U+".width"),re.set(z,"."+tf,U+".height"),U})):Fr(function(Q,re){var U=Q.shared;re.set(U.framebuffer,".next","null");var q=U.context;return re.set(q,"."+ef,q+"."+xD),re.set(q,"."+tf,q+"."+wD),"null"})}else if(Ds in ie){var ee=ie[Ds];return jn(ee,function(Q,re){var U=Q.invoke(re,ee),q=Q.shared,z=q.framebuffer,ne=re.def(z,".getFramebuffer(",U,")");L.optional(function(){Q.assert(re,"!"+U+"||"+ne,"invalid framebuffer object")}),re.set(z,".next",ne);var ue=q.context;return re.set(ue,"."+ef,ne+"?"+ne+".width:"+ue+"."+xD),re.set(ue,"."+tf,ne+"?"+ne+".height:"+ue+"."+wD),ne})}else return null}function Gt(j,R,Z){var ie=j.static,se=j.dynamic;function ee(U){if(U in ie){var q=ie[U];L.commandType(q,"object","invalid "+U,Z.commandStr);var z=!0,ne=q.x|0,ue=q.y|0,be,Ee;return"width"in q?(be=q.width|0,L.command(be>=0,"invalid "+U,Z.commandStr)):z=!1,"height"in q?(Ee=q.height|0,L.command(Ee>=0,"invalid "+U,Z.commandStr)):z=!1,new Ln(!z&&R&&R.thisDep,!z&&R&&R.contextDep,!z&&R&&R.propDep,function(lt,Dt){var st=lt.shared.context,wt=be;"width"in q||(wt=Dt.def(st,".",ef,"-",ne));var Lt=Ee;return"height"in q||(Lt=Dt.def(st,".",tf,"-",ue)),[ne,ue,wt,Lt]})}else if(U in se){var ge=se[U],Re=jn(ge,function(lt,Dt){var st=lt.invoke(Dt,ge);L.optional(function(){lt.assert(Dt,st+"&&typeof "+st+'==="object"',"invalid "+U)});var wt=lt.shared.context,Lt=Dt.def(st,".x|0"),nr=Dt.def(st,".y|0"),Tr=Dt.def('"width" in ',st,"?",st,".width|0:","(",wt,".",ef,"-",Lt,")"),Nn=Dt.def('"height" in ',st,"?",st,".height|0:","(",wt,".",tf,"-",nr,")");return L.optional(function(){lt.assert(Dt,Tr+">=0&&"+Nn+">=0","invalid "+U)}),[Lt,nr,Tr,Nn]});return R&&(Re.thisDep=Re.thisDep||R.thisDep,Re.contextDep=Re.contextDep||R.contextDep,Re.propDep=Re.propDep||R.propDep),Re}else return R?new Ln(R.thisDep,R.contextDep,R.propDep,function(lt,Dt){var st=lt.shared.context;return[0,0,Dt.def(st,".",ef),Dt.def(st,".",tf)]}):null}var Q=ee(Za);if(Q){var re=Q;Q=new Ln(Q.thisDep,Q.contextDep,Q.propDep,function(U,q){var z=re.append(U,q),ne=U.shared.context;return q.set(ne,"."+dde,z[2]),q.set(ne,"."+vde,z[3]),z})}return{viewport:Q,scissor_box:ee(np)}}function kt(j,R){var Z=j.static,ie=typeof Z[dc]=="string"&&typeof Z[hc]=="string";if(ie){if(Object.keys(R.dynamic).length>0)return null;var se=R.static,ee=Object.keys(se);if(ee.length>0&&typeof se[ee[0]]=="number"){for(var Q=[],re=0;re=0,"invalid "+z,R.commandStr),Fr(function(Ee,ge){return ne&&(Ee.OFFSET=ue),ue})}else if(z in ie){var be=ie[z];return jn(be,function(Ee,ge){var Re=Ee.invoke(ge,be);return ne&&(Ee.OFFSET=Re,L.optional(function(){Ee.assert(ge,Re+">=0","invalid "+z)})),Re})}else if(ne&&ee)return Fr(function(Ee,ge){return Ee.OFFSET="0",0});return null}var U=re(ip,!0);function q(){if(Bs in Z){var z=Z[Bs]|0;return L.command(typeof z=="number"&&z>=0,"invalid vertex count",R.commandStr),Fr(function(){return z})}else if(Bs in ie){var ne=ie[Bs];return jn(ne,function(Ee,ge){var Re=Ee.invoke(ge,ne);return L.optional(function(){Ee.assert(ge,"typeof "+Re+'==="number"&&'+Re+">=0&&"+Re+"===("+Re+"|0)","invalid vertex count")}),Re})}else if(ee)if(Fo(ee)){if(ee)return U?new Ln(U.thisDep,U.contextDep,U.propDep,function(Ee,ge){var Re=ge.def(Ee.ELEMENTS,".vertCount-",Ee.OFFSET);return L.optional(function(){Ee.assert(ge,Re+">=0","invalid vertex offset/element buffer too small")}),Re}):Fr(function(Ee,ge){return ge.def(Ee.ELEMENTS,".vertCount")});var ue=Fr(function(){return-1});return L.optional(function(){ue.MISSING=!0}),ue}else{var be=new Ln(ee.thisDep||U.thisDep,ee.contextDep||U.contextDep,ee.propDep||U.propDep,function(Ee,ge){var Re=Ee.ELEMENTS;return Ee.OFFSET?ge.def(Re,"?",Re,".vertCount-",Ee.OFFSET,":-1"):ge.def(Re,"?",Re,".vertCount:-1")});return L.optional(function(){be.DYNAMIC=!0}),be}return null}return{elements:ee,primitive:Q(),count:q(),instances:re(ap,!1),offset:U}}function Gr(j,R){var Z=j.static,ie=j.dynamic,se={};return Ae.forEach(function(ee){var Q=Xe(ee);function re(U,q){if(ee in Z){var z=U(Z[ee]);se[Q]=Fr(function(){return z})}else if(ee in ie){var ne=ie[ee];se[Q]=jn(ne,function(ue,be){return q(ue,be,ue.invoke(be,ne))})}}switch(ee){case cD:case aD:case iD:case gD:case sD:case mD:case dD:case vD:case pD:case lD:return re(function(U){return L.commandType(U,"boolean",ee,R.commandStr),U},function(U,q,z){return L.optional(function(){U.assert(q,"typeof "+z+'==="boolean"',"invalid flag "+ee,U.commandStr)}),z});case uD:return re(function(U){return L.commandParameter(U,nf,"invalid "+ee,R.commandStr),nf[U]},function(U,q,z){var ne=U.constants.compareFuncs;return L.optional(function(){U.assert(q,z+" in "+ne,"invalid "+ee+", must be one of "+Object.keys(nf))}),q.def(ne,"[",z,"]")});case fD:return re(function(U){return L.command(Lr(U)&&U.length===2&&typeof U[0]=="number"&&typeof U[1]=="number"&&U[0]<=U[1],"depth range is 2d array",R.commandStr),U},function(U,q,z){L.optional(function(){U.assert(q,U.shared.isArrayLike+"("+z+")&&"+z+".length===2&&typeof "+z+'[0]==="number"&&typeof '+z+'[1]==="number"&&'+z+"[0]<="+z+"[1]","depth range must be a 2d array")});var ne=q.def("+",z,"[0]"),ue=q.def("+",z,"[1]");return[ne,ue]});case db:return re(function(U){L.commandType(U,"object","blend.func",R.commandStr);var q="srcRGB"in U?U.srcRGB:U.src,z="srcAlpha"in U?U.srcAlpha:U.src,ne="dstRGB"in U?U.dstRGB:U.dst,ue="dstAlpha"in U?U.dstAlpha:U.dst;return L.commandParameter(q,xa,Q+".srcRGB",R.commandStr),L.commandParameter(z,xa,Q+".srcAlpha",R.commandStr),L.commandParameter(ne,xa,Q+".dstRGB",R.commandStr),L.commandParameter(ue,xa,Q+".dstAlpha",R.commandStr),L.command(ID.indexOf(q+", "+ne)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+q+", "+ne+")",R.commandStr),[xa[q],xa[ne],xa[z],xa[ue]]},function(U,q,z){var ne=U.constants.blendFuncs;L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid blend func, must be an object")});function ue(st,wt){var Lt=q.def('"',st,wt,'" in ',z,"?",z,".",st,wt,":",z,".",st);return L.optional(function(){U.assert(q,Lt+" in "+ne,"invalid "+ee+"."+st+wt+", must be one of "+Object.keys(xa))}),Lt}var be=ue("src","RGB"),Ee=ue("dst","RGB");L.optional(function(){var st=U.constants.invalidBlendCombinations;U.assert(q,st+".indexOf("+be+'+", "+'+Ee+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var ge=q.def(ne,"[",be,"]"),Re=q.def(ne,"[",ue("src","Alpha"),"]"),lt=q.def(ne,"[",Ee,"]"),Dt=q.def(ne,"[",ue("dst","Alpha"),"]");return[ge,lt,Re,Dt]});case hb:return re(function(U){if(typeof U=="string")return L.commandParameter(U,ve,"invalid "+ee,R.commandStr),[ve[U],ve[U]];if(typeof U=="object")return L.commandParameter(U.rgb,ve,ee+".rgb",R.commandStr),L.commandParameter(U.alpha,ve,ee+".alpha",R.commandStr),[ve[U.rgb],ve[U.alpha]];L.commandRaise("invalid blend.equation",R.commandStr)},function(U,q,z){var ne=U.constants.blendEquations,ue=q.def(),be=q.def(),Ee=U.cond("typeof ",z,'==="string"');return L.optional(function(){function ge(Re,lt,Dt){U.assert(Re,Dt+" in "+ne,"invalid "+lt+", must be one of "+Object.keys(ve))}ge(Ee.then,ee,z),U.assert(Ee.else,z+"&&typeof "+z+'==="object"',"invalid "+ee),ge(Ee.else,ee+".rgb",z+".rgb"),ge(Ee.else,ee+".alpha",z+".alpha")}),Ee.then(ue,"=",be,"=",ne,"[",z,"];"),Ee.else(ue,"=",ne,"[",z,".rgb];",be,"=",ne,"[",z,".alpha];"),q(Ee),[ue,be]});case oD:return re(function(U){return L.command(Lr(U)&&U.length===4,"blend.color must be a 4d array",R.commandStr),pn(4,function(q){return+U[q]})},function(U,q,z){return L.optional(function(){U.assert(q,U.shared.isArrayLike+"("+z+")&&"+z+".length===4","blend.color must be a 4d array")}),pn(4,function(ne){return q.def("+",z,"[",ne,"]")})});case yD:return re(function(U){return L.commandType(U,"number",Q,R.commandStr),U|0},function(U,q,z){return L.optional(function(){U.assert(q,"typeof "+z+'==="number"',"invalid stencil.mask")}),q.def(z,"|0")});case bb:return re(function(U){L.commandType(U,"object",Q,R.commandStr);var q=U.cmp||"keep",z=U.ref||0,ne="mask"in U?U.mask:-1;return L.commandParameter(q,nf,ee+".cmp",R.commandStr),L.commandType(z,"number",ee+".ref",R.commandStr),L.commandType(ne,"number",ee+".mask",R.commandStr),[nf[q],z,ne]},function(U,q,z){var ne=U.constants.compareFuncs;L.optional(function(){function ge(){U.assert(q,Array.prototype.join.call(arguments,""),"invalid stencil.func")}ge(z+"&&typeof ",z,'==="object"'),ge('!("cmp" in ',z,")||(",z,".cmp in ",ne,")")});var ue=q.def('"cmp" in ',z,"?",ne,"[",z,".cmp]",":",Ro),be=q.def(z,".ref|0"),Ee=q.def('"mask" in ',z,"?",z,".mask|0:-1");return[ue,be,Ee]});case xb:case lc:return re(function(U){L.commandType(U,"object",Q,R.commandStr);var q=U.fail||"keep",z=U.zfail||"keep",ne=U.zpass||"keep";return L.commandParameter(q,Bo,ee+".fail",R.commandStr),L.commandParameter(z,Bo,ee+".zfail",R.commandStr),L.commandParameter(ne,Bo,ee+".zpass",R.commandStr),[ee===lc?Fs:xc,Bo[q],Bo[z],Bo[ne]]},function(U,q,z){var ne=U.constants.stencilOps;L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid "+ee)});function ue(be){return L.optional(function(){U.assert(q,'!("'+be+'" in '+z+")||("+z+"."+be+" in "+ne+")","invalid "+ee+"."+be+", must be one of "+Object.keys(Bo))}),q.def('"',be,'" in ',z,"?",ne,"[",z,".",be,"]:",Ro)}return[ee===lc?Fs:xc,ue("fail"),ue("zfail"),ue("zpass")]});case yb:return re(function(U){L.commandType(U,"object",Q,R.commandStr);var q=U.factor|0,z=U.units|0;return L.commandType(q,"number",Q+".factor",R.commandStr),L.commandType(z,"number",Q+".units",R.commandStr),[q,z]},function(U,q,z){L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid "+ee)});var ne=q.def(z,".factor|0"),ue=q.def(z,".units|0");return[ne,ue]});case hD:return re(function(U){var q=0;return U==="front"?q=xc:U==="back"&&(q=Fs),L.command(!!q,Q,R.commandStr),q},function(U,q,z){return L.optional(function(){U.assert(q,z+'==="front"||'+z+'==="back"',"invalid cull.face")}),q.def(z,'==="front"?',xc,":",Fs)});case gb:return re(function(U){return L.command(typeof U=="number"&&U>=ce.lineWidthDims[0]&&U<=ce.lineWidthDims[1],"invalid line width, must be a positive number between "+ce.lineWidthDims[0]+" and "+ce.lineWidthDims[1],R.commandStr),U},function(U,q,z){return L.optional(function(){U.assert(q,"typeof "+z+'==="number"&&'+z+">="+ce.lineWidthDims[0]+"&&"+z+"<="+ce.lineWidthDims[1],"invalid line width")}),z});case pb:return re(function(U){return L.commandParameter(U,Ab,Q,R.commandStr),Ab[U]},function(U,q,z){return L.optional(function(){U.assert(q,z+'==="cw"||'+z+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),q.def(z+'==="cw"?'+SD+":"+Cb)});case vb:return re(function(U){return L.command(Lr(U)&&U.length===4,"color.mask must be length 4 array",R.commandStr),U.map(function(q){return!!q})},function(U,q,z){return L.optional(function(){U.assert(q,U.shared.isArrayLike+"("+z+")&&"+z+".length===4","invalid color.mask")}),pn(4,function(ne){return"!!"+z+"["+ne+"]"})});case mb:return re(function(U){L.command(typeof U=="object"&&U,Q,R.commandStr);var q="value"in U?U.value:1,z=!!U.invert;return L.command(typeof q=="number"&&q>=0&&q<=1,"sample.coverage.value must be a number between 0 and 1",R.commandStr),[q,z]},function(U,q,z){L.optional(function(){U.assert(q,z+"&&typeof "+z+'==="object"',"invalid sample.coverage")});var ne=q.def('"value" in ',z,"?+",z,".value:1"),ue=q.def("!!",z,".invert");return[ne,ue]})}}),se}function Qr(j,R){var Z=j.static,ie=j.dynamic,se={};return Object.keys(Z).forEach(function(ee){var Q=Z[ee],re;if(typeof Q=="number"||typeof Q=="boolean")re=Fr(function(){return Q});else if(typeof Q=="function"){var U=Q._reglType;U==="texture2d"||U==="textureCube"?re=Fr(function(q){return q.link(Q)}):U==="framebuffer"||U==="framebufferCube"?(L.command(Q.color.length>0,'missing color attachment for framebuffer sent to uniform "'+ee+'"',R.commandStr),re=Fr(function(q){return q.link(Q.color[0])})):L.commandRaise('invalid data for uniform "'+ee+'"',R.commandStr)}else Lr(Q)?re=Fr(function(q){var z=q.global.def("[",pn(Q.length,function(ne){return L.command(typeof Q[ne]=="number"||typeof Q[ne]=="boolean","invalid uniform "+ee,q.commandStr),Q[ne]}),"]");return z}):L.commandRaise('invalid or missing data for uniform "'+ee+'"',R.commandStr);re.value=Q,se[ee]=re}),Object.keys(ie).forEach(function(ee){var Q=ie[ee];se[ee]=jn(Q,function(re,U){return re.invoke(U,Q)})}),se}function Xt(j,R){var Z=j.static,ie=j.dynamic,se={};return Object.keys(Z).forEach(function(ee){var Q=Z[ee],re=F.id(ee),U=new oe;if(pp(Q))U.state=Ju,U.buffer=we.getBuffer(we.create(Q,rf,!1,!0)),U.type=0;else{var q=we.getBuffer(Q);if(q)U.state=Ju,U.buffer=q,U.type=0;else if(L.command(typeof Q=="object"&&Q,"invalid data for attribute "+ee,R.commandStr),"constant"in Q){var z=Q.constant;U.buffer="null",U.state=sb,typeof z=="number"?U.x=z:(L.command(Lr(z)&&z.length>0&&z.length<=4,"invalid constant for attribute "+ee,R.commandStr),Qu.forEach(function(lt,Dt){Dt=0,'invalid offset for attribute "'+ee+'"',R.commandStr);var ue=Q.stride|0;L.command(ue>=0&&ue<256,'invalid stride for attribute "'+ee+'", must be integer betweeen [0, 255]',R.commandStr);var be=Q.size|0;L.command(!("size"in Q)||be>0&&be<=4,'invalid size for attribute "'+ee+'", must be 1,2,3,4',R.commandStr);var Ee=!!Q.normalized,ge=0;"type"in Q&&(L.commandParameter(Q.type,Is,"invalid type for attribute "+ee,R.commandStr),ge=Is[Q.type]);var Re=Q.divisor|0;"divisor"in Q&&(L.command(Re===0||Be,'cannot specify divisor for attribute "'+ee+'", instancing not supported',R.commandStr),L.command(Re>=0,'invalid divisor for attribute "'+ee+'"',R.commandStr)),L.optional(function(){var lt=R.commandStr,Dt=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(Q).forEach(function(st){L.command(Dt.indexOf(st)>=0,'unknown parameter "'+st+'" for attribute pointer "'+ee+'" (valid parameters are '+Dt+")",lt)})}),U.buffer=q,U.state=Ju,U.size=be,U.normalized=Ee,U.type=ge||q.dtype,U.offset=ne,U.stride=ue,U.divisor=Re}}se[ee]=Fr(function(lt,Dt){var st=lt.attribCache;if(re in st)return st[re];var wt={isStream:!1};return Object.keys(U).forEach(function(Lt){wt[Lt]=U[Lt]}),U.buffer&&(wt.buffer=lt.link(U.buffer),wt.type=wt.type||wt.buffer+".dtype"),st[re]=wt,wt})}),Object.keys(ie).forEach(function(ee){var Q=ie[ee];function re(U,q){var z=U.invoke(q,Q),ne=U.shared,ue=U.constants,be=ne.isBufferArgs,Ee=ne.buffer;L.optional(function(){U.assert(q,z+"&&(typeof "+z+'==="object"||typeof '+z+'==="function")&&('+be+"("+z+")||"+Ee+".getBuffer("+z+")||"+Ee+".getBuffer("+z+".buffer)||"+be+"("+z+'.buffer)||("constant" in '+z+"&&(typeof "+z+'.constant==="number"||'+ne.isArrayLike+"("+z+".constant))))",'invalid dynamic attribute "'+ee+'"')});var ge={isStream:q.def(!1)},Re=new oe;Re.state=Ju,Object.keys(Re).forEach(function(wt){ge[wt]=q.def(""+Re[wt])});var lt=ge.buffer,Dt=ge.type;q("if(",be,"(",z,")){",ge.isStream,"=true;",lt,"=",Ee,".createStream(",rf,",",z,");",Dt,"=",lt,".dtype;","}else{",lt,"=",Ee,".getBuffer(",z,");","if(",lt,"){",Dt,"=",lt,".dtype;",'}else if("constant" in ',z,"){",ge.state,"=",sb,";","if(typeof "+z+'.constant === "number"){',ge[Qu[0]],"=",z,".constant;",Qu.slice(1).map(function(wt){return ge[wt]}).join("="),"=0;","}else{",Qu.map(function(wt,Lt){return ge[wt]+"="+z+".constant.length>"+Lt+"?"+z+".constant["+Lt+"]:0;"}).join(""),"}}else{","if(",be,"(",z,".buffer)){",lt,"=",Ee,".createStream(",rf,",",z,".buffer);","}else{",lt,"=",Ee,".getBuffer(",z,".buffer);","}",Dt,'="type" in ',z,"?",ue.glTypes,"[",z,".type]:",lt,".dtype;",ge.normalized,"=!!",z,".normalized;");function st(wt){q(ge[wt],"=",z,".",wt,"|0;")}return st("size"),st("offset"),st("stride"),st("divisor"),q("}}"),q.exit("if(",ge.isStream,"){",Ee,".destroyStream(",lt,");","}"),ge}se[ee]=jn(Q,re)}),se}function Xr(j,R){var Z=j.static,ie=j.dynamic;if(vc in Z){var se=Z[vc];return se!==null&&Fe.getVAO(se)===null&&(se=Fe.createVAO(se)),Fr(function(Q){return Q.link(Fe.getVAO(se))})}else if(vc in ie){var ee=ie[vc];return jn(ee,function(Q,re){var U=Q.invoke(re,ee);return re.def(Q.shared.vao+".getVAO("+U+")")})}return null}function mr(j){var R=j.static,Z=j.dynamic,ie={};return Object.keys(R).forEach(function(se){var ee=R[se];ie[se]=Fr(function(Q,re){return typeof ee=="number"||typeof ee=="boolean"?""+ee:Q.link(ee)})}),Object.keys(Z).forEach(function(se){var ee=Z[se];ie[se]=jn(ee,function(Q,re){return Q.invoke(re,ee)})}),ie}function zr(j,R,Z,ie,se){var ee=j.static,Q=j.dynamic;L.optional(function(){var st=[Ds,hc,dc,Ps,Rs,ip,Bs,ap,cc,vc].concat(Ae);function wt(Lt){Object.keys(Lt).forEach(function(nr){L.command(st.indexOf(nr)>=0,'unknown parameter "'+nr+'"',se.commandStr)})}wt(ee),wt(Q)});var re=kt(j,R),U=ot(j),q=Gt(j,U,se),z=rr(j,se),ne=Gr(j,se),ue=Bt(j,se,re);function be(st){var wt=q[st];wt&&(ne[st]=wt)}be(Za),be(Xe(np));var Ee=Object.keys(ne).length>0,ge={framebuffer:U,draw:z,shader:ue,state:ne,dirty:Ee,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(ge.profile=Nt(j),ge.uniforms=Qr(Z,se),ge.drawVAO=ge.scopeVAO=Xr(j),!ge.drawVAO&&ue.program&&!re&&V.angle_instanced_arrays){var Re=!0,lt=ue.program.attributes.map(function(st){var wt=R.static[st];return Re=Re&&!!wt,wt});if(Re&<.length>0){var Dt=Fe.getVAO(Fe.createVAO(lt));ge.drawVAO=new Ln(null,null,null,function(st,wt){return st.link(Dt)}),ge.useVAO=!0}}return re?ge.useVAO=!0:ge.attributes=Xt(R,se),ge.context=mr(ie),ge}function Yr(j,R,Z){var ie=j.shared,se=ie.context,ee=j.scope();Object.keys(Z).forEach(function(Q){R.save(se,"."+Q);var re=Z[Q],U=re.append(j,R);Array.isArray(U)?ee(se,".",Q,"=[",U.join(),"];"):ee(se,".",Q,"=",U,";")}),R(ee)}function Wr(j,R,Z,ie){var se=j.shared,ee=se.gl,Q=se.framebuffer,re;Ke&&(re=R.def(se.extensions,".webgl_draw_buffers"));var U=j.constants,q=U.drawBuffer,z=U.backBuffer,ne;Z?ne=Z.append(j,R):ne=R.def(Q,".next"),ie||R("if(",ne,"!==",Q,".cur){"),R("if(",ne,"){",ee,".bindFramebuffer(",TD,",",ne,".framebuffer);"),Ke&&R(re,".drawBuffersWEBGL(",q,"[",ne,".colorAttachments.length]);"),R("}else{",ee,".bindFramebuffer(",TD,",null);"),Ke&&R(re,".drawBuffersWEBGL(",z,");"),R("}",Q,".cur=",ne,";"),ie||R("}")}function sn(j,R,Z){var ie=j.shared,se=ie.gl,ee=j.current,Q=j.next,re=ie.current,U=ie.next,q=j.cond(re,".dirty");Ae.forEach(function(z){var ne=Xe(z);if(!(ne in Z.state)){var ue,be;if(ne in Q){ue=Q[ne],be=ee[ne];var Ee=pn(Me[ne].length,function(Re){return q.def(ue,"[",Re,"]")});q(j.cond(Ee.map(function(Re,lt){return Re+"!=="+be+"["+lt+"]"}).join("||")).then(se,".",Ce[ne],"(",Ee,");",Ee.map(function(Re,lt){return be+"["+lt+"]="+Re}).join(";"),";"))}else{ue=q.def(U,".",ne);var ge=j.cond(ue,"!==",re,".",ne);q(ge),ne in Ue?ge(j.cond(ue).then(se,".enable(",Ue[ne],");").else(se,".disable(",Ue[ne],");"),re,".",ne,"=",ue,";"):ge(se,".",Ce[ne],"(",ue,");",re,".",ne,"=",ue,";")}}}),Object.keys(Z.state).length===0&&q(re,".dirty=false;"),R(q)}function yn(j,R,Z,ie){var se=j.shared,ee=j.current,Q=se.current,re=se.gl;LD(Object.keys(Z)).forEach(function(U){var q=Z[U];if(!(ie&&!ie(q))){var z=q.append(j,R);if(Ue[U]){var ne=Ue[U];Fo(q)?z?R(re,".enable(",ne,");"):R(re,".disable(",ne,");"):R(j.cond(z).then(re,".enable(",ne,");").else(re,".disable(",ne,");")),R(Q,".",U,"=",z,";")}else if(Lr(z)){var ue=ee[U];R(re,".",Ce[U],"(",z,");",z.map(function(be,Ee){return ue+"["+Ee+"]="+be}).join(";"),";")}else R(re,".",Ce[U],"(",z,");",Q,".",U,"=",z,";")}})}function Nr(j,R){Be&&(j.instancing=R.def(j.shared.extensions,".angle_instanced_arrays"))}function Ot(j,R,Z,ie,se){var ee=j.shared,Q=j.stats,re=ee.current,U=ee.timer,q=Z.profile;function z(){return typeof performance>"u"?"Date.now()":"performance.now()"}var ne,ue;function be(st){ne=R.def(),st(ne,"=",z(),";"),typeof se=="string"?st(Q,".count+=",se,";"):st(Q,".count++;"),ke&&(ie?(ue=R.def(),st(ue,"=",U,".getNumPendingQueries();")):st(U,".beginQuery(",Q,");"))}function Ee(st){st(Q,".cpuTime+=",z(),"-",ne,";"),ke&&(ie?st(U,".pushScopeStats(",ue,",",U,".getNumPendingQueries(),",Q,");"):st(U,".endQuery();"))}function ge(st){var wt=R.def(re,".profile");R(re,".profile=",st,";"),R.exit(re,".profile=",wt,";")}var Re;if(q){if(Fo(q)){q.enable?(be(R),Ee(R.exit),ge("true")):ge("false");return}Re=q.append(j,R),ge(Re)}else Re=R.def(re,".profile");var lt=j.block();be(lt),R("if(",Re,"){",lt,"}");var Dt=j.block();Ee(Dt),R.exit("if(",Re,"){",Dt,"}")}function mn(j,R,Z,ie,se){var ee=j.shared;function Q(U){switch(U){case op:case fp:case hp:return 2;case sp:case lp:case dp:return 3;case up:case cp:case vp:return 4;default:return 1}}function re(U,q,z){var ne=ee.gl,ue=R.def(U,".location"),be=R.def(ee.attributes,"[",ue,"]"),Ee=z.state,ge=z.buffer,Re=[z.x,z.y,z.z,z.w],lt=["buffer","normalized","offset","stride"];function Dt(){R("if(!",be,".buffer){",ne,".enableVertexAttribArray(",ue,");}");var wt=z.type,Lt;if(z.size?Lt=R.def(z.size,"||",q):Lt=q,R("if(",be,".type!==",wt,"||",be,".size!==",Lt,"||",lt.map(function(Tr){return be+"."+Tr+"!=="+z[Tr]}).join("||"),"){",ne,".bindBuffer(",rf,",",ge,".buffer);",ne,".vertexAttribPointer(",[ue,Lt,wt,z.normalized,z.stride,z.offset],");",be,".type=",wt,";",be,".size=",Lt,";",lt.map(function(Tr){return be+"."+Tr+"="+z[Tr]+";"}).join(""),"}"),Be){var nr=z.divisor;R("if(",be,".divisor!==",nr,"){",j.instancing,".vertexAttribDivisorANGLE(",[ue,nr],");",be,".divisor=",nr,";}")}}function st(){R("if(",be,".buffer){",ne,".disableVertexAttribArray(",ue,");",be,".buffer=null;","}if(",Qu.map(function(wt,Lt){return be+"."+wt+"!=="+Re[Lt]}).join("||"),"){",ne,".vertexAttrib4f(",ue,",",Re,");",Qu.map(function(wt,Lt){return be+"."+wt+"="+Re[Lt]+";"}).join(""),"}")}Ee===Ju?Dt():Ee===sb?st():(R("if(",Ee,"===",Ju,"){"),Dt(),R("}else{"),st(),R("}"))}ie.forEach(function(U){var q=U.name,z=Z.attributes[q],ne;if(z){if(!se(z))return;ne=z.append(j,R)}else{if(!se(ND))return;var ue=j.scopeAttrib(q);L.optional(function(){j.assert(R,ue+".state","missing attribute "+q)}),ne={},Object.keys(new oe).forEach(function(be){ne[be]=R.def(ue,".",be)})}re(j.link(U),Q(U.info.type),ne)})}function sr(j,R,Z,ie,se){for(var ee=j.shared,Q=ee.gl,re,U=0;U1?R(pn(wt,function(Nn){return Array.isArray(ge)?ge[Nn]:ge+"["+Nn+"]"})):(L(!Array.isArray(ge),"uniform value must not be an array"),R(ge));R(");")}}function mt(j,R,Z,ie){var se=j.shared,ee=se.gl,Q=se.draw,re=ie.draw;function U(){var Lt=re.elements,nr,Tr=R;return Lt?((Lt.contextDep&&ie.contextDynamic||Lt.propDep)&&(Tr=Z),nr=Lt.append(j,Tr)):nr=Tr.def(Q,".",Ps),nr&&Tr("if("+nr+")"+ee+".bindBuffer("+gde+","+nr+".buffer.buffer);"),nr}function q(){var Lt=re.count,nr,Tr=R;return Lt?((Lt.contextDep&&ie.contextDynamic||Lt.propDep)&&(Tr=Z),nr=Lt.append(j,Tr),L.optional(function(){Lt.MISSING&&j.assert(R,"false","missing vertex count"),Lt.DYNAMIC&&j.assert(Tr,nr+">=0","missing vertex count")})):(nr=Tr.def(Q,".",Bs),L.optional(function(){j.assert(Tr,nr+">=0","missing vertex count")})),nr}var z=U();function ne(Lt){var nr=re[Lt];return nr?nr.contextDep&&ie.contextDynamic||nr.propDep?nr.append(j,Z):nr.append(j,R):R.def(Q,".",Lt)}var ue=ne(Rs),be=ne(ip),Ee=q();if(typeof Ee=="number"){if(Ee===0)return}else Z("if(",Ee,"){"),Z.exit("}");var ge,Re;Be&&(ge=ne(ap),Re=j.instancing);var lt=z+".type",Dt=re.elements&&Fo(re.elements);function st(){function Lt(){Z(Re,".drawElementsInstancedANGLE(",[ue,Ee,lt,be+"<<(("+lt+"-"+tD+")>>1)",ge],");")}function nr(){Z(Re,".drawArraysInstancedANGLE(",[ue,be,Ee,ge],");")}z?Dt?Lt():(Z("if(",z,"){"),Lt(),Z("}else{"),nr(),Z("}")):nr()}function wt(){function Lt(){Z(ee+".drawElements("+[ue,Ee,lt,be+"<<(("+lt+"-"+tD+")>>1)"]+");")}function nr(){Z(ee+".drawArrays("+[ue,be,Ee]+");")}z?Dt?Lt():(Z("if(",z,"){"),Lt(),Z("}else{"),nr(),Z("}")):nr()}Be&&(typeof ge!="number"||ge>=0)?typeof ge=="string"?(Z("if(",ge,">0){"),st(),Z("}else if(",ge,"<0){"),wt(),Z("}")):st():wt()}function $t(j,R,Z,ie,se){var ee=Ct(),Q=ee.proc("body",se);return L.optional(function(){ee.commandStr=R.commandStr,ee.command=ee.link(R.commandStr)}),Be&&(ee.instancing=Q.def(ee.shared.extensions,".angle_instanced_arrays")),j(ee,Q,Z,ie),ee.compile().body}function Qt(j,R,Z,ie){Nr(j,R),Z.useVAO?Z.drawVAO?R(j.shared.vao,".setVAO(",Z.drawVAO.append(j,R),");"):R(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(R(j.shared.vao,".setVAO(null);"),mn(j,R,Z,ie.attributes,function(){return!0})),sr(j,R,Z,ie.uniforms,function(){return!0}),mt(j,R,R,Z)}function Or(j,R){var Z=j.proc("draw",1);Nr(j,Z),Yr(j,Z,R.context),Wr(j,Z,R.framebuffer),sn(j,Z,R),yn(j,Z,R.state),Ot(j,Z,R,!1,!0);var ie=R.shader.progVar.append(j,Z);if(Z(j.shared.gl,".useProgram(",ie,".program);"),R.shader.program)Qt(j,Z,R,R.shader.program);else{Z(j.shared.vao,".setVAO(null);");var se=j.global.def("{}"),ee=Z.def(ie,".id"),Q=Z.def(se,"[",ee,"]");Z(j.cond(Q).then(Q,".call(this,a0);").else(Q,"=",se,"[",ee,"]=",j.link(function(re){return $t(Qt,j,R,re,1)}),"(",ie,");",Q,".call(this,a0);"))}Object.keys(R.state).length>0&&Z(j.shared.current,".dirty=true;")}function wa(j,R,Z,ie){j.batchId="a1",Nr(j,R);function se(){return!0}mn(j,R,Z,ie.attributes,se),sr(j,R,Z,ie.uniforms,se),mt(j,R,R,Z)}function Gs(j,R,Z,ie){Nr(j,R);var se=Z.contextDep,ee=R.def(),Q="a0",re="a1",U=R.def();j.shared.props=U,j.batchId=ee;var q=j.scope(),z=j.scope();R(q.entry,"for(",ee,"=0;",ee,"<",re,";++",ee,"){",U,"=",Q,"[",ee,"];",z,"}",q.exit);function ne(lt){return lt.contextDep&&se||lt.propDep}function ue(lt){return!ne(lt)}if(Z.needsContext&&Yr(j,z,Z.context),Z.needsFramebuffer&&Wr(j,z,Z.framebuffer),yn(j,z,Z.state,ne),Z.profile&&ne(Z.profile)&&Ot(j,z,Z,!1,!0),ie)Z.useVAO?Z.drawVAO?ne(Z.drawVAO)?z(j.shared.vao,".setVAO(",Z.drawVAO.append(j,z),");"):q(j.shared.vao,".setVAO(",Z.drawVAO.append(j,q),");"):q(j.shared.vao,".setVAO(",j.shared.vao,".targetVAO);"):(q(j.shared.vao,".setVAO(null);"),mn(j,q,Z,ie.attributes,ue),mn(j,z,Z,ie.attributes,ne)),sr(j,q,Z,ie.uniforms,ue),sr(j,z,Z,ie.uniforms,ne),mt(j,q,z,Z);else{var be=j.global.def("{}"),Ee=Z.shader.progVar.append(j,z),ge=z.def(Ee,".id"),Re=z.def(be,"[",ge,"]");z(j.shared.gl,".useProgram(",Ee,".program);","if(!",Re,"){",Re,"=",be,"[",ge,"]=",j.link(function(lt){return $t(wa,j,Z,lt,2)}),"(",Ee,");}",Re,".call(this,a0[",ee,"],",ee,");")}}function X(j,R){var Z=j.proc("batch",2);j.batchId="0",Nr(j,Z);var ie=!1,se=!0;Object.keys(R.context).forEach(function(be){ie=ie||R.context[be].propDep}),ie||(Yr(j,Z,R.context),se=!1);var ee=R.framebuffer,Q=!1;ee?(ee.propDep?ie=Q=!0:ee.contextDep&&ie&&(Q=!0),Q||Wr(j,Z,ee)):Wr(j,Z,null),R.state.viewport&&R.state.viewport.propDep&&(ie=!0);function re(be){return be.contextDep&&ie||be.propDep}sn(j,Z,R),yn(j,Z,R.state,function(be){return!re(be)}),(!R.profile||!re(R.profile))&&Ot(j,Z,R,!1,"a1"),R.contextDep=ie,R.needsContext=se,R.needsFramebuffer=Q;var U=R.shader.progVar;if(U.contextDep&&ie||U.propDep)Gs(j,Z,R,null);else{var q=U.append(j,Z);if(Z(j.shared.gl,".useProgram(",q,".program);"),R.shader.program)Gs(j,Z,R,R.shader.program);else{Z(j.shared.vao,".setVAO(null);");var z=j.global.def("{}"),ne=Z.def(q,".id"),ue=Z.def(z,"[",ne,"]");Z(j.cond(ue).then(ue,".call(this,a0,a1);").else(ue,"=",z,"[",ne,"]=",j.link(function(be){return $t(Gs,j,R,be,2)}),"(",q,");",ue,".call(this,a0,a1);"))}}Object.keys(R.state).length>0&&Z(j.shared.current,".dirty=true;")}function he(j,R){var Z=j.proc("scope",3);j.batchId="a2";var ie=j.shared,se=ie.current;Yr(j,Z,R.context),R.framebuffer&&R.framebuffer.append(j,Z),LD(Object.keys(R.state)).forEach(function(Q){var re=R.state[Q],U=re.append(j,Z);Lr(U)?U.forEach(function(q,z){Z.set(j.next[Q],"["+z+"]",q)}):Z.set(ie.next,"."+Q,U)}),Ot(j,Z,R,!0,!0),[Ps,ip,Bs,ap,Rs].forEach(function(Q){var re=R.draw[Q];re&&Z.set(ie.draw,"."+Q,""+re.append(j,Z))}),Object.keys(R.uniforms).forEach(function(Q){var re=R.uniforms[Q].append(j,Z);Array.isArray(re)&&(re="["+re.join()+"]"),Z.set(ie.uniforms,"["+F.id(Q)+"]",re)}),Object.keys(R.attributes).forEach(function(Q){var re=R.attributes[Q].append(j,Z),U=j.scopeAttrib(Q);Object.keys(new oe).forEach(function(q){Z.set(U,"."+q,re[q])})}),R.scopeVAO&&Z.set(ie.vao,".targetVAO",R.scopeVAO.append(j,Z));function ee(Q){var re=R.shader[Q];re&&Z.set(ie.shader,"."+Q,re.append(j,Z))}ee(hc),ee(dc),Object.keys(R.state).length>0&&(Z(se,".dirty=true;"),Z.exit(se,".dirty=true;")),Z("a1(",j.shared.context,",a0,",j.batchId,");")}function fe(j){if(!(typeof j!="object"||Lr(j))){for(var R=Object.keys(j),Z=0;Z=0;--mt){var $t=_e[mt];$t&&$t(ke,null,0)}V.flush(),Fe&&Fe.update()}function Bt(){!Gt&&_e.length>0&&(Gt=ur.next(kt))}function rr(){Gt&&(ur.cancel(kt),Gt=null)}function Gr(mt){mt.preventDefault(),we=!0,rr(),Ct.forEach(function($t){$t()})}function Qr(mt){V.getError(),we=!1,le.restore(),Ae.restore(),Be.restore(),Ue.restore(),Ce.restore(),Xe.restore(),Ke.restore(),Fe&&Fe.restore(),pt.procs.refresh(),Bt(),Nt.forEach(function($t){$t()})}ze&&(ze.addEventListener(DD,Gr,!1),ze.addEventListener(PD,Qr,!1));function Xt(){_e.length=0,rr(),ze&&(ze.removeEventListener(DD,Gr),ze.removeEventListener(PD,Qr)),Ae.clear(),Xe.clear(),Ce.clear(),Ue.clear(),rt.clear(),Be.clear(),Ke.clear(),Fe&&Fe.clear(),ot.forEach(function(mt){mt()})}function Xr(mt){L(!!mt,"invalid args to regl({...})"),L.type(mt,"object","invalid args to regl({...})");function $t(se){var ee=n({},se);delete ee.uniforms,delete ee.attributes,delete ee.context,delete ee.vao,"stencil"in ee&&ee.stencil.op&&(ee.stencil.opBack=ee.stencil.opFront=ee.stencil.op,delete ee.stencil.op);function Q(re){if(re in ee){var U=ee[re];delete ee[re],Object.keys(U).forEach(function(q){ee[re+"."+q]=U[q]})}}return Q("blend"),Q("depth"),Q("cull"),Q("stencil"),Q("polygonOffset"),Q("scissor"),Q("sample"),"vao"in se&&(ee.vao=se.vao),ee}function Qt(se,ee){var Q={},re={};return Object.keys(se).forEach(function(U){var q=se[U];if(hr.isDynamic(q)){re[U]=hr.unbox(q,U);return}else if(ee&&Array.isArray(q)){for(var z=0;z0)return zt.call(this,Z(se|0),se|0)}else if(Array.isArray(se)){if(se.length)return zt.call(this,se,se.length)}else return it.call(this,se)}return n(ie,{stats:he,destroy:function(){fe.destroy()}})}var mr=Xe.setFBO=Xr({framebuffer:hr.define.call(null,RD,"framebuffer")});function zr(mt,$t){var Qt=0;pt.procs.poll();var Or=$t.color;Or&&(V.clearColor(+Or[0]||0,+Or[1]||0,+Or[2]||0,+Or[3]||0),Qt|=Gde),"depth"in $t&&(V.clearDepth(+$t.depth),Qt|=zde),"stencil"in $t&&(V.clearStencil($t.stencil|0),Qt|=$de),L(!!Qt,"called regl.clear with no buffer specified"),V.clear(Qt)}function Yr(mt){if(L(typeof mt=="object"&&mt,"regl.clear() takes an object as input"),"framebuffer"in mt)if(mt.framebuffer&&mt.framebuffer_reglType==="framebufferCube")for(var $t=0;$t<6;++$t)mr(n({framebuffer:mt.framebuffer.faces[$t]},mt),zr);else mr(mt,zr);else zr(null,mt)}function Wr(mt){L.type(mt,"function","regl.frame() callback must be a function"),_e.push(mt);function $t(){var Qt=BD(_e,mt);L(Qt>=0,"cannot cancel a frame twice");function Or(){var wa=BD(_e,Or);_e[wa]=_e[_e.length-1],_e.length-=1,_e.length<=0&&rr()}_e[Qt]=Or}return Bt(),{cancel:$t}}function sn(){var mt=He.viewport,$t=He.scissor_box;mt[0]=mt[1]=$t[0]=$t[1]=0,ke.viewportWidth=ke.framebufferWidth=ke.drawingBufferWidth=mt[2]=$t[2]=V.drawingBufferWidth,ke.viewportHeight=ke.framebufferHeight=ke.drawingBufferHeight=mt[3]=$t[3]=V.drawingBufferHeight}function yn(){ke.tick+=1,ke.time=Ot(),sn(),pt.procs.poll()}function Nr(){Ue.refresh(),sn(),pt.procs.refresh(),Fe&&Fe.update()}function Ot(){return(xr()-De)/1e3}Nr();function mn(mt,$t){L.type($t,"function","listener callback must be a function");var Qt;switch(mt){case"frame":return Wr($t);case"lost":Qt=Ct;break;case"restore":Qt=Nt;break;case"destroy":Qt=ot;break;default:L.raise("invalid event, must be one of frame,lost,restore,destroy")}return Qt.push($t),{cancel:function(){for(var Or=0;Or=0},read:Tt,destroy:Xt,_gl:V,_refresh:Nr,poll:function(){yn(),Fe&&Fe.update()},now:Ot,stats:Ie});return F.onDone(null,sr),sr}return Yde})})(Ik);var lie=Ik.exports;const cie=Ji(lie);var hie=function(){function r(e,t){Oi(this,r),this.attribute=void 0,this.buffer=void 0;var n=t.buffer,i=t.offset,a=t.stride,o=t.normalized,s=t.size,u=t.divisor;this.buffer=n,this.attribute={buffer:n.get(),offset:i||0,stride:a||0,normalized:o||!1,divisor:u||0},s&&(this.attribute.size=s)}return Di(r,[{key:"get",value:function(){return this.attribute}},{key:"updateBuffer",value:function(t){this.buffer.subData(t)}},{key:"destroy",value:function(){this.buffer.destroy()}}]),r}(),Fa,Il,Ga,vi,kl,So,Ll,vv,fa,gs,wn,la,ca,pv,die=(Fa={},Je(Fa,Le.POINTS,"points"),Je(Fa,Le.LINES,"lines"),Je(Fa,Le.LINE_LOOP,"line loop"),Je(Fa,Le.LINE_STRIP,"line strip"),Je(Fa,Le.TRIANGLES,"triangles"),Je(Fa,Le.TRIANGLE_FAN,"triangle fan"),Je(Fa,Le.TRIANGLE_STRIP,"triangle strip"),Fa),kk=(Il={},Je(Il,Le.STATIC_DRAW,"static"),Je(Il,Le.DYNAMIC_DRAW,"dynamic"),Je(Il,Le.STREAM_DRAW,"stream"),Il),$m=(Ga={},Je(Ga,Le.BYTE,"int8"),Je(Ga,Le.UNSIGNED_INT,"int16"),Je(Ga,Le.INT,"int32"),Je(Ga,Le.UNSIGNED_BYTE,"uint8"),Je(Ga,Le.UNSIGNED_SHORT,"uint16"),Je(Ga,Le.UNSIGNED_INT,"uint32"),Je(Ga,Le.FLOAT,"float"),Ga),vie=(vi={},Je(vi,Le.ALPHA,"alpha"),Je(vi,Le.LUMINANCE,"luminance"),Je(vi,Le.LUMINANCE_ALPHA,"luminance alpha"),Je(vi,Le.RGB,"rgb"),Je(vi,Le.RGBA,"rgba"),Je(vi,Le.RGBA4,"rgba4"),Je(vi,Le.RGB5_A1,"rgb5 a1"),Je(vi,Le.RGB565,"rgb565"),Je(vi,Le.DEPTH_COMPONENT,"depth"),Je(vi,Le.DEPTH_STENCIL,"depth stencil"),vi),pie=(kl={},Je(kl,Le.DONT_CARE,"dont care"),Je(kl,Le.NICEST,"nice"),Je(kl,Le.FASTEST,"fast"),kl),Lk=(So={},Je(So,Le.NEAREST,"nearest"),Je(So,Le.LINEAR,"linear"),Je(So,Le.LINEAR_MIPMAP_LINEAR,"mipmap"),Je(So,Le.NEAREST_MIPMAP_LINEAR,"nearest mipmap linear"),Je(So,Le.LINEAR_MIPMAP_NEAREST,"linear mipmap nearest"),Je(So,Le.NEAREST_MIPMAP_NEAREST,"nearest mipmap nearest"),So),Nk=(Ll={},Je(Ll,Le.REPEAT,"repeat"),Je(Ll,Le.CLAMP_TO_EDGE,"clamp"),Je(Ll,Le.MIRRORED_REPEAT,"mirror"),Ll),gie=(vv={},Je(vv,Le.NONE,"none"),Je(vv,Le.BROWSER_DEFAULT_WEBGL,"browser"),vv),yie=(fa={},Je(fa,Le.NEVER,"never"),Je(fa,Le.ALWAYS,"always"),Je(fa,Le.LESS,"less"),Je(fa,Le.LEQUAL,"lequal"),Je(fa,Le.GREATER,"greater"),Je(fa,Le.GEQUAL,"gequal"),Je(fa,Le.EQUAL,"equal"),Je(fa,Le.NOTEQUAL,"notequal"),fa),Ok=(gs={},Je(gs,Le.FUNC_ADD,"add"),Je(gs,Le.MIN_EXT,"min"),Je(gs,Le.MAX_EXT,"max"),Je(gs,Le.FUNC_SUBTRACT,"subtract"),Je(gs,Le.FUNC_REVERSE_SUBTRACT,"reverse subtract"),gs),gv=(wn={},Je(wn,Le.ZERO,"zero"),Je(wn,Le.ONE,"one"),Je(wn,Le.SRC_COLOR,"src color"),Je(wn,Le.ONE_MINUS_SRC_COLOR,"one minus src color"),Je(wn,Le.SRC_ALPHA,"src alpha"),Je(wn,Le.ONE_MINUS_SRC_ALPHA,"one minus src alpha"),Je(wn,Le.DST_COLOR,"dst color"),Je(wn,Le.ONE_MINUS_DST_COLOR,"one minus dst color"),Je(wn,Le.DST_ALPHA,"dst alpha"),Je(wn,Le.ONE_MINUS_DST_ALPHA,"one minus dst alpha"),Je(wn,Le.CONSTANT_COLOR,"constant color"),Je(wn,Le.ONE_MINUS_CONSTANT_COLOR,"one minus constant color"),Je(wn,Le.CONSTANT_ALPHA,"constant alpha"),Je(wn,Le.ONE_MINUS_CONSTANT_ALPHA,"one minus constant alpha"),Je(wn,Le.SRC_ALPHA_SATURATE,"src alpha saturate"),wn),mie=(la={},Je(la,Le.NEVER,"never"),Je(la,Le.ALWAYS,"always"),Je(la,Le.LESS,"less"),Je(la,Le.LEQUAL,"lequal"),Je(la,Le.GREATER,"greater"),Je(la,Le.GEQUAL,"gequal"),Je(la,Le.EQUAL,"equal"),Je(la,Le.NOTEQUAL,"notequal"),la),Pu=(ca={},Je(ca,Le.ZERO,"zero"),Je(ca,Le.KEEP,"keep"),Je(ca,Le.REPLACE,"replace"),Je(ca,Le.INVERT,"invert"),Je(ca,Le.INCR,"increment"),Je(ca,Le.DECR,"decrement"),Je(ca,Le.INCR_WRAP,"increment wrap"),Je(ca,Le.DECR_WRAP,"decrement wrap"),ca),bie=(pv={},Je(pv,Le.FRONT,"front"),Je(pv,Le.BACK,"back"),pv),xie=function(){function r(e,t){Oi(this,r),this.buffer=void 0;var n=t.data,i=t.usage,a=t.type;this.buffer=e.buffer({data:n,usage:kk[i||Le.STATIC_DRAW],type:$m[a||Le.UNSIGNED_BYTE]})}return Di(r,[{key:"get",value:function(){return this.buffer}},{key:"destroy",value:function(){}},{key:"subData",value:function(t){var n=t.data,i=t.offset;this.buffer.subdata(n,i)}}]),r}();function jm(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t16)throw new Error("invalid data type ".concat(c));i[l]=function(){return f.data}}});var a=this.getOuputDataTexture(),o=a.textureWidth,s=a.texelCount;i.u_OutputTextureSize=[o,o],i.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:i,vert:Cie,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(u)}return Di(r,[{key:"run",value:function(){var t=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(){t.computeCommand()})}},{key:"readData",value:function(){var e=_o(Tn.mark(function n(){var i=this,a,o,s,u,f,l,c,h;return Tn.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(this.reGl({framebuffer:this.texFBO})(function(){a=i.reGl.read()}),!a){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 r;return n.setConfig(t),n.setEngine(new Hie),n}}]),r}();const Gk=ea(Object.freeze(Object.defineProperty({__proto__:null,Kernel:Tk,World:qie},Symbol.toStringTag,{value:"Module"})));var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.arrayToTextureData=Jn.attributesToTextureData=Jn.buildTextureDataWithTwoEdgeAttr=Jn.buildTextureData=Jn.proccessToFunc=void 0;var Zie=Ir(),yv=nd,Kie=function(r,e){var t;return r?(0,Zie.isNumber)(r)?t=function(){return r}:t=r:t=function(){return e||1},t};Jn.proccessToFunc=Kie;var Qie=function(r,e){var t=[],n=[],i={},a=0;for(a=0;a 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] ]; } } } `,ha.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}}',ha.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 ]; } } `,ha.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 rae=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),mv=xe&&xe.__awaiter||function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,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?a(l.value):i(l.value).then(s,u)}f((n=n.apply(r,e||[])).next())})},bv=xe&&xe.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,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]&&(t=0)),t;)try{if(n=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,i=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[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 } } `,da.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}}',da.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]; } } `,da.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 oae=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ym=xe&&xe.__awaiter||function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,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?a(l.value):i(l.value).then(s,u)}f((n=n.apply(r,e||[])).next())})},Wm=xe&&xe.__generator||function(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,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]&&(t=0)),t;)try{if(n=1,i&&(a=f[0]&2?i.return:f[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,f[1])).done)return a;switch(i=0,a&&(f=[f[0]&2,a.value]),f[0]){case 0:case 1:a=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,i=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!a||f[1]>a[0]&&f[1]$.size[1]?$.size[0]:$.size[1];return Y/2}if((0,Yt.isObject)($.size)){var Y=$.size.width>$.size.height?$.size.width:$.size.height;return Y/2}return $.size/2}return 10};else if((0,Yt.isFunction)(g))m=function($){return g($)};else if((0,Yt.isArray)(g)){var x=g[0]>g[1]?g[0]:g[1],w=x/2;m=function($){return w}}else{var E=g/2;m=function($){return E}}this.nodeSize=m;var _=t.comboSpacing,M;(0,Yt.isNumber)(_)?M=function(){return _}:(0,Yt.isFunction)(_)?M=_:M=function(){return 0},this.comboSpacing=M;var C=t.comboPadding,S;(0,Yt.isNumber)(C)?S=function(){return C}:(0,Yt.isArray)(C)?S=function(){return Math.max.apply(null,C)}:(0,Yt.isFunction)(C)?S=C:S=function(){return 0},this.comboPadding=S;var A=this.linkDistance,T;A||(A=10),(0,Yt.isNumber)(A)?T=function($){return A}:T=A,this.linkDistance=T;var k=this.edgeStrength,O;k||(k=1),(0,Yt.isNumber)(k)?O=function($){return k}:O=k,this.edgeStrength=O;var G=this.nodeStrength,D;G||(G=30),(0,Yt.isNumber)(G)?D=function($){return G}:D=G,this.nodeStrength=D},e.prototype.initPos=function(t){var n=this,i=n.nodes;i.forEach(function(a,o){var s=a.comboId,u=t[s];s&&u?(a.x=u.cx+100/(o+1),a.y=u.cy+100/(o+1)):(a.x=100/(o+1),a.y=100/(o+1))})},e.prototype.getComboMap=function(){var t=this,n=t.nodeMap,i=t.comboTrees,a=t.oriComboMap,o={};return(i||[]).forEach(function(s){var u=[];(0,Yt.traverseTreeUp)(s,function(f){if(f.itemType==="node"||!a[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:t.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=a[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,Yt.isNumber)(p.cx)&&(h.cx+=p.cx),(0,Yt.isNumber)(p.cy)&&(h.cy+=p.cy);return}var g=n[v.id];g&&((0,Yt.isNumber)(g.x)&&(h.cx+=g.x),(0,Yt.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(t){var n=this,i=n.gravity,a=n.comboGravity||i,o=this.alpha,s=n.comboTrees,u=n.indexMap,f=n.nodeMap,l=n.comboMap;(s||[]).forEach(function(c){(0,Yt.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,Yt.isNumber)(b.cx)&&(v.cx+=b.cx),b&&(0,Yt.isNumber)(b.cy)&&(v.cy+=b.cy);return}var x=f[m.id],w=x.x-g||.005,E=x.y-y||.005,_=Math.sqrt(w*w+E*E),M=u[x.id],C=a*o/_*p;t[M].x-=w*C,t[M].y-=E*C,(0,Yt.isNumber)(x.x)&&(v.cx+=x.x),(0,Yt.isNumber)(x.y)&&(v.cy+=x.y)}),v.cx/=v.count||1,v.cy/=v.count||1,!0})})},e.prototype.applyCalculate=function(t){var n=this,i=n.comboMap,a=n.nodes,o={};a.forEach(function(u,f){a.forEach(function(l,c){if(!(fb&&(h.minX=b),h.minY>x&&(h.minY=x),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,x=d.r||1,w=g.r||1,E=x+w,_=w*w,M=x*x;if(bo)){var S=n["".concat(p.id,"-").concat(w.id)],A=S.vx,T=S.vy,k=Math.log(Math.abs(w.depth-p.depth)/10)+1||1;k=k<1?1:k,w.comboId!==p.comboId&&(k+=1);var O=k?Math.pow(d,k):1,G=s(w)*u/M*O;if(t[g].x+=A*G,t[g].y+=T*G,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 a.ConcentricLayout({type:"concentric",sortBy:"id"});return y.center=[0,0],y.preventOverlap=!0,y.nodeSpacing=p,(c||[]).forEach(function(m){(0,i.traverseTreeUp)(m,function(b){var x,w=(v==null?void 0:v(b))||10;if((0,i.isArray)(w)&&(w=Math.max.apply(Math,w)),!((x=b.children)===null||x===void 0)&&x.length){var _=b.children.map(function(N){if(N.itemType==="combo")return g[N.id];var P=f[N.id]||{};return e(e({},P),N)}),M=_.map(function(N){return N.id}),C={nodes:_,edges:d.filter(function(N){return M.includes(N.source)&&M.includes(N.target)})},S=1/0;_.forEach(function(N){var P;N.size||(N.size=((P=g[N.id])===null||P===void 0?void 0:P.size)||(h==null?void 0:h(N))||[30,30]),(0,i.isNumber)(N.size)&&(N.size=[N.size,N.size]),S>N.size[0]&&(S=N.size[0]),S>N.size[1]&&(S=N.size[1])}),y.layout(C);var A=(0,i.getLayoutBBox)(_),T=A.minX,k=A.minY,O=A.maxX,G=A.maxY,D={x:(O+T)/2,y:(G+k)/2};C.nodes.forEach(function(N){N.x-=D.x,N.y-=D.y});var $=Math.max(O-T,S)+w*2,Y=Math.max(G-k,S)+w*2;g[b.id]={id:b.id,nodes:_,size:[$,Y]}}else if(b.itemType==="combo"){var E=w?[w*2,w*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,i.isNumber)(c)?d=function(){return c}:(0,i.isFunction)(c)?d=c:d=function(){return 0},this.spacing=d,!l)h=function(b){var x=d(b);if(b.size){if((0,i.isArray)(b.size)){var w=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(w+x)/2}if((0,i.isObject)(b.size)){var w=b.size.width>b.size.height?b.size.width:b.size.height;return(w+x)/2}return(b.size+x)/2}return 10+x/2};else if((0,i.isFunction)(l))h=function(b){var x=l(b),w=d(b);if((0,i.isArray)(b.size)){var E=b.size[0]>b.size[1]?b.size[0]:b.size[1];return(E+w)/2}return((x||10)+w)/2};else if((0,i.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,i.isNumber)(y)?m=function(){return y}:(0,i.isArray)(y)?m=function(){return Math.max.apply(null,y)}:(0,i.isFunction)(y)?m=y:m=function(){return 0},this.comboPadding=m},u.prototype.getType=function(){return"comboCombined"},u}(n.Base);return Dl.ComboCombinedLayout=o,Dl}var Pl={},Vm={};Object.defineProperty(Vm,"__esModule",{value:!0});var vae=function(){function r(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 r.prototype.distanceTo=function(e){var t=this.rx-e.rx,n=this.ry-e.ry;return Math.hypot(t,n)},r.prototype.setPos=function(e,t){this.rx=e,this.ry=t},r.prototype.resetForce=function(){this.fx=0,this.fy=0},r.prototype.addForce=function(e){var t=e.rx-this.rx,n=e.ry-this.ry,i=Math.hypot(t,n);i=i<1e-4?1e-4:i;var a=this.g*(this.degree+1)*(e.degree+1)/i;this.fx+=a*t/i,this.fy+=a*n/i},r.prototype.in=function(e){return e.contains(this.rx,this.ry)},r.prototype.add=function(e){var t=this.mass+e.mass,n=(this.rx*this.mass+e.rx*e.mass)/t,i=(this.ry*this.mass+e.ry*e.mass)/t,a=this.degree+e.degree,o={rx:n,ry:i,mass:t,degree:a};return new r(o)},r}();Vm.default=vae;var Hm={};Object.defineProperty(Hm,"__esModule",{value:!0});var pae=function(){function r(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 r.prototype.getLength=function(){return this.length},r.prototype.contains=function(e,t){var n=this.length/2;return e<=this.xmid+n&&e>=this.xmid-n&&t<=this.ymid+n&&t>=this.ymid-n},r.prototype.NW=function(){var e=this.xmid-this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r.prototype.NE=function(){var e=this.xmid+this.length/4,t=this.ymid+this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r.prototype.SW=function(){var e=this.xmid-this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r.prototype.SE=function(){var e=this.xmid+this.length/4,t=this.ymid-this.length/4,n=this.length/2,i={xmid:e,ymid:t,length:n},a=new r(i);return a},r}();Hm.default=pae;var qm={};Object.defineProperty(qm,"__esModule",{value:!0});var gae=function(){function r(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 r.prototype.insert=function(e){if(this.body==null){this.body=e;return}this._isExternal()?(this.quad&&(this.NW=new r(this.quad.NW()),this.NE=new r(this.quad.NE()),this.SW=new r(this.quad.SW()),this.SE=new r(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))},r.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))},r.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},r.prototype.updateForce=function(e){if(!(this.body==null||e===this.body))if(this._isExternal())e.addForce(this.body);else{var t=this.quad?this.quad.getLength():0,n=this.body.distanceTo(e);t/n250&&(t.barnesHut=!0),t.prune===void 0&&u>100&&(t.prune=!0),this.maxIteration===0&&!t.prune?(o=250,u<=200&&u>100?o=1e3:u>200&&(o=1200),this.maxIteration=o):this.maxIteration===0&&a&&(o=100,u<=200&&u>100?o=500:u>200&&(o=950),this.maxIteration=o),t.kr||(t.kr=50,u>100&&u<=500?t.kr=20:u>500&&(t.kr=1)),t.kg||(t.kg=20,u>100&&u<=500?t.kg=10:u>500&&(t.kg=1)),this.nodes=t.updateNodesByForces(s),i()},e.prototype.updateNodesByForces=function(t){for(var n=this,i=n.edges,a=n.maxIteration,o=n.nodes,s=i.filter(function(_){var M=(0,ja.getEdgeTerminal)(_,"source"),C=(0,ja.getEdgeTerminal)(_,"target");return M!==C}),u=o.length,f=s.length,l=[],c={},h={},d=[],v=0;v0;){for(var w=0;wy||!c)?m=this.getOptRepGraForces(m,x,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(t,n,i,a,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,M=E),f[2*a[y.id]]+=_*w[0],f[2*a[b.id]]-=M*w[0],f[2*a[y.id]+1]+=_*w[1],f[2*a[b.id]+1]-=M*w[1]}}return f},e.prototype.getRepGraForces=function(t,n,i,a,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&&(x=c*(s[g]+1)*(s[y]+1)/b),i[2*g]-=x*m[0],i[2*y]+=x*m[0],i[2*g+1]-=x*m[1],i[2*y+1]+=x*m[1]}var w=[f[g].x-d[0],f[g].y-d[1]],E=Math.hypot(w[0],w[1]);w[0]=w[0]/E,w[1]=w[1]/E;var _=h*(s[g]+1);i[2*g]-=_*w[0],i[2*g+1]-=_*w[1]}return i},e.prototype.getOptRepGraForces=function(t,n,i){for(var a=this,o=a.nodes,s=a.kg,u=a.center,f=a.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 xae.default(y),b=new wae.default(m),p=0;p1.5*E?1.5*E:i);for(var y=0;yC?C:_;var S=_*t[2*y],A=_*t[2*y+1];s[y].x+=S,s[y].y+=A}return{nodes:s,sg:i}},e}(mae.Base);Pl.ForceAtlas2Layout=Eae;var Rl={},Km={},Qm={},Jm={},Fu=xe&&xe.__assign||function(){return Fu=Object.assign||function(r){for(var e,t=1,n=arguments.length;te;n--)for(var i=0;i=e&&(this.additionColumn[i]+=t);for(var n=0;ne;n--)this.cells[i][n+t]=Fu(Fu({},this.cells[i][n]),{dx:i,dy:n+t,x:i*this.CELL_W,y:(n+t)*this.CELL_H}),this.cells[i][n]={dx:i,dy:n,x:i*this.CELL_W,y:n*this.CELL_H,occupied:!1,node:null};for(var n=0;n=e&&(this.additionRow[n]+=t);for(var i=0;ia){for(var d=Math.ceil((f.size[0]+i)/a)-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]+i>o){for(var d=Math.ceil((f.size[1]+i)/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;ut1?(m=i-l,y=s-a,b=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)),x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):0y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):g<-t1?(m=i-l,y=-(f-n),m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y?(y/Math.sin(g)).toFixed(2):m.toFixed(2))):(m=u-o,Math.abs(p)>(a-n)/2?y=n-f:y=p,m>y?b=x=parseFloat(m?(m/Math.cos(g)).toFixed(2):y.toFixed(2)):b=x=parseFloat(y&&g!==0?(y/Math.sin(g)).toFixed(2):m.toFixed(2)));var w=parseFloat(g.toFixed(2)),E=t;return t&&(E=Aaea?e:r,s=i>a?r: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,x=l>=h&&v>=u&&c>=d&&p>=f,w=0,E=0;if(x){E=Math.sqrt(Math.pow(m-g,2)+Math.pow(b-y,2));var _=u>h?u:h,M=f>d?f:d,C=lVk||n.y>Hk)&&(e+=1e12);for(var i=t+1;i150,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-r.x)*(f.x-e.x)<0){s=!1;break}else if((f.y-r.y)*(f.y-e.y)<0){s=!1;break}}return s}function Dae(r,e){for(var t=!1,n=1,i=Iae*n,a=kae*n,o=[i,-i,0,0],s=[0,0,a,-a],u=0;uZk?(l=d,t=!0):(f.x-=o[c],f.y-=s[c])}}return r1>Zk&&(r1*=Lae),t?Qk(r):0}function Jk(r,e){var t=0;(r.x<0||r.y<0||r.x+r.size[0]+20>Vk||r.y+r.size[1]+20>Hk)&&(t+=1e12);for(var n=0;n0&&(s++,!(s>=o));){var u=Dae(r,e);u!==0&&(a=u),i=a-t,t=a,i===0?--n:n=20}return r.forEach(function(f){f.x=f.x-f.size[0]/2,f.y=f.y-f.size[1]/2}),{nodes:r,edges:e}}e1.default=Pae;var n1=xe&&xe.__assign||function(){return n1=Object.assign||function(r){for(var e,t=1,n=arguments.length;t1){var g=n1({},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 $ae.DagreLayout({type:"dagre",ranksep:e.nodeMinGap,nodesep:e.nodeMinGap}),f=u.layout({nodes:o,edges:s}).nodes;t.forEach(function(v){var p=(f||[]).find(function(g){return g.id===v.id});v.x=(p==null?void 0:p.x)||i/2,v.y=(p==null?void 0:p.y)||a/2});var l=JSON.parse(JSON.stringify(t)),c=JSON.parse(JSON.stringify(n)),h=Gu.forceSimulation().nodes(l).force("link",Gu.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",Gu.forceManyBody()).force("center",Gu.forceCenter(i/2,a/2)).force("x",Gu.forceX(i/2)).force("y",Gu.forceY(a/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),d=new Promise(function(v){h.on("end",function(){t.forEach(function(w){var E=l.find(function(_){return _.id===w.id});E&&(w.x=E.x,w.y=E.y)});var p=Math.min.apply(Math,t.map(function(w){return w.x})),g=Math.max.apply(Math,t.map(function(w){return w.x})),y=Math.min.apply(Math,t.map(function(w){return w.y})),m=Math.max.apply(Math,t.map(function(w){return w.y})),b=i/(g-p),x=a/(m-y);t.forEach(function(w){w.x!==void 0&&b<1&&(w.x=(w.x-p)*b),w.y!==void 0&&x<1&&(w.y=(w.y-y)*x)}),t.forEach(function(w){w.sizeTemp=w.size,w.size=[10,10]}),(0,zae.default)(t,n),t.forEach(function(w){w.size=w.sizeTemp||[],delete w.sizeTemp}),(0,Gae.default)({nodes:t,edges:n},e),v()})});return d}Km.default=jae;var Uae=xe&&xe.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Xae=xe&&xe.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Rl,"__esModule",{value:!0}),Rl.ERLayout=void 0;var Yae=Pr,Wae=Xae(Km),Vae=function(r){Uae(e,r);function e(t){var n=r.call(this)||this;return n.width=300,n.height=300,n.nodeMinGap=50,n.onLayoutEnd=function(){},t&&n.updateCfg(t),n}return e.prototype.getDefaultCfg=function(){return{width:300,height:300,nodeMinGap:50}},e.prototype.execute=function(){var t=this,n=t.nodes,i=t.edges;return n==null||n.forEach(function(a){a.size||(a.size=[50,50])}),(0,Wae.default)({nodes:n,edges:i},{width:this.width,height:this.height,nodeMinGap:this.nodeMinGap}).then(function(){t.onLayoutEnd&&t.onLayoutEnd()})},e.prototype.getType=function(){return"er"},e}(Yae.Base);Rl.ERLayout=Vae;var ys={},tL;function Hae(){if(tL)return ys;tL=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.Layouts=ys.Layout=void 0;var r=Ia,e=qf,t=Zf,n=Qf,i=Kf,a=Y0,o=nl,s=fu,u=Om,f=wl,l=El,c=Sl,h=Ml,d=Nl,v=Ol,p=Wk(),g=Pl,y=Rl,m=ll,b=Ir(),x=function(){function w(E){var _=(0,r.getLayoutByName)(E.type);this.layoutInstance=new _(E)}return w.prototype.layout=function(E){return this.layoutInstance.layout(E)},w.prototype.updateCfg=function(E){this.layoutInstance.updateCfg(E)},w.prototype.init=function(E){this.correctLayers(E.nodes),this.layoutInstance.init(E)},w.prototype.correctLayers=function(E){if(E!=null&&E.length){var _=1/0,M=[];if(E.forEach(function(S){(0,b.isString)(S.layer)&&(S.layer=parseInt(S.layer,10)),!(S.layer===void 0||isNaN(S.layer))&&(M.push(S),S.layer<_&&(_=S.layer))}),_<=0){var C=Math.abs(_)+1;M.forEach(function(S){return S.layer+=C})}}},w.prototype.execute=function(){this.layoutInstance.execute()},w.prototype.getDefaultCfg=function(){return this.layoutInstance.getDefaultCfg()},w.prototype.destroy=function(){return this.layoutInstance.destroy()},w}();return ys.Layout=x,ys.Layouts={force:a.ForceLayout,fruchterman:c.FruchtermanLayout,forceAtlas2:g.ForceAtlas2Layout,gForce:i.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:t.RandomLayout,"gForce-gpu":d.GForceGPULayout,"fruchterman-gpu":h.FruchtermanGPULayout,er:y.ERLayout},ys}var rL={};Object.defineProperty(rL,"__esModule",{value:!0});var nL;function iL(){return nL||(nL=1,function(r){var e=xe&&xe.__createBinding||(Object.create?function(E,_,M,C){C===void 0&&(C=M);var S=Object.getOwnPropertyDescriptor(_,M);(!S||("get"in S?!_.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return _[M]}}),Object.defineProperty(E,C,S)}:function(E,_,M,C){C===void 0&&(C=M),E[C]=_[M]}),t=xe&&xe.__exportStar||function(E,_){for(var M in E)M!=="default"&&!Object.prototype.hasOwnProperty.call(_,M)&&e(_,E,M)};Object.defineProperty(r,"__esModule",{value:!0}),r.ERLayout=r.ForceAtlas2Layout=r.ComboCombinedLayout=r.ComboForceLayout=r.GForceGPULayout=r.FruchtermanGPULayout=r.FruchtermanLayout=r.MDSLayout=r.ConcentricLayout=r.RadialLayout=r.DagreCompoundLayout=r.DagreLayout=r.CircularLayout=r.ForceLayout=r.Force2Layout=r.GForceLayout=r.RandomLayout=r.GridLayout=r.Layouts=r.Layout=void 0;var n=qf;Object.defineProperty(r,"GridLayout",{enumerable:!0,get:function(){return n.GridLayout}});var i=Zf;Object.defineProperty(r,"RandomLayout",{enumerable:!0,get:function(){return i.RandomLayout}});var a=Kf;Object.defineProperty(r,"GForceLayout",{enumerable:!0,get:function(){return a.GForceLayout}});var o=Qf;Object.defineProperty(r,"Force2Layout",{enumerable:!0,get:function(){return o.Force2Layout}});var s=Y0;Object.defineProperty(r,"ForceLayout",{enumerable:!0,get:function(){return s.ForceLayout}});var u=nl;Object.defineProperty(r,"CircularLayout",{enumerable:!0,get:function(){return u.CircularLayout}});var f=fu;Object.defineProperty(r,"DagreLayout",{enumerable:!0,get:function(){return f.DagreLayout}});var l=ll;Object.defineProperty(r,"DagreCompoundLayout",{enumerable:!0,get:function(){return l.DagreCompoundLayout}});var c=Om;Object.defineProperty(r,"RadialLayout",{enumerable:!0,get:function(){return c.RadialLayout}});var h=wl;Object.defineProperty(r,"ConcentricLayout",{enumerable:!0,get:function(){return h.ConcentricLayout}});var d=El;Object.defineProperty(r,"MDSLayout",{enumerable:!0,get:function(){return d.MDSLayout}});var v=Sl;Object.defineProperty(r,"FruchtermanLayout",{enumerable:!0,get:function(){return v.FruchtermanLayout}});var p=Ml;Object.defineProperty(r,"FruchtermanGPULayout",{enumerable:!0,get:function(){return p.FruchtermanGPULayout}});var g=Nl;Object.defineProperty(r,"GForceGPULayout",{enumerable:!0,get:function(){return g.GForceGPULayout}});var y=Ol;Object.defineProperty(r,"ComboForceLayout",{enumerable:!0,get:function(){return y.ComboForceLayout}});var m=Wk();Object.defineProperty(r,"ComboCombinedLayout",{enumerable:!0,get:function(){return m.ComboCombinedLayout}});var b=Pl;Object.defineProperty(r,"ForceAtlas2Layout",{enumerable:!0,get:function(){return b.ForceAtlas2Layout}});var x=Rl;Object.defineProperty(r,"ERLayout",{enumerable:!0,get:function(){return x.ERLayout}});var w=Hae();Object.defineProperty(r,"Layout",{enumerable:!0,get:function(){return w.Layout}}),Object.defineProperty(r,"Layouts",{enumerable:!0,get:function(){return w.Layouts}}),t(rL,r)}($0)),$0}(function(r){var e=xe&&xe.__createBinding||(Object.create?function(i,a,o,s){s===void 0&&(s=o);var u=Object.getOwnPropertyDescriptor(a,o);(!u||("get"in u?!a.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,s,u)}:function(i,a,o,s){s===void 0&&(s=o),i[s]=a[o]}),t=xe&&xe.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&e(a,i,o)};Object.defineProperty(r,"__esModule",{value:!0}),r.getLayoutByName=r.unRegisterLayout=r.registerLayout=void 0;var n=Ia;Object.defineProperty(r,"registerLayout",{enumerable:!0,get:function(){return n.registerLayout}}),Object.defineProperty(r,"unRegisterLayout",{enumerable:!0,get:function(){return n.unRegisterLayout}}),Object.defineProperty(r,"getLayoutByName",{enumerable:!0,get:function(){return n.getLayoutByName}}),t(iL(),r)})(Ht);function qae(r,e,t,n){return n===void 0&&(n="height"),t==="center"?(r[n]+e[n])/2:r.height}var Mo={assign:Object.assign,getHeight:qae},aL=Mo,i1=18,Zae=i1*2,oL=i1,Kae={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||oL},getVGap:function(e){return e.vgap||oL},getChildren:function(e){return e.children},getHeight:function(e){return e.height||Zae},getWidth:function(e){var t=e.label||" ";return e.width||t.split("").length*i1}};function Ev(r,e){var t=this;if(t.vgap=t.hgap=0,r instanceof Ev)return r;t.data=r;var n=e.getHGap(r),i=e.getVGap(r);return t.preH=e.getPreH(r),t.preV=e.getPreV(r),t.width=e.getWidth(r),t.height=e.getHeight(r),t.width+=t.preH,t.height+=t.preV,t.id=e.getId(r),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(n,i),t}aL.assign(Ev.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(e,t){var n=this;n.hgap+=e,n.vgap+=t,n.width+=2*e,n.height+=2*t},eachNode:function(e){for(var t=this,n=[t],i;i=n.shift();)e(i),n=i.children.concat(n)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var t=this,n=[t],i;i=n.shift();)e(i),n=n.concat(i.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(t){e.left=Math.min(e.left,t.x),e.top=Math.min(e.top,t.y),e.width=Math.max(e.width,t.x+t.width),e.height=Math.max(e.height,t.y+t.height)}),e},translate:function(e,t){e===void 0&&(e=0),t===void 0&&(t=0),this.eachNode(function(n){n.x+=e,n.y+=t,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var e=this,t=e.getBoundingBox();e.eachNode(function(n){n.x=n.x-(n.x-t.left)*2-n.width}),e.translate(t.width,0)},bottom2top:function(){var e=this,t=e.getBoundingBox();e.eachNode(function(n){n.y=n.y-(n.y-t.top)*2-n.height}),e.translate(0,t.height)}});function Qae(r,e,t){e===void 0&&(e={}),e=aL.assign({},Kae,e);var n=new Ev(r,e),i=[n],a;if(!t&&!r.collapsed){for(;a=i.shift();)if(!a.data.collapsed){var o=e.getChildren(a.data),s=o?o.length:0;if(a.children=new Array(s),o&&s)for(var u=0;ux.low&&(x=x.nxt);var C=E+w.prelim+w.w-(M+_.prelim);C>0&&(M+=C,o(m,b,x.index,C));var S=f(w),A=f(_);S<=A&&(w=u(w),w!==null&&(E+=w.mod)),S>=A&&(_=s(_),_!==null&&(M+=_.mod))}!w&&_?l(m,b,_,M):w&&!_&&c(m,b,w,E)}function o(m,b,x,w){m.c[b].mod+=w,m.c[b].msel+=w,m.c[b].mser+=w,v(m,b,x,w)}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,x,w){var E=m.c[0].el;E.tl=x;var _=w-x.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,x,w){var E=m.c[b].er;E.tr=x;var _=w-x.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 x=0;x=x.low;)x=x.nxt;return{low:m,index:b,nxt:x}}cL(r,t);var y=Fl.fromNode(r,t);return n(y),d(y,0),lL(y,r,t),toe(r,t),r},hL=sL,dL=function(r,e){for(var t=hL(r.data,e,!0),n=hL(r.data,e,!0),i=r.children.length,a=Math.round(i/2),o=e.getSide||function(l,c){return c-1},ooe=Co[0],a1=function(r,e,t){var n=e.direction||ooe;if(e.isHorizontal=aoe(n),n&&Co.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===Co[0])t(r,e);else if(n===Co[1])t(r,e),r.right2left();else if(n===Co[2])t(r,e);else if(n===Co[3])t(r,e),r.bottom2top();else if(n===Co[4]||n===Co[5]){var i=noe(r,e),a=i.left,o=i.right;t(a,e),t(o,e),e.isHorizontal?a.right2left():a.bottom2top(),o.translate(a.x-o.x,a.y-o.y),r.x=a.x,r.y=o.y;var s=r.getBoundingBox();e.isHorizontal?s.top<0&&r.translate(0,-s.top):s.left<0&&r.translate(-s.left,0)}var u=e.fixedRoot;return u===void 0&&(u=!0),u&&r.translate(-(r.x+r.width/2+r.hgap),-(r.y+r.height/2+r.vgap)),soe(r,e),r};function soe(r,e){if(e.radial){var t=e.isHorizontal?["x","y"]:["y","x"],n=t[0],i=t[1],a={x:1/0,y:1/0},o={x:-1/0,y:-1/0},s=0;r.DFTraverse(function(l){s++;var c=l.x,h=l.y;a.x=Math.min(a.x,c),a.y=Math.min(a.y,h),o.x=Math.max(o.x,c),o.y=Math.max(o.y,h)});var u=o[i]-a[i];if(u===0)return;var f=Math.PI*2/s;r.DFTraverse(function(l){var c=(l[i]-a[i])/u*(Math.PI*2-f)+f,h=l[n]-r[n];l.x=Math.cos(c)*h,l.y=Math.sin(c)*h})}}function uoe(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,o1(r,e)}function o1(r,e){return o1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},o1(r,e)}var foe=_v,loe=roe,coe=a1,hoe=Mo,doe=function(r){function e(){return r.apply(this,arguments)||this}uoe(e,r);var t=e.prototype;return t.execute=function(){var i=this;return coe(i.rootNode,i.options,loe)},e}(foe),voe={};function poe(r,e){return e=hoe.assign({},voe,e),new doe(r,e).execute()}var goe=poe,yoe=Mo;function moe(r,e){e===void 0&&(e=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=e}var boe={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function vL(r,e,t){t?(e.x=r.x,e.y=r.y):(e.x=r.y,e.y=r.x),r.children.forEach(function(n,i){vL(n,e.children[i],t)})}var xoe=function(r,e){e===void 0&&(e={}),e=yoe.assign({},boe,e);var t=0;function n(u){if(!u)return null;u.width=0,u.depth&&u.depth>t&&(t=u.depth);var f=u.children,l=f.length,c=new moe(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 i(u){if(u.isLeaf||u.children.length===0)u.drawingDepth=t;else{var f=u.children.map(function(c){return i(c)}),l=Math.min.apply(null,f);u.drawingDepth=l-1}return u.drawingDepth}var a;function o(u){u.x=u.drawingDepth*e.rankSep,u.isLeaf?(u.y=0,a&&(u.y=a.y+a.height+e.nodeSep,u.originNode.parent!==a.originNode.parent&&(u.y+=e.subTreeSep)),a=u):(u.children.forEach(function(f){o(f)}),u.y=(u.leftChild.y+u.rightChild.y)/2)}var s=n(r);return i(s),o(s),vL(s,r,e.isHorizontal),r};function woe(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,s1(r,e)}function s1(r,e){return s1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},s1(r,e)}var Eoe=_v,_oe=xoe,Soe=a1,Moe=Mo,Coe=function(r){function e(){return r.apply(this,arguments)||this}woe(e,r);var t=e.prototype;return t.execute=function(){var i=this;return i.rootNode.width=0,Soe(i.rootNode,i.options,_oe)},e}(Eoe),Aoe={};function Toe(r,e){return e=Moe.assign({},Aoe,e),new Coe(r,e).execute()}var Ioe=Toe,pL=Mo;function koe(r,e,t,n,i){var a=(typeof t=="function"?t(r):t)*r.depth;if(!n)try{if(r.id===r.parent.children[0].id){r.x+=a,r.y=e?e.y:0;return}}catch{}if(r.x+=a,e){if(r.y=e.y+pL.getHeight(e,r,i),e.parent&&r.parent.id!==e.parent.id){var o=e.parent,s=o.y+pL.getHeight(o,r,i);r.y=s>r.y?s:r.y}}else r.y=0}var Loe=function(r,e,t,n){var i=null;r.eachNode(function(a){koe(a,i,e,t,n),i=a})};function Noe(r,e){r.prototype=Object.create(e.prototype),r.prototype.constructor=r,u1(r,e)}function u1(r,e){return u1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},u1(r,e)}var Ooe=_v,Sv=Loe,Doe=dL,Poe=Mo,Gl=["LR","RL","H"],Roe=Gl[0],Boe=function(r){function e(){return r.apply(this,arguments)||this}Noe(e,r);var t=e.prototype;return t.execute=function(){var i=this,a=i.options,o=i.rootNode;a.isHorizontal=!0;var s=a.indent,u=s===void 0?20:s,f=a.dropCap,l=f===void 0?!0:f,c=a.direction,h=c===void 0?Roe:c,d=a.align;if(h&&Gl.indexOf(h)===-1)throw new TypeError("Invalid direction: "+h);if(h===Gl[0])Sv(o,u,l,d);else if(h===Gl[1])Sv(o,u,l,d),o.right2left();else if(h===Gl[2]){var v=Doe(o,a),p=v.left,g=v.right;Sv(p,u,l,d),p.right2left(),Sv(g,u,l,d);var y=p.getBoundingBox();g.translate(y.width,0),o.x=g.x-o.width/2}return o},e}(Ooe),Foe={};function Goe(r,e){return e=Poe.assign({},Foe,e),new Boe(r,e).execute()}var zoe=Goe,$oe=Mo;function gL(r,e){var t=0;return r.children.length?r.children.forEach(function(n){t+=gL(n,e)}):t=r.height,r._subTreeSep=e.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,t)+2*r._subTreeSep,r.totalHeight}function yL(r){var e=r.children,t=e.length;if(t){e.forEach(function(u){yL(u)});var n=e[0],i=e[t-1],a=i.y-n.y+i.height,o=0;if(e.forEach(function(u){o+=u.totalHeight}),a>r.height)r.y=n.y+a/2-r.height/2;else if(e.length!==1||r.height>o){var s=r.y+(r.height-a)/2-n.y;e.forEach(function(u){u.translate(0,s)})}else r.y=(n.y+n.height/2+i.y+i.height/2)/2-r.height/2}}var joe={getSubTreeSep:function(){return 0}},Uoe=function(r,e){e===void 0&&(e={}),e=$oe.assign({},joe,e),r.parent={x:0,width:0,height:0,y:0},r.BFTraverse(function(t){t.x=t.parent.x+t.parent.width}),r.parent=null,gL(r,e),r.startY=0,r.y=r.totalHeight/2-r.height/2,r.eachNode(function(t){var n=t.children,i=n.length;if(i){var a=n[0];if(a.startY=t.startY+t._subTreeSep,i===1)a.y=t.y+t.height/2-a.height/2;else{a.y=a.startY+a.totalHeight/2-a.height/2;for(var o=1;o=0&&(s="x",o="y");var u=0;mL(e,function(c){return u++,c.x>a.x&&(a.x=c.x),c.xa.y&&(a.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 t=document.createElement("div");return t.id="webgl-error-message",t.style.fontFamily="monospace",t.style.fontSize="13px",t.style.fontWeight="normal",t.style.textAlign="center",t.style.background="#fff",t.style.color="#000",t.style.padding="1.5em",t.style.width="400px",t.style.margin="5em auto 0",this.webgl||(t.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(` `)),t},addGetWebGLMessage:function(t){t=t||{};var n=t.parent!==void 0?t.parent:document.body,i=t.id!==void 0?t.id:"oldie",a=r().getWebGLErrorMessage();a.id=i,n.appendChild(a)}}};const fse=Object.freeze(Object.defineProperty({__proto__:null,gpuDetector:bL},Symbol.toStringTag,{value:"Module"}));var xL=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 lse=Object.freeze(Object.defineProperty({__proto__:null,getBrowserName:xL},Symbol.toStringTag,{value:"Module"}));var Ua=B(B(B(B(B({},bn),Y9),use),fse),lse),cse=Ua.radialLayout,hse=function(){function r(e){this.type=e.type,this.radial=e.radial,this.config=e}return r.prototype.init=function(e){var t=this;if(this.data=e,this.radial){this.layoutMethod=function(n){var i=Mv[t.type](n,t.config);return cse(i),i};return}this.layoutMethod=function(n){return Mv[t.type](n,t.config)}},r.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},r.prototype.layout=function(e){return this.init(e),this.execute()},r}();Ht.registerLayout("grid",Ht.GridLayout),Ht.registerLayout("random",Ht.RandomLayout),Ht.registerLayout("force",Ht.ForceLayout),Ht.registerLayout("circular",Ht.CircularLayout),Ht.registerLayout("dagre",Ht.DagreLayout),Ht.registerLayout("dagreCompound",Ht.DagreCompoundLayout),Ht.registerLayout("radial",Ht.RadialLayout),Ht.registerLayout("concentric",Ht.ConcentricLayout),Ht.registerLayout("mds",Ht.MDSLayout),Ht.registerLayout("fruchterman",Ht.FruchtermanLayout),Ht.registerLayout("fruchterman-gpu",Ht.FruchtermanGPULayout),Ht.registerLayout("gForce",Ht.GForceLayout),Ht.registerLayout("force2",Ht.Force2Layout),Ht.registerLayout("gForce-gpu",Ht.GForceGPULayout),Ht.registerLayout("comboForce",Ht.ComboForceLayout),Ht.registerLayout("comboCombined",Ht.ComboCombinedLayout),Ht.registerLayout("forceAtlas2",Ht.ForceAtlas2Layout);var dse=function(e,t){t.isCustomLayout=!0,Ht.Layouts[e]=Ht.registerLayout(e,t)},vse=function(){function r(e,t){var n=e.toString(),i=new Blob(["importScripts('".concat(t,"');(").concat(n,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(i))}return r}(),pse=function(e){e===void 0&&(e="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js");function t(){var i={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout);function a(s){var u=s.data.type;return u===i.RUN||u===i.GPURUN}function o(s){var u=this,f=s.data.type;switch(f){case i.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:i.ERROR,message:"layout ".concat(p," not found")});break}var y;v.onLayoutEnd=function(){u.postMessage({type:i.END,nodes:c}),y==null||y.destroy()},y=new g(v),y.init({nodes:c,edges:h}),y.execute();break}case i.GPURUN:{var m=s.data,b=m.nodes,h=m.edges,x=m.layoutCfg,v=x===void 0?{}:x,w=m.canvas,p=v.type,g=layout.getLayoutByName(p);if(!g){this.postMessage({type:i.ERROR,message:"layout ".concat(p," not found")});break}if(p.split("-")[1]!=="gpu"){this.postMessage({type:i.ERROR,message:"layout ".concat(p," does not support GPU")});break}var E=new g(v);E.init({nodes:b,edges:h}),E.executeWithWorker(w,this);break}}}onmessage=function(u){a(u)&&o(u)}}var n=new vse(t,e);return n},zu={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function l1(r){"@babel/helpers - typeof";return l1=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},l1(r)}var wL=function(e){return setTimeout(e,16)},EL=function(e){return clearTimeout(e)},Cv={requestAnimationFrame:function(e){var t=typeof window<"u"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||wL;return t(e)},cancelAnimationFrame:function(e){var t=typeof window<"u"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||EL;return t(e)}},gse=["fruchterman","gForce"],yse=["force","grid","circular"],mse=function(r){It(e,r);function e(t){var n=r.call(this,t)||this;return n.graph=t,n.layoutCfg=t.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=pse(this.layoutCfg.workerScriptURL),this.worker)},e.prototype.stopWorker=function(){var t=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,t.requestId&&(Cv.cancelAnimationFrame(t.requestId),t.requestId=null),t.requestId2&&(Cv.cancelAnimationFrame(t.requestId2),t.requestId2=null))},e.prototype.execLayoutMethod=function(t,n){var i=this;return new Promise(function(a,o){return Un(i,void 0,void 0,function(){var s,u,f,l,c,p,h,d,v,p,g;return Xn(this,function(y){switch(y.label){case 0:if(s=this.graph,!s||s.get("destroyed"))return[2];u=t.type,t.onLayoutEnd=function(){s.emit("aftersublayout",{type:u}),a()},u&&this.isGPU&&(_L(u)?u="".concat(u,"-gpu"):console.warn("The '".concat(u,"' layout does not support GPU calculation for now, it will run in CPU."))),bn.isForce(u)?(f=t.onTick,l=t.animate,c=l===void 0&&(u==="force"||u==="force2"),p=function(){f&&f(),(l||c)&&s.refreshPositions()},t.tick=p):(u==="comboForce"||u==="comboCombined")&&(t.comboTrees=s.get("comboTrees")),h=!1;try{d=new Ht.Layouts[u](t),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=t.onTick,p=function(){v&&v(),s.refreshPositions()},d.tick=p),g=this.filterLayoutData(this.data,t),wse(g,n),d.init(g),s.emit("beforesublayout",{type:u}),[4,d.execute()];case 1:return y.sent(),d.isCustomLayout&&t.onLayoutEnd&&t.onLayoutEnd(),[2]}})})})},e.prototype.updateLayoutMethod=function(t,n){var i=this;return new Promise(function(a,o){return Un(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Xn(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}),a()},bn.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),t.init(d),t.updateCfg(n),s.emit("beforesublayout",{type:u}),[4,t.execute()];case 1:return v.sent(),t.isCustomLayout&&n.onLayoutEnd&&n.onLayoutEnd(),[2]}})})})},e.prototype.layout=function(t){var n=this,i,a=this.graph;if(!(!a||a.get("destroyed"))){this.data=this.setDataFromGraph();var o=this.data,s=o.nodes,u=o.hiddenNodes;if(!s)return!1;var f=a.get("width"),l=a.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;(i=this.layoutMethods)===null||i===void 0||i.forEach(function(w){var E;return d=!!(!((E=w.nodes)===null||E===void 0)&&E.length)||d});var v=this.destoryLayoutMethods();a.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=SL(c,h);var y=c.onLayoutEnd,m=c.layoutEndFormatted,b=c.adjust;if(m||(c.layoutEndFormatted=!0,c.onAllLayoutEnd=function(){return Un(n,void 0,void 0,function(){return Xn(this,function(w){switch(w.label){case 0:return y&&y(s),this.refreshLayout(),b&&c.pipes?[4,this.adjustPipesBox(this.data,b)]:[3,2];case 1:w.sent(),this.refreshLayout(),w.label=2;case 2:return a.emit("afterlayout"),[2]}})})}),this.stopWorker(),c.workerEnabled&&this.layoutWithWorker(this.data,t))return!0;var x=!1;return c.type?(x=!0,p=p.then(function(){return Un(n,void 0,void 0,function(){return Xn(this,function(w){switch(w.label){case 0:return[4,this.execLayoutMethod(c,0)];case 1:return[2,w.sent()]}})})})):c.pipes&&(x=!0,c.pipes.forEach(function(w,E){p=p.then(function(){return Un(n,void 0,void 0,function(){return Xn(this,function(_){switch(_.label){case 0:return[4,this.execLayoutMethod(w,E)];case 1:return[2,_.sent()]}})})})})),x?p.then(function(){c.onAllLayoutEnd&&c.onAllLayoutEnd(),t&&t()}).catch(function(w){console.warn("graph layout failed,",w)}):(a.refreshPositions(),t==null||t()),!1}},e.prototype.tweakInit=function(){var t=this,n=t.data,i=t.graph,a=n.nodes,o=n.edges;if(a!=null&&a.length){var s={};a.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=i.get("width"),f=i.get("height");a.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(t,n){var i=this;return new Promise(function(a,o){return Un(i,void 0,void 0,function(){var s,u,f,l,c,h,d;return Xn(this,function(v){switch(v.label){case 0:return s=this,u=s.layoutCfg,f=s.data,l=u.preset,!(l!=null&&l.type)||!Ht.Layouts[l==null?void 0:l.type]?(n==null||n(),a(),[2,!1]):(c=SL(l,l.type),h=c?"".concat(l.type,"-gpu"):l.type,d=new Ht.Layouts[h](l),delete u.preset,d.init(f),[4,d.execute()]);case 1:return v.sent(),t==null||t(),a(),[2,!0]}})})})},e.prototype.layoutWithWorker=function(t,n){var i=this,a=this,o=a.layoutCfg,s=a.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 i.runWebworker(u,t,o)});else if(o.pipes){c=!0;for(var h=function(y){l=l.then(function(){return i.runWebworker(u,t,y)})},d=0,v=o.pipes;d'),l=i?i.backgroundColor:void 0,c=i?i.padding:void 0;c?ht(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 $f(v):new Aa(v),g=this.get("group"),y=g.clone(),m=Vt(y.getMatrix());m||(m=[1,0,0,0,1,0,0,0,1]);var b=(a.maxX+a.minX)/2,x=(a.maxY+a.minY)/2;m=ML(m,[["t",-b,-x],["t",s/2+c[3],o/2+c[0]]]),y.resetMatrix(),y.setMatrix(m),p.add(y);var w=p.get("el"),E="";n||(n="image/png"),setTimeout(function(){if(u==="svg"){var _=w.cloneNode(!0),M=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),C=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",M);C.replaceChild(_,C.documentElement);var S=new XMLSerializer().serializeToString(C);E="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(S))}else{var A=void 0,T=w.getContext("2d"),k=void 0;if(l){var O=typeof window<"u"?window.devicePixelRatio:1;try{A=T.getImageData(0,0,d*O,h*O),k=T.globalCompositeOperation,T.globalCompositeOperation="destination-over",T.fillStyle=l,T.fillRect(0,0,d,h)}catch{console.error("Download image failed. Out of memory at ImageData creation")}}E=w.toDataURL(n),l&&(T.clearRect(0,0,d,h),T.putImageData(A,0,0),T.globalCompositeOperation=k)}t&&t(E)},16)},e.prototype.downloadFullImage=function(t,n,i){var a=this,o=this.get("group").getCanvasBBox(),s=o.height,u=o.width,f=this.get("renderer"),l=wr('
'),c=document.querySelector(".g6-graph-watermarker"),h=i?i.backgroundColor:void 0,d=i?i.padding:void 0;d?ht(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},x=f==="svg"?new $f(b):new Aa(b),w=this.get("group"),E=Ese(w),_=Vt(E.getMatrix());_||(_=[1,0,0,0,1,0,0,0,1]);var M=(o.maxX+o.minX)/2,C=(o.maxY+o.minY)/2;_=ML(_,[["t",-M,-C],["t",u/2+d[3],s/2+d[0]]]),E.resetMatrix(),E.setMatrix(_),x.add(E);var S=x.get("el");n||(n="image/png"),this.asyncToDataUrl(n,h,function(A){var T=document.createElement("a"),k=(t||"graph")+(f==="svg"?".svg":".".concat(n.split("/")[1]));a.dataURLToImage(A,f,T,k);var O=document.createEvent("MouseEvents");O.initEvent("click",!1,!1),T.dispatchEvent(O)},p,v,S)},e.prototype.downloadImage=function(t,n,i){var a=this,o=this;o.stopAnimate();var s=o.get("canvas"),u=s.getRenderer();n||(n="image/png");var f=(t||"graph")+(u==="svg"?".svg":n.split("/")[1]),l=document.createElement("a");o.asyncToDataUrl(n,i,function(c){a.dataURLToImage(c,u,l,f);var h=document.createEvent("MouseEvents");h.initEvent("click",!1,!1),l.dispatchEvent(h)})},e.prototype.dataURLToImage=function(t,n,i,a){if(!t||t==="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=t.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,a):i.addEventListener("click",function(){i.download=a,i.href=window.URL.createObjectURL(h)})}else i.addEventListener("click",function(){i.download=a,i.href=t})},e.prototype.addPlugin=function(t){var n=this;t.destroyed||(n.get("plugins").push(t),t.initPlugin(n))},e.prototype.removePlugin=function(t){var n=this.get("plugins"),i=n.indexOf(t);i>=0&&(t.destroyPlugin(),n.splice(i,1))},e.prototype.setImageWaterMarker=function(t,n){t===void 0&&(t=Jo.waterMarkerImage);var i=this.get("container");Pe(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=gr({},Jo.imageWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.image;if(!t){var c=f?i:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var h={container:i,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),a=new Aa(h),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var v=a.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=t,m.onload=function(){if(v.drawImage(m,g,y,l.width,l.height),v.rotate(p*Math.PI/180),f)i.style.cssText="background-image: url(".concat(a.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",a.destroyed||(b.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),i.appendChild(b))}}},e.prototype.setTextWaterMarker=function(t,n){var i=this.get("container");Pe(i)&&(i=document.getElementById(i)),i.style.position||(i.style.position="relative");var a=this.get("graphWaterMarker"),o=gr({},Jo.textWaterMarkerConfig,n),s=o.width,u=o.height,f=o.compatible,l=o.text;if(!(t!=null&&t.length)){var c=f?i:document.querySelector(".g6-graph-watermarker");c&&(c.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var h={container:i,width:s,height:u,capture:!1},d=this.get("pixelRatio");d&&(h.pixelRatio=d,window.devicePixelRatio=d),a=new Aa(h),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var v=a.get("context"),p=l.rotate,g=l.fill,y=l.fontFamily,m=l.fontSize,b=l.baseline,x=l.x,w=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 _=Pe(t)?[t]:t,M=_.length-1;M>=0;M--)v.fillText(_[M],x,w+M*E);if(v.rotate(p*Math.PI/180),f)i.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var C=document.querySelector(".g6-graph-watermarker");C||(C=document.createElement("div"),C.className="g6-graph-watermarker"),C.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),i.appendChild(C)}},e.prototype.destroy=function(){var t,n,i,a;ye(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(t.children||[],l.id)===-1&&(a.innerRemoveChild(l.id,{x:t.x,y:t.y},i),s.splice(f,1))}}var c,h;o.get("originAttrs")&&(c=o.get("originAttrs").x,h=o.get("originAttrs").y);var d=o.getModel();i&&o.set("originAttrs",{x:d.x,y:d.y}),o.set("model",Object.assign(d,t.data)),(c!==t.x||h!==t.y)&&o.updatePosition({x:t.x,y:t.y})},e.prototype.innerRemoveChild=function(t,n,i){var a=this,o=a.findById(t);if(o)if(ye(o.get("children"),function(u){a.innerRemoveChild(u.getModel().id,n,i)}),i){var s=o.getModel();o.set("to",n),o.set("originAttrs",{x:s.x,y:s.y}),a.get("removeList").push(o)}else a.removeItem(o,!1)},e.prototype.changeData=function(t,n){n===void 0&&(n=!0);var i=this;this.getNodes().map(function(a){return i.clearItemStates(a)}),this.getEdges().map(function(a){return i.clearItemStates(a)}),n&&this.get("enabledStack")&&this.pushStack("changedata",{before:i.get("originData"),after:t||i.get("data")}),t?(i.data(t),i.render(!1)):i.layout(this.get("fitView"))},e.prototype.changeLayout=function(t){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");var n=this;n.updateLayout(t)},e.prototype.updateLayout=function(t,n,i,a){a===void 0&&(a=!0);var o=this;if(!t){console.warn("layout cannot be null");return}if(a&&this.get("enabledStack")&&this.pushStack("layout",{before:o.get("layout"),after:t}),o.set("layout",t),o.set("layoutMethod",o.getLayout()),o.layout(),n){var s=i;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(t){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");var n=this;n.layout(t)},e.prototype.layout=function(t){var n=this,i=this,a=i.get("data"),o=i.get("layoutMethod"),s=i.get("layout"),u=a;if(s!=null&&s.excludeInvisibles){a=Vt(i.get("data"));var f={};h1(a,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(a,i.get("layout")):a,h1(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(a,i.get("layout")):a;var l=i.get("animate");if(i.emit("beforerefreshlayout",{data:a,layoutData:u}),i.emit("beforelayout"),i.innerUpdateChild(u,void 0,l),t){var c=i.get("viewController");c.fitView()}l?i.layoutAnimate(u):(i.refresh(),i.paint()),i.emit("afterrefreshlayout",{data:a,layoutData:u}),i.emit("afterlayout")},e.prototype.addChild=function(t,n,i){i===void 0&&(i=!0);var a=this;a.emit("beforeaddchild",{model:t,parent:n}),Pe(n)||(n=n.get("id"));var o=a.findDataById(n);if(o){o.children||(o.children=[]),o.children.push(t);var s=a.findById(n);s.refresh(),a.changeData(void 0,i)}},e.prototype.updateChildren=function(t,n,i){i===void 0&&(i=!0);var a=this,o=a.findById(n);if(!n||!o){console.warn("Update children failed! There is no node with id '".concat(n,"'"));return}var s=a.findDataById(n);s.children=t,o.refresh(),a.changeData(void 0,i)},e.prototype.updateChild=function(t,n,i){i===void 0&&(i=!0);var a=this;if(!n||!a.findById(n)){a.changeData(t,i);return}var o=a.findDataById(n),s=a.findById(t.id);if(o.children||(o.children=[]),!s)o.children.push(t);else{var u=e.indexOfChild(o.children,t.id);u>-1&&(o.children[u]=t)}var f=a.findById(n);f==null||f.refresh(),a.changeData(void 0,i)},e.prototype.removeChild=function(t,n){n===void 0&&(n=!0);var i=this,a=i.findById(t),o;if(a?o=a==null?void 0:a.get("parent"):o=i.getNodes().find(function(c){var h=c.getModel().children||[];return!!h.find(function(d){return d.id===t})}),o&&!o.destroyed){var s=o.get("id"),u=i.findDataById(s),f=u&&u.children||[],l=e.indexOfChild(f,t);f.splice(l,1),o.refresh()}i.changeData(void 0,n)},e.prototype.findDataById=function(t,n){var i=this;if(n||(n=i.get("data")),t===n.id)return n;var a=null;return ye(n.children||[],function(o){if(o.id===t)return a=o,!1;if(a=i.findDataById(t,o),a)return!1}),a},e.prototype.layoutAnimate=function(t,n){var i=this,a=this.get("animateCfg");i.emit("beforeanimate",{data:t}),i.getEdges().forEach(function(o){var s=o.get("model");s.sourceAnchor||(s.sourceAnchor=o.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(o){h1(t,function(s){var u=i.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,t);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}),ye(i.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}),i.refreshPositions()},{duration:a.duration,easing:a.ease,callback:function(){ye(i.getNodes(),function(s){s.set("originAttrs",null)}),ye(i.get("removeList"),function(s){i.removeItem(s,!1)}),i.set("removeList",[]),a.callback&&a.callback(),i.emit("afteranimate",{data:t})},delay:a.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(t){t===void 0&&(t=!0);var n=this,i=n.get("data");if(!i||!un(i)||!Object.keys(i).length)throw new Error("data must be defined first");n.clear(),t&&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(t){r.prototype.data.call(this,t),this.set("originData",JSON.parse(JSON.stringify(t)))},e}(CL),zn=function(){function r(e){this._cfgs=gr(this.getDefaultCfgs(),e),this._events={},this.destroyed=!1}return r.prototype.getDefaultCfgs=function(){return{}},r.prototype.initPlugin=function(e){var t=this;t.set("graph",e);var n=t.getEvents(),i={};ye(n,function(a,o){var s=Go(t,a);i[o]=s,e.on(o,s)}),this._events=i,this.init()},r.prototype.getEvents=function(){return{}},r.prototype.get=function(e){var t;return(t=this._cfgs)===null||t===void 0?void 0:t[e]},r.prototype.set=function(e,t){this._cfgs[e]=t},r.prototype.destroy=function(){},r.prototype.destroyPlugin=function(){this.destroy();var e=this.get("graph"),t=this._events;ye(t,function(n,i){e.off(i,n)}),this._events=null,this._cfgs=null,this.destroyed=!0},r}(),Ase=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),AL="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",Tse=function(r){Ase(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{img:AL,follow:!0}},e.prototype.init=function(){var t=this.get("graph"),n=t.get("container"),i=t.get("canvas").get("el"),a=this.get("img")||AL;a.includes("url(")||(a='url("'.concat(a,'")'));var o=wr(`
`),s=wr(`
`));this.set("container",o),this.set("gridContainer",s),this.positionInit(),o.appendChild(s),n.insertBefore(o,i)},e.prototype.positionInit=function(){var t=this.get("graph"),n=t.get("minZoom"),i=t.get("width"),a=t.get("height");jt(this.get("container"),{width:"".concat(i,"px"),height:"".concat(a,"px")});var o=i*80/n,s=a*80/n;jt(this.get("gridContainer"),{width:"".concat(o,"px"),height:"".concat(s,"px"),left:"-".concat(o/2,"px"),top:"-".concat(s/2,"px")})},e.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},e.prototype.updateGrid=function(t){var n=this.get("gridContainer"),i=t.matrix;i||(i=[1,0,0,0,1,0,0,0,1]);var a=this.get("follow"),o="matrix(".concat(i[0],", ").concat(i[1],", ").concat(i[3],", ").concat(i[4],", ").concat(a?i[6]:"0",", ").concat(a?i[7]:"0",")");jt(n,{transform:o})},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t=this.get("graph"),n=t.get("container"),i=this.get("container");n.removeChild(i)},e}(zn),d1={exports:{}},TL=[],zl=[],Ise="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function IL(r,e){if(e=e||{},r===void 0)throw new Error(Ise);var t=e.prepend===!0?"prepend":"append",n=e.container!==void 0?e.container:document.querySelector("head"),i=TL.indexOf(n);i===-1&&(i=TL.push(n)-1,zl[i]={});var a;return zl[i]!==void 0&&zl[i][t]!==void 0?a=zl[i][t]:(a=zl[i][t]=kse(),t==="prepend"?n.insertBefore(a,n.childNodes[0]):n.appendChild(a)),r.charCodeAt(0)===65279&&(r=r.substr(1,r.length)),a.styleSheet?a.styleSheet.cssText+=r:a.textContent+=r,a}function kse(){var r=document.createElement("style");return r.setAttribute("type","text/css"),r}d1.exports=IL,d1.exports.insertCss=IL;var Lse=d1.exports;const Av=Ji(Lse);var Nse=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();typeof document<"u"&&Av(` .g6-component-contextmenu { border: 1px solid #e2e2e2; border-radius: 4px; font-size: 12px; color: #545454; background-color: rgba(255, 255, 255, 0.9); padding: 10px 8px; box-shadow: rgb(174, 174, 174) 0px 0px 10px; } .g6-contextmenu-ul { padding: 0; margin: 0; list-style: none; } `);var Ose=function(r){Nse(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(n){return`
  • 菜单项1
  • 菜单项2
`},shouldBegin:function(n){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},e.prototype.getEvents=function(){return this.get("trigger")==="click"?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},e.prototype.init=function(){var t=this.get("className"),n=wr("
"));jt(n,{top:"0px",position:"absolute",visibility:"hidden"});var i=this.get("container");i||(i=this.get("graph").get("container")),Pe(i)&&(i=document.getElementById(i)),i.appendChild(n),this.set("menu",n)},e.prototype.onMenuShow=function(t){var n=this;t.preventDefault();var i=this.get("itemTypes");if(t.item){if(t.item&&t.item.getType&&i.indexOf(t.item.getType())===-1){n.onMenuHide();return}}else if(i.indexOf("canvas")===-1){n.onMenuHide();return}var a=this.get("shouldBegin");if(a(t)){var o=this.get("menu"),s=this.get("getContent"),u=this.get("graph"),f=s(t,u);Pe(f)?o.innerHTML=f:o.innerHTML=f.outerHTML,this.removeMenuEventListener();var l=this.get("handleMenuClick");if(l){var c=function(M){l(M.target,t.item,u)};this.set("handleMenuClickWrapper",c),o.addEventListener("click",c)}var h=u.get("width"),d=u.get("height"),v=o.getBoundingClientRect(),p=this.get("offsetX")||0,g=this.get("offsetY")||0,y=u.getContainer().offsetTop,m=u.getContainer().offsetLeft,b=t.canvasX+m+p,x=t.canvasY+y+g;b+v.width>h&&(b=t.canvasX-v.width-p+m),x+v.height>d&&(x=t.canvasY-v.height-g+y),jt(o,{top:"".concat(x,"px"),left:"".concat(b,"px"),visibility:"visible"});var w=this.get("trigger")==="click",E=function(M){if(w){w=!1;return}n.onMenuHide()};document.body.addEventListener("click",E),this.set("handler",E)}},e.prototype.removeMenuEventListener=function(){var t=this.get("handleMenuClickWrapper"),n=this.get("handler");if(t){var i=this.get("menu");i.removeEventListener("click",t),this.set("handleMenuClickWrapper",null)}n&&document.body.removeEventListener("click",n)},e.prototype.onMenuHide=function(){var t=this.get("menu");t&&jt(t,{visibility:"hidden"}),this.removeMenuEventListener()},e.prototype.destroy=function(){var t=this.get("menu");if(this.removeMenuEventListener(),t){var n=this.get("container");n||(n=this.get("graph").get("container")),Pe(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}(zn),Dse=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),v1=function(){return v1=Object.assign||function(r){for(var e,t=1,n=arguments.length;t-1,f=navigator.userAgent.toLowerCase().indexOf("safari")>-1,l=wr(`
`)),c=0,h=0,d=!1,v=0,p=0,g=0,y=0,m=0,b=0,x=f||u?"mousedown":"dragstart";l.addEventListener(x,function(M){var C,S;if(M.dataTransfer){var A=new Image;A.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",(S=(C=M.dataTransfer).setDragImage)===null||S===void 0||S.call(C,A,0,0);try{M.dataTransfer.setData("text/html","view-port-minimap")}catch{M.dataTransfer.setData("text","view-port-minimap")}}if(n.refresh=!1,M.target===l){var T=l.style;v=parseInt(T.left,10),p=parseInt(T.top,10),g=parseInt(T.width,10),y=parseInt(T.height,10),!(g>i[0]||y>i[1])&&(b=a.getZoom(),m=t.get("ratio"),d=!0,c=M.clientX,h=M.clientY)}},!1);var w=function(C){if(!(!d||ct(C.clientX)||ct(C.clientY))){var S=c-C.clientX,A=h-C.clientY;(v-S<0||v-S+g>=i[0])&&(S=0),(p-A<0||p-A+y>=i[1])&&(A=0),v-=S,p-=A,jt(l,{left:"".concat(v,"px"),top:"".concat(p,"px")}),a.translate(S*b/m,A*b/m),c=C.clientX,h=C.clientY}};!f&&!u&&l.addEventListener("drag",w,!1);var E=function(){d=!1,n.refresh=!0},_=f||u?"mouseup":"dragend";l.addEventListener(_,E,!1),s.addEventListener("mouseleave",E),s.addEventListener("mouseup",E),(f||u)&&s.addEventListener("mousemove",w,!1),this.set("viewport",l),s.appendChild(l)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),n=this.get("totaldx"),i=this.get("totaldy"),a=this.get("graph"),o=this.get("size"),s=a.get("canvas").get("el"),u=a.get("width")||s.scrollWidth||500,f=a.get("height")||s.scrollHeight||500,l=a.getPointByCanvas(0,0),c=a.getPointByCanvas(u,f),h=this.get("viewport");h||this.initViewport();var d=(c.x-l.x)*t,v=(c.y-l.y)*t,p=l.x*t+n,g=l.y*t+i,y=p+d,m=g+v;p<0&&(d+=p,p=0),y>o[0]&&(d=d-(y-o[0])),g<0&&(v+=g,g=0),m>o[1]&&(v=v-(m-o[1])),this.set("ratio",t);var b="".concat(p,"px"),x="".concat(g,"px");jt(h,{left:b,top:x,width:"".concat(d,"px"),height:"".concat(v,"px")})}},e.prototype.updateGraphShapes=function(){var t=this._cfgs.graph,n=this.get("canvas"),i=t.get("group");if(!i.destroyed){n.clear();var a;this.get("hideEdge")?(a=n.addGroup(),i.get("children").forEach(function(s){s.get("id").includes("-edge")||a.add(s.clone())})):(a=i.clone(),a.resetMatrix(),n.add(a));var o=t.get("renderer");o===LL&&this.updateVisible(a)}},e.prototype.updateVisible=function(t){var n=this;if(!t.isGroup()&&!t.get("visible"))t.hide();else{var i=t.get("children");if(!i||!i.length)return;i.forEach(function(a){a.get("visible")||a.hide(),n.updateVisible(a)})}},e.prototype.updateKeyShapes=function(){var t=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();this.get("hideEdge")||ye(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),ye(n.getNodes(),function(u){t.updateOneNodeKeyShape(u,a)});var o=n.getCombos();if(o&&o.length){var s=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||(ye(o,function(u){t.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.updateOneComboKeyShape=function(t,n){if(!this.destroyed){var i=this.get("itemMap")||{},a=i[t.get("id")],o=t.getBBox(),s=t.get("keyShape").clone(),u=s.attr(),f={x:o.centerX,y:o.centerY};a?f=Object.assign(u,f):(a=s,n.add(a));var l=a.get("type");(l==="rect"||l==="image")&&(f.x=o.minX,f.y=o.minY),a.attr(f),t.isVisible()?a.show():a.hide(),a.exist=!0;var c=t.getModel().depth;isNaN(c)||a.set("zIndex",c),i[t.get("id")]=a,this.set("itemMap",i)}},e.prototype.updateOneNodeKeyShape=function(t,n){var i=this.get("itemMap")||{},a=i[t.get("id")],o=t.getBBox(),s=t.get("keyShape").clone(),u=s.attr(),f={x:o.centerX,y:o.centerY};a?(f=Object.assign(u,f),a.toFront()):(a=s,n.add(a));var l=a.get("type");(l==="rect"||l==="image")&&(f.x=o.minX,f.y=o.minY),a.attr(f),t.isVisible()?a.show():a.hide(),a.exist=!0;var c=t.getModel().depth;isNaN(c)||a.set("zIndex",c),i[t.get("id")]=a,this.set("itemMap",i)},e.prototype.updateDelegateShapes=function(){var t=this,n=this._cfgs.graph,i=this.get("canvas"),a=i.get("children")[0]||i.addGroup();this.get("hideEdge")||ye(n.getEdges(),function(u){t.updateOneEdgeKeyShape(u,a)}),ye(n.getNodes(),function(u){t.updateOneNodeDelegateShape(u,a)});var o=n.getCombos();if(o&&o.length){var s=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){t.destroyed||(ye(o,function(u){t.updateOneComboKeyShape(u,s)}),s==null||s.sort(),s==null||s.toBack(),t.updateCanvas())},250)}this.clearDestroyedShapes()},e.prototype.clearDestroyedShapes=function(){var t=this.get("itemMap")||{},n=Object.keys(t);if(!(!n||n.length===0))for(var i=n.length-1;i>=0;i--){var a=t[n[i]],o=a.exist;a.exist=!1,o||(a.remove(),delete t[n[i]])}},e.prototype.updateOneEdgeKeyShape=function(t,n){var i=this.get("itemMap")||{},a=i[t.get("id")];if(a){var o=t.get("keyShape").attr("path");a.attr("path",o)}else a=t.get("keyShape").clone(),n.add(a);t.isVisible()?a.show():a.hide(),a.exist=!0,i[t.get("id")]=a,this.set("itemMap",i)},e.prototype.updateOneNodeDelegateShape=function(t,n){var i=this.get("delegateStyle"),a=this.get("itemMap")||{},o=a[t.get("id")],s=t.getBBox();if(o){var u={x:s.minX,y:s.minY,width:s.width,height:s.height};o.attr(u),o.toFront()}else o=n.addShape("rect",{attrs:v1({x:s.minX,y:s.minY,width:s.width,height:s.height},i),name:"minimap-node-shape"});t.isVisible()?o.show():o.hide(),o.exist=!0,a[t.get("id")]=o,this.set("itemMap",a)},e.prototype.init=function(){this.initContainer(),this.get("graph").on("afterupdateitem",this.handleUpdateCanvas),this.get("graph").on("afteritemstatechange",this.handleUpdateCanvas),this.get("graph").on("afteradditem",this.handleUpdateCanvas),this.get("graph").on("afterremoveitem",this.handleUpdateCanvas),this.get("graph").on("afterrender",this.handleUpdateCanvas),this.get("graph").on("afterlayout",this.handleUpdateCanvas)},e.prototype.initContainer=function(){var t=this,n=t.get("graph"),i=t.get("size"),a=t.get("className"),o=t.get("container"),s=wr("
"));Pe(o)&&(o=document.getElementById(o)),o?o.appendChild(s):n.get("container").appendChild(s),t.set("container",s);var u=wr('
');s.appendChild(u),u.addEventListener("dragenter",function(c){c.preventDefault()}),u.addEventListener("dragover",function(c){c.preventDefault()});var f,l=n.get("renderer");l===LL?f=new $f({container:u,width:i[0],height:i[1]}):f=new Aa({container:u,width:i[0],height:i[1]}),t.set("canvas",f),t.updateCanvas()},e.prototype.updateCanvas=function(){if(!this.destroyed){var t=this.get("refresh");if(t){var n=this.get("graph");if(!n.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var i=this.get("size"),a=this.get("canvas"),o=this.get("type"),s=this.get("padding");if(!a.destroyed){switch(o){case Rse:this.updateGraphShapes();break;case Bse:this.updateKeyShapes();break;case Fse:this.updateDelegateShapes();break}var u=a.get("children")[0];if(u){u.resetMatrix();var f=u.getCanvasBBox(),l=n.get("canvas").getCanvasBBox(),c=n.getZoom()||1,h=l.width/c,d=l.height/c;Number.isFinite(f.width)&&(h=kL(f.width,h),d=kL(f.height,d)),h+=2*s,d+=2*s;var v=Math.min(i[0]/h,i[1]/d),p=[1,0,0,0,1,0,0,0,1],g=0,y=0;Number.isFinite(f.minX)&&(g=-f.minX),Number.isFinite(f.minY)&&(y=-f.minY);var m=(i[0]-(h-2*s)*v)/2,b=(i[1]-(d-2*s)*v)/2;p=Pse(p,[["t",g,y],["s",v,v],["t",m,b]]),u.setMatrix(p),this.set("ratio",v),this.set("totaldx",m+g*v),this.set("totaldy",b+y*v),this.set("dx",m),this.set("dy",b),this.updateViewport()}}}}}},e.prototype.getCanvas=function(){return this.get("canvas")},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.destroy=function(){var t;(t=this.get("canvas"))===null||t===void 0||t.destroy();var n=this.get("container");n!=null&&n.parentNode&&n.parentNode.removeChild(n)},e}(zn),zse=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}();function va(r,e,t){var n=r.x-e.x,i=r.y-e.y;return Math.sqrt(n*n+i*i)}function $se(r,e){return r.x*e.x+r.y*e.y}function NL(r,e){var t=(e.source.y-e.target.y)/(e.source.x-e.target.x),n=(t*t*e.source.x+t*(r.y-e.source.y)+r.x)/(t*t+1),i=t*(n-e.source.x)+e.source.y;return{x:n,y:i}}var jse=function(r){zse(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{edgeBundles:[],edgePoints:[],K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:.6666667,bundleThreshold:.6,eps:1e-6,onLayoutEnd:function(){},onTick:function(){}}},e.prototype.init=function(){var t=this.get("graph"),n=this.get("onTick"),i=function(){n&&n(),t.refreshPositions()};this.set("tick",i)},e.prototype.bundling=function(t){var n=this;if(n.set("data",t),!n.isTicking()){var i=t.edges||[],a=t.nodes||[],o={},s=!1;if(a.forEach(function(x){(x.x===null||!x.y===null||x.x===void 0||!x.y===void 0)&&(s=!0),o[x.id]=x}),s)throw new Error("please layout the graph or assign x and y for nodes first");n.set("nodeIdMap",o);var u=n.get("divisions"),f=n.get("divRate"),l=n.divideEdges(u);n.set("edgePoints",l);var c=n.getEdgeBundles();n.set("edgeBundles",c);for(var h=n.get("cycles"),d=n.get("iterations"),v=n.get("iterRate"),p=n.get("lambda"),g=0;gv;){var b=v/m,x={x:o[u][y-1].x,y:o[u][y-1].y};x.x+=b*(g.x-o[u][y-1].x),x.y+=b*(g.y-o[u][y-1].y),p.push(x),m-=v,v=d}v-=m}}),p.push({x:c.x,y:c.y}),o[u]=p}}),o},e.prototype.getEdgeLength=function(t){var n=0;return t.forEach(function(i,a){a!==0&&(n+=va(i,t[a-1]))}),n},e.prototype.getEdgeBundles=function(){var t=this,n=t.get("data"),i=n.edges||[],a=t.get("bundleThreshold"),o=t.get("nodeIdMap"),s=t.get("edgeBundles");return s||(s=[]),i.forEach(function(u,f){(!s[f]||s[f]===void 0)&&(s[f]=[])}),i.forEach(function(u,f){var l=o[u.source],c=o[u.target];i.forEach(function(h,d){if(!(d<=f)){var v=o[h.source],p=o[h.target],g=t.getBundleScore({source:l,target:c},{source:v,target:p});g>=a&&(s[f].push(d),s[d].push(f))}})}),s},e.prototype.getBundleScore=function(t,n){var i=this;t.vx=t.target.x-t.source.x,t.vy=t.target.y-t.source.y,n.vx=n.target.x-n.source.x,n.vy=n.target.y-n.source.y,t.length=va({x:t.source.x,y:t.source.y},{x:t.target.x,y:t.target.y}),n.length=va({x:n.source.x,y:n.source.y},{x:n.target.x,y:n.target.y});var a=i.getAngleScore(t,n),o=i.getScaleScore(t,n),s=i.getPositionScore(t,n),u=i.getVisibilityScore(t,n);return a*o*s*u},e.prototype.getAngleScore=function(t,n){var i=$se({x:t.vx,y:t.vy},{x:n.vx,y:n.vy});return i/(t.length*n.length)},e.prototype.getScaleScore=function(t,n){var i=(t.length+n.length)/2,a=2/(i/Math.min(t.length,n.length)+Math.max(t.length,n.length)/i);return a},e.prototype.getPositionScore=function(t,n){var i=(t.length+n.length)/2,a={x:(t.source.x+t.target.x)/2,y:(t.source.y+t.target.y)/2},o={x:(n.source.x+n.target.x)/2,y:(n.source.y+n.target.y)/2},s=va(a,o);return i/(i+s)},e.prototype.getVisibilityScore=function(t,n){var i=this.getEdgeVisibility(t,n),a=this.getEdgeVisibility(n,t);return ia||Math.abs(c.y)>a){var h=va(s[l][t],s[n][t]),d=1/h;f.x+=c.x*d,f.y+=c.y*d}}),f},e.prototype.isTicking=function(){return this.get("ticking")},e.prototype.getSimulation=function(){return this.get("forceSimulation")},e.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),r.prototype.destroy.call(this)},e}(zn),Use=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),p1=function(){return p1=Object.assign||function(r){for(var e,t=1,n=arguments.length;t(f||i.get("height"))&&a>1||c<(l||i.get("height")*.05)&&a<1)&&(a=1),c*=a,n.set("r",c),n.set("r2",c*c);var h=n.get("d");n.set("molecularParam",(h+1)*c),n.set("delegateCenterDiff",void 0),n.magnify(t,u)}},e.prototype.scaleRByDrag=function(t){var n=this;if(t){var i=n.get("dragPrePos"),a=n.get("graph"),o,s=a.getPointByClient(t.clientX,t.clientY);t.x-i.x<0?o=1-Tv:o=1/(1-Tv);var u=n.get("maxR"),f=n.get("minR"),l=n.get("r");(l>(u||a.get("height"))&&o>1||l<(f||a.get("height")*.05)&&o<1)&&(o=1),l*=o,n.set("r",l),n.set("r2",l*l);var c=n.get("d");n.set("molecularParam",(c+1)*l),n.magnify(t,s),n.set("dragPrePos",{x:t.x,y:t.y})}},e.prototype.scaleDByWheel=function(t){var n=this;if(!(!t&&!t.originalEvent)){t.preventDefault&&t.preventDefault();var i=0;t.originalEvent.wheelDelta<0?i=-.1:i=.1;var a=n.get("d"),o=a+i,s=n.get("maxD"),u=n.get("minD");if(ou){n.set("d",o);var f=n.get("r");n.set("molecularParam",(o+1)*f);var l=n.get("delegate"),c=l?{x:l.attr("x"),y:l.attr("y")}:void 0;n.set("delegateCenterDiff",void 0),n.magnify(t,c)}}},e.prototype.scaleDByDrag=function(t){var n=this,i=n.get("dragPrePos"),a=t.x-i.x>0?.1:-.1,o=n.get("d"),s=o+a,u=n.get("maxD"),f=n.get("minD");if(sf){n.set("d",s);var l=n.get("r");n.set("molecularParam",(s+1)*l),n.magnify(t)}n.set("dragPrePos",{x:t.x,y:t.y})},e.prototype.magnify=function(t,n){var i=this;i.restoreCache();var a=i.get("graph"),o=i.get("cachedMagnifiedModels"),s=i.get("cachedOriginPositions"),u=i.get("showLabel"),f=i.get("r"),l=i.get("r2"),c=i.get("d"),h=i.get("molecularParam"),d=a.getNodes(),v=d.length,p=n?{x:n.x,y:n.y}:{x:t.x,y:t.y};i.get("dragging")&&(i.get("trigger")==="mousemove"||i.get("trigger")==="click")&&(p=i.get("cacheCenter"));var g=i.get("delegateCenterDiff");g&&(p.x+=g.x,p.y+=g.y),i.updateDelegate(p,f);for(var y=0;y
  • `},zoomSensitivity:2}},e.prototype.init=function(){var t=this,n=this.get("graph"),i=this.get("getContent"),a=i(n),o=a;Pe(a)&&(o=wr(a));var s=this.get("className");o.setAttribute("class",s||"g6-component-toolbar");var u=this.get("container");u||(u=this.get("graph").get("container")),Pe(u)&&(u=document.getElementById(u)),u.appendChild(o),this.set("toolBar",o);var f=this.get("handleClick");o.addEventListener("click",function(c){var h=Wse(c).filter(function(v){return v.nodeName==="LI"});if(h.length!==0){var d=h[0].getAttribute("code");d&&(f?f(d,n):t.handleDefaultOperator(d))}});var l=this.get("position");l&&jt(o,{top:"".concat(l.y,"px"),left:"".concat(l.x,"px")}),this.bindUndoRedo()},e.prototype.bindUndoRedo=function(){var t=this.get("graph"),n=document.querySelector('.g6-component-toolbar li[code="undo"]'),i=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),a=document.querySelector('.g6-component-toolbar li[code="redo"]'),o=document.querySelector('.g6-component-toolbar li[code="redo"] svg');!n||!i||!a||!o||(n.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4"),a.setAttribute("style","cursor: not-allowed"),o.setAttribute("style","opacity: 0.4"),t.on("stackchange",function(s){var u=s.undoStack,f=s.redoStack,l=u.length,c=f.length;l===0?(n.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4")):(n.removeAttribute("style"),i.removeAttribute("style")),c===0?(a.setAttribute("style","cursor: not-allowed"),o.setAttribute("style","opacity: 0.4")):(a.removeAttribute("style"),o.removeAttribute("style"))}))},e.prototype.undo=function(){var t=this.get("graph"),n=t.getUndoStack();if(!(!n||n.length===0)){var i=n.pop();if(i){var a=i.action;t.pushStack(a,Vt(i.data),"redo");var o=i.data.before;if(a==="add"&&(o=i.data.after),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=t.findById(d.id);d.visible?t.showItem(v,!1):t.hideItem(v,!1)})});break}case"render":case"update":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=t.findById(d.id);delete d.id,t.updateItem(v,d,!1),v.getType()==="combo"&&t.updateCombo(v)})});break;case"changedata":t.changeData(o,!1);break;case"delete":{Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){var v=d.itemType;delete d.itemType,t.addItem(v,d,!1)})});break}case"add":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){t.removeItem(d.id,!1)})});break;case"updateComboTree":Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){t.updateComboTree(d.id,d.parentId,!1)})});break;case"createCombo":var s=i.data.after.combos,u=s[s.length-1];Object.keys(o).forEach(function(c){var h=o[c];h&&h.forEach(function(d){t.updateComboTree(d.id,d.parentId,!1)})}),t.removeItem(u.id,!1);break;case"uncombo":var f=o.combos[o.combos.length-1],l=o.nodes.concat(o.combos).map(function(c){return c.id}).filter(function(c){return c!==f.id});t.createCombo(f,l,!1);break;case"layout":t.updateLayout(o,void 0,void 0,!1);break}}}},e.prototype.redo=function(){var t=this.get("graph"),n=t.getRedoStack();if(!(!n||n.length===0)){var i=n.pop();if(i){var a=i.action,o=i.data.after;if(t.pushStack(a,Vt(i.data)),a==="delete"&&(o=i.data.before),!o)return;switch(a){case"visible":{Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=t.findById(h.id);h.visible?t.showItem(d,!1):t.hideItem(d,!1)})});break}case"render":case"update":Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=t.findById(h.id);delete h.id,t.updateItem(d,h,!1),d.getType()==="combo"&&t.updateCombo(d)})});break;case"changedata":t.changeData(o,!1);break;case"delete":o.edges&&o.edges.forEach(function(l){t.removeItem(l.id,!1)}),o.nodes&&o.nodes.forEach(function(l){t.removeItem(l.id,!1)}),o.combos&&o.combos.forEach(function(l){t.removeItem(l.id,!1)});break;case"add":{Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){var d=h.itemType;delete h.itemType,t.addItem(d,h,!1)})});break}case"updateComboTree":Object.keys(o).forEach(function(l){var c=o[l];c&&c.forEach(function(h){t.updateComboTree(h.id,h.parentId,!1)})});break;case"createCombo":var s=o.combos[o.combos.length-1];t.createCombo(s,s.children.map(function(l){return l.id}),!1);break;case"uncombo":var u=i.data.before.combos,f=u[u.length-1];t.uncombo(f.id,!1);break;case"layout":t.updateLayout(o,void 0,void 0,!1);break}}}},e.prototype.zoomOut=function(){var t=this.get("graph"),n=t.getZoom(),i=1/(1-DL*this.get("zoomSensitivity")),a=this.get("maxZoom")||t.get("maxZoom");i*n>a||t.zoomTo(n*i)},e.prototype.zoomIn=function(){var t=this.get("graph"),n=t.getZoom(),i=1-DL*this.get("zoomSensitivity"),a=this.get("minZoom")||t.get("minZoom");i*n类型:`.concat(n.item.getType(),` ID:`).concat(n.item.getID(),` `)},shouldBegin:function(n){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},e.prototype.getEvents=function(){return this.get("trigger")==="click"?{"node:click":"onClick","edge:click":"onClick","combo:click":"onClick","canvas:click":"onMouseLeave",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave",drag:"onMouseLeave"}:{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove","edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove","combo:mouseenter":"onMouseEnter","combo:mouseleave":"onMouseLeave","combo:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave","node:drag":"onMouseLeave"}},e.prototype.init=function(){var t=this,n=t.get("className")||"g6-component-tooltip",i=wr("
    ")),a=t.get("container");a||(a=t.get("graph").get("container")),Pe(a)&&(a=document.getElementById(a)),jt(i,{position:"absolute",visibility:"hidden",display:"none"}),a.appendChild(i),t.get("trigger")!=="click"&&(i.addEventListener("mouseenter",function(o){jt(i,{visibility:"visible",display:"unset"})}),i.addEventListener("mouseleave",function(o){t.hideTooltip()})),t.set("tooltip",i)},e.prototype.onClick=function(t){var n=this.get("itemTypes");if(!(t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=t.item,a=this.get("graph");this.currentTarget===i?(this.currentTarget=null,this.hideTooltip(),a.emit("tooltipchange",{item:t.item,action:"hide"})):(this.currentTarget=i,this.showTooltip(t),a.emit("tooltipchange",{item:t.item,action:"show"}))}},e.prototype.onMouseEnter=function(t){var n=this.get("itemTypes");if(!(t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=t.item,a=this.get("graph");this.currentTarget=i,this.showTooltip(t),a.emit("tooltipchange",{item:t.item,action:"show"})}},e.prototype.onMouseMove=function(t){var n=this.get("itemTypes");t.item&&t.item.getType&&n.indexOf(t.item.getType())===-1||!this.currentTarget||t.item!==this.currentTarget||this.showTooltip(t)},e.prototype.onMouseLeave=function(){this.hideTooltip();var t=this.get("graph");t.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},e.prototype.clearContainer=function(){var t=this.get("tooltip");t&&(t.innerHTML="")},e.prototype.showTooltip=function(t){if(t.item){var n=this.get("itemTypes");if(!(t.item.getType&&n.indexOf(t.item.getType())===-1)){var i=this.get("tooltip"),a=this.get("getContent"),o=a(t);Pe(o)?i.innerHTML=o:(this.clearContainer(),i.appendChild(o)),this.updatePosition(t)}}},e.prototype.hideTooltip=function(){var t=this.get("tooltip");t&&jt(t,{visibility:"hidden",display:"none"})},e.prototype.updatePosition=function(t){var n=this.get("shouldBegin"),i=this.get("tooltip");if(!n(t)){jt(i,{visibility:"hidden",display:"none"});return}var a=this.get("graph"),o=a.get("width"),s=a.get("height"),u=this.get("offsetX")||0,f=this.get("offsetY")||0,l=a.getPointByClient(t.clientX,t.clientY),c=this.get("fixToNode"),h=t.item;if(h.getType&&h.getType()==="node"&&c&&vt(c)&&c.length>=2){var d=h.getBBox();l={x:d.minX+d.width*c[0],y:d.minY+d.height*c[1]}}var v=a.getCanvasByPoint(l.x,l.y),p=v.x,g=v.y,y=a.getContainer(),m={x:p+y.offsetLeft+u,y:g+y.offsetTop+f};jt(i,{visibility:"visible",display:"unset"});var b=i.getBoundingClientRect();p+b.width+u>o&&(m.x-=b.width+u),g+b.height+f>s&&(m.y-=b.height+f,m.y<0&&(m.y=0)),jt(i,{left:"".concat(m.x,"px"),top:"".concat(m.y,"px")})},e.prototype.hide=function(){this.onMouseLeave()},e.prototype.destroy=function(){var t=this.get("tooltip");if(t){var n=this.get("container");n||(n=this.get("graph").get("container")),Pe(n)&&(n=document.getElementById(n)),n.removeChild(t)}},e}(zn),PL="timebarstartplay",RL="timebarendplay",pa="valuechange",ms="timebarConfigChanged",Ao="playPauseBtn",$l="nextStepBtn",jl="preStepBtn",Zse=function(){function r(e){var t=e.x,n=t===void 0?0:t,i=e.y,a=i===void 0?0:i,o=e.container,s=e.text,u=e.padding,f=u===void 0?[4,4,4,4]:u,l=e.className,c=l===void 0?"g6-component-timebar-tooltip":l,h=e.backgroundColor,d=h===void 0?"#000":h,v=e.textColor,p=v===void 0?"#fff":v,g=e.opacity,y=g===void 0?.8:g,m=e.fontSize,b=m===void 0?12:m;this.container=o,this.className=c,this.backgroundColor=d,this.textColor=p,this.x=n,this.y=a,this.text=s,this.padding=f,this.opacity=y,this.fontSize=b,this.render()}return r.prototype.render=function(){var e=this,t=e.className;e.x,e.y;var n=e.backgroundColor,i=e.textColor,a=e.text,o=e.padding,s=e.opacity,u=e.fontSize,f=e.container,l=wr("
    '));Pe(f)&&(f=document.getElementById(f)),f.appendChild(l),e.parentHeight=f.offsetHeight,e.parentWidth=f.offsetWidth,jt(l,{visibility:"hidden",top:0,left:0});var c=wr(`
    "));c.innerHTML=a,l.appendChild(c),e.backgroundDOM=c;var h=wr("
    "));l.appendChild(h),e.arrowDOM=h,e.container=l},r.prototype.show=function(e){var t=this,n=e.text,i=e.x;e.y,e.clientX,e.clientY,t.backgroundDOM.innerHTML=n;var a=t.backgroundDOM.offsetWidth,o=t.backgroundDOM.offsetHeight,s=t.arrowDOM.offsetWidth,u=t.arrowDOM.offsetHeight;jt(t.container,{top:"".concat(-o-u,"px"),left:"".concat(i,"px"),visibility:"visible"}),jt(t.backgroundDOM,{marginLeft:"".concat(-a/2,"px")}),jt(t.arrowDOM,{marginLeft:"".concat(-s/2,"px"),top:"".concat(o,"px")});var f=i-a/2,l=i+a/2;f<0?jt(t.backgroundDOM,{marginLeft:"".concat(-a/2-f,"px")}):l>t.parentWidth&&jt(t.backgroundDOM,{marginLeft:"".concat(-a/2-l+t.parentWidth+12,"px")})},r.prototype.hide=function(){jt(this.container,{top:0,left:0,visibility:"hidden"})},r}(),g1=function(){return g1=Object.assign||function(r){for(var e,t=1,n=arguments.length;tl&&(o=l,a=f)})}t.originalEvent.deltaY>0?a=Math.max(0,a-1):a=Math.min(e.speedAxisY.length-1,a+1);var s=e.speedAxisY[a]-i;n=Ul(n,[["t",0,s]]),e.speedPoint.setMatrix(n),e.currentSpeed=e.speedAxisY.length-a,e.speedText.attr("text","".concat(e.currentSpeed,".0X")),e.group.emit(ms,{speed:e.currentSpeed,type:e.currentType})}),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",function(t){var n,i,a=t.target.get("isChecked");a?(e.checkedIcon.hide(),e.checkedText.attr("text",((i=e.controllerCfg)===null||i===void 0?void 0:i.timePointControllerText)||"单一时间"),e.currentType=ga.RANGE):(e.checkedIcon.show(),e.checkedText.attr("text",((n=e.controllerCfg)===null||n===void 0?void 0:n.timeRangeControllerText)||"时间范围"),e.currentType=ga.SINGLE),t.target.set("isChecked",!a),e.group.emit(ms,{type:e.currentType,speed:e.currentSpeed})})},r.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},r}(),Xl=function(){return Xl=Object.assign||function(r){for(var e,t=1,n=arguments.length;t=M&&k<=C,G=O?l:c,D=w.addShape("rect",{attrs:Xl({x:a+k*(x+m),y:a,width:x,height:y},G),draggable:!0,name:"tick-rect-".concat(k)}),$=w.addShape("rect",{attrs:{x:a+k*x+m*(2*k-1)/2,y:a,width:k===0||k===b-1?x+m/2:x+m,height:y,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(k)});$.toFront();var Y=D.getBBox(),N=(Y.minX+Y.maxX)/2;E.push({rect:D,pickRect:$,value:T.date,x:N,y:Y.minY});var P;if(f?(P=f(T),!Pe(P)&&P&&(P=T.date)):k%Math.round(b/10)===0&&(P=T.date),P){_.push(P);var W=Y.maxY+a*2;w.addShape("line",{attrs:{stroke:"#BFBFBF",x1:N,y1:W,x2:N,y2:W+p},name:"tick-line"});var J=W+p+a,te=w.addShape("text",{attrs:Xl({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:N,y:J,textAlign:"center",text:P,textBaseline:"top",fontSize:10,fontFamily:e.fontFamily||"Arial, sans-serif"},h),capture:!1,name:"tick-label"}),H=te.getBBox();if(H.maxX>n?te.attr("textAlign","right"):H.minX<0&&te.attr("textAlign","left"),ht(S)&&_.length!==10){var pe=iue([1,0,0,0,1,0,0,0,1],[["t",-N,-J],["r",S],["t",N-5,J+2]]);te.attr({textAlign:"left",matrix:pe})}_.length===1?te.attr({textAlign:"left"}):_.length===10&&te.attr({textAlign:"right"})}}),this.tickRects=E;var A=this.group;this.currentSpeed=1,this.controllerBtnGroup=new GL(Xl({group:A,x:this.x,y:this.y+i+5,width:n,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"},this.controllerCfg))},r.prototype.initEvent=function(){var e=this,t=this.sliceGroup;t.on("click",function(l){var c=l.target;if(!(c.get("type")!=="rect"||!c.get("name"))){var h=parseInt(c.get("name").split("-")[2],10);if(!isNaN(h)){var d=e.tickRects,v=e.unselectedTickStyle;d.forEach(function(m){m.rect.attr(v)});var p=e.selectedTickStyle;d[h].rect.attr(p),e.startTickRectId=h,e.endTickRectId=h;var g=d.length,y=h/g;e.graph.emit(pa,{value:[y,y]})}}}),t.on("dragstart",function(l){var c=e.tickRects,h=e.unselectedTickStyle;c.forEach(function(m){m.rect.attr(h)});var d=l.target,v=parseInt(d.get("name").split("-")[2],10),p=e.selectedTickStyle;c[v].rect.attr(p),e.startTickRectId=v;var g=c.length,y=v/g;e.graph.emit(pa,{value:[y,y]}),e.dragging=!0}),t.on("dragover",function(l){if(e.dragging&&l.target.get("type")==="rect"){for(var c=parseInt(l.target.get("name").split("-")[2],10),h=e.startTickRectId,d=e.tickRects,v=e.selectedTickStyle,p=e.unselectedTickStyle,g=0;g=h&&g<=c?v:p;d[g].rect.attr(y)}var m=d.length;e.endTickRectId=c;var b=h/m,x=c/m;e.graph.emit(pa,{value:[b,x]})}}),t.on("drop",function(l){if(e.dragging&&(e.dragging=!1,l.target.get("type")==="rect")){var c=e.startTickRectId,h=parseInt(l.target.get("name").split("-")[2],10);if(!(h0?t.endTickRectId++:(n[t.endTickRectId].rect.attr(a),t.endTickRectId--),s!==t.startTickRectId)t.endTickRectIdthis.max?NaN:this.values[a]},e.prototype.getText=function(t){for(var n=[],i=1;i1?t-1:t}this.translateIndexMap&&(this.translateIndexMap=void 0)},e}(m1),$L=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,Io="\\d\\d?",ko="\\d\\d",fue="\\d{3}",lue="\\d{4}",Wl="[^\\s]+",jL=/\[([^]*?)\]/gm;function UL(r,e){for(var t=[],n=0,i=r.length;n-1?i:null}};function Lo(r){for(var e=[],t=1;t3?0:(r-r%10!==10?1:0)*r%10]}},Iv=Lo({},b1),VL=function(r){return Iv=Lo(Iv,r)},HL=function(r){return r.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},$n=function(r,e){for(e===void 0&&(e=2),r=String(r);r.length0?"-":"+")+$n(Math.floor(Math.abs(e)/60)*100+Math.abs(e)%60,4)},Z:function(r){var e=r.getTimezoneOffset();return(e>0?"-":"+")+$n(Math.floor(Math.abs(e)/60),2)+":"+$n(Math.abs(e)%60,2)}},qL=function(r){return+r-1},ZL=[null,Io],KL=[null,Wl],QL=["isPm",Wl,function(r,e){var t=r.toLowerCase();return t===e.amPm[0]?0:t===e.amPm[1]?1:null}],JL=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(r){var e=(r+"").match(/([+-]|\d\d)/gi);if(e){var t=+e[1]*60+parseInt(e[2],10);return e[0]==="+"?t:-t}return 0}],vue={D:["day",Io],DD:["day",ko],Do:["day",Io+Wl,function(r){return parseInt(r,10)}],M:["month",Io,qL],MM:["month",ko,qL],YY:["year",ko,function(r){var e=new Date,t=+(""+e.getFullYear()).substr(0,2);return+(""+(+r>68?t-1:t)+r)}],h:["hour",Io,void 0,"isPm"],hh:["hour",ko,void 0,"isPm"],H:["hour",Io],HH:["hour",ko],m:["minute",Io],mm:["minute",ko],s:["second",Io],ss:["second",ko],YYYY:["year",lue],S:["millisecond","\\d",function(r){return+r*100}],SS:["millisecond",ko,function(r){return+r*10}],SSS:["millisecond",fue],d:ZL,dd:ZL,ddd:KL,dddd:KL,MMM:["month",Wl,XL("monthNamesShort")],MMMM:["month",Wl,XL("monthNames")],a:QL,A:QL,ZZ:JL,Z:JL},kv={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"},eN=function(r){return Lo(kv,r)},tN=function(r,e,t){if(e===void 0&&(e=kv.default),t===void 0&&(t={}),typeof r=="number"&&(r=new Date(r)),Object.prototype.toString.call(r)!=="[object Date]"||isNaN(r.getTime()))throw new Error("Invalid Date pass to format");e=kv[e]||e;var n=[];e=e.replace(jL,function(a,o){return n.push(o),"@@@"});var i=Lo(Lo({},Iv),t);return e=e.replace($L,function(a){return due[a](r,i)}),e.replace(/@@@/g,function(){return n.shift()})};function rN(r,e,t){if(t===void 0&&(t={}),typeof e!="string")throw new Error("Invalid format in fecha parse");if(e=kv[e]||e,r.length>1e3)return null;var n=new Date,i={year:n.getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},a=[],o=[],s=e.replace(jL,function(x,w){return o.push(HL(w)),"@@@"}),u={},f={};s=HL(s).replace($L,function(x){var w=vue[x],E=w[0],_=w[1],M=w[3];if(u[E])throw new Error("Invalid format. "+E+" specified twice in format");return u[E]=!0,M&&(f[M]=!0),a.push(w),"("+_+")"}),Object.keys(f).forEach(function(x){if(!u[x])throw new Error("Invalid format. "+x+" is required in specified format")}),s=s.replace(/@@@/g,function(){return o.shift()});var l=r.match(new RegExp(s,"i"));if(!l)return null;for(var c=Lo(Lo({},Iv),t),h=1;h11||i.month<0||i.day>31||i.day<1||i.hour>23||i.hour<0||i.minute>59||i.minute<0||i.second>59||i.second<0)return null;return y}var nN={format:tN,parse:rN,defaultI18n:b1,setGlobalDateI18n:VL,setGlobalDateMasks:eN};const pue=Object.freeze(Object.defineProperty({__proto__:null,assign:Lo,default:nN,defaultI18n:b1,format:tN,parse:rN,setGlobalDateI18n:VL,setGlobalDateMasks:eN},Symbol.toStringTag,{value:"Module"}));function gue(r){return function(e,t,n,i){for(var a=ct(n)?0:n,o=ct(i)?e.length:i;a>>1;r(e[s])>t?o=s:a=s+1}return a}}var iN="format";function aN(r,e){var t=pue[iN]||nN[iN];return t(r,e)}function Lv(r){return Pe(r)&&(r.indexOf("T")>0?r=new Date(r).getTime():r=new Date(r.replace(/-/gi,"/")).getTime()),wp(r)&&(r=r.getTime()),r}var Pi=1e3,bs=60*Pi,xs=60*bs,Xa=24*xs,Vl=Xa*31,oN=Xa*365,Hl=[["HH:mm:ss",Pi],["HH:mm:ss",Pi*10],["HH:mm:ss",Pi*30],["HH:mm",bs],["HH:mm",bs*10],["HH:mm",bs*30],["HH",xs],["HH",xs*6],["HH",xs*12],["YYYY-MM-DD",Xa],["YYYY-MM-DD",Xa*4],["YYYY-WW",Xa*7],["YYYY-MM",Vl],["YYYY-MM",Vl*4],["YYYY-MM",Vl*6],["YYYY",Xa*380]];function yue(r,e,t){var n=(e-r)/t,i=gue(function(o){return o[1]})(Hl,n)-1,a=Hl[i];return i<0?a=Hl[0]:i>=Hl.length&&(a=ri(Hl)),a}var mue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="timeCat",t}return e.prototype.translate=function(t){t=Lv(t);var n=this.values.indexOf(t);return n===-1&&(ht(t)&&t-1){var a=this.values[i],o=this.formatter;return a=o?o(a,n):aN(a,this.mask),a}return t},e.prototype.initCfg=function(){this.tickMethod="time-cat",this.mask="YYYY-MM-DD",this.tickCount=7},e.prototype.setDomain=function(){var t=this.values;ye(t,function(n,i){t[i]=Lv(n)}),t.sort(function(n,i){return n-i}),r.prototype.setDomain.call(this)},e}(Yl),Nv=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.isContinuous=!0,t}return e.prototype.scale=function(t){if(ct(t))return NaN;var n=this.rangeMin(),i=this.rangeMax(),a=this.max,o=this.min;if(a===o)return n;var s=this.getScalePercent(t);return n+s*(i-n)},e.prototype.init=function(){r.prototype.init.call(this);var t=this.ticks,n=Xi(t),i=ri(t);nthis.max&&(this.max=i),ct(this.minLimit)||(this.min=n),ct(this.maxLimit)||(this.max=i)},e.prototype.setDomain=function(){var t=Jb(this.values),n=t.min,i=t.max;ct(this.min)&&(this.min=n),ct(this.max)&&(this.max=i),this.min>this.max&&(this.min=n,this.max=i)},e.prototype.calculateTicks=function(){var t=this,n=r.prototype.calculateTicks.call(this);return this.nice||(n=Mc(n,function(i){return i>=t.min&&i<=t.max})),n},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;return(t-i)/(n-i)},e.prototype.getInvertPercent=function(t){return(t-this.rangeMin())/(this.rangeMax()-this.rangeMin())},e}(m1),ql=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="linear",t.isLinear=!0,t}return e.prototype.invert=function(t){var n=this.getInvertPercent(t);return this.min+n*(this.max-this.min)},e.prototype.initCfg=function(){this.tickMethod="wilkinson-extended",this.nice=!1},e}(Nv);function No(r,e){var t=Math.E,n;return e>=0?n=Math.pow(t,Math.log(e)/r):n=Math.pow(t,Math.log(-e)/r)*-1,n}function pi(r,e){return r===1?1:Math.log(e)/Math.log(r)}function sN(r,e,t){ct(t)&&(t=Math.max.apply(null,r));var n=t;return ye(r,function(i){i>0&&i1&&(n=1),n}var bue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="log",t}return e.prototype.invert=function(t){var n=this.base,i=pi(n,this.max),a=this.rangeMin(),o=this.rangeMax()-a,s,u=this.positiveMin;if(u){if(t===0)return 0;s=pi(n,u/n);var f=1/(i-s)*o;if(t=0?1:-1;return Math.pow(s,i)*u},e.prototype.initCfg=function(){this.tickMethod="pow",this.exponent=2,this.tickCount=5,this.nice=!0},e.prototype.getScalePercent=function(t){var n=this.max,i=this.min;if(n===i)return 0;var a=this.exponent,o=(No(a,t)-No(a,i))/(No(a,n)-No(a,i));return o},e}(Nv),wue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="time",t}return e.prototype.getText=function(t,n){var i=this.translate(t),a=this.formatter;return a?a(i,n):aN(i,this.mask)},e.prototype.scale=function(t){var n=t;return(Pe(n)||wp(n))&&(n=this.translate(n)),r.prototype.scale.call(this,n)},e.prototype.translate=function(t){return Lv(t)},e.prototype.initCfg=function(){this.tickMethod="time-pretty",this.mask="YYYY-MM-DD",this.tickCount=7,this.nice=!1},e.prototype.setDomain=function(){var t=this.values,n=this.getConfig("min"),i=this.getConfig("max");if((!ct(n)||!ht(n))&&(this.min=this.translate(this.min)),(!ct(i)||!ht(i))&&(this.max=this.translate(this.max)),t&&t.length){var a=[],o=1/0,s=o,u=0;ye(t,function(f){var l=Lv(f);if(isNaN(l))throw new TypeError("Invalid Time: "+f+" in time scale!");o>l?(s=o,o=l):s>l&&(s=l),u1&&(this.minTickInterval=s-o),ct(n)&&(this.min=o),ct(i)&&(this.max=u)}},e}(ql),uN=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="quantize",t}return e.prototype.invert=function(t){var n=this.ticks,i=n.length,a=this.getInvertPercent(t),o=Math.floor(a*(i-1));if(o>=i-1)return ri(n);if(o<0)return Xi(n);var s=n[o],u=n[o+1],f=o/(i-1),l=(o+1)/(i-1);return s+(a-f)/(l-f)*(u-s)},e.prototype.initCfg=function(){this.tickMethod="r-pretty",this.tickCount=5,this.nice=!0},e.prototype.calculateTicks=function(){var t=r.prototype.calculateTicks.call(this);return this.nice||(ri(t)!==this.max&&t.push(this.max),Xi(t)!==this.min&&t.unshift(this.min)),t},e.prototype.getScalePercent=function(t){var n=this.ticks;if(tri(n))return 1;var i=0;return ye(n,function(a,o){if(t>=a)i=o;else return!1}),i/(n.length-1)},e}(Nv),Eue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="quantile",t}return e.prototype.initCfg=function(){this.tickMethod="quantile",this.tickCount=5,this.nice=!0},e}(uN),fN={};function _ue(r){return fN[r]}function ma(r,e){if(_ue(r))throw new Error("type '"+r+"' existed.");fN[r]=e}var Sue=function(r){It(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="identity",t.isIdentity=!0,t}return e.prototype.calculateTicks=function(){return this.values},e.prototype.scale=function(t){return this.values[0]!==t&&ht(t)?t:this.range[0]},e.prototype.invert=function(t){var n=this.range;return tn[1]?NaN:this.values[0]},e}(m1);function lN(r){var e=r.values,t=r.tickInterval,n=r.tickCount,i=r.showLast;if(ht(t)){var a=Mc(e,function(v,p){return p%t===0}),o=ri(e);return i&&ri(a)!==o&&a.push(o),a}var s=e.length,u=r.min,f=r.max;if(ct(u)&&(u=0),ct(f)&&(f=e.length-1),!ht(n)||n>=s)return e.slice(u,f+1);if(n<=0||f<=0)return[];for(var l=n===1?s:Math.floor(s/(n-1)),c=[],h=u,d=0;d=f);d++)h=Math.min(u+d*l,f),d===n-1&&i?c.push(e[f]):c.push(e[h]);return c}function Mue(r){var e=r.min,t=r.max,n=r.nice,i=r.tickCount,a=new Cue;return a.domain([e,t]),n&&a.nice(i),a.ticks(i)}var x1=5,cN=Math.sqrt(50),hN=Math.sqrt(10),dN=Math.sqrt(2),Cue=function(){function r(){this._domain=[0,1]}return r.prototype.domain=function(e){return e?(this._domain=Array.from(e,Number),this):this._domain.slice()},r.prototype.nice=function(e){var t,n;e===void 0&&(e=x1);var i=this._domain.slice(),a=0,o=this._domain.length-1,s=this._domain[a],u=this._domain[o],f;return u0?(s=Math.floor(s/f)*f,u=Math.ceil(u/f)*f,f=Ov(s,u,e)):f<0&&(s=Math.ceil(s*f)/f,u=Math.floor(u*f)/f,f=Ov(s,u,e)),f>0?(i[a]=Math.floor(s/f)*f,i[o]=Math.ceil(u/f)*f,this.domain(i)):f<0&&(i[a]=Math.ceil(s*f)/f,i[o]=Math.floor(u*f)/f,this.domain(i)),this},r.prototype.ticks=function(e){return e===void 0&&(e=x1),Aue(this._domain[0],this._domain[this._domain.length-1],e||x1)},r}();function Aue(r,e,t){var n,i=-1,a,o,s;if(e=+e,r=+r,t=+t,r===e&&t>0)return[r];if((n=e0)for(r=Math.ceil(r/s),e=Math.floor(e/s),o=new Array(a=Math.ceil(e-r+1));++i=0?(a>=cN?10:a>=hN?5:a>=dN?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=cN?10:a>=hN?5:a>=dN?2:1)}function vN(r,e,t){var n;return t==="ceil"?n=Math.ceil(r/e):t==="floor"?n=Math.floor(r/e):n=Math.round(r/e),n*e}function w1(r,e,t){var n=vN(r,t,"floor"),i=vN(e,t,"ceil");n=Tc(n,t),i=Tc(i,t);for(var a=[],o=Math.max((i-n)/(Math.pow(2,12)-1),t),s=n;s<=i;s=s+o){var u=Tc(s,o);a.push(u)}return{min:n,max:i,ticks:a}}function E1(r,e,t){var n,i=r.minLimit,a=r.maxLimit,o=r.min,s=r.max,u=r.tickCount,f=u===void 0?5:u,l=ct(i)?ct(e)?o:e:i,c=ct(a)?ct(t)?s:t:a;if(l>c&&(n=[l,c],c=n[0],l=n[1]),f<=2)return[l,c];for(var h=(c-l)/(f-1),d=[],v=0;v=0&&(u=1),1-s/(o-1)-t+u}function Oue(r,e,t){var n=Nc(e),i=_p(e,r),a=1;return 1-i/(n-1)-t+a}function Due(r,e,t,n,i,a){var o=(r-1)/(a-i),s=(e-1)/(Math.max(a,n)-Math.min(t,i));return 2-Math.max(o/s,s/o)}function Pue(r,e){return r>=e?2-(r-1)/(e-1):1}function Rue(r,e,t,n){var i=e-r;return 1-.5*(Math.pow(e-n,2)+Math.pow(r-t,2))/Math.pow(.1*i,2)}function Bue(r,e,t){var n=e-r;if(t>n){var i=(t-n)/2;return 1-Math.pow(i,2)/Math.pow(.1*n,2)}return 1}function Fue(){return 1}function Gue(r,e,t,n,i,a){t===void 0&&(t=5),n===void 0&&(n=!0),i===void 0&&(i=Iue),a===void 0&&(a=[.25,.2,.5,.05]);var o=t<0?0:Math.round(t);if(Number.isNaN(r)||Number.isNaN(e)||typeof r!="number"||typeof e!="number"||!o)return{min:0,max:0,ticks:[]};if(e-r<1e-15||o===1)return{min:r,max:e,ticks:[r]};if(e-r>1e148){var s=t||5,u=(e-r)/s;return{min:r,max:e,ticks:Array(s).fill(null).map(function(W,J){return ws(r+u*J)})}}for(var f={score:-2,lmin:0,lmax:0,lstep:0},l=1;l<1/0;){for(var c=0;cf.score&&(!n||M<=r&&C>=e)&&(f.lmin=M,f.lmax=C,f.lstep=S,f.score=G)}y+=1}v+=1}}l+=1}var D=ws(f.lmax),$=ws(f.lmin),Y=ws(f.lstep),N=Math.floor(Lue((D-$)/Y))+1,P=new Array(N);P[0]=ws($);for(var c=1;c0)o=Math.floor(pi(e,n));else{var u=sN(a,e,i);o=Math.floor(pi(e,u))}for(var f=s-o,l=Math.ceil(f/t),c=[],h=o;h=0?1:-1;return Math.pow(o,e)*s})}function Uue(r,e){var t=r.length*e;return e===1?r[r.length-1]:e===0?r[0]:t%1!==0?r[Math.ceil(t)-1]:r.length%2===0?(r[t-1]+r[t])/2:r[t]}function Xue(r){var e=r.tickCount,t=r.values;if(!t||!t.length)return[];for(var n=t.slice().sort(function(s,u){return s-u}),i=[],a=0;a1&&(i=i*Math.ceil(s)),n&&ioN)for(var u=Dv(t),f=Math.ceil(a/oN),l=s;l<=u+f;l=l+f)o.push(Hue(l));else if(a>Vl)for(var c=Math.ceil(a/Vl),h=_1(e),d=que(e,t),l=0;l<=d+c;l=l+c)o.push(Zue(s,l+h));else if(a>Xa)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),y=v.getDate(),m=Math.ceil(a/Xa),b=Kue(e,t),l=0;lxs)for(var v=new Date(e),p=v.getFullYear(),g=v.getMonth(),m=v.getDate(),x=v.getHours(),w=Math.ceil(a/xs),E=Que(e,t),l=0;l<=E+w;l=l+w)o.push(new Date(p,g,m,x+l).getTime());else if(a>bs)for(var _=Jue(e,t),M=Math.ceil(a/bs),l=0;l<=_+M;l=l+M)o.push(e+l*bs);else{var C=a;C=512&&console.warn("Notice: current ticks length("+o.length+') >= 512, may cause performance issues, even out of memory. Because of the configure "tickInterval"(in milliseconds, current is '+a+") is too small, increase the value to solve the problem!"),o}ya("cat",lN),ya("time-cat",Vue),ya("wilkinson-extended",zue),ya("r-pretty",Yue),ya("time",Wue),ya("time-pretty",efe),ya("log",$ue),ya("pow",jue),ya("quantile",Xue),ya("d3-linear",Tue),ma("cat",Yl),ma("category",Yl),ma("identity",Sue),ma("linear",ql),ma("log",bue),ma("pow",xue),ma("time",wue),ma("timeCat",mue),ma("quantize",uN),ma("quantile",Eue);var tfe=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;np?(E.show(),M.show(),p=C.minX+C.width+10):(E.hide(),M.hide()),E}),this.controllerBtnGroup=new GL(br({group:this.group,x:this.x,y:this.y+i+25,width:n,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),s.move(this.x,this.y),this.bindEvents(),this.currentMode===ga.SINGLE&&(this.minHandlerShape.hide(),this.foregroundShape.hide(),this.minTextShape.hide())},r.prototype.bindEvents=function(){var e=this,t=this.group.find(function(i){return i.get("name")==="minHandlerShape"});t&&(t.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),t.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var n=this.group.find(function(i){return i.get("name")==="maxHandlerShape"});n&&(n.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),n.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on("".concat(Ao,":click"),function(){e.isPlay=!e.isPlay,e.currentHandler=e.maxHandlerShape,e.changePlayStatus()}),this.group.on("".concat($l,":click"),function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(.01),e.updateUI()}),this.group.on("".concat(jl,":click"),function(){e.currentHandler=e.maxHandlerShape,e.updateStartEnd(-.01),e.updateUI()}),this.group.on(ms,function(i){var a=i.type,o=i.speed;e.currentSpeed=o,e.currentMode=a,a===ga.SINGLE?(e.minHandlerShape.hide(),e.foregroundShape.hide(),e.minTextShape.hide()):a===ga.RANGE&&(e.minHandlerShape.show(),e.foregroundShape.show(),e.minTextShape.show())})},r.prototype.adjustTickIndex=function(e){for(var t=0;t1&&(this.start=1),this.end>1&&(this.end=1),this.end<0&&(this.end=0);var t=this.x+this.start*this.width,n=this.x+this.end*this.width;this.foregroundShape.attr("x",t),this.foregroundShape.attr("width",n-t);var i=Ea(this.handlerStyle,"width",S1);this.setText(this.minText,this.maxText);var a=this.dodgeText([t,n]),o=a[0],s=a[1];this.minHandlerShape.setX(t-i/2),ye(o,function(u,f){return e.minTextShape.attr(f,u)}),this.maxHandlerShape.setX(n-i/2),ye(s,function(u,f){return e.maxTextShape.attr(f,u)}),this.currentMode===ga.RANGE?this.graph.emit(pa,{value:[this.start,this.end].sort()}):this.currentMode===ga.SINGLE&&this.graph.emit(pa,{value:[this.end,this.end]})},r.prototype.dodgeText=function(e){var t,n,i=2,a=Ea(this.handlerStyle,"width",S1),o=this.minTextShape,s=this.maxTextShape,u=e[0],f=e[1],l=!1;u>f&&(t=[f,u],u=t[0],f=t[1],n=[s,o],o=n[0],s=n[1],l=!0);var c=o.getBBox(),h=s.getBBox(),d=null,v=null;return this.timeBarType==="trend"?(d=u-c.widththis.x+this.width?{x:f-a/2-i,textAlign:"right"}:{x:f+a/2+i,textAlign:"left"}):this.timeBarType==="simple"&&(d=o.attr("x")>c.width?{x:u,textAlign:"center"}:{x:u,textAlign:"left"},v=s.attr("x")>this.width-h.width?{x:f,textAlign:"right"}:{x:f,textAlign:"center"}),l?[v,d]:[d,v]},r.prototype.startPlay=function(){var e=this;return typeof window<"u"?window.requestAnimationFrame(function(){var t=e,n=t.ticks,i=t.width,a=e.currentSpeed,o=i/n.length,s=o/((10-a)*1e3/60),u=e.adjustOffsetRange(s/e.width);e.updateStartEnd(u),e.updateUI(),e.isPlay&&(e.playHandler=e.startPlay())}):void 0},r.prototype.changePlayStatus=function(e){e===void 0&&(e=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(PL,null)):this.playHandler&&(typeof window<"u"&&window.cancelAnimationFrame(this.playHandler),e&&this.graph.emit(RL,null))},r.prototype.destory=function(){this.graph.off(pa,function(){});var e=this.group,t=e.find(function(i){return i.get("name")==="minHandlerShape"});t&&(t.off("minHandlerShape-handler:mousedown"),t.off("minHandlerShape-handler:touchstart"),t.destroy());var n=e.find(function(i){return i.get("name")==="maxHandlerShape"});n&&(n.off("maxHandlerShape-handler:mousedown"),n.off("maxHandlerShape-handler:touchstart"),n.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),e.off("".concat(Ao,":click")),e.off("".concat($l,":click")),e.off("".concat(jl,":click")),e.off(ms),e.destroy(),this.trendComponent&&this.trendComponent.destory()},r}(),Sfe=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),Ya=function(){return Ya=Object.assign||function(r){for(var e,t=1,n=arguments.length;t
    ")),jt(f,{position:"relative"})),o){var l=this.get("graph").get("container");l.appendChild(f)}this.set("timeBarContainer",f);var c,h=t.get("renderer");h==="SVG"?c=new $f({container:f,width:i,height:a}):c=new Aa({container:f,width:i,height:a}),this.get("containerCSS")&&jt(f,this.get("containerCSS")),this.set("canvas",c)},e.prototype.init=function(){this.initContainer();var t=this.get("canvas"),n=t.addGroup({name:"timebar-group"});this.set("timeBarGroup",n),this.renderTrend(),this.initEvent();var i=typeof window<"u"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",i)},e.prototype.play=function(){this.togglePlay(!0)},e.prototype.pause=function(){this.togglePlay(!1)},e.prototype.togglePlay=function(t){var n=this.get("timebar");n&&(n.isPlay=!!t,n.changePlayStatus())},e.prototype.renderTrend=function(){var t=this,n=this._cfgs,i=n.width,a=n.x,o=n.y,s=n.padding,u=n.type,f=n.trend,l=n.slider,c=n.controllerCfg,h=n.textStyle,d=n.tick,v=n.backgroundStyle,p=n.foregroundStyle,g=f.data,y=Mfe(f,["data"]),m=i-2*s,b=u==="trend"?Afe:Cfe,x=this.get("graph"),w=this.get("timeBarGroup"),E=this.get("canvas"),_=null;if(u==="trend"||u==="simple"){var M=this.get("getValue");_=new _fe(Ya(Ya({graph:x,canvas:E,group:w,type:u,x:a+s,y:u==="trend"?o+s:o+s+15,width:m,height:b,padding:s,backgroundStyle:v,foregroundStyle:p,trendCfg:Ya(Ya({},y),{data:g.map(function(S){return(M==null?void 0:M(S))||S.value})})},l),{tick:{ticks:g,tickLabelFormatter:d.tickLabelFormatter,tickLabelStyle:d.tickLabelStyle,tickLineStyle:d.tickLineStyle},handlerStyle:Ya(Ya({},l.handlerStyle),{height:l.height||b}),controllerCfg:c,textStyle:h}))}else u==="tick"&&(_=new sue(Ya({graph:x,canvas:E,group:w,x:a+s,y:o+s,width:i,height:42,padding:2,controllerCfg:c},d)));var C=function S(){var A=t.get("timebar");A.draggingHandler=!1,A.isPlay&&(A.isPlay=!1,A.currentHandler=A.maxHandlerShape,A.changePlayStatus()),document.removeEventListener("mouseup",S)};E.on("mousedown",function(S){(S.target.get("name")==="maxHandlerShape-handler"||S.target.get("name")==="minHandlerShape-handler"||S.target===_.foregroundShape)&&document.addEventListener("mouseup",C)}),this.set("timebar",_)},e.prototype.filterData=function(t){var n,i=t.value;if(!i){i=[];var a=this._cfgs.type;!a||a==="trend"||a==="simple"?(i[0]=this._cfgs.slider.start,i[1]=this._cfgs.slider.end):a==="tick"&&(i[0]=this._cfgs.tick.start,i[1]=this._cfgs.tick.end)}var o=null,s=this._cfgs.type;if(s==="trend"||s==="simple"?o=this._cfgs.trend.data:s==="tick"&&(o=this._cfgs.tick.data),!o||o.length===0){console.warn("请配置 TimeBar 组件的数据");return}var u=this.get("rangeChange"),f=this.get("graph"),l=Math.round(o.length*i[0]),c=Math.round(o.length*i[1]);c=c>=o.length?o.length-1:c,l=l>=o.length?o.length-1:l;var h=(n=this._cfgs.tick)===null||n===void 0?void 0:n.tickLabelFormatter,d=h?h(o[l]):o[l].date,v=h?h(o[c]):o[c].date;if(s!=="tick"){var p=this.get("timebar");p.setText(d,v)}if(u)u(f,d,v);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&this.cacheGraphData.nodes.length===0)&&(this.cacheGraphData=f.get("data"));var g=this.get("filterItemTypes"),y=this.get("changeData"),m=this.get("getDate"),b=this.get("shouldIgnore"),x=o[l].date,w=o[c].date;if(y||y===void 0){var E=this.cacheGraphData.nodes,_=this.cacheGraphData.edges,M={},C={};f.getNodes().forEach(function(S){return M[S.getID()]=!0}),f.getEdges().forEach(function(S){return C[S.getID()]=!0}),g.includes("node")&&(E==null||E.forEach(function(S){var A=+((m==null?void 0:m(S))||S.date),T=A>=x&&A<=w||(b==null?void 0:b("node",S,{min:x,max:w})),k=M[S.id];k&&!T?(f.removeItem(S.id),M[S.id]=!1):!k&&T&&(f.addItem("node",S),M[S.id]=!0)}),_==null||_.forEach(function(S){var A=M[S.source]&&M[S.target]||(b==null?void 0:b("edge",S,{min:x,max:w})),T=!!f.findById(S.id);T&&!A?(f.removeItem(S.id),C[S.id]=!1):!T&&A?(f.addItem("edge",S),C[S.id]=!0):T||(C[S.id]=!1)})),(this.get("filterEdge")||g.includes("edge"))&&(_==null||_.filter(function(S){var A=+((m==null?void 0:m(S))||S.date),T=A>=x&&A<=w||(b==null?void 0:b("edge",S,{min:x,max:w})),k=M[S.source]&&M[S.target],O=T&&k,G=C[S.id];G&&!O?(C[S.id]=!1,f.removeItem(S.id)):!G&&O&&(C[S.id]=!0,f.addItem("edge",S))}))}else g.includes("node")&&f.getNodes().forEach(function(S){var A=S.getModel();if(!(b!=null&&b("node",A,{min:x,max:w}))){var T=+((m==null?void 0:m(A))||A.date);Tw?f.hideItem(S):f.showItem(S)}}),(this.get("filterEdge")||g.includes("edge"))&&f.getEdges().forEach(function(S){var A=S.getModel();if(!(b!=null&&b("edge",A,{min:o[l].date,max:o[c].date}))){var T=+((m==null?void 0:m(A))||A.date);if(To[c].date)f.hideItem(S);else{var k=S.getSource().isVisible(),O=S.getTarget().isVisible();k&&O&&f.showItem(S)}}})}},e.prototype.initEvent=function(){var t=this.get("graph");t.on("afterchangedata",this.changeData),t.on("afterrender",this.afterrenderListener),t.on(pa,this.valueChangeListener)},e.prototype.destroy=function(){var t=this.get("graph");t.off("afterchangedata",this.changeData),t.off("afterrender",this.afterrenderListener),t.off(pa,this.valueChangeListener);var n=this.get("timebar");n&&n.destory&&n.destory(),r.prototype.destroy.call(this);var i=this.get("timeBarContainer");if(i){var a=this.get("container");a||(a=this.get("graph").get("container")),Pe(a)&&(a=document.getElementById(a)),a===i&&(a=a.parentElement),a.removeChild(i)}},e}(zn),Ife=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),kfe=bn.applyMatrix;function Lfe(r,e){var t,n;if(r.naturalWidth)t=r.naturalWidth,n=r.naturalHeight;else{var i=new Image;i.src=r.src,i.onload=function(){}}return[t,n]}var Nfe=function(r){Ife(e,r);function e(t){return r.call(this,t)||this}return e.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},e.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},e.prototype.disableRefresh=function(){this.set("refresh",!1)},e.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},e.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},e.prototype.initViewport=function(){var t=this,n=this._cfgs,i=n.graph;if(!this.destroyed){var a=this.get("container");Pe(a)&&(a=document.getElementById(a));var o=wr("
    m||d>b||(p=i.getZoom(),v=t.get("ratio"),f=!0,s=g.clientX,u=g.clientY)}},!1),a.addEventListener("mousemove",function(g){if(!(!f||ct(g.clientX)||ct(g.clientY))){var y=t.get("width"),m=t.get("height"),b=o.style;l=parseInt(b.left,10),c=parseInt(b.top,10),h=parseInt(b.width,10),d=parseInt(b.height,10);var x=s-g.clientX,w=u-g.clientY;l-x<0?x=l:l-x+h>=y&&(x=0),c-w<0?w=c:c-w+d>=m&&(w=0),l-=x,c-=w,jt(o,{left:"".concat(l,"px"),top:"".concat(c,"px")}),i.translate(x*p/v,w*p/v),s=g.clientX,u=g.clientY}},!1),a.addEventListener("mouseleave",function(){f=!1,n.refresh=!0},!1),a.addEventListener("mouseup",function(){f=!1,n.refresh=!0},!1),this.set("viewport",o),a.appendChild(o)}},e.prototype.updateViewport=function(){if(!this.destroyed){var t=this.get("ratio"),n=this.get("width"),i=this.get("height"),a=this.get("graph"),o=a.get("width"),s=a.get("height"),u=o/s,f=a.getGroup(),l=f.getCanvasBBox(),c=[(l.minX+l.maxX)/2,(l.minY+l.maxY)/2],h=[l.maxX-l.minX,l.maxY-l.minY],d={centerX:c[0],centerY:c[1],width:0,height:0,minX:0,minY:0};l[0]/l[1]>u?(d.width=h[0],d.height=d.width/u):(d.height=h[1],d.width=d.height*u),d.minX=c[0]-d.width/2,d.minY=c[1]-d.height/2;var v=f.getMatrix();v||(v=[1,0,0,0,1,0,0,0,1]);var p=Mp([1,0,0,0,1,0,0,0,1],v),g=kfe({x:d.minX,y:d.minY},p),y=a.getCanvasByPoint(g.x,g.y),m=this.get("viewport");m||this.initViewport();var b=o/d.width,x=b*n,w=b*i,E=n*-y.x/d.width,_=i*-y.y/d.height,M=E+x,C=_+w;E<0&&(x+=E,E=0),M>n&&(x=x-(M-n)),_<0&&(w+=_,_=0),C>i&&(w=w-(C-i)),this.set("ratio",t);var S="".concat(E,"px"),A="".concat(_,"px");jt(m,{left:S,top:A,width:"".concat(x,"px"),height:"".concat(w,"px")})}},e.prototype.init=function(){this.initContainer()},e.prototype.initContainer=function(){var t=this,n=t.get("graph"),i=n.get("width"),a=n.get("height"),o=a/i,s=t.get("className"),u=t.get("container"),f=t.get("width"),l=t.get("height");!f&&!l&&(f=200),f?(l=o*f,t.set("height",l)):(f=1/o*l,t.set("width",f));var c=wr("
    "));Pe(u)&&(u=document.getElementById(u)),u?u.appendChild(c):n.get("container").appendChild(c),t.set("container",c);var h=wr('
    ');c.appendChild(h);var d=wr('');h.appendChild(d),t.set("containerDOM",h),t.set("containerSpan",d);var v=wr(''));t.set("imgDOM",v),t.updateImgSize(),d.appendChild(v),t.updateCanvas()},e.prototype.updateImgSize=function(){var t=this,n=t.get("imgDOM"),i=t.get("width"),a=t.get("height");n.onload=function(){var o=Lfe(n);o[0]>o[1]?n.width=i:n.height=a}},e.prototype.updateCanvas=function(){var t=this.get("refresh");if(t){var n=this.get("graph");if(!n.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var i=this.get("width"),a=n.get("canvas").getCanvasBBox(),o=a.width,s=i/o;this.set("ratio",s),this.updateViewport()}}},e.prototype.getViewport=function(){return this.get("viewport")},e.prototype.getContainer=function(){return this.get("container")},e.prototype.updateGraphImg=function(t){var n=this,i=n.get("imgDOM");i.remove(),n.set("graphImg",t);var a=wr(''));n.set("imgDOM",a),a.src=t,n.updateImgSize();var o=n.get("containerSpan");o.appendChild(a),n.updateCanvas()},e.prototype.destroy=function(){var t=this.get("container");t.parentNode.removeChild(t)},e}(zn),Ofe=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),M1=function(){return M1=Object.assign||function(r){for(var e,t=1,n=arguments.length;t(u||i.get("height"))&&a>1||l<(f||i.get("height")*.05)&&a<1)&&(a=1),l*=a,n.set("r",l),n.filter(t)}},e.prototype.filter=function(t){var n=this,i=n.get("graph"),a=i.getNodes(),o={},s=n.get("r"),u=n.get("type"),f={x:t.x,y:t.y};n.updateDelegate(f,s);var l=n.get("shouldShow"),c=n.get("vShapes");c&&c.forEach(function(y){y.remove(),y.destroy()}),c=[],a.forEach(function(y){var m=y.getModel(),b=m.x,x=m.y;Dfe({x:b,y:x},f)
    `);s.appendChild(u),this.set("container",u);var f=this.render();jt(u,this.getContainerPos(f)),this.bindEvents()},e.prototype.getContainerPos=function(t){t===void 0&&(t=[0,0]);var n=this,i=n.get("graph"),a=this.get("offsetX"),o=this.get("offsetY"),s=this.get("margin"),u=this.get("position").split("-"),f={top:0,right:1,bottom:2,left:3},l=0,c=0,h={left:(i.getWidth()-t[0])/2+l,top:(i.getHeight()-t[1])/2+c};return u.forEach(function(d){var v=s[f[d]],p=d;switch(d){case"top":v+=c;break;case"left":v+=l;break;case"bottom":v=i.getHeight()-t[1]-v+c,p="top";break;default:v=i.getWidth()-t[0]-v+l,p="left";break}h[p]=v}),h.top+=o+i.getContainer().offsetTop,h.left+=a+i.getContainer().offsetLeft,Object.keys(h).forEach(function(d){h[d]="".concat(h[d],"px")}),h},e.prototype.bindEvents=function(){var t=this,n=t.get("filter");if(!(!n||!n.enable)){var i=n.trigger||"click";$fe.includes(i)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),i="click");var a=t.get("legendCanvas");i==="mouseenter"?(a.on("node-container:mouseenter",function(o){return t.filterData(o)}),a.on("node-container:mouseleave",function(o){t.clearFilter(),t.clearActiveLegend()})):(a.on("node-container:click",function(o){return t.filterData(o)}),a.on("click",function(o){o.target&&o.target.isCanvas&&o.target.isCanvas()&&(t.clearFilter(),t.clearActiveLegend())}))}},e.prototype.changeData=function(t){this.set("data",t);var n=this.render();jt(this.get("container"),this.getContainerPos(n))},e.prototype.activateLegend=function(t){var n=this.get("filter"),i=n==null?void 0:n.multiple;i||this.clearActiveLegend();var a=t.get("parent");a.get("active")?(a.set("active",!1),this.findLegendItemsByState("active").length&&a.set("inactive",!0)):(a.set("inactive",!1),a.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach(function(c){c.set("inactive",!0)}):this.clearActiveLegend();var o=(n==null?void 0:n.legendStateStyles)||{},s=(o==null?void 0:o.inactive)||{opacity:.5,"text-shape":{opacity:.5}},u=s["text-shape"]||{};this.findLegendItemsByState("inactive").forEach(function(c){var h=c.get("children"),d=h[0],v=h[1];d.attr(Ar(Ar({},d.get("oriAttrs")),s)),v.attr(Ar(Ar({},v.get("oriAttrs")),u))});var f=(o==null?void 0:o.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},l=f["text-shape"]||{};this.findLegendItemsByState("active").forEach(function(c){var h=c.get("children"),d=h[0],v=h[1];d.attr(Ar(Ar({},d.get("oriAttrs")),f)),v.attr(Ar(Ar({},v.get("oriAttrs")),l))})},e.prototype.findLegendItemsByState=function(t,n,i){n===void 0&&(n="all"),i===void 0&&(i=!0);var a=this.get("legendCanvas").find(function(u){return u.get("name")==="root"}),o=a.find(function(u){return u.get("name")==="node-group"}),s=a.find(function(u){return u.get("name")==="edge-group"});return n==="node"?o.get("children").filter(function(u){return!!u.get(t)===i}):n==="edge"?s.get("children").filter(function(u){return!!u.get(t)===i}):o.get("children").filter(function(u){return!!u.get(t)===i}).concat(s.get("children").filter(function(u){return!!u.get(t)===i}))},e.prototype.clearActiveLegend=function(){var t=this.get("legendCanvas"),n=t.find(function(a){return a.get("name")==="root"}),i=[n.find(function(a){return a.get("name")==="node-group"}),n.find(function(a){return a.get("name")==="edge-group"})];i.forEach(function(a){a.get("children").forEach(function(o){o.set("active",!1),o.set("inactive",!1);var s=o.get("children"),u=s[0],f=s[1];u.attr(u.get("oriAttrs")),f.attr(f.get("oriAttrs"))})})},e.prototype.filterData=function(t){var n=this.get("filter"),i=n==null?void 0:n.filterFunctions;if(!(!n||!i)){var a=this.get("legendCanvas"),o=this.get("graph"),s=n.graphActiveState||"active",u=n.graphInactiveState||"inactive",f=n.multiple;this.clearFilter(),f||this.clearActiveLegend(),this.activateLegend(t.target);var l=a.find(function(y){return y.get("name")==="root"}),c=l.find(function(y){return y.get("name")==="node-group"}),h=l.find(function(y){return y.get("name")==="edge-group"}),d=c.get("children").filter(function(y){return y.get("active")}),v=h.get("children").filter(function(y){return y.get("active")}),p=0,g=["getNodes","getEdges"];g.forEach(function(y){o[y]().forEach(function(m){var b=!1,x=y==="getNodes"?d:v;x.forEach(function(w){var E=i[w.get("id")];b=b||E(m.getModel())}),b?(o.setItemState(m,u,!1),o.setItemState(m,s,!0),p++):(o.setItemState(m,s,!1),o.setItemState(m,u,!0))})}),p||g.forEach(function(y){o[y]().forEach(function(m){o.clearItemStates(m,[u])})})}},e.prototype.clearFilter=function(){var t=this.get("graph"),n=this.get("filter");if(n){var i=n.graphActiveState||"active",a=n.graphInactiveState||"inactive";t.getNodes().forEach(function(o){t.clearItemStates(o,[i,a])}),t.getEdges().forEach(function(o){t.clearItemStates(o,[i,a])})}},e.prototype.render=function(){var t=this;this.processData();var n=this.get("legendCanvas");n?n.clear():n=new Aa({container:this.get("container"),width:200,height:200});var i=n.addGroup({name:"root"}),a=i.addGroup({name:"node-group"}),o=i.addGroup({name:"edge-group"});this.set("legendCanvas",n);var s=this.get("itemsData"),u=["nodes","edges"],f=[a,o];u.forEach(function(D,$){s[D].forEach(function(Y){var N,P=f[$].addGroup({id:Y.id,name:"node-container"}),W,J=Y.type,te=t.getShapeSize(Y),H=te.width,pe=te.height,Te=te.r,Ne=t.getStyle(D.substr(0,4),Y);switch(Y.type){case"circle":W={r:Te,x:0,y:0};break;case"rect":W={width:H,height:pe,x:-H/2,y:-pe/2};break;case"ellipse":W={rx:H,ry:pe,x:0,y:0},J="ellipse";break;case"line":W={x1:-H/2,y1:0,x2:H/2,y2:0},J="line";break;case"quadratic":W={path:[["M",-H/2,0],["Q",0,H/2,H/2,0]]},J="path";break;case"cubic":W={path:[["M",-H/2,0],["C",-H/6,H/2,H/6,-H/2,H/2,0]]},J="path";break;case"diamond":W={path:[["M",0,-pe],["L",H,0],["L",0,pe],["L",-H,0],["Z"]]},J="path";break;case"triangle":W={path:[["M",-H,pe],["L",0,-pe],["L",H,pe],["Z"]]},J="path";break;case"star":W={path:bn.getStarPath(Te*3,Te*1.2)},J="path";break;default:W={r:Te,x:0,y:0};break}var Ze=P.addShape(J,{attrs:Ar(Ar({},W),Ne),name:"".concat(Y.type,"-node-keyShape"),oriAttrs:Ar({opacity:1},Ne)});if(Y.label){var at=Ze.getBBox(),nt=((N=Y.labelCfg)===null||N===void 0?void 0:N.style)||{},St=Ar({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},nt);P.addShape("text",{attrs:Ar({x:at.maxX+4,y:0,text:Y.label},St),className:"legend-label",name:"".concat(Y.type,"-node-text"),oriAttrs:St})}})});var l=this.get("padding"),c,h=i.find(function(D){return D.get("name")==="title-container"}),d={height:0,maxY:0,width:0};if(this.get("title")){h||(h=i.addGroup({name:"title-container"}));var v={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:l[0]},p=this.get("titleConfig")||{},g=Object.assign(v,p.style||{});c=h.addShape("text",{attrs:Ar({text:this.get("title")},g)}),d=h.getCanvasBBox(),h.setMatrix([1,0,0,0,1,0,p.offsetX,p.offsetY,1])}this.layoutItems();var y=i.getCanvasBBox(),m=a.getCanvasBBox(),b=m.minX<0?Math.abs(m.minX)+l[3]:l[3],x=d.maxYc.max&&(c.max=s[0]),b.setMatrix([1,0,0,0,1,0,S,A,1])});var h=c.max-c.min,d={min:0,max:-1/0},v=f.getCanvasBBox();s[0]=0,s[1]=a==="vertical"?v.maxX+n:v.maxY+i,l.get("children").forEach(function(b,x){x===0&&(d.min=s[0]);var w=b.get("children")[0],E=b.getCanvasBBox(),_=w.getBBox(),M=_.width,C=_.height,S=0,A=0;a==="vertical"?(S=s[1],A=s[0],s[0]=A+E.height+i,b.setMatrix([1,0,0,0,1,0,0,A+C/2,1])):(S=s[0],A=s[1],s[0]=S+E.width+n,b.setMatrix([1,0,0,0,1,0,S+M/2,0,1])),s[0]>d.max&&(d.max=s[0])});var p=d.max-d.min;if(o&&o!==""&&o!=="left"){var g=h-p,y=o==="center"?Math.abs(g)/2:Math.abs(g),m=g<0?f:l;m.get("children").forEach(function(b){var x=b.getMatrix()||[1,0,0,0,1,0,0,0,1];a==="vertical"?x[7]+=y:x[6]+=y,b.setMatrix(x)})}},e.prototype.processData=function(){var t=this.get("data"),n={nodes:[],edges:[]};t.nodes&&(t.nodes.sort(function(i,a){return i.order-a.order}),t.nodes.forEach(function(i){var a,o,s,u,f,l=i.size||[((a=i.style)===null||a===void 0?void 0:a.width)||((o=i.style)===null||o===void 0?void 0:o.r)||8,((s=i.style)===null||s===void 0?void 0:s.height)||((u=i.style)===null||u===void 0?void 0:u.r)||8],c=((f=i.labelCfg)===null||f===void 0?void 0:f.style)||{};n.nodes.push({id:i.id||Yi(),type:i.type||"circle",style:Ar({},i.style),order:i.order,label:i.label,itemType:"node",size:l,labelCfg:{position:"right",style:Ar({fontFamily:"Arial"},c)}})})),t.edges&&(t.edges.sort(function(i,a){return i.order-a.order}),t.edges.forEach(function(i){var a,o,s=i.type||"line";i.type==="cubic-horizontal"&&(s="cubic");var u=((a=i.labelCfg)===null||a===void 0?void 0:a.style)||{},f=i.size||[((o=i.style)===null||o===void 0?void 0:o.width)||8,1];n.edges.push({id:i.id||Yi(),type:s,size:f,style:Ar({lineWidth:vt(f)?f[1]:1},i.style),order:i.order,label:i.label,itemType:"edge",labelCfg:{position:"right",style:Ar({fontFamily:"Arial"},u)}})})),this.set("itemsData",n)},e.prototype.getContainer=function(){return this.get("container")},e.prototype.formatArray=function(t){var n=this.get(t);if(ht(n))this.set(t,[n,n,n,n]);else if(vt(n))switch(n.length){case 0:this.set(t,[0,0,0,0]);break;case 1:this.set(t,[n[0],n[0],n[0],n[0]]);break;case 2:this.set(t,[n[0],n[1],n[0],n[1]]);break;case 3:this.set(t,[n[0],n[1],n[2],n[1]]);break}return this.get(t)},e.prototype.getShapeSize=function(t){var n,i,a;return t.size&&(vt(t.size)?(n=t.size[0],i=t.size[1]||t.size[0],a=t.size[0]/2):ht(t.size)&&(n=t.size,i=t.size,a=t.size/2)),t.style&&(t.style.width&&(n=t.style.width),t.style.height&&(i=t.style.height),t.style.r&&(a=t.style.r)),a||(a=5),n||(n=a),i||(i=a),{width:n,height:i,r:a}},e.prototype.getStyle=function(t,n){var i=t==="node"?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1};return Ar(Ar({},i),n.style||{})},e.prototype.destroy=function(){var t=this.get("legendCanvas");t==null||t.destroy();var n=this.get("graph"),i=n.get("container"),a=this.get("container");i.removeChild(a)},e}(zn),Ufe=function(){var r=function(t,n){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(i[o]=a[o])},r(t,n)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),gi=function(){return gi=Object.assign||function(r){for(var e,t=1,n=arguments.length;t+

    ":"

    -

    ",h=n?"":"

    ".concat(u,"

    "),d="

    x

    ",v=n?"".concat(l,"px"):"".concat(l,"px ").concat(l,"px 0 0");return'

    `).concat(o,`

    `).concat(c,` `).concat(d,`
    `).concat(h,`
    `)}},e.prototype.init=function(){var t=this;if(!t.destroyed){var n=t.get("graph"),i=n.getContainer(),a=t.get("container"),o=this.get("containerCfg");o?(a=this.createContainer(),i.appendChild(a)):a=i,this.set("container",a);var s=i.getBoundingClientRect(),u=new Aa({container:i,width:s.right-s.left,height:s.bottom-s.top});jt(u.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",sf(function(){return t.resizeCanvas(t)},100));var f=u.addGroup({id:"annotation-link-group"});t.set("linkGroup",f),t.set("canvas",u),t.get("getTitle")||t.set("getTitle",function(c){var h,d=((h=c==null?void 0:c.getModel)===null||h===void 0?void 0:h.call(c))||{},v=d.label,p=d.id;return v||p||"-"}),t.get("getContent")||t.set("getContent",function(c){var h,d;if(!c)return"-";var v=((h=c.getModel)===null||h===void 0?void 0:h.call(c))||{},p=v.label,g=v.id,y=(d=c.getType)===null||d===void 0?void 0:d.call(c),m=y?"".concat(y,": "):"";return"".concat(m).concat(p||g||"")});var l=t.get("defaultData");l&&this.readData(l)}},e.prototype.createContainer=function(){var t=this;if(!this.destroyed){var n=this.get("containerCfg"),i=this.get("graph"),a=i.getContainer(),o=a.getBoundingClientRect(),s=o.left,u=o.right,f=o.top,l=o.bottom,c=l-f,h=u-s,d=n.position,v=d===void 0?"top":d,p=n.offsetX,g=p===void 0?0:p,y=n.offsetY,m=y===void 0?0:y,b=wN(n,["position","offsetX","offsetY"]),x=n.height,w=x===void 0?"fit-content":x,E=n.width,_=E===void 0?i.getWidth():E;w==="100%"&&(w=c),_==="100%"&&(_=h);var M="unset",C="unset",S={};switch(v){case"right":M="".concat(c,"px"),S={top:0,right:0},S.right+=s+g,S.top+=f+m;break;case"bottom":C="".concat(h,"px"),S={bottom:0,left:0},S.left+=s+g,S.bottom+=f+m;break;case"top":C="".concat(h,"px");case"left":M="".concat(c,"px");default:S={top:0,left:0},S.left+=s+g,S.top+=f+m;break}Object.keys(S).forEach(function(T){S[T]="".concat(S[T],"px")});var A=wr("
    "));return jt(A,gi(gi({position:"absolute",display:v==="top"||v==="bottom"?"inline-flex":"unset",width:ht(_)?"".concat(_,"px"):_,height:ht(w)?"".concat(w,"px"):w,maxHeight:M,maxWidth:C,overflow:"scroll"},S),b)),a.appendChild(A),A.addEventListener("scroll",function(T){t.updateLinks()}),A}},e.prototype.resizeCanvas=function(t){clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout(function(){if(!(!t||t.destroyed)){var n=t.get("container").getBoundingClientRect(),i=n.right-n.left,a=n.bottom-n.top;t.get("canvas").changeSize(i,a),t.updateOutsideCards(t)}},250)},e.prototype.updateOutsideCards=function(t){var n=t||this,i=n.get("cardInfoMap")||{},a=n.get("graph"),o=a.getPointByCanvas(0,0),s=a.getPointByCanvas(a.getWidth(),a.getHeight()),u=a.getClientByPoint(o.x,o.y),f=u.x,l=u.y,c=a.getClientByPoint(s.x,s.y),h=c.x,d=c.y;Object.values(i).forEach(function(v){var p=v.card;if(p){var g=p.style,y=Es(g.left),m=Es(g.top),b=p.getBoundingClientRect(),x=b.width,w=b.height,E=y,_=m;y+x>h-f&&(E=h-f-x),y<0&&(E=0),m+w>d-l&&(_=d-l-w),m<0&&(_=0),jt(p,{left:"".concat(E,"px"),top:"".concat(_,"px")})}}),n.updateLinks()},e.prototype.showAnnotation=function(t){if(!this.destroyed){var n=t.item;this.toggleAnnotation(n)}},e.prototype.hideCards=function(){var t=this;if(!t.destroyed){var n=t.get("cardInfoMap")||{};Object.keys(n).forEach(function(i){t.hideCard(i)})}},e.prototype.toggleAnnotation=function(t,n){var i,a;n===void 0&&(n={});var o=this;if(!o.destroyed){var s=o.get("cardInfoMap")||{},u=o.get("graph"),f=o.get("container"),l=o.get("containerCfg"),c=Object.assign({},o.get("cardCfg")||{},n),h=c.minHeight,d=c.minWidth,v=c.width,p=c.height,g=c.collapsed,y=g===void 0?!1:g,m=c.x,b=c.y,x=c.title,w=c.content,E=c.maxTitleLength,_=c.defaultBegin,M=wN(c,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),C=o.get("linkGroup"),S=this.get("rows")||[[]],A=(i=t.isCanvas)===null||i===void 0?void 0:i.call(t),T=A?EN:t.getID(),k=s[T]||{},O=k.card,G=k.link,D=k.x,$=k.y,Y=k.title,N=k.content,P=this.get("getTitle"),W=this.get("getContent"),J=this.get("getContentPlaceholder")||function(){return""},te=this.get("getTitlePlaceHolder")||function(){return""},H=J(t),pe=te(t),Te=wr(this.getDOMContent(gi({itemId:T,collapsed:y,title:((a=Y||x||(P==null?void 0:P(t)))===null||a===void 0?void 0:a.substr(0,E))||pe,content:N||w||(W==null?void 0:W(t))||H},M))),Ne=ht(h)?"".concat(h,"px"):h;jt(Te,{minHeight:y?"unset":Ne,minWidth:ht(d)?"".concat(d,"px"):d,height:p,width:v});var Ze=!!O;Ze?(G==null||G.remove(!0),f.replaceChild(Te,O)):f.appendChild(Te);var at;if(!l){if(at=f.getBoundingClientRect()||{},m!==void 0&&b!==void 0)D=m,$=b;else if(!Ze&&!A){var nt=at.top,St=_||{},Mt=St.left,fr=St.right,Ft=fr===void 0?16:fr,Wt=St.top,dr=Wt===void 0?8:Wt,lr=St.bottom,Ut=Ft,ar=dr;isNaN(Mt)||(Ut=f.scrollWidth-Mt),isNaN(lr)||(ar=f.scrollHeight-lr);var Zr=ht(d)?d:100;D=f.scrollWidth-Te.scrollWidth-(S.length-1)*Zr-Ut;var tt=S[S.length-1],ae=(tt[tt.length-1]||{}).bbox;$=(ae==null?void 0:ae.bottom)-nt||ar}jt(Te,{position:"absolute",left:"".concat(D,"px"),top:"".concat($,"px"),cusor:l?"unset":"move"})}this.bindListener(Te,T);var L=Te.getBoundingClientRect();if(!A){var Se=C1(t,L,u,this.get("canvas")),Ge=this.get("linkStyle");G=C.addShape("path",{attrs:gi({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:Se},Ge)})}if(s[T]=gi(gi({},s[T]||{}),{id:T,collapsed:y,card:Te,link:G,x:D,y:$,cardBBox:L,content:N||w,title:Y||x,contentPlaceholder:H,titlePlaceholder:pe,isCanvas:A}),o.set("cardInfoMap",s),l)this.updateCardPositionsInConatainer(),this.updateLinks();else{var me=!isNaN(m)&&!isNaN(b);if(!Ze&&!A&&!me){var Ye=at.bottom,We=Ye===void 0?0:Ye,nt=at.top;S[S.length-1].push({id:T,bbox:L}),L.top>We-nt-L.height-16&&S.push([]),this.set("rows",S)}}this.updateCardSize(T);var qe=this.get("onAnnotationChange");qe==null||qe(s[T],Ze?"update":"create")}},e.prototype.updateCardPositionsInConatainer=function(){if(!this.destroyed){var t=this.get("cardInfoMap");if(t){var n=this.get("container"),i=this.get("containerCfg").position,a=n.getBoundingClientRect().width,o=getComputedStyle(n),s=Es(o.paddingLeft)+Es(o.paddingRight);a-=s,Object.values(t).forEach(function(u){var f=u.card,l=f.getBoundingClientRect().width;switch(i){case"right":jt(f,{marginLeft:a?"".concat(a-l,"px"):"0px"});break;case"top":case"bottom":jt(f,{marginLeft:"8px"})}})}}},e.prototype.handleExpandCollapseCard=function(t){if(!this.destroyed){var n=this.get("graph"),i=this.get("cardInfoMap");if(i){var a=i[t].collapsed,o=n.findById(t);if(o){var s=this.get("cardCfg").collapseType;s==="hide"&&!a?this.hideCard(t):this.toggleAnnotation(o,{collapsed:!a}),i[t]=gi(gi({},i[t]),{collapsed:!a})}}}},e.prototype.hideCard=function(t){if(!this.destroyed){var n=this.get("cardInfoMap");if(!(!n||!n[t])){var i=n[t],a=i.card,o=i.link;jt(a,{display:"none"}),o==null||o.hide();var s=this.get("onAnnotationChange");s(n[t],"hide")}}},e.prototype.removeCard=function(t){if(!this.destroyed){var n=this.get("cardInfoMap");if(n){var i=n[t],a=i.card,o=i.link,s=this.get("container");s.removeChild(a),o==null||o.remove(!0),delete n[t];var u=this.get("onAnnotationChange");u(i,"remove")}}},e.prototype.bindListener=function(t,n){var i=this;if(!this.destroyed){t.addEventListener("mousemove",function(u){var f;if(u.target.className==="g6-annotation-collapse"?f="collapse":u.target.className==="g6-annotation-expand"?f="expand":u.target.className==="g6-annotation-close"&&(f="close"),f){var l=i.get("cardCfg").onMouseEnterIcon,c=l===void 0?function(){}:l;c(u,n,f)}}),t.addEventListener("mouseout",function(u){var f;if(u.target.className==="g6-annotation-collapse"?f="collapse":u.target.className==="g6-annotation-expand"?f="expand":u.target.className==="g6-annotation-close"&&(f="close"),f){var l=i.get("cardCfg").onMouseLeaveIcon,c=l===void 0?function(){}:l;c(u,n,f)}}),t.addEventListener("mouseenter",function(u){var f=i.get("cardInfoMap");if(f){var l=i.get("graph"),c=l.findById(n);if(c){var h=i.get("itemHighlightState");l.setItemState(c,h,!0)}var d=f[n].link;if(d){var v=i.get("linkHighlightStyle")||{};d.attr(v)}}}),t.addEventListener("mouseleave",function(u){var f=i.get("cardInfoMap");if(f){var l=i.get("graph"),c=l.findById(n);if(c){var h=i.get("itemHighlightState");l.setItemState(c,h,!1)}var d=f[n].link;if(d){var v=i.get("linkHighlightStyle")||{};Object.keys(v).forEach(function(g){d.attr(g,void 0),d.attr(g,void 0)});var p=i.get("linkStyle");d.attr(p)}}}),t.addEventListener("click",function(u){var f=(i.get("cardCfg")||{}).onClickIcon;if(u.target.className==="g6-annotation-collapse"||u.target.className==="g6-annotation-expand"){var l=i.get("cardCfg").collapseType;l==="hide"?i.hideCard(n):i.handleExpandCollapseCard(n),f==null||f(u,n,u.target.className==="g6-annotation-collapse"?"collapse":"expand")}else if(u.target.className==="g6-annotation-close"){var c=i.get("cardCfg").closeType;c==="remove"?i.removeCard(n):i.hideCard(n),f==null||f(u,n,"close")}});var a=this.get("editable");a&&t.addEventListener("dblclick",function(u){var f=i.get("cardInfoMap"),l=(i.get("cardCfg")||{}).maxTitleLength,c=l===void 0?20:l;if(f){var h=u.target,d=h.className;if(!(d!=="g6-annotation-title"&&d!=="g6-annotation-content")){var v=d==="g6-annotation-title"?h.getBoundingClientRect():h.parentNode.getBoundingClientRect(),p=v.width,g=v.height,y=getComputedStyle(h),m=d==="g6-annotation-title"?"input":"textarea",b=wr("<".concat(m,' class="').concat(d,'-input" type="textarea" style="width:').concat(p,"px; height: ").concat(g,'px; min-width: 16px;"/>')),x=wr('
    '));x.appendChild(b),h.parentNode.replaceChild(x,h);var w=f[n],E=w.contentPlaceholder,_=w.titlePlaceholder,M=w.content,C=w.title,S=M;d==="g6-annotation-title"?(b.name="title",b.maxLength=c,S=C):b.name="content",S?(b.innerHTML=h.innerHTML,b.value=h.innerHTML):b.placeholder=d==="g6-annotation-title"?_:E,b.focus(),b.addEventListener("blur",function(A){b.value&&(h.innerHTML=b.value,w[b.name||"title"]=b.value),x.parentNode.replaceChild(h,x),i.updateCardSize(n);var T=i.get("onAnnotationChange");T==null||T(w,"update")})}}});var o=["g6-annotation-title","g6-annotation-content","g6-annotation-title-input","g6-annotation-content-input"];t.draggable=!0,t.addEventListener("dragstart",function(u){var f=u.target.className;if(!o.includes(f)){var l=t.style;i.set("dragging",{card:t,x:u.clientX,y:u.clientY,left:Es(l.left),top:Es(l.top)})}}),t.addEventListener("drag",function(u){u.preventDefault();var f=i.get("cardInfoMap");if(f){var l=u.clientX,c=u.clientY,h=i.get("dragging");if(!(isNaN(l)||isNaN(c)||!h)){var d=h.x,v=h.y,p=h.left,g=h.top,y=h.card,m=l-d,b=c-v;p+=m,g+=b;var x=i.get("graph"),w=x.getPointByCanvas(0,0),E=x.getPointByCanvas(x.getWidth(),x.getHeight()),_=x.getClientByPoint(w.x,w.y),M=_.x,C=_.y,S=x.getClientByPoint(E.x,E.y),A=S.x,T=S.y,k=y.getBoundingClientRect(),O=k.right-k.left,G=k.bottom-k.top;(p>A-M-O&&m>0||p<0&&m<0)&&(p-=m),(g>T-C-G&&b>0||g<0&&b<0)&&(g-=b),jt(y,{left:"".concat(p,"px"),top:"".concat(g,"px"),visibility:"hidden"}),d=l,v=c;var D=(f[n]||{}).link;if(D){var $=x.findById(n);D.attr("path",C1($,k,x,i.get("canvas")))}i.set("dragging",{x:d,y:v,left:p,top:g,card:y})}}});var s=function(f){var l=i.get("cardInfoMap");if(l){var c=i.get("dragging");if(c){var h=c.left,d=c.top,v=c.card;l[n].x=h,l[n].y=d,jt(v,{visibility:"visible"}),i.set("dragging",!1);var p=i.get("rows");p==null||p.forEach(function(y){for(var m=y.length-1;m>=0;m--)y[m].id===n&&y.splice(m,1)});var g=i.get("onAnnotationChange");g==null||g(l[n],"update")}}};t.addEventListener("dragend",s)}},e.prototype.updateCardSize=function(t){var n=this.get("cardInfoMap");if(n){var i=n[t].card,a=i.getBoundingClientRect().width,o=i.getElementsByClassName("g6-annotation-title")[0];if(o){var s=getComputedStyle(o),u=Es(s.marginLeft),f=o.getBoundingClientRect().width;jt(o,{marginRight:"".concat(a-u-24-16-f,"px")})}}},e.prototype.updateLink=function(t){var n=t.item;if(n){var i=this.get("cardInfoMap");if(i){var a=this.get("canvas"),o=this.get("graph"),s=n.getID(),u=i[s]||{},f=u.link,l=u.card;if(f){var c=C1(n,l.getBoundingClientRect(),o,a);f.attr("path",c)}}}},e.prototype.updateLinks=function(){var t=this;if(!this.destroyed){var n=this.get("cardInfoMap");if(n){var i=this.get("graph");Object.values(n).forEach(function(a){var o=a.id,s=i.findById(o);t.updateLink({item:s})})}}},e.prototype.onGraphDataChange=function(){var t=this,n=this.get("cardInfoMap");if(n){var i=this.get("graph");Object.values(n).forEach(function(a){var o=a.id,s=a.card,u=a.isCanvas;if(!(!s||u||s.style.display==="none")){var f=i.findById(o);f&&f.isVisible()?t.toggleAnnotation(f):t.hideCard(o)}})}},e.prototype.onGraphItemVisibilityChange=function(t){var n=t.item,i=t.visible;if(!(!n||n.destroyed)){var a=this.get("cardInfoMap");if(a){var o=n.getID();a[o]&&(i||this.hideCard(o))}}},e.prototype.saveData=function(t){t===void 0&&(t=!1);var n=this.get("cardInfoMap");if(n){var i=this.get("graph"),a=this.get("getTitle"),o=this.get("getContent"),s=[];return Object.values(n).forEach(function(u){var f=u.title,l=u.content,c=u.x,h=u.y,d=u.id,v=u.collapsed,p=u.card;if(!(p&&p.style.display==="none"&&!t)){var g=i.findById(d)||i.get("canvas");s.push({id:d,x:c,y:h,collapsed:v,title:f||(a==null?void 0:a(g)),content:l||(o==null?void 0:o(g)),visible:p&&p.style.display!=="none"})}}),s}},e.prototype.readData=function(t){var n=this,i=this.get("graph");t.forEach(function(a){var o=a.id,s=a.x,u=a.y,f=a.title,l=a.content,c=a.collapsed,h=a.visible,d=i.findById(o);if(!d&&o===EN&&(d=i.get("canvas")),!d){var v=n.get("cardInfoMap")||{};v[o]=a,n.set("cardInfoMap",v);return}n.toggleAnnotation(d,{x:s,y:u,title:f,content:l,collapsed:c}),h||n.hideCard(o)})},e.prototype.clear=function(){var t=this.get("cardInfoMap");if(t){var n=this.get("container");Object.values(t).forEach(function(i){var a=i.card,o=i.link;n.removeChild(a),o==null||o.remove(!0)}),this.set("cardInfoMap",{})}},e.prototype.destroy=function(){var t;this.clear(),(t=this.get("canvas"))===null||t===void 0||t.destroy();var n=this.get("graph");!n||n.destroyed||(this.get("containerCfg")&&n.getContainer().removeChild(this.get("container")),this.destroyed=!0)},e}(zn),Yfe=function(e,t){var n,i,a=1/0;Object.keys(e).forEach(function(u){var f=e[u];Object.keys(t).forEach(function(l){var c=t[l],h=f.x-c.x,d=f.y-c.y,v=h*h+d*d;a>v&&(a=v,n=f,i=c)})});var o=20,s=bn.getControlPoint(n,i,.5,o);return[["M",n.x,n.y],["Q",s.x,s.y,i.x,i.y]]},C1=function(e,t,n,i){var a,o,s=e.getType();if(s==="edge")o=[e.getKeyShape().getPoint(.5)];else{var u=(a=e.getKeyShape)===null||a===void 0?void 0:a.call(e).getBBox(),f=u.minX,l=u.minY,c=u.maxX,h=u.maxY,d=e.getModel(),v=d.x,p=d.y;f+=v,l+=p,c+=v,h+=p,o={left:{x:f,y:(l+h)/2},right:{x:c,y:(l+h)/2},top:{x:(f+c)/2,y:l},bottom:{x:(f+c)/2,y:h}}}Object.keys(o).forEach(function(C){var S=o[C],A=S.x,T=S.y,k=n.getClientByPoint(A,T);o[C]=i.getPointByClient(k.x,k.y)});var g=t.top,y=g===void 0?0:g,m=t.left,b=m===void 0?0:m,x=t.right,w=x===void 0?0:x,E=t.bottom,_=E===void 0?0:E,M={left:i.getPointByClient(b,(y+_)/2),right:i.getPointByClient(w,(y+_)/2),top:i.getPointByClient((b+w)/2,y),bottom:i.getPointByClient((b+w)/2,_)};return Yfe(o,M)},Es=function(e){return Number(e.replace(/\s+|px/gi,""))||0},ei={PluginBase:zn,Menu:Ose,Grid:Tse,Minimap:Gse,Bundling:jse,ToolBar:Vse,Tooltip:qse,Fisheye:Xse,TimeBar:Tfe,ImageMinimap:Nfe,EdgeFilterLens:Pfe,SnapLine:Gfe,Legend:jfe,Annotation:Xfe};Ma("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:B({},Qe.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=gr({},i,e.icon),s="".concat(this.type,"-keyShape"),u=t.addShape("circle",{attrs:a,className:s,name:s,draggable:!0});t.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?t.shapeMap[d]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:d,name:d,draggable:!0}):t.shapeMap[d]=t.addShape("image",{attrs:B({x:-f/2,y:-l/2},o),className:d,name:d,draggable:!0})}return this.drawLinkPoints(e,t),u},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints;if(n){var i=n||{},a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2;if(o){var v="link-point-left";t.shapeMap[v]=t.addShape("circle",{attrs:B(B({},c),{x:-d,y:0,r:f/2||l||5}),className:v,name:v,isAnchorPoint:!0})}if(s){var p="link-point-right";t.shapeMap[p]=t.addShape("circle",{attrs:B(B({},c),{x:d,y:0,r:f/2||l||5}),className:p,name:p,isAnchorPoint:!0})}if(a){var g="link-point-top";t.shapeMap[g]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-d,r:f/2||l||5}),className:g,name:g,isAnchorPoint:!0})}if(u){var y="link-point-bottom";t.shapeMap[y]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:d,r:f/2||l||5}),className:y,name:y,isAnchorPoint:!0})}}},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gr({},t,n),a=this.getSize(e),o=a[0]/2,s=B({x:0,y:0,r:o},i);return s},update:function(e,t,n){var i=t.getContainer(),a=this.getSize(e),o=B({},e.style);e.style.stroke===void 0&&e.color&&(o.stroke=e.color),e.style.r===void 0&&!isNaN(a[0])&&(o.r=a[0]/2),this.updateShape(e,t,o,!0,n),this.updateLinkPoints(e,i)}},"single-node"),Ma("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:B({},Qe.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e),i=t.addShape("rect",{attrs:n,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return t.shapeMap["".concat(this.type,"-keyShape")]=i,this.drawLinkPoints(e,t),i},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},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 t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=B({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getSize(e),s=t.get("keyShape");e.size||(o[0]=s.attr("width")||a.width,o[1]=s.attr("height")||a.height);var u={stroke:e.color,x:-o[0]/2,y:-o[1]/2,width:o[0],height:o[1]},f=gt({},a,s.attr(),u);f=gt(f,e.style),this.updateShape(e,t,f,!1,n),this.updateLinkPoints(e,i)}},"single-node"),Ma("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:B({},Qe.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("ellipse",{attrs:a,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});t.shapeMap["ellipse-keyShape"]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({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}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0]/2,v=h[1]/2;o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getSize(e),o=a[0]/2,s=a[1]/2,u=B({x:0,y:0,rx:o,ry:s},i);return u},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getSize(e),s={stroke:e.color,rx:o[0]/2,ry:o[1]/2},u=t.get("keyShape"),f=gt({},a,u.attr(),s);f=gt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)}},"single-node"),Ma("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:B({},Qe.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({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}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},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 t=this.getSize(e),n=t[0],i=t[1],a=[["M",0,-i/2],["L",n/2,0],["L",0,i/2],["L",-n/2,0],["Z"]];return a},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getPath(e),o=B({path:a},i);return o},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=t.get("keyShape"),f=gt({},a,u.attr(),s);f=gt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)}},"single-node"),Ma("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:B({},Qe.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(e,t){var n=this.mergeStyle||this.getOptions(e),i=n.icon,a=i===void 0?{}:i,o=n.direction,s=this.getShapeStyle(e),u=e.direction||o,f=t.addShape("path",{attrs:s,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=f;var l=a.width,c=a.height,h=a.show,d=a.offset,v=a.text;if(h)if(v)t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var p=-l/2,g=-c/2;(u==="up"||u==="down")&&(g+=d),(u==="left"||u==="right")&&(p+=d),t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:p,y:g},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(e,t),f},drawLinkPoints:function(e,t){var n=this.mergeStyle||this.getOptions(e),i=n.linkPoints,a=i===void 0?{}:i,o=n.direction,s=e.direction||o,u=a.top,f=a.left,l=a.right,c=a.bottom,h=a.size,d=a.r,v=Jr(a,["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&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},v),{x:y[0],y:y[1],r:h/2||d||5}),className:"link-point-left",name:"link-point-left"}))}if(l){var x=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?x=[b,m]:s==="down"?x=[b,-m]:s==="right"&&(x=[b,b-m]),x&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},v),{x:x[0],y:x[1],r:h/2||d||5}),className:"link-point-right",name:"link-point-right"}))}if(u){var w=null,m=g*Math.sin(1/3*Math.PI),b=g*Math.sin(1/3*Math.PI);s==="up"?w=[b-m,-m]:s==="left"?w=[b,-m]:s==="right"&&(w=[-b,-m]),w&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},v),{x:w[0],y:w[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&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},v),{x:E[0],y:E[1],r:h/2||d||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(e){var t=(this.mergeStyle||this.getOptions(e)).direction,n=e.direction||t,i=this.getSize(e),a=i[0],o=a*Math.sin(1/3*Math.PI),s=a*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 t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getPath(e),o=B({path:a},i);return o},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=t.get("keyShape"),f=gt({},a,u.attr(),s);f=gt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)},updateLinkPoints:function(e,t){var n=this.getOptions({}),i=n.linkPoints,a=n.direction,o=e.direction||a,s=t.shapeMap["link-point-left"]||t.find(function(D){return D.get("className")==="link-point-left"}),u=t.shapeMap["link-point-right"]||t.find(function(D){return D.get("className")==="link-point-right"}),f=t.shapeMap["link-point-top"]||t.find(function(D){return D.get("className")==="link-point-top"}),l=t.shapeMap["link-point-bottom"]||t.find(function(D){return D.get("className")==="link-point-bottom"}),c=i,h=s||u||f||l;h&&(c=h.attr());var d=gt({},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,x=m.right,w=m.top,E=m.bottom,_=this.getSize(e),M=_[0],C={r:y,fill:v,stroke:p,lineWidth:g},S=null,A=M*Math.sin(1/3*Math.PI),T=M*Math.sin(1/3*Math.PI);o==="up"?S=[-T,A]:o==="down"?S=[-T,-A]:o==="left"&&(S=[-T,T-A]),S&&(s?!b&&b!==void 0?(s.remove(),delete t.shapeMap["link-point-left"]):s.attr(B(B({},C),{x:S[0],y:S[1]})):b&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},C),{x:S[0],y:S[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var k=null;o==="up"?k=[T,A]:o==="down"?k=[T,-A]:o==="right"&&(k=[T,T-A]),k&&(u?!x&&x!==void 0?(u.remove(),delete t.shapeMap["link-point-right"]):u.attr(B(B({},C),{x:k[0],y:k[1]})):x&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},C),{x:k[0],y:k[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var O=null;o==="up"?O=[T-A,-A]:o==="left"?O=[T,-A]:o==="right"&&(O=[-T,-A]),O&&(f?!w&&w!==void 0?(f.remove(),delete t.shapeMap["link-point-top"]):f.attr(B(B({},C),{x:O[0],y:O[1]})):w&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},C),{x:O[0],y:O[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var G=null;o==="down"?G=[-T+A,A]:o==="left"?G=[T,A]:o==="right"&&(G=[-T,A]),G&&(l?!E&&E!==void 0?(l.remove(),delete t.shapeMap["link-point-bottom"]):l.attr(B(B({},C),{x:G[0],y:G[1]})):E&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},C),{x:G[0],y:G[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node"),Ma("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,t){var n=(this.mergeStyle||this.getOptions(e)).preRect,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=this.getSize(e),s=o[0],u=o[1],f=t.addShape("rect",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=f;var l=i.show,c=Jr(i,["show"]);return l&&(t.shapeMap["pre-rect"]=t.addShape("rect",{attrs:B({x:-s/2,y:-u/2,height:u},c),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(e,t),this.drawStateIcon(e,t),this.drawLinkPoints(e,t),f},drawLogoIcon:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).logoIcon,i=n===void 0?{}:n,a=this.getSize(e),o=a[0];if(i.show){var s=i.width,u=i.height,f=i.x,l=i.y,c=i.offset,h=i.text,d=Jr(i,["width","height","x","y","offset","text"]);h?t.shapeMap["rect-logo-icon"]=t.addShape("text",{attrs:B({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}):t.shapeMap["rect-logo-icon"]=t.addShape("image",{attrs:B(B({},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,t){var n=(this.mergeStyle||this.getOptions(e)).stateIcon,i=n===void 0?{}:n,a=this.getSize(e),o=a[0];if(i.show){var s=i.width,u=i.height,f=i.x,l=i.y,c=i.offset,h=i.text,d=Jr(i,["width","height","x","y","offset","text"]);h?t.shapeMap["rect-state-icon"]=t.addShape("text",{attrs:B({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}):t.shapeMap["rect-state-icon"]=t.addShape("image",{attrs:B(B({},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,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.bottom,f=i.size,l=i.r,c=Jr(i,["top","left","right","bottom","size","r"]),h=this.getSize(e),d=h[0],v=h[1];o&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},c),{x:-d/2,y:0,r:f/2||l||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),s&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},c),{x:d/2,y:0,r:f/2||l||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:-v/2,r:f/2||l||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},c),{x:0,y:v/2,r:f/2||l||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(e,t){var n=this.getOptions(e),i=n.labelCfg,a=i===void 0?{}:i,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+a.offset;d&&(p=-c/2+v+a.offset);var g=a.style,y=f.style,m=f.paddingTop;return Pe(e.description)?(h=t.addShape("text",{attrs:B(B({},g),{x:p,y:-5,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),t.shapeMap["text-shape"]=h,t.shapeMap["rect-description"]=t.addShape("text",{attrs:B(B({},y),{x:p,y:17+(m||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(h=t.addShape("text",{attrs:B(B({},g),{x:p,y:7,text:e.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),t.shapeMap["text-shape"]=h),h},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getSize(e),o=i.width||a[0],s=i.height||a[1],u=B({x:-o/2,y:-s/2,width:o,height:s},i);return u},update:function(e,t){var n=this.mergeStyle||this.getOptions(e),i=n.style,a=i===void 0?{}:i,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=t.get("keyShape");d.attr(B(B({},a),{x:-c/2,y:-h/2,width:c,height:h}));var v=t.getContainer(),p=v.shapeMap["rect-logo-icon"]||v.find(function(Te){return Te.get("className")==="rect-logo-icon"}),g=p?p.attr():{},y=gt({},g,e.logoIcon),m=y.width;m===void 0&&(m=this.options.logoIcon.width);var b=e.logoIcon?e.logoIcon.show:void 0,x=s.offset,w=-c/2+m+x;!b&&b!==void 0&&(w=-c/2+x);var E=v.shapeMap["node-label"]||v.find(function(Te){return Te.get("className")==="node-label"}),_=v.shapeMap["rect-description"]||v.find(function(Te){return Te.get("className")==="rect-description"});if(e.label)if(!E)v.shapeMap["node-label"]=v.addShape("text",{attrs:B(B({},s.style),{x:w,y:e.description?-5:7,text:e.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var M=e.labelCfg?e.labelCfg.style:{},C=gt({},E.attr(),M);e.label&&(C.text=e.label),C.x=w,Pe(e.description)&&(C.y=-5),_&&(_.resetMatrix(),_.attr({x:w})),E.resetMatrix(),E.attr(C)}if(Pe(e.description)){var S=f.paddingTop;if(!_)v.shapeMap["rect-description"]=v.addShape("text",{attrs:B(B({},f.style),{x:w,y:17+(S||0),text:e.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var M=e.descriptionCfg?e.descriptionCfg.style:{},A=gt({},_.attr(),M);Pe(e.description)&&(A.text=e.description),A.x=w,_.resetMatrix(),_.attr(B(B({},A),{y:17+(S||0)}))}}var T=v.shapeMap["pre-rect"]||v.find(function(Te){return Te.get("className")==="pre-rect"});if(T&&!T.destroyed){var k=gt({},T.attr(),e.preRect);T.attr(B(B({},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,G=y.height,D=y.x,$=y.y,Y=y.offset,N=Jr(y,["width","height","x","y","offset"]);p.attr(B(B({},N),{x:D||-c/2+O+Y,y:$||-G/2,width:O,height:G}))}else b&&this.drawLogoIcon(e,v);var P=v.shapeMap["rect-state-icon"]||v.find(function(Te){return Te.get("className")==="rect-state-icon"}),W=P?P.attr():{},J=gt({},W,e.stateIcon);if(P){!J.show&&J.show!==void 0&&(P.remove(),delete v.shapeMap["rect-state-icon"]);var te=J.width,G=J.height,D=J.x,$=J.y,H=J.offset,pe=Jr(J,["width","height","x","y","offset"]);P.attr(B(B({},pe),{x:D||c/2-te+H,y:$||-G/2,width:te,height:G}))}else J.show&&this.drawStateIcon(e,v);this.updateLinkPoints(e,v)},getOptions:function(e,t){return t==="move"?e:gr({},this.options,this.getCustomConfig(e)||{},e)}},"single-node"),Ma("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:B({},Qe.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=t.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});t.shapeMap["".concat(this.type,"-keyShape")]=o;var s=i.width,u=i.height,f=i.show,l=i.text;return f&&(l?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({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}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-s/2,y:-u/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(e,t),o},drawLinkPoints:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).linkPoints,i=n===void 0?{}:n,a=i.top,o=i.left,s=i.right,u=i.leftBottom,f=i.rightBottom,l=i.size,c=i.r,h=Jr(i,["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;t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right",name:"link-point-right"})}if(a){var p=Math.cos(.5*Math.PI)*v,g=Math.sin((18+72*1)/180*Math.PI)*v;t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},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;t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},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;t.shapeMap["link-point-bottom"]=t.addShape("circle",{attrs:B(B({},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;t.shapeMap["link-point-right-bottom"]=t.addShape("circle",{attrs:B(B({},h),{x:p,y:-g,r:l/2||c||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(e){var t=this.getSize(e),n=t[0],i=n*3/8,a=e.innerR||i;return bn.getStarPath(n,a)},getShapeStyle:function(e){var t=(this.mergeStyle||this.getOptions(e)).style,n={stroke:e.color},i=gt({},t,n),a=this.getPath(e),o=B({path:a},i);return o},update:function(e,t,n){var i=t.getContainer(),a=this.getOptions({}).style,o=this.getPath(e),s={stroke:e.color,path:o},u=t.get("keyShape"),f=gt({},a,u.attr(),s);f=gt(f,e.style),this.updateShape(e,t,f,!0,n),this.updateLinkPoints(e,i)},updateLinkPoints:function(e,t){var n=this.getOptions({}).linkPoints,i=t.shapeMap["link-point-left"]||t.find(function(A){return A.get("className")==="link-point-left"}),a=t.shapeMap["link-point-right"]||t.find(function(A){return A.get("className")==="link-point-right"}),o=t.shapeMap["link-point-top"]||t.find(function(A){return A.get("className")==="link-point-top"}),s=t.shapeMap["link-point-left-bottom"]||t.find(function(A){return A.get("className")==="link-point-left-bottom"}),u=t.shapeMap["link-point-left-bottom"]||t.find(function(A){return A.get("className")==="link-point-right-bottom"}),f=n,l=i||a||o||s||u;l&&(f=l.attr());var c=gt({},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,x=g.leftBottom,w=g.rightBottom,E=this.getSize(e),_=E[0],M={r:p,fill:h,stroke:d,lineWidth:v},C=Math.cos((18+72*0)/180*Math.PI)*_,S=Math.sin((18+72*0)/180*Math.PI)*_;a?!m&&m!==void 0?(a.remove(),delete t.shapeMap["link-point-right"]):a.attr(B(B({},M),{x:C,y:-S})):m&&(t.shapeMap["link-point-right"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),C=Math.cos((18+72*1)/180*Math.PI)*_,S=Math.sin((18+72*1)/180*Math.PI)*_,o?!b&&b!==void 0?(o.remove(),delete t.shapeMap["link-point-top"]):o.attr(B(B({},M),{x:C,y:-S})):b&&(t.shapeMap["link-point-top"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),C=Math.cos((18+72*2)/180*Math.PI)*_,S=Math.sin((18+72*2)/180*Math.PI)*_,i?!y&&y!==void 0?(i.remove(),delete t.shapeMap["link-point-left"]):i.attr(B(B({},M),{x:C,y:-S})):y&&(t.shapeMap["link-point-left"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),C=Math.cos((18+72*3)/180*Math.PI)*_,S=Math.sin((18+72*3)/180*Math.PI)*_,s?!x&&x!==void 0?(s.remove(),delete t.shapeMap["link-point-left-bottom"]):s.attr(B(B({},M),{x:C,y:-S})):x&&(t.shapeMap["link-point-left-bottom"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),C=Math.cos((18+72*4)/180*Math.PI)*_,S=Math.sin((18+72*4)/180*Math.PI)*_,u?!w&&w!==void 0?(u.remove(),delete t.shapeMap["link-point-right-bottom"]):u.attr(B(B({},M),{x:C,y:-S})):w&&(t.shapeMap["link-point-right-bottom"]=t.addShape("circle",{attrs:B(B({},M),{x:C,y:-S}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var _N=bn.defaultSubjectColors,Kl="fan-shape-";Ma("donut",{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:B({},Qe.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(e,t){var n=(this.mergeStyle||this.getOptions(e)).icon,i=n===void 0?{}:n,a=this.getShapeStyle(e),o=gr({},i,e.icon),s=t.addShape("circle",{attrs:a,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});t.shapeMap["".concat(this.type,"-keyShape")]=s;var u=o.width,f=o.height,l=o.show,c=o.text;return l&&(c?t.shapeMap["".concat(this.type,"-icon")]=t.addShape("text",{attrs:B({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):t.shapeMap["".concat(this.type,"-icon")]=t.addShape("image",{attrs:B({x:-u/2,y:-f/2},o),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),Wfe(e,t,s),this.drawLinkPoints(e,t),s},updateShape:function(e,t,n,i,a){var o=t.get("keyShape");o.attr(B({},n)),Vfe(e,t,o),this.updateLabel(e,t,a),i&&this.updateIcon(e,t)}},"circle");var Wfe=function(e,t,n){var i=e.donutAttrs,a=i===void 0?{}:i,o=e.donutColorMap,s=o===void 0?{}:o,u=Object.keys(a).length;if(a&&u>1){var f=SN(a,s),l=f.configs,c=f.totalValue;if(c){var h=MN(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0;if(u===1){A1(t,{arcR:v,arcBegin:p,beginAngle:g,config:l[0],fanIndex:0,lineWidth:d,totalValue:c,drawWhole:!0});return}for(var y=0;y.999)p=[n,1e-4],y=1;else{var m=v*Math.PI*2;g=a+m,p=[n*Math.cos(g),-n*Math.sin(g)],y=m>Math.PI?1:0}var b={path:[["M",i[0],i[1]],["A",n,n,0,y,0,p[0],p[1]]],stroke:o.color||(d==null?void 0:d.attr("stroke"))||_N[s%_N.length],lineWidth:u};return d?d.attr(b):e.shapeMap["".concat(Kl).concat(s)]=e.addShape("path",{attrs:b,name:"".concat(Kl).concat(s),draggable:!0}),{beginAngle:g,arcBegin:p,shape:e.shapeMap["".concat(Kl).concat(s)],shouldEnd:c||v>.999}},Vfe=function(e,t,n){var i=e.donutAttrs,a=e.donutColorMap,o=a===void 0?{}:a,s={},u=t.getContainer();if(i){var f=SN(i,o),l=f.configs,c=f.totalValue;if(c)for(var h=MN(n),d=h.lineWidth,v=h.arcR,p=[v,0],g=0,y=0;y=0;a--){var o=e[a];o.id="".concat(o.x,"|||").concat(o.y),n[o.id]||(n[o.id]=o,t.push(o))}return t},CN=function(e){return T1(e)},Rv=function(e,t){return e.width||e.height?{centerX:e.centerX,centerY:e.centerY,minX:e.minX-t,minY:e.minY-t,maxX:e.maxX+t,maxY:e.maxY+t,height:e.height+2*t,width:e.width+2*t}:e},qfe=function(e,t){var n=Math.abs(e.x-t.centerX),i=Math.abs(e.y-t.centerY);return n===0&&i===0?0:n/t.width>i/t.height},I1=function(e,t,n){var i=qfe(t,e);if(i===0){var a=e.centerX,o=e.centerY;return n.yt.x?a=e.maxX:n.xe.centerX?e.maxX:e.minX,y:t.y}:{x:t.x,y:t.y>e.centerY?e.maxY:e.minY}},AN=function(e,t){var n=Math.min(e.minX,t.minX),i=Math.min(e.minY,t.minY),a=Math.max(e.maxX,t.maxX),o=Math.max(e.maxY,t.maxY);return{centerX:(n+a)/2,centerY:(i+o)/2,minX:n,minY:i,maxX:a,maxY:o,height:o-i,width:a-n}},k1=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}]},Bv=function(e,t){var n=e.x,i=e.y;return nt.maxX||it.maxY},Zfe=function(e,t){return te.maxX?[]:[{x:t,y:e.minY},{x:t,y:e.maxY}]},Kfe=function(e,t){return te.maxY?[]:[{x:e.minX,y:t},{x:e.maxX,y:t}]},Qfe=function(e,t){return Zfe(e,t.x).concat(Kfe(e,t.y))},Ql=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},Jfe=function(e,t){var n=-2,i=0;return t.forEach(function(a){a&&(e.x===a.x&&(i+=n),e.y===a.y&&(i+=n))}),i},TN=function(e,t,n,i,a){return Ql(e,t)+Ql(e,n)+Jfe(e,[t,n,i,a])},ele=function r(e,t,n,i,a){a===void 0&&(a=0),e.unshift(t[i]),n[i]&&n[i]!==i&&a<=100&&r(e,t,n,n[i],a+1)},Fv=function(e,t,n,i){var a=n.x-e.x,o=n.y-e.y,s=i.x-e.x,u=i.y-e.y,f=n.x-t.x,l=n.y-t.y,c=i.x-t.x,h=i.y-t.y,d=a*u-o*s,v=f*h-l*c,p=a*l-o*f,g=s*h-u*c;return d*v<=0&&p*g<=0},L1=function(e,t,n){if(n.width||n.height){var i=k1(n),a=i[0],o=i[1],s=i[2],u=i[3];return Fv(e,t,a,o)||Fv(e,t,a,u)||Fv(e,t,o,s)||Fv(e,t,s,u)}return!1},tle=function(e,t,n,i){var a=[];return e.forEach(function(o){if(o!==t&&(o.x===t.x||o.y===t.y)){if(L1(o,t,n)||L1(o,t,i))return;a.push(o)}}),T1(a)},rle=function(e,t,n,i,a,o,s){var u,f=[],l=(u={},u[t.id]=t,u),c={},h={},d={};h[t.id]=0,d[t.id]=TN(t,n,t);var v=new LN;v.add({id:t.id,value:d[t.id]});var p={};e.forEach(function(w){p[w.id]=w});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 ele(m,p,c,n.id),m}delete l[g.id],v.remove(g.id),f.push(g);var b=tle(e,g,i,a),x=function(E){E.forEach(function(_){if(f.indexOf(_)===-1){var M=_.id;l[M]||(l[M]=_);var C=d[g.id]+Ql(g,_);if(h[M]&&C>=h[M]){v.add({id:M,value:d[M]});return}c[M]=g.id,h[M]=C,d[M]=h[M]+TN(_,n,t,o,s),v.add({id:M,value:d[M]})}})};x(b)}return[t,n]},nle=function(e,t,n){return!(e.x===t.x&&t.x===n.x||e.y===t.y&&t.y===n.y)},ile=function(e,t,n,i){var a=Ql(e,t),o=Ql(n,t);a=0;o--){var s=e[o];if(s.x===n.x?i.push(s):(i=[s],n.x=s.x),s.y===n.y?a.push(s):(a=[s],n.y=s.y),i.length>2){var u=e.indexOf(i[1]);u>-1&&e.splice(u,1);continue}if(a.length>2){var u=e.indexOf(a[1]);u>-1&&e.splice(u,1)}}return e},LN=function(){function r(){this.arr=[],this.map={},this.arr=[],this.map={}}return r.prototype._innerAdd=function(e,t){for(var n=[0,t-1];n[1]-n[0]>1;){var i=Math.floor((n[0]+n[1])/2);if(this.arr[i].value>e.value)n[1]=i;else if(this.arr[i].value=0;t--)this.map[this.arr[t].id]?e=this.arr[t].id:this.arr.splice(t,1);return e},r.prototype._findFirstId=function(){for(;this.arr.length;){var e=this.arr.shift();if(this.map[e.id])return e.id}},r.prototype.minId=function(e){return e?this._clearAndGetMinId():this._findFirstId()},r}(),ole=function(e,t){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},sle=function(e,t,n,i,a){return CN(kN(e,t,n,i,a.offset))},ule={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:ole,fallbackRoute:sle},Wa=function(e,t){var n=Math.round(Math.abs(e/t)),i=e<0?-1:1;return n<0?0:i*n},fle=function(e,t,n){var i={};return e.forEach(function(a){if(a)for(var o=Rv(a.getBBox(),n),s=Wa(o.minX,t);s<=Wa(o.maxX,t);s+=1)for(var u=Wa(o.minY,t);u<=Wa(o.maxY,t);u+=1)i["".concat(s,"|||").concat(u)]=!0}),i},N1=function(e,t){var n=t.x-e.x,i=t.y-e.y;return n||i?Math.atan2(i,n):0},NN=function(e,t){var n=Math.abs(e-t);return n>Math.PI?2*Math.PI-n:n},ON=function(e,t,n){for(var i=1/0,a=0,o=t.length;af.minX&&t.xf.minY&&t.y0&&E>0;){var G=b.minId((E+1)%30===0);if(G)_=v[G];else break;if(O["".concat(_.x,"|||").concat(_.y)])return lle(_,g,l,t,e,c,u);delete v[_.id],b.remove(_.id),p[_.id]=!0;for(var x=0;xo.maxAllowedDirectionChange)&&!f[D])){v[D]||(v[D]=C);var $=s[T];S=o.distFunc(_,C)+(isNaN($)?u:$),A=y[_.id]+S;var Y=y[D];Y&&A>=Y||(g[D]=_,y[D]=A,m[D]=A+ON(C,d,o.distFunc),b.add({id:D,value:m[D]}))}}E-=1}return o.fallbackRoute(e,t,n,i,o)};eS("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:B({},Qe.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(e,t){var n=this.getShapeStyle(e);n.radius===0&&delete n.radius;var i=t.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:n});return t.shapeMap["edge-shape"]=i,i},getShapeStyle:function(e){var t=this.options.style,n={stroke:e.color},i=gt({},t,n,e.style);e=this.getPathPoints(e),this.radius=i.radius,this.offset=i.offset;var a=e.startPoint,o=e.endPoint,s=this.getControlPoints(e),u=[a];s&&(u=u.concat(s)),u.push(o);var f=e.sourceNode,l=e.targetNode,c=i.radius,h=this.options.routeCfg,d=gt({},h,e.routeCfg);d.offset=i.offset;var v=this.getPath(u,f,l,c,d,!s);(vt(v)&&v.length<=1||Pe(v)&&v.indexOf("L")===-1)&&(v="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(o.x)||isNaN(o.y))&&(v="M0 0, L0 0");var p=gt({},Qe.defaultEdge.style,i,{lineWidth:e.size,path:v});return p},updateShapeStyle:function(e,t){var n=t.getContainer();if(t.isVisible()){var i={stroke:e.color},a=n.shapeMap["edge-shape"]||n.find(function(x){return x.get("className")==="edge-shape"})||t.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=a.attr(),h=gt({},i,c,e.style),d=e.sourceNode,v=e.targetNode,p=h.radius,g=this.options.routeCfg,y=gt({},g,e.routeCfg);y.offset=h.offset;var m=this.getPath(l,d,v,p,y,!f);(vt(m)&&m.length<=1||Pe(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=gt(i,a.attr(),{lineWidth:o,path:m},e.style);a&&a.attr(b)}},getPath:function(e,t,n,i,a,o){var s=a.offset,u=a.obstacles,f=a.simple;if(!s||e.length>2||o===!1){if(i)return IN(e,i);var l=[];return ye(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?kN(e[e.length-1],e[0],n,t,s):cle(e[0],e[e.length-1],t,n,a);if(!c||!c.length)return"M0 0, L0 0";if(i){var h=IN(c,i);return h}c=ale(c);var d=bn.pointsToPolygon(c);return d}},"single-edge");var PN=Ua.cloneEvent,RN=Ua.isNaN,BN=Math.abs,hle=10,dle=["shift","ctrl","alt","control"];const vle={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 t=this.origin,n=+e.clientX,i=+e.clientY;if(!(RN(n)||RN(i))){var a=n-t.x,o=i-t.y;this.get("direction")==="x"?o=0:this.get("direction")==="y"&&(a=0),this.origin={x:n,y:i};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+a>s+l||f.maxX+l>=0&&f.maxX+l+a<0)&&(a=0),(f.minY<=u+c&&f.minY+o>u+c||f.maxY+c>=0&&f.maxY+c+o<0)&&(o=0),this.graph.translate(a,o)}},onTouchStart:function(e){var t=this,n=e.originalEvent.touches,i=n[0],a=n[1];i&&a||(e.preventDefault(),this.mousedown=!0,t.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 t=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)&&!t.keydown&&this.allowDrag(e)){if(t.origin={x:e.clientX,y:e.clientY},t.dragging=!1,this.enableOptimize){for(var i=this.graph,a=i.getEdges(),o=0,s=a.length;ou)for(var d=i.getNodes(),v=0,p=d.length;v-1?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(e){var t,n,i=e.target,a=i&&i.isCanvas&&i.isCanvas();if(of(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if(un(this.allowDragOnItem)){var o=this.allowDragOnItem,s=o.node,u=o.edge,f=o.combo,l=(n=(t=e.item)===null||t===void 0?void 0:t.getType)===null||n===void 0?void 0:n.call(t);if(!s&&l==="node"||!u&&l==="edge"||!f&&l==="combo")return!1}return!0}},ple={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 t=e.getType();return t==="combo"},onTouchStart:function(e){if(e.item){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)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,t.onDragStart(e)}},onTouchMove:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a){t.onDragEnd(e);return}e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.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 t,n;if(((n=(t=e.item)===null||t===void 0?void 0:t.getType)===null||n===void 0?void 0:n.call(t))!=="node"){this.onDragEnd();return}this.mousedown&&(this.dragstart?this.onDrag(B(B({},e),this.mousedown)):(this.dragstart=!0,this.onDragStart(e)))},onDragStart:function(e){var t=this;if(this.currentShouldEnd=!0,!!this.shouldBegin(B(B({},e),this.mousedown),this)){var n=this.mousedown,i=n.item,a=n.target;if(!(!i||i.destroyed||i.hasLocked())){var o=i.getContainer();if(o.set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(i),a){var s=a.get("isAnchorPoint");if(s)return}var u=this.graph;this.targets=[],this.targetCombo=null;var f=u.findAllByState("node",this.selectedState),l=i.get("id"),c=f.filter(function(d){var v=d.get("id");return l===v});if(c.length===0?this.targets.push(i):f.length>1?f.forEach(function(d){var v=d.hasLocked();v||t.targets.push(d)}):this.targets.push(i),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()&&(t.hidenEdge[p.getID()]=!0,p.hide())})}),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(e){var t=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(i){t.update(i,e);var a=i.getModel().comboId;a&&(n[a]=t.graph.findById(a))}),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(e){var t=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){t.hidenEdge[u.getID()]&&u.show(),u.refresh()})}),this.hidenEdge={};var i=this.graph;if(i.get("enabledStack")&&this.enableStack){var a={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(o){a.before.nodes.push(o)}),this.targets.forEach(function(o){var s=o.getModel(),u=s.x,f=s.y,l=s.id;a.after.nodes.push({x:u,y:f,id:l})}),i.pushStack("update",Vt(a))}i.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 t=e.item;if(this.currentShouldEnd=this.shouldEnd(e,t,this),this.updatePositions(e,!this.currentShouldEnd),!(!this.currentShouldEnd||!this.validationCombo(t))){var n=this.graph;if(this.comboActiveState&&n.setItemState(t,this.comboActiveState,!1),this.targetCombo=t,this.onlyChangeComboSize)n.updateCombos();else{var i=t.getModel();this.targets.map(function(a){var o=a.getModel();o.comboId!==i.id&&n.updateComboTree(a,i.id)}),n.updateCombo(t)}n.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(e){var t=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 i=n.getModel();i.comboId&&t.updateComboTree(n)}))},onDropNode:function(e){if(!(!this.targets||this.targets.length===0)){var t=this,n=e.item,i=t.graph,a=n.getModel().comboId,o=a?i.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(a){var s=i.findById(a);t.comboActiveState&&i.setItemState(s,t.comboActiveState,!1),this.targets.map(function(u){var f=u.getModel();a!==f.comboId&&i.updateComboTree(u,a)}),i.updateCombo(s)}else this.targets.map(function(u){var f=u.getModel();f.comboId&&i.updateComboTree(u)});i.emit("dragnodeend",{items:this.targets,targetItem:n})}}},onDragEnter:function(e){var t=e.item;if(this.validationCombo(t)){var n=this.graph;this.comboActiveState&&n.setItemState(t,this.comboActiveState,!0)}},onDragLeave:function(e){var t=e.item;if(this.validationCombo(t)){var n=this.graph;this.comboActiveState&&n.setItemState(t,this.comboActiveState,!1)}},updatePositions:function(e,t){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}):t||this.targets.map(function(i){return n.update(i,e)}):this.targets.map(function(i){return n.update(i,e,t)}))},update:function(e,t,n){var i=this.origin,a=e.get("model"),o=e.get("id");this.point[o]||(this.point[o]={x:a.x||0,y:a.y||0});var s=t.x-i.x+this.point[o].x,u=t.y-i.y+this.point[o].y;n&&(s+=i.x-t.x,u+=i.y-t.y);var f={x:s,y:u};this.get("updateEdge")?this.graph.updateItem(e,f,!1):e.updatePosition(f)},debounceUpdate:sf(function(r){var e=r.targets,t=r.graph,n=r.point,i=r.origin,a=r.evt,o=r.updateEdge,s=r.onlyChangeComboSize,u=r.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=a.x-i.x+n[c].x,d=a.y-i.y+n[c].y,v={x:h,y:d};o?t.updateItem(f,v,!1):f.updatePosition(v)}),s&&u(t,e)},50,!0),updateDelegate:function(e){var t=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=t.get("group"),i=gr({},Jo.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(e),o=a.x,s=a.y,u=a.width,f=a.height,l=a.minX,c=a.minY;this.originPoint={x:o,y:s,width:u,height:f,minX:l,minY:c},this.delegateRect=n.addShape("rect",{attrs:B({width:u,height:f,x:o,y:s},i),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(e){var t=this.targets;t.length===0&&t.push(e.item);for(var n=1/0,i=-1/0,a=1/0,o=-1/0,s=0;si&&(i=h),d>o&&(o=d)}var v=Math.floor(n),p=Math.floor(a),g=Math.ceil(i)-Math.floor(n),y=Math.ceil(o)-Math.floor(a);return{x:v,y:p,width:g,height:y,minX:n,minY:a}},updateParentCombos:function(e,t){var n=e||this.graph,i=t||this.targets,a={};i==null||i.forEach(function(o){var s=o.getModel().comboId;s&&(a[s]=n.findById(s))}),Object.values(a).forEach(function(o){o&&n.updateCombo(o)})}},gle={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return this.get("trigger")==="mouseenter"?{"node:mouseenter":"setAllItemStates","combo:mouseenter":"setAllItemStates","node:mouseleave":"clearActiveState","combo:mouseleave":"clearActiveState"}:{"node:click":"setAllItemStates","combo:click":"setAllItemStates","canvas:click":"clearActiveState","node:touchstart":"setOnTouchStart","combo:touchstart":"setOnTouchStart","canvas:touchstart":"clearOnTouchStart"}},setOnTouchStart:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.setAllItemStates(e)},clearOnTouchStart:function(e){var t=this;try{var n=e.originalEvent.touches,i=n[0],a=n[1];if(i&&a)return;e.preventDefault()}catch{console.warn("Touch original event not exist!")}t.clearActiveState(e)},setAllItemStates:function(e){clearTimeout(this.timer),this.throttleSetAllItemStates(e,this)},clearActiveState:function(e){var t=this;this.timer=setTimeout(function(){t.throttleClearActiveState(e,t)},50)},throttleSetAllItemStates:uf(function(r,e){var t=r.item,n=e.graph;if(!(!n||n.destroyed)&&(e.item=t,!!e.shouldUpdate(r.item,{event:r,action:"activate"},e))){for(var i=e.activeState,a=e.inactiveState,o=n.getNodes(),s=n.getCombos(),u=n.getEdges(),f=n.get("vedges"),l=o.length,c=s.length,h=u.length,d=f.length,v=e.inactiveItems||{},p=e.activeItems||{},g=0;g-1||(this.trigger=zN,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 t=e.item,n=this.brush;t||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,t=e.graph,n=e.selectedState,i=t.findAllByState("node",n),a=t.findAllByState("edge",n),o=t.findAllByState("combo",n);i.forEach(function(s){return t.setItemState(s,n,!1)}),a.forEach(function(s){return t.setItemState(s,n,!1)}),o.forEach(function(s){return t.setItemState(s,n,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.selectedCombos=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges,this.selectedCombos),t.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},isBBoxCenterInRect:function(e,t,n,i,a){var o=e.getBBox();return o.centerX>=t&&o.centerX<=n&&o.centerY>=i&&o.centerY<=a},getSelectedNodes:function(e){var t=this,n=this,i=n.graph,a=n.originPoint,o=n.shouldUpdate,s=n.isBBoxCenterInRect,u=this.selectedState,f={x:e.x,y:e.y},l=i.getPointByCanvas(a.x,a.y),c=Gv(f.x,l.x),h=FN(f.x,l.x),d=Gv(f.y,l.y),v=FN(f.y,l.y),p=[],g=[];i.getNodes().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",t)){p.push(b);var x=b.getModel();g.push(x.id),i.setItemState(b,u,!0)}});var y=[];this.includeEdges&&p.forEach(function(b){var x=b.getOutEdges();x.forEach(function(w){if(w.isVisible()){var E=w.getModel(),_=E.source,M=E.target;g.includes(_)&&g.includes(M)&&o(w,"select",t)&&(y.push(w),i.setItemState(w,t.selectedState,!0))}})});var m=[];this.includeCombos&&i.getCombos().forEach(function(b){if(b.isVisible()&&s(b,c,h,d,v)&&o(b,"select",t)){m.push(b);var x=b.getModel();g.push(x.id),i.setItemState(b,u,!0)}}),this.selectedEdges=y,this.selectedNodes=p,this.selectedCombos=m,this.onSelect&&this.onSelect(p,y,m),i.emit("nodeselectchange",{selectedItems:{nodes:p,edges:y,combos:m},select:!0})},createBrush:function(){var e=this,t=e.graph.get("canvas").addShape("rect",{attrs:e.brushStyle,capture:!1,name:"brush-shape"});return this.brush=t,this.delegate=t,t},updateBrush:function(e){var t=this.originPoint;this.brush.attr({width:GN(e.canvasX-t.x),height:GN(e.canvasY-t.y),x:Gv(e.canvasX,t.x),y:Gv(e.canvasY,t.y)})},onKeyDown:function(e){var t=e.key;if(t){var n=this.trigger.toLowerCase(),i=t.toLowerCase();i===n||i==="control"&&n==="ctrl"||i==="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 $N="shift",ble=["shift","ctrl","alt","control"];const xle={getDefaultCfg:function(){return{multiple:!0,trigger:$N,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var e=this;return ble.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=$N,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 t=this,n=e.item;if(!(!n||n.destroyed)){var i=n.getType(),a=t.graph,o=t.keydown,s=t.multiple,u=t.shouldUpdate,f=t.shouldBegin;if(f(e,t)){if(!o||!s){var l=a.findAllByState("node",t.selectedState).concat(a.findAllByState("edge",t.selectedState)).concat(a.findAllByState("combo",t.selectedState));ye(l,function(p){p!==n&&a.setItemState(p,t.selectedState,!1)})}var c=function(){switch(i){case"node":return t.selectNode;case"edge":return t.selectEdge;case"combo":return t.selectCombo;default:return!1}}();if(!c){var h=a.findAllByState("node",t.selectedState),d=a.findAllByState("edge",t.selectedState),v=a.findAllByState("combo",t.selectedState);a.emit("nodeselectchange",{selectedItems:{nodes:h,edges:d,combos:v},select:!1});return}if(n.hasState(t.selectedState)){u(e,t)&&a.setItemState(n,t.selectedState,!1);var h=a.findAllByState("node",t.selectedState),d=a.findAllByState("edge",t.selectedState),v=a.findAllByState("combo",t.selectedState);a.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!1})}else{u(e,t)&&a.setItemState(n,t.selectedState,!0);var h=a.findAllByState("node",t.selectedState),d=a.findAllByState("edge",t.selectedState),v=a.findAllByState("combo",t.selectedState);a.emit("nodeselectchange",{target:n,selectedItems:{nodes:h,edges:d,combos:v},select:!0})}}}},onCanvasClick:function(e){var t=this,n=this,i=n.graph,a=n.shouldBegin;if(a(e,this)){var o=i.findAllByState("node",this.selectedState);ye(o,function(f){i.setItemState(f,t.selectedState,!1)});var s=i.findAllByState("edge",this.selectedState);ye(s,function(f){i.setItemState(f,t.selectedState,!1)});var u=i.findAllByState("combo",this.selectedState);ye(u,function(f){i.setItemState(f,t.selectedState,!1)}),i.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(e){var t=this,n=e.key;n&&(n.toLowerCase()===this.trigger.toLowerCase()||n.toLowerCase()==="control"?t.keydown=!0:t.keydown=!1)},onKeyUp:function(){var e=this;e.keydown=!1}};var wle=ni,zv=.05;const Ele={getDefaultCfg:function(){return this.isFireFox=xL()==="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 t=e.originalEvent.touches,n=t[0],i=t[1];e.preventDefault(),i&&(this.shouldBegin&&!this.shouldBegin(e,this)||(this.startPoint={pageX:n.pageX,pageY:n.pageY},this.moveable=!0,i&&(this.endPoint={pageX:i.pageX,pageY:i.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(e){if(this.moveable){e.preventDefault();var t=e.originalEvent.touches,n=t[0],i=t[1];if(i){this.endPoint||(this.endPoint={pageX:i.pageX,pageY:i.pageY});var a=function(p,g){return Math.hypot(g.x-p.x,g.y-p.y)},o=a({x:n.pageX,y:n.pageY},{x:i.pageX,y:i.pageY})/a({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-zv*u:l=1/(1-zv*u):e.wheelDelta<0?l=1-zv*u:l=1/(1-zv*u),c=f*l;var h=this.get("minZoom")||i.get("minZoom"),d=this.get("maxZoom")||i.get("maxZoom");c>d?c=d:ci/2?l-=h.width:l+=this.offset,c>a/2?c-=h.height:c+=this.offset;var d="".concat(l,"px"),v="".concat(c,"px");jt(this.container,{left:d,top:v,visibility:"visible"})},createTooltip:function(e){var t=e.get("el");t.style.position="relative";var n=wr('
    '));return t.parentNode.appendChild(n),jt(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}},_le=B({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(t){return t.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},jN),Sle=B({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(t){return"source: ".concat(t.source," target: ").concat(t.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},jN);var UN="click",Mle=["click","dblclick"];const Cle={getDefaultCfg:function(){return{trigger:UN,onChange:function(){}}},getEvents:function(){var e,t;return Mle.includes(this.trigger)?t=this.trigger:(t=UN,console.warn("Behavior collapse-expand 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),e={},e["node:".concat(t)]="onNodeClick",e.touchstart="onNodeClick",e},onNodeClick:function(e){var t=this;if(this.trigger==="click"){if(this.timer){clearTimeout(this.timer),this.timer=0;return}this.timer=setTimeout(function(){t.toggle(e),clearTimeout(t.timer),t.timer=0},200)}else this.toggle(e)},toggle:function(e){var t=e.item;if(t){var n=this.graph.findDataById(t.get("id"));if(n){var i=n.children;if(!(!i||i.length===0)){var a=!n.collapsed;this.shouldBegin(e,a,this)&&(n.collapsed=a,t.getModel().collapsed=a,this.graph.emit("itemcollapsed",{item:e.item,collapsed:a}),this.shouldUpdate(e,a,this)&&(this.onChange(t,a,this),this.graph.layout()))}}}}};var Ale=Ua.calculationItemsBBox,Tle=function r(e,t){if(t(e)!==!1&&e){var n=e.get("combos");if(n.length===0)return!1;ye(n,function(i){r(i,t)})}};const Ile={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 t=e.item;if(!t||t.destroyed||!this.shouldUpdate(e,this))return!1;var n=t.getType();return n==="combo"},onMouseDown:function(e){this.origin={x:e.x,y:e.y}},onDragStart:function(e){var t=this,n=this.graph,i=e.item;if(this.currentShouldEnd=!0,!!this.validationCombo(e)){this.targets=[];var a=n.findAllByState("combo",this.selectedState),o=i.get("id"),s=a.filter(function(f){var l=f.get("id");return o===l});s.length===0?this.targets.push(i):this.targets=a;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,t.activeState,!0)}}),this.point={},this.originPoint={},this.currentItemChildCombos=[],Tle(i,function(f){if(f.destroyed)return!1;var l=f.getModel();return t.currentItemChildCombos.push(l.id),!0})}},onDrag:function(e){var t=this;if(this.origin&&this.validationCombo(e))if(this.enableDelegate)this.updateDelegate(e);else{if(this.activeState){var n=this.graph,i=e.item,a=i.getModel(),o=n.getCombos(),s=i.getBBox(),u=s.centerX,f=s.centerY,l=s.width,c=o.filter(function(h){var d=h.getModel();return a.parentId,d.id!==a.id&&!t.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,t.activeState,!0):n.setItemState(h,t.activeState,!1)})}ye(this.targets,function(h){t.updateCombo(h,e)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(e,t){var n=this;(this.enableDelegate||t)&&ye(this.targets,function(i){n.updateCombo(i,e,t)})},onDrop:function(e){var t=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 i=this.graph,a=n.getModel();this.targets.map(function(o){var s=o.getModel();s.parentId!==a.id?(t.activeState&&i.setItemState(n,t.activeState,!1),t.onlyChangeComboSize?i.updateCombo(o):i.updateComboTree(o,a.id,!1)):i.updateCombo(n)}),this.end(n,e),this.endComparison=!0}},onNodeDrop:function(e){var t=this;if(!(!this.targets||this.targets.length===0)){var n=this.graph,i=e.item,a=i.getModel().comboId,o=a?n.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(e,o,this),this.updatePositions(e,!this.currentShouldEnd),!!this.currentShouldEnd){var s;if(a){if(this.activeState){var u=n.findById(a);n.setItemState(u,this.activeState,!1)}this.targets.map(function(f){t.onlyChangeComboSize?n.updateCombo(f):a!==f.getID()&&(s=n.findById(a),a!==f.getModel().parentId&&n.updateComboTree(f,a,!1))})}else this.targets.map(function(f){if(t.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 t=e.item,n=this.graph;this.activeState&&n.setItemState(t,this.activeState,!0)}},onDragLeave:function(e){if(this.origin&&this.validationCombo(e)){var t=e.item,n=this.graph;this.activeState&&n.setItemState(t,this.activeState,!1)}},onDragEnd:function(e){if(!(!this.targets||this.targets.length===0)){var t=e.item;this.currentShouldEnd&&this.updatePositions(e);var n=this.getParentCombo(t.getModel().parentId),i=this.graph;n&&this.activeState&&i.setItemState(n,this.activeState,!1),this.end(void 0,e)}},end:function(e,t){var n=this;if(this.origin){var i=this.graph;if(this.delegateShape){var a=i.get("delegateGroup");a.clear(),this.delegateShape=null}if(e&&this.activeState&&i.setItemState(e,this.activeState,!1),!e){var o=i.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)i.updateComboTree(u,void 0,o);else{i.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}),i.pushStack("update",s)}})}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(e,t,n){var i=this;if(n===void 0&&(n={}),t(e,n)!==!1&&e){var a=e.get("combos");ye(a,function(s){i.traverse(s,t,n)});var o=e.get("nodes");ye(o,function(s){i.traverse(s,t,n)})}},updateCombo:function(e,t,n){this.updateSingleItem(e,t,n);var i={};this.traverse(e,function(a,o){return a.destroyed?!1:(a.getEdges().forEach(function(s){return o[s.getID()]=s}),!0)},i),Object.values(i).forEach(function(a){return a.refresh()})},updateSingleItem:function(e,t,n){var i=this.origin,a=this.graph,o=e.getModel(),s=e.get("id");this.point[s]||(this.point[s]={x:o.x,y:o.y});var u=t.x-i.x+this.point[s].x,f=t.y-i.y+this.point[s].y;n&&(u+=i.x-t.x,f+=i.y-t.y),a.updateItem(e,{x:u,y:f},!1)},getParentCombo:function(e){var t=this.graph;if(e){var n=t.findById(e);if(n)return n}},updateDelegate:function(e){var t=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=t.get("delegateGroup"),i=null;this.targets.length>1?i=Ale(this.targets):i=this.targets[0].getBBox();var a=i.x,o=i.y,s=i.width,u=i.height,f=i.minX,l=i.minY;this.originPoint={x:a,y:o,width:s,height:u,minX:f,minY:l};var c=B(B({},Jo.delegateStyle),this.delegateStyle);this.delegateShape=n.addShape("rect",{attrs:B({width:i.width,height:i.height,x:i.x,y:i.y},c),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var e=this,t=e.graph,n=e.targets,i={};n==null||n.forEach(function(a){var o=a.getModel().parentId;o&&(i[o]=t.findById(o))}),Object.values(i).forEach(function(a){a&&t.updateCombo(a)})}};var XN="dblclick",kle=["click","dblclick"];const Lle={getDefaultCfg:function(){return{trigger:XN,relayout:!0}},getEvents:function(){var e,t;return kle.includes(this.trigger)?t=this.trigger:(t=XN,console.warn("Behavior collapse-expand-group 的 trigger 参数不合法,请输入 'click' 或 'dblclick'")),e={},e["combo:".concat(t)]="onComboClick",e},onComboClick:function(e){var t=e.item,n=this,i=n.graph,a=n.relayout;if(!(!t||t.destroyed||t.getType()!=="combo")){var o=t.getModel(),s=o.id;s&&(i.collapseExpandCombo(s),a&&i.get("layout")?i.layout():i.refreshPositions())}}};var Nle=Ua.isPolygonsIntersect,Ole=Ua.pathToPoints,YN="shift",Dle=["drag","shift","ctrl","alt","control"],Ple=function(e,t){var n,i=e.getKeyShape();if(e.get("type")==="path")n=Ole(i.attr("path"));else{var a=i.getCanvasBBox();n=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]]}return Nle(t,n)};const Rle={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:YN,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Dle.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=YN,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 t=this.lasso,n=e.item;n||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates("dragstart"),t||(t=this.createLasso()),this.dragging=!0,this.originPoint={x:e.x,y:e.y},this.points.push(this.originPoint),t.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,t=[];return e.length&&(e.forEach(function(n,i){i===0?t.push(["M",n.x,n.y]):t.push(["L",n.x,n.y])}),t.push(["L",e[0].x,e[0].y])),t},clearStates:function(e){e===void 0&&(e="canvas:click");var t=this,n=t.graph,i=t.selectedState,a=t.shouldDeselect,o=n.findAllByState("node",i),s=n.findAllByState("edge",i);(!a||a({action:e,nodes:o,edges:s}))&&(o.forEach(function(u){return n.setItemState(u,i,!1)}),s.forEach(function(u){return n.setItemState(u,i,!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,t=this,n=t.graph,i=t.shouldUpdate,a=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()&&Ple(l,a)&&i(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)&&i(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,t=e.graph.get("delegateGroup").addShape("path",{attrs:B({path:[]},e.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=t,this.delegate=t,this.points=[],t},updateLasso:function(e){var t=this;this.lasso.attr({path:t.getLassoPath()})},onKeyDown:function(e){var t=e.key;t&&(t.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 WN="click",Ble=["click","drag"],VN=void 0,Fle=["shift","ctrl","control","alt","meta",void 0];const Gle={getDefaultCfg:function(){return{trigger:WN,key:VN,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var e=this;Ble.indexOf(e.trigger.toLowerCase())>-1||(e.trigger=WN,console.warn("Behavior create-edge 的 trigger 参数不合法,请输入 'click','drag'")),e.key&&Fle.indexOf(e.key.toLowerCase())===-1&&(e.trigger=VN,console.warn("Behavior create-edge 的 key 参数不合法,请输入 'shift','ctrl','alt','control',或 undefined"));var t;return e.trigger==="drag"?t={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:e.trigger==="click"&&(t={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),e.key&&(t.keydown="onKeyDown",t.keyup="onKeyUp"),t},onDragEnd:function(e){var t=this;if(!(t.key&&!t.keydown)){var n=e.item;(!n||n.getID()===t.source||n.getType()!=="node")&&t.cancelCreating({item:t.edge,x:e.x,y:e.y})}},onClick:function(e){var t=this;if(!(t.key&&!t.keydown)){var n=e.item,i=t.graph,a=n.getModel(),o=t.getEdgeConfig;if(t.addingEdge&&t.edge){if(!t.shouldEnd(e,t))return;var s=void 0;o&&_r(o)?s=o({source:t.source,target:a.id},t):s=t.edgeConfig;var u=B({target:a.id},s);if(t.source===a.id&&(u.type="loop"),i.emit("beforecreateedge",{}),i.updateItem(t.edge,u,!1),i.get("enabledStack")){var f=B(B({},t.edge.getModel()),{itemType:"edge"}),l={};l.edges=[f],i.pushStack("add",{before:{},after:l})}i.emit("aftercreateedge",{edge:t.edge}),t.edge.getKeyShape().set("capture",!0),t.edge=null,t.addingEdge=!1}else{if(!t.shouldBegin(e,t))return;var s=void 0;o&&_r(o)?s=o({source:a.id,target:a.id},t):s=t.edgeConfig,t.edge=i.addItem("edge",B({source:a.id,target:a.id},s),!1),t.source=a.id,t.addingEdge=!0,t.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(e){var t=this;if(!(t.key&&!t.keydown)){t.edge&&t.edge.destroyed&&t.cancelCreating({item:t.edge});var n={x:e.x,y:e.y};if(!t.graph.findById(t.source)){t.addingEdge=!1;return}t.addingEdge&&t.edge&&t.graph.updateItem(t.edge,{target:n},!1)}},cancelCreating:function(e){var t,n,i=this;if(!(i.key&&!i.keydown)){var a=i.graph,o=e.item;if(i.addingEdge&&(i.edge===o||!((n=(t=e.target)===null||t===void 0?void 0:t.isCanvas)===null||n===void 0)&&n.call(t))){i.edge&&!i.edge.destroyed&&a.removeItem(i.edge,!1),i.edge=null,i.addingEdge=!1;return}}},onKeyDown:function(e){var t=this,n=e.key;n&&(n.toLowerCase()===t.key.toLowerCase()?t.keydown=!0:t.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 HN="ctrl",zle=["shift","ctrl","alt","control"],$le="1";const jle={getDefaultCfg:function(){return{trigger:HN,combinedKey:$le,functionName:"fitView",functionParams:[]}},getEvents:function(){return zle.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=HN,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 t=e.key;if(t){var n=this.trigger.toLowerCase(),i=t.toLowerCase();this.triggerKeydown||(i===n||i==="control"&&n==="ctrl"||i==="ctrl"&&n==="control"?this.triggerKeydown=!0:this.triggerKeydown=!1);var a=this.graph;if(!a[this.functionName])return console.warn("Behavior shortcuts-fit-view 的 functionName 参数 '".concat(this.functionName,"' 不合法,它不是 Graph 的一个函数名")),{};if(this.triggerKeydown&&!this.combinedKey){this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]();return}var o=this.combinedKey.toLowerCase();this.triggerKeydown&&(i===o||i==="control"&&o==="ctrl"||i==="ctrl"&&o==="control")&&(this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]())}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}};var Ule=["shift","ctrl","alt","control","meta"],Xle={"drag-canvas":vle,"zoom-canvas":Ele,"drag-node":ple,"activate-relations":gle,"brush-select":mle,"click-select":xle,"lasso-select":Rle,tooltip:_le,"edge-tooltip":Sle,"collapse-expand":Cle,"drag-combo":Ile,"collapse-expand-combo":Lle,"create-edge":Gle,"shortcuts-call":jle,"scroll-canvas":{getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return(!this.zoomKey||Ule.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(e){var t=this;if(this.allowDrag(e)){var n=this.graph,i=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];i.includes("control")&&i.push("ctrl");var a=i.some(function(P){return e["".concat(P,"Key")]});if(a){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 x=this.get("enableOptimize");if(x){var w=this.get("optimizeZoom"),E=this.get("optimized"),_=n.getNodes(),M=n.getEdges(),C=_.length,S=M.length;if(!E){for(var A=0;A{const e={nodes:[{id:"node1",label:"node1"},{id:"node2",label:"node2"}],edges:[{source:"node1",target:"node2"}]},t=new qN.Graph({container:"test",width:800,height:500,modes:{default:["drag-node","zoom-canvas","click-select"]}});t.data(e),t.render()}),(e,t)=>(Ka.openBlock(),Ka.createElementBlock("div",Qle))}}),ece=(r,e)=>r+e,tce=(r,e)=>r-e,rce=(r,e)=>r*e,nce=(r,e)=>r/e,ice=[Jle],ace=function(r,e){ice.forEach(t=>{r.component(t.name,t)})};bi.divide=nce,bi.install=ace,bi.multiply=rce,bi.subtract=tce,bi.sum=ece,Object.defineProperty(bi,Symbol.toStringTag,{value:"Module"})});