n8n-editor-ui
Version:
Workflow Editor UI for n8n
5 lines • 119 kB
JavaScript
import{l as q,v as on,x as ot,y as te,z as Ke,u as W,E as Ue,n as qe,A as an,e as b,i as Y,j as ln,m as Bt,p as un,g as cn,r as M,B as ye,f as G,C as at,a as Ie,D as Q,h as hn,F as dn,T as $,G as fn,H as vn,I as yn,J as pn,K as gn,L as Ut,M as mn,N as De,O as lt}from"./util-98a92a84.js";import{P as ve,E as Je,A as Vt,D as Le,a as Ve,W as he}from"./common-fe415eb9.js";function T(a,o){if(!(a instanceof o))throw new TypeError("Cannot call a class as a function")}function ut(a,o){for(var i=0;i<o.length;i++){var n=o[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(a,n.key,n)}}function w(a,o,i){return o&&ut(a.prototype,o),i&&ut(a,i),a}function u(a,o,i){return o in a?Object.defineProperty(a,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[o]=i,a}function D(a,o){if(typeof o!="function"&&o!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(o&&o.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),o&&Ze(a,o)}function U(a){return U=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},U(a)}function Ze(a,o){return Ze=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},Ze(a,o)}function _n(){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 d(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function En(a,o){return o&&(typeof o=="object"||typeof o=="function")?o:d(a)}function L(a){var o=_n();return function(){var n=U(a),e;if(o){var t=U(this).constructor;e=Reflect.construct(n,arguments,t)}else e=n.apply(this,arguments);return En(this,e)}}function Cn(a,o){for(;!Object.prototype.hasOwnProperty.call(a,o)&&(a=U(a),a!==null););return a}function H(a,o,i){return typeof Reflect<"u"&&Reflect.get?H=Reflect.get:H=function(e,t,r){var s=Cn(e,t);if(s){var l=Object.getOwnPropertyDescriptor(s,t);return l.get?l.get.call(r):l.value}},H(a,o,i||a)}function We(a,o){return xn(a)||An(a,o)||Ht(a,o)||Tn()}function Ge(a){return kn(a)||bn(a)||Ht(a)||Sn()}function kn(a){if(Array.isArray(a))return Qe(a)}function xn(a){if(Array.isArray(a))return a}function bn(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function An(a,o){var i=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(i!=null){var n=[],e=!0,t=!1,r,s;try{for(i=i.call(a);!(e=(r=i.next()).done)&&(n.push(r.value),!(o&&n.length===o));e=!0);}catch(l){t=!0,s=l}finally{try{!e&&i.return!=null&&i.return()}finally{if(t)throw s}}return n}}function Ht(a,o){if(a){if(typeof a=="string")return Qe(a,o);var i=Object.prototype.toString.call(a).slice(8,-1);if(i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set")return Array.from(a);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Qe(a,o)}}function Qe(a,o){(o==null||o>a.length)&&(o=a.length);for(var i=0,n=new Array(o);i<o;i++)n[i]=a[i];return n}function Sn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var ct={},ht={},dt={},K={get:function(o,i,n){var e=ct[i];if(e)return new e(o,n);throw{message:"jsPlumb: unknown endpoint type '"+i+"'"}},clone:function(o){var i=dt[o.type];return K.get(o.endpoint,o.type,i.getParams(o))},compute:function(o,i,n,e){var t=ht[o.type];if(t!=null)return t(o,i,n,e);q("jsPlumb: cannot find endpoint calculator for endpoint of type ",o.type)},registerHandler:function(o){dt[o.type]=o,ct[o.type]=o.cls,ht[o.type]=o.compute}},He=function(){function a(o,i){T(this,a),this.endpoint=o,u(this,"typeId",void 0),u(this,"x",void 0),u(this,"y",void 0),u(this,"w",void 0),u(this,"h",void 0),u(this,"computedValue",void 0),u(this,"bounds",Je()),u(this,"classes",[]),u(this,"instance",void 0),u(this,"type",void 0),i=i||{},this.instance=o.instance,o.cssClass&&this.classes.push(o.cssClass),i.cssClass&&this.classes.push(i.cssClass)}return w(a,[{key:"addClass",value:function(i){this.classes.push(i),this.instance.addEndpointClass(this.endpoint,i)}},{key:"removeClass",value:function(i){this.classes=this.classes.filter(function(n){return n!==i}),this.instance.removeEndpointClass(this.endpoint,i)}},{key:"compute",value:function(i,n,e){this.computedValue=K.compute(this,i,n,e),this.bounds.xmin=this.x,this.bounds.ymin=this.y,this.bounds.xmax=this.x+this.w,this.bounds.ymax=this.y+this.h}},{key:"setVisible",value:function(i){this.instance.setEndpointVisible(this.endpoint,i)}}]),a}(),Ee=function(a){D(i,a);var o=L(i);function i(n,e){var t;return T(this,i),t=o.call(this,n,e),u(d(t),"radius",void 0),u(d(t),"defaultOffset",void 0),u(d(t),"defaultInnerRadius",void 0),u(d(t),"type",i.type),e=e||{},t.radius=e.radius||5,t.defaultOffset=.5*t.radius,t.defaultInnerRadius=t.radius/3,t}return i}(He);u(Ee,"type","Dot");var Pn={type:Ee.type,cls:Ee,compute:function(o,i,n,e){var t=i.curX-o.radius,r=i.curY-o.radius,s=o.radius*2,l=o.radius*2;if(e&&e.stroke){var c=e.strokeWidth||1;t-=c,r-=c,s+=c*2,l+=c*2}return o.x=t,o.y=r,o.w=s,o.h=l,[t,r,s,l,o.radius]},getParams:function(o){return{radius:o.radius}}},$e=function(a){D(i,a);var o=L(i);function i(n,e){var t;return T(this,i),t=o.call(this,n,e),u(d(t),"type",i.type),t}return i}(He);u($e,"type","Blank");var On={type:$e.type,cls:$e,compute:function(o,i,n,e){return o.x=i.curX,o.y=i.curY,o.w=10,o.h=0,[i.curX,i.curY,10,0]},getParams:function(o){return{}}},et=function(a){D(i,a);var o=L(i);function i(n,e){var t;return T(this,i),t=o.call(this,n,e),u(d(t),"width",void 0),u(d(t),"height",void 0),u(d(t),"type",i.type),e=e||{},t.width=e.width||10,t.height=e.height||10,t}return w(i,null,[{key:"_getParams",value:function(e){return{width:e.width,height:e.height}}}]),i}(He);u(et,"type","Rectangle");var wn={type:et.type,cls:et,compute:function(o,i,n,e){var t=e.width||o.width,r=e.height||o.height,s=i.curX-t/2,l=i.curY-r/2;return o.x=s,o.y=l,o.w=t,o.h=r,[s,l,t,r]},getParams:function(o){return{width:o.width,height:o.height}}},Wt=function(){function a(o,i){T(this,a),this.connection=o,u(this,"type",void 0),u(this,"edited",!1),u(this,"stub",void 0),u(this,"sourceStub",void 0),u(this,"targetStub",void 0),u(this,"maxStub",void 0),u(this,"typeId",void 0),u(this,"gap",void 0),u(this,"sourceGap",void 0),u(this,"targetGap",void 0),u(this,"segments",[]),u(this,"totalLength",0),u(this,"segmentProportions",[]),u(this,"segmentProportionalLengths",[]),u(this,"paintInfo",null),u(this,"strokeWidth",void 0),u(this,"x",void 0),u(this,"y",void 0),u(this,"w",void 0),u(this,"h",void 0),u(this,"segment",void 0),u(this,"bounds",Je()),u(this,"cssClass",void 0),u(this,"hoverClass",void 0),u(this,"geometry",void 0),this.stub=i.stub||this.getDefaultStubs(),this.sourceStub=Array.isArray(this.stub)?this.stub[0]:this.stub,this.targetStub=Array.isArray(this.stub)?this.stub[1]:this.stub,this.gap=i.gap||0,this.sourceGap=Array.isArray(this.gap)?this.gap[0]:this.gap,this.targetGap=Array.isArray(this.gap)?this.gap[1]:this.gap,this.maxStub=Math.max(this.sourceStub,this.targetStub),this.cssClass=i.cssClass||"",this.hoverClass=i.hoverClass||""}return w(a,[{key:"getTypeDescriptor",value:function(){return"connector"}},{key:"getIdPrefix",value:function(){return"_jsplumb_connector"}},{key:"setGeometry",value:function(i,n){this.geometry=i,this.edited=i!=null&&!n}},{key:"exportGeometry",value:function(){return this.geometry}},{key:"importGeometry",value:function(i){return this.geometry=i,!0}},{key:"resetGeometry",value:function(){this.geometry=null,this.edited=!1}},{key:"transformAnchorPlacement",value:function(i,n,e){return{x:i.x,y:i.y,ox:i.ox,oy:i.oy,curX:i.curX+n,curY:i.curY+e}}},{key:"resetBounds",value:function(){this.bounds=Je()}},{key:"findSegmentForPoint",value:function(i,n){for(var e={d:1/0,s:null,x:null,y:null,l:null,x1:null,y1:null,x2:null,y2:null,index:null,connectorLocation:null},t=0;t<this.segments.length;t++){var r=this.segments[t].findClosestPointOnPath(i,n);r.d<e.d&&(e.d=r.d,e.l=r.l,e.x=r.x,e.y=r.y,e.s=this.segments[t],e.x1=r.x1,e.x2=r.x2,e.y1=r.y1,e.y2=r.y2,e.index=t,e.connectorLocation=this.segmentProportions[t][0]+r.l*(this.segmentProportions[t][1]-this.segmentProportions[t][0]))}return e}},{key:"lineIntersection",value:function(i,n,e,t){for(var r=[],s=0;s<this.segments.length;s++)r.push.apply(r,this.segments[s].lineIntersection(i,n,e,t));return r}},{key:"boxIntersection",value:function(i,n,e,t){for(var r=[],s=0;s<this.segments.length;s++)r.push.apply(r,this.segments[s].boxIntersection(i,n,e,t));return r}},{key:"boundingBoxIntersection",value:function(i){for(var n=[],e=0;e<this.segments.length;e++)n.push.apply(n,this.segments[e].boundingBoxIntersection(i));return n}},{key:"_updateSegmentProportions",value:function(){for(var i=0,n=0;n<this.segments.length;n++){var e=this.segments[n].getLength();this.segmentProportionalLengths[n]=e/this.totalLength,this.segmentProportions[n]=[i,i+=e/this.totalLength]}}},{key:"_findSegmentForLocation",value:function(i,n){var e,t,r;if(n&&(i=i>0?i/this.totalLength:(this.totalLength+i)/this.totalLength),i===1)e=this.segments.length-1,r=1;else if(i===0)r=0,e=0;else if(i>=.5){for(e=0,r=0,t=this.segmentProportions.length-1;t>-1;t--)if(this.segmentProportions[t][1]>=i&&this.segmentProportions[t][0]<=i){e=t,r=(i-this.segmentProportions[t][0])/this.segmentProportionalLengths[t];break}}else for(e=this.segmentProportions.length-1,r=1,t=0;t<this.segmentProportions.length;t++)if(this.segmentProportions[t][1]>=i){e=t,r=(i-this.segmentProportions[t][0])/this.segmentProportionalLengths[t];break}return{segment:this.segments[e],proportion:r,index:e}}},{key:"_addSegment",value:function(i,n){if(!(n.x1===n.x2&&n.y1===n.y2)){var e=new i(n);this.segments.push(e),this.totalLength+=e.getLength(),this.updateBounds(e)}}},{key:"_clearSegments",value:function(){this.totalLength=0,this.segments.length=0,this.segmentProportions.length=0,this.segmentProportionalLengths.length=0}},{key:"getLength",value:function(){return this.totalLength}},{key:"_prepareCompute",value:function(i){this.strokeWidth=i.strokeWidth;var n=i.sourcePos.curX,e=i.targetPos.curX,t=i.sourcePos.curY,r=i.targetPos.curY,s=on({x:n,y:t},{x:e,y:r}),l=e<n,c=r<t,h=[i.sourcePos.ox,i.sourcePos.oy],f=[i.targetPos.ox,i.targetPos.oy],v=l?e:n,y=c?r:t,p=Math.abs(e-n),m=Math.abs(r-t),g=h[0]===0&&h[1]===0,_=f[0]===0&&f[1]===0;if(g||_){var E=p>m?0:1,C=[1,0][E],A=E===0?n:t,P=E===0?e:r;g&&(h[E]=A>P?-1:1,h[C]=0),_&&(f[E]=A>P?1:-1,f[C]=0)}var S=l?p+this.sourceGap*h[0]:this.sourceGap*h[0],x=c?m+this.sourceGap*h[1]:this.sourceGap*h[1],k=l?this.targetGap*f[0]:p+this.targetGap*f[0],O=c?this.targetGap*f[1]:m+this.targetGap*f[1],B=h[0]*f[0]+h[1]*f[1],F={sx:S,sy:x,tx:k,ty:O,xSpan:Math.abs(k-S),ySpan:Math.abs(O-x),mx:(S+k)/2,my:(x+O)/2,so:h,to:f,x:v,y,w:p,h:m,segment:s,startStubX:S+h[0]*this.sourceStub,startStubY:x+h[1]*this.sourceStub,endStubX:k+f[0]*this.targetStub,endStubY:O+f[1]*this.targetStub,isXGreaterThanStubTimes2:Math.abs(S-k)>this.sourceStub+this.targetStub,isYGreaterThanStubTimes2:Math.abs(x-O)>this.sourceStub+this.targetStub,opposite:B===-1,perpendicular:B===0,orthogonal:B===1,sourceAxis:h[0]===0?"y":"x",points:[v,y,p,m,S,x,k,O],stubs:[this.sourceStub,this.targetStub]};return F.anchorOrientation=F.opposite?"opposite":F.orthogonal?"orthogonal":"perpendicular",F}},{key:"updateBounds",value:function(i){var n=i.extents;this.bounds.xmin=Math.min(this.bounds.xmin,n.xmin),this.bounds.xmax=Math.max(this.bounds.xmax,n.xmax),this.bounds.ymin=Math.min(this.bounds.ymin,n.ymin),this.bounds.ymax=Math.max(this.bounds.ymax,n.ymax)}},{key:"dumpSegmentsToConsole",value:function(){q("SEGMENTS:");for(var i=0;i<this.segments.length;i++)q(this.segments[i].type,""+this.segments[i].getLength(),""+this.segmentProportions[i])}},{key:"pointOnPath",value:function(i,n){var e=this._findSegmentForLocation(i,n);return e.segment&&e.segment.pointOnPath(e.proportion,!1)||{x:0,y:0}}},{key:"gradientAtPoint",value:function(i,n){var e=this._findSegmentForLocation(i,n);return e.segment&&e.segment.gradientAtPoint(e.proportion,!1)||0}},{key:"pointAlongPathFrom",value:function(i,n,e){var t=this._findSegmentForLocation(i,e);return t.segment&&t.segment.pointAlongPathFrom(t.proportion,n,!1)||{x:0,y:0}}},{key:"compute",value:function(i){this.paintInfo=this._prepareCompute(i),this._clearSegments(),this._compute(this.paintInfo,i),this.x=this.paintInfo.points[0],this.y=this.paintInfo.points[1],this.w=this.paintInfo.points[2],this.h=this.paintInfo.points[3],this.segment=this.paintInfo.segment,this._updateSegmentProportions()}},{key:"setAnchorOrientation",value:function(i,n){}}]),a}(),we=function(a){D(i,a);var o=L(i);function i(n){var e;return T(this,i),e=o.call(this,n),u(d(e),"length",void 0),u(d(e),"m",void 0),u(d(e),"m2",void 0),u(d(e),"type",i.segmentType),e._setCoordinates({x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2}),e}return w(i,[{key:"getPath",value:function(e){return(e?"M "+this.x1+" "+this.y1+" ":"")+"L "+this.x2+" "+this.y2}},{key:"_recalc",value:function(){this.length=Math.sqrt(Math.pow(this.x2-this.x1,2)+Math.pow(this.y2-this.y1,2)),this.m=ot({x:this.x1,y:this.y1},{x:this.x2,y:this.y2}),this.m2=-1/this.m,this.extents={xmin:Math.min(this.x1,this.x2),ymin:Math.min(this.y1,this.y2),xmax:Math.max(this.x1,this.x2),ymax:Math.max(this.y1,this.y2)}}},{key:"getLength",value:function(){return this.length}},{key:"getGradient",value:function(){return this.m}},{key:"_setCoordinates",value:function(e){this.x1=e.x1,this.y1=e.y1,this.x2=e.x2,this.y2=e.y2,this._recalc()}},{key:"pointOnPath",value:function(e,t){if(e===0&&!t)return{x:this.x1,y:this.y1};if(e===1&&!t)return{x:this.x2,y:this.y2};var r=t?e>0?e:this.length+e:e*this.length;return te({x:this.x1,y:this.y1},{x:this.x2,y:this.y2},r)}},{key:"gradientAtPoint",value:function(e,t){return this.m}},{key:"pointAlongPathFrom",value:function(e,t,r){var s=this.pointOnPath(e,r),l=t<=0?{x:this.x1,y:this.y1}:{x:this.x2,y:this.y2};return t<=0&&Math.abs(t)>1&&(t*=-1),te(s,l,t)}},{key:"within",value:function(e,t,r){return r>=Math.min(e,t)&&r<=Math.max(e,t)}},{key:"closest",value:function(e,t,r){return Math.abs(r-e)<Math.abs(r-t)?e:t}},{key:"findClosestPointOnPath",value:function(e,t){var r={d:1/0,x:null,y:null,l:null,x1:this.x1,x2:this.x2,y1:this.y1,y2:this.y2};if(this.m===0)r.y=this.y1,r.x=this.within(this.x1,this.x2,e)?e:this.closest(this.x1,this.x2,e);else if(this.m===1/0||this.m===-1/0)r.x=this.x1,r.y=this.within(this.y1,this.y2,t)?t:this.closest(this.y1,this.y2,t);else{var s=this.y1-this.m*this.x1,l=t-this.m2*e,c=(l-s)/(this.m-this.m2),h=this.m*c+s;r.x=this.within(this.x1,this.x2,c)?c:this.closest(this.x1,this.x2,c),r.y=this.within(this.y1,this.y2,h)?h:this.closest(this.y1,this.y2,h)}var f=Ke({x:r.x,y:r.y},{x:this.x1,y:this.y1});return r.d=Ke({x:e,y:t},r),r.l=f/length,r}},{key:"_pointLiesBetween",value:function(e,t,r){return r>t?t<=e&&e<=r:t>=e&&e>=r}},{key:"lineIntersection",value:function(e,t,r,s){var l=Math.abs(ot({x:e,y:t},{x:r,y:s})),c=Math.abs(this.m),h=c===1/0?this.x1:this.y1-c*this.x1,f=[],v=l===1/0?e:t-l*e;if(l!==c)if(l===1/0&&c===0)this._pointLiesBetween(e,this.x1,this.x2)&&this._pointLiesBetween(this.y1,t,s)&&f.push({x:e,y:this.y1});else if(l===0&&c===1/0)this._pointLiesBetween(t,this.y1,this.y2)&&this._pointLiesBetween(this.x1,e,r)&&f.push({x:this.x1,y:t});else{var y,p;l===1/0?(y=e,this._pointLiesBetween(y,this.x1,this.x2)&&(p=c*e+h,this._pointLiesBetween(p,t,s)&&f.push({x:y,y:p}))):l===0?(p=t,this._pointLiesBetween(p,this.y1,this.y2)&&(y=(t-h)/c,this._pointLiesBetween(y,e,r)&&f.push({x:y,y:p}))):(y=(v-h)/(c-l),p=c*y+h,this._pointLiesBetween(y,this.x1,this.x2)&&this._pointLiesBetween(p,this.y1,this.y2)&&f.push({x:y,y:p}))}return f}},{key:"boxIntersection",value:function(e,t,r,s){var l=[];return l.push.apply(l,this.lineIntersection(e,t,e+r,t)),l.push.apply(l,this.lineIntersection(e+r,t,e+r,t+s)),l.push.apply(l,this.lineIntersection(e+r,t+s,e,t+s)),l.push.apply(l,this.lineIntersection(e,t+s,e,t)),l}}]),i}(Vt);u(we,"segmentType","Straight");var Me=function(a){D(i,a);var o=L(i);function i(){var n;T(this,i);for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n=o.call.apply(o,[this].concat(t)),u(d(n),"type",i.type),n}return w(i,[{key:"getDefaultStubs",value:function(){return[0,0]}},{key:"_compute",value:function(e,t){this._addSegment(we,{x1:e.sx,y1:e.sy,x2:e.startStubX,y2:e.startStubY}),this._addSegment(we,{x1:e.startStubX,y1:e.startStubY,x2:e.endStubX,y2:e.endStubY}),this._addSegment(we,{x1:e.endStubX,y1:e.endStubY,x2:e.tx,y2:e.ty}),this.geometry={source:t.sourcePos,target:t.targetPos}}},{key:"transformGeometry",value:function(e,t,r){return{source:this.transformAnchorPlacement(e.source,t,r),target:this.transformAnchorPlacement(e.target,t,r)}}}]),i}(Wt);u(Me,"type","Straight");var ft={},Yt={get:function(o,i,n){var e=ft[i];if(e)return new e(o,n);throw{message:"jsPlumb: unknown connector type '"+i+"'"}},register:function(o,i){ft[o]=i}};function mr(){for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return o.map(function(n){return"."+n}).join(",")}function _r(){for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return o.join(" ")}function In(){for(var a=arguments.length,o=new Array(a),i=0;i<a;i++)o[i]=arguments[i];return o.map(function(n){return"["+n+"]"}).join(",")}var Dn="source",Ln="target",vt="block",Gn="none",Er="absolute",Cr="fixed",kr="static",Mn="data-jtk-group",ce="data-jtk-managed",xr="data-jtk-not-draggable",br="tabindex",Rn="data-jtk-scope",Ar=Rn+"-",Fn="checkCondition",Sr="checkDropAllowed",Nn="jtk-connector",Bn="jtk-connector-outline",Un="jtk-connected",Vn="jtk-endpoint",Hn="jtk-endpoint-connected",Wn="jtk-endpoint-full",Yn="jtk-floating-endpoint",jn="jtk-endpoint-drop-allowed",Xn="jtk-endpoint-drop-forbidden",zn="jtk-endpoint-anchor",xe="jtk-group-collapsed",pe="jtk-group-expanded",Kn="jtk-overlay",qn="anchor:changed",Jn="connection",jt="internal.connection",Zn="connection:detach",Xt="connection:move",Qn="container:change",$n="endpoint:replaced",zt="internal.endpoint:unregistered",nt="internal.connection:detached",ei="element:manage",ti="group:added",ni="group:collapse",ii="group:expand",ri="group:member:added",si="group:member:removed",oi="group:removed",ai="maxConnections",li="group:nested:added",ui="group:nested:removed",ci="element:unmanage",hi="zoom",Ye="isDetachAllowed",Tr="beforeDrag",di="beforeDrop",fi="beforeDetach",Pr="beforeStartDetach",vi=In(ce),yi="Cannot establish connection: source endpoint is full",pi="Cannot establish connection: target endpoint is full",gi="Cannot establish connection: source does not exist",mi="Cannot establish connection: target does not exist",_i="connectionOverlays",Ei="allowNestedGroups",re="paintStyle",Ci="scope";function tt(a){var o=null;return Y(a)?o={type:a,options:{}}:o=a,o.options.id=o.options.id||W(),o}var it=function(a){D(i,a);var o=L(i);function i(n,e,t){var r;T(this,i),r=o.call(this),r.instance=n,r.component=e,u(d(r),"id",void 0),u(d(r),"type",void 0),u(d(r),"cssClass",void 0),u(d(r),"visible",!0),u(d(r),"location",void 0),u(d(r),"events",void 0),u(d(r),"attributes",void 0),t=t||{},r.id=t.id||W(),r.cssClass=t.cssClass||"",r.setLocation(t.location),r.events=t.events||{},r.attributes=t.attributes||{};for(var s in r.events)r.bind(s,r.events[s]);return r}return w(i,[{key:"setLocation",value:function(e){var t=this.location==null?.5:this.location;if(e!=null)try{var r=typeof e=="string"?parseFloat(e):e;isNaN(r)||(t=r)}catch{}this.location=t}},{key:"shouldFireEvent",value:function(e,t,r){return!0}},{key:"setVisible",value:function(e){this.visible=e,this.instance.setOverlayVisible(this,e)}},{key:"isVisible",value:function(){return this.visible}}]),i}(Ue),yt={},ne={get:function(o,i,n,e){var t=yt[i];if(t)return new t(o,n,e);throw{message:"jsPlumb: unknown overlay type '"+i+"'"}},register:function(o,i){yt[o]=i}},ie=function(a){D(i,a);var o=L(i);function i(n,e,t){var r;return T(this,i),r=o.call(this,n,e,t),r.instance=n,r.component=e,u(d(r),"label",void 0),u(d(r),"labelText",void 0),u(d(r),"type",i.type),u(d(r),"cachedDimensions",void 0),t=t||{label:""},r.setLabel(t.label),r}return w(i,[{key:"getLabel",value:function(){return qe(this.label)?this.label(this):this.labelText}},{key:"setLabel",value:function(e){this.label=e,this.labelText=null,this.instance.updateLabel(this)}},{key:"getDimensions",value:function(){return{w:1,h:1}}},{key:"updateFrom",value:function(e){e.label!=null&&this.setLabel(e.label),e.location!=null&&(this.setLocation(e.location),this.instance.updateLabel(this))}}]),i}(it);u(ie,"type","Label");function Or(a){return a.type===ie.type}ne.register(ie.type,ie);function be(a){return a==null?null:a.split(" ").filter(function(o){return o!=null&&o.length>0})}function pt(a,o,i){for(var n in o)a[n]=i}var ki="connector",xi="override",bi="cssClass",gt="__default",Ai="anchor",Si="anchors",ge="__label",Ti="jtk-default-label",Kt="overlay",Pi="labelLocation",mt="add",_t="remove";function se(a,o){if(a.getDefaultType){var i=a.getTypeDescriptor(),n={},e=a.getDefaultType(),t=b({},e);pt(n,e,gt),a._types.forEach(function(r){if(r!==gt){var s=a.instance.getType(r,i);if(s!=null){var l=new Set([ki,Ai,Si]);if(s.mergeStrategy===xi)for(var c in s)l.add(c);t=Bt(t,s,[bi],pn(l)),pt(n,s,r)}}}),o&&(t=gn(t,o,"_")),a.applyType(t,n)}}function je(a,o){var i=a.instance.getType(o,a.getTypeDescriptor());i!=null&&i.cssClass&&a.removeClass(i.cssClass)}function Et(a){if(a.paintStyle&&a.hoverPaintStyle){var o={};b(o,a.paintStyle),b(o,a.hoverPaintStyle),a.hoverPaintStyle=o}}function Oi(a,o){var i={cssClass:o.cssClass,id:ge,component:a},n=b(i,o);return new ie(a.instance,a,n)}function wi(a,o){var i=null;if(Y(o))i=ne.get(a.instance,o,a,{});else if(o.type!=null&&o.options!=null){var n=o,e=b({},n.options);i=ne.get(a.instance,n.type,a,e)}else i=o;return i.id=i.id||W(),a.cacheTypeItem(Kt,i,i.id),a.overlays[i.id]=i,i}var qt=function(a){D(i,a);var o=L(i);function i(n,e){var t;if(T(this,i),t=o.call(this),t.instance=n,u(d(t),"defaultLabelLocation",.5),u(d(t),"overlays",{}),u(d(t),"overlayPositions",{}),u(d(t),"overlayPlacements",{}),u(d(t),"clone",void 0),u(d(t),"deleted",void 0),u(d(t),"segment",void 0),u(d(t),"x",void 0),u(d(t),"y",void 0),u(d(t),"w",void 0),u(d(t),"h",void 0),u(d(t),"id",void 0),u(d(t),"visible",!0),u(d(t),"typeId",void 0),u(d(t),"params",{}),u(d(t),"paintStyle",void 0),u(d(t),"hoverPaintStyle",void 0),u(d(t),"paintStyleInUse",void 0),u(d(t),"_hover",!1),u(d(t),"lastPaintedAt",void 0),u(d(t),"data",void 0),u(d(t),"_defaultType",void 0),u(d(t),"events",void 0),u(d(t),"parameters",void 0),u(d(t),"_types",void 0),u(d(t),"_typeCache",void 0),u(d(t),"cssClass",void 0),u(d(t),"hoverClass",void 0),u(d(t),"beforeDetach",void 0),u(d(t),"beforeDrop",void 0),e=e||{},t.cssClass=e.cssClass||"",t.hoverClass=e.hoverClass||n.defaults.hoverClass,t.beforeDetach=e.beforeDetach,t.beforeDrop=e.beforeDrop,t._types=new Set,t._typeCache={},t.parameters=an(e.parameters||{}),t.id=e.id||t.getIdPrefix()+new Date().getTime(),t._defaultType={parameters:t.parameters,scope:e.scope||t.instance.defaultScope,overlays:{}},e.events)for(var r in e.events)t.bind(r,e.events[r]);t.clone=function(){var y=Object.create(t.constructor.prototype);return t.constructor.apply(y,[n,e]),y},t.overlays={},t.overlayPositions={};var s=e.overlays||[],l={},c=t.getDefaultOverlayKey();if(c){var h=t.instance.defaults[c];h&&s.push.apply(s,Ge(h));for(var f=0;f<s.length;f++){var v=tt(s[f]);l[v.options.id]=v}}return t._defaultType.overlays=l,e.label&&(t.getDefaultType().overlays[ge]={type:ie.type,options:{label:e.label,location:e.labelLocation||t.defaultLabelLocation,id:ge,cssClass:Ti}}),t}return w(i,[{key:"isDetachAllowed",value:function(e){var t=!0;if(this.beforeDetach)try{t=this.beforeDetach(e)}catch(r){q("jsPlumb: beforeDetach callback failed",r)}return t}},{key:"isDropAllowed",value:function(e,t,r,s,l){var c,h={sourceId:e,targetId:t,scope:r,connection:s,dropEndpoint:l};if(this.beforeDrop)try{c=this.beforeDrop(h)}catch(f){q("jsPlumb: beforeDrop callback failed",f)}else c=this.instance.checkCondition(di,h);return c}},{key:"getDefaultType",value:function(){return this._defaultType}},{key:"appendToDefaultType",value:function(e){for(var t in e)this._defaultType[t]=e[t]}},{key:"getId",value:function(){return this.id}},{key:"cacheTypeItem",value:function(e,t,r){this._typeCache[r]=this._typeCache[r]||{},this._typeCache[r][e]=t}},{key:"getCachedTypeItem",value:function(e,t){return this._typeCache[t]?this._typeCache[t][e]:null}},{key:"setType",value:function(e,t){this.clearTypes(),(be(e)||[]).forEach(this._types.add,this._types),se(this,t)}},{key:"getType",value:function(){return Array.from(this._types.keys())}},{key:"reapplyTypes",value:function(e){se(this,e)}},{key:"hasType",value:function(e){return this._types.has(e)}},{key:"addType",value:function(e,t){var r=be(e),s=!1;if(r!=null){for(var l=0,c=r.length;l<c;l++)this._types.has(r[l])||(this._types.add(r[l]),s=!0);s&&se(this,t)}}},{key:"removeType",value:function(e,t){var r=this,s=be(e),l=!1,c=function(y){return r._types.has(y)?(je(r,y),r._types.delete(y),!0):!1};if(s!=null){for(var h=0,f=s.length;h<f;h++)l=c(s[h])||l;l&&se(this,t)}}},{key:"clearTypes",value:function(e){var t=this;this._types.forEach(function(r){je(t,r)}),this._types.clear(),se(this,e)}},{key:"toggleType",value:function(e,t){var r=be(e);if(r!=null){for(var s=0,l=r.length;s<l;s++)this._types.has(r[s])?(je(this,r[s]),this._types.delete(r[s])):this._types.add(r[s]);se(this,t)}}},{key:"applyType",value:function(e,t){if(this.setPaintStyle(e.paintStyle),this.setHoverPaintStyle(e.hoverPaintStyle),this.mergeParameters(e.parameters),this.paintStyleInUse=this.getPaintStyle(),e.overlays){var r={},s;for(s in e.overlays){var l=this.overlays[e.overlays[s].options.id];if(l)l.updateFrom(e.overlays[s].options),r[e.overlays[s].options.id]=!0,this.instance.reattachOverlay(l,this);else{var c=this.getCachedTypeItem(Kt,e.overlays[s].options.id);c!=null?(this.instance.reattachOverlay(c,this),c.setVisible(!0),c.updateFrom(e.overlays[s].options),this.overlays[c.id]=c):c=this.addOverlay(e.overlays[s]),r[c.id]=!0}}for(s in this.overlays)r[this.overlays[s].id]==null&&this.removeOverlay(this.overlays[s].id,!0)}}},{key:"setPaintStyle",value:function(e){this.paintStyle=e,this.paintStyleInUse=this.paintStyle,Et(this)}},{key:"getPaintStyle",value:function(){return this.paintStyle}},{key:"setHoverPaintStyle",value:function(e){this.hoverPaintStyle=e,Et(this)}},{key:"getHoverPaintStyle",value:function(){return this.hoverPaintStyle}},{key:"destroy",value:function(){for(var e in this.overlays)this.instance.destroyOverlay(this.overlays[e]);this.overlays={},this.overlayPositions={},this.unbind(),this.clone=null}},{key:"isHover",value:function(){return this._hover}},{key:"mergeParameters",value:function(e){e!=null&&b(this.parameters,e)}},{key:"setVisible",value:function(e){this.visible=e,e?this.showOverlays():this.hideOverlays()}},{key:"isVisible",value:function(){return this.visible}},{key:"setAbsoluteOverlayPosition",value:function(e,t){this.overlayPositions[e.id]=t}},{key:"getAbsoluteOverlayPosition",value:function(e){return this.overlayPositions?this.overlayPositions[e.id]:null}},{key:"_clazzManip",value:function(e,t){for(var r in this.overlays)e===mt?this.instance.addOverlayClass(this.overlays[r],t):e===_t&&this.instance.removeOverlayClass(this.overlays[r],t)}},{key:"addClass",value:function(e,t){var r=(this.cssClass||"").split(" ");r.push(e),this.cssClass=r.join(" "),this._clazzManip(mt,e)}},{key:"removeClass",value:function(e,t){var r=(this.cssClass||"").split(" ");this.cssClass=r.filter(function(s){return s!==e}).join(" "),this._clazzManip(_t,e)}},{key:"getClass",value:function(){return this.cssClass}},{key:"shouldFireEvent",value:function(e,t,r){return!0}},{key:"getData",value:function(){return this.data}},{key:"setData",value:function(e){this.data=e||{}}},{key:"mergeData",value:function(e){this.data=b(this.data,e)}},{key:"addOverlay",value:function(e){var t=wi(this,e);if(this.getData&&t.type===ie.type&&!Y(e)){var r=this.getData(),s=e.options;if(r){var l=s.labelLocationAttribute||Pi,c=r[l];c&&(t.location=c)}}return t}},{key:"getOverlay",value:function(e){return this.overlays[e]}},{key:"getOverlays",value:function(){return this.overlays}},{key:"hideOverlay",value:function(e){var t=this.getOverlay(e);t&&t.setVisible(!1)}},{key:"hideOverlays",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t||[];for(var s in this.overlays)(t.length===0||t.indexOf(s)!==-1)&&this.overlays[s].setVisible(!1)}},{key:"showOverlay",value:function(e){var t=this.getOverlay(e);t&&t.setVisible(!0)}},{key:"showOverlays",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t=t||[];for(var s in this.overlays)(t.length===0||t.indexOf(s)!==-1)&&this.overlays[s].setVisible(!0)}},{key:"removeAllOverlays",value:function(){for(var e in this.overlays)this.instance.destroyOverlay(this.overlays[e]);this.overlays={},this.overlayPositions=null,this.overlayPlacements={}}},{key:"removeOverlay",value:function(e,t){var r=this.overlays[e];r&&(r.setVisible(!1),t||this.instance.destroyOverlay(r),delete this.overlays[e],this.overlayPositions&&delete this.overlayPositions[e],this.overlayPlacements&&delete this.overlayPlacements[e])}},{key:"removeOverlays",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];for(var s=0,l=t.length;s<l;s++)this.removeOverlay(arguments[s])}},{key:"getLabel",value:function(){var e=this.getLabelOverlay();return e!=null?e.getLabel():null}},{key:"getLabelOverlay",value:function(){return this.getOverlay(ge)}},{key:"setLabel",value:function(e){var t=this.getLabelOverlay();if(t)if(Y(e)||qe(e))t.setLabel(e);else{var s=e;s.label&&t.setLabel(s.label),s.location&&(t.location=s.location)}else{var r=Y(e)||qe(e)?{label:e}:e;t=Oi(this,r),this.overlays[ge]=t}}}]),i}(Ue),oe,ae,le,de;(function(a){a.top="top",a.left="left",a.right="right",a.bottom="bottom"})(de||(de={}));var I=de.top,N=de.left,R=de.right,V=de.bottom,Ii=[N,R],Di=[I,V],Li=function(){function a(o,i,n){T(this,a),this.instance=o,this.element=i,u(this,"isFloating",!0),u(this,"isContinuous",void 0),u(this,"isDynamic",void 0),u(this,"locations",[]),u(this,"currentLocation",0),u(this,"locked",!1),u(this,"cssClass",""),u(this,"timestamp",null),u(this,"type","Floating"),u(this,"id",W()),u(this,"orientation",[0,0]),u(this,"size",void 0),this.size=o.viewport.getPosition(n),this.locations.push({x:.5,y:.5,ox:this.orientation[0],oy:this.orientation[1],offx:0,offy:0,iox:this.orientation[0],ioy:this.orientation[1],cls:""})}return w(a,[{key:"_updateOrientationInRouter",value:function(){this.instance.router.setAnchorOrientation(this,[this.locations[0].ox,this.locations[0].oy])}},{key:"over",value:function(i){this.orientation=this.instance.router.getEndpointOrientation(i),this.locations[0].ox=this.orientation[0],this.locations[0].oy=this.orientation[1],this._updateOrientationInRouter()}},{key:"out",value:function(){this.orientation=null,this.locations[0].ox=this.locations[0].iox,this.locations[0].oy=this.locations[0].ioy,this._updateOrientationInRouter()}}]),a}(),Ct=(oe={},u(oe,I,V),u(oe,R,N),u(oe,N,R),u(oe,V,I),oe),Jt=(ae={},u(ae,I,R),u(ae,R,V),u(ae,N,I),u(ae,V,N),ae),Zt=(le={},u(le,I,N),u(le,R,I),u(le,N,V),u(le,V,R),le);function Gi(a){return a.faces.length===0?I:a.faces[0]}function me(a,o){return a.faces.indexOf(o)!==-1}function Mi(a,o){return(a.clockwise?Jt:Zt)[o]}function Ri(a,o){return(a.clockwise?Zt:Jt)[o]}function kt(a,o){return a.lockedAxis==null?a.lockedFace==null?me(a,o)===!0:a.lockedFace===o:a.lockedAxis.indexOf(o)!==-1}function Fi(a,o){if(me(a,o))return o;if(me(a,Ct[o]))return Ct[o];var i=Mi(a,o);if(me(a,i))return i;var n=Ri(a,o);return me(a,n)?n:o}var xt={x:.5,y:0,ox:0,oy:-1,offx:0,offy:0},bt={x:.5,y:1,ox:0,oy:1,offx:0,offy:0},At={x:0,y:.5,ox:-1,oy:0,offx:0,offy:0},St={x:1,y:.5,ox:1,oy:0,offx:0,offy:0},Ni={x:0,y:0,ox:0,oy:-1,offx:0,offy:0},Bi={x:1,y:0,ox:1,oy:-1,offx:0,offy:0},Ui={x:0,y:1,ox:0,oy:1,offx:0,offy:0},Vi={x:1,y:1,ox:0,oy:1,offx:0,offy:0},Hi={x:.5,y:.5,ox:0,oy:0,offx:0,offy:0},Qt={Top:[xt],Bottom:[bt],Left:[At],Right:[St],TopLeft:[Ni],TopRight:[Bi],BottomLeft:[Ui],BottomRight:[Vi],Center:[Hi],AutoDefault:[xt,At,bt,St]},Wi={Continuous:{faces:[I,N,V,R]},ContinuousTop:{faces:[I]},ContinuousRight:{faces:[R]},ContinuousBottom:{faces:[V]},ContinuousLeft:{faces:[N]},ContinuousLeftRight:{faces:[N,R]},ContinuousTopBottom:{faces:[I,V]}};function Tt(a,o){if(o=o||{},a===Ve.Perimeter)return Ji(o);var i=Qt[a];if(i!=null)return Re(a,Ut(i,function(n){return b({iox:n.ox,ioy:n.oy},n)}),o);if(i=Wi[a],i!=null)return ji(a,i.faces,o);throw{message:"jsPlumb: unknown anchor type '"+a+"'"}}function Re(a,o,i){return{type:a,locations:o,currentLocation:0,locked:!1,id:W(),isFloating:!1,isContinuous:!1,isDynamic:o.length>1,timestamp:null,cssClass:i.cssClass||""}}function wr(a,o,i){return new Li(a,o,i)}var Yi="currentFace";function ji(a,o,i){var n={type:a,locations:[],currentLocation:0,locked:!1,id:W(),cssClass:i.cssClass||"",isFloating:!1,isContinuous:!0,timestamp:null,faces:i.faces||o,lockedFace:null,lockedAxis:null,clockwise:i.clockwise!==!1,__currentFace:null};return Object.defineProperty(n,Yi,{get:function(){return this.__currentFace},set:function(t){this.__currentFace=Fi(this,t)}}),n}function Pt(a){return a.length<7&&a.every(lt)||a.length===7&&a.slice(0,5).every(lt)&&Y(a[6])}function _e(a){if(Y(a))return Tt(a,null);if(Array.isArray(a))if(Pt(a)){var o=a;return Re(null,[{x:o[0],y:o[1],ox:o[2],oy:o[3],offx:o[4]==null?0:o[4],offy:o[5]==null?0:o[5],iox:o[2],ioy:o[3],cls:o[6]||""}],{cssClass:o[6]||""})}else{var i=Ut(a,function(e){if(Y(e)){var t=Qt[e];return t!=null?b({iox:t[0].ox,ioy:t[0].oy,cls:""},t[0]):null}else if(Pt(e))return{x:e[0],y:e[1],ox:e[2],oy:e[3],offx:e[4]==null?0:e[4],offy:e[5]==null?0:e[5],iox:e[2],ioy:e[3],cls:e[6]||""}}).filter(function(e){return e!=null});return Re("Dynamic",i,{})}else{var n=a;return Tt(n.type,n.options)}}function $t(a){for(var o=.5,i=Math.PI*2/a,n=[],e=0,t=0;t<a;t++){var r=o+o*Math.sin(e),s=o+o*Math.cos(e);n.push({x:r,y:s,ox:0,oy:0,offx:0,offy:0,iox:0,ioy:0,cls:""}),e+=i}return n}function Xi(a,o){for(var i=o/a.length,n=[],e=function(s,l,c,h,f,v,y){i=o*f;for(var p=(c-s)/i,m=(h-l)/i,g=0;g<i;g++)n.push({x:s+p*g,y:l+m*g,ox:v??0,oy:y??0,offx:0,offy:0,iox:0,ioy:0,cls:""})},t=0;t<a.length;t++)e.apply(null,a[t]);return n}function rt(a,o){for(var i=[],n=0;n<a.length;n++)i.push([a[n][0],a[n][1],a[n][2],a[n][3],1/a.length,a[n][4],a[n][5]]);return Xi(i,o)}function en(a){return rt([[0,0,1,0,0,-1],[1,0,1,1,1,0],[1,1,0,1,0,1],[0,1,0,0,-1,0]],a)}function zi(a){return rt([[.5,0,1,.5],[1,.5,.5,1],[.5,1,0,.5],[0,.5,.5,0]],a)}function Ki(a){return rt([[.5,0,1,1],[1,1,0,1],[0,1,.5,0]],a)}function qi(a,o){for(var i=[],n=o/180*Math.PI,e=0;e<a.length;e++){var t=a[e].x-.5,r=a[e].y-.5;i.push({x:.5+(t*Math.cos(n)-r*Math.sin(n)),y:.5+(t*Math.sin(n)+r*Math.cos(n)),ox:a[e].ox,oy:a[e].oy,offx:0,offy:0,iox:0,ioy:0,cls:""})}return i}var J=new Map;J.set(ve.Circle,$t);J.set(ve.Ellipse,$t);J.set(ve.Rectangle,en);J.set(ve.Square,en);J.set(ve.Diamond,zi);J.set(ve.Triangle,Ki);function Ji(a){a=a||{};var o=a.anchorCount||60,i=a.shape;if(!i)throw new Error("no shape supplied to Perimeter Anchor type");if(!J.has(i))throw new Error("Shape ["+i+"] is unknown by Perimeter Anchor type");var n=J.get(i)(o);a.rotation&&(n=qi(n,a.rotation));var e=Re(Ve.Perimeter,n,a),t=b(e,{shape:i});return t}var Ae="anchors",Xe="connector";function Ot(a,o,i,n,e,t,r){var s;if(o)a.endpoints[i]=o,o.addConnection(a);else{var l=r||a.endpointSpec||a.endpointsSpec[i]||a.instance.defaults.endpoints[i]||a.instance.defaults.endpoint,c=a.endpointStyles[i]||a.endpointStyle||a.instance.defaults.endpointStyles[i]||a.instance.defaults.endpointStyle;c.fill==null&&a.paintStyle!=null&&(c.fill=a.paintStyle.stroke),c.outlineStroke==null&&a.paintStyle!=null&&(c.outlineStroke=a.paintStyle.outlineStroke),c.outlineWidth==null&&a.paintStyle!=null&&(c.outlineWidth=a.paintStyle.outlineWidth);var h=a.endpointHoverStyles[i]||a.endpointHoverStyle||a.endpointHoverStyle||a.instance.defaults.endpointHoverStyles[i]||a.instance.defaults.endpointHoverStyle;a.hoverPaintStyle!=null&&(h==null&&(h={}),h.fill==null&&(h.fill=a.hoverPaintStyle.stroke));var f=a.uuids?a.uuids[i]:null;n=n??(a.instance.defaults.anchors!=null?a.instance.defaults.anchors[i]:a.instance.defaults.anchor),s=a.instance._internal_newEndpoint({paintStyle:c,hoverPaintStyle:h,endpoint:l,connections:[a],uuid:f,element:e,scope:a.scope,anchor:n,reattachConnections:a.reattach||a.instance.defaults.reattachConnections,connectionsDetachable:a.detachable||a.instance.defaults.connectionsDetachable}),a.instance._refreshEndpoint(s),o==null&&(s.deleteOnEmpty=!0),a.endpoints[i]=s}return s}var tn=function(a){D(i,a);var o=L(i);function i(n,e){var t;T(this,i),t=o.call(this,n,e),t.instance=n,u(d(t),"connector",void 0),u(d(t),"defaultLabelLocation",.5),u(d(t),"scope",void 0),u(d(t),"typeId","_jsplumb_connection"),u(d(t),"previousConnection",void 0),u(d(t),"sourceId",void 0),u(d(t),"targetId",void 0),u(d(t),"source",void 0),u(d(t),"target",void 0),u(d(t),"detachable",!0),u(d(t),"reattach",!1),u(d(t),"uuids",void 0),u(d(t),"cost",1),u(d(t),"directed",void 0),u(d(t),"endpoints",[null,null]),u(d(t),"endpointStyles",void 0),u(d(t),"endpointSpec",void 0),u(d(t),"endpointsSpec",void 0),u(d(t),"endpointStyle",{}),u(d(t),"endpointHoverStyle",{}),u(d(t),"endpointHoverStyles",void 0),u(d(t),"suspendedEndpoint",void 0),u(d(t),"suspendedIndex",void 0),u(d(t),"suspendedElement",void 0),u(d(t),"suspendedElementId",void 0),u(d(t),"suspendedElementType",void 0),u(d(t),"_forceReattach",void 0),u(d(t),"_forceDetach",void 0),u(d(t),"proxies",[]),u(d(t),"pending",!1),t.id=e.id,t.previousConnection=e.previousConnection,t.source=e.source,t.target=e.target,e.sourceEndpoint?(t.source=e.sourceEndpoint.element,t.sourceId=e.sourceEndpoint.elementId):t.sourceId=n.getId(t.source),e.targetEndpoint?(t.target=e.targetEndpoint.element,t.targetId=e.targetEndpoint.elementId):t.targetId=n.getId(t.target),t.scope=e.scope;var r=e.anchors?e.anchors[0]:e.anchor,s=e.anchors?e.anchors[1]:e.anchor;n.manage(t.source),n.manage(t.target),t.visible=!0,t.params={cssClass:e.cssClass,hoverClass:e.hoverClass,"pointer-events":e["pointer-events"],overlays:e.overlays},t.lastPaintedAt=null,e.type&&(e.endpoints=e.endpoints||t.instance._deriveEndpointAndAnchorSpec(e.type).endpoints),t.endpointSpec=e.endpoint,t.endpointsSpec=e.endpoints||[null,null],t.endpointStyle=e.endpointStyle,t.endpointHoverStyle=e.endpointHoverStyle,t.endpointStyles=e.endpointStyles||[null,null],t.endpointHoverStyles=e.endpointHoverStyles||[null,null],t.paintStyle=e.paintStyle,t.hoverPaintStyle=e.hoverPaintStyle,t.uuids=e.uuids,t.makeEndpoint(!0,t.source,t.sourceId,r,e.sourceEndpoint),t.makeEndpoint(!1,t.target,t.targetId,s,e.targetEndpoint),t.scope||(t.scope=t.endpoints[0].scope),e.deleteEndpointsOnEmpty!=null&&(t.endpoints[0].deleteOnEmpty=e.deleteEndpointsOnEmpty,t.endpoints[1].deleteOnEmpty=e.deleteEndpointsOnEmpty);var l=t.instance.defaults.connectionsDetachable;e.detachable===!1&&(l=!1),t.endpoints[0].connectionsDetachable===!1&&(l=!1),t.endpoints[1].connectionsDetachable===!1&&(l=!1),t.endpointsSpec=e.endpoints||[null,null],t.endpointSpec=e.endpoint||null;var c=e.reattach||t.endpoints[0].reattachConnections||t.endpoints[1].reattachConnections||t.instance.defaults.reattachConnections,h=b({},t.endpoints[0].connectorStyle||t.endpoints[1].connectorStyle||e.paintStyle||t.instance.defaults.paintStyle);if(t.appendToDefaultType({detachable:l,reattach:c,paintStyle:h,hoverPaintStyle:b({},t.endpoints[0].connectorHoverStyle||t.endpoints[1].connectorHoverStyle||e.hoverPaintStyle||t.instance.defaults.hoverPaintStyle)}),e.outlineWidth&&(h.outlineWidth=e.outlineWidth),e.outlineColor&&(h.outlineStroke=e.outlineColor),e.lineWidth&&(h.strokeWidth=e.lineWidth),e.color&&(h.stroke=e.color),!t.instance._suspendDrawing){var f=t.instance._suspendedAt||W();t.instance._paintEndpoint(t.endpoints[0],{timestamp:f}),t.instance._paintEndpoint(t.endpoints[1],{timestamp:f})}t.cost=e.cost||t.endpoints[0].connectionCost,t.directed=e.directed,e.directed==null&&(t.directed=t.endpoints[0].connectionsDirected);var v=b({},t.endpoints[1].parameters);b(v,t.endpoints[0].parameters),b(v,t.parameters),t.parameters=v,t.paintStyleInUse=t.getPaintStyle()||{},t._setConnector(t.endpoints[0].connector||t.endpoints[1].connector||e.connector||t.instance.defaults.connector,!0);var y=e.data==null||!ln(e.data)?{}:e.data;t.setData(y);var p=[Le,t.endpoints[0].edgeType,t.endpoints[1].edgeType,e.type].join(" ");return/[^\s]/.test(p)&&t.addType(p,e.data),t}return w(i,[{key:"getIdPrefix",value:function(){return"_jsPlumb_c"}},{key:"getDefaultOverlayKey",value:function(){return _i}},{key:"getXY",value:function(){return{x:this.connector.x,y:this.connector.y}}},{key:"makeEndpoint",value:function(e,t,r,s,l){return r=r||this.instance.getId(t),Ot(this,l,e?0:1,s,t)}},{key:"getTypeDescriptor",value:function(){return i.type}},{key:"isDetachable",value:function(e){return this.detachable===!1?!1:e!=null?e.connectionsDetachable===!0:this.detachable===!0}},{key:"setDetachable",value:function(e){this.detachable=e===!0}},{key:"isReattach",value:function(){return this.reattach===!0||this.endpoints[0].reattachConnections===!0||this.endpoints[1].reattachConnections===!0}},{key:"setReattach",value:function(e){this.reattach=e===!0}},{key:"applyType",value:function(e,t){var r=null;e.connector!=null&&(r=this.getCachedTypeItem(Xe,t.connector),r==null&&(r=this.prepareConnector(e.connector,t.connector),this.cacheTypeItem(Xe,r,t.connector)),this.setPreparedConnector(r)),H(U(i.prototype),"applyType",this).call(this,e,t),e.detachable!=null&&this.setDetachable(e.detachable),e.reattach!=null&&this.setReattach(e.reattach),e.scope&&(this.scope=e.scope);var s=null;e.anchor?(s=this.getCachedTypeItem(Ae,t.anchor),s==null&&(s=[_e(e.anchor),_e(e.anchor)],this.cacheTypeItem(Ae,s,t.anchor))):e.anchors&&(s=this.getCachedTypeItem(Ae,t.anchors),s==null&&(s=[_e(e.anchors[0]),_e(e.anchors[1])],this.cacheTypeItem(Ae,s,t.anchors))),s!=null&&(this.instance.router.setConnectionAnchors(this,s),this.instance.router.isDynamicAnchor(this.endpoints[1])&&this.instance.repaint(this.endpoints[1].element)),this.instance.applyConnectorType(this.connector,e)}},{key:"addClass",value:function(e,t){H(U(i.prototype),"addClass",this).call(this,e),t&&(this.endpoints[0].addClass(e),this.endpoints[1].addClass(e),this.suspendedEndpoint&&this.suspendedEndpoint.addClass(e)),this.connector&&this.instance.addConnectorClass(this.connector,e)}},{key:"removeClass",value:function(e,t){H(U(i.prototype),"removeClass",this).call(this,e),t&&(this.endpoints[0].removeClass(e),this.endpoints[1].removeClass(e),this.suspendedEndpoint&&this.suspendedEndpoint.removeClass(e)),this.connector&&this.instance.removeConnectorClass(this.connector,e)}},{key:"setVisible",value:function(e){H(U(i.prototype),"setVisible",this).call(this,e),this.connector&&this.instance.setConnectorVisible(this.connector,e),this.instance._paintConnection(this)}},{key:"destroy",value:function(){H(U(i.prototype),"destroy",this).call(this),this.endpoints=null,this.endpointStyles=null,this.source=null,this.target=null,this.instance.destroyConnector(this),this.connector=null,this.deleted=!0}},{key:"getUuids",value:function(){return[this.endpoints[0].getUuid(),this.endpoints[1].getUuid()]}},{key:"prepareConnector",value:function(e,t){var r={cssClass:this.params.cssClass,hoverClass:this.params.hoverClass,"pointer-events":this.params["pointer-events"]},s;if(Y(e))s=this.instance._makeConnector(this,e,r);else{var l=e;s=this.instance._makeConnector(this,l.type,Bt(l.options||{},r))}return t!=null&&(s.typeId=t),s}},{key:"setPreparedConnector",value:function(e,t,r,s){if(this.connector!==e){var l,c="";if(this.connector!=null&&(l=this.connector,c=this.instance.getConnectorClass(this.connector),this.instance.destroyConnector(this)),this.connector=e,s&&this.cacheTypeItem(Xe,e,s),this.addClass(c),l!=null){var h=this.getOverlays();for(var f in h)this.instance.reattachOverlay(h[f],this)}t||this.instance._paintConnection(this)}}},{key:"_setConnector",value:function(e,t,r,s){var l=this.prepareConnector(e,s);this.setPreparedConnector(l,t,r,s)}},{key:"replaceEndpoint",value:function(e,t){var r=this.endpoints[e],s=r.elementId,l=this.instance.getEndpoints(r.element),c=l.indexOf(r),h=Ot(this,null,e,null,r.element,s,t);this.endpoints[e]=h,l.splice(c,1,h),r.detachFromConnection(this),this.instance.deleteEndpoint(r),this.instance.fire($n,{previous:r,current:h})}}]),i}(qt);u(tn,"type","connection");var Zi=["connectorStyle","connectorHoverStyle","connectorOverlays","connector","connectionType","connectorClass","connectorHoverClass"],Se=function(a){D(i,a);var o=L(i);function i(n,e){var t;T(this,i),t=o.call(this,n,e),t.instance=n,u(d(t),"connections",[]),u(d(t),"endpoint",void 0),u(d(t),"element",void 0),u(d(t),"elementId",void 0),u(d(t),"dragAllowedWhenFull",!0),u(d(t),"timestamp",void 0),u(d(t),"portId",void 0),u(d(t),"maxConnections",void 0),u(d(t),"proxiedBy",void 0),u(d(t),"connectorClass",void 0),u(d(t),"connectorHoverClass",void 0),u(d(t),"finalEndpoint",void 0),u(d(t),"enabled",!0),u(d(t),"isSource",void 0),u(d(t),"isTarget",void 0),u(d(t),"isTemporarySource",void 0),u(d(t),"connectionCost",1),u(d(t),"connectionsDirected",void 0),u(d(t),"connectionsDetachable",void 0),u(d(t),"reattachConnections",void 0),u(d(t),"currentAnchorClass",void 0),u(d(t),"referenceEndpoint",void 0),u(d(t),"edgeType",void 0),u(d(t),"connector",void 0),u(d(t),"connectorOverlays",void 0),u(d(t),"connectorStyle",void 0),u(d(t),"connectorHoverStyle",void 0),u(d(t),"deleteOnEmpty",void 0),u(d(t),"uuid",void 0),u(d(t),"scope",void 0),u(d(t),"_anchor",void 0),u(d(t),"defaultLabelLocation",[.5,.5]),t.appendToDefaultType({edgeType:e.edgeType,maxConnections:e.maxConnections==null?t.instance.defaults.maxConnections:e.maxConnections,paintStyle:e.paintStyle||t.instance.defaults.endpointStyle,hoverPaintStyle:e.hoverPaintStyle||t.instance.defaults.endpointHoverStyle,connectorStyle:e.connectorStyle,connectorHoverStyle:e.connectorHoverStyle,connectorClass:e.connectorClass,connectorHoverClass:e.connectorHoverClass,connectorOverlays:e.connectorOverlays,connector:e.connector}),t.enabled=e.enabled!==!1,t.visible=!0,t.element=e.element,t.uuid=e.uuid,t.portId=e.portId,t.elementId=e.elementId,t.connectionCost=e.connectionCost==null?1:e.connectionCost,t.connectionsDirected=e.connectionsDirected,t.currentAnchorClass="",t.events={},t.connectorOverlays=e.connectorOverlays,t.connectorStyle=e.connectorStyle,t.connectorHoverStyle=e.connectorHoverStyle,t.connector=e.connector,t.edgeType=e.edgeType,t.connectorClass=e.connectorClass,t.connectorHoverClass=e.connectorHoverClass,t.deleteOnEmpty=e.deleteOnEmpty===!0,t.isSource=e.source||!1,t.isTemporarySource=e.isTemporarySource||!1,t.isTarget=e.target||!1,t.connections=e.connections||[],t.scope=e.scope||n.defaultScope,t.timestamp=null,t.reattachConnections=e.reattachConnections||n.defaults.reattachConnections,t.connectionsDetachable=n.defaults.connectionsDetachable,e.connectionsDetachable===!1&&(t.connectionsDetachable=!1),t.dragAllowedWhenFull=e.dragAllowedWhenFull!==!1,e.onMaxConnections&&t.bind(ai,e.onMaxConnections);var r=e.endpoint||e.existingEndpoint||n.defaults.endpoint;if(t.setEndpoint(r),e.preparedAnchor!=null)t.setPreparedAnchor(e.preparedAnchor);else{var s=e.anchor?e.anchor:e.anchors?e.anchors:n.defaults.anchor||Ve.Top;t.setAnchor(s)}var l=[Le,e.type||""].join(" ");return t.addType(l,e.data),t}return w(i,[{key:"getIdPrefix",value:function(){return"_jsplumb_e"}},{key:"getTypeDescriptor",value:function(){return"endpoint"}},{key:"getXY",value:function(){return{x:this.endpoint.x,y:this.endpoint.y}}},{key:"getDefaultOverlayKey",value:function(){return"endpointOverlays"}},{key:"_updateAnchorClass",value:function(){var e=this._anchor&&this._anchor.cssClass;if(e!=null&&e.length>0){var t=this.instance.endpointAnchorClassPrefix+"-"+this.currentAnchorClass;this.currentAnchorClass=e;var r=this.instance.endpointAnchorClassPrefix+(this.currentAnchorClass?"-"+this.currentAnchorClass:"");t!==r&&(this.removeClass(t),this.addClass(r),this.instance.removeClass(this.element,t),this.instance.addClass(this.element,r))}}},{key:"setPreparedAnchor",value:function(e){return this.instance.router.setAnchor(this,e),this._updateAnchorClass(),this}},{key:"_anchorLocationChanged",value:function(e){this.fire(qn,{endpoint:this,anchor:e}),this._updateAnchorClass()}},{key:"setAnchor",value:function(e){var t=this.instance.router.prepareAnchor(e);return this.setPreparedAnchor(t),this}},{key:"addConnection",value:function(e){this.connections.push(e),this.instance._refreshEndpoint(this)}},{key:"detachFromConnection",value:function(e,t,r){t=t??this.connections.indexOf(e),t>=0&&(this.connections.splice(t,1),this.instance._refreshEndpoint(this)),!r&&this.deleteOnEmpty&&this.connections.length===0&&this.instance.deleteEndpoint(this)}},{key:"deleteEveryConnection",value:function(e){for(var t=this.connections.length,r=0;r<t;r++)this.instance.deleteConnection(this.connections[0],e)}},{key:"detachFrom",value:function(e){for(var t=[],r=0;r<this.connections.length;r++)(this.connections[r].endpoints[1]===e||this.connections[r].endpoints[0]===e)&&t.push(this.connections[r]);for(var s=0,l=t.length;s<l;s++)this.instance.deleteConnection(t[0]);return this}},{key:"setVisible",value:function(e,t,r){if(H(U(i.prototype),"setVisible",this).call(this,e),this.endpoint.setVisible(e),e?this.showOverlays():this.hideOverlays(),!t){for(var s=0;s<this.connections.length;s++)if(this.connections[s].setVisible(e),!r){var l=this===this.connections[s].endpoints[0]?1:0;this.connections[s].endpoints[l].connections.length===1&&this.connections[s].endpoints[l].setVisible(e,!0,!0)}}}},{key:"applyType",value:function(e,t){H(U(i.prototype),"applyType",this).call(this,e,t),this.setPaintStyle(e.endpointStyle||e.paintStyle),this.setHoverPaintStyle(e.endpointHoverStyle||e.hoverPaintStyle),this.connectorStyle=e.connectorStyle,this.connectorHoverStyle=e.connectorHoverStyle,this.connector=e.connector,this.connectorOverlays=e.connectorOverlays,this.edgeType=e.edgeType,e.maxConnections!=null&&(this.maxConnections=e.maxConnections),e.scope&&(this.scope=e.scope),b(e,Zi),this.instance.applyEndpointType(this,e)}},{key:"destroy",value:function(){H(U(i.prototype),"destroy",this).call(this),this.deleted=!0,this.endpoint!=null&&this.instance.destroyEndpoint(this)}},{key:"isFull",value:function(){return this.maxConnections===0?!0:!(this.isFloating()||this.maxConnections<0||this.connections.length<this.maxConnections)}},{key:"isFloating",value:function(){return this.instance.router.isFloating(this)}},{key:"isConnectedTo",value:function(e){var t=!1;if(e){for(var r=0;r<this.connections.length;r++)if(this.connections[r].endpoints[1]===e||this.connections[r].endpoints[0]===e){t=!0;break}}return t}},{key:"setDragAllowedWhenFull",value:function(e){this.dragAllowedWhenFull=e}},{key:"getUuid",value:function(){return this.uuid}},{key:"connectorSelector",value:function(){return this.connections[0]}},{key:"prepareEndpoint",value:function(e,t){var r={cssClass:this.cssClass,endpoint:this},s;if(un(e,He)){var l=e;s=K.clone(l),s.classes=r.cssClass.split(" ")}else if(Y(e))s=K.get(this,e,r);else{var c=e;b(r,c.options||{}),s=K.get(this,c.type,r)}return s.typeId=t,s}},{key:"setEndpoint",value:function(e){var t=this.prepareEndpoint(e);this.setPreparedEndpoint(t)}},{key:"setPreparedEndpoint",value:function(e){this.endpoint!=null&&this.instance.destroyEndpoint(this),this.endpoint=e}},{key:"addClass",value:function(e,t){H(U(i.prototype),"addClass",this).call(this,e,t),this.endpoint!=null&&this.endpoint.addClass(e)}},{key:"removeClass",value:function(e,t){H(U(i.prototype),"removeClass",this).call(this,e,t),this.endpoint!=null&&this.endpoint.removeClass(e)}}]),i}(qt),ze=function a(o,i){T(this,a),this.instance=o,this.el=i,u(this,"group",void 0)},Qi=function(a){D(i,a);var o=L(i);function i(n,e,t){var r;T(this,i),r=o.call(this,n,e),r.instance=n,u(d(r),"children",[]),u(d(r),"collapsed",!1),u(d(r),"droppable",void 0),u(d(r),"enabled",void 0),u(d(r),"orphan",void 0),u(d(r),"constrain",void 0),u(d(r),"proxied",void 0),u(d(r),"ghost",void 0),u(d(r),"revert",void 0),u(d(r),"prune",void 0),u(d(r),"dropOverride",void 0),u(d(r),"anchor",void 0),u(d(r),"endpoint",void 0),u(d(r),"connections",{source:[],target:[],internal:[]}),u(d(r),"manager",void 0),u(d(r),"id",void 0),u(d(r),"elId",void 0);var s=r.el;return s._isJsPlumbGroup=!0,s._jsPlumbGroup=d(r),r.elId=n.getId(e),r.orphan=t.orphan===!0,r.revert=r.orphan===!0?!1:t.revert!==!1,r.droppable=t.droppable!==!1,r.ghost=t.ghost===!0,r.enabled=t.enabled!==!1,r.prune=r.orphan!==!0&&t.prune===!0,r.constrain=r.ghost||t.constrain===!0,r.proxied=t.proxied!==!1,r.id=t.id||W(),r.dropOverride=t.dropOverride===!0,r.anchor=t.anchor,r.endpoint=t.endpoint,r.anchor=t.anchor,n.setAttribute(e,Mn,""),r}return w(i,[{key:"contentArea",get:function(){return this.instance.getGroupContentArea(this)}},{key:"overrideDrop",value:function(e,t){return this.dropOverride&&(this.revert||this.prune||this.orphan)}},{key:"getAnchor",value:function(e,t){return this.anchor||"Continuous"}},{key:"getEndpoint",value:function(e,t){return this.endpoint||{type:Ee.type,options:{radius:10}}}},{key:"add",value:function(e,t){var r=this.instance.getGroupContentArea(this),s=e;if(s._jsPlumbParentGroup!=null){if(s._jsPlumbParentGroup===this)return;s._jsPlumbParentGroup.remove(e,!0,t,!1)}s._jsPlumbParentGroup=this,this.children.push(new ze(this.instance,e)),this.instance._appendElement(s,r),this.manager._updateConnectionsForGroup(this)}},{key:"resolveNode",value:function(e){return e==null?null:cn(this.children,function(t){return t.el===e})}},{key:"remove",value:function(e,t,r,s,l){var c=this.resolveNode(e);c!=null&&this._doRemove(c,t,r,s,l)}},{key:"_doRemove",value:function(e,t,r,s,l){var c=e.el;if(delete c._jsPlumbParentGroup,M(this.children,function(f){return f===e}),t)try{this.instance.getGroupContentArea(this).removeChild(c)}catch(f){q("Could not remove element from Group "+f)}if(!r){var h={group:this,el:c};l&&(h.targetGroup=l),this.instance.fire(si,h)}s||this.manager._updateConnectionsForGroup(this)}},{key:"removeAll",value:function(e,t){for(var r=0,s=this.children.length;r<s;r++){var l=this.children[0];this._doRemove(l,e,t,!0),this.instance.unmanage(l.el,!0)}this.children.length=0,this.manager._updateConnectionsForGroup(this)}},{key:"orphanAll",value:function(){for(var e={},t=0;t<this.children.length;t++){var r=this.manager.orphan(this.children[t].el,!1);e[r.id]=r.pos}return this.children.length=0,e}},{key:"addGroup",value:function(e){if(this.instance.allowNestedGroups&&e!==this){if(this.instance.groupManager.isAncestor(this,e))return!1;e.group!=null&&e.group.removeGroup(e);var t=this.instance.getId(e.el),r=this.instance.getManagedElements()[t];r.group=this.elId;var s=this.instance.getOffsetRelativeToRoot(e.el),l=this.collapsed?this.instance.getOffsetRelativeToRoot(this.el):this.instance.getOffsetRelativeToRoot(this.instance.getGroupContentArea(this));e.el._jsPlumbParentGroup=this,this.children.push(e),this.instance._appendElementToGroup(this,e.el),e.group=this;var c={x:s.x-l.x,y:s.y-l.y};return this.instance.setPosition(e.el,c),this.instance.fire(li,{parent:this,child:e}),!0}else return!1}},{key:"removeGroup",value:function(e){if(e.group===this){var t=e.el,r=this.instance.getGroupContentArea(this);r===t.parentNode&&r.removeChild(e.el);var s=this.instance.getId(e.el),l=this.instance.getManagedElements()[s];l&&delete l.group,this.children=this.children.filter(function(c){return c.id!==e.id}),delete e.group,delete t._jsPlumbParentGroup,this.instance.fire(ui,{parent:this,child:e})}}},{key:"getGroups",value:function(){return this.children.filter(function(e){return e.constructor===i})}},{key:"getNodes",value:function(){return this.children.filter(function(e){return e.constructor===ze})}},{key:"collapseParent",get:function(){var e=null;if(this.group==null)return null;for(var t=this.group;t!=null;)t.collapsed&&(e=t),t=t.group;return e}}]),i}(ze),$i=function(){function a(o){var i=this;T(this,a),this.instance=o,u(this,"groupMap",{}),u(this,"_connectionSourceMap",{}),u(this,"_connectionTargetMap",{}),o.bind(jt,function(n){var e=i.getGroupFor(n.source),t=i.getGroupFor(n.target);e!=null&&t!=null&&e===t?(i._connectionSourceMap[n.connection.id]=e,i._connectionTargetMap[n.connection.id]=e,ye(e.connections.internal,n.connection)):(e!=null&&(n.target._jsPlumbGroup===e?ye(e.connections.internal,n.connection):ye(e.connections.source,n.connection),i._connectionSourceMap[n.connection.id]=e),t!=null&&(n.source._jsPlumbGroup===t?ye(t.connections.internal,n.connection):ye(t.connections.target,n.connection),i._connectionTargetMap[n.connection.id]=t))}),o.bind(nt,function(n){i._cleanupDetachedConnection(n.connection)}),o.bind(Xt,function(n){var e=n.originalEndpoint.element,t=i.getGroupFor(e),r=n.connection.endpoints[n.index],s=r.element,l=i.getGroupFor(s),c=n.index===0?i._connectionSourceMap:i._connectionTargetMap,h=n.index===0?i._connectionTargetMap:i._connectionSourceMap;l!=null?(c[n.connection.id]=l,n.connection.source===n.connection.target&&(h[n.connection.id]=l)):(delete c[n.connection.id],n.connection.source===n.connection.target&&delete h[n.connection.id]),t!=null&&i._updateConnectionsForGroup(t),l!=null&&i._updateConnectionsForGroup(l)})}return w(a,[{key:"_cleanupDetachedConnection",value:function(i){i.proxies.length=0;var n=this._connectionSourceMap[i.id],e;n!=null&&(e=function(r){return r.id===i.id},M(n.connections.source,e),M(n.connections.target,e),M(n.connections.internal,e),delete this._connectionSourceMap[i.id]),n=this._connectionTargetMap[i.id],n!=null&&(e=function(r){return r.id===i.id},M(n.connections.source,e),M(n.connections.target,e),M(n.connections.internal,e),delete this._connectionTargetMap[i.id])}},{key:"addGroup",value:function(i){var n=i.el;if(this.groupMap[i.id]!=null)throw new Error("cannot create Group ["+i.id+"]; a Group with that ID exists");if(n._isJsPlumbGroup!=null)throw new Error("cannot create Group ["+i.id+"]; the given element is already a Group");var e=new Qi(this.instance,i.el,i);return this.groupMap[e.id]=e,i.collapsed&&this.collapseGroup(e),this.instance.manage(e.el),this.instance.addClass(e.el,pe),e.manager=this,this._updateConnectionsForGroup(e),this.instance.fire(ti,{group:e}),e}},{key:"getGroup",value:function(i){var n=i;if(Y(i)&&(n=this.groupMap[i],n==null))throw new Error("No such group ["+i+"]");return n}},{key:"getGroupFor",value:function(i){for(var n=i,e=this.instance.getContainer(),t=!1,r=null;!t;)n==null||n===e?t=!0:n._jsPlumbParentGroup?(r=n._jsPlumbParentGroup,t=!0):n=n.parentNode;return r}},{key:"getGroups",value:function(){var i=[];for(var n in this.groupMap)i.push(this.groupMap[n]);return i}},{key:"removeGroup",value:function(i,n,e,t){var r=this,s=this.getGroup(i);this.expandGroup(s,!0);var l={};return G(s.children,function(c){var h=r.instance.getManagedElements()[r.instance.getId(c.el)];h&&delete h.group}),n?(G(s.getGroups(),function(c){return r.removeGroup(c,n,e)}),s.removeAll(e,t)):(s.group&&G(s.children,function(c){return s.group.add(c.el)}),l=s.orphanAll()),s.group&&s.group.removeGroup(s),this.instance.unmanage(s.el,!0),delete this.groupMap[s.id],this.instance.fire(oi,{group:s}),l}},{key:"removeAllGroups",value:function(i,n,e){for(var t in this.groupMap)this.removeGroup(this.groupMap[t],i,n,e)}},{key:"forEach",value:function(i){for(var n in this.groupMap)i(this.groupMap[n])}},{key:"orphan",value:function(i,n){var e=i;if(e._jsPlumbParentGroup){var t=e._jsPlumbParentGroup,r=this.instance.getId(e),s=this.instance.getOffset(i);return n!==!0&&t.group?this.instance._appendElementToGroup(t.group,i):this.instance._appendElementToContainer(i),this.instance.setPosition(i,s),delete e._jsPlumbParentGroup,{id:r,pos:s}}}},{key:"_updateConnectionsForGroup",value:function(i){var n=this;i.connections.source.length=0,i.connections.target.length=0,i.connections.internal.length=0;var e=i.children.slice().map(function(v){return v.el}),t=[];if(G(e,function(v){Array.prototype.push.apply(t,n.instance.getSelector(v,vi))}),Array.prototype.push.apply(e,t),e.length>0){var r=this.instance.getConnections({source:e,scope:he},!0),s=this.instance.getConnections({target:e,scope:he},!0),l={},c,h,f=function(y){for(var p=0;p<y.length;p++)l[y[p].id]||(l[y[p].id]=!0,c=n.getGroupFor(y[p].source),h=n.getGroupFor(y[p].target),y[p].source===i.el&&h===i||y[p].target===i.el&&c===i?i.connections.internal.push(y[p]):c===i?(h!==i?i.connections.source.push(y[p]):i.connections.internal.push(y[p]),n._connectionSourceMap[y[p].id]=i):h===i&&(i.connections.target.push(y[p]),n._connectionTargetMap[y[p].id]=i))};f(r),f(s)}}},{key:"_collapseConnection",value:function(i,n,e){var t=i.endpoints[n===0?1:0].element;if(t._jsPlumbParentGroup&&!t._jsPlumbParentGroup.proxied&&t._jsPlumbParentGroup.collapsed)return!1;var r=i.endpoints[0].element,s=r._jsPlumbParentGroup,l=s!=null?s.collapseParent||s:null,c=i.endpoints[1].element,h=c._jsPlumbParentGroup,f=h!=null?h.collapseParent||h:null;if(l==null||f==null||l.id!==f.id){var v=e.el;return this.instance.getId(v),this.instance.proxyConnection(i,n,v,function(y,p){return e.getEndpoint(y,p)},function(y,p){return e.getAnchor(y,p)}),!0}else return!1}},{key:"_expandConnection",value:function(i,n,e){this.instance.unproxyConnection(i,n)}},{key:"isElementDescendant",value:function(i,n){for(var e=this.instance.getContainer(),t=!1;!t;){if(i==null||i===e)return!1;if(i===n)return!0;i=i.parentNode}}},{key:"collapseGroup",value:function(i){var n=this,e=this.getGroup(i);if(!(e==null||e.collapsed)){var t=e.el;if(e.collapseParent==null){if(this.instance.setGroupVisible(e,!1),e.collapsed=!0,this.instance.removeClass(t,pe),this.instance.addClass(t,xe),e.proxied){var r=new Set,s=function(c,h){for(var f=0;f<c.length;f++){var v=c[f];n._collapseConnection(v,h,e)===!0&&r.add(v.id)}};s(e.connections.source,0),s(e.connections.target,1),G(e.getGroups(),function(l){n.cascadeCollapse(e,l,r)})}this.instance.revalidate(t),this.repaintGroup(e),this.instance.fire(ni,{group:e})}else e.collapsed=!0,this.instance.removeClass(t,pe),this.instance.addClass(t,xe)}}},{key:"cascadeCollapse",value:function(i,n,e){var t=this;if(i.proxied){var r=function(l,c){for(var h=0;h<l.length;h++){var f=l[h];e.has(f.id)||t._collapseConnection(f,c,i)===!0&&e.add(f.id)}};r(n.connections.source,0),r(n.connections.target,1)}G(n.getGroups(),function(s){t.cascadeCollapse(i,s,e)})}},{key:"expandGroup",value:function(i,n){var e=this,t=this.getGroup(i);if(t!=null){var r=t.el;if(t.collapseParent==null){if(this.instance.setGroupVisible(t,!0),t.collapsed=!1,this.instance.addClass(r,pe),this.instance.removeClass(r,xe),t.proxied){var s=function(h,f){for(var v=0;v<h.length;v++){var y=h[v];e._expandConnection(y,f,t)}};s(t.connections.source,0),s(t.connections.target,1);var l=function c(h,f){if(f||h.collapsed){var v=function(p,m){for(var g=0;g<p.length;g++){var _=p[g];e._collapseConnection(_,m,h.collapseParent||h)}};v(h.connections.source,0),v(h.connections.target,1),G(h.connections.internal,function(y){return y.setVisible(!1)}),G(h.getGroups(),function(y){return c(y,!0)})}else e.expandGroup(h,!0)};G(t.getGroups(),l)}this.instance.revalidate(r),this.repaintGroup(t),n||this.instance.fire(ii,{group:t})}else t.collapsed=!1,this.instance.addClass(r,pe),this.instance.removeClass(r,xe)}}},{key:"toggleGroup",value:function(i){i=this.getGroup(i),i!=null&&(i.collapsed?this.expandGroup(i):this.collapseGroup(i))}},{key:"repaintGroup",value:function(i){for(var n=this.getGroup(i),e=n.children,t=0;t<e.length;t++)this.instance.revalidate(e[t].el)}},{key:"addToGroup",value:function(i,n){var e=this,t=this.getGroup(i);if(t){for(var r=t.el,s=function(v){var y=v,p=y._isJsPlumbGroup!=null,m=y._jsPlumbGroup,g=y._jsPlumbParentGroup;if(g!==t){var _=e.instance.manage(v),E=e.instance.getOffset(v),C=t.collapsed?e.instance.getOffsetRelativeToRoot(r):e.instance.getOffset(e.instance.getGroupContentArea(t));_.group=t.elId,g!=null&&(g.remove(v,!1,n,!1,t),e._updateConnectionsForGroup(g)),p?t.addGroup(m):t.add(v,n);var A=function(k,O){var B=O===0?1:0;k.each(function(F){F.setVisible(!1),F.endpoints[B].element._jsPlumbGroup===t?(F.endpoints[B].setVisible(!1),e._expandConnection(F,B,t)):(F.endpoints[O].setVisible(!1),e._collapseConnection(F,O,t))})};t.collapsed&&(A(e.instance.select({source:v}),0),A(e.instance.select({target:v}),1)),e.instance.getId(v);var P={x:E.x-C.x,y:E.y-C.y};if(e.instance.setPosition(v,P),e._updateConnectionsForGroup(t),e.instance.revalidate(v),!n){var S={group:t,el:v,pos:P};g&&(S.sourceGroup=g),e.instance.fire(ri,S)}}},l=arguments.length,c=new Array(l>2?l-2:0),h=2;h<l;h++)c[h-2]=arguments[h];G(c,s)}}},{key:"removeFromGroup",value:function(i,n){var e=this,t=this.getGroup(i);if(t){for(var r=function(f){if(t.collapsed){var v=function(m,g){for(var _=0;_<m.length;_++){var E=m[_];if(E.proxies){for(var C=0;C<E.proxies.length;C++)if(E.proxies[C]!=null){var A=E.proxies[C].originalEp.element;(A===f||e.isElementDescendant(A,f))&&e._expandConnection(E,g,t)}}}};v(t.connections.source.slice(),0),v(t.connections.target.slice(),1)}t.remove(f,null,n);var y=e.instance.getManagedElements()[e.instance.getId(f)];y&&delete y.group},s=arguments.length,l=new Array(s>2?s-2:0),c=2;c<s;c++)l[c-2]=arguments[c];G(l,r)}}},{key:"getAncestors",value:function(i){for(var n=[],e=i.group;e!=null;)n.push(e),e=e.group;return n}},{key:"isAncestor",value:function(i,n){return i==null||n==null?!1:this.getAncestors(i).indexOf(n)!==-1}},{key:"getDescendants",value:function(i){var n=[],e=function t(r){var s=r.getGroups();n.push.apply(n,Ge(s)),G(s,t)};return e(i),n}},{key:"isDescendant",value:function(i,n){return i==null||n==null?!1:this.getDescendants(n).indexOf(i)!==-1}},{key:"reset",value:function(){this._connectionSourceMap={},this._connectionTargetMap={},this.groupMap={}}}]),a}(),nn=function(){function a(o,i){T(this,a),this.instance=o,this.entries=i}return w(a,[{key:"length",get:function(){return this.entries.length}},{key:"each",value:function(i){return G(this.entries,function(n){return i(n)}),this}},{key:"get",value:function(i){return this.entries[i]}},{key:"addClass",value:function(i,n){return this.each(function(e){return e.addClass(i,n)}),this}},{key:"removeClass",value:function(i,n){return this.each(function(e){return e.removeClass(i,n)}),this}},{key:"removeAllOverlays",value:function(){return this.each(function(i){return i.removeAllOverlays()}),this}},{key:"setLabel",value:function(i){return this.each(function(n){return n.setLabel(i)}),this}},{key:"clear",value:function(){return this.entries.length=0,this}},{key:"map",value:function(i){var n=[];return this.each(function(e){return n.push(i(e))}),n}},{key:"addOverlay",value:function(i){return this.each(function(n){return n.addOverlay(i)}),this}},{key:"removeOverlay",value:function(i){return this.each(function(n){return n.removeOverlay(i)}),this}},{key:"removeOverlays",value:function(){return this.each(function(i){return i.removeOverlays()}),this}},{key:"showOverlay",value:function(i){return this.each(function(n){return n.showOverlay(i)}),this}},{key:"hideOverlay",value:function(i){return this.each(function(n){return n.hideOverlay(i)}),this}},{key:"setPaintStyle",value:function(i){return this.each(function(n){return n.setPaintStyle(i)}),this}},{key:"setHoverPaintStyle",value:function(i){return this.each(function(n){return n.setHoverPaintStyle(i)}),this}},{key:"setSuspendEvents",value:function(i){return this.each(function(n){return n.setSuspendEvents(i)}),this}},{key:"setParameter",value:function(i,n){return this.each(function(e){return e.parameters[i]=n}),this}},{key:"setParameters",value:function(i){return this.each(function(n){return n.parameters=i}),this}},{key:"setVisible",value:function(i){return this.each(function(n){return n.setVisible(i)}),this}},{key:"addType",value:function(i){return this.each(function(n){return n.addType(i)}),this}},{key:"toggleType",value:function(i){return this.each(function(n){return n.toggleType(i)}),this}},{key:"removeType",value:function(i){return this.each(function(n){return n.removeType(i)}),this}},{key:"bind",value:function(i,n){return this.each(function(e){return e.bind(i,n)}),this}},{key:"unbind",value:function(i,n){return this.each(function(e){return e.unbind(i,n)}),this}},{key:"setHover",value:function(i){var n=this;return this.each(function(e){return n.instance.setHover(e,i)}),this}}]),a}(),er=function(a){D(i,a);var o=L(i);function i(){return T(this,i),o.apply(this,arguments)}return w(i,[{key:"setEnabled",value:function(e){return this.each(function(t){return t.enabled=e}),this}},{key:"setAnchor",value:function(e){return this.each(function(t){return t.setAnchor(e)}),this}},{key:"deleteEveryConnection",value:function(){return this.each(function(e){return e.deleteEveryConnection()}),this}},{key:"deleteAll",value:function(){var e=this;return this.each(function(t){return e.instance.deleteEndpoint(t)}),this.clear(),this}}]),i}(nn),tr=function(a){D(i,a);var o=L(i);function i(){return T(this,i),o.apply(this,arguments)}return w(i,[{key:"setDetachable",value:function(e){return this.each(function(t){return t.setDetachable(e)}),this}},{key:"setReattach",value:function(e){return this.each(function(t){return t.setReattach(e)}),this}},{key:"setConnector",value:function(e){return this.each(function(t){return t._setConnector(e)}),this}},{key:"deleteAll",value:function(){var e=this;this.each(function(t){return e.instance.deleteConnection(t)}),this.clear()}},{key:"repaint",value:function(){var e=this;return this.each(function(t){return e.instance._paintConnection(t)}),this}}]),i}(nn),nr=function a(){T(this,a),u(this,"affectedElements",new Set)};function wt(){return{x:0,y:0,w:0,h:0,r:0,c:{x:0,y:0},x2:0,y2:0,t:{x:0,y:0,c:{x:0,y:0},w:0,h:0,r:0,x2:0,y2:0,cr:0,sr:0},dirty:!0}}function ir(a,o,i,n,e){var t={x:a+i/2,y:o+n/2},r=Math.cos(e/360*Math.PI*2),s=Math.sin(e/360*Math.PI*2),l=function(C,A){return{x:t.x+Math.round((C-t.x)*r-(A-t.y)*s),y:t.y+Math.round((A-t.y)*r-(C-t.x)*s)}},c=l(a,o),h=l(a+i,o),f=l(a+i,o+n),v=l(a,o+n),y=l(a+i/2,o+n/2),p=Math.min(c.x,h.x,f.x,v.x),m=Math.max(c.x,h.x,f.x,v.x),g=Math.min(c.y,h.y,f.y,v.y),_=Math.max(c.y,h.y,f.y,v.y);return{x:p,y:g,w:m-p,h:_-g,c:y,r:e,x2:m,y2:_,cr:r,sr:s}}var Fe=function(o,i){var n=0;return i[1]>o[1]?n=-1:i[1]<o[1]&&(n=1),n},It=function(o,i){return Fe(o,i)*-1};function Te(a,o,i,n){mn([a,o],i,Fe,n)}function X(a,o){var i=Ie(o,function(n){return n[0]===a});i>-1&&o.splice(i,1)}var rr=function(a){D(i,a);var o=L(i);function i(n){var e;return T(this,i),e=o.call(this),e.instance=n,u(d(e),"_currentTransaction",null),u(d(e),"_sortedElements",{xmin:[],xmax:[],ymin:[],ymax:[]}),u(d(e),"_elementMap",new Map),u(d(e),"_transformedElementMap",new Map),u(d(e),"_bounds",{minx:0,maxx:0,miny:0,maxy:0}),e}return w(i,[{key:"_updateBounds",value:function(e,t,r){t!=null&&(X(e,this._sortedElements.xmin),X(e,this._sortedElements.xmax),X(e,this._sortedElements.ymin),X(e,this._sortedElements.ymax),Te(e,t.t.x,this._sortedElements.xmin,!1),Te(e,t.t.x+t.t.w,this._sortedElements.xmax,!0),Te(e,t.t.y,this._sortedElements.ymin,!1),Te(e,t.t.y+t.t.h,this._sortedElements.ymax,!0),r!==!0&&this._recalculateBounds())}},{key:"_recalculateBounds",value:function(){this._bounds.minx=this._sortedElements.xmin.length>0?this._sortedElements.xmin[0][1]:0,this._bounds.maxx=this._sortedElements.xmax.length>0?this._sortedElements.xmax[0][1]:0,this._bounds.miny=this._sortedElements.ymin.length>0?this._sortedElements.ymin[0][1]:0,this._bounds.maxy=this._sortedElements.ymax.length>0?this._sortedElements.ymax[0][1]:0}},{key:"recomputeBounds",value:function(){var e=this;this._sortedElements.xmin.length=0,this._sortedElements.xmax.length=0,this._sortedElements.ymin.length=0,this._sortedElements.ymax.length=0,this._elementMap.forEach(function(t,r){e._sortedElements.xmin.push([r,t.t.x]),e._sortedElements.xmax.push([r,t.t.x+t.t.w]),e._sortedElements.ymin.push([r,t.t.y]),e._sortedElements.ymax.push([r,t.t.y+t.t.h])}),this._sortedElements.xmin.sort(Fe),this._sortedElements.ymin.sort(Fe),this._sortedElements.xmax.sort(It),this._sortedElements.ymax.sort(It),this._recalculateBounds()}},{key:"_finaliseUpdate",value:function(e,t,r){t.t=ir(t.x,t.y,t.w,t.h,t.r),this._transformedElementMap.set(e,t.t),r!==!0&&this._updateBounds(e,t,r)}},{key:"shouldFireEvent",value:function(e,t,r){return!0}},{key:"startTransaction",value:function(){if(this._currentTransaction!=null)throw new Error("Viewport: cannot start transaction; a transaction is currently active.");this._currentTransaction=new nr}},{key:"endTransaction",value:function(){var e=this;this._currentTransaction!=null&&(this._currentTransaction.affectedElements.forEach(function(t){var r=e.getPosition(t);e._finaliseUpdate(t,r,!0)}),this.recomputeBounds(),this._currentTransaction=null)}},{key:"updateElements",value:function(e){var t=this;G(e,function(r){return t.updateElement(r.id,r.x,r.y,r.width,r.height,r.rotation)})}},{key:"updateElement",value:function(e,t,r,s,l,c,h){var f=at(this._elementMap,e,wt);return f.dirty=t==null&&f.x==null||r==null&&f.y==null||s==null&&f.w==null||l==null&&f.h==null,t!=null&&(f.x=t),r!=null&&(f.y=r),s!=null&&(f.w=s),l!=null&&(f.h=l),c!=null&&(f.r=c||0),f.c.x=f.x+f.w/2,f.c.y=f.y+f.h/2,f.x2=f.x+f.w,f.y2=f.y+f.h,this._currentTransaction==null?this._finaliseUpdate(e,f,h):this._currentTransaction.affectedElements.add(e),f}},{key:"refreshElement",value:function(e,t){var r=this.instance.getManagedElements(),s=r[e]?r[e].el:null;if(s!=null){var l=this.getSize(s),c=this.getOffset(s);return this.updateElement(e,c.x,c.y,l.w,l.h,null,t)}else return null}},{key:"getSize",value:function(e){return this.instance.getSize(e)}},{key:"getOffset",value:function(e){return this.instance.getOffset(e)}},{key:"registerElement",value:function(e,t){return this.updateElement(e,0,0,0,0,0,t)}},{key:"addElement",value:function(e,t,r,s,l,c){return this.updateElement(e,t,r,s,l,c)}},{key:"rotateElement",value:function(e,t){var r=at(this._elementMap,e,wt);return r.r=t||0,this._finaliseUpdate(e,r),r}},{key:"getBoundsWidth",value:function(){return this._bounds.maxx-this._bounds.minx}},{key:"getBoundsHeight",value:function(){return this._bounds.maxy-this._bounds.miny}},{key:"getX",value:function(){return this._bounds.minx}},{key:"getY",value:function(){return this._bounds.miny}},{key:"setSize",value:function(e,t,r){if(this._elementMap.has(e))return this.updateElement(e,null,null,t,r,null)}},{key:"setPosition",value:function(e,t,r){if(this._elementMap.has(e))return this.updateElement(e,t,r,null,null,null)}},{key:"reset",value:function(){this._sortedElements.xmin.length=0,this._sortedElements.xmax.length=0,this._sortedElements.ymin.length=0,this._sortedElements.ymax.length=0,this._elementMap.clear(),this._transformedElementMap.clear(),this._recalculateBounds()}},{key:"remove",value:function(e){X(e,this._sortedElements.xmin),X(e,this._sortedElements.xmax),X(e,this._sortedElements.ymin),X(e,this._sortedElements.ymax),this._elementMap.delete(e),this._transformedElementMap.delete(e),this._recalculateBounds()}},{key:"getPosition",value:function(e){return this._elementMap.get(e)}},{key:"getElements",value:function(){return this._elementMap}},{key:"isEmpty",value:function(){return this._elementMap.size===0}}]),i}(Ue),ue;function sr(a,o,i,n,e){for(var t=i?a.w:a.h,r=i?a.h:a.w,s=[],l=t/(o.length+1),c=0;c<o.length;c++){var h=(c+1)*l,f=n*r;e&&(h=t-h);var v=i?h:f,y=a.x+v,p=v/a.w,m=i?f:h,g=a.y+m,_=m/a.h;if(a.r!==0&&a.r!=null){var E=De({x:y,y:g},a.c,a.r);y=E.x,g=E.y}s.push({x:y,y:g,xLoc:p,yLoc:_,c:o[c].c})}return s}function Dt(a,o){return o.theta-a.theta}function Lt(a,o){var i=a.theta<0?-Math.PI-a.theta:Math.PI-a.theta,n=o.theta<0?-Math.PI-o.theta:Math.PI-o.theta;return i-n}var or=(ue={},u(ue,I,Lt),u(ue,R,Dt),u(ue,V,Dt),u(ue,N,Lt),ue);function z(a){return a.isContinuous===!0}function Gt(a){return a.isContinuous===!0}function ar(a){return a.locations.length>1}function Mt(a){return[a.currentLocation,a.locations[a.currentLocation]]}var lr=function(){function a(o){var i=this;T(this,a),this.instance=o,u(this,"anchorLists",new Map),u(this,"anchorLocations",new Map),o.bind(nt,function(n){n.sourceEndpoint._anchor.isContinuous&&i._removeEndpointFromAnchorLists(n.sourceEndpoint),n.targetEndpoint._anchor.isContinuous&&i._removeEndpointFromAnchorLists(n.targetEndpoint)}),o.bind(zt,function(n){i._removeEndpointFromAnchorLists(n)})}return w(a,[{key:"getAnchorOrientation",value:function(i){var n=this.anchorLocations.get(i.id);return n?[n.ox,n.oy]:[0,0]}},{key:"_distance",value:function(i,n,e,t,r,s,l){var c=t.x+i.x*r.w,h=t.y+i.y*r.h,f=t.x+r.w/2,v=t.y+r.h/2;if(s!=null&&s.length>0){var y=this.instance._applyRotations([c,h,0,0],s);c=y.x,h=y.y}return Math.sqrt(Math.pow(n-c,2)+Math.pow(e-h,2))+Math.sqrt(Math.pow(f-c,2)+Math.pow(v-h,2))}},{key:"_anchorSelector",value:function(i,n,e,t,r,s,l){for(var c=e.x+t.w/2,h=e.y+t.h/2,f=-1,v=1/0,y=0;y<l.length;y++){var p=this._distance(l[y],c,h,i,n,r,s);p<v&&(f=y+0,v=p)}return[f,l[f]]}},{key:"_floatingAnchorCompute",value:function(i,n){var e=n.xy,t={curX:e.x+i.size.w/2,curY:e.y+i.size.h/2,x:0,y:0,ox:0,oy:0};return this._setComputedPosition(i,t)}},{key:"_setComputedPosition",value:function(i,n,e){return this.anchorLocations.set(i.id,n),i.computedPosition=n,e&&(i.timestamp=e),n}},{key:"_computeSingleLocation",value:function(i,n,e,t){var r,s=t.rotation,l={curX:n.x+i.x*e.w+i.offx,curY:n.y+i.y*e.h+i.offy,x:i.x,y:i.y,ox:0,oy:0};if(s!=null&&s.length>0){var c=[i.iox,i.ioy],h={x:l.curX,y:l.curY,cr:0,sr:0};G(s,function(f){h=De(h,f.c,f.r);var v=[Math.round(c[0]*h.cr-c[1]*h.sr),Math.round(c[1]*h.cr+c[0]*h.sr)];c=v.slice()}),i.ox=c[0],i.oy=c[1],r={curX:h.x,curY:h.y,x:i.x,y:i.y,ox:c[0],oy:c[1]}}else i.ox=i.iox,i.oy=i.ioy,r=b({ox:i.iox,oy:i.ioy},l);return r}},{key:"_singleAnchorCompute",value:function(i,n){var e=n.xy,t=n.wh,r=n.timestamp,s=this.anchorLocations.get(i.id);if(s!=null&&r&&r===i.timestamp)return s;var l=Mt(i),c=We(l,2);c[0];var h=c[1];return s=this._computeSingleLocation(h,e,t,n),this._setComputedPosition(i,s,r)}},{key:"_defaultAnchorCompute",value:function(i,n){var e;if(i.locations.length===1)return this._singleAnchorCompute(i,n);var t=n.xy,r=n.wh,s=n.txy,l=n.twh,c=Mt(i),h=We(c,2),f=h[0],v=h[1];if(i.locked||s==null||l==null)e=this._computeSingleLocation(v,t,r,n);else{var y=this._anchorSelector(t,r,s,l,n.rotation,n.tRotation,i.locations),p=We(y,2),m=p[0],g=p[1];i.currentLocation=m,m!==f&&(i.cssClass=g.cls||i.cssClass,n.element._anchorLocationChanged(i)),e=this._computeSingleLocation(g,t,r,n)}return this._setComputedPosition(i,e,n.timestamp)}},{key:"_placeAnchors",value:function(i,n){var e=this,t=this.instance.viewport.getPosition(i),r=function(l,c,h,f,v,y){if(h.length>0)for(var p=h.sort(or[l]),m=l===R||l===I,g=sr(t,p,f,v,m),_=0;_<g.length;_++){var E=g[_].c,C=E.endpoints[0].elementId===i,A=C?E.endpoints[0]:E.endpoints[1];e._setComputedPosition(A._anchor,{curX:g[_].x,curY:g[_].y,x:g[_].xLoc,y:g[_].yLoc,ox:y[0],oy:y[1]})}};r(V,t,n.bottom,!0,1,[0,1]),r(I,t,n.top,!0,0,[0,-1]),r(N,t,n.left,!1,0,[-1,0]),r(R,t,n.right,!1,1,[1,0])}},{key:"_updateAnchorList",value:function(i,n,e,t,r,s,l,c,h,f,v){var y=t.endpoints[l],p=y.id,m=[1,0][l],g={theta:n,order:e,c:t,b:r,elId:s,epId:p},_=i[h],E=y._continuousAnchorEdge?i[y._continuousAnchorEdge]:null,C;if(E){var A=Ie(E,function(k){return k.epId===p});if(A!==-1){E.splice(A,1);for(var P=0;P<E.length;P++)C=E[P].c,C.placeholder!==!0&&f.add(C),v.add(E[P].c.endpoints[l]),v.add(E[P].c.endpoints[m])}}for(var S=0;S<_.length;S++)C=_[S].c,C.placeholder!==!0&&f.add(C),v.add(_[S].c.endpoints[l]),v.add(_[S].c.endpoints[m]);{var x=c?0:_.length;_.splice(x,0,g)}y._continuousAnchorEdge=h}},{key:"_removeEndpointFromAnchorLists",value:function(i){var n=this.anchorLists.get(i.elementId),e=0;(function(t,r){if(t){var s=function(c){return c.epId===r};M(t.top,s),M(t.left,s),M(t.bottom,s),M(t.right,s),e+=t.top.length,e+=t.left.length,e+=t.bottom.length,e+=t.right.length}})(n,i.id),e===0&&this.anchorLists.delete(i.elementId),this.anchorLocations.delete(i._anchor.id)}},{key:"computeAnchorLocation",value:function(i,n){var e;return z(i)?e=this.anchorLocations.get(i.id)||{curX:0,curY:0,x:0,y:0,ox:0,oy:0}:Gt(i)?e=this._floatingAnchorCompute(i,n):e=this._defaultAnchorCompute(i,n),i.timestamp=n.timestamp,e}},{key:"computePath",value:function(i,n){var e=this.instance.viewport.getPosition(i.sourceId),t=this.instance.viewport.getPosition(i.targetId),r=i.endpoints[0],s=i.endpoints[1],l=this.getEndpointLocation(r,{xy:e,wh:e,element:r,timestamp:n,rotation:this.instance._getRotations(i.sourceId)}),c=this.getEndpointLocation(s,{xy:t,wh:t,element:s,timestamp:n,rotation:this.instance._getRotations(i.targetId)});i.connector.resetBounds(),i.connector.compute({sourcePos:l,targetPos:c,sourceEndpoint:i.endpoints[0],targetEndpoint:i.endpoints[1],strokeWidth:i.paintStyleInUse.strokeWidth,sourceInfo:e,targetInfo:t})}},{key:"getEndpointLocation",value:function(i,n){n=n||{};var e=i._anchor,t=this.anchorLocations.get(e.id);return(t==null||n.timestamp!=null&&e.timestamp!==n.timestamp)&&(t=this.computeAnchorLocation(e,n),this._setComputedPosition(e,t,n.timestamp)),t}},{key:"getEndpointOrientation",value:function(i){return i._anchor?this.getAnchorOrientation(i._anchor):[0,0]}},{key:"setAnchorOrientation",value:function(i,n){var e=this.anchorLocations.get(i.id);e!=null&&(e.ox=n[0],e.oy=n[1])}},{key:"isDynamicAnchor",value:function(i){return i._anchor?!z(i._anchor)&&i._anchor.locations.length>1:!1}},{key:"isFloating",value:function(i){return i._anchor?Gt(i._anchor):!1}},{key:"prepareAnchor",value:function(i){return _e(i)}},{key:"redraw",value:function(i,n,e){var t=this,r=new Set,s=new Set,l=new Set;if(!this.instance._suspendDrawing){var c=this.instance.endpointsByElement[i]||[];n=n||W();for(var h={},f,v,y=0;y<c.length;y++)if(v=c[y],s.add(v),f=v._anchor,v.connections.length===0)z(f)&&(this.anchorLists.has(i)||this.anchorLists.set(i,{top:[],right:[],bottom:[],left:[]}),this._updateAnchorList(this.anchorLists.get(i),-Math.PI/2,0,{endpoints:[v,v],placeholder:!0},!1,i,0,!1,Gi(f),r,s),l.add(i));else for(var p=0;p<v.connections.length;p++){var m=v.connections[p],g=m.sourceId,_=m.targetId,E=z(m.endpoints[0]._anchor),C=z(m.endpoints[1]._anchor);if(E||C){var A=(m.endpoints[0]._anchor.faces||[]).join("-"),P=(m.endpoints[1]._anchor.faces||[]).join("-"),S=[g,A,_,P].join("-"),x=h[S],k=m.sourceId===i?1:0;E&&!this.anchorLists.has(g)&&this.anchorLists.set(g,{top:[],right:[],bottom:[],left:[]}),C&&!this.anchorLists.has(_)&&this.anchorLists.set(_,{top:[],right:[],bottom:[],left:[]});var O=this.instance.viewport.getPosition(_),B=this.instance.viewport.getPosition(g);if(_===g&&(E||C))this._updateAnchorList(this.anchorLists.get(g),-Math.PI/2,0,m,!1,_,0,!1,I,r,s),this._updateAnchorList(this.anchorLists.get(_),-Math.PI/2,0,m,!1,g,1,!1,I,r,s);else{var F=this.instance._getRotations(g),Ce=this.instance._getRotations(_);x||(x=this._calculateOrientation(g,_,B,O,m.endpoints[0]._anchor,m.endpoints[1]._anchor,F,Ce),h[S]=x),E&&this._updateAnchorList(this.anchorLists.get(g),x.theta,0,m,!1,_,0,!1,x.a[0],r,s),C&&this._updateAnchorList(this.anchorLists.get(_),x.theta2,-1,m,!0,g,1,!0,x.a[1],r,s)}E&&l.add(g),C&&l.add(_),r.add(m),(E&&k===0||C&&k===1)&&s.add(m.endpoints[k])}else{var j=v.connections[p].endpoints[m.sourceId===i?1:0],rn=j._anchor;if(ar(rn)){this.instance._paintEndpoint(j,{elementWithPrecedence:i,timestamp:n}),r.add(v.connections[p]);for(var ke=0;ke<j.connections.length;ke++)j.connections[ke]!==v.connections[p]&&r.add(j.connections[ke])}else r.add(v.connections[p])}}l.forEach(function(Z){t._placeAnchors(Z,t.anchorLists.get(Z))}),s.forEach(function(Z){var sn=t.instance.viewport.getPosition(Z.elementId);t.instance._paintEndpoint(Z,{timestamp:n,offset:sn})}),r.forEach(function(Z){t.instance._paintConnection(Z,{timestamp:n})})}return{c:r,e:s}}},{key:"reset",value:function(){this.anchorLocations.clear(),this.anchorLists.clear()}},{key:"setAnchor",value:function(i,n){n!=null&&(i._anchor=n)}},{key:"setConnectionAnchors",value:function(i,n){i.endpoints[0]._anchor=n[0],i.endpoints[1]._anchor=n[1]}},{key:"_calculateOrientation",value:function(i,n,e,t,r,s,l,c){var h=this,f={HORIZONTAL:"horizontal",VERTICAL:"vertical",DIAGONAL:"diagonal",IDENTITY:"identity"};if(i===n)return{orientation:f.IDENTITY,a:[I,I]};var v=Math.atan2(t.c.y-e.c.y,t.c.x-e.c.x),y=Math.atan2(e.c.y-t.c.y,e.c.x-t.c.x),p=[],m={};(function(S,x){for(var k=0;k<S.length;k++){var O;if(m[S[k]]=(O={},u(O,N,{x:x[k][0].x,y:x[k][0].c.y}),u(O,R,{x:x[k][0].x+x[k][0].w,y:x[k][0].c.y}),u(O,I,{x:x[k][0].c.x,y:x[k][0].y}),u(O,V,{x:x[k][0].c.x,y:x[k][0].y+x[k][0].h}),O),x[k][1]!=null&&x[k][1].length>0)for(var B in m[S[k]])m[S[k]][B]=h.instance._applyRotationsXY(m[S[k]][B],x[k][1])}})([Dn,Ln],[[e,l],[t,c]]);for(var g=[I,N,R,V],_=0;_<g.length;_++)for(var E=0;E<g.length;E++)p.push({source:g[_],target:g[E],dist:Ke(m.source[g[_]],m.target[g[E]])});p.sort(function(S,x){if(S.dist<x.dist)return-1;if(x.dist<S.dist)return 1;var k,O=(k={},u(k,N,0),u(k,I,1),u(k,R,2),u(k,V,3),k),B=O[S.source],F=O[x.source],Ce=O[S.target],j=O[x.target];return B<F?-1:F<B?1:Ce<j?-1:j<Ce?1:0});for(var C=p[0].source,A=p[0].target,P=0;P<p.length&&(z(r)&&r.locked?C=r.currentFace:!r.isContinuous||kt(r,p[P].source)?C=p[P].source:C=null,s.isContinuous&&s.locked?A=s.currentFace:!s.isContinuous||kt(s,p[P].target)?A=p[P].target:A=null,!(C!=null&&A!=null));P++);return r.isContinuous&&this.setCurrentFace(r,C),s.isContinuous&&this.setCurrentFace(s,A),{a:[C,A],theta:v,theta2:y}}},{key:"setCurrentFace",value:function(i,n,e){i.currentFace=n,e&&i.lockedFace!=null&&(i.lockedFace=i.currentFace)}},{key:"lock",value:function(i){i.locked=!0,z(i)&&(i.lockedFace=i.currentFace)}},{key:"unlock",value:function(i){i.locked=!1,z(i)&&(i.lockedFace=null)}},{key:"selectAnchorLocation",value:function(i,n){var e=Ie(i.locations,function(t){return t.x===n.x&&t.y===n.y});return e!==-1?(i.currentLocation=e,!0):!1}},{key:"lockCurrentAxis",value:function(i){i.currentFace!=null&&(i.lockedAxis=i.currentFace===N||i.currentFace===R?Ii:Di)}},{key:"unlockCurrentAxis",value:function(i){i.lockedAxis=null}},{key:"anchorsEqual",value:function(i,n){if(!i||!n)return!1;var e=i.locations[i.currentLocation],t=n.locations[n.currentLocation];return e.x===t.x&&e.y===t.y&&e.offx===t.offx&&e.offy===t.offy&&e.ox===t.ox&&e.oy===t.oy}}]),a}(),Rt=function(){function a(o,i){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;T(this,a),this.selector=o,this.def=i,this.exclude=n,u(this,"id",void 0),u(this,"redrop",void 0),this.id=W(),this.redrop=i.def.redrop||ur}return w(a,[{key:"setEnabled",value:function(i){this.def.enabled=i}},{key:"isEnabled",value:function(){return this.def.enabled!==!1}}]),a}(),ur="strict",Ir="any",Dr="anySource",Lr="anyTarget",Gr="anySourceOrTarget";function cr(a,o){for(var i=a.scope.split(/\s/),n=o.scope.split(/\s/),e=0;e<i.length;e++)for(var t=0;t<n.length;t++)if(n[t]===i[e])return!0;return!1}function ee(a,o,i){var n=[],e=function(s){return Y(s)?s:a.getId(s)};if(o)if(typeof o=="string"){if(o==="*")return o;n.push(o)}else if(i)n=o;else if(o.length!=null){var t;(t=n).push.apply(t,Ge(Ge(o).map(e)))}else n.push(e(o));return n}function hr(a,o){a!=null&&a.endpoints.push(o)}function dr(a,o){a!=null&&M(a.endpoints,function(i){return i===o})}function Pe(a,o,i){o!=null&&(o.connections.push(a),o.connections.length===1&&a.instance.addClass(a.source,a.instance.connectedClass)),i!=null&&(o==null||a.sourceId!==a.targetId)&&(i.connections.push(a),i.connections.length===1&&a.instance.addClass(a.target,a.instance.connectedClass))}function Oe(a,o,i){if(o!=null){var n=o.connections.length;M(o.connections,function(t){return a.id===t.id}),n>0&&o.connections.length===0&&a.instance.removeClass(a.source,a.instance.connectedClass)}if(i!=null){var e=i.connections.length;(o==null||a.sourceId!==a.targetId)&&M(i.connections,function(t){return a.id===t.id}),e>0&&i.connections.length===0&&a.instance.removeClass(a.target,a.instance.connectedClass)}}var Mr=function(a){D(i,a);var o=L(i);function i(n,e){var t;return T(this,i),t=o.call(this),t._instanceIndex=n,u(d(t),"defaults",void 0),u(d(t),"_initialDefaults",{}),u(d(t),"isConnectionBeingDragged",!1),u(d(t),"currentlyDragging",!1),u(d(t),"hoverSuspended",!1),u(d(t),"_suspendDrawing",!1),u(d(t),"_suspendedAt",null),u(d(t),"connectorClass",Nn),u(d(t),"connectorOutlineClass",Bn),u(d(t),"connectedClass",Un),u(d(t),"endpointClass",Vn),u(d(t),"endpointConnectedClass",Hn),u(d(t),"endpointFullClass",Wn),u(d(t),"endpointFloatingClass",Yn),u(d(t),"endpointDropAllowedClass",jn),u(d(t),"endpointDropForbiddenClass",Xn),u(d(t),"endpointAnchorClassPrefix",zn),u(d(t),"overlayClass",Kn),u(d(t),"connections",[]),u(d(t),"endpointsByElement",{}),u(d(t),"endpointsByUUID",new Map),u(d(t),"sourceSelectors",[]),u(d(t),"targetSelectors",[]),u(d(t),"allowNestedGroups",void 0),u(d(t),"_curIdStamp",1),u(d(t),"viewport",new rr(d(t))),u(d(t),"router",void 0),u(d(t),"groupManager",void 0),u(d(t),"_connectionTypes",new Map),u(d(t),"_endpointTypes",new Map),u(d(t),"_container",void 0),u(d(t),"_managedElements",{}),u(d(t),"DEFAULT_SCOPE",void 0),u(d(t),"_zoom",1),t.defaults={anchor:Ve.Bottom,anchors:[null,null],connectionsDetachable:!0,connectionOverlays:[],connector:Me.type,container:null,endpoint:Ee.type,endpointOverlays:[],endpoints:[null,null],endpointStyle:{fill:"#456"},endpointStyles:[null,null],endpointHoverStyle:null,endpointHoverStyles:[null,null],hoverPaintStyle:null,listStyle:{},maxConnections:1,paintStyle:{strokeWidth:2,stroke:"#456"},reattachConnections:!1,scope:"jsplumb_defaultscope",allowNestedGroups:!0},e&&b(t.defaults,e),b(t._initialDefaults,t.defaults),t._initialDefaults[re]!=null&&(t._initialDefaults[re].strokeWidth=t._initialDefaults[re].strokeWidth||2),t.DEFAULT_SCOPE=t.defaults[Ci],t.allowNestedGroups=t._initialDefaults[Ei]!==!1,t.router=new lr(d(t)),t.groupManager=new $i(d(t)),t.setContainer(t._initialDefaults.container),t}return w(i,[{key:"defaultScope",get:function(){return this.DEFAULT_SCOPE}},{key:"currentZoom",get:function(){return this._zoom}},{key:"areDefaultAnchorsSet",value:function(){return this.validAnchorsSpec(this.defaults.anchors)}},{key:"validAnchorsSpec",value:function(e){return e!=null&&e[0]!=null&&e[1]!=null}},{key:"getContainer",value:function(){return this._container}},{key:"setZoom",value:function(e,t){return this._zoom=e,this.fire(hi,this._zoom),t&&this.repaintEverything(),!0}},{key:"_idstamp",value:function(){return""+this._curIdStamp++}},{key:"checkCondition",value:function(e,t){var r=this.getListener(e),s=!0;if(r&&r.length>0){var l=Array.prototype.slice.call(arguments,1);try{for(var c=0,h=r.length;c<h;c++)s=s&&r[c].apply(r[c],l)}catch(f){q("cannot check condition ["+e+"]"+f)}}return s}},{key:"getId",value:function(e,t){if(e==null)return null;var r=this.getAttribute(e,ce);return(!r||r==="undefined")&&(arguments.length===2&&arguments[1]!==void 0?r=t:(arguments.length===1||arguments.length===3&&!arguments[2])&&(r="jsplumb-"+this._instanceIndex+"-"+this._idstamp()),this.setAttribute(e,ce,r)),r}},{key:"getConnections",value:function(e,t){e?e.constructor===String&&(e={scope:e}):e={};for(var r=e.scope||this.defaultScope,s=ee(this,r,!0),l=ee(this,e.source),c=ee(this,e.target),h=!t&&s.length>1?{}:[],f=function(E,C){if(!t&&s.length>1){var A=h[E];A==null&&(A=h[E]=[]),A.push(C)}else h.push(C)},v=0,y=this.connections.length;v<y;v++){var p=this.connections[v],m=p.proxies&&p.proxies[0]?p.proxies[0].originalEp.elementId:p.sourceId,g=p.proxies&&p.proxies[1]?p.proxies[1].originalEp.elementId:p.targetId;Q(s,p.scope)&&Q(l,m)&&Q(c,g)&&f(p.scope,p)}return h}},{key:"select",value:function(e){return e=e||{},e.scope=e.scope||"*",new tr(this,e.connections||this.getConnections(e,!0))}},{key:"selectEndpoints",value:function(e){e=e||{},e.scope=e.scope||he;var t=!e.element&&!e.source&&!e.target,r=t?he:ee(this,e.element),s=t?he:ee(this,e.source),l=t?he:ee(this,e.target),c=ee(this,e.scope,!0),h=[];for(var f in this.endpointsByElement){var v=Q(r,f,!0),y=Q(s,f,!0),p=s!=="*",m=Q(l,f,!0),g=l!=="*";if(v||y||m)e:for(var _=0,E=this.endpointsByElement[f].length;_<E;_++){var C=this.endpointsByElement[f][_];if(Q(c,C.scope,!0)){var A=p&&s.length>0&&!C.isSource,P=g&&l.length>0&&!C.isTarget;if(A||P)continue e;h.push(C)}}}return new er(this,h)}},{key:"setContainer",value:function(e){this._container=e,this.fire(Qn,this._container)}},{key:"_set",value:function(e,t,r){var s=[{el:"source",elId:"sourceId"},{el:"target",elId:"targetId"}],l,c=s[r],h=e[c.elId],f,v=e.endpoints[r],y={index:r,originalEndpoint:v,originalSourceId:r===0?h:e.sourceId,newSourceId:e.sourceId,originalTargetId:r===1?h:e.targetId,newTargetId:e.targetId,connection:e,newEndpoint:v};return t instanceof Se?(l=t,l.addConnection(e)):(f=this.getId(t),f===e[c.elId]?l=null:l=e.makeEndpoint(r===0,t,f)),l!=null&&(y.newEndpoint=l,v.detachFromConnection(e),e.endpoints[r]=l,e[c.el]=l.element,e[c.elId]=l.elementId,y[r===0?"newSourceId":"newTargetId"]=l.elementId,this.fireMoveEvent(y),this._paintConnection(e)),y}},{key:"setSource",value:function(e,t){Oe(e,this._managedElements[e.sourceId]);var r=this._set(e,t,0);Pe(e,this._managedElements[r.newSourceId])}},{key:"setTarget",value:function(e,t){Oe(e,this._managedElements[e.targetId]);var r=this._set(e,t,1);Pe(e,this._managedElements[r.newTargetId])}},{key:"setConnectionType",value:function(e,t,r){e.setType(t,r),this._paintConnection(e)}},{key:"isHoverSuspended",value:function(){return this.hoverSuspended}},{key:"setSuspendDrawing",value:function(e,t){var r=this._suspendDrawing;return this._suspendDrawing=e,e?this._suspendedAt=""+new Date().getTime():(this._suspendedAt=null,this.viewport.recomputeBounds()),t&&this.repaintEverything(),r}},{key:"getSuspendedAt",value:function(){return this._suspendedAt}},{key:"batch",value:function(e,t){var r=this._suspendDrawing===!0;r||this.setSuspendDrawing(!0),e(),r||this.setSuspendDrawing(!1,!t)}},{key:"each",value:function(e,t){if(e!=null){if(e.length!=null)for(var r=0;r<e.length;r++)t(e[r]);else t(e);return this}}},{key:"updateOffset",value:function(e){var t=e.elId;return e.recalc?this.viewport.refreshElement(t):this.viewport.getPosition(t)}},{key:"deleteConnection",value:function(e,t){if(e!=null&&e.deleted!==!0&&(t=t||{},t.force||hn(!0,!1,[[e.endpoints[0],Ye,[e]],[e.endpoints[1],Ye,[e]],[e,Ye,[e]],[this,Fn,[fi,e]]]))){Oe(e,this._managedElements[e.sourceId],this._managedElements[e.targetId]),this.fireDetachEvent(e,!e.pending&&t.fireEvent!==!1,t.originalEvent);var r=e.endpoints[0],s=e.endpoints[1];return r!==t.endpointToIgnore&&r.detachFromConnection(e,null,!0),s!==t.endpointToIgnore&&s.detachFromConnection(e,null,!0),M(this.connections,function(l){return e.id===l.id}),e.destroy(),r!==t.endpointToIgnore&&r.deleteOnEmpty&&r.connections.length===0&&this.deleteEndpoint(r),s!==t.endpointToIgnore&&s.deleteOnEmpty&&s.connections.length===0&&this.deleteEndpoint(s),!0}return!1}},{key:"deleteEveryConnection",value:function(e){var t=this;e=e||{};var r=this.connections.length,s=0;return this.batch(function(){for(var l=0;l<r;l++)s+=t.deleteConnection(t.connections[0],e)?1:0}),s}},{key:"deleteConnectionsForElement",value:function(e,t){var r=this.getId(e),s=this._managedElements[r];if(s)for(var l=s.connections.length,c=0;c<l;c++)this.deleteConnection(s.connections[0],t);return this}},{key:"fireDetachEvent",value:function(e,t,r){var s=e.id!=null,l=s?{connection:e,source:e.source,target:e.target,sourceId:e.sourceId,targetId:e.targetId,sourceEndpoint:e.endpoints[0],targetEndpoint:e.endpoints[1]}:e;t&&this.fire(Zn,l,r),this.fire(nt,l,r)}},{key:"fireMoveEvent",value:function(e,t){this.fire(Xt,e,t)}},{key:"manageAll",value:function(e,t){for(var r=Y(e)?this.getSelector(this.getContainer(),e):e,s=0;s<r.length;s++)this.manage(r[s],null,t)}},{key:"manage",value:function(e,t,r){this.getAttribute(e,ce)==null&&(t=t||this.getAttribute(e,"id")||W(),this.setAttribute(e,ce,t));var s=this.getId(e);if(this._managedElements[s])r&&(this._managedElements[s].viewportElement=this.updateOffset({elId:s,timestamp:null,recalc:!0}));else{var l={el:e,endpoints:[],connections:[],rotation:0,data:{}};this._managedElements[s]=l,this._suspendDrawing?l.viewportElement=this.viewport.registerElement(s,!0):l.viewportElement=this.updateOffset({elId:s,recalc:!0}),this.fire(ei,{el:e})}return this._managedElements[s]}},{key:"getManagedData",value:function(e,t,r){if(this._managedElements[e]){var s=this._managedElements[e].data[t];return s!=null?s[r]:null}}},{key:"setManagedData",value:function(e,t,r,s){this._managedElements[e]&&(this._managedElements[e].data[t]=this._managedElements[e].data[t]||{},this._managedElements[e].data[t][r]=s)}},{key:"getManagedElement",value:function(e){return this._managedElements[e]?this._managedElements[e].el:null}},{key:"unmanage",value:function(e,t){var r=this;this.removeAllEndpoints(e,!0);var s=function(c){var h=r.getId(c);r.removeAttribute(c,ce),delete r._managedElements[h],r.viewport.remove(h),r.fire(ci,{el:c,id:h}),c&&t&&r._removeElement(c)};this._getAssociatedElements(e).map(s),s(e)}},{key:"rotate",value:function(e,t,r){var s=this.getId(e);return this._managedElements[s]&&(this._managedElements[s].rotation=t,this.viewport.rotateElement(s,t),r!==!0)?this.revalidate(e):{c:new Set,e:new Set}}},{key:"_getRotation",value:function(e){var t=this._managedElements[e];return t!=null&&t.rotation||0}},{key:"_getRotations",value:function(e){var t=this,r=[],s=this._managedElements[e],l=function c(h){if(h.group!=null){var f=t._managedElements[h.group];f!=null&&(r.push({r:f.viewportElement.r,c:f.viewportElement.c}),c(f))}};return s!=null&&(r.push({r:s.viewportElement.r||0,c:s.viewportElement.c}),l(s)),r}},{key:"_applyRotations",value:function(e,t){var r=e.slice(),s={x:r[0],y:r[1],cr:0,sr:0};return G(t,function(l){s=De(s,l.c,l.r)}),s}},{key:"_applyRotationsXY",value:function(e,t){return G(t,function(r){e=De(e,r.c,r.r)}),e}},{key:"_internal_newEndpoint",value:function(e){var t=b({},e),r=this.manage(t.element);t.elementId=this.getId(t.element),t.id="ep_"+this._idstamp();var s=new Se(this,t);return hr(r,s),e.uuid&&this.endpointsByUUID.set(e.uuid,s),dn(this.endpointsByElement,s.elementId,s),this._suspendDrawing||this._paintEndpoint(s,{timestamp:this._suspendedAt}),s}},{key:"_deriveEndpointAndAnchorSpec",value:function(e,t){for(var r=((t?"":"default ")+e).split(/[\s]/),s=null,l=null,c=null,h=null,f=0;f<r.length;f++){var v=this.getConnectionType(r[f]);v&&(v.endpoints&&(s=v.endpoints),v.endpoint&&(l=v.endpoint),v.anchors&&(h=v.anchors),v.anchor&&(c=v.anchor))}return{endpoints:s||[l,l],anchors:h||[c,c]}}},{key:"revalidate",value:function(e,t){var r=this.getId(e);return this.updateOffset({elId:r,recalc:!0,timestamp:t}),this.repaint(e)}},{key:"repaintEverything",value:function(){var e=W(),t;for(t in this._managedElements)this.viewport.refreshElement(t,!0);this.viewport.recomputeBounds();for(t in this._managedElements)this.repaint(this._managedElements[t].el,e,!0);return this}},{key:"setElementPosition",value:function(e,t,r){var s=this.getId(e);return this.viewport.setPosition(s,t,r),this.repaint(e)}},{key:"repaint",value:function(e,t,r){var s={c:new Set,e:new Set},l=function(p){p.c.forEach(function(m){return s.c.add(m)}),p.e.forEach(function(m){return s.e.add(m)})};if(!this._suspendDrawing){var c=this.getId(e);if(e!=null){var h=this._getAssociatedElements(e);if(t==null&&(t=W()),!r)for(var f=0;f<h.length;f++)this.updateOffset({elId:this.getId(h[f]),recalc:!0,timestamp:t});if(l(this.router.redraw(c,t,null)),h.length>0)for(var v=0;v<h.length;v++)l(this.router.redraw(this.getId(h[v]),t,null))}}return s}},{key:"unregisterEndpoint",value:function(e){var t=e.getUuid();t&&this.endpointsByUUID.delete(t),dr(this._managedElements[e.elementId],e);var r=this.endpointsByElement[e.elementId];r!=null&&(r.length>1?this.endpointsByElement[e.elementId]=r.filter(function(s){return s!==e}):delete this.endpointsByElement[e.elementId]),this.fire(zt,e)}},{key:"_maybePruneEndpoint",value:function(e){return e.deleteOnEmpty&&e.connections.length===0?(this.deleteEndpoint(e),!0):!1}},{key:"deleteEndpoint",value:function(e){var t=this,r=typeof e=="string"?this.endpointsByUUID.get(e):e;if(r){var s=r.proxiedBy,l=r.connections.slice();G(l,function(c){r.detachFromConnection(c,null,!0)}),this.unregisterEndpoint(r),r.destroy(),G(l,function(c){t.deleteConnection(c,{force:!0,endpointToIgnore:r})}),s!=null&&this.deleteEndpoint(s)}return this}},{key:"addEndpoint",value:function(e,t,r){r=r||{};var s=b({},r);b(s,t||{});var l=b({element:e},s);return this._internal_newEndpoint(l)}},{key:"addEndpoints",value:function(e,t,r){for(var s=[],l=0,c=t.length;l<c;l++)s.push(this.addEndpoint(e,t[l],r));return s}},{key:"reset",value:function(){var e=this;this.silently(function(){e.endpointsByElement={},e._managedElements={},e.endpointsByUUID.clear(),e.viewport.reset(),e.router.reset(),e.groupManager.reset(),e.connections.length=0})}},{key:"destroy",value:function(){this.reset(),this.unbind(),this.sourceSelectors.length=0,this.targetSelectors.length=0,this._connectionTypes.clear(),this._endpointTypes.clear()}},{key:"getEndpoints",value:function(e){return this.endpointsByElement[this.getId(e)]||[]}},{key:"getEndpoint",value:function(e){return this.endpointsByUUID.get(e)}},{key:"setEndpointUuid",value:function(e,t){e.uuid&&this.endpointsByUUID.delete(e.uuid),e.uuid=t,this.endpointsByUUID.set(t,e)}},{key:"connect",value:function(e,t){try{var r=this._prepareConnectionParams(e,t),s=this._newConnection(r);return this._finaliseConnection(s,r),s}catch(l){q(l);return}}},{key:"_prepareConnectionParams",value:function(e,t){var r=b({},e);t&&b(r,t);var s=r;if(s.source&&s.source.endpoint&&(s.sourceEndpoint=s.source),s.target&&s.target.endpoint&&(s.targetEndpoint=s.target),e.uuids&&(s.sourceEndpoint=this.getEndpoint(e.uuids[0]),s.targetEndpoint=this.getEndpoint(e.uuids[1])),s.sourceEndpoint!=null){if(s.sourceEndpoint.isFull())throw yi;if(s.type||(s.type=s.sourceEndpoint.edgeType),s.sourceEndpoint.connectorOverlays){s.overlays=s.overlays||[];for(var l=0,c=s.sourceEndpoint.connectorOverlays.length;l<c;l++)s.overlays.push(s.sourceEndpoint.connectorOverlays[l])}s.sourceEndpoint.scope&&(s.scope=s.sourceEndpoint.scope)}else if(s.source==null)throw gi;if(s.targetEndpoint!=null){if(s.targetEndpoint.isFull())throw pi}else if(s.target==null)throw mi;if(s.sourceEndpoint&&s.targetEndpoint&&!cr(s.sourceEndpoint,s.targetEndpoint))throw"Cannot establish connection: scopes do not match";return s}},{key:"_newConnection",value:function(e){e.id="con_"+this._idstamp();var t=new tn(this,e);return Pe(t,this._managedElements[t.sourceId],this._managedElements[t.targetId]),this._paintConnection(t),t}},{key:"_finaliseConnection",value:function(e,t,r){t=t||{},e.suspendedEndpoint||this.connections.push(e),e.pending=null,e.endpoints[0].isTemporarySource=!1,this.repaint(e.source);var s={connection:e,source:e.source,target:e.target,sourceId:e.sourceId,targetId:e.targetId,sourceEndpoint:e.endpoints[0],targetEndpoint:e.endpoints[1]};this.fire(jt,s,r),!t.doNotFireConnectionEvent&&t.fireEvent!==!1&&this.fire(Jn,s,r)}},{key:"removeAllEndpoints",value:function(e,t){var r=this,s=function(c){var h=r.getId(c),f=r.endpointsByElement[h],v,y;if(f)for(v=0,y=f.length;v<y;v++)r.deleteEndpoint(f[v]);delete r.endpointsByElement[h]};return t&&this._getAssociatedElements(e).map(s),s(e),this}},{key:"_createSourceDefinition",value:function(e,t){var r=b({},t);b(r,e),r.edgeType=r.edgeType||Le;var s=this._deriveEndpointAndAnchorSpec(r.edgeType);r.endpoint=r.endpoint||s.endpoints[0],r.anchor=r.anchor||s.anchors[0];var l=r.maxConnections||-1,c={def:b({},r),uniqueEndpoint:r.uniqueEndpoint,maxConnections:l,enabled:!0,endpoint:null};return c}},{key:"addSourceSelector",value:function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=this._createSourceDefinition(t),l=new Rt(e,s,r);return this.sourceSelectors.push(l),l}},{key:"removeSourceSelector",value:function(e){M(this.sourceSelectors,function(t){return t===e})}},{key:"removeTargetSelector",value:function(e){M(this.targetSelectors,function(t){return t===e})}},{key:"addTargetSelector",value:function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=this._createTargetDefinition(t),l=new Rt(e,s,r);return this.targetSelectors.push(l),l}},{key:"_createTargetDefinition",value:function(e,t){var r=b({},t);b(r,e),r.edgeType=r.edgeType||Le;var s=r.maxConnections||-1,l={def:b({},r),uniqueEndpoint:r.uniqueEndpoint,maxConnections:s,enabled:!0,endpoint:null};return l}},{key:"show",value:function(e,t){return this._setVisible(e,vt,t)}},{key:"hide",value:function(e,t){return this._setVisible(e,Gn,t)}},{key:"_setVisible",value:function(e,t,r){var s=t===vt,l=null;r&&(l=function(f){f.setVisible(s,!0,!0)});var c=this.getId(e);return this._operation(e,function(h){if(s&&r){var f=h.sourceId===c?1:0;h.endpoints[f].isVisible()&&h.setVisible(!0)}else h.setVisible(s)},l),this}},{key:"toggleVisible",value:function(e,t){var r=null;t&&(r=function(l){var c=l.isVisible();l.setVisible(!c)}),this._operation(e,function(s){var l=s.isVisible();s.setVisible(!l)},r)}},{key:"_operation",value:function(e,t,r){var s=this.getId(e),l=this.endpointsByElement[s];if(l&&l.length)for(var c=0,h=l.length;c<h;c++){for(var f=0,v=l[c].connections.length;f<v;f++){var y=t(l[c].connections[f]);if(y)return}r&&r(l[c])}}},{key:"registerConnectionType",value:function(e,t){if(this._connectionTypes.set(e,b({},t)),t.overlays){for(var r={},s=0;s<t.overlays.length;s++){var l=tt(t.overlays[s]);r[l.options.id]=l}this._connectionTypes.get(e).overlays=r}}},{key:"registerConnectionTypes",value:function(e){for(var t in e)this.registerConnectionType(t,e[t])}},{key:"registerEndpointType",value:function(e,t){if(this._endpointTypes.set(e,b({},t)),t.overlays){for(var r={},s=0;s<t.overlays.length;s++){var l=tt(t.overlays[s]);r[l.options.id]=l}this._endpointTypes.get(e).overlays=r}}},{key:"registerEndpointTypes",value:function(e){for(var t in e)this.registerEndpointType(t,e[t])}},{key:"getType",value:function(e,t){return t==="connection"?this.getConnectionType(e):this.getEndpointType(e)}},{key:"getConnectionType",value:function(e){return this._connectionTypes.get(e)}},{key:"getEndpointType",value:function(e){return this._endpointTypes.get(e)}},{key:"importDefaults",value:function(e){for(var t in e)this.defaults[t]=e[t];return this.defaults[re]!=null&&(this.defaults[re].strokeWidth=this.defaults[re].strokeWidth||2),e.container&&this.setContainer(e.container),this}},{key:"restoreDefaults",value:function(){return this.defaults=b({},this._initialDefaults),this}},{key:"getManagedElements",value:function(){return this._managedElements}},{key:"proxyConnection",value:function(e,t,r,s,l){var c=e.proxies[t]!=null,h,f=c?e.proxies[t].originalEp.elementId:e.endpoints[t].elementId,v=c?e.proxies[t].originalEp:e.endpoints[t],y=this.getId(r);e.proxies[t]?e.proxies[t].ep.elementId===y?h=e.proxies[t].ep:(e.proxies[t].ep.detachFromConnection(e,t),h=this._internal_newEndpoint({element:r,endpoint:s(e,t),anchor:l(e,t),parameters:{isProxyEndpoint:!0}})):h=this._internal_newEndpoint({element:r,endpoint:s(e,t),anchor:l(e,t),parameters:{isProxyEndpoint:!0}}),h.deleteOnEmpty=!0,e.proxies[t]={ep:h,originalEp:v},this.sourceOrTargetChanged(f,y,e,r,t),v.detachFromConnection(e,null,!0),h.connections=[e],e.endpoints[t]=h,v.proxiedBy=h,v.setVisible(!1),e.setVisible(!0),this.revalidate(r)}},{key:"unproxyConnection",value:function(e,t){if(!(e.proxies==null||e.proxies[t]==null)){var r=e.proxies[t].originalEp.element,s=e.proxies[t].originalEp.elementId,l=e.proxies[t].ep.elementId;e.endpoints[t]=e.proxies[t].originalEp,delete e.proxies[t].originalEp.proxiedBy,this.sourceOrTargetChanged(l,s,e,r,t),e.proxies[t].ep.detachFromConnection(e,null),e.proxies[t].originalEp.addConnection(e),e.isVisible()&&e.proxies[t].originalEp.setVisible(!0),e.proxies[t]=null,Ie(e.proxies,function(c){return c!=null})===-1&&(e.proxies.length=0)}}},{key:"sourceOrTargetChanged",value:function(e,t,r,s,l){e!==t&&(l===0?(r.sourceId=t,r.source=s):l===1&&(r.targetId=t,r.target=s),Oe(r,this._managedElements[e]),Pe(r,this._managedElements[t]))}},{key:"getGroup",value:function(e){return this.groupManager.getGroup(e)}},{key:"getGroupFor",value:function(e){return this.groupManager.getGroupFor(e)}},{key:"addGroup",value:function(e){return this.groupManager.addGroup(e)}},{key:"addToGroup",value:function(e){for(var t,r=arguments.length,s=new Array(r>1?r-1:0),l=1;l<r;l++)s[l-1]=arguments[l];return(t=this.groupManager).addToGroup.apply(t,[e,!1].concat(s))}},{key:"collapseGroup",value:function(e){this.groupManager.collapseGroup(e)}},{key:"expandGroup",value:function(e){this.groupManager.expandGroup(e)}},{key:"toggleGroup",value:function(e){this.groupManager.toggleGroup(e)}},{key:"removeGroup",value:function(e,t,r,s){return this.groupManager.removeGroup(e,t,r,s)}},{key:"removeAllGroups",value:function(e,t){this.groupManager.removeAllGroups(e,t,!1)}},{key:"removeFromGroup",value:function(e,t,r){this.groupManager.removeFromGroup(e,r,t),this._appendElement(t,this.getContainer()),this.updateOffset({recalc:!0,elId:this.getId(t)})}},{key:"_paintEndpoint",value:function(e,t){function r(C){var A=0;if(t.elementWithPrecedence!=null){for(var P=0;P<C.connections.length;P++)if(C.connections[P].sourceId===t.elementWithPrecedence||C.connections[P].targetId===t.elementWithPrecedence){A=P;break}}return C.connections[A]}t=t||{};var s=t.timestamp,l=t.recalc!==!1;if(!s||e.timestamp!==s){var c=this.viewport.getPosition(e.elementId),h=t.offset?{x:t.offset.x,y:t.offset.y}:{x:c.x,y:c.y};if(h!=null){var f=t.anchorLoc;if(f==null){var v={xy:h,wh:c,element:e,timestamp:s};if(l&&this.router.isDynamicAnchor(e)&&e.connections.length>0){var y=r(e),p=y.endpoints[0]===e?1:0,m=p===0?y.sourceId:y.targetId,g=this.viewport.getPosition(m);v.index=p===0?1:0,v.connection=y,v.txy=g,v.twh=g,v.tElement=y.endpoints[p],v.tRotation=this._getRotations(m)}else e.connections.length>0&&(v.connection=e.connections[0]);v.rotation=this._getRotations(e.elementId),f=this.router.computeAnchorLocation(e._anchor,v)}e.endpoint.compute(f,this.router.getEndpointOrientation(e),e.paintStyleInUse),this.renderEndpoint(e,e.paintStyleInUse),e.timestamp=s;for(var _ in e.overlays)if(e.overlays.hasOwnProperty(_)){var E=e.overlays[_];E.isVisible()&&(e.overlayPlacements[_]=this.drawOverlay(E,e.endpoint,e.paintStyleInUse,e.getAbsoluteOverlayPosition(E)),this._paintOverlay(E,e.overlayPlacements[_],{xmin:0,ymin:0}))}}}}},{key:"_paintConnection",value:function(e,t){if(!this._suspendDrawing&&e.visible!==!1){t=t||{};var r=t.timestamp;if(r!=null&&r===e.lastPaintedAt)return;if(r==null||r!==e.lastPaintedAt){this.router.computePath(e,r);var s={xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0};for(var l in e.overlays)if(e.overlays.hasOwnProperty(l)){var c=e.overlays[l];c.isVisible()&&(e.overlayPlacements[l]=this.drawOverlay(c,e.connector,e.paintStyleInUse,e.getAbsoluteOverlayPosition(c)),s.xmin=Math.min(s.xmin,e.overlayPlacements[l].xmin),s.xmax=Math.max(s.xmax,e.overlayPlacements[l].xmax),s.ymin=Math.min(s.ymin,e.overlayPlacements[l].ymin),s.ymax=Math.max(s.ymax,e.overlayPlacements[l].ymax))}var h=parseFloat(""+e.paintStyleInUse.strokeWidth||"1")/2,f=parseFloat(""+e.paintStyleInUse.strokeWidth||"0"),v={xmin:Math.min(e.connector.bounds.xmin-(h+f),s.xmin),ymin:Math.min(e.connector.bounds.ymin-(h+f),s.ymin),xmax:Math.max(e.connector.bounds.xmax+(h+f),s.xmax),ymax:Math.max(e.connector.bounds.ymax+(h+f),s.ymax)};this.paintConnector(e.connector,e.paintStyleInUse,v);for(var y in e.overlays)if(e.overlays.hasOwnProperty(y)){var p=e.overlays[y];p.isVisible()&&this._paintOverlay(p,e.overlayPlacements[y],v)}}e.lastPaintedAt=r}}},{key:"_refreshEndpoint",value:function(e){e._anchor.isFloating||(e.connections.length>0?this.addEndpointClass(e,this.endpointConnectedClass):this.removeEndpointClass(e,this.endpointConnectedClass),e.isFull()?this.addEndpointClass(e,this.endpointFullClass):this.removeEndpointClass(e,this.endpointFullClass))}},{key:"_makeConnector",value:function(e,t,r){return Yt.get(e,t,r)}},{key:"addOverlay",value:function(e,t,r){if(e.addOverlay(t),!r){var s=e instanceof Se?e.element:e.source;this.revalidate(s)}}},{key:"removeOverlay",value:function(e,t){e.removeOverlay(t);var r=e instanceof Se?e.element:e.source;this.revalidate(r)}},{key:"setOutlineColor",value:function(e,t){e.paintStyleInUse.outlineStroke=t,this._paintConnection(e)}},{key:"setOutlineWidth",value:function(e,t){e.paintStyleInUse.outlineWidth=t,this._paintConnection(e)}},{key:"setColor",value:function(e,t){e.paintStyleInUse.stroke=t,this._paintConnection(e)}},{key:"setLineWidth",value:function(e,t){e.paintStyleInUse.strokeWidth=t,this._paintConnection(e)}},{key:"setLineStyle",value:function(e,t){t.lineWidth!=null&&(e.paintStyleInUse.strokeWidth=t.lineWidth),t.outlineWidth!=null&&(e.paintStyleInUse.outlineWidth=t.outlineWidth),t.color!=null&&(e.paintStyleInUse.stroke=t.color),t.outlineColor!=null&&(e.paintStyleInUse.outlineStroke=t.outlineColor),this._paintConnection(e)}},{key:"getPathData",value:function(e){for(var t="",r=0;r<e.segments.length;r++)t+=e.segments[r].getPath(r===0),t+=" ";return t}}]),i}(Ue),Ft=1e-10;function Nt(a){var o=Math.floor(a),i=Math.ceil(a);return a-o<Ft?o:i-a<Ft?i:a}var fr=function(a){D(i,a);var o=L(i);function i(n){var e;T(this,i),e=o.call(this,n),u(d(e),"type",i.segmentType),u(d(e),"cx",void 0),u(d(e),"cy",void 0),u(d(e),"radius",void 0),u(d(e),"anticlockwise",void 0),u(d(e),"startAngle",void 0),u(d(e),"endAngle",void 0),u(d(e),"sweep",void 0),u(d(e),"length",void 0),u(d(e),"circumference",void 0),u(d(e),"frac",void 0),e.cx=n.cx,e.cy=n.cy,e.radius=n.r,e.anticlockwise=n.ac,n.startAngle&&n.endAngle?(e.startAngle=n.startAngle,e.endAngle=n.endAngle,e.x1=e.cx+e.radius*Math.cos(e.startAngle),e.y1=e.cy+e.radius*Math.sin(e.startAngle),e.x2=e.cx+e.radius*Math.cos(e.endAngle),e.y2=e.cy+e.radius*Math.sin(e.endAngle)):(e.startAngle=e._calcAngle(e.x1,e.y1),e.endAngle=e._calcAngle(e.x2,e.y2)),e.endAngle<0&&(e.endAngle+=$),e.startAngle<0&&(e.startAngle+=$);var t=e.endAngle<e.startAngle?e.endAngle+$:e.endAngle;return e.sweep=Math.abs(t-e.startAngle),e.anticlockwise&&(e.sweep=$-e.sweep),e.circumference=2*Math.PI*e.radius,e.frac=e.sweep/$,e.length=e.circumference*e.frac,e.extents={xmin:e.cx-e.radius,xmax:e.cx+e.radius,ymin:e.cy-e.radius,ymax:e.cy+e.radius},e}return w(i,[{key:"_calcAngle",value:function(e,t){return fn({x:this.cx,y:this.cy},{x:e,y:t})}},{key:"_calcAngleForLocation",value:function(e,t){if(e.anticlockwise){var r=e.startAngle<e.endAngle?e.startAngle+$:e.startAngle,s=Math.abs(r-e.endAngle);return r-s*t}else{var l=e.endAngle<e.startAngle?e.endAngle+$:e.endAngle,c=Math.abs(l-e.startAngle);return e.startAngle+c*t}}},{key:"getPath",value:function(e){var t=this.sweep>Math.PI?1:0,r=this.anticlockwise?0:1;return(e?"M"+this.x1+" "+this.y1+" ":"")+"A "+this.radius+" "+this.radius+" 0 "+t+","+r+" "+this.x2+" "+this.y2}},{key:"getLength",value:function(){return this.length}},{key:"pointOnPath",value:function(e,t){if(e===0)return{x:this.x1,y:this.y1,theta:this.startAngle};if(e===1)return{x:this.x2,y:this.y2,theta:this.endAngle};t&&(e=e/length);var r=this._calcAngleForLocation(this,e),s=this.cx+this.radius*Math.cos(r),l=this.cy+this.radius*Math.sin(r);return{x:Nt(s),y:Nt(l),theta:r}}},{key:"gradientAtPoint",value:function(e,t){var r=this.pointOnPath(e,t),s=vn({x:this.cx,y:this.cy},r);return!this.anticlockwise&&(s===1/0||s===-1/0)&&(s*=-1),s}},{key:"pointAlongPathFrom",value:function(e,t,r){var s=this.pointOnPath(e,r),l=t/this.circumference*2*Math.PI,c=this.anticlockwise?-1:1,h=s.theta+c*l,f=this.cx+this.radius*Math.cos(h),v=this.cy+this.radius*Math.sin(h);return{x:f,y:v}}}]),i}(Vt);u(fr,"segmentType","Arc");var vr=20,yr=20,fe=function(a){D(i,a);var o=L(i);function i(n,e,t){var r;return T(this,i),r=o.call(this,n,e,t),r.instance=n,r.component=e,u(d(r),"width",void 0),u(d(r),"length",void 0),u(d(r),"foldback",void 0),u(d(r),"direction",void 0),u(d(r),"location",.5),u(d(r),"paintStyle",void 0),u(d(r),"type",i.type),u(d(r),"cachedDimensions",void 0),t=t||{},r.width=t.width||vr,r.length=t.length||yr,r.direction=(t.direction||1)<0?-1:1,r.foldback=t.foldback||.623,r.paintStyle=t.paintStyle||{strokeWidth:1},r.location=t.location==null?r.location:Array.isArray(t.location)?t.location[0]:t.location,r}return w(i,[{key:"draw",value:function(e,t,r){if(e instanceof Wt){var s=e,l,c,h,f,v;if(this.location>1||this.location<0){var y=this.location<0?1:0;l=s.pointAlongPathFrom(y,this.location,!1),c=s.pointAlongPathFrom(y,this.location-this.direction*this.length/2,!1),h=te(l,c,this.length)}else if(this.location===1){if(l=s.pointOnPath(this.location),c=s.pointAlongPathFrom(this.location,-this.length),h=te(l,c,this.length),this.direction===-1){var p=h;h=l,l=p}}else if(this.location===0){if(h=s.pointOnPath(this.location),c=s.pointAlongPathFrom(this.location,this.length),l=te(h,c,this.length),this.direction===-1){var m=h;h=l,l=m}}else l=s.pointAlongPathFrom(this.location,this.direction*this.length/2),c=s.pointOnPath(this.location),h=te(l,c,this.length);f=yn(l,h,this.width),v=te(l,h,this.foldback*this.length);var g={hxy:l,tail:f,cxy:v},_=this.paintStyle.stroke||t.stroke,E=this.paintStyle.fill||t.stroke,C=this.paintStyle.strokeWidth||t.strokeWidth;return{component:e,d:g,"stroke-width":C,stroke:_,fill:E,xmin:Math.min(l.x,f[0].x,f[1].x),xmax:Math.max(l.x,f[0].x,f[1].x),ymin:Math.min(l.y,f[0].y,f[1].y),ymax:Math.max(l.y,f[0].y,f[1].y)}}}},{key:"updateFrom",value:function(e){}}]),i}(it);u(fe,"type","Arrow");function Rr(a){return a.type===fe.type}ne.register(fe.type,fe);var st=function(a){D(i,a);var o=L(i);function i(n,e,t){var r;return T(this,i),r=o.call(this,n,e,t),r.instance=n,u(d(r),"type",i.type),r.foldback=1,r}return i}(fe);u(st,"type","PlainArrow");function Fr(a){return a.type===st.type}ne.register("PlainArrow",st);var Ne=function(a){D(i,a);var o=L(i);function i(n,e,t){var r;return T(this,i),r=o.call(this,n,e,t),r.instance=n,u(d(r),"type",i.type),r.length=r.length/2,r.foldback=2,r}return i}(fe);u(Ne,"type","Diamond");function Nr(a){return a.type===Ne.type}ne.register(Ne.type,Ne);var Be=function(a){D(i,a);var o=L(i);function i(n,e,t){var r;return T(this,i),r=o.call(this,n,e,t),r.instance=n,r.component=e,u(d(r),"create",void 0),u(d(r),"type",i.type),r.create=t.create,r}return w(i,[{key:"updateFrom",value:function(e){}}]),i}(it);u(Be,"type","Custom");function Br(a){return a.type===Be.type}ne.register(Be.type,Be);K.registerHandler(Pn);K.registerHandler(wn);K.registerHandler(On);Yt.register(Me.type,Me);export{Jn as $,Mn as A,vt as B,Nn as C,Nr as D,hi as E,Cr as F,Fr as G,He as H,Tr as I,Se as J,Mr as K,Ee as L,et as M,Gn as N,it as O,$e as P,br as Q,Ir as R,vi as S,Ln as T,wr as U,Yt as V,fr as W,Wt as X,we as Y,K as Z,di as _,In as a,Xt as a0,Zn as a1,Vn as b,mr as c,Kn as d,xr as e,Dn as f,Pr as g,Ar as h,Yn as i,ur as j,Dr as k,Lr as l,Gr as m,Sr as n,_r as o,ai as p,Ye as q,Fn as r,fi as s,Er as t,ce as u,tn as v,kr as w,Or as x,Br as y,Rr as z};
//# sourceMappingURL=core-0a463c13.js.map