text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.panejs=t():e.panejs=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="/dist/",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionHandler=t.SelectionHandler=t.Handler=t.VectorView=t.PortalView=t.NodeView=t.LinkView=t.CellView=t.Terminal=t.Portal=t.Node=t.Link=t.Cell=t.Paper=t.Model=t.Events=t.VElement=t.vector=t.detector=t.utils=void 0;var o=n(1);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var a=n(41);Object.keys(a).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var s=n(49);Object.keys(s).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var u=n(5),l=i(u),c=n(27),f=r(c),h=n(15),d=r(h),v=n(51),p=r(v),y=n(52),g=r(y),m=n(57),b=r(m),k=n(20),w=r(k),x=n(59),P=r(x),O=n(3),_=r(O),C=n(25),M=r(C),j=n(21),T=r(j),E=n(32),S=r(E),N=n(58),B=r(N),V=n(29),R=r(V),A=n(26),L=r(A),z=n(30),F=r(z),I=n(60),D=r(I),G=n(61),U=r(G),$=n(64),W=r($),H=n(65),q=r(H),X=n(66),Y=r(X),K=n(67),Z=r(K),J=n(68),Q=r(J),ee=n(69),te=r(ee),ne=n(70),re=r(ne),ie=n(71),oe=r(ie),ae=n(72),se=r(ae);n(73),b["default"].registerConnector("sharp",q["default"]).registerConnector("smooth",Y["default"]).registerConnector("rounded",Z["default"]),b["default"].registerMarker("classic",Q["default"]).registerMarker("diamond",te["default"]).registerMarker("cloven",oe["default"]).registerMarker("block",re["default"]).registerMarker("oval",se["default"]),t.utils=l,t.detector=d["default"],t.vector=f["default"],t.VElement=c.VElement,t.Events=p["default"],t.Model=g["default"],t.Paper=b["default"],t.Cell=w["default"],t.Link=P["default"],t.Node=_["default"],t.Portal=M["default"],t.Terminal=T["default"],t.CellView=S["default"],t.LinkView=B["default"],t.NodeView=R["default"],t.PortalView=L["default"],t.VectorView=F["default"],t.Handler=D["default"],t.SelectionHandler=U["default"],t.ConnectionHandler=W["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.shapes=void 0;var i=n(2),o=r(i),a=n(22),s=r(a),u=n(23),l=r(u),c=n(24),f=r(c),h=n(33),d=r(h),v=n(34),p=r(v),y=n(35),g=r(y),m=n(36),b=r(m),k=n(37),w=r(k),x=n(38),P=r(x),O=n(39),_=r(O),C=n(40),M=r(C),j={basic:{Text:l["default"],Rect:o["default"],Path:s["default"],Image:d["default"],Ports:f["default"],Circle:p["default"],Rhombus:g["default"],Ellipse:b["default"],Polygon:w["default"],Polyline:P["default"],LabelLink:_["default"],ElementLink:M["default"]}};t.shapes=j},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({markup:'<g class="pane-rotatable"><g class="pane-scalable"><rect/></g><text/></g>',attrs:{".":{fill:"#fff",stroke:"none"},rect:{fill:"#fff",stroke:"#000","stroke-width":"1",width:80,height:30},text:{fill:"#000","font-size":12,"ref-x":.5,"ref-y":.5,"text-anchor":"middle","y-alignment":"middle","font-family":"Arial, helvetica, sans-serif"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),l=r(u),c=n(20),f=r(c),h=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),s(t,[{key:"isNode",value:function(){return!0}},{key:"getBBox",value:function(){var e=this.getPosition(),t=this.getSize();return new l["default"](e.x,e.y,t.width,t.height)}}],[{key:"isNode",value:function(e){return e&&e instanceof t}}]),t}(f["default"]);h.setDefaults({tagName:"g",markup:"",classNames:"pane-cell pane-node",pane:null,view:null,data:null,attrs:null,size:{width:1,height:1,relative:!1},position:{x:0,y:0,relative:!1},rotation:{angle:0,inherited:!0}}),t["default"]=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(5),u=i(s),l=n(18),c=r(l),f=n(19),h=r(f),d=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],n=arguments.length<=1||void 0===arguments[1]?0:arguments[1],r=arguments.length<=2||void 0===arguments[2]?0:arguments[2],i=arguments.length<=3||void 0===arguments[3]?0:arguments[3];o(this,e),this.x=t,this.y=n,this.width=r,this.height=i}return a(e,[{key:"getOrigin",value:function(){return new c["default"](this.x,this.y)}},{key:"getCenter",value:function(){return new c["default"](this.x+this.width/2,this.y+this.height/2)}},{key:"getCorner",value:function(){return new c["default"](this.x+this.width,this.y+this.height)}},{key:"getTopRight",value:function(){return new c["default"](this.x+this.width,this.y)}},{key:"getBottomLeft",value:function(){return new c["default"](this.x,this.y+this.height)}},{key:"getNearestSideToPoint",value:function(e){var t=e.x-this.x,n=e.y-this.y,r=this.x+this.width-e.x,i=this.y+this.height-e.y,o=t,a="left";return o>r&&(o=r,a="right"),o>n&&(o=n,a="top"),o>i&&(a="bottom"),a}},{key:"getNearestPointToPoint",value:function(e){if(this.containsPoint(e)){var t=this.getNearestSideToPoint(e);if("right"===t)return new c["default"](this.x+this.width,e.y);if("left"===t)return new c["default"](this.x,e.y);if("bottom"===t)return new c["default"](e.x,this.y+this.height);if("top"===t)return new c["default"](e.x,this.y)}return e.adhereToRect(this)}},{key:"containsPoint",value:function(e){return e&&e.x>=this.x&&e.x<=this.x+this.width&&e.y>=this.y&&e.y<=this.y+this.height}},{key:"containsRect",value:function(e){this.normalize(),e.normalize();var t=e.x,n=e.y,r=e.width,i=e.height,o=this.x,a=this.y,s=this.width,u=this.height;return t>=o&&n>=a&&o+s>=t+r&&a+u>=n+i}},{key:"unContainsRect",value:function(e){return this.normalize(),e.normalize(),!(this.containPoint(e.getOrigin())||this.containPoint(e.getCorner())||this.containPoint(e.getTopRight())||this.containPoint(e.getBottomLeft()))}},{key:"intersect",value:function(t){var n=this.getOrigin(),r=this.getCorner(),i=t.getOrigin(),o=t.getCorner();if(n.x>=o.x||n.y>=o.y||i.x>=r.x||i.y>=r.y)return null;var a=Math.max(n.x,i.x),s=Math.max(n.y,i.y),u=Math.min(r.x,o.x)-a,l=Math.min(r.y,o.y)-s;return new e(a,s,u,l)}},{key:"union",value:function(t){var n=this.getOrigin(),r=this.getCorner(),i=t.getOrigin(),o=t.getCorner(),a=Math.min(n.x,i.x),s=Math.min(n.y,i.y),u=Math.max(r.x,o.x),l=Math.max(r.y,o.y);return new e(a,s,u-a,l-s)}},{key:"intersectionWithLineFromCenterToPoint",value:function(e,t){var n=void 0,r=this.getCenter();t&&e.rotate(r,t);for(var i=[new h["default"](this.getOrigin(),this.getTopRight()),new h["default"](this.getTopRight(),this.getCorner()),new h["default"](this.getCorner(),this.getBottomLeft()),new h["default"](this.getBottomLeft(),this.getOrigin())],o=new h["default"](r,e),a=i.length-1;a>=0;--a){var s=i[a].intersection(o);if(s){n=s;break}}return n&&t&&n.rotate(r,-t),n}},{key:"moveAndExpand",value:function(e){return this.x+=e.x||0,this.y+=e.y||0,this.width+=e.width||0,this.height+=e.height||0,this}},{key:"grow",value:function(e){return this.x-=e,this.y-=e,this.width+=2*e,this.height+=2*e,this}},{key:"round",value:function(e){return this.x=e?u.toFixed(this.x,e):Math.round(this.x),this.y=e?u.toFixed(this.y,e):Math.round(this.y),this.width=e?u.toFixed(this.width,e):Math.round(this.width),this.height=e?u.toFixed(this.height,e):Math.round(this.height),this}},{key:"normalize",value:function(){var e=this.x,t=this.y,n=this.width,r=this.height;return 0>n&&(e+=n,n=-n),0>r&&(t+=r,r=-r),this.x=e,this.y=t,this.width=n,this.height=r,this}},{key:"getBBox",value:function(t){var n=u.toRad(t||0),r=Math.abs(Math.sin(n)),i=Math.abs(Math.cos(n)),o=this.width*i+this.height*r,a=this.width*r+this.height*i;return new e(this.x+(this.width-o)/2,this.y+(this.height-a)/2,o,a)}},{key:"snapToGrid",value:function(e,t){var n=this,r=n.getOrigin(),i=n.getCorner();return r=r.snapToGrid(e,t),i=i.snapToGrid(e,t),n.x=r.x,n.y=r.y,n.width=i.x-r.x,n.height=i.y-r.y,n}},{key:"equals",value:function(t){return e.equals(this,t)}},{key:"valueOf",value:function(){return[this.x,this.y,this.width,this.height]}},{key:"toString",value:function(){return this.valueOf().join(", ")}},{key:"clone",value:function(){return e.fromRect(this)}}],[{key:"equals",value:function(e,t){var n=this.isRect(e)&&this.isRect(t);return n&&(e.standardizePort(),t.standardizePort(),n=e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height),n}},{key:"fromRect",value:function(t){return new e(t.x,t.y,t.width,t.height)}},{key:"fromVerticesAndRotation",value:function(t,n){var r=arguments.length<=2||void 0===arguments[2]?0:arguments[2],i=(t.x+n.x)/2,o=(t.y+n.y)/2,a=new c["default"](t.x,t.y).distance(new c["default"](n.x,n.y)),s=180*Math.atan(Math.abs((n.y-t.y)/(t.x-n.x)))/Math.PI,u=Math.abs(a*Math.sin((90-r+s)/180*Math.PI)),l=Math.abs(a*Math.cos((90-r+s)/180*Math.PI)),f=i-u/2,h=o-l/2,d=new e(f,h,u,l);return d.cx=i,d.cy=o,d.rotation=r,d}},{key:"isRect",value:function(t){return t&&t instanceof e}}]),e}();t["default"]=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);Object.keys(r).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})});var i=n(7);Object.keys(i).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})});var o=n(8);Object.keys(o).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}})});var a=n(10);Object.keys(a).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}})});var s=n(9);Object.keys(s).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var u=n(11);Object.keys(u).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var l=n(12);Object.keys(l).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return l[e]}})});var c=n(13);Object.keys(c).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return c[e]}})});var f=n(14);Object.keys(f).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return f[e]}})});var h=n(16);Object.keys(h).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return h[e]}})});var d=n(17);Object.keys(d).forEach(function(e){"default"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return d[e]}})}),t["default"]={}},function(e,t){"use strict";function n(e){return null===e}function r(e){return"undefined"==typeof e}function i(e){return r(e)||n(e)}function o(e){return"string"==typeof e}function a(e){return"boolean"==typeof e}function s(e,t){return y.call(e)==="[object "+t+"]"}function u(e){if(!e)return!1;var t="undefined"==typeof e?"undefined":v(e);return"function"===t||"object"===t}function l(e){return e&&e===e.window}function c(e){return s(e,"Function")}function f(e){return Array.isArray(e)}function h(e){if(f(e))return!0;if(c(e)||l(e))return!1;var t=!!e&&"length"in e&&e.length;return 0===t||"number"==typeof t&&t>0&&t-1 in e}function d(e){return!f(e)&&e-parseFloat(e)+1>=0}Object.defineProperty(t,"__esModule",{value:!0});var v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},p=Object.prototype,y=p.toString;t.isNil=i,t.isNull=n,t.isType=s,t.isArray=f,t.isWindow=l,t.isObject=u,t.isString=o,t.isBoolean=a,t.isNumeric=d,t.isFunction=c,t.isArrayLike=h,t.isUndefined=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reduceRight=t.reduce=t.filter=t.every=t.some=t.map=t.forEach=t.contains=t.lastIndexOf=t.indexOf=t.slice=t.toArray=void 0;var r=n(6),i=Array.prototype,o=function(e){return(0,r.isArray)(e)?e:(0,r.isArrayLike)(e)?i.slice.call(e):[e]},a=function(e,t,n){return e?i.slice.call(e,t,n):[]},s=function(e,t){return e?i.indexOf.call(e,t):-1},u=function(e,t){return e?i.lastIndexOf.call(e,t):-1},l=function(e,t){return e&&s(e,t)>=0},c=function(e,t,n){e&&i.forEach.call(e,t,n)},f=function(e,t,n){return e?i.map.call(e,t,n):[]},h=function(e,t,n){return e?i.some.call(e,t,n):!1},d=function(e,t,n){return e?i.every.call(e,t,n):!1},v=function(e,t,n){return e?i.filter.call(e,t,n):[]},p=function(e,t,n){return e?i.reduce.call(e,t,n):n},y=function(e,t,n){return e?i.reduceRight.call(e,t,n):n};t.toArray=o,t.slice=a,t.indexOf=s,t.lastIndexOf=u,t.contains=l,t.forEach=c,t.map=f,t.some=h,t.every=d,t.filter=v,t.reduce=p,t.reduceRight=y},function(e,t,n){"use strict";function r(e){return""+e}function i(e){return r(e).toUpperCase()}function o(e){return r(e).toLowerCase()}function a(e){return e.charAt(0).toUpperCase()+e.substring(1)}function s(e){return e.charAt(0).toLowerCase()+e.substring(1)}function u(e){var t=arguments.length<=1||void 0===arguments[1]?/\s+/:arguments[1];return r(e).split(t)}function l(e){return e?w.trim.call(""+e):""}function c(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,n="x"===e?t:3&t|8;return n.toString(16)})}function f(e){var t=0,n=e.length;if(0===n)return t;for(var r=0;n>r;r++){var i=e.charCodeAt(r);t=(t<<5)-t+i,t&=t}return t}function h(e,t){return e&&t?(""+e).replace(/\$\{(.*?)\}/g,function(e,n){var r=(0,k.getByPath)(t,n);return void 0!==r?r:e}):e}function d(e){return(e||"").replace(/ /g,"\xa0")}function v(e,t){return 0===(""+e).indexOf(t)}function p(e,t){return e=""+e,-1!==e.indexOf(t,e.length-t.length)}function y(e,t,n,r){if((0,b.isNil)(e)||(0,b.isNil)(t))return e;var i=String(e),o="number"==typeof t?t:parseInt(t,10);if(isNaN(o)||!isFinite(o))return i;var a=i.length;if(a>=o)return i;var s=(0,b.isNil)(n)?"":String(n);""===s&&(s=" ");for(var u=o-a;s.length<u;)s+=s;var l=s.length>u?s.substr(0,u):s;return r?l+i:i+l}function g(e,t,n){return y(e,t,n,!0)}function m(e,t,n){return y(e,t,n,!1)}Object.defineProperty(t,"__esModule",{value:!0}),t.padEnd=t.padStart=t.endWith=t.startWith=t.sanitizeText=t.toString=t.hashCode=t.format=t.uuid=t.split=t.trim=t.lcFirst=t.ucFirst=t.toUpper=t.toLower=void 0;var b=n(6),k=n(9),w=String.prototype;t.toLower=o,t.toUpper=i,t.ucFirst=a,t.lcFirst=s,t.trim=l,t.split=u,t.uuid=c,t.format=h,t.hashCode=f,t.toString=r,t.sanitizeText=d,t.startWith=v,t.endWith=p,t.padStart=g,t.padEnd=m},function(e,t,n){"use strict";function r(e,t){return null!==e&&Object.prototype.hasOwnProperty.call(e,t)}function i(e){return e?Object.keys(e):[]}function o(e,t,n){(0,h.forEach)(i(e),function(r){t.call(n,e[r],r)})}function a(e){e||(e={});for(var t=1,n=arguments.length;n>t;t++){var r=arguments[t];if(r)for(var i in r)e[i]=r[i]}return e}function s(e){e||(e={});for(var t=1,n=arguments.length;n>t;t++){var r=arguments[t];if(r)for(var i in r){var o=e[i],a=r[i],u=(0,d.isArray)(a);if(u||c(a)){var l=void 0;l=u?o&&(0,d.isArray)(o)?o:[]:o&&c(o)?o:{},e[i]=s(l,a)}else e[i]=a}}return e}function u(e,t,n){n=n||".";for(var r=t.split(n);r.length;){var i=r.shift();if(!(Object(e)===e&&i in e))return;e=e[i]}return e}function l(e){if(e){for(var t in e)e.hasOwnProperty(t)&&delete e[t];e&&(e.prototype=e.__proto__=null),e.destroyed=!0}}function c(e){return!(0,d.isObject)(e)||e.nodeType||(0,d.isWindow)(e)?!1:!e.constructor||r(e.constructor.prototype,"isPrototypeOf")}function f(e){for(var t in e)return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyObject=t.isPlainObject=t.getByPath=t.destroy=t.extend=t.merge=t.forIn=t.keys=t.hasOwn=void 0;var h=n(7),d=n(6);t.hasOwn=r,t.keys=i,t.forIn=o,t.merge=s,t.extend=a,t.destroy=l,t.getByPath=u,t.isPlainObject=c,t.isEmptyObject=f},function(e,t,n){"use strict";function r(e){return window.isFinite(e)&&!window.isNaN(parseFloat(e))}function i(e){return(0,d.isString)(e)&&"%"===e.slice(-1)}function o(e){return parseInt(e,10)}function a(e,t){var n=parseFloat(e);return t?n/100:n}function s(e){var t=arguments.length<=1||void 0===arguments[1]?2:arguments[1];return u(100*e,t)+"%"}function u(e){var t=arguments.length<=1||void 0===arguments[1]?2:arguments[1],n=Math.pow(10,t);return a((Math.round(e*n)/n).toFixed(t))}function l(e,t,n){var r=a(e,t);return isNaN(r)?n:r}function c(e,t){if((0,d.isNil)(e))return t;for(;0>e;)e+=t;return Math.min(e,t)}function f(e,t,n){return n>t?t>e?t:e>n?n:e:n>e?n:e>t?t:e}function h(e,t,n){return n>t?e>=t&&n>=e:e>=n&&t>=e}Object.defineProperty(t,"__esModule",{value:!0}),t.clamp=t.fixNumber=t.fixIndex=t.isWithin=t.isPercentage=t.isFinite=t.toPercentage=t.toFixed=t.toFloat=t.toInt=void 0;var d=n(6);t.toInt=o,t.toFloat=a,t.toFixed=u,t.toPercentage=s,t.isFinite=r,t.isPercentage=i,t.isWithin=h,t.fixIndex=c,t.fixNumber=l,t.clamp=f},function(e,t,n){"use strict";function r(e,t,n){var r=void 0;if((0,o.isFunction)(e)){var i=t.length,a=t[0],s=t[1],u=t[2];r=0===i?e.call(n):1===i?e.call(n,a):2===i?e.call(n,a,s):3===i?e.call(n,a,s,u):e.apply(n,t)}return r}function i(e){if((0,o.isFunction)(e)){var t=(0,a.slice)(arguments,1);return r(Function.prototype.bind,t,e)}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.invoke=t.bind=void 0;var o=n(6),a=n(7);t.bind=i,t.invoke=r},function(e,t,n){"use strict";function r(e){return e.getAttribute&&e.getAttribute("class")||""}function i(e,t){if((0,R.isNil)(e)||(0,R.isNil)(t))return!1;var n=u(r(e)),i=u(t);return 1===e.nodeType?n.replace(F," ").indexOf(i)>-1:!1}function o(e,t){if(!(0,R.isNil)(e)&&!(0,R.isNil)(t)){if((0,R.isFunction)(t))return void o(e,t.call(e,r(e)));if((0,R.isString)(t)&&1===e.nodeType){var n=t.match(I)||[],i=u(r(e)).replace(F," "),a=(0,A.reduce)(n,function(e,t){return e.indexOf(u(t))<0&&(e+=t+" "),e},i);a=(0,L.trim)(a),i!==a&&e.setAttribute("class",a)}}}function a(e,t){if(!(0,R.isNil)(e)){if((0,R.isFunction)(t))return void a(e,t.call(e,r(e)));if((!t||(0,R.isString)(t))&&1===e.nodeType){var n=(t||"").match(I)||[],i=u(r(e)).replace(F," "),o=(0,A.reduce)(n,function(e,t){var n=u(t);return e.indexOf(n)>-1&&(e=e.replace(n," ")),e},i);o=t?(0,L.trim)(o):"",i!==o&&e.setAttribute("class",o)}}}function s(e,t,n){return(0,R.isNil)(e)||(0,R.isNil)(t)?void 0:(0,R.isBoolean)(n)&&(0,R.isString)(t)?void(n?o(e,t):a(e,t)):(0,R.isFunction)(t)?void s(e,t.call(e,r(e),n),n):void((0,R.isString)(t)&&(0,A.forEach)(t.match(I)||[],function(t){i(e,t)?a(e,t):o(e,t)}))}function u(e){return" "+e+" "}function l(e){return(0,A.reduce)((0,L.split)(e,";"),function(e,t){if(t){var n=(0,L.split)(t,"=");e[(0,L.trim)(n[0])]=(0,L.trim)(n[1])}return e},{})}function c(e,t,n){if(e){var r={};(0,R.isObject)(t)?r=t:(0,R.isString)(t)&&(0,R.isUndefined)(n)?r=l(t):r[t]=n,(0,z.forIn)(r,function(t,n){e.style["transform"===n?D:n]=t})}}function f(e,t){var n=e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):window.getComputedStyle(e,null);return n&&t?n.getPropertyValue(t)||n[t]:n}function h(e){return Object(e)!==e?(e=(0,R.isNil)(e)?0:e,{top:e,right:e,bottom:e,left:e}):{top:(0,R.isNil)(e.top)?0:e.top,right:(0,R.isNil)(e.right)?0:e.right,bottom:(0,R.isNil)(e.bottom)?0:e.bottom,left:(0,R.isNil)(e.left)?0:e.left}}function d(e,t){return(t||document).createElement(e)}function v(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function p(e){if(e)for(;e.firstChild;)e.removeChild(e.firstChild)}function y(e){return e.nodeName?e.nodeName.toLowerCase():""}function g(e,t,n,r){var i=e&&!isNaN(e.nodeType);return i&&(i=(0,R.isNil)(t)||y(e)===t.toLowerCase()),i&&(i=(0,R.isNil)(n)||e.getAttribute(n)===r),i}function m(e){return(0,R.isWindow)(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}function b(e){var t={top:0,left:0},n=e&&e.ownerDocument;if(!n)return t;var r=n.documentElement;if(!U(r,e))return t;e.getBoundingClientRect&&(t=e.getBoundingClientRect());var i=m(n);return{top:t.top+(i.pageYOffset||r.scrollTop)-(r.clientTop||0),left:t.left+(i.pageXOffset||r.scrollLeft)-(r.clientLeft||0)}}function k(e,t){if(e&&e.style){var n=e.style.display;t?"none"===n&&((0,R.isUndefined)(e.__display)?n="":(n=e.__display,delete e.__display),e.style.display=n||""):"none"!==n&&(n&&(e.__display=n),e.style.display="none")}}function w(e){return e&&("none"===e.style.display||!U(e.ownerDocument,e))}function x(e,t){var n=void 0;try{var r=new DOMParser;(0,R.isUndefined)(t)||(r.async=t),n=r.parseFromString(e,"text/xml")}catch(i){n=null}if(!n||n.getElementsByTagName("parsererror").length)throw new Error("Invalid XML: "+e);return n}function P(e){var t='<svg xmlns="'+$.xmlns+'" xmlns:xlink="'+$.xlink+'" version="'+W+'">'+(e||"")+"</svg>",n=x(t,!1);return n.documentElement}function O(e,t){return(t||document).createElementNS($.xmlns,e)}function _(e,t,n){if((0,R.isNil)(n))return C(e,t);if("id"===t)e.id=n;else{var r=M(t);r.ns?e.setAttributeNS(r.ns,t,n):e.setAttribute(t,n)}}function C(e,t){var n=M(t);n.ns?e.hasAttributeNS(n.ns,n.local)&&e.removeAttributeNS(n.ns,n.local):e.hasAttribute(t)&&e.removeAttribute(t)}function M(e){if(-1!==e.indexOf(":")){var t=e.split(":");return{ns:$[t[0]],local:t[1]}}return{ns:null,local:e}}function j(e,t,n){e&&(e.style[D]="scale("+t+","+n+")")}function T(e,t,n,r){e&&(e.style[D]="rotate("+t+","+n+","+r+")")}function E(e,t,n){if(e){var r="translateX("+t+"px) translateY("+n+"px)";e.style[D]=r}}function S(e,t){if(e.getTransformToElement)return e.getTransformToElement(t);var n=void 0;try{n=t.getScreenCTM().inverse()}catch(r){throw new Error("Can not inverse source element's ctm.")}return n.multiply(e.getScreenCTM())}function N(e){var t=void 0;e===document?(t=document,e=document.documentElement):t=e.ownerDocument;var n=t.documentElement,r={},i=e.getBoundingClientRect();for(var o in i)r[o]=i[o];return(0,R.isUndefined)(r.width)&&(r.width=document.body.scrollWidth-r.left-r.right),(0,R.isUndefined)(r.height)&&(r.height=document.body.scrollHeight-r.top-r.bottom),r.top=r.top-n.clientTop,r.left=r.left-n.clientLeft,r.right=t.body.clientWidth-r.width-r.left,r.bottom=t.body.clientHeight-r.height-r.top,r}function B(e){var t=f(e)||{},n=t.position;if("fixed"===n)return e;for(var r=e;r=r.parentNode;){var i=void 0;try{i=f(r)}catch(o){}if("undefined"==typeof i||null===i)return r;var a=i.overflow,s=i.overflowX,u=i.overflowY;if(/(auto|scroll)/.test(a+u+s)&&("absolute"!==n||["relative","absolute","fixed"].indexOf(i.position)>=0))return r}return document.body}function V(){var e=d("p"),t=d("div");c(e,{width:"100%",height:"200px"}),c(t,{overflow:"hidden",visibility:"hidden",position:"absolute",left:0,top:0,width:"200px",height:"100px"}),t.appendChild(e),document.body.appendChild(t);var n=e.offsetWidth;t.style.overflow="scroll";var r=e.offsetWidth;return n===r&&(r=t.clientWidth),document.body.removeChild(t),n-r}Object.defineProperty(t,"__esModule",{value:!0}),t.getTransformToElement=t.getComputedStyle=t.getScrollBarWidth=t.getScrollParent=t.normalizeSides=t.styleStrToObject=t.getBounds=t.setStyle=t.setTranslate=t.setRotation=t.setScale=t.qualifyAttributeName=t.removeAttribute=t.setAttribute=t.getClassName=t.toggleClass=t.removeClass=t.addClass=t.hasClass=t.containsElement=t.removeElement=t.emptyElement=t.createSvgElement=t.createSvgDocument=t.createElement=t.getNodeName=t.getOffset=t.getWindow=t.isHidden=t.showHide=t.isNode=void 0;var R=n(6),A=n(7),L=n(8),z=n(9),F=/[\t\r\n\f]/g,I=/\S+/g,D=function(){if((0,R.isUndefined)(document))return"";for(var e=d("div"),t=["transform","webkitTransform","OTransform","MozTransform","msTransform"],n=0;n<t.length;++n){var r=t[n];if(void 0!==e.style[r])return r}}(),G=document.documentElement,U=G.compareDocumentPosition||G.contains?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},$={xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"},W="1.1";t.isNode=g,t.showHide=k,t.isHidden=w,t.getWindow=m,t.getOffset=b,t.getNodeName=y,t.createElement=d,t.createSvgDocument=P,t.createSvgElement=O,t.emptyElement=p,t.removeElement=v,t.containsElement=U,t.hasClass=i,t.addClass=o,t.removeClass=a,t.toggleClass=s,t.getClassName=r,t.setAttribute=_,t.removeAttribute=C,t.qualifyAttributeName=M,t.setScale=j,t.setRotation=T,t.setTranslate=E,t.setStyle=c,t.getBounds=N,t.styleStrToObject=l,t.normalizeSides=h,t.getScrollParent=B,t.getScrollBarWidth=V,t.getComputedStyle=f,t.getTransformToElement=S},function(e,t){"use strict";function n(e){return 180*e/Math.PI%360}function r(e,t){return e=t?e:e%360,e*Math.PI/180}function i(e){var t=arguments.length<=1||void 0===arguments[1]?1:arguments[1],n=arguments.length<=2||void 0===arguments[2]?"round":arguments[2];return Math[n](e/t)*t}function o(e){return e%360+(0>e?360:0)}Object.defineProperty(t,"__esModule",{value:!0}),t.toDeg=n,t.toRad=r,t.snapToGrid=i,t.normalizeAngle=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){return function(n){o(n.delegateTarget||e,n)||t.call(this,n)}}function o(e,t){var n="mouseover"===t.type?t.relatedTarget||t.fromElement:t.relatedTarget||t.toElement;return(0,w.containsElement)(e,n)||e===n}function a(e){return e.preventDefault=a.preventDefault,e.stopPropagation=a.stopPropagation,e}function s(e){var t=!0,n=this;e=e||a((_.parentWindow||O).event);var r=n.events[e.type];for(var i in r)r.hasOwnProperty(i)&&(n.$$handleEvent=r[i],n.$$handleEvent(e)===!1&&(t=!1));return t}function u(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else{n.$$guid||(n.$$guid=++u.guid),e.events||(e.events={});var r="on"+t,i=e.events[t];i||(i=e.events[t]={},e[r]&&(i[0]=e[r])),i[n.$$guid]=n,e[r]=s}}function l(e,t,n){for(;t&&t!==e;){if(j(t,n))return t;t=t.parentElement}return null}function c(e,t,n){var r=n._delegateWrapper,i=M[t];t=i?i.type:t,e.removeEventListener?(e.removeEventListener(t,n,!1),r&&e.removeEventListener(t,r,!1)):e.events&&e.events[t]&&(delete e.events[t][n.$$guid],r&&delete e.events[t][r.$$guid])}function f(e,t,n,r,i){function o(s){var u=l(e,s.target,n);u&&(s.delegateTarget=u,a&&(r=a.wrap(e,r)),i===!0&&c(e,t,o),r.call(e,s))}var a=M[t];return t=a?a.type:t,(0,b.isFunction)(n)?a?u(e,t,a.wrap(e,n)):u(e,t,n):(r._delegateWrapper=o,u(e,t,o),r)}function h(e){var t=C&&e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0];if(t){for(var n in e)void 0===t[n]&&(t[n]=e[n]);return t}return e}function d(e){return P["default"].IS_IE?1===e.button:0===e.button}function v(e){return y(e)||m(e)||g(e)}function p(e){return e.altKey}function y(e){return e.ctrlKey}function g(e){return e.shiftKey}function m(e){return e.metaKey}Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.addEventListener=t.isLeftMouseButton=t.hasModifierKey=t.hasShiftKey=t.hasMetaKey=t.hasCtrlKey=t.hasAltKey=t.normalizeEvent=void 0;var b=n(6),k=n(7),w=n(12),x=n(15),P=r(x),O=window,_=window.document,C=P["default"].IS_TOUCH,M={mouseenter:{type:"mouseover",wrap:i},mouseleave:{type:"mouseout",wrap:i}},j=function(){var e=_.createElement("div"),t=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector,n=t&&t.call(e,"div");return function(e,r){if(n)return t.call(e,r);var i=e.parentNode;i||n||(i=_.createDocumentFragment(),i.appendChild(e));var o=i.querySelectorAll(r);return(0,k.some)(o,function(t){return t===e})}}();a.preventDefault=function(){this.returnValue=!1},a.stopPropagation=function(){this.cancelBubble=!0},u.guid=0,t.normalizeEvent=h,t.hasAltKey=p,t.hasCtrlKey=y,t.hasMetaKey=m,t.hasShiftKey=g,t.hasModifierKey=v,t.isLeftMouseButton=d,t.addEventListener=f,t.removeEventListener=c},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=navigator.userAgent,r=navigator.appVersion;t["default"]={IS_IE:n.indexOf("MSIE")>=0,IS_IE11:!!n.match(/Trident\/7\./),IS_NS:n.indexOf("Mozilla/")>=0&&n.indexOf("MSIE")<0,IS_FF:n.indexOf("Firefox/")>=0,IS_GC:n.indexOf("Chrome/")>=0,IS_SF:n.indexOf("AppleWebKit/")>=0&&n.indexOf("Chrome/")<0,IS_OP:n.indexOf("Opera/")>=0,IS_OT:n.indexOf("Presto/2.4.")<0&&n.indexOf("Presto/2.3.")<0&&n.indexOf("Presto/2.2.")<0&&n.indexOf("Presto/2.1.")<0&&n.indexOf("Presto/2.0.")<0&&n.indexOf("Presto/1.")<0,IS_MT:n.indexOf("Firefox/")>=0&&n.indexOf("Firefox/1.")<0&&n.indexOf("Firefox/2.")<0||n.indexOf("Iceweasel/")>=0&&n.indexOf("Iceweasel/1.")<0&&n.indexOf("Iceweasel/2.")<0||n.indexOf("SeaMonkey/")>=0&&n.indexOf("SeaMonkey/1.")<0||n.indexOf("Iceape/")>=0&&n.indexOf("Iceape/1.")<0,IS_IOS:!!n.match(/(iPad|iPhone|iPod)/g),IS_WIN:r.indexOf("Win")>0,IS_MAC:r.indexOf("Mac")>0,IS_POINTER:window.navigator.msPointerEnabled||!1,IS_TOUCH:"ontouchstart"in document.documentElement||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0,SUPPORT_FOREIGN_OBJECT:function(){if(document.createElementNS){var e=Object.prototype.toString,t=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");return/SVGForeignObject/.test(e.call(t))}return!1}()}},function(e,t,n){"use strict";function r(e){return["M",e.getAttribute("x1"),e.getAttribute("y1"),"L",e.getAttribute("x2"),e.getAttribute("y2")].join(" ")}function i(e){var t=[];return(0,l.forEach)(e.points,function(e,n){t.push(0===n?"M":"L",e.x,e.y)}),t.push("Z"),t.join(" ")}function o(e){var t=[];return(0,l.forEach)(e.points,function(e,n){t.push(0===n?"M":"L",e.x,e.y)}),t.join(" ")}function a(e){var t=parseFloat(e.getAttribute("x"))||0,n=parseFloat(e.getAttribute("y"))||0,r=parseFloat(e.getAttribute("width"))||0,i=parseFloat(e.getAttribute("height"))||0,o=parseFloat(e.getAttribute("rx"))||0,a=parseFloat(e.getAttribute("ry"))||0,s=t+r,u=n+i,l=void 0;
  return l=o||a?["M",t+o,n,"L",s-o,n,"Q",s,n,s,n+a,"L",s,n+i-a,"Q",s,u,s-o,u,"L",t+o,u,"Q",t,u,t,u-o,"L",t,n+a,"Q",t,n,t+o,n,"Z"]:["M",t,n,"H",s,"V",u,"H",t,"V",n,"Z"],l.join(" ")}function s(e){var t=parseFloat(e.getAttribute("cx"))||0,n=parseFloat(e.getAttribute("cy"))||0,r=parseFloat(e.getAttribute("r")),i=r*c;return["M",t,n-r,"C",t+i,n-r,t+r,n-i,t+r,n,"C",t+r,n+i,t+i,n+r,t,n+r,"C",t-i,n+r,t-r,n+i,t-r,n,"C",t-r,n-i,t-i,n-r,t,n-r,"Z"].join(" ")}function u(e){var t=parseFloat(e.getAttribute("cx"))||0,n=parseFloat(e.getAttribute("cy"))||0,r=parseFloat(e.getAttribute("rx")),i=parseFloat(e.getAttribute("ry"))||r,o=r*c,a=i*c;return["M",t,n-i,"C",t+o,n-i,t+r,n-a,t+r,n,"C",t+r,n+a,t+o,n+i,t,n+i,"C",t-o,n+i,t-r,n+a,t-r,n,"C",t-r,n-a,t-o,n-i,t,n-i,"Z"].join(" ")}Object.defineProperty(t,"__esModule",{value:!0}),t.polylineToPathData=t.polygonToPathData=t.ellipseToPathData=t.circleToPathData=t.rectToPathData=t.lineToPathData=void 0;var l=n(7),c=.5522847498307935;t.lineToPathData=r,t.rectToPathData=a,t.circleToPathData=s,t.ellipseToPathData=u,t.polygonToPathData=i,t.polylineToPathData=o},function(e,t,n){"use strict";function r(e){var t={tx:0,ty:0};if(e){var n=/[ ,]+/,r=e.match(/translate\((.*)\)/);if(r){var i=r[1].split(n);i[0]&&(t.tx+=(0,f.toFloat)(i[0])),i[1]&&(t.ty+=(0,f.toFloat)(i[1]))}}return t}function i(e){var t={sx:1,sy:1};if(e){var n=/[ ,]+/,r=e.match(/scale\((.*)\)/);if(r){var i=r[1].split(n);i[0]&&(t.sx*=(0,f.toFloat)(i[0])),(i[1]||i[0])&&(t.sy*=(0,f.toFloat)(i[1]||i[0]))}}return t}function o(e){var t={angle:0};if(e){var n=/[ ,]+/,r=e.match(/rotate\((.*)\)/);if(r){var i=r[1].split(n);i[0]&&(t.angle+=(0,f.toFloat)(i[0])),i[1]&&i[2]&&(t.cx=(0,f.toFloat)(i[1]),t.cy=(0,f.toFloat)(i[2]))}}return t}function a(e){return{translate:r(e),rotate:o(e),scale:i(e)}}function s(e){return e&&(0,c.trim)(e.replace(/translate\([^)]*\)/g,""))||""}function u(e){return e&&(0,c.trim)(e.replace(/scale\([^)]*\)/g,""))||""}function l(e){return e&&(0,c.trim)(e.replace(/rotate\([^)]*\)/g,""))||""}Object.defineProperty(t,"__esModule",{value:!0}),t.clearTranslate=t.clearRotate=t.clearScale=t.parseTranslate=t.parseTransform=t.parseRotate=t.parseScale=void 0;var c=n(8),f=n(10);t.parseScale=i,t.parseRotate=o,t.parseTransform=a,t.parseTranslate=r,t.clearScale=u,t.clearRotate=l,t.clearTranslate=s},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(5),s=r(a),u=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],n=arguments.length<=1||void 0===arguments[1]?0:arguments[1];i(this,e),this.x=t,this.y=n}return o(e,[{key:"update",value:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=arguments.length<=1||void 0===arguments[1]?0:arguments[1];return this.x=e,this.y=t,this}},{key:"translate",value:function(){var e=arguments.length<=0||void 0===arguments[0]?0:arguments[0],t=arguments.length<=1||void 0===arguments[1]?0:arguments[1];return this.x+=e,this.y+=t,this}},{key:"rotate",value:function(t,n){n=(n+360)%360,this.toPolar(t),this.y+=s.toRad(n);var r=e.fromPolar(this.x,this.y,t);return this.x=r.x,this.y=r.y,this}},{key:"scale",value:function(t,n,r){return r=r||new e(0,0),this.x=r.x+t*(this.x-r.x),this.y=r.y+n*(this.y-r.y),this}},{key:"move",value:function(e,t){var n=s.toRad(e.theta(this));return this.translate(Math.cos(n)*t,-Math.sin(n)*t)}},{key:"reflect",value:function(e){return e.move(this,this.distance(e))}},{key:"diff",value:function(t){return new e(this.x-t.x,this.y-t.y)}},{key:"round",value:function(e){return this.x=e?s.toFixed(this.x,e):Math.round(this.x),this.y=e?s.toFixed(this.y,e):Math.round(this.y),this}},{key:"smooth",value:function(){return this.round(2)}},{key:"theta",value:function(t){t=t||new e;var n=-(t.y-this.y),r=t.x-this.x,i=10,o=0===s.toFixed(r,i)&&0===s.toFixed(n,i)?0:Math.atan2(n,r);return 0>o&&(o=2*Math.PI+o),s.toDeg(o)}},{key:"distance",value:function(t){t=t||new e;var n=t.x-this.x,r=t.y-this.y;return Math.sqrt(n*n+r*r)}},{key:"manhattanDistance",value:function(t){return t=t||new e,Math.abs(t.x-this.x)+Math.abs(t.y-this.y)}},{key:"toPolar",value:function(t){t=t||new e(0,0);var n=this.x-t.x,r=this.y-t.y;return this.y=s.toRad(t.theta(e.fromPoint(this))),this.x=Math.sqrt(n*n+r*r),this}},{key:"normalize",value:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],n=this.x,r=this.y;if(0===n&&0===r)return this;var i=void 0;return i=0===n?t/r:0===r?t/n:t/this.distance(new e),this.x=i*n,this.y=i*r,this}},{key:"changeInAngle",value:function(t,n,r){return e.fromPoint(this).translate(-t,-n).theta(r)-this.theta(r)}},{key:"snapToGrid",value:function(e,t){return this.x=s.snapToGrid(this.x,e),this.y=s.snapToGrid(this.y,t||e),this}},{key:"adhereToRect",value:function(e){return e.containsPoint(this)?this:(this.x=Math.min(Math.max(this.x,e.x),e.x+e.width),this.y=Math.min(Math.max(this.y,e.y),e.y+e.height),this)}},{key:"magnitude",value:function(){return Math.sqrt(this.x*this.x+this.y*this.y)||.01}},{key:"valueOf",value:function(){return[this.x,this.y]}},{key:"toString",value:function(){return this.valueOf().join(", ")}},{key:"equals",value:function(t){return e.equals(this,t)}},{key:"clone",value:function(){return e.fromPoint(this)}}],[{key:"equals",value:function(e,t){return this.isPoint(e)&&this.isPoint(t)&&e.x===t.x&&e.y===t.y}},{key:"isPoint",value:function(t){return t&&t instanceof e}},{key:"isPointLike",value:function(e){return this.isPoint(e)?!0:e?s.hasOwn(e,"x")&&s.hasOwn(e,"y"):!1}},{key:"fromPoint",value:function(t){return new e(t.x,t.y)}},{key:"fromPolar",value:function(t,n,r){r=r||new e(0,0);var i=Math.abs(t*Math.cos(n)),o=Math.abs(t*Math.sin(n)),a=s.normalizeAngle(s.toDeg(n));return 90>a?o=-o:180>a?(i=-i,o=-o):270>a&&(i=-i),new e(r.x+i,r.y+o)}},{key:"fromString",value:function(t){var n=t.split(-1===t.indexOf("@")?" ":"@");return new e(s.toFloat(n[0]),s.toFloat(n[1]))}},{key:"random",value:function(t,n,r,i){var o=Math.floor(Math.random()*(n-t+1)+t),a=Math.floor(Math.random()*(i-r+1)+r);return new e(o,a)}}]),e}();t["default"]=u},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(5),u=i(s),l=n(18),c=r(l),f=function(){function e(t,n){if(o(this,e),!t)throw new Error("The start point of line must be specified");if(!n)throw new Error("The end point of line must be specified");this.start=t,this.end=n}return a(e,[{key:"getLength",value:function(){return Math.sqrt(this.getSquaredLength())}},{key:"getSquaredLength",value:function(){var e=this.end.x-this.start.x,t=this.end.y-this.end.x;return e*e+t*t}},{key:"getMidpoint",value:function(){var e=(this.start.x+this.end.x)/2,t=(this.start.y+this.end.y)/2;return new c["default"](e,t)}},{key:"getPointAt",value:function(e){var t=(1-e)*this.start.x+e*this.end.x,n=(1-e)*this.start.y+e*this.end.y;return new c["default"](t,n)}},{key:"intersection",value:function(e){var t=this.start,n=this.end,r=e.start,i=e.end,o=new c["default"](n.x-t.x,n.y-t.y),a=new c["default"](i.x-r.x,i.y-r.y),s=o.x*a.y-o.y*a.x,u=new c["default"](r.x-t.x,r.y-t.y),l=u.x*a.y-u.y*a.x,f=u.x*o.y-u.y*o.x;if(0===s||0>l*s||0>f*s)return null;if(s>0){if(l>s||f>s)return null}else if(s>l||s>f)return null;return new c["default"](t.x+l*o.x/s,t.y+l*o.y/s)}},{key:"getDirection",value:function(){var e=this.start,t=this.end,n=u.toRad(e.y),r=u.toRad(t.y),i=e.x,o=t.x,a=u.toRad(o-i),s=Math.sin(a)*Math.cos(r),l=Math.cos(n)*Math.sin(r)-Math.sin(n)*Math.cos(r)*Math.cos(a),c=["NE","E","SE","S","SW","W","NW","N"],f=u.toDeg(Math.atan2(s,l)),h=f-22.5;return 0>h&&(h+=360),h=u.toInt(h/45),c[h]}},{key:"getOffset",value:function(e){var t=this.start,n=this.end;return((n.x-t.x)*(e.y-t.y)-(n.y-t.y)*(e.x-t.x))/2}},{key:"valueOf",value:function(){return[this.satrt.valueOf(),this.end.valueOf()]}},{key:"toString",value:function(){return this.start.toString()+" "+this.end.toString()}},{key:"equals",value:function(t){return e.equals(this,t)}},{key:"clone",value:function(){return e.fromLine(this)}}],[{key:"equals",value:function(e,t){return this.isLine(e)&&this.isLine(t)&&(e.start&&e.start.equals(t.start)||!e.start&&!t.start)&&(e.end&&e.end.equals(t.end)||!e.end&&!t.end)}},{key:"fromLine",value:function(t){return new e(t.start.clone(),t.end.clone())}},{key:"isLine",value:function(t){return t&&t instanceof e}}]),e}();t["default"]=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){var n=this.getChildCount();return t=v.fixIndex(t,n),e.parent===this&&t===n&&t--,e.removeFromParent({silent:!0}),e.parent=this,this.children&&this.children.length?this.children.splice(t,0,e):(this.children=[],this.children.push(e)),this}function s(e,t){var n=e&&e.getModel();return!n&&t&&t.getModel&&(n=t.getModel()),n}function u(e){return this.setParent.scheduled=e,this}function l(){return this.setParent.scheduled===!0}function c(e){return this.setTerminal.scheduled=e,this}function f(){return this.setTerminal.scheduled===!0}Object.defineProperty(t,"__esModule",{value:!0});var h=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(5),v=i(d),p=n(21),y=r(p),g=function(){function e(t){o(this,e);var n=v.merge({},this.constructor.defaults,t);this.data=n.data,this.attrs=n.attrs||{},this.visible=n.visible!==!1,this.metadata=n}return h(e,[{key:"isLink",value:function(){return!1}},{key:"getTerminal",value:function(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];return e?this.source:this.target}},{key:"setTerminal",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(c.call(this,!1),!n.silent){var r=s(this,e);r&&(r.setTerminal(this,e,t),c.call(this,!0))}return f.call(this)||(e=e?new y["default"](e):null,t?(this.source=e,e?(this.sourceNode=e.node,this.sourcePort=e.port,this.sourcePoint=e.point):(this.sourceNode=null,this.sourcePort=null,this.sourcePoint=null)):(this.target=e,e?(this.targetNode=e.node,this.targetPort=e.port,this.targetPoint=e.point):(this.targetNode=null,this.targetPort=null,this.targetPoint=null))),this}},{key:"getTerminalNode",value:function(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],t=e?this.sourceNode:this.targetNode;if(!t){var n=this.getTerminal(e);t=n&&n.node||null}return t}},{key:"setTerminalNode",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(c.call(this,!1),!n.silent){var r=s(this,e);r&&(r.setTerminalNode(this,e,t),c.call(this,!0))}if(!f.call(this)){t?this.sourceNode=e:this.targetNode=e;var i=this.getTerminal(t);i&&(i.node=e)}return this}},{key:"getTerminalPort",value:function(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],t=e?this.sourcePort:this.targetPort;if(!t){var n=this.getTerminal(e);t=n&&n.port||null}return t}},{key:"setTerminalPort",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(c.call(this,!1),!n.silent){var r=s(this);r&&(r.setTerminalPort(this,e,t),c.call(this,!0))}if(!f.call(this)){t?this.sourcePort=e:this.targetPort=e;var i=this.getTerminal(t);i&&(i.port=e)}return this}},{key:"getTerminalPoint",value:function(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],t=e?this.sourcePoint:this.targetPoint;if(!t){var n=this.getTerminal(e);t=n&&n.point||null}return t}},{key:"setTerminalPoint",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(c.call(this,!1),!n.silent){var r=s(this);r&&(r.setTerminalPoint(this,e,t),c.call(this,!0))}if(!f.call(this)){t?this.sourcePoint=e:this.targetPoint=e;var i=this.getTerminal(t);i&&(i.point=e)}return this}},{key:"removeFromTerminal",value:function(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0],t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=this.getTerminal(e);if(n){if(c.call(this,!1),!t.silent){var r=s(this,n);r&&(r.removeFromTerminal(this,e),c.call(this,!0))}f.call(this)||n.removeLink(this,e,{silent:!0})}return this}},{key:"isNode",value:function(){return!1}},{key:"getLinkCount",value:function(){return this.links?this.links.length:0}},{key:"indexOfLink",value:function(e){return v.indexOf(this.links,e)}},{key:"getLinkAt",value:function(e){return this.links?this.links[e]:null}},{key:"eachLink",value:function(e,t){return v.forEach(this.links,e,t)}},{key:"filterLink",value:function(e,t){return v.filter(this.links,e,t)}},{key:"addLink",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(!e)return this;if(c.call(e,!1),!n.silent){var r=s(e,this);r&&(r.setTerminal(e,this,t),c.call(e,!0))}return f.call(e)||(e.removeFromTerminal(t,{silent:!0}),(!this.links||this.indexOfLink(e)<0||e.getTerminalNode(!t)!==this)&&(this.links||(this.links=[]),this.links.push(e)),e.setTerminal(this,t,{silent:!0})),this}},{key:"removeLink",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(!e)return this;if(c.call(e,!1),!n.silent){var r=s(e,this);r&&(r.setTerminal(e,null,t),c.call(e,!0))}if(!f.call(e)){if(this.links&&e.getTerminalNode(!t)!==this){var i=this.indexOfLink(e);i>=0&&this.links.splice(i,1)}e.setTerminal(null,t,{silent:!0})}return this}},{key:"getChildCount",value:function(){return this.children?this.children.length:0}},{key:"indexOfChild",value:function(e){return v.indexOf(this.children,e)}},{key:"getChildAt",value:function(e){return this.children?this.children[e]:null}},{key:"eachChild",value:function(e,t){return v.forEach(this.children,e,t)}},{key:"filterChild",value:function(e,t){return v.filter(this.children,e,t)}},{key:"insertChild",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return e?(v.isObject(t)&&(n=t),u.call(e,!1),n.silent||e.setParent(this,t),l.call(e)||a.call(this,e,t),this):this}},{key:"removeChild",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return this.removeChildAt(this.indexOfChild(e),t)}},{key:"removeChildAt",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=this.getChildAt(e);return n&&(u.call(n,!1),t.silent||n.setParent(null),l.call(n)||(this.children.splice(e,1),n.parent=null)),n}},{key:"getParent",value:function(){return this.parent}},{key:"setParent",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(u.call(this,!1),!n.silent){var r=s(this,e);r&&(r.setParent(this,e,t),u.call(this,!0))}return l.call(this)||(e?a.call(e,this,t):this.removeFromParent({silent:!0})),this}},{key:"removeFromParent",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];if(this.parent){var t=!1;if(!e.silent){var n=s(this,this.parent);n&&(n.removeCell(this),t=!0)}t||this.parent.removeChild(this,{silent:!0})}return this}},{key:"isOrphan",value:function(){return v.isNil(this.parent)}},{key:"isAncestor",value:function(e){if(!e)return!1;for(;e&&e!==this;)e=e.parent;return e===this}},{key:"contains",value:function(e){return this.isAncestor(this,e)}},{key:"getAncestors",value:function(){for(var e=[],t=this.parent;t;)e.push(t),t=t.parent;return e}},{key:"getDescendants",value:function(){var e=this,t=[];return this.eachChild(function(n){t.push(n),t=t.concat(e.getDescendants(n))},this),t}},{key:"getSize",value:function(e){return e?this.metadata.size:this.size}},{key:"setSize",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=!1;if(e={width:e.width,height:e.height,relative:e.relative===!0},!t.silent){var r=this.getModel();r&&(r.setSize(this,e),n=!0)}return!n&&this.metadata&&(this.metadata.size=e),this}},{key:"resize",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return this.setSize({width:e,height:t},n)}},{key:"getPosition",value:function(e){return e?this.metadata.position:this.position}},{key:"setPosition",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=!1;if(e={x:e.x,y:e.y,relative:e.relative===!0},!t.silent){var r=this.getModel();r&&(r.setPosition(this,e),n=!0)}return!n&&this.metadata&&(this.metadata.position=e),this}},{key:"translate",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return this.setPosition({x:e,y:t},n)}},{key:"getRotation",value:function(e){return e?this.metadata.rotation:this.rotation}},{key:"setRotation",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=!1;if(e={angle:e.angle,relative:e.relative===!0},!t.silent){var r=this.getModel();r&&(r.setRotation(this,e),n=!0)}return!n&&this.metadata&&(this.metadata.rotation=e),this}},{key:"rotate",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return this.setRotation({angle:e},t)}},{key:"getGeometry",value:function(e){return{size:this.getSize(e),position:this.getPosition(e),rotation:this.getRotation(e)}}},{key:"setGeometry",value:function(e){var t=this,n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=!1;if(!n.silent){var i=this.getModel();i&&(i.setGeometry(this,e),r=!0)}return r||v.forEach(["size","position","rotation"],function(n){var r=e[n];r&&t["set"+v.ucFirst(n)](r,{silent:!0})},this),this}},{key:"isVisible",value:function(){return this.visible!==!1}},{key:"setVisible",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=!1;if(!t.silent){var r=s(this);r&&(r.setVisible(this,e),n=!0)}return n||(this.visible=!!e,this.metadata.visible=this.visible),this}},{key:"show",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return this.setVisible(!0,e),this}},{key:"hide",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return this.setVisible(!1,e),this}},{key:"toggle",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return this.isVisible()?this.hide(e):this.show(e),this}},{key:"getAttribute",value:function(){return this.metadata.attrs}},{key:"setAttribute",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=!1;if(!t.silent){var r=this.getModel();r&&(r.setAttribute(this,e),n=!0)}return!n&&this.metadata&&(this.metadata.attrs=v.merge({},this.getAttribute(),e)),this}},{key:"getId",value:function(){return this.id}},{key:"setId",value:function(e){this.id=e}},{key:"getModel",value:function(){return this.model}},{key:"setModel",value:function(e){return this.model=e||null,this}},{key:"addTo",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?this.getModel():arguments[2];return n&&n.addCell(this,e,t),this}},{key:"getView",value:function(e){return e.getView(this)}},{key:"getClassName",value:function(){var e=this.metadata.classNames;return v.isArray(e)?e.join(" "):e||""}},{key:"getTagName",value:function(){return this.metadata.tagName||"g"}},{key:"getMarkup",value:function(){return this.metadata.markup}},{key:"valueOf",value:function(){return this.data}},{key:"toString",value:function(){return this.getId()||Object.toString.call(this)}},{key:"cloneData",value:function(){var e=this.data;if(e){if(e.clone&&v.isFunction(e.clone))return e.clone();if(v.isNode(e))return e.cloneNode(!0);if(v.isObject(e))return v.merge({},e)}return e}},{key:"clone",value:function(e,t){var n=v.merge({},this.metadata,e);return n.data=t===!0?this.cloneData():this.data,n.visible=this.visible,new this.constructor(n)}},{key:"destroy",value:function(){this.eachChild(function(e){e.destroy()}),this.eachLink(function(e){e.destroy()}),this.removeFromTerminal(!0).removeFromTerminal(!1).removeFromParent(),v.destroy(this)}}],[{key:"setDefaults",value:function(e){this.defaults=v.merge({},this.defaults,e)}}]),e}();t["default"]=g},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){return this.setTerminal.scheduled=e,this}function s(){return this.setTerminal.scheduled===!0}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(18),h=r(f),d=function(){function e(t){return o(this,e),t instanceof e?t:void(t&&(t.isNode&&t.isNode()?this.node=t:h["default"].isPointLike(t)?this.point=h["default"].fromPoint(t):c.isObject(t)&&(this.node=t.node,this.port=t.port,this.point=h["default"].isPointLike(t.point)?h["default"].fromPoint(t.point):null)))}return u(e,[{key:"addLink",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(e){if(a.call(e,!1),!n.silent){var r=e.getModel()||this.getModel();r&&(r.setTerminal(e,this,t),a.call(e,!0))}s.call(e)||(this.node&&this.node.addLink(e,t,{silent:!0}),e.setTerminal(this,t,{silent:!0}))}return this}},{key:"removeLink",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(e){if(a.call(e,!1),!n.silent){var r=e.getModel()||this.getModel();r&&(r.setTerminal(e,null,t),a.call(e,!0))}s.call(e)||(this.node&&this.node.removeLink(e,t,{silent:!0}),e.setTerminal(null,t,{silent:!0}))}return this}},{key:"duplicate",value:function(t){var n=new e(t);return c.forEach(["node","port","point"],function(e){this[e]&&!n[e]&&(n[e]=this[e])},this),n}},{key:"getModel",value:function(){return this.node&&this.node.getModel()}}]),e}();t["default"]=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(3),h=r(f),d=function(e){function t(e){o(this,t);var n=a(this,Object.getPrototypeOf(t).call(this,e));return n.parsePathData(),n}return s(t,e),u(t,[{key:"parsePathData",value:function(){var e=this.getPathData()||"",t=e.match(/([A-Za-z])/g);e=e.replace(/^[A-Za-z]/,"").replace(/[A-Za-z]$/,"");var n=c.split(e,/[A-Za-z]/);n=c.map(n,function(e){e=c.trim(e);for(var t=c.split(e,/[\s,]+/),n=[],r=0,i=t.length;i>r;r+=2)n.push({x:c.toFloat(t[r]),y:c.toFloat(t[r+1])});return n});var r=c.reduce(n,function(e,t){return e.concat(t)},[]),i=r[0].x,o=r[0].y;c.forEach(r,function(e){i=Math.min(e.x,i),o=Math.min(e.y,o)});var a=[];c.forEach(n,function(e,n){t[n]&&a.push(t[n]),c.forEach(e,function(e){var t=c.toFixed(e.x-i,2),n=c.toFixed(e.y-o,2);a.push(t,n)})}),t[n.length]&&a.push(t[n.length]);var s=a.join(" "),u=this.metadata.attrs;u.path?u.path.d=s:u.path={d:s}}},{key:"getPathData",value:function(){var e=this.metadata,t=e.attrs,n=t&&t.path,r=n&&n.d;if(!r){var i=/<path(?:.+)d=(["|'])(.*?)\1/,o=e.markup||"",a=o.match(i);a&&(r=a[2])}return r}}]),t}(h["default"]);d.setDefaults({markup:'<g class="pane-rotatable"><g class="pane-scalable"><path/></g><text/></g>',size:{width:60,height:60},attrs:{".":{fill:"#ffffff",stroke:"none"},path:{fill:"#ffffff",stroke:"#000000"},text:{"font-size":14,text:"","text-anchor":"middle",ref:"path","ref-x":.5,"ref-dy":10,fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}}),t["default"]=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({markup:'<g class="pane-rotatable"><g class="pane-scalable"><text/></g></g>',attrs:{".":{fill:"#ffffff",stroke:"none"},text:{"font-size":18,fill:"#000000"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(25),h=r(f),d=function(e){function t(e){o(this,t);var n=a(this,Object.getPrototypeOf(t).call(this,e));return n.updatePortsAttrs(),n}return s(t,e),u(t,[{key:"updatePortsAttrs",value:function(){var e={};return c.forEach(this.inPorts,function(t,n){c.merge(e,this.getPortAttrs(t,n,!0))},this),c.forEach(this.outPorts,function(t,n){c.merge(e,this.getPortAttrs(t,n,!1))},this),c.merge(this.attrs,e),this}},{key:"getPortAttrs",value:function(e,t,n){var r={},i=n?this.inPorts:this.outPorts,o=this.getPortSelector(e,n),a=o+">.port-label";return r[a]={text:e.id},r[o]={ref:".node-body","ref-y":(t+.5)*(1/i.length)},n||(r[o]["ref-dx"]=0),r}},{key:"getPortSelector",value:function(e,t){return this.getPortsWrapSelector(t)+'>.pane-port[data-id="'+e.id+'"]'}},{key:"getPortsWrapSelector",value:function(e){return".pane-ports."+(e?"in":"out")}}]),t}(h["default"]);d.setDefaults({size:{width:80,height:100},markup:'<g class="pane-rotatable">  <g class="pane-scalable">    <rect class="node-body"/>  </g>  <text class="node-label"/>  <g class="pane-ports in" />  <g class="pane-ports out" /></g>',portMarkup:'<g class="pane-port" data-id="${id}">  <circle class="port-body"/>  <text class="port-label"/></g>',attrs:{".node-label":{text:"port","ref-x":.5,"ref-y":.5,"y-alignment":"middle","text-anchor":"middle"},".in .port-label":{x:-15,dy:4},".out .port-label":{x:15,dy:4}}}),t["default"]=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(3),h=r(f),d=n(26),v=r(d),p=function(e){function t(e){o(this,t);var n=a(this,Object.getPrototypeOf(t).call(this,e));return n.portById={},n.inPorts=c.map(n.metadata.inPorts,function(e){var t=this.standardizePort(e);return this.portById[t.id]=t,t},n),n.outPorts=c.map(n.metadata.outPorts,function(e){var t=this.standardizePort(e);return this.portById[t.id]=t,t},n),n}return s(t,e),u(t,[{key:"eachInPort",value:function(e,t){c.forEach(this.inPorts,e,t)}},{key:"eachOutPort",value:function(e,t){c.forEach(this.outPorts,e,t)}},{key:"getInPorts",value:function(){return this.inPorts}},{key:"getOutPorts",value:function(){return this.outPorts}},{key:"getPortById",value:function(e){return this.portById[e]||null}},{key:"isInPort",value:function(e){return c.some(this.inPorts,function(t){return t.id===e.id})}},{key:"isOutPort",value:function(e){return c.some(this.outPorts,function(t){return t.id===e.id})}},{key:"standardizePort",value:function(e){return c.isObject(e)||(e={id:e}),e.id||(e.id=c.uuid()),e}},{key:"getPortMarkup",value:function(){return this.metadata.portMarkup}}]),t}(h["default"]);p.setDefaults({portMarkup:"",view:v["default"],inPorts:[],outPorts:[]}),t["default"]=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);
  return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=function k(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var i=Object.getPrototypeOf(e);return null===i?void 0:k(i,t,n)}if("value"in r)return r.value;var o=r.get;if(void 0!==o)return o.call(n)},f=n(5),h=i(f),d=n(27),v=r(d),p=n(28),y=r(p),g=n(29),m=r(g),b=function(e){function t(){return o(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return s(t,e),l(t,[{key:"renderMarkup",value:function(){return c(Object.getPrototypeOf(t.prototype),"renderMarkup",this).call(this),this.renderPorts(),this}},{key:"renderPorts",value:function(){var e=this.vel,t=this.getCell(),n=t.getInPorts(),r=t.getOutPorts(),i=t.getPortMarkup(),o=e.findOne(t.getPortsWrapSelector(!0)),a=e.findOne(t.getPortsWrapSelector(!1));return o&&(o.empty(),h.forEach(n,function(e){var t=this.compileMarkup(i,e);o.append((0,v["default"])(t))},this)),a&&(a.empty(),h.forEach(r,function(e){var t=this.compileMarkup(i,e);a.append((0,v["default"])(t))},this)),this}},{key:"getConnectionPointOnPort",value:function(){return null}},{key:"getPortBodyBBox",value:function(e){var t=this.getCell(),n=h.isObject(e)?e.id:e;e=t.getPortById(n);var r=t.getPortSelector(e,t.isInPort(e));if(r){var i=this.findOne(r),o=i&&i.findOne(".port-body");if(o)return o.getBBox()}}},{key:"getPortBodyGeom",value:function(e){var t=this.getCell(),n=h.isObject(e)?e.id:e;e=t.getPortById(n);var r=t.getPortSelector(e,t.isInPort(e));if(r){var i=this.findOne(r),o=i&&i.findOne(".port-body"),a=o&&o.node;if(a){var s=o.getBBox(!1,this.getPane()),u=s.getCenter(),l=void 0;if(h.isNode(a,"circle")){var c=h.getComputedStyle(a,"r");c=h.toFloat(c),c&&(l=new y["default"](u.x,u.y,c,c))}else if(h.isNode(a,"ellipse")){var f=h.getComputedStyle(a,"rx"),d=h.getComputedStyle(a,"ry");f=h.toFloat(f),d=h.toFloat(d),f&&d&&(l=new y["default"](u.x,u.y,f,d))}else l=s;return l}}}},{key:"findPortByElem",value:function(e){var t=this,n=t.vel,r=t.cell,i=(0,v["default"])(e),o="pane-port";if(i.hasClass(o)||(i=i.findParent(o,n.node)),i){var a=i.parent();if(a){var s=function(){var e=i.index(),t=a.hasClass("in")?"in":a.hasClass("out")?"out":"",n="in"===t?r.inPorts:"out"===t?r.outPorts:[],o=r.getPortSelector(t,e),s=null;return h.some(n,function(e){return e.selector===o?(s=e,!0):void 0}),{v:s}}();if("object"===("undefined"==typeof s?"undefined":u(s)))return s.v}}return null}}]),t}(m["default"]);t["default"]=b},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(){var e=void 0;do w+=1,e="pane-path-"+w;while(document.getElementById(e));return e}function s(e,t){return{x:t.x*e.a+t.y*e.c,y:t.x*e.b+t.y*e.d}}function u(e){var t=s(e,{x:0,y:1}),n=s(e,{x:1,y:0}),r=180/Math.PI*Math.atan2(t.y,t.x)-90,i=180/Math.PI*Math.atan2(n.y,n.x);return{skewX:r,skewY:i,translateX:e.e,translateY:e.f,scaleX:Math.sqrt(e.a*e.a+e.b*e.b),scaleY:Math.sqrt(e.c*e.c+e.d*e.d),rotation:r}}function l(e){var t=P.isVElement(e)?e:d(e);return y.isArray(t)?t[t.length-1]:t}function c(e,t,n){if(e){var r=y.map(y.isArray(e)?e:[e],function(t){return P.isVElement(t)?t:d(e)});y.forEach(r,t,n)}}function f(e){return new x(e)}function h(e){return e instanceof x?e.node:e}function d(e,t,n){if(!e)return null;if(e instanceof x&&(e=e.node),y.isString(e))if("svg"===e.toLowerCase())e=y.createSvgDocument();else if("<"===e[0]){var r=y.createSvgDocument(e);if(r.childNodes.length>1)return y.map(r.childNodes,function(e){return f(document.importNode(e,!0))});e=document.importNode(r.firstChild,!0)}else e=y.createSvgElement(e);var i=f(e);return t&&i.setAttrs(t),n&&i.append(n),i}Object.defineProperty(t,"__esModule",{value:!0}),t.VElement=void 0;var v=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),p=n(5),y=i(p),g=n(4),m=r(g),b=n(18),k=r(b),w=0,x=t.VElement=function(){function e(t){if(o(this,e),!(this instanceof e))return new e(t);if(t instanceof e&&(t=t.node),!t)throw new Error("Unknown elem for VElement");this.node=t}return v(e,[{key:"attr",value:function(e,t){return y.isUndefined(e)?y.reduce(this.node.attributes,function(e,t){return e[t.nodeName]=t.nodeValue,e},{}):y.isString(e)&&y.isUndefined(t)?this.node.getAttribute(e):(y.isObject(e)?this.setAttrs(e):this.setAttr(e,t),this)}},{key:"setAttr",value:function(e,t){return y.isNil(t)?this.removeAttr(e):y.setAttribute(this.node,e,t),this}},{key:"setAttrs",value:function(e){return y.forIn(e,function(e,t){this.setAttr(t,e)},this),this}},{key:"removeAttr",value:function(e){return y.removeAttribute(this.node,e),this}},{key:"show",value:function(){return y.showHide(this.node,!0),this}},{key:"hide",value:function(){return y.showHide(this.node,!1),this}},{key:"toggle",value:function(e){return y.isBoolean(e)?e?this.show():this.hide():(y.isHidden(this.node)?this.show():this.hide(),this)}},{key:"getClassName",value:function(){return y.getClassName(this.node)}},{key:"hasClass",value:function(e){return y.hasClass(this.node,e)}},{key:"addClass",value:function(e){return y.addClass(this.node,e),this}},{key:"removeClass",value:function(e){return y.removeClass(this.node,e),this}},{key:"toggleClass",value:function(e,t){return y.toggleClass(this.node,e,t),this}},{key:"css",value:function(e,t){return e?(y.setStyle(this.node,e,t),this):this.node.style}},{key:"text",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];e=y.sanitizeText(e);var n=this.attr("y");n||this.attr("y","0.8em"),this.attr("display",e?null:"none"),this.attr("xml:space","preserve"),this.node.textContent="";var r=this.node,i=t.textPath;if(i){var o=this.find("defs");o.length||(o=d("defs"),this.append(o));var s=Object(i)===i,u=s?i.d:i,l=void 0;u&&(l=d("path",{d:u,id:a()}),o.append(l));var c=d("textPath");!i["xlink:href"]&&l&&c.attr("xlink:href","#"+l.node.id),s&&c.attr(i),this.append(c),r=c.node}var f=0,h=e.split("\n"),v=t.lineHeight,p=t.annotations,g=t.includeAnnotationIndices;return p&&(p=y.isArray(p)?p:[p]),v="auto"===v?"1.5em":v||"1em",y.forEach(h,function(e,n){var i=d("tspan",{dy:n?v:"0",x:this.attr("x")||0});i.addClass("pane-text-line"),e?p?!function(){var r=0,o=P.annotateString(e,p,{offset:-f,includeAnnotationIndices:g});y.forEach(o,function(e){var t=void 0;if(y.isObject(e)){var n=y.toInt(e.attrs["font-size"]);n&&n>r&&(r=n),t=d("tspan",e.attrs),g&&t.attr("annotations",e.annotations),e.attrs["class"]&&t.addClass(e.attrs["class"]),t.node.textContent=e.t}else t=document.createTextNode(e||" ");i.append(t)}),"auto"===t.lineHeight&&r&&0!==n&&i.attr("dy",1.2*r+"px")}():i.node.textContent=e:(i.addClass("pane-text-empty"),i.node.style.opacity=0,i.node.textContent="-"),r.appendChild(i.node),f+=e.length+1},this),this}},{key:"html",value:function(e){return this.node.innerHTML=e,this}},{key:"remove",value:function(){return y.removeElement(this.node),this}},{key:"empty",value:function(){return y.emptyElement(this.node),this}},{key:"append",value:function(e){return c(e,function(e){this.node.appendChild(h(e))},this),this}},{key:"prepend",value:function(e){return c(e,function(e){this.node.insertBefore(h(e),this.node.firstChild)},this),this}},{key:"before",value:function(e){return c(e,function(e){this.node.parentNode&&this.node.parentNode.insertBefore(h(e),this.node)},this),this}},{key:"after",value:function(e){return c(e,function(e){this.node.parentNode&&this.node.parentNode.insertBefore(h(e),this.node.nextSibling)},this),this}},{key:"appendTo",value:function(e){return l(e).append(this),this}},{key:"prependTo",value:function(e){return l(e).prepend(this),this}},{key:"insertBefore",value:function(e){return l(e).before(this),this}},{key:"insertAfter",value:function(e){return l(e).after(this),this}},{key:"getSVG",value:function(){return this.node instanceof window.SVGSVGElement?this:f(this.node.ownerSVGElement)}},{key:"getDefs",value:function(){var e=this.getSVG(),t=e.node.getElementsByTagName("defs");return t&&t.length?t=f(t[0]):(t=d("defs"),e.append(t)),t}},{key:"clone",value:function(){var e=f(this.node.cloneNode(!0));return this.node.id&&e.node.removeAttribute("id"),e}},{key:"find",value:function(e){return y.map(this.node.querySelectorAll(e),f)}},{key:"findOne",value:function(e){var t=this.node.querySelector(e);return t?f(t):null}},{key:"findParent",value:function(e,t){for(var n=t||this.node.ownerSVGElement,r=this.node.parentNode;r&&r!==n;){var i=f(r);if(i.hasClass(e))return i;r=r.parentNode}return null}},{key:"parent",value:function(){var e=this.node&&this.node.parentNode;return e?f(e):null}},{key:"index",value:function(){for(var e=0,t=this.node.previousSibling;t;)1===t.nodeType&&e++,t=t.previousSibling;return e}},{key:"translate",value:function(e,t,n){var r=this.attr("transform")||"",i=y.parseTranslate(r);if(y.isUndefined(e))return i;e=n?i.tx+e:e,t=n?i.ty+t:t;var o=y.clearTranslate(r),a="translate("+e+","+t+")";return o&&(a=a+" "+o),this.attr("transform",a),this}},{key:"rotate",value:function(e,t,n,r){var i=this.attr("transform")||"",o=y.parseRotate(i);if(y.isUndefined(e))return o;e%=360;var a=r?o.angle+e:e,s=y.isUndefined(t)||y.isUndefined(n)?"":","+t+","+n,u=y.clearRotate(i),l="rotate("+a+s+")";return u&&(l=u+" "+l),this.attr("transform",l)}},{key:"scale",value:function(e,t,n){var r=this.attr("transform")||"",i=y.parseScale(r);if(y.isUndefined(e))return i;y.isUndefined(t)&&(t=e),e=n?i.sx*e:e,t=n?i.sy*t:t;var o=y.clearScale(r),a="scale("+e+","+t+")";return o&&(a=o+" "+a),this.attr("transform",a)}},{key:"getBBox",value:function(e,t){if(!this.node.ownerSVGElement)return new m["default"](0,0,0,0);var n=void 0;try{n=this.node.getBBox(),n={x:n.x,y:n.y,width:n.width,height:n.height}}catch(r){n={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}if(!e){var i=this.getTransformToElement(t||this.node.ownerSVGElement);n=P.transformRect(n,i)}return m["default"].fromRect(n)}},{key:"toLocalPoint",value:function(e,t){var n=this.getSVG().node,r=n.createSVGPoint();r.x=e,r.y=t;try{var i=r.matrixTransform(n.getScreenCTM().inverse()),o=this.getTransformToElement(n).inverse();return i.matrixTransform(o)}catch(a){return r}}},{key:"getTransformToElement",value:function(e){return y.getTransformToElement(this.node,e)}},{key:"translateCenterToPoint",value:function(e){var t=this.getBBox(),n=t.getCenter();return this.translate(e.x-n.x,e.y-n.y),this}},{key:"translateAndAutoOrient",value:function(e,t,n){var r=this.scale();this.attr("transform",""),this.scale(r.sx,r.sy);var i=this.getSVG().node,o=this.getBBox(!1,n),a=i.createSVGTransform();a.setTranslate(-o.x-o.width/2,-o.y-o.height/2);var s=i.createSVGTransform(),l=k["default"].fromPoint(e).changeInAngle(e.x-t.x,e.y-t.y,t);s.setRotate(l,0,0);var c=i.createSVGTransform(),f=k["default"].fromPoint(e).move(t,o.width/2);c.setTranslate(e.x+(e.x-f.x),e.y+(e.y-f.y));var h=this.getTransformToElement(n),d=i.createSVGTransform();d.setMatrix(c.matrix.multiply(s.matrix.multiply(a.matrix.multiply(h))));var v=u(d.matrix);return this.translate(y.toFixed(v.translateX,2),y.toFixed(v.translateY,2)),this.rotate(y.toFixed(v.rotation,2)),this}},{key:"animateAlongPath",value:function(){}},{key:"sample",value:function t(e){e=e||1;for(var n=this.node.getTotalLength(),r=0,i=[];n>r;){var t=this.node.getPointAtLength(r);i.push({distance:r,x:t.x,y:t.y}),r+=e}return i}},{key:"toPath",value:function(){var e=f(y.createSvgElement("path")),t=this.toPathData();return e.attr(this.attr()),t&&e.attr("d",t),e}},{key:"toPathData",value:function(){var e=this.node.tagName.toLowerCase();if("path"===e)return this.attr("d");var t=y[e+"ToPathData"];if(y.isFunction(t))return t(this.node);throw new Error(e+" cannot be converted to PATH.")}},{key:"findIntersection",value:function(e,t){var n=this,r=n.getSVG().node;t=t||r;var i=m["default"].fromRect(n.getBBox(!1,t)),o=i.getCenter(),a=i.intersectionWithLineFromCenterToPoint(e);if(a){var s=n.node.localName.toUpperCase();if("RECT"===s){var u=new m["default"](parseFloat(this.attr("x")||0),parseFloat(this.attr("y")||0),parseFloat(this.attr("width")),parseFloat(this.attr("height"))),l=n.getTransformToElement(t),c=P.decomposeMatrix(l),f=r.createSVGTransform();f.setRotate(-c.rotation,o.x,o.y);var h=P.transformRect(u,f.matrix.multiply(l));a=m["default"].fromRect(h).intersectionWithLineFromCenterToPoint(e,c.rotation)}else if("PATH"===s||"POLYGON"===s||"POLYLINE"===s||"CIRCLE"===s||"ELLIPSE"===s){for(var d="PATH"===s?n:n.toPath(),v=d.sample(),p=1/0,y=[],g=0,b=v.length;b>g;g++){var w=v[g],x=P.createSVGPoint(w.x,w.y);x=x.matrixTransform(n.getTransformToElement(t)),w=k["default"].fromPoint(x);var O=w.distance(o),_=1.1*w.distance(e),C=O+_;p>C?(p=C,y=[{sample:w,refDistance:_}]):p+1>C&&y.push({sample:w,refDistance:_})}y.sort(function(e,t){return e.refDistance-t.refDistance}),a=y[0].sample}return a}}}]),e}(),P=x.create=d,O=d("svg").node;y.extend(P,{isVElement:function(e){return e instanceof x},createSVGPoint:function(e,t){var n=O.createSVGPoint();return n.x=e,n.y=t,n},createSVGMatrix:function(e){var t=O.createSVGMatrix();for(var n in e)t[n]=e[n];return t},createSVGTransform:function(e){return y.isUndefined(e)?O.createSVGTransform():(e instanceof SVGMatrix||(e=P.createSVGMatrix(e)),O.createSVGTransformFromMatrix(e))},transformRect:function(e,t){var n=O.createSVGPoint();n.x=e.x,n.y=e.y;var r=n.matrixTransform(t);n.x=e.x+e.width,n.y=e.y;var i=n.matrixTransform(t);n.x=e.x+e.width,n.y=e.y+e.height;var o=n.matrixTransform(t);n.x=e.x,n.y=e.y+e.height;var a=n.matrixTransform(t),s=Math.min(r.x,i.x,o.x,a.x),u=Math.max(r.x,i.x,o.x,a.x),l=Math.min(r.y,i.y,o.y,a.y),c=Math.max(r.y,i.y,o.y,a.y);return{x:s,y:l,width:u-s,height:c-l}},annotations:function(e,t,n){t=t||[],t=y.isArray(t)?t:[t],n=n||{};for(var r=[],i=[],o=n.offset||0,a=void 0,s=void 0,u=void 0,l=0,c=e.length;c>l;l++){s=i[l]=e[l];for(var f=0,h=t.length;h>f;f++){var d=t[f],v=d.start+o,p=d.end+o;l>=v&&p>l&&(y.isObject(s)?s.attrs=y.merge({},s.attrs,d.attrs):s=i[l]={t:e[l],attrs:d.attrs},n.includeAnnotationIndices&&(s.annotations||(s.annotations=[]),s.annotations.push(f)))}u=i[l-1],u?y.isObject(s)&&y.isObject(u)?JSON.stringify(s.attrs)===JSON.stringify(u.attrs)?a.t+=s.t:(r.push(a),a=s):y.isObject(s)?(r.push(a),a=s):y.isObject(u)?(r.push(a),a=s):a=(a||"")+s:a=s}return a&&r.push(a),r}}),t["default"]=P},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(4),s=r(a),u=n(18),l=r(u),c=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],n=arguments.length<=1||void 0===arguments[1]?0:arguments[1],r=arguments.length<=2||void 0===arguments[2]?0:arguments[2],o=arguments.length<=3||void 0===arguments[3]?0:arguments[3];i(this,e),this.x=t,this.y=n,this.a=r,this.b=o}return o(e,[{key:"getCenter",value:function(){return new l["default"](this.x,this.y)}},{key:"getBBox",value:function(){return new s["default"](this.x-this.a,this.y-this.b,2*this.a,2*this.b)}},{key:"grow",value:function(e){return this.a+=e,this.b+=e,this}},{key:"intersectionWithLineFromCenterToPoint",value:function(e,t){var n=void 0,r=this.getCenter();t&&e.rotate(r,t);var i=e.x-this.x,o=e.y-this.y;if(0===i)return n=this.getBBox().getNearestPointToPoint(e),t?n.rotate(r,-t):n;var a=o/i,s=a*a,u=this.a*this.a,c=this.b*this.b,f=Math.sqrt(1/(1/u+s/c));f=0>i?-f:f;var h=a*f;return n=new l["default"](this.x+f,this.y+h),t?n.rotate(r,-t):n}},{key:"equals",value:function(t){return e.equals(this,t)}},{key:"valueOf",value:function(){return[this.x,this.y,this.a,this.b]}},{key:"toString",value:function(){return this.valueOf().join(", ")}},{key:"clone",value:function(){return e.fromEllipse(this)}}],[{key:"equals",value:function(e,t){return this.isEllipse(e)&&this.isEllipse(t)&&e.x===t.x&&e.y===t.y&&e.a===t.a&&e.b===t.b}},{key:"fromEllipse",value:function(t){return new e(t.x,t.y,t.a,t.b)}},{key:"isEllipse",value:function(t){return t&&t instanceof e}}]),e}();t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(30),h=r(f),d=function(e){function t(){return o(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return s(t,e),u(t,[{key:"render",value:function(){return this.vel.empty(),this.renderMarkup(),this.scalableNode=this.findOne(".pane-scalable"),this.rotatableNode=this.findOne(".pane-rotatable"),this.update().resize().rotate().translate()}},{key:"update",value:function(e){var n=this.cell.attrs,r=this.rotatableNode,i=void 0;r&&(i=r.attr("transform"),r.attr("transform",""));var o={},a=[];c.forIn(e||n,function(e,n){var r=this.find(n);if(r.length){o[n]=r;var i=t.specialAttributes.slice();c.isObject(e.filter)&&(i.push("filter"),this.applyFilter(r,e.filter)),c.isObject(e.fill)&&(i.push("fill"),this.applyGradient(r,"fill",e.fill)),c.isObject(e.stroke)&&(i.push("stroke"),this.applyGradient(r,"stroke",e.stroke)),c.isNil(e.text)||(i.push("lineHeight","textPath","annotations"),c.forEach(r,function(t){t.text(e.text,{textPath:e.textPath,lineHeight:e.lineHeight,annotations:e.annotations})}));var s={};c.forIn(e,function(e,t){c.contains(i,t)||(s[t]=e)}),c.isEmptyObject(s)||c.forEach(r,function(e){e.attr(s)}),c.isNil(e.html)||c.forEach(r,function(t){t.node.innerHTML=e.html});var u=c.some(["ref-x","ref-y","ref-dx","ref-dy","x-alignment","y-alignment","ref-width","ref-height"],function(t){return!c.isNil(e[t])});u&&a.push(n)}},this);var s=this.cell.size,u={x:0,y:0,width:s.width,height:s.height};return c.forEach(a,function(t){var r=n[t],i=e&&e[t];i&&(r=c.merge({},r,i)),c.forEach(o[t],function(e){this.positionRelative(e,u,r,o)},this)},this),r&&r.attr("transform",i||""),this}},{key:"positionRelative",value:function(e,t,n,r){var i=n.ref;if(i){var o=r&&r[i];if(o=o?o[0]:"."===i?this.vel:this.vel.findOne(i),!o)throw new Error("NodeView: reference does not exists.");t=o.getBBox(!1,this.elem)}var a=c.toFloat(n["ref-dx"]),s=c.toFloat(n["ref-dy"]),u=n["y-alignment"],l=n["x-alignment"],f=n["ref-x"],h=c.isPercentage(f);f=c.toFloat(f,h);var d=n["ref-y"],v=c.isPercentage(d);d=c.toFloat(d,v);var p=n["ref-width"],y=c.isPercentage(p);p=c.toFloat(p,y);var g=n["ref-height"],m=c.isPercentage(g);g=c.toFloat(g,m),c.isFinite(p)&&(y||p>=0&&1>=p?e.attr("width",c.toFixed(p*t.width,2)):e.attr("width",Math.max(c.toFixed(p+t.width,2),0))),c.isFinite(g)&&(m||g>=0&&1>=g?e.attr("height",c.toFixed(g*t.height,2)):e.attr("height",Math.max(c.toFixed(g+t.height,2),0)));var b=e.findParent("pane-scalable",this.elem),k=e.attr("transform");k&&e.attr("transform",c.clearTranslate(k));var w=0,x=0,P=void 0;if(c.isFinite(a)&&(b?(P=b.scale(),w=t.x+t.width+a/P.sx):w=t.x+t.width+a),c.isFinite(s)&&(b?(P=P||b.scale(),x=t.y+t.height+s/P.sy):x=t.y+t.height+s),c.isFinite(f)&&(h||f>0&&1>f?w=t.x+t.width*f:b?(P=P||b.scale(),w=t.x+f/P.sx):w=t.x+f),c.isFinite(d)&&(h||d>0&&1>d?x=t.y+t.height*d:b?(P=P||b.scale(),x=t.y+d/P.sy):x=t.y+d),!c.isNil(u)||!c.isNil(l)){var O=e.getBBox(!1,this.getPane());"middle"===u?x-=O.height/2:c.isFinite(u)&&(x+=u>-1&&1>u?O.height*u:u),"middle"===l?w-=O.width/2:c.isFinite(l)&&(w+=l>-1&&1>l?O.width*l:l)}return e.translate(c.toFixed(w,2),c.toFixed(x,2)),this}},{key:"scale",value:function(e,t){return this.vel.scale(e,t),this}},{key:"resize",value:function(){if(!this.scalableNode)return this;var e=this.scalableNode.getBBox(!0),t=this.cell.getSize(),n=t.width/(e.width||1),r=t.height/(e.height||1);return n=c.toFixed(n,2),r=c.toFixed(r,2),this.scalableNode.attr("transform","scale("+n+","+r+")"),this.update(),this}},{key:"rotate",value:function(){if(this.rotatableNode){var e=this.cell.getSize(),t=e.width/2,n=e.height/2;this.rotatableNode.attr("transform","rotate("+this.cell.getRotation()+","+t+","+n+")")}return this}},{key:"translate",value:function(){var e=this.cell.getPosition();return this.vel.attr("transform","translate("+e.x+","+e.y+")"),this}},{key:"getBBox",value:function(){return this.vel.getBBox()}},{key:"getStrokeWidth",value:function(){var e=this.findOne("rect")||this.findOne("path")||this.findOne("circle")||this.findOne("ellipse")||this.findOne("polyline")||this.findOne("polygon");if(e&&e.node){var t=c.getComputedStyle(e.node,"stroke-width");return t&&c.toFloat(t)||0}return 0}},{key:"getStrokedBBox",value:function(){var e=this.getStrokeWidth()-1,t=this.getCell().getBBox();return e?t.grow(e/2):t}},{key:"getConnectionPointOnBorder",value:function(){return null}}],[{key:"specialAttributes",get:function(){return["text","html","style","ref","ref-x","ref-y","ref-dx","ref-dy","ref-width","ref-height","x-alignment","y-alignment"]}}]),t}(h["default"]);t["default"]=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(27),h=r(f),d=n(31),v=r(d),p=n(32),y=r(p),g=function(e){function t(){return o(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return s(t,e),u(t,[{key:"ensureElement",value:function(){this.vel=(0,h["default"])(this.cell.getTagName(),{"class":this.cell.getClassName()}),this.elem=this.vel.node,this.elem.cellId=this.cell.id;var e=this.getPane();return e&&e.appendChild(this.elem),this}},{key:"renderMarkup",value:function(){var e=this.compileMarkup(this.cell.getMarkup(),this.cell.data);if(!e)throw new Error("`markup` is missing while the default `render()` implementation is used.");return this.vel.append((0,h["default"])(e)),this}},{key:"find",value:function(e){return"."===e?[this.vel]:this.vel.find(e)}},{key:"findOne",value:function(e){return"."===e?this.vel:this.vel.findOne(e)}},{key:"applyAttr",value:function(e,t){return t&&c.forEach(this.find(e),function(e){e.attr(t)}),this}},{key:"applyFilter",value:function(e,t){if(!t)return this;var n=t.name||"",r=t.args||{},i=t.attrs,o=v["default"][n];if(!n||!o)throw new Error('Invalided filter: "'+n+'"');var a=c.isString(e)?this.find(e):e;if(!a.length)return this;var s=this.paper.svg,u=c.hashCode(JSON.stringify(t)),l=n+"-"+this.paper.id+"-"+u;if(!s.getElementById(l)){var f=(0,h["default"])(o(r));f.attr({filterUnits:"objectBoundingBox",x:-1,y:-1,width:3,height:3}),i&&f.attr(i),f.node.id=l,(0,h["default"])(s).getDefs().append(f)}return c.forEach(a,function(e){e.attr("filter","url(#"+l+")")}),this}},{key:"applyGradient",value:function(e,t,n){if(!t||!n)return this;var r=n.type,i=n.stops,o=n.attrs;if(!r||!i||!i.length)return this;var a=c.isString(e)?this.find(e):e;if(!a.length)return this;var s=this.paper.svg,u=r+"-"+this.paper.id+"-"+c.hashCode(JSON.stringify(n));if(!s.getElementById(u)){var l=["<"+r+">",c.map(i,function(e){return'<stop offset="'+e.offset+'" stop-color="'+e.color+'" stop-opacity="'+(c.isFinite(e.opacity)?e.opacity:1)+'" />'}).join(""),"</"+r+">"].join(""),f=(0,h["default"])(l);o&&f.attr(o),f.node.id=u,(0,h["default"])(s).getDefs().append(f)}return c.forEach(a,function(e){e.attr(t,"url(#"+u+")")}),this}}]),t}(y["default"]);t["default"]=g},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}Object.defineProperty(t,"__esModule",{value:!0});var i=n(5),o=r(i),a=o.format,s=o.isFinite;t["default"]={outline:function(e){var t='<filter>  <feFlood flood-color="${color}" flood-opacity="${opacity}" result="colored"/>  <feMorphology in="SourceAlpha" result="morphedOuter" operator="dilate" radius="${outerRadius}" />  <feMorphology in="SourceAlpha" result="morphedInner" operator="dilate" radius="${innerRadius}" />  <feComposite result="morphedOuterColored" in="colored" in2="morphedOuter" operator="in"/>  <feComposite operator="xor" in="morphedOuterColored" in2="morphedInner" result="outline"/>  <feMerge>    <feMergeNode in="outline"/>    <feMergeNode in="SourceGraphic"/>  </feMerge></filter>',n=s(e.margin)?e.margin:2,r=s(e.width)?e.width:1;return a(t,{color:e.color||"blue",opacity:s(e.opacity)?e.opacity:1,outerRadius:n+r,innerRadius:n})},highlight:function(e){var t='<filter>  <feFlood flood-color="${color}" flood-opacity="${opacity}" result="colored"/>  <feMorphology result="morphed" in="SourceGraphic" operator="dilate" radius="${width}"/>  <feComposite result="composed" in="colored" in2="morphed" operator="in"/>  <feGaussianBlur result="blured" in="composed" stdDeviation="${blur}"/>   <feBlend in="SourceGraphic" in2="blured" mode="normal"/></filter>';return a(t,{color:e.color||"red",width:s(e.width)?e.width:1,blur:s(e.blur)?e.blur:0,opacity:s(e.opacity)?e.opacity:1})},blur:function(e){var t='<filter>  <feGaussianBlur stdDeviation="${stdDeviation}"/></filter>',n=s(e.x)?e.x:2;return a(t,{stdDeviation:s(e.y)?[n,e.y]:n})},dropShadow:function(e){var t="SVGFEDropShadowElement"in window?'<filter><feDropShadow stdDeviation="${blur}" dx="${dx}" dy="${dy}" flood-color="${color}" flood-opacity="${opacity}"/></filter>':'<filter><feGaussianBlur in="SourceAlpha" stdDeviation="${blur}"/><feOffset dx="${dx}" dy="${dy}" result="offsetblur"/><feFlood flood-color="${color}"/><feComposite in2="offsetblur" operator="in"/><feComponentTransfer><feFuncA type="linear" slope="${opacity}"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge></filter>';return a(t,{dx:e.dx||0,dy:e.dy||0,opacity:s(e.opacity)?e.opacity:1,color:e.color||"black",blur:s(e.blur)?e.blur:4})},grayScale:function(e){var t='<filter>  <feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${b} ${h} 0 0 0 0 0 1 0"/></filter>',n=s(e.amount)?e.amount:1;return a(t,{a:.2126+.7874*(1-n),b:.7152-.7152*(1-n),c:.0722-.0722*(1-n),d:.2126-.2126*(1-n),e:.7152+.2848*(1-n),f:.0722-.0722*(1-n),g:.2126-.2126*(1-n),h:.0722+.9278*(1-n)})},sepia:function(e){var t='<filter>  <feColorMatrix type="matrix" values="${a} ${b} ${c} 0 0 ${d} ${e} ${f} 0 0 ${g} ${h} ${i} 0 0 0 0 0 1 0"/></filter>',n=s(e.amount)?e.amount:1;return a(t,{a:.393+.607*(1-n),b:.769-.769*(1-n),c:.189-.189*(1-n),d:.349-.349*(1-n),e:.686+.314*(1-n),f:.168-.168*(1-n),g:.272-.272*(1-n),h:.534-.534*(1-n),i:.131+.869*(1-n)})},saturate:function(e){var t='<filter>  <feColorMatrix type="saturate" values="${amount}"/></filter>',n=s(e.amount)?e.amount:1;return a(t,{amount:1-n})},hueRotate:function(e){var t='<filter>  <feColorMatrix type="hueRotate" values="${angle}"/></filter>';return a(t,{angle:e.angle||0})},invert:function(e){var t='<filter>  <feComponentTransfer>    <feFuncR type="table" tableValues="${amount} ${amount2}"/>    <feFuncG type="table" tableValues="${amount} ${amount2}"/>    <feFuncB type="table" tableValues="${amount} ${amount2}"/>  </feComponentTransfer></filter>',n=s(e.amount)?e.amount:1;return a(t,{amount:n,amount2:1-n})},brightness:function(e){var t='<filter>  <feComponentTransfer>    <feFuncR type="linear" slope="${amount}"/>    <feFuncG type="linear" slope="${amount}"/>    <feFuncB type="linear" slope="${amount}"/>  </feComponentTransfer></filter>';return a(t,{amount:s(e.amount)?e.amount:1})},contrast:function(e){var t='<filter>  <feComponentTransfer>    <feFuncR type="linear" slope="${amount}" intercept="${amount2}"/>    <feFuncG type="linear" slope="${amount}" intercept="${amount2}"/>    <feFuncB type="linear" slope="${amount}" intercept="${amount2}"/>  </feComponentTransfer></filter>',n=s(e.amount)?e.amount:1;return a(t,{amount:n,amount2:.5-n/2})}}},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(5),s=r(a),u=function(){function e(t,n){i(this,e),this.cell=n,this.paper=t,this.invalid=!0,this.ensureElement()}return o(e,[{key:"ensureElement",value:function(){return this}},{key:"render",value:function(){return this}},{key:"update",value:function(){return this}},{key:"compileMarkup",value:function(e,t){return s.isFunction(e)?e(t):s.format(e,t)}},{key:"getCell",value:function(){return this.cell}},{key:"getPaper",value:function(){return this.paper}},{key:"getModel",value:function(){return this.paper&&this.paper.getModel()}},{key:"getPane",value:function(){
  var e=void 0,t=this.cell.metadata.pane;return t&&(s.isString(t)?e=this.paper[t]:s.isNode(t)&&(e=t)),e||this.paper.drawPane}},{key:"destroy",value:function(){s.removeElement(this.elem),s.destroy(this)}}]),e}();t["default"]=u},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({markup:'<g class="pane-rotatable"><g class="pane-scalable"><image/></g><text/></g>',attrs:{".":{fill:"#ffffff",stroke:"none"},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({markup:'<g class="pane-rotatable"><g class="pane-scalable"><circle/></g><text/></g>',size:{width:60,height:60},attrs:{".":{fill:"#ffffff",stroke:"none"},circle:{fill:"#ffffff",stroke:"#000000",r:30,cx:30,cy:30},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-y":.5,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(22),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({attrs:{path:{d:"M 30 0 L 60 30 30 60 0 30 z"},text:{"ref-y":.5,"y-alignment":"middle"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({markup:'<g class="pane-rotatable"><g class="pane-scalable"><ellipse/></g><text/></g>',size:{width:60,height:40},attrs:{".":{fill:"#ffffff",stroke:"none"},ellipse:{fill:"#ffffff",stroke:"#000000",rx:30,ry:20,cx:30,cy:20},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-y":.5,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({markup:'<g class="pane-rotatable"><g class="pane-scalable"><polygon/></g><text/></g>',size:{width:60,height:40},attrs:{".":{fill:"#ffffff",stroke:"none"},polygon:{fill:"#ffffff",stroke:"#000000"},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({markup:'<g class="pane-rotatable"><g class="pane-scalable"><polyline/></g><text/></g>',size:{width:60,height:40},attrs:{".":{fill:"#ffffff",stroke:"none"},polyline:{fill:"#ffffff",stroke:"#000000"},text:{"font-size":14,text:"","text-anchor":"middle","ref-x":.5,"ref-dy":20,"y-alignment":"middle",fill:"#000000","font-family":"Arial, helvetica, sans-serif"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({markup:'<g class="pane-rotatable"><g class="pane-scalable"><rect/></g><a><text/></a></g>',attrs:{".":{fill:"#fff",stroke:"none"},rect:{fill:"#fff",stroke:"#000","stroke-width":"1",width:80,height:30},text:{fill:"#000","font-size":12,"ref-x":.5,"ref-y":.5,"text-anchor":"middle","y-alignment":"middle","font-family":"Arial, helvetica, sans-serif"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=n(3),u=r(s),l=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),t}(u["default"]);l.setDefaults({markup:'<a><g class="pane-rotatable"><g class="pane-scalable"><rect/></g><text/></g></a>',attrs:{".":{fill:"#fff",stroke:"none"},rect:{fill:"#fff",stroke:"#000","stroke-width":"1",width:80,height:30},text:{fill:"#000","font-size":12,"ref-x":.5,"ref-y":.5,"text-anchor":"middle","y-alignment":"middle","font-family":"Arial, helvetica, sans-serif"}}}),t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.changes=void 0;var i=n(42),o=r(i),a=n(43),s=r(a),u=n(44),l=r(u),c=n(45),f=r(c),h=n(46),d=r(h),v=n(47),p=r(v),y=n(48),g=r(y),m={Change:o["default"],RootChange:s["default"],ChildChange:l["default"],VisibleChange:f["default"],TerminalChange:d["default"],GeometryChange:p["default"],ChangeCollection:g["default"]};t.changes=m},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){n(this,e)}return r(e,[{key:"digest",value:function(){return this}}]),e}();t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(42),l=r(u),c=function(e){function t(e,n){i(this,t);var r=o(this,Object.getPrototypeOf(t).call(this));return r.model=e,r.root=n,r.previous=n,r}return a(t,e),s(t,[{key:"digest",value:function(){return this.root=this.previous,this.previous=this.model.rootChanged(this.previous),this}}]),t}(l["default"]);t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(42),l=r(u),c=function(e){function t(e,n,r,a){i(this,t);var s=o(this,Object.getPrototypeOf(t).call(this));return s.model=e,s.child=n,s.parent=r,s.index=a,s.previous=r,s.previousIndex=a,s}return a(t,e),s(t,[{key:"digest",value:function(){var e=this.model,t=this.child,n=this.previous,r=this.previousIndex,i=t.parent,o=i?i.indexOfChild(t):0;return n||this.disConnect(t,!1),i=e.childChanged(t,n,r),this.parent=n,this.index=r,this.previous=i,this.previousIndex=o,this}},{key:"disConnect",value:function(e){if(e.isLink()){var t=e.getTerminal(!0),n=e.getTerminal(!1);t&&this.model.terminalChanged(e,null,!0),n&&this.model.terminalChanged(e,null,!1)}return e.eachChild(function(e){this.disConnect(e)},this),this}}]),t}(l["default"]);t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(42),l=r(u),c=function(e){function t(e,n,r){i(this,t);var a=o(this,Object.getPrototypeOf(t).call(this));return a.model=e,a.cell=n,a.visible=r,a.previous=r,a}return a(t,e),s(t,[{key:"digest",value:function(){return this.visible=this.previous,this.previous=this.model.visibleChanged(this.cell,this.previous),this}}]),t}(l["default"]);t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(42),l=r(u),c=function(e){function t(e,n,r,a){i(this,t);var s=o(this,Object.getPrototypeOf(t).call(this));return s.model=e,s.link=n,s.terminal=r,s.previous=r,s.isSource=a,s}return a(t,e),s(t,[{key:"digest",value:function(){return this.terminal=this.previous,this.previous=this.model.terminalChanged(this.link,this.terminal,this.isSource),this}}]),t}(l["default"]);t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(42),l=r(u),c=function(e){function t(e,n,r){i(this,t);var a=o(this,Object.getPrototypeOf(t).call(this));return a.model=e,a.cell=n,a.geometry=r,a.previous=r,a}return a(t,e),s(t,[{key:"digest",value:function(){return this.geometry=this.previous,this.previous=this.model.geometryChanged(this.cell,this.previous),this}}]),t}(l["default"]);t["default"]=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){n(this,e),this.model=t,this.changes=[]}return r(e,[{key:"hasChange",value:function(){return!!this.changes.length}},{key:"getChanges",value:function(){return this.changes}},{key:"add",value:function(e){return e&&this.changes.push(e),this}},{key:"clear",value:function(){return this.changes=[],this}},{key:"notify",value:function(){return this.model.trigger("change",this.changes),this}}]),e}();t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),t.geometry=void 0;var i=n(18),o=r(i),a=n(19),s=r(a),u=n(4),l=r(u),c=n(28),f=r(c),h=n(50),d=r(h),v={Point:o["default"],Line:s["default"],Rect:l["default"],Ellipse:f["default"],bezier:d["default"]};t.geometry=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){var t=a(e),n=["M",e[0].x,e[0].y];l.forEach(t[0],function(){});for(var r=0;r<t[0].length;r++)n.push("C",t[0][r].x,t[0][r].y,t[1][r].x,t[1][r].y,e[r+1].x,e[r+1].y);return n}function a(e){var t=[],n=[],r=e.length-1;if(1===r)return t[0]=new f["default"]((2*e[0].x+e[1].x)/3,(2*e[0].y+e[1].y)/3),n[0]=new f["default"](2*t[0].x-e[0].x,2*t[0].y-e[0].y),[t,n];for(var i=[],o=1;r-1>o;o++)i[o]=4*e[o].x+2*e[o+1].x;i[0]=e[0].x+2*e[1].x,i[r-1]=(8*e[r-1].x+e[r].x)/2;for(var a=s(i),u=1;r-1>u;++u)i[u]=4*e[u].y+2*e[u+1].y;i[0]=e[0].y+2*e[1].y,i[r-1]=(8*e[r-1].y+e[r].y)/2;for(var l=s(i),c=0;r>c;c++)t.push(new f["default"](a[c],l[c])),r-1>c?n.push(new f["default"](2*e[c+1].x-a[c+1],2*e[c+1].y-l[c+1])):n.push(new f["default"]((e[r].x+a[r-1])/2,(e[r].y+l[r-1])/2));return[t,n]}function s(e){var t=e.length,n=[],r=[],i=2;n[0]=e[0]/i;for(var o=1;t>o;o++)r[o]=1/i,i=(t-1>o?4:3.5)-r[o],n[o]=(e[o]-n[o-1])/i;for(var a=1;t>a;a++)n[t-a-1]-=r[t-a]*n[t-a];return n}Object.defineProperty(t,"__esModule",{value:!0}),t.curveThroughPoints=t.getCurveControlPoints=void 0;var u=n(5),l=i(u),c=n(18),f=r(c);t.getCurveControlPoints=a,t.curveThroughPoints=o},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t,n){for(var r=!0,i=0,o=e.length;o>i;i+=2)r=u.invoke(e[i],t,e[i+1]||n)!==!1&&r;return r}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(5),u=r(s),l=function(){function e(){i(this,e)}return a(e,[{key:"on",value:function(e,t,n){if(!t)return this;var r=this.__events||(this.__events={});return u.forEach(u.split(e),function(e){var i=r[e]||(r[e]=[]);i.push(t,n)}),this}},{key:"once",value:function(e,t,n){var r=this,i=function o(){r.off(e,o),t.apply(n||r,arguments)};return this.on(e,i,n)}},{key:"off",value:function(e,t,n){var r=this.__events;return r?e||t||n?(e=e?u.split(e):u.keys(r),u.forEach(e,function(e){var i=r[e];if(i){if(!t&&!n)return void delete r[e];for(var o=i.length-2;o>=0;o-=2)t&&i[o]!==t||n&&i[o+1]!==n||i.splice(o,2)}}),this):(delete this.__events,this):this}},{key:"trigger",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];var i=this.__events;if(!i||!e)return null;var a=!0,s=i["*"];return u.forEach(u.split(e),function(e){var t=void 0;"*"!==e&&(t=i[e],t&&(a=o(t,n,this)&&a)),s&&(a=o(s,[e].concat(n),this)&&a)},this),a}}]),e}();t["default"]=l},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(51),h=r(f),d=n(20),v=r(d),p=n(21),y=r(p),g=n(43),m=r(g),b=n(53),k=r(b),w=n(44),x=r(w),P=n(45),O=r(P),_=n(54),C=r(_),M=n(55),j=r(M),T=n(46),E=r(T),S=n(47),N=r(S),B=n(56),V=r(B),R=n(48),A=r(R),L=function(e){function t(e){o(this,t);var n=a(this,Object.getPrototypeOf(t).call(this));return n.nextId=0,n.updateLevel=0,n.endingUpdate=!1,n.changes=new A["default"](n),e?n.setRoot(e):n.clear(),n}return s(t,e),u(t,[{key:"clear",value:function(){return this.setRoot(this.createRoot())}},{key:"getDefaultParent",value:function(){return this.getRoot().getChildAt(0)}},{key:"isOrphan",value:function(e){return e&&e.isOrphan()}},{key:"isAncestor",value:function(e,t){return e&&e.isAncestor(t)}},{key:"contains",value:function(e,t){return t||(t=e,e=this.root),this.isAncestor(e,t)}},{key:"getAncestors",value:function(e){return e?e.getAncestors():[]}},{key:"getDescendants",value:function(e){return e?e.getDescendants():[]}},{key:"getParents",value:function(){}},{key:"getCellById",value:function(e){return this.cells?this.cells[e]:null}},{key:"findCellAtPoint",value:function(e){var t=this,n=[];return e&&this.eachCell(function(r){if(t.isNode(r)){var i=r.getBBox();i&&i.containsPoint(e)&&n.push(r)}},this),n}},{key:"findCellInArea",value:function(e){var t=this,n=[];return e&&this.eachCell(function(r){if(t.isNode(r)){var i=r.getBBox();i&&e.containsRect(i)&&n.push(r)}},this),n}},{key:"createCellId",value:function(){var e=this.nextId;return this.nextId+=1,"cell-"+e}},{key:"isRoot",value:function(e){return e&&this.root===e}},{key:"createRoot",value:function(){var e=new v["default"];return e.insertChild(this.createLayer(),{silent:!0}),e}},{key:"getRoot",value:function(e){for(var t=this.root;e;)t=e,e=e.parent;return t}},{key:"setRoot",value:function(e){return this.digest(new m["default"](this,e))}},{key:"rootChanged",value:function(e){var t=this.root;return this.root=e,this.cells=null,this.nextId=0,this.cellAdded(e),t}},{key:"isLayer",value:function(e){return e&&this.isRoot(e.parent)}},{key:"getLayers",value:function(){return this.getRoot().children||[]}},{key:"createLayer",value:function(){return new v["default"]}},{key:"eachLayer",value:function(e,t){return c.forEach(this.getLayers(),e,t)}},{key:"addNode",value:function(e,t,n){return this.addCells([e],t,n)}},{key:"addLink",value:function(e,t,n,r,i){return this.addCells([e],r,i,t,n)}},{key:"addCell",value:function(e,t,n,r,i){return this.addCells([e],t,n,r,i)}},{key:"addCells",value:function(e,t,n,r,i){var o=this;t=t||this.getDefaultParent(),n=c.fixIndex(n,t.getChildCount()),this.beginUpdate();try{c.forEach(e,function(e){e&&(e!==t&&(o.setParent(e,t,n),n++),r&&o.setTerminal(e,r,!0),i&&o.setTerminal(e,i,!1))},this)}finally{this.endUpdate()}return this}},{key:"removeCell",value:function(e){return e&&(this.isRoot(e)?this.setRoot(null):this.getParent(e)&&this.digest(new x["default"](this,e,null))),e}},{key:"getParent",value:function(e){return e?e.parent:null}},{key:"setParent",value:function(e,t,n){if(e)if(t)try{this.beginUpdate(),this.digest(new x["default"](this,e,t,n))}finally{this.endUpdate()}else this.removeCell(e);return this}},{key:"childChanged",value:function(e,t,n){var r=this.getParent(e);return t?t===r&&r.indexOfChild(e)===n||t.insertChild(e,n,{silent:!0}):r&&r.removeChild(e,{silent:!0}),t?this.contains(r)||this.cellAdded(e):this.cellRemoved(e),r}},{key:"cellAdded",value:function(e){if(e){var t=e.getId()||this.createCellId(e);if(t){var n=this.getCellById(t);if(n!==e){for(;n;)t=this.createCellId(e),n=this.getCellById(t);this.cells||(this.cells={}),e.setId(t),this.cells[t]=e}}c.isNumeric(t)&&(this.nextId=Math.max(this.nextId,t)),e.setModel(this),e.eachChild(this.cellAdded,this)}}},{key:"cellRemoved",value:function(e){var t=this;if(e){e.eachChild(function(e){t.cellRemoved(e)},this);var n=e.getId();this.cells&&n&&delete this.cells[n],e.setModel(null)}}},{key:"updateLinkParents",value:function(e,t){var n=this;t=t||this.getRoot(e),e.eachChild(function(e){n.updateLinkParents(e,t)},this),e.eachLink(function(e){n.isAncestor(t,e)&&n.updateLinkParent(e,t)},this)}},{key:"updateLinkParent",value:function(e,t){for(var n=this,r=null,i=e.getTerminal(!0),o=e.getTerminal(!1);i&&!i.isLink()&&i.geometry&&i.geometry.relative;)i=i.parent;for(;o&&!o.isLink()&&o.geometry&&o.geometry.relative;)o=o.parent;if(n.isAncestor(t,i)&&n.isAncestor(t,o)&&(r=i===o?i.parent:n.getNearestCommonAncestor(i,o),r&&(r.parent!==n.viewport||n.isAncestor(r,e))&&e.parent!==r)){var a=e.geometry;if(a){var s=n.getOrigin(e.parent),u=n.getOrigin(r),l=u.x-s.x,c=u.y-s.y;a=a.clone(),a.translate(-l,-c),n.setGeometry(e,a)}n.add(r,e)}}},{key:"getNearestCommonAncestor",value:function(){return null}},{key:"eachCell",value:function(e,t){this.cells&&e&&c.isFunction(e)&&c.forIn(this.cells,function(n,r){e.call(t,n,r)})}},{key:"filterCell",value:function(e,t){var n=[];return this.cells&&e&&c.isFunction(e)&&c.forIn(this.cells,function(r,i){e.call(t,r,i)&&n.push(r)}),n}},{key:"eachNode",value:function(e,t){var n=this,r=this.filterCell(function(e){return n.isNode(e)},this);return c.forEach(r,e,t)}},{key:"eachLink",value:function(e,t){var n=this,r=this.filterCell(function(e){return n.isLink(e)},this);return c.forEach(r,e,t)}},{key:"getChildNodes",value:function(e){return this.getChildCells(e,!0,!1)}},{key:"getChildLinks",value:function(e){return this.getChildCells(e,!1,!0)}},{key:"eachChildNode",value:function(e,t,n){c.forEach(this.getChildNodes(e),t,n)}},{key:"eachChildLink",value:function(e,t,n){c.forEach(this.getChildLinks(e),t,n)}},{key:"getChildCells",value:function(e,t,n){return e?e.filterChild(function(e){return t&&e.isNode()||n&&e.isLink()}):[]}},{key:"indexOfChild",value:function(e,t){return e?e.indexOfChild(t):-1}},{key:"getChildAt",value:function(e,t){return e?e.getChildAt(t):null}},{key:"getChildren",value:function(e){return e?e.children:null}},{key:"getChildCount",value:function(e){return e?e.getChildCount():0}},{key:"isNode",value:function(e){return e?e.isNode():!1}},{key:"getLinkCount",value:function(e){return e?e.getLinkCount():0}},{key:"indexOfLink",value:function(e,t){return e?e.indexOfLink(t):-1}},{key:"getLinkAt",value:function(e,t){return e?e.getLinkAt(t):null}},{key:"isLink",value:function(e){return e?e.isLink():!1}},{key:"getTerminal",value:function(e,t){return e?e.getTerminal(t):null}},{key:"getTerminalNode",value:function(e,t){return e?e.getTerminalNode(t):null}},{key:"getTerminalPort",value:function(e,t){return e?e.getTerminalPort(t):null}},{key:"getTerminalPoint",value:function(e,t){return e?e.getTerminalPoint(t):null}},{key:"setTerminal",value:function(e,t,n){if(e)try{this.beginUpdate(),this.digest(new E["default"](this,e,new y["default"](t),n))}finally{this.endUpdate()}return this}},{key:"setTerminalNode",value:function(e,t,n){return e&&this.setTerminal(e,t,n),this}},{key:"setTerminalPort",value:function(e,t,n){if(e){var r=this.getTerminal(e,n);r=r?r.duplicate({port:t}):new y["default"]({port:t}),this.setTerminal(e,r,n)}return this}},{key:"setTerminalPoint",value:function(e,t,n){return e&&this.setTerminal(e,t,n),this}},{key:"setTerminals",value:function(e,t,n){this.beginUpdate();try{this.setTerminal(e,t,!0),this.setTerminal(e,n,!1)}finally{this.endUpdate()}return this}},{key:"removeFromTerminal",value:function(e,t){return e&&this.setTerminal(e,null,t),this}},{key:"terminalChanged",value:function(e,t,n){var r=this.getTerminal(e,n);return t?t.addLink(e,n,{silent:!0}):r&&r.removeLink(e,n,{silent:!0}),r}},{key:"isVisible",value:function(e){return e?e.isVisible():!1}},{key:"setVisible",value:function(e,t){if(e&&t!==this.isVisible(e))try{this.beginUpdate(),this.digest(new O["default"](this,e,t))}finally{this.endUpdate()}return this}},{key:"visibleChanged",value:function(e,t){var n=this.isVisible(e);return e.setVisible(t,{silent:!0}),n}},{key:"getAttribute",value:function(e){return e?e.getAttribute():null}},{key:"setAttribute",value:function(e,t){if(e)try{this.beginUpdate(),this.digest(new V["default"](this,e,t))}finally{this.endUpdate()}return this}},{key:"attributeChanged",value:function(e,t){var n=this.getAttribute(e);return e.setAttribute(t,{silent:!0}),n}},{key:"getPosition",value:function(e,t){return e?e.getPosition(t):null}},{key:"setPosition",value:function(e,t){if(e&&t){var n=e.getPosition(!0)||{};if(t.relative=t.relative===!0,n.relative=n.relative===!0,n.x!==t.x||n.y!==t.y||n.relative!==t.relative)try{this.beginUpdate(),this.digest(new C["default"](this,e,{x:t.x,y:t.y,relative:t.relative}))}finally{this.endUpdate()}}return this}},{key:"positionChanged",value:function(e,t){var n=e.getPosition(!0);return e.setPosition(t,{silent:!0}),n}},{key:"getSize",value:function(e,t){return e?e.getSize(t):null}},{key:"setSize",value:function(e,t){if(e&&t){var n=e.getSize(!0)||{};if(t.relative=t.relative===!0,n.relative=n.relative===!0,n.width!==t.width||n.height!==t.height||n.relative!==t.relative)try{this.beginUpdate(),this.digest(new k["default"](this,e,{width:t.width,height:t.height,
  relative:t.relative}))}finally{this.endUpdate()}}return this}},{key:"sizeChanged",value:function(e,t){var n=e.getSize(!0);return e.setSize(t,{silent:!0}),n}},{key:"getRotation",value:function(e,t){return e?e.getRotation(t):null}},{key:"setRotation",value:function(e,t){if(e&&t){var n=e.getRotation(!0)||{};if(t.relative=t.relative===!0,n.relative=n.relative===!0,n.angle!==t.angle||n.relative!==t.relative)try{this.beginUpdate(),this.digest(new j["default"](this,e,{angle:t.angle,relative:t.relative}))}finally{this.endUpdate()}}return this}},{key:"rotationChanged",value:function(e,t){var n=e.getRotation(!0);return e.setRotation(t,{silent:!0}),n}},{key:"getGeometry",value:function(e,t){return e?e.getGeometry(t):null}},{key:"setGeometry",value:function(e,t){if(e&&t)try{this.beginUpdate(),this.digest(new N["default"](this,e,t))}finally{this.endUpdate()}return this}},{key:"geometryChanged",value:function(e,t){var n=this,r=e.getGeometry(!0)||{};return c.forEach(["size","position","rotation"],function(r){t[r]&&n[r+"Changed"](e,t[r])},this),r}},{key:"digest",value:function(e){return e.digest(),this.beginUpdate(),this.changes.add(e),this.endUpdate(),this}},{key:"beginUpdate",value:function(){this.updateLevel+=1,this.trigger("beginUpdate"),1===this.updateLevel&&this.trigger("startEdit")}},{key:"endUpdate",value:function(){if(this.updateLevel-=1,0===this.updateLevel&&this.trigger("endEdit"),!this.endingUpdate){this.endingUpdate=0===this.updateLevel;var e=this.changes;this.trigger("endUpdate",e.getChanges()),this.endingUpdate&&e.hasChange()&&e.notify().clear(),this.endingUpdate=!1}}},{key:"destroy",value:function(){c.destroy(this)}}]),t}(h["default"]);t["default"]=L},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(42),l=r(u),c=function(e){function t(e,n,r){i(this,t);var a=o(this,Object.getPrototypeOf(t).call(this));return a.model=e,a.cell=n,a.size=r,a.previous=r,a}return a(t,e),s(t,[{key:"digest",value:function(){return this.size=this.previous,this.previous=this.model.sizeChanged(this.cell,this.previous),this}}]),t}(l["default"]);t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(42),l=r(u),c=function(e){function t(e,n,r){i(this,t);var a=o(this,Object.getPrototypeOf(t).call(this));return a.model=e,a.cell=n,a.position=r,a.previous=r,a}return a(t,e),s(t,[{key:"digest",value:function(){return this.position=this.previous,this.previous=this.model.positionChanged(this.cell,this.previous),this}}]),t}(l["default"]);t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(42),l=r(u),c=function(e){function t(e,n,r){i(this,t);var a=o(this,Object.getPrototypeOf(t).call(this));return a.model=e,a.cell=n,a.rotation=r,a.previous=r,a}return a(t,e),s(t,[{key:"digest",value:function(){return this.position=this.previous,this.previous=this.model.rotationChanged(this.cell,this.previous),this}}]),t}(l["default"]);t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(42),l=r(u),c=function(e){function t(e,n,r){i(this,t);var a=o(this,Object.getPrototypeOf(t).call(this));return a.model=e,a.cell=n,a.attrs=r,a.previous=r,a}return a(t,e),s(t,[{key:"digest",value:function(){return this.attrs=this.previous,this.previous=this.model.attributeChanged(this.cell,this.previous),this}}]),t}(l["default"]);t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(27),h=r(f),d=n(15),v=r(d),p=n(51),y=r(p),g=n(4),m=r(g),b=n(18),k=r(b),w=n(52),x=r(w),P=n(20),O=r(P),_=n(58),C=r(_),M=n(29),j=r(M),T=n(43),E=r(T),S=n(44),N=r(S),B=n(53),V=r(B),R=n(45),A=r(R),L=n(54),z=r(L),F=n(55),I=r(F),D=n(46),G=r(D),U=n(47),$=r(U),W=n(56),H=r(W),q=window,X=q.document,Y={wrap:"pane-wrap",stage:"pane-stage",svg:"pane-svg",viewport:"pane-viewport",htmlPane:"pane-html",rawPane:"pane-raw"},K={width:"100%",height:"100%",tx:0,ty:0,sx:1,sy:1,gridSize:1,container:null,model:null,clickThreshold:0,isValidEvent:null,eventDelegate:null},Z=0,J=function(e){function t(e){o(this,t);var n=a(this,Object.getPrototypeOf(t).call(this));return n.id="paper-"+Z++,e&&n.init(e),n}return s(t,e),u(t,[{key:"configure",value:function(e){return this.options=c.merge({},K,e),this.trigger("paper:configure",this.options),this}},{key:"init",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];if(this.configure(e),this.container=e.container,!this.container)throw new Error("Initialize error: invalid container");return e=this.options,this.ensureElement().createPanes().setup().resize(e.width,e.height).translate(e.tx,e.ty).scale(e.sx,e.sy).setModel(e.model),this.trigger("paper:init",this.options),this}},{key:"ensureElement",value:function(){return this.wrap=c.createElement("div"),this.stage=c.createElement("div"),this.svg=c.createSvgDocument(),this.viewport=c.createSvgElement("g"),c.addClass(this.wrap,Y.wrap),c.addClass(this.stage,Y.stage),c.addClass(this.svg,Y.svg),c.addClass(this.viewport,Y.viewport),this.svg.appendChild(this.viewport),this.stage.appendChild(this.svg),this.wrap.appendChild(this.stage),this.container.appendChild(this.wrap),this.trigger("paper:ensureElements"),this}},{key:"getContainer",value:function(){return this.container}},{key:"getWrap",value:function(){return this.wrap}},{key:"getStage",value:function(){return this.stage}},{key:"getSvg",value:function(){return this.svg}},{key:"getViewport",value:function(){return this.viewport}},{key:"getEventDelegate",value:function(){var e=this.eventDelegate;return e||(e=this.options.eventDelegate,c.isFunction(e)&&(e=e.call(this)),this.eventDelegate=e||this.getWrap()),this.eventDelegate}},{key:"createPanes",value:function(){var e=this.viewport,t=this.stage;return this.backgroundPane=e.appendChild(c.createSvgElement("g")),this.linkPane=e.appendChild(c.createSvgElement("g")),this.drawPane=e.appendChild(c.createSvgElement("g")),this.controlPane=e.appendChild(c.createSvgElement("g")),this.decoratePane=e.appendChild(c.createSvgElement("g")),this.htmlPane=t.appendChild(c.createElement("div")),c.addClass(this.htmlPane,Y.htmlPane),this.rawPane=t.appendChild(c.createElement("div")),c.addClass(this.rawPane,Y.rawPane),this.trigger("paper:createPanes"),this}},{key:"setup",value:function(){var e=this.getEventDelegate();return c.addEventListener(e,"contextmenu",this.onContextMenu.bind(this)),c.addEventListener(e,"dblclick",this.onDblClick.bind(this)),c.addEventListener(e,"click",this.onClick.bind(this)),c.addEventListener(e,"mouseenter",".pane-cell",this.onCellMouseEnter.bind(this)),c.addEventListener(e,"mouseleave",".pane-cell",this.onCellMouseLeave.bind(this)),c.addEventListener(e,"mouseover",".pane-cell",this.onCellMouseOver.bind(this)),c.addEventListener(e,"mouseout",".pane-cell",this.onCellMouseOut.bind(this)),c.addEventListener(e,"mousedown",this.onPointerDown.bind(this)),this.mouseMoved=0,v["default"].IS_POINTER&&(this.container.style.msTouchAction="none"),this.trigger("paper:setup"),this}},{key:"getModel",value:function(){return this.model}},{key:"setModel",value:function(){var e=arguments.length<=0||void 0===arguments[0]?new x["default"]:arguments[0];return this.model=e,this.model.on("change",this.handleChanges,this),this.reValidate(),this}},{key:"destroy",value:function(){this.trigger("paper:destroy"),c.removeElement(this.wrap),v["default"].IS_POINTER&&(this.container.style.msTouchAction="");var e=this.getModel();e&&!e.destroyed&&e.destroy(),c.destroy(this)}},{key:"registerHandlers",value:function(e){return e=c.isArray(e)?e:[e],this.handlers=this.handlers||[],this.handlerByName=this.handlerByName||{},c.forEach(e,function(e){if(this.handlerByName[e.name])throw new Error('handler with name "'+e.name+'" is already registered');this.handlers.push(e),this.handlerByName[e.name]=e},this),this}},{key:"resize",value:function(e,t,n){if(!c.isNil(e)&&!c.isNil(t)){var r=c.isPercentage(e);r&&(e=c.toFloat(e,!0)*this.container.clientWidth),r=c.isPercentage(t),r&&(t=c.toFloat(t,!0)*this.container.clientHeight),n&&(e+=c.isNil(this.width)?0:this.width,t+=c.isNil(this.height)?0:this.height),e=Math.round(e),t=Math.round(t),(0,h["default"])(this.svg).attr({width:e,height:t}),c.setStyle(this.stage,{width:e+"px",height:t+"px"}),this.width=e,this.height=t,this.trigger("paper:resize",e,t)}return this}},{key:"resizeTo",value:function(e,t){return this.resize(e,t,!1)}},{key:"resizeBy",value:function(e,t){return this.resize(e,t,!0)}},{key:"translate",value:function(e,t,n){return c.isNil(e)||c.isNil(t)||(n&&(e+=c.isNil(this.tx)||0,t+=c.isNil(this.ty)||0),(0,h["default"])(this.viewport).translate(e,t),this.tx=e,this.ty=t,this.trigger("paper:translate",e,t)),this}},{key:"translateTo",value:function(e,t){return this.translate(e,t,!1)}},{key:"translateBy",value:function(e,t){return this.translate(e,t,!0)}},{key:"scale",value:function(e,t){var n=arguments.length<=2||void 0===arguments[2]?0:arguments[2],r=arguments.length<=3||void 0===arguments[3]?0:arguments[3];if(t=t||e,e&&t){var i=(0,h["default"])(this.viewport);i.attr("transform","");var o=this.tx,a=this.ty;if(n||r||o||a){var s=o-n*(e-1),u=a-r*(t-1);this.translateTo(s,u)}i.scale(e,t),this.sx=e,this.sy=t,this.trigger("paper:scale",e,t,n,r)}return this}},{key:"getContentBBox",value:function(e){if(e)return(0,h["default"])(this.viewport).getBBox(!0,this.svg);var t=this.viewport.getBoundingClientRect(),n=this.viewport.getScreenCTM(),r=this.viewport.getCTM();return m["default"].fromRect({x:t.left-n.e+r.e,y:t.top-n.f+r.f,width:t.width,height:t.height})}},{key:"fitToContent",value:function(e,t,n,r){function i(e){return!r.allowNewOrigin||"any"===r.allowNewOrigin||"negative"===r.allowNewOrigin&&0>e||"positive"===r.allowNewOrigin&&e>=0}c.isObject(e)?(r=e,n=r.padding||0,e=r.frameWidth||1,t=r.frameHeight||1):(r=r||{},n=n||0,e=e||1,t=t||1),n=c.normalizeSides(n);var o=this.getContentBBox(!0);o.x*=this.sx,o.y*=this.sy,o.width*=this.sx,o.height*=this.sy;var a=c.snapToGrid(o.width+o.x||1,e,"ceil"),s=c.snapToGrid(o.height+o.y||1,t,"ceil"),u=this.tx,l=this.ty;i(o.x)&&(u=Math.ceil(-o.x/e)*e,u+=n.left,a+=u),i(o.y)&&(l=Math.ceil(-o.y/t)*t,l+=n.top,s+=l),a+=n.right,s+=n.bottom,a=c.clamp(a,r.minWidth||0,r.maxWidth||Number.MAX_VALUE),s=c.clamp(s,r.minHeight||0,r.maxHeight||Number.MAX_VALUE);var f=a!==this.width||s!==this.height,h=u!==this.tx||l!==this.ty;return h&&this.translate(u,l),f&&this.resize(a,s),f||h}},{key:"scaleContentToFit",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=this.getContentBBox(!0);if(!t.width||!t.height)return this;e=c.merge({padding:0,minScale:null,maxScale:null,scaleGrid:null,preserveAspectRatio:!0},e);var n=c.normalizeSides(e.padding),r=e.fittingBBox;r||(r={x:this.tx,y:this.ty,width:this.width,height:this.height}),r=m["default"].fromRect(r).moveAndExpand({x:n.left,y:n.top,width:-(n.left+n.right),height:-(n.top+n.bottom)});var i=r.width/t.width,o=r.height/t.height,a=e.scaleGrid;a&&(i=c.snapToGrid(i,a,"floor"),o=c.snapToGrid(o,a,"floor"));var s=e.minScaleX||e.minScale,u=e.maxScaleX||e.maxScale,l=e.minScaleY||e.minScale,f=e.maxScaleY||e.maxScale;i=c.clamp(i,s,u),o=c.clamp(o,l,f),e.preserveAspectRatio&&(i=o=Math.min(i,o)),this.scale(i,o),t=this.getContentBBox(!0);var h=r.x-t.x,d=r.y-t.y;return this.translateTo(h,d),this}},{key:"reValidate",value:function(){return this.invalidate().validate()}},{key:"clear",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.model.getRoot():arguments[0],t=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],n=arguments.length<=2||void 0===arguments[2]?!0:arguments[2];return this.removeView(e),n&&(t||e!==this.currentRoot)?e.eachChild(function(e){this.clear(e,t,n)},this):this.invalidate(e,!0,!0),this}},{key:"invalidate",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.model.getRoot():arguments[0],t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?!0:arguments[2],r=this.getView(e);return r&&(r.invalid=!0),e.invalidating||(e.invalidating=!0,t&&e.eachChild(function(e){this.invalidate(e,t,n)},this),n&&e.eachLink(function(e){this.invalidate(e,t,n)},this),e.invalidating=!1),this}},{key:"validate",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.model.getRoot():arguments[0];return this.validateCell(e).validateView(e)}},{key:"validateCell",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];if(e){t=t&&e.isVisible();var n=this.getView(e,t);n&&!t&&this.removeView(e,!1,!1),e.eachChild(function(e){this.validateCell(e,t)},this)}return this}},{key:"validateView",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];if(e){var n=this.getView(e);n&&n.invalid&&(this.validateView(e.getParent(),!1).updateNodeGeometry(e).renderView(e),n.invalid=!1),t&&e.eachChild(function(e){this.validateView(e,t)},this)}return this}},{key:"updateNodeGeometry",value:function(e){return e&&e.isNode()&&this.updateNodeSize(e).updateNodePosition(e).updateNodeRotation(e),this}},{key:"updateNodeSize",value:function(e){if(e&&e.isNode()){var t=e.metadata.size||{},n=c.isUndefined(t.width)?1:t.width,r=c.isUndefined(t.height)?1:t.height,i=e.parent;if(t.relative&&i&&i.isNode()){var o=i.size,a=c.isPercentage(n);n=c.fixNumber(n,a,0),a||n>0&&1>n?n*=o.width:n+=o.width,a=c.isPercentage(r),r=c.fixNumber(r,a,0),a||r>0&&1>r?r*=o.height:r+=o.height}else n=c.fixNumber(n,!1,1),r=c.fixNumber(r,!1,1);e.size={width:Math.max(n,1),height:Math.max(r,1)}}return this}},{key:"updateNodePosition",value:function(e){if(e&&e.isNode()){var t=e.metadata.position||{},n=c.isUndefined(t.x)?0:t.x,r=c.isUndefined(t.y)?0:t.y,i=e.parent;if(t.relative&&i&&i.isNode()){var o=i.position,a=i.size,s=c.isPercentage(n);n=c.fixNumber(n,s,0),s||n>-1&&1>n?n=o.x+a.width*n:n+=o.x,s=c.isPercentage(r),r=c.fixNumber(r,s,0),s||r>-1&&1>r?r=o.y+a.height*r:r+=o.y}else n=c.fixNumber(n,!1,0),r=c.fixNumber(r,!1,0);e.position=this.snapToGrid({x:n,y:r},!0)}return this}},{key:"updateNodeRotation",value:function(e){if(e&&e.isNode()){var t=e.metadata.rotation||{},n=c.fixNumber(t.angle,!1,0),r=e.parent;if(t.inherited&&r&&r.isNode()&&0!==r.rotation){var i=e.position,o=e.size,a=new k["default"](i.x+o.width/2,i.y+o.height/2),s=r.position,u=r.size,l=new k["default"](s.x+u.width/2,s.y+u.height/2);a.rotate(l,-r.rotation),i.x=a.x-o.width/2,i.y=a.y-o.height/2,n+=r.rotation}e.rotation=n}return this}},{key:"getView",value:function(e,t){if(e){var n=this.getViewById(e.id);return!n&&t&&e.isVisible()&&(n=this.createView(e)),n}}},{key:"getViewById",value:function(e){return this.views?this.views[e]:null}},{key:"eachView",value:function(e,t){return c.forIn(this.views,e,t)}},{key:"getTerminalView",value:function(e,t){var n=this.model.getTerminal(e,t);return n&&n.node?this.getView(n.node):null}},{key:"createView",value:function(e){if(e){var t=e.metadata.view;if(t||(t=e.isLink()?C["default"]:e.isNode()?j["default"]:null),t){var n=new t(this,e);return this.views||(this.views={}),this.views[e.id]=n,n}}return null}},{key:"removeView",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?!0:arguments[2];if(e){t&&e.eachChild(function(e){this.removeView(e,t,n)},this),n&&e.eachLink(function(e){this.removeView(e,t,n)},this);var r=this.getView(e);r&&(delete this.views[e.id],r.destroy())}return this}},{key:"renderView",value:function(e){var t=this.getView(e);return t&&(e.isLink()&&!this.canRenderLink(e)?this.removeView(e):t.render()),this}},{key:"canRenderLink",value:function(e){var t=e.getTerminalNode(!0),n=e.getTerminalNode(!1);return(!t||t.isVisible()&&this.getView(t))&&(!n||n.isVisible()&&this.getView(n))?(t||e.getTerminalPoint(!0))&&(n||e.getTerminalPoint(!1)):!1}},{key:"findViewByElem",value:function(e){if(this.views)for(e=c.isString(e)?this.svg.querySelector(e):e;e&&e!==this.svg&&e!==document;){var t=e.cellId;if(t)return this.views[t];e=e.parentNode}return null}},{key:"findViewByCell",value:function(e){return c.isString(e)?this.getViewById(e):this.getView(e)}},{key:"findViewByPoint",value:function(){}},{key:"findViewsInArea",value:function(){}},{key:"handleChanges",value:function(e){return c.forEach(e,function(e){this.distributeChange(e)},this),this.validate(),this}},{key:"distributeChange",value:function(e){return e instanceof E["default"]?this.onRootChanged(e):e instanceof N["default"]?this.onChildChanged(e):e instanceof A["default"]?this.onVisibleChange(e):e instanceof G["default"]?this.onTerminalChange(e):e instanceof V["default"]?this.onSizeChange(e):e instanceof z["default"]?this.onPositionChange(e):e instanceof I["default"]?this.onRotationChange(e):e instanceof H["default"]?this.onAttributeChange(e):e instanceof $["default"]&&this.onGeometryChange(e),this}},{key:"onRootChanged",value:function(e){e.viewport&&this.invalidate(e.viewport,!0,!0),e.previous&&this.removeView(e.previous,!0,!0)}},{key:"onChildChanged",value:function(e){var t=e.parent,n=e.previous;this.invalidate(e.child,!0,!0),t||this.removeView(e.child,!0,!0),t!==n&&(t&&this.invalidate(t,!1,!1),n&&this.invalidate(n,!1,!1))}},{key:"onVisibleChange",value:function(e){this.invalidate(e.cell,!0,!0)}},{key:"onTerminalChange",value:function(e){this.invalidate(e.link,!0,!0)}},{key:"onSizeChange",value:function(e){this.invalidate(e.cell,!0,!0)}},{key:"onPositionChange",value:function(e){this.invalidate(e.cell,!0,!0)}},{key:"onRotationChange",value:function(e){this.invalidate(e.cell,!0,!0)}},{key:"onAttributeChange",value:function(e){this.invalidate(e.cell,!0,!0)}},{key:"onGeometryChange",value:function(e){this.invalidate(e.cell,!0,!0)}},{key:"getRouter",value:function(e){return this.constructor.getRouter(e)}},{key:"getConnector",value:function(e){return this.constructor.getConnector(e)}},{key:"getMarker",value:function(e){return this.constructor.getMarker(e)}},{key:"isValidEvent",value:function(e,t){if(this.options.isValidEvent&&!this.options.isValidEvent(e,t))return!1;if(t&&t.cell&&t.cell instanceof O["default"])return!0;var n=this.eventDelegate,r=e.target;return n===r||c.containsElement(n,r)?!0:void 0}},{key:"onContextMenu",value:function(e){e=c.normalizeEvent(e);var t=this.findViewByElem(e.target);if(this.isValidEvent(e,t)){var n=this.snapToGrid({x:e.clientX,y:e.clientY});t?this.trigger("cell:contextmenu",t.cell,t,e,n.x,n.y):this.trigger("blank:contextmenu",e,n.x,n.y)}}},{key:"onDblClick",value:function(e){e.preventDefault(),e=c.normalizeEvent(e);var t=this.findViewByElem(e.target);if(this.isValidEvent(e,t)){var n=this.snapToGrid({x:e.clientX,y:e.clientY});t?this.trigger("cell:dblclick",t.cell,t,e,n.x,n.y):this.trigger("blank:dblclick",e,n.x,n.y)}}},{key:"onClick",value:function(e){if(this.mouseMoved<=this.options.clickThreshold){e=c.normalizeEvent(e);var t=this.findViewByElem(e.target);if(!this.isValidEvent(e,t))return;var n=this.snapToGrid({x:e.clientX,y:e.clientY});t?this.trigger("cell:click",t.cell,t,e,n.x,n.y):this.trigger("blank:click",e,n.x,n.y)}}},{key:"onCellMouseOver",value:function(e){this.onCellHover(e,"mouseover")}},{key:"onCellMouseOut",value:function(e){this.onCellHover(e,"mouseout")}},{key:"onCellMouseEnter",value:function(e){this.onCellHover(e,"mouseenter")}},{key:"onCellMouseLeave",value:function(e){this.onCellHover(e,"mouseleave")}},{key:"onCellHover",value:function(e,t){e=c.normalizeEvent(e);var n=this.findViewByElem(e.target);if(this.isValidEvent(e,n)){var r=this.snapToGrid({x:e.clientX,y:e.clientY});this.trigger("cell:"+t,n.cell,n,e,r.x,r.y)}}},{key:"onPointerDown",value:function(e){if(e=c.normalizeEvent(e),c.isLeftMouseButton(e)){var t=this.findViewByElem(e.target),n=t&&t.cell;this.isValidEvent(e,t)&&this.triggerPointDown(e,n,t)}}},{key:"triggerPointDown",value:function(e,t,n){e.preventDefault(),this.mouseMoved=0;var r=this.snapToGrid({x:e.clientX,y:e.clientY});n?(this.sourceView=n,this.trigger("cell:pointerDown",t,n,e,r.x,r.y)):this.trigger("blank:pointerDown",e,r.x,r.y),this.onMouseMoveHandler=this.onMouseMoveHandler||this.onPointerMove.bind(this),this.onMouseUpHandler=this.onMouseUpHandler||this.onPointerUp.bind(this),c.addEventListener(X,"mousemove",this.onMouseMoveHandler),c.addEventListener(X,"mouseup",this.onMouseUpHandler)}},{key:"onPointerMove",value:function(e){e.preventDefault(),e=c.normalizeEvent(e);var t=this.snapToGrid({x:e.clientX,y:e.clientY}),n=this.sourceView;n?(this.mouseMoved++,this.trigger("cell:pointerMove",n.cell,n,e,t.x,t.y)):this.trigger("blank:pointerMove",e,t.x,t.y)}},{key:"onPointerUp",value:function(e){e=c.normalizeEvent(e);var t=this.snapToGrid({x:e.clientX,y:e.clientY}),n=this.sourceView;n?(this.trigger("cell:pointerUp",n.cell,n,e,t.x,t.y),this.sourceView=null):this.trigger("blank:pointerUp",e,t.x,t.y),c.removeEventListener(X,"mousemove",this.onMouseMoveHandler),c.removeEventListener(X,"mouseup",this.onMouseUpHandler)}},{key:"snapToGrid",value:function(e,t){var n=this.options.gridSize||1;return t||(e=(0,h["default"])(this.drawPane).toLocalPoint(e.x,e.y)),{x:c.snapToGrid(e.x,n),y:c.snapToGrid(e.y,n)}}},{key:"toLocalPoint",value:function(e){var t=this.svg,n=t.createSVGPoint();n.x=e.x,n.y=e.y;var r=void 0;v["default"].IS_FF&&(r=(0,h["default"])("rect",{width:this.options.width,height:this.options.height,x:0,y:0,opacity:0}),t.appendChild(r.node));var i=c.getOffset(t);v["default"].IS_FF&&r.remove();var o=X.body,a=X.documentElement,s=o.scrollTop||a.scrollTop,u=o.scrollLeft||a.scrollLeft;n.x+=u-i.left,n.y+=s-i.top;var l=n.matrixTransform(this.drawPane.getCTM().inverse());return k["default"].fromPoint(l)}},{key:"toLocalRect",value:function(e){var t=this.toLocalPoint({x:e.x,y:e.y}),n=this.toLocalPoint({x:e.x+e.width,y:e.y+e.height});return new m["default"](t.x,t.y,n.x-t.x,n.y-t.y)}}],[{key:"registerRouter",value:function(e,t){return this.router||(this.router={}),this.router[e]=t,this}},{key:"getRouter",value:function(e){return this.router?this.router[e]:null}},{key:"registerConnector",value:function(e,t){return this.connectors||(this.connectors={}),this.connectors[e]=t,this}},{key:"getConnector",value:function(e){return this.connectors?this.connectors[e]:null}},{key:"registerMarker",value:function(e,t){return this.markers||(this.markers={}),this.markers[e]=t,this}},{key:"getMarker",value:function(e){return this.markers?this.markers[e]:null}}]),t}(y["default"]);t["default"]=J},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(27),h=r(f),d=n(18),v=r(d),p=n(30),y=r(p),g=function(e){function t(){return o(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return s(t,e),u(t,[{key:"render",value:function(){return this.vel.empty(),this.renderMarkup().update(),this}},{key:"update",value:function(){return this.cache={},this.parseRouter().parseConnector().parseTerminal(!0).parseTerminal(!1).updateMarker().updateConnector().updateAttributes()}},{key:"updateAttributes",value:function(e){return c.forIn(e||this.cell.attrs,function(e,t){var n=[];c.isObject(e.fill)&&(this.applyGradient(t,"fill",e.fill),n.push("fill")),c.isObject(e.stroke)&&(this.applyGradient(t,"stroke",e.stroke),n.push("stroke")),c.isObject(e.filter)&&(this.applyFilter(t,e.filter),n.push("filter"));var r={};c.forIn(e,function(e,t){c.contains(n,t)||(r[t]=e)}),this.applyAttr(t,r)},this),this}},{key:"parseRouter",value:function(){var e=this.cell,t=e.getRouter(),n=c.filter(e.vertices||[],function(e){return v["default"].isPointLike(e)});n=c.map(n,function(e){return v["default"].fromPoint(e)});var r=t.parse&&c.isFunction(t.parse)?t.parse:t.name&&this.paper.getRouter(t.name),i=r&&c.isFunction(r)?r.call(this,n,t.options||{}):n;return this.cacheRouterPoints(i),this}},{key:"parseConnector",value:function(){var e=this.cell,t=e.getConnector(),n=e.getMarker(!0),r=e.getMarker(!1),i=this.getStrokeWidth(t.selector),o=this.getStrokeWidth(n.selector),a=this.getStrokeWidth(r.selector),s=n.options;s||(s=n.options={}),s.connectorStrokeWidth=i,s.markerStrokeWidth=o;var u=r.options;return u||(u=r.options={}),u.connectorStrokeWidth=i,u.markerStrokeWidth=a,this.cacheConnector(t),this.cacheMarker(n,!0),this.cacheMarker(r,!1),this}},{key:"parseTerminal",value:function(e){var t=this.cell,n=t.getTerminalPoint(e),r=t.getTerminalNode(e),i=r&&this.paper.getView(r),o=t.getTerminalPort(e);return this.cacheStaticConnPoint(n,e),this.cacheTerminalView(i,e),this.cacheTerminalPort(o,e),this}},{key:"updateMarker",value:function(){return this.renderMarker(!0).renderMarker(!1).updateConnectionPoint(!0).updateConnectionPoint(!1).transformMarker(!0).transformMarker(!1).updateConnectionPointOnMarker(!0).updateConnectionPointOnMarker(!1)}},{key:"updateConnector",value:function(){var e=this.fetchConnector(),t=e.parse&&c.isFunction(e.parse)?e.parse:e.name&&this.paper.getConnector(e.name);if(!t||!c.isFunction(t))throw new Error('Unknown connector: "'+e.name+'"');var n=this.getConnectionPoint(!0),r=this.getConnectionPoint(!1);if(n&&r){var i=t.call(this,n,r,this.fetchRouterPoints(),e.options||{});this.applyAttr(e.selector,{d:i})}else this.vel.empty();return this}},{key:"renderMarker",value:function(e){var t=this.fetchMarker(e),n=this.findOne(t.selector);if(t&&n){var r=t.parse&&c.isFunction(t.parse)?t.parse:t.name&&this.paper.getMarker(t.name);if(r&&c.isFunction(r)){var i=r(n,t.options),o=i.vel;if(o){var a=n.node,s=a.parentNode,u=n.getClassName();s.insertBefore(o.node,a),s.removeChild(a),o.addClass(u),n=o}this.cacheMarkerVel(n,e),this.cacheRenderedMarker(i,e)}}return this}},{key:"updateConnectionPoint",value:function(e){var t=this.fetchStaticConnPoint(e);return t||this.updateConnPointOnPort(e)||this.updateConnPointOnNode(e),this}},{key:"updateConnPointOnPort",value:function(e){var t=this.fetchConnPointOnPort(e);if(!t){var n=this.fetchTerminalView(e),r=this.fetchTerminalPort(e);if(r&&n){if(n.getConnectionPointOnPort&&(t=n.getConnectionPointOnPort(r,e)),!t){var i=this.getPortBodyBBox(e);if(i){var o=this.getReferencePoint(i,e),a=this.getPortBodyGeom(e)||i;o&&(t=a.intersectionWithLineFromCenterToPoint(o)),t=t||a.getCenter()}}this.cacheConnPointOnPort(t,e)}}return t}},{key:"updateConnPointOnNode",value:function(e){var t=this.fetchConnPointOnNode(e);if(!t){var n=this.fetchTerminalView(e);if(n){if(n.getConnectionPointOnBorder&&(t=n.getConnectionPointOnBorder()),!t){var r=this.getTerminalBBox(e);if(r){var i=this.getReferencePoint(r,e);i&&(t=r.intersectionWithLineFromCenterToPoint(i)),t=t||r.getCenter()}}this.cacheConnPointOnNode(t,e)}}return t}},{key:"getStrokeWidth",value:function(e){var t=this.findOne(e);
  if(t&&t.node){var n=c.getComputedStyle(t.node,"stroke-width");return n&&c.toFloat(n)||0}return 0}},{key:"getTerminalBBox",value:function(e){var t=this.fetchTerminalBBox(e);if(!t){var n=this.fetchTerminalView(e);n&&(t=n.getStrokedBBox(),t=this.fixStrokedBBox(t,e)),this.cacheTerminalBBox(t,e)}return t}},{key:"fixStrokedBBox",value:function(e,t){if(e){var n=this.fetchMarker(t),r=this.fetchRenderedMarker(t);if(n&&r){var i=n.options.markerStrokeWidth;if(i){var o=r.rad||0;o>=Math.PI/4||0===o?e.grow(i/2):e.grow(i/Math.sin(o)/2)}}}return e}},{key:"getReferencePoint",value:function(e,t){var n=this.fetchStaticConnPoint(t);if(!n){var r=this.fetchRouterPoints();n=t?r[0]:r[r.length-1]}if(!n){var i=this.getPortBodyBBox(!t);i&&(n=i.intersectionWithLineFromCenterToPoint(e.getCenter()),n=n||i.getCenter())}if(!n){var o=this.getTerminalBBox(!t);o&&(n=o.intersectionWithLineFromCenterToPoint(e.getCenter()),n=n||o.getCenter())}return n}},{key:"getPortBodyBBox",value:function(e){var t=this.fetchPortBodyBBox(e);if(!t){var n=this.fetchTerminalView(e),r=this.fetchTerminalPort(e);n&&r&&(n.getPortBodyBBox&&(t=n.getPortBodyBBox(r,e)),t&&(t=this.fixStrokedBBox(t,e),this.cachePortBodyBBox(t,e)))}return t}},{key:"getPortBodyGeom",value:function(e){var t=this.fetchPortBodyGeom(e);if(!t){var n=this.fetchTerminalView(e),r=this.fetchTerminalPort(e);n&&r&&(n.getPortBodyGeom&&(t=n.getPortBodyGeom(r,e)),t&&(t=this.fixStrokedBBox(t,e),this.cachePortBodyGeom(t,e)))}return t}},{key:"getConnectionPoint",value:function(e){return this.fetchStaticConnPoint(e)||this.fetchConnPointOnMarker(e)||this.fetchConnPointOnPort(e)||this.fetchConnPointOnNode(e)}},{key:"transformMarker",value:function(e,t){var n=this.fetchRenderedMarker(e);if(n){var r=this.getPane(),i=this.fetchRouterPoints(),o=this.getConnectionPoint(!0),a=this.getConnectionPoint(!1),s=e?o:a,u=t||e?i[0]||a:i[i.length-1]||o,l=this.fetchMarkerVel(e);s&&u&&l&&l.translateAndAutoOrient(s,u,r)}return this}},{key:"updateConnectionPointOnMarker",value:function(e){var t=this.fetchMarkerVel(e),n=this.fetchRenderedMarker(e);if(t&&n){var r=this.getPane(),i=n.point,o=h["default"].createSVGPoint(i.x,i.y);o=o.matrixTransform(t.getTransformToElement(r));var a=v["default"].fromPoint(o);this.cacheConnPointOnMarker(a,e)}return this}},{key:"cacheRouterPoints",value:function(e){this.cache.routerPoints=e}},{key:"fetchRouterPoints",value:function(){return this.cache.routerPoints}},{key:"cacheConnector",value:function(e){this.cache.connector=e}},{key:"fetchConnector",value:function(){return this.cache.connector}},{key:"cacheMarker",value:function(e,t){t?this.cache.sourceMarker=e:this.cache.targetMarker=e}},{key:"fetchMarker",value:function(e){return e?this.cache.sourceMarker:this.cache.targetMarker}},{key:"cacheRenderedMarker",value:function(e,t){e&&(t?this.cache.renderedSourceMarker=e:this.cache.renderedTargetMarker=e)}},{key:"fetchRenderedMarker",value:function(e){return e?this.cache.renderedSourceMarker:this.cache.renderedTargetMarker}},{key:"cacheMarkerVel",value:function(e,t){e&&(t?this.cache.sourceMarkerVel=e:this.cache.targetMarkerVel=e)}},{key:"fetchMarkerVel",value:function(e){return e?this.cache.sourceMarkerVel:this.cache.targetMarkerVel}},{key:"cacheTerminalView",value:function(e,t){e&&(t?this.cache.sourceView=e:this.cache.targetView=e)}},{key:"fetchTerminalView",value:function(e){return e?this.cache.sourceView:this.cache.targetView}},{key:"cacheTerminalPort",value:function(e,t){c.isNil(e)||(t?this.cache.sourcePort=e:this.cache.targetPort=e)}},{key:"fetchTerminalPort",value:function(e){return e?this.cache.sourcePort:this.cache.targetPort}},{key:"cacheStaticConnPoint",value:function(e,t){e&&(t?this.cache.staticSourcePoint=e:this.cache.staticTargetPoint=e)}},{key:"fetchStaticConnPoint",value:function(e){return e?this.cache.staticSourcePoint:this.cache.staticTargetPoint}},{key:"cacheConnPointOnMarker",value:function(e,t){e&&(t?this.cache.sourcePointOnMarker=e:this.cache.targetPointOnMarker=e)}},{key:"fetchConnPointOnMarker",value:function(e){return e?this.cache.sourcePointOnMarker:this.cache.targetPointOnMarker}},{key:"cacheConnPointOnPort",value:function(e,t){e&&(t?this.cache.sourcePointOnPort=e:this.cache.targetPointOnPort=e)}},{key:"fetchConnPointOnPort",value:function(e){return e?this.cache.sourcePointOnPort:this.cache.targetPointOnPort}},{key:"cacheConnPointOnNode",value:function(e,t){e&&(t?this.cache.sourcePointOnTerminal=e:this.cache.targetPointOnTerminal=e)}},{key:"fetchConnPointOnNode",value:function(e){return e?this.cache.sourcePointOnTerminal:this.cache.targetPointOnTerminal}},{key:"cacheTerminalBBox",value:function(e,t){e&&(t?this.cache.sourceTerminalBBox=e:this.cache.targetTerminalBBox=e)}},{key:"fetchTerminalBBox",value:function(e){return e?this.cache.sourceTerminalBBox:this.cache.targetTerminalBBox}},{key:"cachePortBodyBBox",value:function(e,t){e&&(t?this.cache.sourcePortBBox=e:this.cache.targetPortBBox=e)}},{key:"fetchPortBodyBBox",value:function(e){return e?this.cache.sourcePortBBox:this.cache.targetPortBBox}},{key:"cachePortBodyGeom",value:function(e,t){e&&(t?this.cache.sourcePortGeom=e:this.cache.targetPortGeom=e)}},{key:"fetchPortBodyGeom",value:function(e){return e?this.cache.sourcePortGeom:this.cache.targetPortGeom}}]),t}(y["default"]);t["default"]=g},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=function m(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(void 0===r){var i=Object.getPrototypeOf(e);return null===i?void 0:m(i,t,n)}if("value"in r)return r.value;var o=r.get;if(void 0!==o)return o.call(n)},f=n(5),h=i(f),d=n(18),v=r(d),p=n(20),y=r(p),g=function(e){function t(e){a(this,t);var n=s(this,Object.getPrototypeOf(t).call(this,e));return n.vertices=n.metadata.vertices||[],n}return u(t,e),l(t,[{key:"isLink",value:function(){return!0}},{key:"getRouter",value:function(){var e=this.metadata.router||{};return h.isFunction(e)?e={parse:e}:h.isObject(e)||(e={name:e}),e}},{key:"getMarker",value:function(e){var t=e?this.metadata.sourceMarker:this.metadata.targetMarker;return h.isFunction(t)?t={parse:t}:h.isObject(t)||(t={name:t}),t.selector=e?".source-marker":".target-marker",t}},{key:"getConnector",value:function(){var e=this.metadata.connector||{};return h.isFunction(e)?e={parse:e}:h.isObject(e)||(e={name:e}),e.selector=".connector",e}},{key:"getVertices",value:function(){return this.vertices}},{key:"getVerticesCount",value:function(){return this.vertices?this.vertices.length:0}},{key:"getVerticeAt",value:function(e){return this.vertices?this.vertices[e]:null}},{key:"indexOfVertice",value:function(e){if(e&&v["default"].isPointLike(e))for(var t=0,n=this.getVerticesCount();n>t;t++){var r=this.getVerticeAt(t);if(e.x===r.x&&e.y===r.y)return t}return-1}},{key:"eachVertice",value:function(e,t){return h.forEach(this.vertices,e,t)}},{key:"filterVertice",value:function(e,t){return h.filter(this.vertices,e,t)}},{key:"insertVertice",value:function(e,t){var n=this.getVerticesCount();if(t=h.fixIndex(t,n),h.isArray(e)||(e=[e]),t===n){var r;(r=this.vertices).push.apply(r,o(e))}else this.vertices.splice(t,0,e);return this}},{key:"removeVertice",value:function(e){var t=this.indexOfVertice(e);return t>=0&&this.removeVerticeAt(t),this}},{key:"removeVerticeAt",value:function(e){var t=this.getVerticeAt(e);return t&&this.vertices.splice(e,1),t}},{key:"clearVertices",value:function(){return this.vertices=[],this}},{key:"clone",value:function(e,n){var r=c(Object.getPrototypeOf(t.prototype),"clone",this).call(this,e,n);return r.vertices=[],h.forEach(this.vertices,function(e){v["default"].isPointLike(e)&&r.vertices.push({x:e.x,y:e.y})}),r}}],[{key:"isLink",value:function(e){return e&&e instanceof t}}]),t}(y["default"]);g.setDefaults({tagName:"g",markup:'<path class="connector"/><path class="source-marker"/><path class="target-marker"/>',classNames:"pane-cell pane-link",pane:"linkPane",data:null,view:null,router:null,connector:"sharp",sourceMarker:null,targetMarker:null,attrs:{".connector":{fill:"none",stroke:"#000","stroke-width":1},".source-marker":{fill:"#000",stroke:"#000","stroke-width":1},".target-marker":{fill:"#000",stroke:"#000","stroke-width":1}}}),t["default"]=g},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(51),h=r(f),d=function(e){function t(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];o(this,t);var r=a(this,Object.getPrototypeOf(t).call(this));return r.paper=e,r.disabled=!1,r.configure(n).init(),r}return s(t,e),u(t,[{key:"configure",value:function(){return this}},{key:"init",value:function(){return this}},{key:"destroy",value:function(){c.destroy(this)}},{key:"getPaper",value:function(){return this.paper}},{key:"getModel",value:function(){return this.paper&&this.paper.model}},{key:"isDisabled",value:function(){return this.disabled===!0}},{key:"isEnabled",value:function(){return this.disabled===!1}},{key:"disable",value:function(){return this.disabled=!0,this.trigger("handler:disabled"),this}},{key:"enable",value:function(){return this.disabled=!1,this.trigger("handler:enabled"),this}},{key:"invoke",value:function(e,t){return this.isDisabled()||e.call(t),this}}]),t}(h["default"]);t["default"]=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(27),h=r(f),d=n(60),v=r(d),p=n(62),y=r(p),g=function(e){function t(){return o(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return s(t,e),u(t,[{key:"init",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=this;this.name=e.name||"select";var n=this.getPaper(),r=this.getModel();return this.previewVel=(0,h["default"])("rect",{fill:"none","stroke-dasharray":"3px, 3px",stroke:"black"}),this.previewRect=this.previewVel.node,n.controlPane.appendChild(this.previewRect),this.hidePreview(),n.selection=[],this.origin={x:0,y:0},n.on("cell:pointerDown",function(e,n,r){t.invoke(function(){t.origin={x:r.x,y:r.y},t.selectCell(e,c.hasModifierKey(r))})}),n.on("cell:pointerMove",function(e,n,r){t.invoke(function(){t.showPreview().redrawPreview(r)})}),n.on("cell:pointerUp",function(e,i,o){t.invoke(function(){var e=t.origin;o.x===e.x&&o.y===e.y||(r.beginUpdate(),c.forEach(n.selection,function(t){var n=t.metadata.position;r.setGeometry(t,{position:{x:n.x+(o.x-e.x),y:n.y+(o.y-e.y),relative:n.relative}})}),r.endUpdate(),c.forEach(n.selection,function(e){e.vertexController.redraw()})),t.hidePreview()})}),n.on("blank:pointerDown",function(e){t.invoke(function(){c.hasModifierKey(e)||t.clearSelection()})}),this}},{key:"hidePreview",value:function(){return this.previewVel.hide(),this}},{key:"showPreview",value:function(){return this.previewVel.show(),this}},{key:"redrawPreview",value:function(e){var t=this,n=this.getPaper(),r=this.previewVel,i=n.selection;return i.length&&!function(){var o={x:Number.MAX_VALUE,y:Number.MAX_VALUE},a={x:0,y:0};c.forEach(i,function(e){var t=n.getView(e),r=t.vel.getBBox();r.x<o.x&&(o.x=r.x),r.y<o.y&&(o.y=r.y),r.x+r.width>a.x&&(a.x=r.x+r.width),r.y+r.height>a.y&&(a.y=r.y+r.height)});var s=t.origin;r.attr({x:o.x+(e.x-s.x),y:o.y+(e.y-s.y),width:a.x-o.x,height:a.y-o.y})}(),this}},{key:"_selectCell",value:function(e){var t=this.getPaper();return e.vertexController=new y["default"](t,{cell:e}),e.selected=!0,t.selection.push(e),this}},{key:"_unselectCell",value:function(e){var t=this.getPaper(),n=t.selection;return c.contains(n,e)&&t.selection.splice(c.indexOf(n,e),1),e.vertexController.destroy(),e.selected=!1,this}},{key:"selectCell",value:function(e,t){return t?e.selected?this._unselectCell(e):this._selectCell(e):(this.clearSelection(),e.selected?this:(this.clearSelection(),this._selectCell(e),this))}},{key:"clearSelection",value:function(){return c.forEach(this.paper.selection,function(e){e.vertexController.destroy(),e.selected=!1}),this.paper.selection=[],this}}]),t}(v["default"]);t["default"]=g},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(15),h=r(f),d=n(27),v=r(d),p=n(4),y=r(p),g=n(63),m=r(g),b=window,k=b.document,w={boundsAttr:{fill:"none","stroke-dasharray":"3px, 3px",stroke:"#0f0"},rotaterOffset:-12,rotaterAttr:{rx:5,ry:5,fill:"#0f0",stroke:"black",style:"cursor:crosshair;"},resizerAttr:{height:6,width:6,fill:"#0f0",stroke:"black"}},x=["nw-resize","n-resize","ne-resize","e-resize","se-resize","s-resize","sw-resize","w-resize"],P=function(e){function t(){return o(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return s(t,e),u(t,[{key:"init",value:function(e){this.options=c.merge({},w,e);var t=(0,v["default"])("g",{"class":"vertex-bounds"});return this.cell=e.cell,this.vel=t,this.elem=t.node,this.paper.controlPane.appendChild(this.elem),this.redraw(),this}},{key:"redraw",value:function(){var e=this,t=e.cell;return e.moveTo(t.position).rotate().setSize(t.size).drawBounds().drawRotater().drawResizers(),this.bindEvents(),this}},{key:"moveTo",value:function(e){return this.vel.translate(e.x,e.y),this.position=e,this}},{key:"setSize",value:function(e){return this.size=e,this}},{key:"rotate",value:function(e,t,n){var r=this.cell;return t=c.isNumeric(t)?t:r.size.width/2,n=c.isNumeric(n)?n:r.size.height/2,e=c.isNumeric(e)?e:r.rotation,this.vel.rotate(e,t,n),this.rotation=e,this}},{key:"drawBounds",value:function(){var e=c.extend({},this.options.boundsAttr,this.size);return this.boundsVel?this.boundsVel.attr(e):(this.boundsVel=(0,v["default"])("rect",e),this.vel.append(this.boundsVel)),this}},{key:"drawRotater",value:function(){return this.rotaterVel||(this.rotaterVel=(0,v["default"])("ellipse",this.options.rotaterAttr),this.vel.append(this.rotaterVel)),this.rotaterVel.translate(this.size.width/2,this.options.rotaterOffset),this}},{key:"drawResizers",value:function(){var e=this.options;this.resizers||(this.resizers=[],c.forEach(x,function(){this.createResizer()},this));var t=this.resizers,n=e.resizerAttr.width/2,r=e.resizerAttr.height/2,i=this.size.height,o=this.size.width;return t[0].translate(-n,-r),t[1].translate(-n+o/2,-r),t[2].translate(-n+o,-r),t[3].translate(-n+o,-r+i/2),t[4].translate(-n+o,-r+i),t[5].translate(-n+o/2,-r+i),t[6].translate(-n,-r+i),t[7].translate(-n,-r+i/2),this.cacheResizerBBox(),this.adjustResizers(),this}},{key:"cacheResizerBBox",value:function(){return c.forEach(this.resizers,function(e){e.hidden||(e.cachedBBox=e.getBBox())}),this}},{key:"adjustResizers",value:function(){var e=this.cell,t=45,n=c.normalizeAngle(e.rotation),r=Math.floor(n/t),i=x.length;return c.forEach(this.resizers,function(e,t){var n=x[(t+r)%i];e.attr({"class":"resizer "+n}),e.css({cursor:n})}),this}},{key:"createResizer",value:function(){var e=this,t=(0,v["default"])("rect",e.options.resizerAttr);return e.resizers.push(t),e.vel.append(t),e}},{key:"hideRotater",value:function(){return this.rotaterVel.hide(),this}},{key:"showRotater",value:function(){return this.rotaterVel.show(),this}},{key:"showResizers",value:function(){return c.forEach(this.resizers,function(e){e.show()}),this}},{key:"hideResizers",value:function(e){return this.cacheResizerBBox(),c.forEach(this.resizers,function(t){t.node!==e&&t.hide()}),this}},{key:"resetEvents",value:function(e){return this.isRotating=!1,this.isResizing=!1,this.eventTarget=null,e&&e.target&&(this.eventTarget=e.target,this.isRotating=e.target===this.rotaterVel.node,this.isResizing=c.hasClass(e.target,"resizer"),this.oldEventPosition={x:e.x,y:e.y}),this.isRotating?this.hideResizers():this.showResizers(),this.isResizing?(this.hideRotater(),this.hideResizers(e.target)):this.showRotater(),this}},{key:"bindEvents",value:function(){var e=this.elem;this.resetEvents();var t=this.onPointerDown.bind(this),n=this.onPointerMove.bind(this),r=this.onPointerUp.bind(this);return h["default"].IS_TOUCH?(c.addEventListener(e,"touchstart",t),c.addEventListener(k,"touchmove",n),c.addEventListener(k,"touchend",r)):(c.addEventListener(e,"mousedown",t),c.addEventListener(k,"mousemove",n),c.addEventListener(k,"mouseup",r)),this}},{key:"onPointerDown",value:function(e){return e.stopPropagation(),this.resetEvents(e),this}},{key:"onPointerMove",value:function(e){var t=this;if(t.isRotating){e.stopPropagation();var n=t.position.x+t.size.width/2-e.x,r=t.position.y+t.size.height/2-e.y,i=0!==n?180*Math.atan(r/n)/Math.PI+90:0>r?180:0;n>0&&(i-=180),t.rotate(i)}return t.isResizing&&!function(){e.stopPropagation();var n=t.oldEventPosition,r={x:e.x,y:e.y},i=t.eventTarget,o=0,a=!1,s=!1;c.some(t.resizers,function(e,t){return e.node===i?(o=t,!0):!1});var u=(o-4+8)%8;o%2!==0&&(1!==o&&5!==o||(a=!0),3!==o&&7!==o||(s=!0),o-=1,u-=1);var l=t.resizers[u].cachedBBox.getCenter(),f=t.resizers[o].getBBox().getCenter(),h=0,d=0;a?(h=0,d=0):s?(h=0,d=0):(h=r.x-n.x,d=r.y-n.y);var v=y["default"].fromVerticesAndRotation(l,{x:f.x+h,y:f.y+d},t.rotation);t.moveTo({x:v.x,y:v.y}).setSize({height:v.height,width:v.width}).drawBounds().drawResizers().rotate(t.rotation),t.oldEventPosition=r}(),t}},{key:"onPointerUp",value:function(e){var t=this;if(t.isResizing||t.isRotating){e.stopPropagation();var n=t.model;n.beginUpdate(),t.isRotating&&n.setGeometry(t.cell,{rotation:{angle:t.rotation}}),t.isResizing&&n.setGeometry(t.cell,{position:{x:t.position.x,y:t.position.y},rotation:{angle:t.rotation},size:{width:t.size.width,height:t.size.height}}),n.endUpdate(),t.redraw(),t.resetEvents()}return t}},{key:"destroy",value:function(){this.boundsVel.remove(),this.rotaterVel.remove(),c.forEach(this.resizers,function(e){e.remove()}),this.vel.remove(),c.destroy(this)}}]),t}(m["default"]);t["default"]=P},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(51),l=r(u),c=function(e){function t(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];i(this,t);var r=o(this,Object.getPrototypeOf(t).call(this));return r.paper=e,r.model=e.model,r.init(n),r.on("controller:initalized"),r}return a(t,e),s(t,[{key:"init",value:function(){return this}},{key:"destroy",value:function(){}}]),t}(l["default"]);t["default"]=c},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(5),c=i(l),f=n(27),h=r(f),d=n(4),v=r(d),p=n(59),y=r(p),g=n(60),m=r(g),b=function(e){function t(){return o(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return s(t,e),u(t,[{key:"init",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=this,n=this.getPaper(),r=this.getModel();return this.name=e.name||"connection",this.sourceCellView=null,this.targetCellView=null,this.sourcePort=null,this.targetPort=null,this.connecting=!1,this.previewingLink=null,n.on("cell:mouseOver",function(e,n){t.sourceCellView!==n&&(t.connecting?t.setTargetCellView(n):t.setSourceCellView(n))}),n.on("cell:mouseOut",function(e,n,r){t.connecting?t.targetCellView===n&&t._isOut(n,r.toElement)&&t.setTargetCellView(null):t.sourceCellView===n&&t._isOut(n,r.toElement)&&t.setSourceCellView(null)}),c.addEventListener(n.decoratePane,"mouseout",".port-decorator.out",function(e){t.connecting||c.hasClass(e.toElement,"port-decorator-layer")||t.setSourceCellView(null)}),c.addEventListener(n.decoratePane,"mousedown",".port-decorator.out",function(e){t.connecting=!0;var n=e.delegateTarget;t.sourcePort=n.cellView.findPortByElem(n.portBody),t._drawInPortDecorators()}),c.addEventListener(n.container,"mousemove",function(e){t.connecting&&(t.previewingLink?r.setTerminal(t.previewingLink,n.toLocalPoint({x:e.x,y:e.y}),!1):(t.previewingLink=new y["default"]({sourceMarker:"block",targetMarker:"block"}),r.addLink(t.previewingLink,{node:t.sourceCellView.cell,port:t.sourcePort},n.toLocalPoint({x:e.x,y:e.y}))))}),n.on("cell:pointerUp",function(){t.connecting=!1,t.setSourceCellView(null),t._clearInPortDecorators()}),n.on("blank:pointerUp",function(){t.connecting=!1,t.setSourceCellView(null),t._clearInPortDecorators()}),this}},{key:"_isOut",value:function(e,t){return!c.containsElement(e.elem,t)&&!c.hasClass(t,"port-decorator-layer")}},{key:"setSourceCellView",value:function(e){var t=this,n=this.getPaper();return this.sourceCellView&&c.forEach(n.decoratePane.querySelectorAll(".port-decorator.out"),function(e){(0,h["default"])(e).remove()}),t.sourceCellView=e,e&&t._drawPortDecorators(e,"out"),this}},{key:"_drawInPortDecorators",value:function(){var e=this;return e}},{key:"_clearInPortDecorators",value:function(){var e=this,t=e.paper;return c.forEach(t.decoratePane.querySelectorAll(".port-decorator.in"),function(e){(0,h["default"])(e).remove()}),e}},{key:"_drawPortDecorators",value:function(e,t){var n=['<g class="port-decorator ${className}">','<circle class="back port-decorator-layer" r="8" cx="${x}" cy="${y}"></circle>','<circle class="front port-decorator-layer" r="3" cx="${x}" cy="${y}"></circle>',"</g>"].join(""),r=e.elem.querySelectorAll(".pane-ports."+t+" .pane-port .port-body"),i=this.getPaper(),o=i.decoratePane;c.forEach(r,function(r){var i=v["default"].fromRect((0,h["default"])(r).getBBox(!1)),a=i.getCenter(),s=(0,h["default"])(c.format(n,c.extend({className:t},a)));o.appendChild(s.node),s.node.cellView=e,s.node.portBody=r})}},{key:"setTargetCellView",value:function(){var e=this;return e}}]),t}(m["default"]);t["default"]=b},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function i(e,t,n){var r=["M",e.x,e.y];return a.forEach(n,function(e){r.push(e.x,e.y)}),r.push(t.x,t.y),r.join(" ")}Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),a=r(o);t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t,n){var r=e.cache,i=t?r.renderedSourceMarker:r.renderedTargetMarker,o=t?r.sourceMarkerVel:r.targetMarkerVel;if(i&&o){var a=t?r.sourcePointOnTerminal||r.staticSourcePoint:r.targetPointOnTerminal||r.staticTargetPoint;a&&(o.translateAndAutoOrient(a,n,e.getPane()),e.updateConnectionPointOnMarker(t))}}function a(e,t){var n=e.cache;return t?n.sourcePointOnMarker||n.sourcePointOnTerminal||n.staticSourcePoint:n.targetPointOnMarker||n.targetPointOnTerminal||n.staticTargetPoint}function s(e,t,n){var r=this,i=void 0,s=void 0,u=void 0;if(n&&n.length){var c=[e].concat(n).concat([t]),h=l.getCurveControlPoints(c),d=h[0].length;s=f["default"].fromPoint(h[0][0]),u=f["default"].fromPoint(h[1][d-1]),o(r,!0,s),o(r,!1,u),c[0]=a(r,!0),c[c.length-1]=a(r,!1),i=["M",c[0].x,c[0].y];for(var v=0;d>v;v++)i.push("C",h[0][v].x,h[0][v].y,h[1][v].x,h[1][v].y,c[v+1].x,c[v+1].y)}else{var p=(e.y+t.y)/2;i=["M",e.x,e.y,"C",e.x,p,t.x,p,t.x,t.y]}return i.join(" ")}Object.defineProperty(t,"__esModule",{value:!0});var u=n(50),l=i(u),c=n(18),f=r(c);t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e,t,n){var r=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],i=r.radius||10,o=void 0,a=void 0,u=["M",e.x,e.y];return s.forEach(n,function(r,s){var c=n[s-1]||e,f=n[s+1]||t,h=l["default"].fromPoint(r);o=a||h.distance(c)/2,a=h.distance(f)/2;var d=l["default"].fromPoint(r).move(c,-Math.min(i,o)).smooth(),v=l["default"].fromPoint(r).move(f,-Math.min(i,a)).smooth();u.push(d.x,d.y,"S",r.x,r.y,v.x,v.y,"L")}),u.push(t.x,t.y),u.join(" ")}Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),s=i(a),u=n(18),l=r(u);t["default"]=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(e){var n=t.size||7,r=[],i=.75*n,o=n/2;r.push("M",0,n/2),r.push("L",n,0),r.push("L",i,o),r.push("L",n,n),r.push("Z"),e.attr("d",r.join(" "));var s=t.connectorStrokeWidth;return s>1&&(i+=s/2*(n-i)/o),{rad:Math.atan2(n/2,n),point:new a["default"](i,o)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(18),a=r(o);t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(e){var n=t.rx||5,r=t.ry||n/2,i=[];return i.push("M",n,0),i.push("L",0,r),i.push("L",n,2*r),i.push("L",2*n,r),i.push("Z"),e.attr("d",i.join(" ")),{rad:Math.atan2(r,n),point:new a["default"](2*n-1,r)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(18),a=r(o);t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(e){var n=t.width||7,r=t.height||n*Math.tan(1/6*Math.PI),i=[];return i.push("M",n,0),i.push("L",0,r),i.push("L",n,2*r),i.push("Z"),e.attr({d:i.join(" ")}),{rad:Math.atan2(r,n),point:new a["default"](n,r)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(18),a=r(o);t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(e){var n=t.rx||7,r=t.ry||n/2,i=[];return i.push("M",n,0),i.push("L",0,r),i.push("L",n,2*r),e.attr("d",i.join(" ")),{rad:Math.atan2(r,n),point:new a["default"](0,r)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(18),a=r(o);t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(e){var n=t.rx||3.5,r=t.ry||n,i=(0,a["default"])("ellipse");return i.attr({cx:n,cy:r,rx:n,ry:r}),{vel:i,rad:0,point:new u["default"](2*n,r)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(27),a=r(o),s=n(18),u=r(s);t["default"]=i},function(e,t){}])});