You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
297 KiB
1 lines
297 KiB
!function(){function t(t,e){var i;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(i=n(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var o=0,r=function(){};return{s:r,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,l=!1;return{s:function(){i=t[Symbol.iterator]()},n:function(){var t=i.next();return a=t.done,t},e:function(t){l=!0,s=t},f:function(){try{a||null==i.return||i.return()}finally{if(l)throw s}}}}function e(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||n(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t,e){if(t){if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{"4ZMo":function(t,e,n){(function(){void 0===Math.sgn&&(Math.sgn=function(t){return 0==t?0:t>0?1:-1});var t=function(t,e){return{x:t.x-e.x,y:t.y-e.y}},n=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},i=Math.pow(2,-65),o=function(e,i){for(var o=[],a=r(e,i),l=i.length-1,c=s(a,2*l-1,o,0),d=t(e,i[0]),h=n(d),p=0,f=0;f<c;f++){d=t(e,u(i,l,o[f],null,null));var m=n(d);m<h&&(h=m,p=o[f])}return d=t(e,i[l]),(m=n(d))<h&&(h=m,p=1),{location:p,distance:h}},r=function(e,n){for(var i=n.length-1,o=2*i-1,r=[],s=[],a=[],l=[],c=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],u=0;u<=i;u++)r[u]=t(n[u],e);for(u=0;u<=i-1;u++)s[u]=t(n[u+1],n[u]),s[u]={x:3*(d=s[u]).x,y:3*d.y};for(var d,h,p,f=0;f<=i-1;f++)for(var m=0;m<=i;m++)a[f]||(a[f]=[]),a[f][m]=(h=s[f]).x*(p=r[m]).x+h.y*p.y;for(u=0;u<=o;u++)l[u]||(l[u]=[]),l[u].y=0,l[u].x=parseFloat(u)/o;for(var g=i,v=i-1,b=0;b<=g+v;b++){var y=Math.max(0,b-v),_=Math.min(b,g);for(u=y;u<=_;u++){var P=b-u;l[u+P].y+=a[P][u]*c[P][u]}}return l},s=function t(e,n,i,o){var r,s,d=[],h=[],p=[],f=[];switch(a(e,n)){case 0:return 0;case 1:if(o>=64)return i[0]=(e[0].x+e[n].x)/2,1;if(l(e,n))return i[0]=c(e,n),1}u(e,n,.5,d,h),r=t(d,n,p,o+1),s=t(h,n,f,o+1);for(var m=0;m<r;m++)i[m]=p[m];for(m=0;m<s;m++)i[m+r]=f[m];return r+s},a=function(t,e){var n,i,o=0;n=i=Math.sgn(t[0].y);for(var r=1;r<=e;r++)(n=Math.sgn(t[r].y))!=i&&o++,i=n;return o},l=function(t,e){var n,o,r,s,a,l,c,u,d;s=t[0].y-t[e].y,a=t[e].x-t[0].x,l=t[0].x*t[e].y-t[e].x*t[0].y,u=d=0;for(var h=1;h<e;h++){var p=s*t[h].x+a*t[h].y+l;p>u?u=p:p<d&&(d=p)}return n=(1*(l-u)-0*(c=a))*(1/(0*c-1*s)),o=(1*(l-d)-0*(c=a))*(1/(0*c-1*s)),r=Math.min(n,o),Math.max(n,o)-r<i?1:0},c=function(t,e){var n=t[e].x-t[0].x,i=t[e].y-t[0].y;return 0+1/(0*n-1*i)*(n*(t[0].y-0)-i*(t[0].x-0))*1},u=function(t,e,n,i,o){for(var r=[[]],s=0;s<=e;s++)r[0][s]=t[s];for(var a=1;a<=e;a++)for(s=0;s<=e-a;s++)r[a]||(r[a]=[]),r[a][s]||(r[a][s]={}),r[a][s].x=(1-n)*r[a-1][s].x+n*r[a-1][s+1].x,r[a][s].y=(1-n)*r[a-1][s].y+n*r[a-1][s+1].y;if(null!=i)for(s=0;s<=e;s++)i[s]=r[s][0];if(null!=o)for(s=0;s<=e;s++)o[s]=r[e-s][s];return r[e][0]},d={},h=function(t,e){for(var n=function(t){var e=d[t];if(!e){var n=function(t){return function(e){return t}},i=function(){return function(t){return t}},o=function(){return function(t){return 1-t}},r=function(t){return function(e){for(var n=1,i=0;i<t.length;i++)n*=t[i](e);return n}};(e=[]).push(new function(){return function(e){return Math.pow(e,t)}});for(var s=1;s<t;s++){for(var a=[new n(t)],l=0;l<t-s;l++)a.push(new i);for(l=0;l<s;l++)a.push(new o);e.push(new r(a))}e.push(new function(){return function(e){return Math.pow(1-e,t)}}),d[t]=e}return e}(t.length-1),i=0,o=0,r=0;r<t.length;r++)i+=t[r].x*n[r](e),o+=t[r].y*n[r](e);return{x:i,y:o}},p=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},f=function(t){return t[0].x===t[1].x&&t[0].y===t[1].y},m=function(t,e,n){if(f(t))return{point:t[0],location:e};for(var i=h(t,e),o=0,r=e,s=n>0?1:-1,a=null;o<Math.abs(n);)a=h(t,r+=.005*s),o+=p(a,i),i=a;return{point:a,location:r}},g=function(t,e){var n=h(t,e),i=h(t.slice(0,t.length-1),e),o=i.y-n.y;return 0===o?1/0:Math.atan(o/(i.x-n.x))},v=function(t,e,n,i,o){var r=i-e,s=t-n,a=t*(e-i)+e*(n-t),l=function(t){return[b(t,"x"),b(t,"y")]}(o),c=_.apply(null,[r*l[0][0]+s*l[1][0],r*l[0][1]+s*l[1][1],r*l[0][2]+s*l[1][2],r*l[0][3]+s*l[1][3]+a]),u=[];if(null!=c)for(var d=0;d<3;d++){var h,p=c[d],f=Math.pow(p,2),m=Math.pow(p,3),g=[l[0][0]*m+l[0][1]*f+l[0][2]*p+l[0][3],l[1][0]*m+l[1][1]*f+l[1][2]*p+l[1][3]];h=n-t!=0?(g[0]-t)/(n-t):(g[1]-e)/(i-e),p>=0&&p<=1&&h>=0&&h<=1&&u.push(g)}return u};function b(t,e){return[3*t[1][e]-t[0][e]+-3*t[2][e]+t[3][e],3*t[0][e]-6*t[1][e]+3*t[2][e],-3*t[0][e]+3*t[1][e],t[0][e]]}function y(t){return t<0?-1:t>0?1:0}function _(t,e,n,i){var o,r,s=e/t,a=n/t,l=i/t,c=(3*a-Math.pow(s,2))/9,u=(9*s*a-27*l-2*Math.pow(s,3))/54,d=Math.pow(c,3)+Math.pow(u,2),h=[];if(d>=0)o=y(u+Math.sqrt(d))*Math.pow(Math.abs(u+Math.sqrt(d)),1/3),r=y(u-Math.sqrt(d))*Math.pow(Math.abs(u-Math.sqrt(d)),1/3),h[0]=-s/3+(o+r),h[1]=-s/3-(o+r)/2,h[2]=-s/3-(o+r)/2,0!==Math.abs(Math.sqrt(3)*(o-r)/2)&&(h[1]=-1,h[2]=-1);else{var p=Math.acos(u/Math.sqrt(-Math.pow(c,3)));h[0]=2*Math.sqrt(-c)*Math.cos(p/3)-s/3,h[1]=2*Math.sqrt(-c)*Math.cos((p+2*Math.PI)/3)-s/3,h[2]=2*Math.sqrt(-c)*Math.cos((p+4*Math.PI)/3)-s/3}for(var f=0;f<3;f++)(h[f]<0||h[f]>1)&&(h[f]=-1);return h}var P=this.jsBezier={distanceFromCurve:o,gradientAtPoint:g,gradientAtPointAlongCurveFrom:function(t,e,n){var i=m(t,e,n);return i.location>1&&(i.location=1),i.location<0&&(i.location=0),g(t,i.location)},nearestPointOnCurve:function(t,e){var n=o(t,e);return{point:u(e,e.length-1,n.location,null,null),location:n.location}},pointOnCurve:h,pointAlongCurveFrom:function(t,e,n){return m(t,e,n).point},perpendicularToCurveAt:function(t,e,n,i){var o=m(t,e,i=null==i?0:i),r=g(t,o.location),s=Math.atan(-1/r),a=n/2*Math.sin(s),l=n/2*Math.cos(s);return[{x:o.point.x+l,y:o.point.y+a},{x:o.point.x-l,y:o.point.y-a}]},locationAlongCurveFrom:function(t,e,n){return m(t,e,n).location},getLength:function(t){var e=(new Date).getTime();if(f(t))return 0;for(var n=h(t,0),i=0,o=0,r=null;o<1;)r=h(t,o+=.005),i+=p(r,n),n=r;return console.log("length",(new Date).getTime()-e),i},lineIntersection:v,boxIntersection:function(t,e,n,i,o){var r=[];return r.push.apply(r,v(t,e,t+n,e,o)),r.push.apply(r,v(t+n,e,t+n,e+i,o)),r.push.apply(r,v(t+n,e+i,t,e+i,o)),r.push.apply(r,v(t,e+i,t,e,o)),r},boundingBoxIntersection:function(t,e){var n=[];return n.push.apply(n,v(t.x,t.y,t.x+t.w,t.y,e)),n.push.apply(n,v(t.x+t.w,t.y,t.x+t.w,t.y+t.h,e)),n.push.apply(n,v(t.x+t.w,t.y+t.h,t.x,t.y+t.h,e)),n.push.apply(n,v(t.x,t.y+t.h,t.x,t.y,e)),n},version:"0.9.0"};e.jsBezier=P}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this.Biltong={version:"0.4.0"};e.Biltong=t;var n=function(t){return"[object Array]"===Object.prototype.toString.call(t)},i=function(t,e,i){return i(t=n(t)?t:[t.x,t.y],e=n(e)?e:[e.x,e.y])},o=t.gradient=function(t,e){return i(t,e,function(t,e){return e[0]==t[0]?e[1]>t[1]?1/0:-1/0:e[1]==t[1]?e[0]>t[0]?0:-0:(e[1]-t[1])/(e[0]-t[0])})},r=(t.normal=function(t,e){return-1/o(t,e)},t.lineLength=function(t,e){return i(t,e,function(t,e){return Math.sqrt(Math.pow(e[1]-t[1],2)+Math.pow(e[0]-t[0],2))})},t.quadrant=function(t,e){return i(t,e,function(t,e){return e[0]>t[0]||e[0]==t[0]?e[1]>t[1]?2:1:e[1]>t[1]?3:4})}),s=(t.theta=function(t,e){return i(t,e,function(t,e){var n=o(t,e),i=Math.atan(n),s=r(t,e);return 4!=s&&3!=s||(i+=Math.PI),i<0&&(i+=2*Math.PI),i})},t.intersects=function(t,e){var n=t.x,i=t.x+t.w,o=t.y,r=t.y+t.h,s=e.x,a=e.x+e.w,l=e.y,c=e.y+e.h;return n<=s&&s<=i&&o<=l&&l<=r||n<=a&&a<=i&&o<=l&&l<=r||n<=s&&s<=i&&o<=c&&c<=r||n<=a&&s<=i&&o<=c&&c<=r||s<=n&&n<=a&&l<=o&&o<=c||s<=i&&i<=a&&l<=o&&o<=c||s<=n&&n<=a&&l<=r&&r<=c||s<=i&&n<=a&&l<=r&&r<=c},t.encloses=function(t,e,n){var i=t.y,o=t.y+t.h,r=e.y,s=e.y+e.h,a=function(t,e,i,o){return n?t<=e&&i>=o:t<e&&i>o};return a(t.x,e.x,t.x+t.w,e.x+e.w)&&a(i,r,o,s)},[null,[1,-1],[1,1],[-1,1],[-1,-1]]),a=[null,[-1,-1],[-1,1],[1,1],[1,-1]];t.pointOnLine=function(t,e,n){var i=o(t,e),l=r(t,e),c=n>0?s[l]:a[l],u=Math.atan(i),d=Math.abs(n*Math.sin(u))*c[1],h=Math.abs(n*Math.cos(u))*c[0];return{x:t.x+h,y:t.y+d}},t.perpendicularLineTo=function(t,e,n){var i=o(t,e),r=Math.atan(-1/i),s=n/2*Math.sin(r),a=n/2*Math.cos(r);return[{x:e.x+a,y:e.y+s},{x:e.x-a,y:e.y-s}]}}).call("undefined"!=typeof window?window:this),(function(){"use strict";function t(t,e,n,i,o,r,s,a){return new Touch({target:e,identifier:M(),pageX:n,pageY:i,screenX:o,screenY:r,clientX:s||o,clientY:a||r})}function n(){var t=[];return Array.prototype.push.apply(t,arguments),t.item=function(t){return this[t]},t}var i=function(t,e,n){for(var i=(n=n||t.parentNode).querySelectorAll(e),o=0;o<i.length;o++)if(i[o]===t)return!0;return!1},o=function(t){return"string"==typeof t||t.constructor===String?document.getElementById(t):t},r=function(t){return t.srcElement||t.target},s=function(t,e,n,i){if(i){if(void 0!==t.path&&t.path.indexOf)return{path:t.path,end:t.path.indexOf(n)};var o={path:[],end:-1};return function t(e){o.path.push(e),e===n?o.end=o.path.length-1:null!=e.parentNode&&t(e.parentNode)}(e),o}return{path:[e],end:1}},a=function(t,e){for(var n=0,i=t.length;n<i&&t[n]!=e;n++);n<t.length&&t.splice(n,1)},l=1,c=function(t,e,n){var i=l++;return t.__ta=t.__ta||{},t.__ta[e]=t.__ta[e]||{},t.__ta[e][i]=n,n.__tauid=i,i},u=function(t,e,n,o){if(null==t)return n;var a=t.split(","),l=function o(l){o.__tauid=n.__tauid;var c=r(l),u=c,d=s(l,c,e,null!=t);if(-1!=d.end)for(var h=0;h<d.end;h++){u=d.path[h];for(var p=0;p<a.length;p++)i(u,a[p],e)&&n.apply(u,arguments)}};return d(n,o,l),l},d=function(t,e,n){t.__taExtra=t.__taExtra||[],t.__taExtra.push([e,n])},h=function(t,e,n,i){if(v&&y[e]){var o=u(i,t,n,y[e]);O(t,y[e],o,n)}"focus"===e&&null==t.getAttribute("tabindex")&&t.setAttribute("tabindex","1"),O(t,e,u(i,t,n,e),n)},p={tap:{touches:1,taps:1},dbltap:{touches:1,taps:2},contextmenu:{touches:2,taps:1}},f=function(t,e){return function(n,o,l,c){if("contextmenu"==o&&b)h(n,o,l,c);else{if(null==n.__taTapHandler){var u=n.__taTapHandler={tap:[],dbltap:[],contextmenu:[],down:!1,taps:0,downSelectors:[]},d=function(){u.down=!1},f=function(){u.taps=0};h(n,"mousedown",function(o){for(var a=r(o),l=s(o,a,n,null!=c),h=!1,p=0;p<l.end;p++){if(h)return;a=l.path[p];for(var m=0;m<u.downSelectors.length;m++)if(null==u.downSelectors[m]||i(a,u.downSelectors[m],n)){u.down=!0,setTimeout(d,t),setTimeout(f,e),h=!0;break}}}),h(n,"mouseup",function(t){if(u.down){var e,o,a=r(t);u.taps++;var l=S(t);for(var c in p)if(p.hasOwnProperty(c)){var d=p[c];if(d.touches===l&&(1===d.taps||d.taps===u.taps))for(var h=0;h<u[c].length;h++){o=s(t,a,n,null!=u[c][h][1]);for(var f=0;f<o.end;f++)if(e=o.path[f],null==u[c][h][1]||i(e,u[c][h][1],n)){u[c][h][0].apply(e,[t]);break}}}}})}n.__taTapHandler.downSelectors.push(c),n.__taTapHandler[o].push([l,c]),l.__taUnstore=function(){a(n.__taTapHandler[o],l)}}}},m=function(t,e,n,i){for(var o in n.__tamee[t])n.__tamee[t].hasOwnProperty(o)&&n.__tamee[t][o].apply(i,[e])},g=function(){var t=[];return function(e,n,o,s){if(!e.__tamee){e.__tamee={over:!1,mouseenter:[],mouseexit:[]};var a=function(n){var o=r(n);(null==s&&o==e&&!e.__tamee.over||i(o,s,e)&&(null==o.__tamee||!o.__tamee.over))&&(m("mouseenter",n,e,o),o.__tamee=o.__tamee||{},o.__tamee.over=!0,t.push(o))},l=function(n){for(var o=r(n),s=0;s<t.length;s++)o!=t[s]||i(n.relatedTarget||n.toElement,"*",o)||(o.__tamee.over=!1,t.splice(s,1),m("mouseexit",n,e,o))};O(e,"mouseover",u(s,e,a,"mouseover"),a),O(e,"mouseout",u(s,e,l,"mouseout"),l)}o.__taUnstore=function(){delete e.__tamee[n][o.__tauid]},c(e,n,o),e.__tamee[n][o.__tauid]=o}},v="ontouchstart"in document.documentElement||navigator.maxTouchPoints,b="onmousedown"in document.documentElement,y={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove"},_=function(){var t=-1;if("Microsoft Internet Explorer"==navigator.appName){var e=navigator.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(e)&&(t=parseFloat(RegExp.$1))}return t}(),P=_>-1&&_<9,C=function(t,e){if(null==t)return[0,0];var n=j(t),i=w(n,0);return[i[e+"X"],i[e+"Y"]]},x=function(t){return null==t?[0,0]:P?[t.clientX+document.documentElement.scrollLeft,t.clientY+document.documentElement.scrollTop]:C(t,"page")},w=function(t,e){return t.item?t.item(e):t[e]},j=function(t){return t.touches&&t.touches.length>0?t.touches:t.changedTouches&&t.changedTouches.length>0?t.changedTouches:t.targetTouches&&t.targetTouches.length>0?t.targetTouches:[t]},S=function(t){return j(t).length},O=function(t,e,n,i){if(c(t,e,n),i.__tauid=n.__tauid,t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent){var o=e+n.__tauid;t["e"+o]=n,t[o]=function(){t["e"+o]&&t["e"+o](window.event)},t.attachEvent("on"+e,t[o])}},E=function t(e,n,i){null!=i&&k(e,function(){var r=o(this);if(function(e,n,i){if(e.__ta&&e.__ta[n]&&delete e.__ta[n][i.__tauid],i.__taExtra){for(var o=0;o<i.__taExtra.length;o++)t(e,i.__taExtra[o][0],i.__taExtra[o][1]);i.__taExtra.length=0}i.__taUnstore&&i.__taUnstore()}(r,n,i),null!=i.__tauid)if(r.removeEventListener)r.removeEventListener(n,i,!1),v&&y[n]&&r.removeEventListener(y[n],i,!1);else if(this.detachEvent){var s=n+i.__tauid;r[s]&&r.detachEvent("on"+n,r[s]),r[s]=null,r["e"+s]=null}i.__taTouchProxy&&t(e,i.__taTouchProxy[1],i.__taTouchProxy[0])})},k=function(t,e){if(null!=t){t="undefined"!=typeof Window&&"unknown"!=typeof t.top&&t==t.top?[t]:"string"!=typeof t&&null==t.tagName&&null!=t.length?t:"string"==typeof t?document.querySelectorAll(t):[t];for(var n=0;n<t.length;n++)e.apply(t[n])}},M=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)})};this.Mottle=function(e){var i=(e=e||{}).clickThreshold||250,s=e.dblClickThreshold||450,l=new g,c=new f(i,s),u=e.smartClicks,d=function(t,e,n,i){null!=n&&k(t,function(){var t=o(this);u&&"click"===e?function(t,e,n,i){null==t.__taSmartClicks&&(h(t,"mousedown",function(e){t.__tad=x(e)},i),h(t,"mouseup",function(e){t.__tau=x(e)},i),h(t,"click",function(e){if(t.__tad&&t.__tau&&t.__tad[0]===t.__tau[0]&&t.__tad[1]===t.__tau[1])for(var n=0;n<t.__taSmartClicks.length;n++)t.__taSmartClicks[n].apply(r(e),[e])},i),t.__taSmartClicks=[]),t.__taSmartClicks.push(n),n.__taUnstore=function(){a(t.__taSmartClicks,n)}}(t,0,n,i):"tap"===e||"dbltap"===e||"contextmenu"===e?c(t,e,n,i):"mouseenter"===e||"mouseexit"==e?l(t,e,n,i):h(t,e,n,i)})};this.remove=function(t){return k(t,function(){var t=o(this);if(t.__ta)for(var e in t.__ta)if(t.__ta.hasOwnProperty(e))for(var n in t.__ta[e])t.__ta[e].hasOwnProperty(n)&&E(t,e,t.__ta[e][n]);t.parentNode&&t.parentNode.removeChild(t)}),this},this.on=function(t,e,n,i){var o=arguments[0],r=4==arguments.length?arguments[2]:null,s=arguments[1],a=arguments[arguments.length-1];return d(o,s,a,r),this},this.off=function(t,e,n){return E(t,e,n),this},this.trigger=function(e,i,r,s){var a=b&&("undefined"==typeof MouseEvent||null==r||r.constructor===MouseEvent),l=v&&!b&&y[i]?y[i]:i,c=!(v&&!b&&y[i]),u=x(r),d=C(r,"screen"),h=C(r,"client");return k(e,function(){var e,p=o(this);r=r||{screenX:d[0],screenY:d[1],clientX:h[0],clientY:h[1]};var f=function(t){s&&(t.payload=s)},m={TouchEvent:function(e){var i=function(e,i,o,r,s,a,l,c){return n(t.apply(null,arguments))}(window,p,0,u[0],u[1],d[0],d[1],h[0],h[1]);(e.initTouchEvent||e.initEvent)(l,!0,!0,window,null,d[0],d[1],h[0],h[1],!1,!1,!1,!1,i,i,i,1,0)},MouseEvents:function(t){t.initMouseEvent(l,!0,!0,window,0,d[0],d[1],h[0],h[1],!1,!1,!1,!1,1,p)}};if(document.createEvent){var g=!c&&!a&&v&&y[i]?"TouchEvent":"MouseEvents";e=document.createEvent(g),m[g](e),f(e),p.dispatchEvent(e)}else document.createEventObject&&((e=document.createEventObject()).eventType=e.eventName=l,e.screenX=d[0],e.screenY=d[1],e.clientX=h[0],e.clientY=h[1],f(e),p.fireEvent("on"+l,e))}),this}},this.Mottle.consume=function(t,e){t.stopPropagation?t.stopPropagation():t.returnValue=!1,!e&&t.preventDefault&&t.preventDefault()},this.Mottle.pageLocation=x,this.Mottle.setForceTouchEvents=function(t){v=t},this.Mottle.setForceMouseEvents=function(t){b=t},this.Mottle.version="0.8.0",e.Mottle=this.Mottle}).call("undefined"==typeof window?this:window),(function(){"use strict";var t=function(t,e,n){return-1===t.indexOf(e)&&(n?t.unshift(e):t.push(e),!0)},n=function(t,e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)},i=function(t,e){for(var n=[],i=0;i<t.length;i++)-1===e.indexOf(t[i])&&n.push(t[i]);return n},o=function(t){return null!=t&&("string"==typeof t||t.constructor===String)},r=function(t){var e=t.getBoundingClientRect(),n=document.body,i=document.documentElement,o=window.pageYOffset||i.scrollTop||n.scrollTop,r=window.pageXOffset||i.scrollLeft||n.scrollLeft,s=e.left+r-(i.clientLeft||n.clientLeft||0);return{top:Math.round(e.top+o-(i.clientTop||n.clientTop||0)),left:Math.round(s)}},s=function(t,e,n){for(var i=(n=n||t.parentNode).querySelectorAll(e),o=0;o<i.length;o++)if(i[o]===t)return!0;return!1},a=function(t,e,n){if(s(e,n,t))return e;for(var i=e.parentNode;null!=i&&i!==t;){if(s(i,n,t))return i;i=i.parentNode}},l=function(t,e,n){for(var i=null,o=e.getAttribute("katavorio-draggable"),r=null!=o?"[katavorio-draggable='"+o+"'] ":"",l=0;l<t.length;l++)if(null!=(i=a(e,n,r+t[l].selector))){if(t[l].filter){var c=s(n,t[l].filter,i);if(!0===t[l].filterExclude&&!c||c)return null}return[t[l],i]}return null},c=function(){var t=-1;if("Microsoft Internet Explorer"===navigator.appName){var e=navigator.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(e)&&(t=parseFloat(RegExp.$1))}return t}(),u=c>-1&&c<9,d=9===c,h=function(t){if(u)return[t.clientX+document.documentElement.scrollLeft,t.clientY+document.documentElement.scrollTop];var e=f(t),n=p(e,0);return d?[n.pageX||n.clientX,n.pageY||n.clientY]:[n.pageX,n.pageY]},p=function(t,e){return t.item?t.item(e):t[e]},f=function(t){return t.touches&&t.touches.length>0?t.touches:t.changedTouches&&t.changedTouches.length>0?t.changedTouches:t.targetTouches&&t.targetTouches.length>0?t.targetTouches:[t]},m={delegatedDraggable:"katavorio-delegated-draggable",draggable:"katavorio-draggable",droppable:"katavorio-droppable",drag:"katavorio-drag",selected:"katavorio-drag-selected",active:"katavorio-drag-active",hover:"katavorio-drag-hover",noSelect:"katavorio-drag-no-select",ghostProxy:"katavorio-ghost-proxy",clonedDrag:"katavorio-clone-drag"},g=["stop","start","drag","drop","over","out","beforeStart"],v=function(){},b=function(){return!0},y=function(t,e,n){for(var i=0;i<t.length;i++)t[i]!=n&&e(t[i])},_=function(t,e,n,i){y(t,function(t){t.setActive(e),e&&t.updatePosition(),n&&t.setHover(i,e)})},P=function(t,e){if(null!=t){t=o(t)||null!=t.tagName||null==t.length?[t]:t;for(var n=0;n<t.length;n++)e.apply(t[n],[t[n]])}},C=function(t){t.stopPropagation?(t.stopPropagation(),t.preventDefault()):t.returnValue=!1},x=function(t,e,n){return!s(t.srcElement||t.target,n.getInputFilterSelector(),e)},w=function(t,e,n,i){this.params=e||{},this.el=t,this.params.addClass(this.el,this._class),this.uuid=k();var o=!0;return this.setEnabled=function(t){o=t},this.isEnabled=function(){return o},this.toggleEnabled=function(){o=!o},this.setScope=function(t){this.scopes=t?t.split(/\s+/):[i]},this.addScope=function(t){var e={};for(var n in P(this.scopes,function(t){e[t]=!0}),P(t?t.split(/\s+/):[],function(t){e[t]=!0}),this.scopes=[],e)this.scopes.push(n)},this.removeScope=function(t){var e={};for(var n in P(this.scopes,function(t){e[t]=!0}),P(t?t.split(/\s+/):[],function(t){delete e[t]}),this.scopes=[],e)this.scopes.push(n)},this.toggleScope=function(t){var e={};for(var n in P(this.scopes,function(t){e[t]=!0}),P(t?t.split(/\s+/):[],function(t){e[t]?delete e[t]:e[t]=!0}),this.scopes=[],e)this.scopes.push(n)},this.setScope(e.scope),this.k=e.katavorio,e.katavorio},j=function(){return!0},S=function(){return!1},O=function(t,e,n,i){this._class=n.draggable;var a=w.apply(this,arguments);this.rightButtonCanDrag=this.params.rightButtonCanDrag;var c,u,d,p,f,g,v=[0,0],y=null,P=null,O=[0,0],E=!1,D=[0,0],I=!1!==this.params.consumeStartEvent,T=this.el,A=this.params.clone,F=!1!==e.multipleDrop,U=!1,L=null,H=[],R=null,N=e.ghostProxyParent;if(c=!0===e.ghostProxy?j:e.ghostProxy&&"function"==typeof e.ghostProxy?e.ghostProxy:function(t,e){return!(!R||!R.useGhostProxy)&&R.useGhostProxy(t,e)},u=e.makeGhostProxy?e.makeGhostProxy:function(t){return R&&R.makeGhostProxy?R.makeGhostProxy(t):t.cloneNode(!0)},e.selector){var G=t.getAttribute("katavorio-draggable");null==G&&(G=""+(new Date).getTime(),t.setAttribute("katavorio-draggable",G)),H.push(e)}var B,$=e.snapThreshold,V=function(t,e,n,i,o){var r=e*Math.floor(t[0]/e),s=r+e,a=Math.abs(t[0]-r)<=i?r:Math.abs(s-t[0])<=i?s:t[0],l=n*Math.floor(t[1]/n),c=l+n;return[a,Math.abs(t[1]-l)<=o?l:Math.abs(c-t[1])<=o?c:t[1]]};this.posses=[],this.posseRoles={},this.toGrid=function(t){return null==this.params.grid?t:V(t,this.params.grid[0],this.params.grid[1],this.params.grid?this.params.grid[0]/2:$||5,this.params.grid?this.params.grid[1]/2:$||5)},this.snap=function(t,e){if(null!=T){t=t||(this.params.grid?this.params.grid[0]:10),e=e||(this.params.grid?this.params.grid[1]:10);var n=this.params.getPosition(T),i=V(n,t,e,this.params.grid?this.params.grid[0]/2:$,this.params.grid?this.params.grid[1]/2:$);return this.params.setPosition(T,i),i}},this.setUseGhostProxy=function(t){c=t?j:S};var X=function(t){return!1===e.allowNegative?[Math.max(0,t[0]),Math.max(0,t[1])]:t},Y=(function(t){B="function"==typeof t?t:t?(function(t,e,n,i){return X([Math.max(0,Math.min(n.w-i[0],t[0])),Math.max(0,Math.min(n.h-i[1],t[1]))])}).bind(this):function(t){return X(t)}}).bind(this);Y("function"==typeof this.params.constrain?this.params.constrain:this.params.constrain||this.params.containment),this.setConstrain=function(t){Y(t)};var q,W=function(t,e,n,i){return null!=R&&R.constrain&&"function"==typeof R.constrain?R.constrain(t,e,n,i):B(t,e,n,i)};this.setRevert=function(t){q=t},this.params.revert&&(q=this.params.revert);var z=function(t){return"function"==typeof t?(t._katavorioId=k(),t._katavorioId):t},J={},Z=function(t){for(var e in J){var n=J[e],i=n[0](t);if(n[1]&&(i=!i),!i)return!1}return!0},K=this.setFilter=function(e,n){if(e){var i=z(e);J[i]=[function(n){var i,r=n.srcElement||n.target;return o(e)?i=s(r,e,t):"function"==typeof e&&(i=e(n,t)),i},!1!==n]}};this.addFilter=K,this.removeFilter=function(t){delete J["function"==typeof t?t._katavorioId:t]},this.clearAllFilters=function(){J={}},this.canDrag=this.params.canDrag||b;var Q,tt=[],et=[];this.addSelector=function(t){t.selector&&H.push(t)},this.downListener=(function(t){if(!t.defaultPrevented&&(this.rightButtonCanDrag||3!==t.which&&2!==t.button)&&this.isEnabled()&&this.canDrag())if(Z(t)&&x(t,this.el,this.k)){if(R=null,L=null,H.length>0){var e=l(H,this.el,t.target||t.srcElement);if(null!=e&&(R=e[0],L=e[1]),null==L)return}else L=this.el;if(A)if(T=L.cloneNode(!0),this.params.addClass(T,m.clonedDrag),T.setAttribute("id",null),T.style.position="absolute",null!=this.params.parent){var i=this.params.getPosition(this.el);T.style.left=i[0]+"px",T.style.top=i[1]+"px",this.params.parent.appendChild(T)}else{var o=r(L);T.style.left=o.left+"px",T.style.top=o.top+"px",document.body.appendChild(T)}else T=L;I&&C(t),v=h(t),T&&T.parentNode&&(D=[T.parentNode.scrollLeft,T.parentNode.scrollTop]),this.params.bind(document,"mousemove",this.moveListener),this.params.bind(document,"mouseup",this.upListener),a.markSelection(this),a.markPosses(this),this.params.addClass(document.body,n.noSelect),ot("beforeStart",{el:this.el,pos:y,e:t,drag:this})}else this.params.consumeFilteredEvents&&C(t)}).bind(this),this.moveListener=(function(t){if(v){if(!E)if(!1!==ot("start",{el:this.el,pos:y,e:t,drag:this})){if(!v)return;this.mark(!0),E=!0}else this.abort();if(v){et.length=0;var e=h(t),n=e[0]-v[0],i=e[1]-v[1],o=this.params.ignoreZoom?1:a.getZoom();T&&T.parentNode&&(n+=T.parentNode.scrollLeft-D[0],i+=T.parentNode.scrollTop-D[1]),this.moveBy(n/=o,i/=o,t),a.updateSelection(n,i,this),a.updatePosses(n,i,this)}}}).bind(this),this.upListener=(function(t){v&&(v=null,this.params.unbind(document,"mousemove",this.moveListener),this.params.unbind(document,"mouseup",this.upListener),this.params.removeClass(document.body,n.noSelect),this.unmark(t),a.unmarkSelection(this,t),a.unmarkPosses(this,t),this.stop(t),a.notifyPosseDragStop(this,t),E=!1,et.length=0,A?(T&&T.parentNode&&T.parentNode.removeChild(T),T=null):q&&!0===q(T,this.params.getPosition(T))&&(this.params.setPosition(T,y),ot("revert",T)))}).bind(this),this.getFilters=function(){return J},this.abort=function(){null!=v&&this.upListener()},this.getDragElement=function(t){return t?L||this.el:T||this.el};var nt={start:[],drag:[],stop:[],over:[],out:[],beforeStart:[],revert:[]};e.events.start&&nt.start.push(e.events.start),e.events.beforeStart&&nt.beforeStart.push(e.events.beforeStart),e.events.stop&&nt.stop.push(e.events.stop),e.events.drag&&nt.drag.push(e.events.drag),e.events.revert&&nt.revert.push(e.events.revert),this.on=function(t,e){nt[t]&&nt[t].push(e)},this.off=function(t,e){if(nt[t]){for(var n=[],i=0;i<nt[t].length;i++)nt[t][i]!==e&&n.push(nt[t][i]);nt[t]=n}};var it,ot=function(t,e){var n=null;if(R&&R[t])n=R[t](e);else if(nt[t])for(var i=0;i<nt[t].length;i++)try{var o=nt[t][i](e);null!=o&&(n=o)}catch(r){}return n};this.notifyStart=function(t){ot("start",{el:this.el,pos:this.params.getPosition(T),e:t,drag:this})},this.stop=function(t,e){if(e||E){var n=[],i=a.getSelection(),o=this.params.getPosition(T);if(i.length>0)for(var r=0;r<i.length;r++){var s=this.params.getPosition(i[r].el);n.push([i[r].el,{left:s[0],top:s[1]},i[r]])}else n.push([T,{left:o[0],top:o[1]},this]);ot("stop",{el:T,pos:it||o,finalPos:o,e:t,drag:this,selection:n})}},this.mark=function(t){var e;y=this.params.getPosition(T),P=this.params.getPosition(T,!0),O=[P[0]-y[0],P[1]-y[1]],this.size=this.params.getSize(T),tt=a.getMatchingDroppables(this),_(tt,!0,!1,this),this.params.addClass(T,this.params.dragClass||n.drag),e=this.params.getConstrainingRectangle?this.params.getConstrainingRectangle(T):this.params.getSize(T.parentNode),Q={w:e[0],h:e[1]},f=0,g=0,t&&a.notifySelectionDragStart(this)},this.unmark=function(t,i){if(_(tt,!1,!0,this),U&&c(L,T)?(it=[T.offsetLeft-f,T.offsetTop-g],T.parentNode.removeChild(T),T=L):it=null,this.params.removeClass(T,this.params.dragClass||n.drag),tt.length=0,U=!1,!i){et.length>0&&it&&e.setPosition(L,it),et.sort(M);for(var o=0;o<et.length&&!0!==et[o].drop(this,t);o++);}},this.moveBy=function(t,n,i){et.length=0;var o=this.toGrid([y[0]+t,y[1]+n]),r=W(o,T,Q,this.size);if(c(this.el,T))if(o[0]!==r[0]||o[1]!==r[1]){if(!U){var s=u(L);e.addClass(s,m.ghostProxy),N?(N.appendChild(s),d=e.getPosition(L.parentNode,!0),p=e.getPosition(e.ghostProxyParent,!0),f=d[0]-p[0],g=d[1]-p[1]):L.parentNode.appendChild(s),T=s,U=!0}r=o}else U&&(T.parentNode.removeChild(T),T=L,U=!1,d=null,p=null,f=0,g=0);var a={x:r[0],y:r[1],w:this.size[0],h:this.size[1]},l={x:a.x+O[0],y:a.y+O[1],w:a.w,h:a.h},h=null;this.params.setPosition(T,[r[0]+f,r[1]+g]);for(var v=0;v<tt.length;v++)this.params.intersects(l,{x:tt[v].pagePosition[0],y:tt[v].pagePosition[1],w:tt[v].size[0],h:tt[v].size[1]})&&(F||null==h||h===tt[v].el)&&tt[v].canDrop(this)?(h||(h=tt[v].el),et.push(tt[v]),tt[v].setHover(this,!0,i)):tt[v].isHover()&&tt[v].setHover(this,!1,i);ot("drag",{el:this.el,pos:r,e:i,drag:this})},this.destroy=function(){this.params.unbind(this.el,"mousedown",this.downListener),this.params.unbind(document,"mousemove",this.moveListener),this.params.unbind(document,"mouseup",this.upListener),this.downListener=null,this.upListener=null,this.moveListener=null},this.params.bind(this.el,"mousedown",this.downListener),this.params.handle?K(this.params.handle,!1):K(this.params.filter,this.params.filterExclude)},E=function(t,e,n,i){this._class=n.droppable,this.params=e||{},this.rank=e.rank||0,this._activeClass=this.params.activeClass||n.active,this._hoverClass=this.params.hoverClass||n.hover,w.apply(this,arguments);var o=!1;this.allowLoopback=!1!==this.params.allowLoopback,this.setActive=function(t){this.params[t?"addClass":"removeClass"](this.el,this._activeClass)},this.updatePosition=function(){this.position=this.params.getPosition(this.el),this.pagePosition=this.params.getPosition(this.el,!0),this.size=this.params.getSize(this.el)},this.canDrop=this.params.canDrop||function(t){return!0},this.isHover=function(){return o},this.setHover=function(t,e,n){(e||null==this.el._katavorioDragHover||this.el._katavorioDragHover===t.el._katavorio)&&(this.params[e?"addClass":"removeClass"](this.el,this._hoverClass),this.el._katavorioDragHover=e?t.el._katavorio:null,o!==e&&this.params.events[e?"over":"out"]({el:this.el,e:n,drag:t,drop:this}),o=e)},this.drop=function(t,e){return this.params.events.drop({drag:t,e:e,drop:this})},this.destroy=function(){this._class=null,this._activeClass=null,this._hoverClass=null,o=null}},k=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})},M=function(t,e){return t.rank<e.rank?1:t.rank>e.rank?-1:0},D=function(t){return null==t||null==(t="string"==typeof t||t.constructor===String?document.getElementById(t):t)?null:(t._katavorio=t._katavorio||k(),t)};this.Katavorio=function(e){var r=[],s={};this._dragsByScope={},this._dropsByScope={};var a=1,l=function(t,e){P(t,function(t){for(var n=0;n<t.scopes.length;n++)e[t.scopes[n]]=e[t.scopes[n]]||[],e[t.scopes[n]].push(t)})},c=function(t,n){var i=0;return P(t,function(t){for(var o=0;o<t.scopes.length;o++)if(n[t.scopes[o]]){var r=e.indexOf(n[t.scopes[o]],t);-1!==r&&(n[t.scopes[o]].splice(r,1),i++)}}),i>0},u=(this.getMatchingDroppables=function(t){for(var e=[],n={},i=0;i<t.scopes.length;i++){var o=this._dropsByScope[t.scopes[i]];if(o)for(var r=0;r<o.length;r++)!o[r].canDrop(t)||n[o[r].uuid]||!o[r].allowLoopback&&o[r].el===t.el||(n[o[r].uuid]=!0,e.push(o[r]))}return e.sort(M),e},(function(t){t=t||{};var n,i={events:{}};for(n in e)i[n]=e[n];for(n in t)i[n]=t[n];for(n=0;n<g.length;n++)i.events[g[n]]=t[g[n]]||v;return i.katavorio=this,i}).bind(this)),d=(function(t,e){for(var n=0;n<g.length;n++)e[g[n]]&&t.on(g[n],e[g[n]])}).bind(this),h={},p=e.css||{},f=e.scope||"katavorio-drag-scope";for(var b in m)h[b]=m[b];for(var b in p)h[b]=p[b];var _=e.inputFilterSelector||"input,textarea,select,button,option";this.getInputFilterSelector=function(){return _},this.setInputFilterSelector=function(t){return _=t,this},this.draggable=function(t,n){var i=[];return P(t,(function(t){if(null!=(t=D(t)))if(null==t._katavorioDrag){var o=u(n);t._katavorioDrag=new O(t,o,h,f),l(t._katavorioDrag,this._dragsByScope),i.push(t._katavorioDrag),e.addClass(t,o.selector?h.delegatedDraggable:h.draggable)}else d(t._katavorioDrag,n)}).bind(this)),i},this.droppable=function(t,n){var i=[];return P(t,(function(t){if(null!=(t=D(t))){var o=new E(t,u(n),h,f);t._katavorioDrop=t._katavorioDrop||[],t._katavorioDrop.push(o),l(o,this._dropsByScope),i.push(o),e.addClass(t,h.droppable)}}).bind(this)),i},this.select=function(t){return P(t,function(){var t=D(this);t&&t._katavorioDrag&&(s[t._katavorio]||(r.push(t._katavorioDrag),s[t._katavorio]=[t,r.length-1],e.addClass(t,h.selected)))}),this},this.deselect=function(t){return P(t,function(){var t=D(this);if(t&&t._katavorio&&s[t._katavorio]){for(var n=[],i=0;i<r.length;i++)r[i].el!==t&&n.push(r[i]);r=n,delete s[t._katavorio],e.removeClass(t,h.selected)}}),this},this.deselectAll=function(){for(var t in s)e.removeClass(s[t][0],h.selected);r.length=0,s={}},this.markSelection=function(t){y(r,function(t){t.mark()},t)},this.markPosses=function(t){t.posses&&P(t.posses,function(e){t.posseRoles[e]&&S[e]&&y(S[e].members,function(t){t.mark()},t)})},this.unmarkSelection=function(t,e){y(r,function(t){t.unmark(e)},t)},this.unmarkPosses=function(t,e){t.posses&&P(t.posses,function(n){t.posseRoles[n]&&S[n]&&y(S[n].members,function(t){t.unmark(e,!0)},t)})},this.getSelection=function(){return r.slice(0)},this.updateSelection=function(t,e,n){y(r,function(n){n.moveBy(t,e)},n)};var C=function(t,e){e.posses&&P(e.posses,function(n){e.posseRoles[n]&&S[n]&&y(S[n].members,function(e){t(e)},e)})};this.updatePosses=function(t,e,n){C(function(n){n.moveBy(t,e)},n)},this.notifyPosseDragStop=function(t,e){C(function(t){t.stop(e,!0)},t)},this.notifySelectionDragStop=function(t,e){y(r,function(t){t.stop(e,!0)},t)},this.notifySelectionDragStart=function(t,e){y(r,function(t){t.notifyStart(e)},t)},this.setZoom=function(t){a=t},this.getZoom=function(){return a};var x=function(t,e,n,i){P(t,function(t){c(t,n),t[i](e),l(t,n)})};P(["set","add","remove","toggle"],(function(t){this[t+"Scope"]=(function(e,n){x(e._katavorioDrag,n,this._dragsByScope,t+"Scope"),x(e._katavorioDrop,n,this._dropsByScope,t+"Scope")}).bind(this),this[t+"DragScope"]=(function(e,n){x(e.constructor===O?e:e._katavorioDrag,n,this._dragsByScope,t+"Scope")}).bind(this),this[t+"DropScope"]=(function(e,n){x(e.constructor===E?e:e._katavorioDrop,n,this._dropsByScope,t+"Scope")}).bind(this)}).bind(this)),this.snapToGrid=function(t,e){for(var n in this._dragsByScope)y(this._dragsByScope[n],function(n){n.snap(t,e)})},this.getDragsForScope=function(t){return this._dragsByScope[t]},this.getDropsForScope=function(t){return this._dropsByScope[t]};var w=function(t,e,n){if((t=D(t))[e]){var i=r.indexOf(t[e]);i>=0&&r.splice(i,1),c(t[e],n)&&P(t[e],function(t){t.destroy()}),delete t[e]}},j=function(t,e,n,i){(t=D(t))[e]&&t[e].off(n,i)};this.elementRemoved=function(t){t._katavorioDrag&&this.destroyDraggable(t),t._katavorioDrop&&this.destroyDroppable(t)},this.destroyDraggable=function(t,e,n){1===arguments.length?w(t,"_katavorioDrag",this._dragsByScope):j(t,"_katavorioDrag",e,n)},this.destroyDroppable=function(t,e,n){1===arguments.length?w(t,"_katavorioDrop",this._dropsByScope):j(t,"_katavorioDrop",e,n)},this.reset=function(){this._dragsByScope={},this._dropsByScope={},r=[],s={},S={}};var S={},k=function(e,n,i){var r,s=o(n)?n:n.id,a=!!o(n)||!1!==n.active,l=S[s]||(S[s]=r={name:s,members:[]},r);return P(e,function(e){if(e._katavorioDrag){if(i&&null!=e._katavorioDrag.posseRoles[l.name])return;t(l.members,e._katavorioDrag),t(e._katavorioDrag.posses,l.name),e._katavorioDrag.posseRoles[l.name]=a}}),l};this.addToPosse=function(t,e){for(var n=[],i=1;i<arguments.length;i++)n.push(k(t,arguments[i]));return 1===n.length?n[0]:n},this.setPosse=function(t,e){for(var n=[],o=1;o<arguments.length;o++)n.push(k(t,arguments[o],!0).name);return P(t,(function(t){if(t._katavorioDrag){var e=i(t._katavorioDrag.posses,n);Array.prototype.push.apply([],t._katavorioDrag.posses);for(var o=0;o<e.length;o++)this.removeFromPosse(t,e[o])}}).bind(this)),1===n.length?n[0]:n},this.removeFromPosse=function(t,e){if(arguments.length<2)throw new TypeError("No posse id provided for remove operation");for(var i=1;i<arguments.length;i++)e=arguments[i],P(t,function(t){if(t._katavorioDrag&&t._katavorioDrag.posses){var i=t._katavorioDrag;P(e,function(t){n(S[t].members,i),n(i.posses,t),delete i.posseRoles[t]})}})},this.removeFromAllPosses=function(t){P(t,function(t){if(t._katavorioDrag&&t._katavorioDrag.posses){var e=t._katavorioDrag;P(e.posses,function(t){n(S[t].members,e)}),e.posses.length=0,e.posseRoles={}}})},this.setPosseState=function(t,e,n){var i=S[e];i&&P(t,function(t){t._katavorioDrag&&t._katavorioDrag.posses&&(t._katavorioDrag.posseRoles[i.name]=n)})}},this.Katavorio.version="1.0.0",e.Katavorio=this.Katavorio}).call("undefined"!=typeof window?window:this),(function(){this.jsPlumbUtil=this.jsPlumbUtil||{};var t=this.jsPlumbUtil;function n(t){return"[object Array]"===Object.prototype.toString.call(t)}function i(t){return"string"==typeof t}function o(t){return"boolean"==typeof t}function r(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function s(t){return"[object Date]"===Object.prototype.toString.call(t)}function a(t){return"[object Function]"===Object.prototype.toString.call(t)}function l(t){if(i(t))return""+t;if(o(t))return!!t;if(s(t))return new Date(t.getTime());if(a(t))return t;if(n(t)){for(var e=[],c=0;c<t.length;c++)e.push(l(t[c]));return e}if(r(t)){var u={};for(var d in t)u[d]=l(t[d]);return u}return t}function c(t,e,s,a){var c,u,d={},h={};for(s=s||[],a=a||[],u=0;u<s.length;u++)d[s[u]]=!0;for(u=0;u<a.length;u++)h[a[u]]=!0;var p=l(t);for(u in e)if(null==p[u]||h[u])p[u]=e[u];else if(i(e[u])||o(e[u]))d[u]?((c=[]).push.apply(c,n(p[u])?p[u]:[p[u]]),c.push.apply(c,o(e[u])?e[u]:[e[u]]),p[u]=c):p[u]=e[u];else if(n(e[u]))c=[],n(p[u])&&c.push.apply(c,p[u]),c.push.apply(c,e[u]),p[u]=c;else if(r(e[u]))for(var f in r(p[u])||(p[u]={}),e[u])p[u][f]=e[u][f];return p}function u(t,e){if(t)for(var n=0;n<t.length;n++)if(e(t[n]))return n;return-1}function d(t,e){var n=t.indexOf(e);return n>-1&&t.splice(n,1),-1!==n}function h(t,e,n,i){var o=t[e];return null==o&&(t[e]=o=[]),o[i?"unshift":"push"](n),o}e.jsPlumbUtil=t,t.isArray=n,t.isNumber=function(t){return"[object Number]"===Object.prototype.toString.call(t)},t.isString=i,t.isBoolean=o,t.isNull=function(t){return null==t},t.isObject=r,t.isDate=s,t.isFunction=a,t.isNamedFunction=function(t){return a(t)&&null!=t.name&&t.name.length>0},t.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},t.clone=l,t.merge=c,t.replace=function(t,e,n){if(null!=t){var i=t;return e.replace(/([^\.])+/g,function(t,e,o,r){var s=t.match(/([^\[0-9]+){1}(\[)([0-9+])/),a=function(){return i[s[1]]||(i[s[1]]=[],i[s[1]])};if(o+t.length>=r.length)s?a()[s[3]]=n:i[t]=n;else if(s){var l=a();i=l[s[3]]||(l[s[3]]={},l[s[3]])}else i=i[t]||(i[t]={},i[t]);return""}),t}},t.functionChain=function(t,e,n){for(var i=0;i<n.length;i++){var o=n[i][0][n[i][1]].apply(n[i][0],n[i][2]);if(o===e)return o}return t},t.populate=function(t,e,o,s){return function t(l){if(null!=l){if(i(l))return function(t){var n=t.match(/(\${.*?})/g);if(null!=n)for(var i=0;i<n.length;i++){var o=e[n[i].substring(2,n[i].length-1)]||"";null!=o&&(t=t.replace(n[i],o))}return t}(l);if(!a(l)||s||null!=o&&0!==(l.name||"").indexOf(o)){if(n(l)){for(var c=[],u=0;u<l.length;u++)c.push(t(l[u]));return c}if(r(l)){var d={};for(var h in l)d[h]=t(l[h]);return d}return l}return l(e)}}(t)},t.findWithFunction=u,t.removeWithFunction=function(t,e){var n=u(t,e);return n>-1&&t.splice(n,1),-1!==n},t.remove=d,t.addWithFunction=function(t,e,n){-1===u(t,n)&&t.push(e)},t.addToList=h,t.suggest=function(t,e,n){return-1===t.indexOf(e)&&(n?t.unshift(e):t.push(e),!0)},t.extend=function(t,e,i){var o;e=n(e)?e:[e];var r=function(e){for(var n=e.__proto__;null!=n;)if(null!=n.prototype){for(var i in n.prototype)n.prototype.hasOwnProperty(i)&&!t.prototype.hasOwnProperty(i)&&(t.prototype[i]=n.prototype[i]);n=n.prototype.__proto__}else n=null};for(o=0;o<e.length;o++){for(var s in e[o].prototype)e[o].prototype.hasOwnProperty(s)&&!t.prototype.hasOwnProperty(s)&&(t.prototype[s]=e[o].prototype[s]);r(e[o])}var a=function(t,n){return function(){for(o=0;o<e.length;o++)e[o].prototype[t]&&e[o].prototype[t].apply(this,arguments);return n.apply(this,arguments)}},l=function(e){for(var n in e)t.prototype[n]=a(n,e[n])};if(arguments.length>2)for(o=2;o<arguments.length;o++)l(arguments[o]);return t};for(var p=[],f=0;f<256;f++)p[f]=(f<16?"0":"")+f.toString(16);function m(){var t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return p[255&t]+p[t>>8&255]+p[t>>16&255]+p[t>>24&255]+"-"+p[255&e]+p[e>>8&255]+"-"+p[e>>16&15|64]+p[e>>24&255]+"-"+p[63&n|128]+p[n>>8&255]+"-"+p[n>>16&255]+p[n>>24&255]+p[255&i]+p[i>>8&255]+p[i>>16&255]+p[i>>24&255]}function g(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(t.logEnabled&&"undefined"!=typeof console)try{var i=arguments[arguments.length-1];console.log(i)}catch(o){}}function v(t,e,n){var i=[t[0]-e[0],t[1]-e[1]],o=Math.cos(n/360*Math.PI*2),r=Math.sin(n/360*Math.PI*2);return[i[0]*o-i[1]*r+e[0],i[1]*o+i[0]*r+e[1],o,r]}t.uuid=m,t.fastTrim=function(t){if(null==t)return null;for(var e=t.replace(/^\s\s*/,""),n=/\s/,i=e.length;n.test(e.charAt(--i)););return e.slice(0,i+1)},t.each=function(t,e){t=null==t.length||"string"==typeof t?[t]:t;for(var n=0;n<t.length;n++)e(t[n])},t.map=function(t,e){for(var n=[],i=0;i<t.length;i++)n.push(e(t[i]));return n},t.mergeWithParents=function(t,e,n){n=n||"parent";var i=function(t){return t?e[t]:null},o=function(t){return t?i(t[n]):null},r=function t(e){if(null==e)return{};if("string"==typeof e)return i(e);if(e.length){for(var n=!1,o=0,r=void 0;!n&&o<e.length;)(r=t(e[o]))?n=!0:o++;return r}}(t);return r?function t(e,n){if(null==e)return n;var i=["anchor","anchors","cssClass","connector","paintStyle","hoverPaintStyle","endpoint","endpoints"];"override"===n.mergeStrategy&&Array.prototype.push.apply(i,["events","overlays"]);var r=c(e,n,[],i);return t(o(e),r)}(o(r),r):{}},t.logEnabled=!0,t.log=g,t.wrap=function(t,e,n){return function(){var i=null;try{null!=e&&(i=e.apply(this,arguments))}catch(o){g("jsPlumb function failed : "+o)}if(null!=t&&(null==n||i!==n))try{i=t.apply(this,arguments)}catch(o){g("wrapped function failed : "+o)}return i}},t.EventGenerator=function(){var t=this;this._listeners={},this.eventsSuspended=!1,this.tick=!1,this.eventsToDieOn={ready:!0},this.queue=[],this.bind=function(e,n,i){var o=function(e){h(t._listeners,e,n,i),n.__jsPlumb=n.__jsPlumb||{},n.__jsPlumb[m()]=e};if("string"==typeof e)o(e);else if(null!=e.length)for(var r=0;r<e.length;r++)o(e[r]);return t},this.fire=function(t,e,n){if(this.tick)this.queue.unshift(arguments);else{if(this.tick=!0,!this.eventsSuspended&&this._listeners[t]){var i=this._listeners[t].length,o=0,r=!1,s=null;if(!this.shouldFireEvent||this.shouldFireEvent(t,e,n))for(;!r&&o<i&&!1!==s;){if(this.eventsToDieOn[t])this._listeners[t][o].apply(this,[e,n]);else try{s=this._listeners[t][o].apply(this,[e,n])}catch(a){g("jsPlumb: fire failed for event "+t+" : "+a)}o++,null!=this._listeners&&null!=this._listeners[t]||(r=!0)}}this.tick=!1,this._drain()}return this},this._drain=function(){var e=t.queue.pop();e&&t.fire.apply(t,e)},this.unbind=function(t,e){if(0===arguments.length)this._listeners={};else if(1===arguments.length){if("string"==typeof t)delete this._listeners[t];else if(t.__jsPlumb)for(var n in t.__jsPlumb)d(this._listeners[t.__jsPlumb[n]]||[],t)}else 2===arguments.length&&d(this._listeners[t]||[],e);return this},this.getListener=function(e){return t._listeners[e]},this.setSuspendEvents=function(e){t.eventsSuspended=e},this.isSuspendEvents=function(){return t.eventsSuspended},this.silently=function(e){t.setSuspendEvents(!0);try{e()}catch(n){g("Cannot execute silent function "+n)}t.setSuspendEvents(!1)},this.cleanupListeners=function(){for(var e in t._listeners)t._listeners[e]=null}},t.rotatePoint=v,t.rotateAnchorOrientation=function(t,e){var n=v(t,[0,0],e);return[Math.round(n[0]),Math.round(n[1])]}}).call("undefined"!=typeof window?window:this),(function(){"use strict";this.jsPlumbUtil.matchesSelector=function(t,e,n){for(var i=(n=n||t.parentNode).querySelectorAll(e),o=0;o<i.length;o++)if(i[o]===t)return!0;return!1},this.jsPlumbUtil.consume=function(t,e){t.stopPropagation?t.stopPropagation():t.returnValue=!1,!e&&t.preventDefault&&t.preventDefault()},this.jsPlumbUtil.sizeElement=function(t,e,n,i,o){t&&(t.style.height=o+"px",t.height=o,t.style.width=i+"px",t.width=i,t.style.left=e+"px",t.style.top=n+"px")}}).call("undefined"!=typeof window?window:this),(function(){var t={deriveAnchor:function(t,e,n,i){return{top:["TopRight","TopLeft"],bottom:["BottomRight","BottomLeft"]}[t][e]}},e=function(t,e){this.count=0,this.instance=t,this.lists={},this.options=e||{},this.instance.addList=function(t,e){return this.listManager.addList(t,e)},this.instance.removeList=function(t){this.listManager.removeList(t)},this.instance.bind("manageElement",(function(t){for(var e=this.instance.getSelector(t.el,"[jtk-scrollable-list]"),n=0;n<e.length;n++)this.addList(e[n])}).bind(this)),this.instance.bind("unmanageElement",function(t){this.removeList(t.el)}),this.instance.bind("connection",(function(t,e){null==e&&(this._maybeUpdateParentList(t.source),this._maybeUpdateParentList(t.target))}).bind(this))};this.jsPlumbListManager=e,e.prototype={addList:function(e,i){var o=this.instance.extend({},t);this.instance.extend(o,this.options),i=this.instance.extend(o,i||{});var r=[this.instance.getInstanceIndex(),this.count++].join("_");this.lists[r]=new n(this.instance,e,i,r)},removeList:function(t){var e=this.lists[t._jsPlumbList];e&&(e.destroy(),delete this.lists[t._jsPlumbList])},_maybeUpdateParentList:function(t){for(var e=t.parentNode,n=this.instance.getContainer();null!=e&&e!==n;){if(null!=e._jsPlumbList&&null!=this.lists[e._jsPlumbList])return void e._jsPlumbScrollHandler();e=e.parentNode}}};var n=function(t,e,n,i){function o(t,e,i,o){return n.anchor?n.anchor:n.deriveAnchor(t,e,i,o)}function r(t,e,i,o){return n.deriveEndpoint?n.deriveEndpoint(t,e,i,o):n.endpoint?n.endpoint:i.type}e._jsPlumbList=i;var s=function(n){for(var i=t.getSelector(e,".jtk-managed"),s=t.getId(e),a=0;a<i.length;a++){if(i[a].offsetTop<e.scrollTop)i[a]._jsPlumbProxies||(i[a]._jsPlumbProxies=i[a]._jsPlumbProxies||[],t.select({source:i[a]}).each(function(n){t.proxyConnection(n,0,e,s,function(){return r("top",0,n.endpoints[0],n)},function(){return o("top",0,n.endpoints[0],n)}),i[a]._jsPlumbProxies.push([n,0])}),t.select({target:i[a]}).each(function(n){t.proxyConnection(n,1,e,s,function(){return r("top",1,n.endpoints[1],n)},function(){return o("top",1,n.endpoints[1],n)}),i[a]._jsPlumbProxies.push([n,1])}));else if(i[a].offsetTop+i[a].offsetHeight>e.scrollTop+e.offsetHeight)i[a]._jsPlumbProxies||(i[a]._jsPlumbProxies=i[a]._jsPlumbProxies||[],t.select({source:i[a]}).each(function(n){t.proxyConnection(n,0,e,s,function(){return r("bottom",0,n.endpoints[0],n)},function(){return o("bottom",0,n.endpoints[0],n)}),i[a]._jsPlumbProxies.push([n,0])}),t.select({target:i[a]}).each(function(n){t.proxyConnection(n,1,e,s,function(){return r("bottom",1,n.endpoints[1],n)},function(){return o("bottom",1,n.endpoints[1],n)}),i[a]._jsPlumbProxies.push([n,1])}));else if(i[a]._jsPlumbProxies){for(var l=0;l<i[a]._jsPlumbProxies.length;l++)t.unproxyConnection(i[a]._jsPlumbProxies[l][0],i[a]._jsPlumbProxies[l][1],s);delete i[a]._jsPlumbProxies}t.revalidate(i[a])}!function(e){for(var n=e.parentNode,i=t.getContainer();null!=n&&n!==i;){if(t.hasClass(n,"jtk-managed"))return void t.recalculateOffsets(n);n=n.parentNode}}(e)};t.setAttribute(e,"jtk-scrollable-list","true"),e._jsPlumbScrollHandler=s,t.on(e,"scroll",s),s(),this.destroy=function(){t.off(e,"scroll",s),delete e._jsPlumbScrollHandler;for(var n=t.getSelector(e,".jtk-managed"),i=t.getId(e),o=0;o<n.length;o++)if(n[o]._jsPlumbProxies){for(var r=0;r<n[o]._jsPlumbProxies.length;r++)t.unproxyConnection(n[o]._jsPlumbProxies[r][0],n[o]._jsPlumbProxies[r][1],i);delete n[o]._jsPlumbProxies}}}}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this,n=t.jsPlumbUtil,i=function(t){if(t._jsPlumb.paintStyle&&t._jsPlumb.hoverPaintStyle){var e={};h.extend(e,t._jsPlumb.paintStyle),h.extend(e,t._jsPlumb.hoverPaintStyle),delete t._jsPlumb.hoverPaintStyle,e.gradient&&t._jsPlumb.paintStyle.fill&&delete e.gradient,t._jsPlumb.hoverPaintStyle=e}},o=["tap","dbltap","click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","contextmenu"],r=function(t){return null==t?null:t.split(" ")},s=function(t,e,n){for(var i in e)t[i]=n},a=function(t,e,i){if(t.getDefaultType){var o=t.getTypeDescriptor(),r={},a=t.getDefaultType(),l=n.merge({},a);s(r,a,"__default");for(var c=0,u=t._jsPlumb.types.length;c<u;c++){var d=t._jsPlumb.types[c];if("__default"!==d){var h=t._jsPlumb.instance.getType(d,o);if(null!=h){var p=["anchor","anchors","connector","paintStyle","hoverPaintStyle","endpoint","endpoints","connectorOverlays","connectorStyle","connectorHoverStyle","endpointStyle","endpointHoverStyle"],f=[];"override"===h.mergeStrategy?Array.prototype.push.apply(p,["events","overlays","cssClass"]):f.push("cssClass"),l=n.merge(l,h,f,p),s(r,h,d)}}}e&&(l=n.populate(l,e,"_")),t.applyType(l,i,r),i||t.repaint()}},l=t.jsPlumbUIComponent=function(t){n.EventGenerator.apply(this,arguments);var e=this,i=arguments,o=e.idPrefix,r=o+(new Date).getTime();this._jsPlumb={instance:t._jsPlumb,parameters:t.parameters||{},paintStyle:null,hoverPaintStyle:null,paintStyleInUse:null,hover:!1,beforeDetach:t.beforeDetach,beforeDrop:t.beforeDrop,overlayPlacements:[],hoverClass:t.hoverClass||t._jsPlumb.Defaults.HoverClass,types:[],typeCache:{}},this.cacheTypeItem=function(t,e,n){this._jsPlumb.typeCache[n]=this._jsPlumb.typeCache[n]||{},this._jsPlumb.typeCache[n][t]=e},this.getCachedTypeItem=function(t,e){return this._jsPlumb.typeCache[e]?this._jsPlumb.typeCache[e][t]:null},this.getId=function(){return r};var s=t.overlays||[],a={};if(this.defaultOverlayKeys){for(var l=0;l<this.defaultOverlayKeys.length;l++)Array.prototype.push.apply(s,this._jsPlumb.instance.Defaults[this.defaultOverlayKeys[l]]||[]);for(l=0;l<s.length;l++){var c=h.convertToFullOverlaySpec(s[l]);a[c[1].id]=c}}var u={overlays:a,parameters:t.parameters||{},scope:t.scope||this._jsPlumb.instance.getDefaultScope()};if(this.getDefaultType=function(){return u},this.appendToDefaultType=function(t){for(var e in t)u[e]=t[e]},t.events)for(var d in t.events)e.bind(d,t.events[d]);this.clone=(function(){var t=Object.create(this.constructor.prototype);return this.constructor.apply(t,i),t}).bind(this),this.isDetachAllowed=function(t){var e=!0;if(this._jsPlumb.beforeDetach)try{e=this._jsPlumb.beforeDetach(t)}catch(i){n.log("jsPlumb: beforeDetach callback failed",i)}return e},this.isDropAllowed=function(t,e,i,o,r,s,a){var l=this._jsPlumb.instance.checkCondition("beforeDrop",{sourceId:t,targetId:e,scope:i,connection:o,dropEndpoint:r,source:s,target:a});if(this._jsPlumb.beforeDrop)try{l=this._jsPlumb.beforeDrop({sourceId:t,targetId:e,scope:i,connection:o,dropEndpoint:r,source:s,target:a})}catch(c){n.log("jsPlumb: beforeDrop callback failed",c)}return l};var p=[];this.setListenerComponent=function(t){for(var e=0;e<p.length;e++)p[e][3]=t}},c=function(t,e){var n=t._jsPlumb.instance.getType(t._jsPlumb.types[e],t.getTypeDescriptor());null!=n&&n.cssClass&&t.canvas&&t._jsPlumb.instance.removeClass(t.canvas,n.cssClass)};n.extend(t.jsPlumbUIComponent,n.EventGenerator,{getParameter:function(t){return this._jsPlumb.parameters[t]},setParameter:function(t,e){this._jsPlumb.parameters[t]=e},getParameters:function(){return this._jsPlumb.parameters},setParameters:function(t){this._jsPlumb.parameters=t},getClass:function(){return h.getClass(this.canvas)},hasClass:function(t){return h.hasClass(this.canvas,t)},addClass:function(t){h.addClass(this.canvas,t)},removeClass:function(t){h.removeClass(this.canvas,t)},updateClasses:function(t,e){h.updateClasses(this.canvas,t,e)},setType:function(t,e,n){this.clearTypes(),this._jsPlumb.types=r(t)||[],a(this,e,n)},getType:function(){return this._jsPlumb.types},reapplyTypes:function(t,e){a(this,t,e)},hasType:function(t){return-1!==this._jsPlumb.types.indexOf(t)},addType:function(t,e,n){var i=r(t),o=!1;if(null!=i){for(var s=0,l=i.length;s<l;s++)this.hasType(i[s])||(this._jsPlumb.types.push(i[s]),o=!0);o&&a(this,e,n)}},removeType:function(t,e,n){var i=r(t),o=!1,s=(function(t){var e=this._jsPlumb.types.indexOf(t);return-1!==e&&(c(this,e),this._jsPlumb.types.splice(e,1),!0)}).bind(this);if(null!=i){for(var l=0,u=i.length;l<u;l++)o=s(i[l])||o;o&&a(this,e,n)}},clearTypes:function(t,e){for(var n=this._jsPlumb.types.length,i=0;i<n;i++)c(this,0),this._jsPlumb.types.splice(0,1);a(this,t,e)},toggleType:function(t,e,n){var i=r(t);if(null!=i){for(var o=0,s=i.length;o<s;o++){var l=this._jsPlumb.types.indexOf(i[o]);-1!==l?(c(this,l),this._jsPlumb.types.splice(l,1)):this._jsPlumb.types.push(i[o])}a(this,e,n)}},applyType:function(t,e){if(this.setPaintStyle(t.paintStyle,e),this.setHoverPaintStyle(t.hoverPaintStyle,e),t.parameters)for(var n in t.parameters)this.setParameter(n,t.parameters[n]);this._jsPlumb.paintStyleInUse=this.getPaintStyle()},setPaintStyle:function(t,e){this._jsPlumb.paintStyle=t,this._jsPlumb.paintStyleInUse=this._jsPlumb.paintStyle,i(this),e||this.repaint()},getPaintStyle:function(){return this._jsPlumb.paintStyle},setHoverPaintStyle:function(t,e){this._jsPlumb.hoverPaintStyle=t,i(this),e||this.repaint()},getHoverPaintStyle:function(){return this._jsPlumb.hoverPaintStyle},destroy:function(t){(t||null==this.typeId)&&(this.cleanupListeners(),this.clone=null,this._jsPlumb=null)},isHover:function(){return this._jsPlumb.hover},setHover:function(t,e,n){if(this._jsPlumb&&!this._jsPlumb.instance.currentlyDragging&&!this._jsPlumb.instance.isHoverSuspended()){this._jsPlumb.hover=t;var i=t?"addClass":"removeClass";null!=this.canvas&&(null!=this._jsPlumb.instance.hoverClass&&this._jsPlumb.instance[i](this.canvas,this._jsPlumb.instance.hoverClass),null!=this._jsPlumb.hoverClass&&this._jsPlumb.instance[i](this.canvas,this._jsPlumb.hoverClass)),null!=this._jsPlumb.hoverPaintStyle&&(this._jsPlumb.paintStyleInUse=t?this._jsPlumb.hoverPaintStyle:this._jsPlumb.paintStyle,this._jsPlumb.instance.isSuspendDrawing()||(n=n||jsPlumbUtil.uuid(),this.repaint({timestamp:n,recalc:!1}))),this.getAttachedElements&&!e&&function(t,e,n,i){var o=t.getAttachedElements();if(o)for(var r=0,s=o.length;r<s;r++)i&&i===o[r]||o[r].setHover(e,!0,n)}(this,t,jsPlumbUtil.uuid(),this)}}});var u=0,d=t.jsPlumbInstance=function(e){this.version="2.15.6",this.Defaults={Anchor:"Bottom",Anchors:[null,null],ConnectionsDetachable:!0,ConnectionOverlays:[],Connector:"Bezier",Container:null,DoNotThrowErrors:!1,DragOptions:{},DropOptions:{},Endpoint:"Dot",EndpointOverlays:[],Endpoints:[null,null],EndpointStyle:{fill:"#456"},EndpointStyles:[null,null],EndpointHoverStyle:null,EndpointHoverStyles:[null,null],HoverPaintStyle:null,LabelStyle:{color:"black"},ListStyle:{},LogEnabled:!1,Overlays:[],MaxConnections:1,PaintStyle:{"stroke-width":4,stroke:"#456"},ReattachConnections:!1,RenderMode:"svg",Scope:"jsPlumb_DefaultScope"},e&&h.extend(this.Defaults,e),this.logEnabled=this.Defaults.LogEnabled,this._connectionTypes={},this._endpointTypes={},n.EventGenerator.apply(this);var i=this,r=function(){var t=u+1;return u++,t}(),s=i.bind,a={},c=1,d=function(t){if(null==t)return null;if(3===t.nodeType||8===t.nodeType)return{el:t,text:!0};var e=i.getElement(t);return{el:e,id:n.isString(t)&&null==e?t:N(e)}};for(var p in this.getInstanceIndex=function(){return r},this.setZoom=function(t,e){return i.fire("zoom",c=t),e&&i.repaintEverything(),!0},this.getZoom=function(){return c},this.Defaults)a[p]=this.Defaults[p];var f,m=[];this.unbindContainer=function(){if(null!=f&&m.length>0)for(var t=0;t<m.length;t++)i.off(f,m[t][0],m[t][1])},this.setContainer=function(t){this.unbindContainer(),t=this.getElement(t),this.select().each(function(e){e.moveParent(t)}),this.selectEndpoints().each(function(e){e.moveParent(t)});var e=f;f=t,m.length=0;for(var n={endpointclick:"endpointClick",endpointdblclick:"endpointDblClick"},r=function(t,e,o){var r=e.srcElement||e.target,s=(r&&r.parentNode?r.parentNode._jsPlumb:null)||(r?r._jsPlumb:null)||(r&&r.parentNode&&r.parentNode.parentNode?r.parentNode.parentNode._jsPlumb:null);s&&(s.fire(t,s,e),i.fire(o&&n[o+t]||t,s.component||s,e))},s=function(t,e,n){m.push([t,n]),i.on(f,t,e,n)},a=function(t){s(t,".jtk-connector",function(e){r(t,e)}),s(t,".jtk-endpoint",function(e){r(t,e,"endpoint")}),s(t,".jtk-overlay",function(e){r(t,e)})},l=0;l<o.length;l++)a(o[l]);for(var c in P){var u=P[c].el;u.parentNode===e&&(e.removeChild(u),f.appendChild(u))}},this.getContainer=function(){return f},this.bind=function(t,e){"ready"===t&&v?e():s.apply(i,[t,e])},i.importDefaults=function(t){for(var e in t)i.Defaults[e]=t[e];return t.Container&&i.setContainer(t.Container),i},i.restoreDefaults=function(){return i.Defaults=h.extend({},a),i};var g=null,v=!1,b=[],y={},_={},P={},C={},x={},w=!1,j=[],S=!1,O=null,E=this.Defaults.Scope,k=1,M=function(){return""+k++},D=(function(t,e){f?f.appendChild(t):e?this.getElement(e).appendChild(t):this.appendToRoot(t)}).bind(this),I=function(t,e,n,o){var r={c:[],e:[]};if(!S&&null!=(t=i.getElement(t))){var s=N(t),a=t.querySelectorAll(".jtk-managed");null==n&&(n=jsPlumbUtil.uuid()),rt({elId:s,offset:e,recalc:!1,timestamp:n});for(var l=0;l<a.length;l++)rt({elId:a[l].getAttribute("id"),recalc:!0,timestamp:n});var c=i.router.redraw(s,e,n,null,o);if(Array.prototype.push.apply(r.c,c.c),Array.prototype.push.apply(r.e,c.e),a)for(var u=0;u<a.length;u++)c=i.router.redraw(a[u].getAttribute("id"),null,n,null,o,!0),Array.prototype.push.apply(r.c,c.c),Array.prototype.push.apply(r.e,c.e)}return r},T=function(t){return _[t]},A=(function(t,e){var o=h.extend({},t);if(e&&h.extend(o,e),o.source&&(o.source.endpoint?o.sourceEndpoint=o.source:o.source=i.getElement(o.source)),o.target&&(o.target.endpoint?o.targetEndpoint=o.target:o.target=i.getElement(o.target)),t.uuids&&(o.sourceEndpoint=T(t.uuids[0]),o.targetEndpoint=T(t.uuids[1])),o.sourceEndpoint&&o.sourceEndpoint.isFull())n.log(i,"could not add connection; source endpoint is full");else if(o.targetEndpoint&&o.targetEndpoint.isFull())n.log(i,"could not add connection; target endpoint is full");else{if(!o.type&&o.sourceEndpoint&&(o.type=o.sourceEndpoint.connectionType),o.sourceEndpoint&&o.sourceEndpoint.connectorOverlays){o.overlays=o.overlays||[];for(var r=0,s=o.sourceEndpoint.connectorOverlays.length;r<s;r++)o.overlays.push(o.sourceEndpoint.connectorOverlays[r])}o.sourceEndpoint&&o.sourceEndpoint.scope&&(o.scope=o.sourceEndpoint.scope),!o["pointer-events"]&&o.sourceEndpoint&&o.sourceEndpoint.connectorPointerEvents&&(o["pointer-events"]=o.sourceEndpoint.connectorPointerEvents);var a=function(t,e,n,r){if(o[t]&&!o[t].endpoint&&!o[t+"Endpoint"]&&!o.newConnection){var s=n[N(o[t])];if(s=s?s[r]:null){if(!s.enabled)return!1;var a=h.extend({},s.def);delete a.label;var l=null!=s.endpoint&&s.endpoint._jsPlumb?s.endpoint:function(t,e,n){var r=function(t,e){var n=h.extend({},t);for(var i in e)e[i]&&(n[i]=e[i]);return n}(e,{anchor:o.anchors?o.anchors[n]:o.anchor,endpoint:o.endpoints?o.endpoints[n]:o.endpoint,paintStyle:o.endpointStyles?o.endpointStyles[n]:o.endpointStyle,hoverPaintStyle:o.endpointHoverStyles?o.endpointHoverStyles[n]:o.endpointHoverStyle});return i.addEndpoint(t,r)}(o[t],a,e);if(l.isFull())return!1;o[t+"Endpoint"]=l,!o.scope&&a.scope&&(o.scope=a.scope),s.uniqueEndpoint?s.endpoint?l.finalEndpoint=s.endpoint:(s.endpoint=l,l.setDeleteOnEmpty(!1)):l.setDeleteOnEmpty(!0),0===e&&s.def.connectorOverlays&&(o.overlays=o.overlays||[],Array.prototype.push.apply(o.overlays,s.def.connectorOverlays))}}};if(!1!==a("source",0,this.sourceEndpointDefinitions,o.type||"default")&&!1!==a("target",1,this.targetEndpointDefinitions,o.type||"default"))return o.sourceEndpoint&&o.targetEndpoint&&(function(t,e){for(var n=t.scope.split(/\s/),i=e.scope.split(/\s/),o=0;o<n.length;o++)for(var r=0;r<i.length;r++)if(i[r]===n[o])return!0;return!1}(o.sourceEndpoint,o.targetEndpoint)||(o=null)),o}}).bind(i),F=function t(e){var n=i.Defaults.ConnectionType||i.getDefaultConnectionType();e._jsPlumb=i,e.newConnection=t,e.newEndpoint=L,e.endpointsByUUID=_,e.endpointsByElement=y,e.finaliseConnection=U,e.id="con_"+M();var o=new n(e);return o.isDetachable()&&(o.endpoints[0].initDraggable("_jsPlumbSource"),o.endpoints[1].initDraggable("_jsPlumbTarget")),o},U=i.finaliseConnection=function(t,e,n,o){e=e||{},t.suspendedEndpoint||b.push(t),t.pending=null,t.endpoints[0].isTemporarySource=!1,!1!==o&&i.router.newConnection(t),I(t.source),e.doNotFireConnectionEvent||!1===e.fireEvent||i.fire("connection",{connection:t,source:t.source,target:t.target,sourceId:t.sourceId,targetId:t.targetId,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1]},n)},L=function t(e,n){var o=i.Defaults.EndpointType||h.Endpoint,r=h.extend({},e);r._jsPlumb=i,r.newConnection=F,r.newEndpoint=t,r.endpointsByUUID=_,r.endpointsByElement=y,r.fireDetachEvent=$,r.elementId=n||N(r.source);var s=new o(r);return s.id="ep_"+M(),ot(r.elementId,r.source),h.headless||i.getDragManager().endpointAdded(r.source,n),s},H=function(t,e,n){var i=y[t];if(i&&i.length)for(var o=0,r=i.length;o<r;o++){for(var s=0,a=i[o].connections.length;s<a;s++)if(e(i[o].connections[s]))return;n&&n(i[o])}},R=function(t,e,n){e="block"===e;var i=null;n&&(i=function(t){t.setVisible(e,!0,!0)});var o=d(t);H(o.id,function(t){e&&n?t.endpoints[t.sourceId===o.id?1:0].isVisible()&&t.setVisible(!0):t.setVisible(e)},i)},N=function(t,e,o){if(n.isString(t))return t;if(null==t)return null;var s=i.getAttribute(t,"id");return s&&"undefined"!==s||(2===arguments.length&&void 0!==arguments[1]?s=e:(1===arguments.length||3===arguments.length&&!arguments[2])&&(s="jsPlumb_"+r+"_"+M()),o||i.setAttribute(t,"id",s)),s};this.setConnectionBeingDragged=function(t){w=t},this.isConnectionBeingDragged=function(){return w},this.getManagedElements=function(){return P},this.connectorClass="jtk-connector",this.connectorOutlineClass="jtk-connector-outline",this.connectedClass="jtk-connected",this.hoverClass="jtk-hover",this.endpointClass="jtk-endpoint",this.endpointConnectedClass="jtk-endpoint-connected",this.endpointFullClass="jtk-endpoint-full",this.endpointDropAllowedClass="jtk-endpoint-drop-allowed",this.endpointDropForbiddenClass="jtk-endpoint-drop-forbidden",this.overlayClass="jtk-overlay",this.draggingClass="jtk-dragging",this.elementDraggingClass="jtk-element-dragging",this.sourceElementDraggingClass="jtk-source-element-dragging",this.targetElementDraggingClass="jtk-target-element-dragging",this.endpointAnchorClassPrefix="jtk-endpoint-anchor",this.hoverSourceClass="jtk-source-hover",this.hoverTargetClass="jtk-target-hover",this.dragSelectClass="jtk-drag-select",this.Anchors={},this.Connectors={svg:{}},this.Endpoints={svg:{}},this.Overlays={svg:{}},this.ConnectorRenderers={},this.SVG="svg",this.addEndpoint=function(t,e,o){var r=h.extend({},o=o||{});h.extend(r,e),r.endpoint=r.endpoint||i.Defaults.Endpoint,r.paintStyle=r.paintStyle||i.Defaults.EndpointStyle;for(var s=[],a=n.isArray(t)||null!=t.length&&!n.isString(t)?t:[t],l=0,c=a.length;l<c;l++){r.source=i.getElement(a[l]),it(r.source);var u=N(r.source),d=L(r,u),p=ot(u,r.source,null,!S).info.o;n.addToList(y,u,d),S||d.paint({anchorLoc:d.anchor.compute({xy:[p.left,p.top],wh:j[u],element:d,timestamp:O,rotation:this.getRotation(u)}),timestamp:O}),s.push(d)}return 1===s.length?s[0]:s},this.addEndpoints=function(t,e,o){for(var r=[],s=0,a=e.length;s<a;s++){var l=i.addEndpoint(t,e[s],o);n.isArray(l)?Array.prototype.push.apply(r,l):r.push(l)}return r},this.animate=function(t,e,o){if(!this.animationSupported)return!1;o=o||{};var r=i.getElement(t),s=N(r),a=h.animEvents.step,l=h.animEvents.complete;o[a]=n.wrap(o[a],function(){i.revalidate(s)}),o[l]=n.wrap(o[l],function(){i.revalidate(s)}),i.doAnimate(r,e,o)},this.checkCondition=function(t,e){var o=i.getListener(t),r=!0;if(o&&o.length>0){var s=Array.prototype.slice.call(arguments,1);try{for(var a=0,l=o.length;a<l;a++)r=r&&o[a].apply(o[a],s)}catch(c){n.log(i,"cannot check condition ["+t+"]"+c)}}return r},this.connect=function(t,e){var i,o=A(t,e);if(o){if(null==o.source&&null==o.sourceEndpoint)return void n.log("Cannot establish connection - source does not exist");if(null==o.target&&null==o.targetEndpoint)return void n.log("Cannot establish connection - target does not exist");it(o.source),i=F(o),U(i,o)}return i};var G=[{el:"source",elId:"sourceId",epDefs:"sourceEndpointDefinitions"},{el:"target",elId:"targetId",epDefs:"targetEndpointDefinitions"}],B=(function(t,e,n,i){var o,r,s,a=G[n],l=t[a.elId],c=t.endpoints[n],u={index:n,originalSourceId:0===n?l:t.sourceId,newSourceId:t.sourceId,originalTargetId:1===n?l:t.targetId,newTargetId:t.targetId,connection:t};if(e.constructor===h.Endpoint)(o=e).addConnection(t),e=o.element;else if(r=N(e),s=this[a.epDefs][r],r===t[a.elId])o=null;else if(s)for(var d in s){if(!s[d].enabled)return;o=null!=s[d].endpoint&&s[d].endpoint._jsPlumb?s[d].endpoint:this.addEndpoint(e,s[d].def),s[d].uniqueEndpoint&&(s[d].endpoint=o),o.addConnection(t)}else o=t.makeEndpoint(0===n,e,r);return null!=o&&(c.detachFromConnection(t),t.endpoints[n]=o,t[a.el]=o.element,t[a.elId]=o.elementId,u[0===n?"newSourceId":"newTargetId"]=o.elementId,V(u),i||t.repaint()),u.element=e,u}).bind(this);this.setSource=function(t,e,n){var i=B(t,e,0,n);this.router.sourceOrTargetChanged(i.originalSourceId,i.newSourceId,t,i.el,0)},this.setTarget=function(t,e,n){var i=B(t,e,1,n);this.router.sourceOrTargetChanged(i.originalTargetId,i.newTargetId,t,i.el,1)},this.deleteEndpoint=function(t,e,n){var o="string"==typeof t?_[t]:t;return o&&i.deleteObject({endpoint:o,dontUpdateHover:e,deleteAttachedObjects:n}),i},this.deleteEveryEndpoint=function(){var t=i.setSuspendDrawing(!0);for(var e in y){var n=y[e];if(n&&n.length)for(var o=0,r=n.length;o<r;o++)i.deleteEndpoint(n[o],!0)}y={},P={},_={},C={},x={},i.router.reset();var s=i.getDragManager();return s&&s.reset(),t||i.setSuspendDrawing(!1),i};var $=function(t,e,n){var o=i.Defaults.ConnectionType||i.getDefaultConnectionType(),r=t.constructor===o?{connection:t,source:t.source,target:t.target,sourceId:t.sourceId,targetId:t.targetId,sourceEndpoint:t.endpoints[0],targetEndpoint:t.endpoints[1]}:t;e&&i.fire("connectionDetached",r,n),i.fire("internal.connectionDetached",r,n),i.router.connectionDetached(r)},V=i.fireMoveEvent=function(t,e){i.fire("connectionMoved",t,e)};this.unregisterEndpoint=function(t){for(var e in t._jsPlumb.uuid&&(_[t._jsPlumb.uuid]=null),i.router.deleteEndpoint(t),y){var n=y[e];if(n){for(var o=[],r=0,s=n.length;r<s;r++)n[r]!==t&&o.push(n[r]);y[e]=o}y[e].length<1&&delete y[e]}},this.deleteConnection=function(t,e){return!(null==t||!(e=e||{}).force&&!n.functionChain(!0,!1,[[t.endpoints[0],"isDetachAllowed",[t]],[t.endpoints[1],"isDetachAllowed",[t]],[t,"isDetachAllowed",[t]],[i,"checkCondition",["beforeDetach",t]]])||(t.setHover(!1),$(t,!t.pending&&!1!==e.fireEvent,e.originalEvent),t.endpoints[0].detachFromConnection(t),t.endpoints[1].detachFromConnection(t),n.removeWithFunction(b,function(e){return t.id===e.id}),t.cleanup(),t.destroy(),0))},this.deleteEveryConnection=function(t){t=t||{};var e=b.length,n=0;return i.batch(function(){for(var o=0;o<e;o++)n+=i.deleteConnection(b[0],t)?1:0}),n},this.deleteConnectionsForElement=function(t,e){e=e||{},t=i.getElement(t);var n=N(t),o=y[n];if(o&&o.length)for(var r=0,s=o.length;r<s;r++)o[r].deleteEveryConnection(e);return i},this.deleteObject=function(t){var e={endpoints:{},connections:{},endpointCount:0,connectionCount:0},o=!1!==t.deleteAttachedObjects,r=function(n){null!=n&&null==e.connections[n.id]&&(t.dontUpdateHover||null==n._jsPlumb||n.setHover(!1),e.connections[n.id]=n,e.connectionCount++)};for(var s in t.connection?r(t.connection):function(n){if(null!=n&&null==e.endpoints[n.id]&&(t.dontUpdateHover||null==n._jsPlumb||n.setHover(!1),e.endpoints[n.id]=n,e.endpointCount++,o))for(var i=0;i<n.connections.length;i++)r(n.connections[i])}(t.endpoint),e.connections){var a=e.connections[s];if(a._jsPlumb){n.removeWithFunction(b,function(t){return a.id===t.id}),$(a,!1!==t.fireEvent&&!a.pending,t.originalEvent);var l=null==t.deleteAttachedObjects?null:!t.deleteAttachedObjects;a.endpoints[0].detachFromConnection(a,null,l),a.endpoints[1].detachFromConnection(a,null,l),a.cleanup(!0),a.destroy(!0)}}for(var c in e.endpoints){var u=e.endpoints[c];u._jsPlumb&&(i.unregisterEndpoint(u),u.cleanup(!0),u.destroy(!0))}return e};var X=function(t,e,n,i){for(var o=0,r=t.length;o<r;o++)t[o][e].apply(t[o],n);return i(t)},Y=function(t,e,n){for(var i=[],o=0,r=t.length;o<r;o++)i.push([t[o][e].apply(t[o],n),t[o]]);return i},q=function(t,e,n){return function(){return X(t,e,arguments,n)}},W=function(t,e){return function(){return Y(t,e,arguments)}},z=function(t,e){var n=[];if(t)if("string"==typeof t){if("*"===t)return t;n.push(t)}else if(e)n=t;else if(t.length)for(var i=0,o=t.length;i<o;i++)n.push(d(t[i]).id);else n.push(d(t).id);return n},J=function(t,e,n){return"*"===t||(t.length>0?-1!==t.indexOf(e):!n)};this.getConnections=function(t,e){t?t.constructor===String&&(t={scope:t}):t={};for(var n=t.scope||i.getDefaultScope(),o=z(n,!0),r=z(t.source),s=z(t.target),a=!e&&o.length>1?{}:[],l=function(t,n){if(!e&&o.length>1){var i=a[t];null==i&&(i=a[t]=[]),i.push(n)}else a.push(n)},c=0,u=b.length;c<u;c++){var d=b[c],h=d.proxies&&d.proxies[0]?d.proxies[0].originalEp.elementId:d.sourceId,p=d.proxies&&d.proxies[1]?d.proxies[1].originalEp.elementId:d.targetId;J(o,d.scope)&&J(r,h)&&J(s,p)&&l(d.scope,d)}return a};var Z=function(t,e){return function(n){for(var i=0,o=t.length;i<o;i++)n(t[i]);return e(t)}},K=function(t){return function(e){return t[e]}},Q=function(t,e){var n,i,o={length:t.length,each:Z(t,e),get:K(t)},r=["setHover","removeAllOverlays","setLabel","addClass","addOverlay","removeOverlay","removeOverlays","showOverlay","hideOverlay","showOverlays","hideOverlays","setPaintStyle","setHoverPaintStyle","setSuspendEvents","setParameter","setParameters","setVisible","repaint","addType","toggleType","removeType","removeClass","setType","bind","unbind"],s=["getLabel","getOverlay","isHover","getParameter","getParameters","getPaintStyle","getHoverPaintStyle","isVisible","hasType","getType","isSuspendEvents"];for(n=0,i=r.length;n<i;n++)o[r[n]]=q(t,r[n],e);for(n=0,i=s.length;n<i;n++)o[s[n]]=W(t,s[n]);return o},tt=function t(e){var n=Q(e,t);return h.extend(n,{setDetachable:q(e,"setDetachable",t),setReattach:q(e,"setReattach",t),setConnector:q(e,"setConnector",t),delete:function(){for(var t=0,n=e.length;t<n;t++)i.deleteConnection(e[t])},isDetachable:W(e,"isDetachable"),isReattach:W(e,"isReattach")})},et=function t(e){var n=Q(e,t);return h.extend(n,{setEnabled:q(e,"setEnabled",t),setAnchor:q(e,"setAnchor",t),isEnabled:W(e,"isEnabled"),deleteEveryConnection:function(){for(var t=0,n=e.length;t<n;t++)e[t].deleteEveryConnection()},delete:function(){for(var t=0,n=e.length;t<n;t++)i.deleteEndpoint(e[t])}})};this.select=function(t){return(t=t||{}).scope=t.scope||"*",tt(t.connections||i.getConnections(t,!0))},this.selectEndpoints=function(t){(t=t||{}).scope=t.scope||"*";var e=!t.element&&!t.source&&!t.target,n=e?"*":z(t.element),i=e?"*":z(t.source),o=e?"*":z(t.target),r=z(t.scope,!0),s=[];for(var a in y){var l=J(n,a,!0),c=J(i,a,!0),u="*"!==i,d=J(o,a,!0),h="*"!==o;if(l||c||d)t:for(var p=0,f=y[a].length;p<f;p++){var m=y[a][p];if(J(r,m.scope,!0)){if(u&&i.length>0&&!m.isSource||h&&o.length>0&&!m.isTarget)continue t;s.push(m)}}}return et(s)},this.getAllConnections=function(){return b},this.getDefaultScope=function(){return E},this.getEndpoint=T,this.getEndpoints=function(t){return y[d(t).id]||[]},this.getDefaultEndpointType=function(){return h.Endpoint},this.getDefaultConnectionType=function(){return h.Connection},this.getId=N,this.draw=I,this.info=d,this.appendElement=D;var nt=!1;this.isHoverSuspended=function(){return nt},this.setHoverSuspended=function(t){nt=t},this.hide=function(t,e){return R(t,"none",e),i},this.idstamp=M;var it=function(t){if(!f&&t){var e=i.getElement(t);e.offsetParent&&i.setContainer(e.offsetParent)}},ot=i.manage=function(t,e,n,o){return P[t]?o&&(P[t].info=rt({elId:t,timestamp:O,recalc:!0})):(P[t]={el:e,endpoints:[],connections:[],rotation:0},P[t].info=rt({elId:t,timestamp:O}),i.addClass(e,"jtk-managed"),n||i.fire("manageElement",{id:t,info:P[t].info,el:e})),P[t]};this.unmanage=function(t){if(P[t]){var e=P[t].el;i.removeClass(e,"jtk-managed"),delete P[t],i.fire("unmanageElement",{id:t,el:e})}},this.rotate=function(t,e,n){return P[t]&&(P[t].rotation=e,P[t].el.style.transform="rotate("+e+"deg)",P[t].el.style.transformOrigin="center center",!0!==n)?this.revalidate(t):{c:[],e:[]}},this.getRotation=function(t){return P[t]&&P[t].rotation||0};var rt=function(t){var e,n=t.timestamp,o=t.recalc,r=t.offset,s=t.elId;return S&&!n&&(n=O),!o&&n&&n===x[s]?{o:t.offset||C[s],s:j[s]}:(o||!r&&null==C[s]?null!=(e=P[s]?P[s].el:null)&&(j[s]=i.getSize(e),C[s]=i.getOffset(e),x[s]=n):(C[s]=r||C[s],null==j[s]&&null!=(e=P[s].el)&&(j[s]=i.getSize(e)),x[s]=n),C[s]&&!C[s].right&&(C[s].right=C[s].left+j[s][0],C[s].bottom=C[s].top+j[s][1],C[s].width=j[s][0],C[s].height=j[s][1],C[s].centerx=C[s].left+C[s].width/2,C[s].centery=C[s].top+C[s].height/2),{o:C[s],s:j[s]})};this.updateOffset=rt,this.init=(function(){v||(i.Defaults.Container&&i.setContainer(i.Defaults.Container),i.router=new t.jsPlumb.DefaultRouter(i),i.anchorManager=i.router.anchorManager,v=!0,i.fire("ready",i))}).bind(this),this.log=g,this.jsPlumbUIComponent=l,this.makeAnchor=function(){var e,o=function(e,n){if(t.jsPlumb.Anchors[e])return new t.jsPlumb.Anchors[e](n);if(!i.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown anchor type '"+e+"'"}};if(0===arguments.length)return null;var r=arguments[0],s=arguments[1],a=null;if(r.compute&&r.getOrientation)return r;if("string"==typeof r)a=o(arguments[0],{elementId:s,jsPlumbInstance:i});else if(n.isArray(r))if(n.isArray(r[0])||n.isString(r[0]))2===r.length&&n.isObject(r[1])?n.isString(r[0])?(e=t.jsPlumb.extend({elementId:s,jsPlumbInstance:i},r[1]),a=o(r[0],e)):(e=t.jsPlumb.extend({elementId:s,jsPlumbInstance:i,anchors:r[0]},r[1]),a=new t.jsPlumb.DynamicAnchor(e)):a=new h.DynamicAnchor({anchors:r,selector:null,elementId:s,jsPlumbInstance:i});else{var l={x:r[0],y:r[1],orientation:r.length>=4?[r[2],r[3]]:[0,0],offsets:r.length>=6?[r[4],r[5]]:[0,0],elementId:s,jsPlumbInstance:i,cssClass:7===r.length?r[6]:null};(a=new t.jsPlumb.Anchor(l)).clone=function(){return new t.jsPlumb.Anchor(l)}}return a.id||(a.id="anchor_"+M()),a},this.makeAnchors=function(e,o,r){for(var s=[],a=0,l=e.length;a<l;a++)"string"==typeof e[a]?s.push(t.jsPlumb.Anchors[e[a]]({elementId:o,jsPlumbInstance:r})):n.isArray(e[a])&&s.push(i.makeAnchor(e[a],o,r));return s},this.makeDynamicAnchor=function(e,n){return new t.jsPlumb.DynamicAnchor({anchors:e,selector:n,elementId:null,jsPlumbInstance:i})},this.targetEndpointDefinitions={},this.sourceEndpointDefinitions={};var st=function(e,o,r,s,a){var c=new l(o),u=o._jsPlumb.EndpointDropHandler({jsPlumb:i,enabled:function(){return e.def.enabled},isFull:function(){var t=i.select({target:e.id}).length;return e.def.maxConnections>0&&t>=e.def.maxConnections},element:e.el,elementId:e.id,isSource:s,isTarget:a,addClass:function(t){i.addClass(e.el,t)},removeClass:function(t){i.removeClass(e.el,t)},onDrop:function(t){t.endpoints[0].anchor.locked=!1},isDropAllowed:function(){return c.isDropAllowed.apply(c,arguments)},isRedrop:function(t){return null!=t.suspendedElement&&null!=t.suspendedEndpoint&&t.suspendedEndpoint.element===e.el},getEndpoint:function(n){var r=e.def.endpoint;if(null==r||null==r._jsPlumb){var s=i.deriveEndpointAndAnchorSpec(n.getType().join(" "),!0),a=s.endpoints?t.jsPlumb.extend(o,{endpoint:e.def.def.endpoint||s.endpoints[1]}):o;s.anchors&&(a=t.jsPlumb.extend(a,{anchor:e.def.def.anchor||s.anchors[1]})),(r=i.addEndpoint(e.el,a))._mtNew=!0}if(o.uniqueEndpoint&&(e.def.endpoint=r),r.setDeleteOnEmpty(!0),n.isDetachable()&&r.initDraggable(),null!=r.anchor.positionFinder){var l=i.getUIPosition(arguments,i.getZoom()),c=i.getOffset(e.el),u=i.getSize(e.el),d=null==l?[0,0]:r.anchor.positionFinder(l,c,u,r.anchor.constructorParams);r.anchor.x=d[0],r.anchor.y=d[1]}return r},maybeCleanup:function(t){t._mtNew&&0===t.connections.length?i.deleteObject({endpoint:t}):delete t._mtNew}}),d=t.jsPlumb.dragEvents.drop;return r.scope=r.scope||o.scope||i.Defaults.Scope,r[d]=n.wrap(r[d],u,!0),r.rank=o.rank||0,a&&(r[t.jsPlumb.dragEvents.over]=function(){return!0}),!1===o.allowLoopback&&(r.canDrop=function(t){return t.getDragElement()._jsPlumbRelatedElement!==e.el}),i.initDroppable(e.el,r,"internal"),u};this.makeTarget=function(e,n,o){var r=t.jsPlumb.extend({_jsPlumb:this},o);t.jsPlumb.extend(r,n);for(var s=r.maxConnections||-1,a=(function(e){var n=d(e),o=n.id,a=t.jsPlumb.extend({},r.dropOptions||{}),l=r.connectionType||"default";this.targetEndpointDefinitions[o]=this.targetEndpointDefinitions[o]||{},it(o),n.el._isJsPlumbGroup&&null==a.rank&&(a.rank=-1);var c={def:t.jsPlumb.extend({},r),uniqueEndpoint:r.uniqueEndpoint,maxConnections:s,enabled:!0};r.createEndpoint&&(c.uniqueEndpoint=!0,c.endpoint=i.addEndpoint(e,c.def),c.endpoint.setDeleteOnEmpty(!1)),n.def=c,this.targetEndpointDefinitions[o][l]=c,st(n,r,a,!0===r.isSource,!0),n.el._katavorioDrop[n.el._katavorioDrop.length-1].targetDef=c}).bind(this),l=e.length&&e.constructor!==String?e:[e],c=0,u=l.length;c<u;c++)a(l[c]);return this},this.unmakeTarget=function(t,e){var n=d(t);return i.destroyDroppable(n.el,"internal"),e||delete this.targetEndpointDefinitions[n.id],this},this.makeSource=function(e,o,r){var s=t.jsPlumb.extend({_jsPlumb:this},r);t.jsPlumb.extend(s,o);var a=s.connectionType||"default",l=i.deriveEndpointAndAnchorSpec(a);s.endpoint=s.endpoint||l.endpoints[0],s.anchor=s.anchor||l.anchors[0];for(var u=s.maxConnections||-1,h=s.onMaxConnections,p=(function(o){var r=o.id,l=this.getElement(o.el);this.sourceEndpointDefinitions[r]=this.sourceEndpointDefinitions[r]||{},it(r);var d={def:t.jsPlumb.extend({},s),uniqueEndpoint:s.uniqueEndpoint,maxConnections:u,enabled:!0};s.createEndpoint&&(d.uniqueEndpoint=!0,d.endpoint=i.addEndpoint(e,d.def),d.endpoint.setDeleteOnEmpty(!1)),this.sourceEndpointDefinitions[r][a]=d,o.def=d;var p=t.jsPlumb.dragEvents.stop,f=t.jsPlumb.dragEvents.drag,m=t.jsPlumb.extend({},s.dragOptions||{}),g=m.drag,v=m.stop,b=null,y=!1;m.scope=m.scope||s.scope,m[f]=n.wrap(m[f],function(){g&&g.apply(this,arguments),y=!1}),m[p]=n.wrap(m[p],(function(){if(v&&v.apply(this,arguments),this.currentlyDragging=!1,null!=b._jsPlumb){var t=s.anchor||this.Defaults.Anchor,e=b.anchor,n=b.connections[0],o=this.makeAnchor(t,r,this),a=b.element;if(null!=o.positionFinder){var l=i.getOffset(a),c=this.getSize(a),u={left:l.left+e.x*c[0],top:l.top+e.y*c[1]},d=o.positionFinder(u,l,c,o.constructorParams);o.x=d[0],o.y=d[1]}b.setAnchor(o,!0),b.repaint(),this.repaint(b.elementId),null!=n&&this.repaint(n.targetId)}}).bind(this));var _=(function(e){if(3!==e.which&&2!==e.button){r=this.getId(this.getElement(o.el));var d=this.sourceEndpointDefinitions[r][a];if(d.enabled){if(s.filter&&!1===(n.isString(s.filter)?function(t,e,n,i,o){for(var r=t.target||t.srcElement,s=!1,a=i.getSelector(e,n),l=0;l<a.length;l++)if(a[l]===r){s=!0;break}return o?!s:s}(e,o.el,s.filter,this,s.filterExclude):s.filter(e,o.el)))return;var p=this.select({source:r}).length;if(d.maxConnections>=0&&p>=d.maxConnections)return h&&h({element:o.el,maxConnections:u},e),!1;var f=t.jsPlumb.getPositionOnElement(e,l,c),g={};t.jsPlumb.extend(g,d.def),g.isTemporarySource=!0,g.anchor=[f[0],f[1],0,0],g.dragOptions=m,d.def.scope&&(g.scope=d.def.scope),b=this.addEndpoint(r,g),y=!0,b.setDeleteOnEmpty(!0),d.uniqueEndpoint&&(d.endpoint?b.finalEndpoint=d.endpoint:(d.endpoint=b,b.setDeleteOnEmpty(!1)));var v=function t(){i.off(b.canvas,"mouseup",t),i.off(o.el,"mouseup",t),y&&(y=!1,i.deleteEndpoint(b))};i.on(b.canvas,"mouseup",v),i.on(o.el,"mouseup",v);var _={};if(d.def.extract)for(var P in d.def.extract){var C=(e.srcElement||e.target).getAttribute(P);C&&(_[d.def.extract[P]]=C)}i.trigger(b.canvas,"mousedown",e,_),n.consume(e)}}}).bind(this);this.on(o.el,"mousedown",_),d.trigger=_,s.filter&&(n.isString(s.filter)||n.isFunction(s.filter))&&i.setDragFilter(o.el,s.filter);var P=t.jsPlumb.extend({},s.dropOptions||{});st(o,s,P,!0,!0===s.isTarget)}).bind(this),f=e.length&&e.constructor!==String?e:[e],m=0,g=f.length;m<g;m++)p(d(f[m]));return this},this.unmakeSource=function(t,e,n){var o=d(t);i.destroyDroppable(o.el,"internal");var r=this.sourceEndpointDefinitions[o.id];if(r)for(var s in r)if(null==e||e===s){var a=r[s].trigger;a&&i.off(o.el,"mousedown",a),n||delete this.sourceEndpointDefinitions[o.id][s]}return this},this.unmakeEverySource=function(){for(var t in this.sourceEndpointDefinitions)i.unmakeSource(t,null,!0);return this.sourceEndpointDefinitions={},this};var at=(function(t,e,i){e=n.isArray(e)?e:[e];var o=N(t);i=i||"default";for(var r=0;r<e.length;r++){var s=this[e[r]][o];if(s&&s[i])return s[i].def.scope||this.Defaults.Scope}}).bind(this),lt=(function(t,e,i,o){i=n.isArray(i)?i:[i];var r=N(t);o=o||"default";for(var s=0;s<i.length;s++){var a=this[i[s]][r];a&&a[o]&&(a[o].def.scope=e)}}).bind(this);this.getScope=function(t,e){return at(t,["sourceEndpointDefinitions","targetEndpointDefinitions"])},this.getSourceScope=function(t){return at(t,"sourceEndpointDefinitions")},this.getTargetScope=function(t){return at(t,"targetEndpointDefinitions")},this.setScope=function(t,e,n){this.setSourceScope(t,e,n),this.setTargetScope(t,e,n)},this.setSourceScope=function(t,e,n){lt(t,e,"sourceEndpointDefinitions",n),this.setDragScope(t,e)},this.setTargetScope=function(t,e,n){lt(t,e,"targetEndpointDefinitions",n),this.setDropScope(t,e)},this.unmakeEveryTarget=function(){for(var t in this.targetEndpointDefinitions)i.unmakeTarget(t,!0);return this.targetEndpointDefinitions={},this};var ct=(function(t,e,o,r,s){var a,l,c,u="source"===t?this.sourceEndpointDefinitions:this.targetEndpointDefinitions;if(s=s||"default",e.length&&!n.isString(e)){a=[];for(var h=0,p=e.length;h<p;h++)u[(l=d(e[h])).id]&&u[l.id][s]&&(a[h]=u[l.id][s].enabled,u[l.id][s].enabled=c=r?!a[h]:o,i[c?"removeClass":"addClass"](l.el,"jtk-"+t+"-disabled"))}else{var f=(l=d(e)).id;u[f]&&u[f][s]&&(a=u[f][s].enabled,u[f][s].enabled=c=r?!a:o,i[c?"removeClass":"addClass"](l.el,"jtk-"+t+"-disabled"))}return a}).bind(this),ut=(function(t,e){if(null!=t){if(n.isString(t)||!t.length)return e.apply(this,[t]);if(t.length)return e.apply(this,[t[0]])}}).bind(this);this.toggleSourceEnabled=function(t,e){return ct("source",t,null,!0,e),this.isSourceEnabled(t,e)},this.setSourceEnabled=function(t,e,n){return ct("source",t,e,null,n)},this.isSource=function(t,e){return e=e||"default",ut(t,(function(t){var n=this.sourceEndpointDefinitions[d(t).id];return null!=n&&null!=n[e]}).bind(this))},this.isSourceEnabled=function(t,e){return e=e||"default",ut(t,(function(t){var n=this.sourceEndpointDefinitions[d(t).id];return n&&n[e]&&!0===n[e].enabled}).bind(this))},this.toggleTargetEnabled=function(t,e){return ct("target",t,null,!0,e),this.isTargetEnabled(t,e)},this.isTarget=function(t,e){return e=e||"default",ut(t,(function(t){var n=this.targetEndpointDefinitions[d(t).id];return null!=n&&null!=n[e]}).bind(this))},this.isTargetEnabled=function(t,e){return e=e||"default",ut(t,(function(t){var n=this.targetEndpointDefinitions[d(t).id];return n&&n[e]&&!0===n[e].enabled}).bind(this))},this.setTargetEnabled=function(t,e,n){return ct("target",t,e,null,n)},this.ready=function(t){i.bind("ready",t)},this.repaint=function(t,e,n){return function(t,e){if("object"==typeof t&&t.length)for(var n=0,o=t.length;n<o;n++)e(t[n]);else e(t);return i}(t,function(t){I(t,e,n)})},this.revalidate=function(t,e,n){var o=n?t:i.getId(t);i.updateOffset({elId:o,recalc:!0,timestamp:e});var r=i.getDragManager();return r&&r.updateOffsets(o),I(t,null,e)},this.repaintEverything=function(){var t,e=jsPlumbUtil.uuid();for(t in y)i.updateOffset({elId:t,recalc:!0,timestamp:e});for(t in y)I(t,null,e);return this},this.removeAllEndpoints=function(t,e,n){n=n||[];return function t(o){var r,s,a=d(o),l=y[a.id];if(l)for(n.push(a),r=0,s=l.length;r<s;r++)i.deleteEndpoint(l[r],!1);if(delete y[a.id],e&&a.el&&3!==a.el.nodeType&&8!==a.el.nodeType)for(r=0,s=a.el.childNodes.length;r<s;r++)t(a.el.childNodes[r])}(t),this};var dt=function(t,e){i.removeAllEndpoints(t.id,!0,e);for(var n=i.getDragManager(),o=function(t){n&&n.elementRemoved(t.id),i.router.elementRemoved(t.id),i.isSource(t.el)&&i.unmakeSource(t.el),i.isTarget(t.el)&&i.unmakeTarget(t.el),i.destroyDraggable(t.el),i.destroyDroppable(t.el),delete i.floatingConnections[t.id],delete P[t.id],delete C[t.id],t.el&&(i.removeElement(t.el),t.el._jsPlumb=null)},r=1;r<e.length;r++)o(e[r]);o(t)};this.remove=function(t,e){var n=d(t),o=[];return n.text&&n.el.parentNode?n.el.parentNode.removeChild(n.el):n.id&&i.batch(function(){dt(n,o)},!0===e),i},this.empty=function(t,e){var n=[],o=function t(e,i){var o=d(e);if(o.text)o.el.parentNode.removeChild(o.el);else if(o.el){for(;o.el.childNodes.length>0;)t(o.el.childNodes[0]);i||dt(o,n)}};return i.batch(function(){o(t,!0)},!1===e),i},this.reset=function(t){i.silently((function(){nt=!1,i.removeAllGroups(),i.removeGroupManager(),i.deleteEveryEndpoint(),t||i.unbind(),this.targetEndpointDefinitions={},this.sourceEndpointDefinitions={},b.length=0,this.doReset&&this.doReset()}).bind(this))},this.destroy=function(){this.reset(),f=null,m=null};var ht=function(t){t.canvas&&t.canvas.parentNode&&t.canvas.parentNode.removeChild(t.canvas),t.cleanup(),t.destroy()};this.clear=function(){i.select().each(ht),i.selectEndpoints().each(ht),y={},_={}},this.setDefaultScope=function(t){return E=t,i},this.deriveEndpointAndAnchorSpec=function(t,e){for(var n=((e?"":"default ")+t).split(/[\s]/),o=null,r=null,s=null,a=null,l=0;l<n.length;l++){var c=i.getType(n[l],"connection");c&&(c.endpoints&&(o=c.endpoints),c.endpoint&&(r=c.endpoint),c.anchors&&(a=c.anchors),c.anchor&&(s=c.anchor))}return{endpoints:o||[r,r],anchors:a||[s,s]}},this.setId=function(t,e,i){var o;n.isString(t)?o=t:(t=this.getElement(t),o=this.getId(t));var r=this.getConnections({source:o,scope:"*"},!0),s=this.getConnections({target:o,scope:"*"},!0);e=""+e,i?t=this.getElement(e):(t=this.getElement(o),this.setAttribute(t,"id",e)),y[e]=y[o]||[];for(var a=0,l=y[e].length;a<l;a++)y[e][a].setElementId(e),y[e][a].setReferenceElement(t);delete y[o],this.sourceEndpointDefinitions[e]=this.sourceEndpointDefinitions[o],delete this.sourceEndpointDefinitions[o],this.targetEndpointDefinitions[e]=this.targetEndpointDefinitions[o],delete this.targetEndpointDefinitions[o],this.router.changeId(o,e);var c=this.getDragManager();c&&c.changeId(o,e),P[e]=P[o],delete P[o];var u=function(n,i,o){for(var r=0,s=n.length;r<s;r++)n[r].endpoints[i].setElementId(e),n[r].endpoints[i].setReferenceElement(t),n[r][o+"Id"]=e,n[r][o]=t};u(r,0,"source"),u(s,1,"target"),this.repaint(e)},this.setDebugLog=function(t){g=t},this.setSuspendDrawing=function(t,e){var n=S;return S=t,O=t?(new Date).getTime():null,e&&this.repaintEverything(),n},this.isSuspendDrawing=function(){return S},this.getSuspendedAt=function(){return O},this.batch=function(t,e){var i=this.isSuspendDrawing();i||this.setSuspendDrawing(!0);try{t()}catch(o){n.log("Function run while suspended failed",o)}i||this.setSuspendDrawing(!1,!e)},this.doWhileSuspended=this.batch,this.getCachedData=function(t){var e=C[t];return e?{o:e,s:j[t]}:rt({elId:t})},this.show=function(t,e){return R(t,"block",e),i},this.toggleVisible=function(t,e){var n=null;e&&(n=function(t){var e=t.isVisible();t.setVisible(!e)}),H(t,function(t){var e=t.isVisible();t.setVisible(!e)},n)},this.addListener=this.bind;var pt=[];this.registerFloatingConnection=function(t,e,i){pt[t.id]=e,n.addToList(y,t.id,i)},this.getFloatingConnectionFor=function(t){return pt[t]},this.listManager=new t.jsPlumbListManager(this,this.Defaults.ListStyle)};n.extend(t.jsPlumbInstance,n.EventGenerator,{setAttribute:function(t,e,n){this.setAttribute(t,e,n)},getAttribute:function(e,n){return this.getAttribute(t.jsPlumb.getElement(e),n)},convertToFullOverlaySpec:function(t){return n.isString(t)&&(t=[t,{}]),t[1].id=t[1].id||n.uuid(),t},registerConnectionType:function(e,n){if(this._connectionTypes[e]=t.jsPlumb.extend({},n),n.overlays){for(var i={},o=0;o<n.overlays.length;o++){var r=this.convertToFullOverlaySpec(n.overlays[o]);i[r[1].id]=r}this._connectionTypes[e].overlays=i}},registerConnectionTypes:function(t){for(var e in t)this.registerConnectionType(e,t[e])},registerEndpointType:function(e,n){if(this._endpointTypes[e]=t.jsPlumb.extend({},n),n.overlays){for(var i={},o=0;o<n.overlays.length;o++){var r=this.convertToFullOverlaySpec(n.overlays[o]);i[r[1].id]=r}this._endpointTypes[e].overlays=i}},registerEndpointTypes:function(t){for(var e in t)this.registerEndpointType(e,t[e])},getType:function(t,e){return"connection"===e?this._connectionTypes[t]:this._endpointTypes[t]},setIdChanged:function(t,e){this.setId(t,e,!0)},setParent:function(t,e){var n=this.getElement(t),i=this.getId(n),o=this.getElement(e),r=this.getId(o),s=this.getDragManager();n.parentNode.removeChild(n),o.appendChild(n),s&&s.setParent(n,i,o,r)},extend:function(t,e,n){var i;if(n)for(i=0;i<n.length;i++)t[n[i]]=e[n[i]];else for(i in e)t[i]=e[i];return t},floatingConnections:{},getFloatingAnchorIndex:function(t){return t.endpoints[0].isFloating()?0:t.endpoints[1].isFloating()?1:-1},proxyConnection:function(t,e,n,i,o,r){var s,a=t.endpoints[e].elementId,l=t.endpoints[e];t.proxies=t.proxies||[],(s=t.proxies[e]?t.proxies[e].ep:this.addEndpoint(n,{endpoint:o(t,e),anchor:r(t,e),parameters:{isProxyEndpoint:!0}})).setDeleteOnEmpty(!0),t.proxies[e]={ep:s,originalEp:l},this.router.sourceOrTargetChanged(a,i,t,n,0===e?0:1),l.detachFromConnection(t,null,!0),s.connections=[t],t.endpoints[e]=s,l.setVisible(!1),t.setVisible(!0),this.revalidate(n)},unproxyConnection:function(t,e,n){if(null!=t._jsPlumb&&null!=t.proxies&&null!=t.proxies[e]){var i=t.proxies[e].originalEp.element,o=t.proxies[e].originalEp.elementId;t.endpoints[e]=t.proxies[e].originalEp,this.router.sourceOrTargetChanged(n,o,t,i,0===e?0:1),t.proxies[e].ep.detachFromConnection(t,null),t.proxies[e].originalEp.addConnection(t),t.isVisible()&&t.proxies[e].originalEp.setVisible(!0),delete t.proxies[e]}}});var h=new d;t.jsPlumb=h,h.getInstance=function(t,e){var n=new d(t);if(e)for(var i in e)n[i]=e[i];return n.init(),n},h.each=function(t,e){if(null!=t)if("string"==typeof t)e(h.getElement(t));else if(null!=t.length)for(var n=0;n<t.length;n++)e(h.getElement(t[n]));else e(t)},e.jsPlumb=h}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this,e=t.jsPlumb,n=t.jsPlumbUtil;e.OverlayCapableJsPlumbUIComponent=function(e){t.jsPlumbUIComponent.apply(this,arguments),this._jsPlumb.overlays={},this._jsPlumb.overlayPositions={},e.label&&(this.getDefaultType().overlays.__label=["Label",{label:e.label,location:e.labelLocation||this.defaultLabelLocation||.5,labelStyle:e.labelStyle||this._jsPlumb.instance.Defaults.LabelStyle,id:"__label"}]),this.setListenerComponent=function(t){if(this._jsPlumb)for(var e in this._jsPlumb.overlays)this._jsPlumb.overlays[e].setListenerComponent(t)}},e.OverlayCapableJsPlumbUIComponent.applyType=function(t,e){if(e.overlays){var n,i={};for(n in e.overlays){var o=t._jsPlumb.overlays[e.overlays[n][1].id];if(o)o.updateFrom(e.overlays[n][1]),i[e.overlays[n][1].id]=!0,o.reattach(t._jsPlumb.instance,t);else{var r=t.getCachedTypeItem("overlay",e.overlays[n][1].id);null!=r?(r.reattach(t._jsPlumb.instance,t),r.setVisible(!0),r.updateFrom(e.overlays[n][1]),t._jsPlumb.overlays[r.id]=r):r=t.addOverlay(e.overlays[n],!0),i[r.id]=!0}}for(n in t._jsPlumb.overlays)null==i[t._jsPlumb.overlays[n].id]&&t.removeOverlay(t._jsPlumb.overlays[n].id,!0)}},n.extend(e.OverlayCapableJsPlumbUIComponent,t.jsPlumbUIComponent,{setHover:function(t,e){if(this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged())for(var n in this._jsPlumb.overlays)this._jsPlumb.overlays[n][t?"addClass":"removeClass"](this._jsPlumb.instance.hoverClass)},addOverlay:function(t,i){var o=function(t,i){var o=null;if(n.isArray(i)){var r=i[0],s=e.extend({component:t,_jsPlumb:t._jsPlumb.instance},i[1]);3===i.length&&e.extend(s,i[2]),o=new(e.Overlays[t._jsPlumb.instance.getRenderMode()][r])(s)}else o=i.constructor===String?new(e.Overlays[t._jsPlumb.instance.getRenderMode()][i])({component:t,_jsPlumb:t._jsPlumb.instance}):i;return o.id=o.id||n.uuid(),t.cacheTypeItem("overlay",o,o.id),t._jsPlumb.overlays[o.id]=o,o}(this,t);if(this.getData&&"Label"===o.type&&n.isArray(t)){var r=this.getData();if(r){var s=r?r[t[1].labelLocationAttribute||"labelLocation"]:null;s&&(o.loc=s)}}return i||this.repaint(),o},getOverlay:function(t){return this._jsPlumb.overlays[t]},getOverlays:function(){return this._jsPlumb.overlays},hideOverlay:function(t){var e=this.getOverlay(t);e&&e.hide()},hideOverlays:function(){for(var t in this._jsPlumb.overlays)this._jsPlumb.overlays[t].hide()},showOverlay:function(t){var e=this.getOverlay(t);e&&e.show()},showOverlays:function(){for(var t in this._jsPlumb.overlays)this._jsPlumb.overlays[t].show()},removeAllOverlays:function(t){for(var e in this._jsPlumb.overlays)this._jsPlumb.overlays[e].cleanup&&this._jsPlumb.overlays[e].cleanup();this._jsPlumb.overlays={},this._jsPlumb.overlayPositions=null,this._jsPlumb.overlayPlacements={},t||this.repaint()},removeOverlay:function(t,e){var n=this._jsPlumb.overlays[t];n&&(n.setVisible(!1),!e&&n.cleanup&&n.cleanup(),delete this._jsPlumb.overlays[t],this._jsPlumb.overlayPositions&&delete this._jsPlumb.overlayPositions[t],this._jsPlumb.overlayPlacements&&delete this._jsPlumb.overlayPlacements[t])},removeOverlays:function(){for(var t=0,e=arguments.length;t<e;t++)this.removeOverlay(arguments[t])},moveParent:function(t){if(this.bgCanvas&&(this.bgCanvas.parentNode.removeChild(this.bgCanvas),t.appendChild(this.bgCanvas)),this.canvas&&this.canvas.parentNode)for(var e in this.canvas.parentNode.removeChild(this.canvas),t.appendChild(this.canvas),this._jsPlumb.overlays)if(this._jsPlumb.overlays[e].isAppendedAtTopLevel){var n=this._jsPlumb.overlays[e].getElement();n.parentNode.removeChild(n),t.appendChild(n)}},getLabel:function(){var t=this.getOverlay("__label");return null!=t?t.getLabel():null},getLabelOverlay:function(){return this.getOverlay("__label")},setLabel:function(t){var n,i,o=this.getOverlay("__label");o?t.constructor===String||t.constructor===Function?o.setLabel(t):(t.label&&o.setLabel(t.label),t.location&&o.setLocation(t.location)):(i=e.extend({cssClass:(n=t.constructor===String||t.constructor===Function?{label:t}:t).cssClass,labelStyle:this.labelStyle,id:"__label",component:this,_jsPlumb:this._jsPlumb.instance},n),o=new(e.Overlays[this._jsPlumb.instance.getRenderMode()].Label)(i),this._jsPlumb.overlays.__label=o),this._jsPlumb.instance.isSuspendDrawing()||this.repaint()},cleanup:function(t){for(var e in this._jsPlumb.overlays)this._jsPlumb.overlays[e].cleanup(t),this._jsPlumb.overlays[e].destroy(t);t&&(this._jsPlumb.overlays={},this._jsPlumb.overlayPositions=null)},setVisible:function(t){this[t?"showOverlays":"hideOverlays"]()},setAbsoluteOverlayPosition:function(t,e){this._jsPlumb.overlayPositions[t.id]=e},getAbsoluteOverlayPosition:function(t){return this._jsPlumb.overlayPositions?this._jsPlumb.overlayPositions[t.id]:null},_clazzManip:function(t,e,n){if(!n)for(var i in this._jsPlumb.overlays)this._jsPlumb.overlays[i][t+"Class"](e)},addClass:function(t,e){this._clazzManip("add",t,e)},removeClass:function(t,e){this._clazzManip("remove",t,e)}})}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil,n=function(t,e,n){var i=!1;return{drag:function(){if(i)return i=!1,!0;if(e.element){var o=n.getUIPosition(arguments,n.getZoom());null!=o&&n.setPosition(e.element,o),n.repaint(e.element,o),t.paint({anchorPoint:t.anchor.getCurrentLocation({element:t})})}},stopDrag:function(){i=!0}}},i=function(t,e,n,i){var o=e.createElement("div",{position:"absolute"});e.appendElement(o);var r=e.getId(o);e.setPosition(o,n),o.style.width=i[0]+"px",o.style.height=i[1]+"px",e.manage(r,o,!0),t.id=r,t.element=o},o=function(e,n,i,o,r,s,a,l){return a({paintStyle:e,endpoint:i,anchor:new t.FloatingAnchor({reference:n,referenceCanvas:o,jsPlumbInstance:s}),source:r,scope:l})},r=["connectorStyle","connectorHoverStyle","connectorOverlays","connector","connectionType","connectorClass","connectorHoverClass"],s=function(t,e){var n=0;if(null!=e)for(var i=0;i<t.connections.length;i++)if(t.connections[i].sourceId===e||t.connections[i].targetId===e){n=i;break}return t.connections[n]};t.Endpoint=function(a){var l=a._jsPlumb,c=a.newConnection,u=a.newEndpoint;this.idPrefix="_jsplumb_e_",this.defaultLabelLocation=[.5,.5],this.defaultOverlayKeys=["Overlays","EndpointOverlays"],t.OverlayCapableJsPlumbUIComponent.apply(this,arguments),this.appendToDefaultType({connectionType:a.connectionType,maxConnections:null==a.maxConnections?this._jsPlumb.instance.Defaults.MaxConnections:a.maxConnections,paintStyle:a.endpointStyle||a.paintStyle||a.style||this._jsPlumb.instance.Defaults.EndpointStyle||t.Defaults.EndpointStyle,hoverPaintStyle:a.endpointHoverStyle||a.hoverPaintStyle||this._jsPlumb.instance.Defaults.EndpointHoverStyle||t.Defaults.EndpointHoverStyle,connectorStyle:a.connectorStyle,connectorHoverStyle:a.connectorHoverStyle,connectorClass:a.connectorClass,connectorHoverClass:a.connectorHoverClass,connectorOverlays:a.connectorOverlays,connector:a.connector,connectorTooltip:a.connectorTooltip}),this._jsPlumb.enabled=!(!1===a.enabled),this._jsPlumb.visible=!0,this.element=t.getElement(a.source),this._jsPlumb.uuid=a.uuid,this._jsPlumb.floatingEndpoint=null;var d=null;this._jsPlumb.uuid&&(a.endpointsByUUID[this._jsPlumb.uuid]=this),this.elementId=a.elementId,this.dragProxy=a.dragProxy,this._jsPlumb.connectionCost=a.connectionCost,this._jsPlumb.connectionsDirected=a.connectionsDirected,this._jsPlumb.currentAnchorClass="",this._jsPlumb.events={};var h=!0===a.deleteOnEmpty;this.setDeleteOnEmpty=function(t){h=t};var p=(function(){var e=l.endpointAnchorClassPrefix+"-"+this._jsPlumb.currentAnchorClass;this._jsPlumb.currentAnchorClass=this.anchor.getCssClass();var n=l.endpointAnchorClassPrefix+(this._jsPlumb.currentAnchorClass?"-"+this._jsPlumb.currentAnchorClass:"");this.removeClass(e),this.addClass(n),t.updateClasses(this.element,n,e)}).bind(this);this.prepareAnchor=function(t){var e=this._jsPlumb.instance.makeAnchor(t,this.elementId,l);return e.bind("anchorChanged",(function(t){this.fire("anchorChanged",{endpoint:this,anchor:t}),p()}).bind(this)),e},this.setPreparedAnchor=function(t,e){return this._jsPlumb.instance.continuousAnchorFactory.clear(this.elementId),this.anchor=t,p(),e||this._jsPlumb.instance.repaint(this.elementId),this},this.setAnchor=function(t,e){var n=this.prepareAnchor(t);return this.setPreparedAnchor(n,e),this};var f=(function(t){if(this.connections.length>0)for(var e=0;e<this.connections.length;e++)this.connections[e].setHover(t,!1);else this.setHover(t)}).bind(this);this.bind("mouseover",function(){f(!0)}),this.bind("mouseout",function(){f(!1)}),a._transient||this._jsPlumb.instance.router.addEndpoint(this,this.elementId),this.prepareEndpoint=function(n,i){var o,r=function(e,n){var i=l.getRenderMode();if(t.Endpoints[i][e])return new t.Endpoints[i][e](n);if(!l.Defaults.DoNotThrowErrors)throw{msg:"jsPlumb: unknown endpoint type '"+e+"'"}},s={_jsPlumb:this._jsPlumb.instance,cssClass:a.cssClass,container:a.container,tooltip:a.tooltip,connectorTooltip:a.connectorTooltip,endpoint:this};return e.isString(n)?o=r(n,s):e.isArray(n)?(s=e.merge(n[1],s),o=r(n[0],s)):o=n.clone(),o.clone=(function(){return e.isString(n)?r(n,s):e.isArray(n)?(s=e.merge(n[1],s),r(n[0],s)):void 0}).bind(this),o.typeId=i,o},this.setEndpoint=function(t,e){var n=this.prepareEndpoint(t);this.setPreparedEndpoint(n,!0)},this.setPreparedEndpoint=function(t,e){null!=this.endpoint&&(this.endpoint.cleanup(),this.endpoint.destroy()),this.endpoint=t,this.type=this.endpoint.type,this.canvas=this.endpoint.canvas},t.extend(this,a,r),this.isSource=a.isSource||!1,this.isTemporarySource=a.isTemporarySource||!1,this.isTarget=a.isTarget||!1,this.connections=a.connections||[],this.connectorPointerEvents=a["connector-pointer-events"],this.scope=a.scope||l.getDefaultScope(),this.timestamp=null,this.reattachConnections=a.reattach||l.Defaults.ReattachConnections,this.connectionsDetachable=l.Defaults.ConnectionsDetachable,!1!==a.connectionsDetachable&&!1!==a.detachable||(this.connectionsDetachable=!1),this.dragAllowedWhenFull=!1!==a.dragAllowedWhenFull,a.onMaxConnections&&this.bind("maxConnections",a.onMaxConnections),this.addConnection=function(t){this.connections.push(t),this[(this.connections.length>0?"add":"remove")+"Class"](l.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](l.endpointFullClass)},this.detachFromConnection=function(t,e,n){(e=null==e?this.connections.indexOf(t):e)>=0&&(this.connections.splice(e,1),this[(this.connections.length>0?"add":"remove")+"Class"](l.endpointConnectedClass),this[(this.isFull()?"add":"remove")+"Class"](l.endpointFullClass)),!n&&h&&0===this.connections.length&&l.deleteObject({endpoint:this,fireEvent:!1,deleteAttachedObjects:!0!==n})},this.deleteEveryConnection=function(t){for(var e=this.connections.length,n=0;n<e;n++)l.deleteConnection(this.connections[0],t)},this.detachFrom=function(t,e,n){for(var i=[],o=0;o<this.connections.length;o++)this.connections[o].endpoints[1]!==t&&this.connections[o].endpoints[0]!==t||i.push(this.connections[o]);for(var r=0,s=i.length;r<s;r++)l.deleteConnection(i[0]);return this},this.getElement=function(){return this.element},this.setElement=function(n){var i=this._jsPlumb.instance.getId(n),o=this.elementId;return e.removeWithFunction(a.endpointsByElement[this.elementId],(function(t){return t.id===this.id}).bind(this)),this.element=t.getElement(n),this.elementId=l.getId(this.element),l.router.rehomeEndpoint(this,o,this.element),l.dragManager.endpointAdded(this.element),e.addToList(a.endpointsByElement,i,this),this},this.makeInPlaceCopy=function(){var t=this.anchor.getCurrentLocation({element:this}),e=this.anchor.getOrientation(this),n=this.anchor.getCssClass();return u({dropOptions:a.dropOptions,anchor:{bind:function(){},compute:function(){return[t[0],t[1]]},getCurrentLocation:function(){return[t[0],t[1]]},getOrientation:function(){return e},getCssClass:function(){return n}},source:this.element,paintStyle:this.getPaintStyle(),endpoint:a.hideOnDrag?"Blank":this.endpoint,_transient:!0,scope:this.scope,reference:this})},this.connectorSelector=function(){return this.connections[0]},this.setStyle=this.setPaintStyle,this.paint=function(t){var e=(t=t||{}).timestamp,n=!(!1===t.recalc);if(!e||this.timestamp!==e){var i=l.updateOffset({elId:this.elementId,timestamp:e}),o=t.offset?t.offset.o:i.o;if(null!=o){var r=t.anchorPoint,a=t.connectorPaintStyle;if(null==r){var c={xy:[o.left,o.top],wh:t.dimensions||i.s,element:this,timestamp:e};if(n&&this.anchor.isDynamic&&this.connections.length>0){var u=s(this,t.elementWithPrecedence),d=u.endpoints[0]===this?1:0,h=0===d?u.sourceId:u.targetId,p=l.getCachedData(h),f=p.o,m=p.s;c.index=0===d?1:0,c.connection=u,c.txy=[f.left,f.top],c.twh=m,c.tElement=u.endpoints[d],c.tRotation=l.getRotation(h)}else this.connections.length>0&&(c.connection=this.connections[0]);c.rotation=l.getRotation(this.elementId),r=this.anchor.compute(c)}for(var g in this.endpoint.compute(r,this.anchor.getOrientation(this),this._jsPlumb.paintStyleInUse,a||this.paintStyleInUse),this.endpoint.paint(this._jsPlumb.paintStyleInUse,this.anchor),this.timestamp=e,this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(g)){var v=this._jsPlumb.overlays[g];v.isVisible()&&(this._jsPlumb.overlayPlacements[g]=v.draw(this.endpoint,this._jsPlumb.paintStyleInUse),v.paint(this._jsPlumb.overlayPlacements[g]))}}}},this.getTypeDescriptor=function(){return"endpoint"},this.isVisible=function(){return this._jsPlumb.visible},this.repaint=this.paint;var m=!1;this.initDraggable=function(){if(!m&&t.isDragSupported(this.element)){var r,s={id:null,element:null},h=null,p=!1,f=null,g=n(this,s,l),v=a.dragOptions||{},b=t.dragEvents.start,y=t.dragEvents.stop,_=t.dragEvents.drag,P=t.dragEvents.beforeStart,C=(function(e){h=this.connectorSelector();var n=!0;this.isEnabled()||(n=!1),null!=h||this.isSource||this.isTemporarySource||(n=!1),!this.isSource||!this.isFull()||null!=h&&this.dragAllowedWhenFull||(n=!1),null==h||h.isDetachable(this)||(this.isFull()?n=!1:h=null);var d=l.checkCondition(null==h?"beforeDrag":"beforeStartDetach",{endpoint:this,source:this.element,sourceId:this.elementId,connection:h});if(!1===d?n=!1:"object"==typeof d?t.extend(d,r||{}):d=r||{},!1===n)return l.stopDrag&&l.stopDrag(this.canvas),g.stopDrag(),!1;for(var m=0;m<this.connections.length;m++)this.connections[m].setHover(!1);this.addClass("endpointDrag"),l.setConnectionBeingDragged(!0),h&&!this.isFull()&&this.isSource&&(h=null),l.updateOffset({elId:this.elementId});var v=this._jsPlumb.instance.getOffset(this.canvas),b=this.canvas,y=this._jsPlumb.instance.getSize(this.canvas);i(s,l,v,y),l.setAttributes(this.canvas,{dragId:s.id,elId:this.elementId});var _=this.dragProxy||this.endpoint;if(null==this.dragProxy&&null!=this.connectionType){var P=this._jsPlumb.instance.deriveEndpointAndAnchorSpec(this.connectionType);P.endpoints[1]&&(_=P.endpoints[1])}var C=this._jsPlumb.instance.makeAnchor("Center");C.isFloating=!0,this._jsPlumb.floatingEndpoint=o(this.getPaintStyle(),C,_,this.canvas,s.element,l,u,this.scope);var x=this._jsPlumb.floatingEndpoint.anchor;if(null==h)this.setHover(!1,!1),(h=c({sourceEndpoint:this,targetEndpoint:this._jsPlumb.floatingEndpoint,source:this.element,target:s.element,anchors:[this.anchor,this._jsPlumb.floatingEndpoint.anchor],paintStyle:a.connectorStyle,hoverPaintStyle:a.connectorHoverStyle,connector:a.connector,overlays:a.connectorOverlays,type:this.connectionType,cssClass:this.connectorClass,hoverClass:this.connectorHoverClass,scope:a.scope,data:d})).pending=!0,h.addClass(l.draggingClass),this._jsPlumb.floatingEndpoint.addClass(l.draggingClass),this._jsPlumb.floatingEndpoint.anchor=x,l.fire("connectionDrag",h),l.router.newConnection(h);else{p=!0,h.setHover(!1);var w=h.endpoints[0].id===this.id?0:1;this.detachFromConnection(h,null,!0);var j=l.getDragScope(b);l.setAttribute(this.canvas,"originalScope",j),l.fire("connectionDrag",h),0===w?(f=[h.source,h.sourceId,b,j],l.router.sourceOrTargetChanged(h.endpoints[w].elementId,s.id,h,s.element,0)):(f=[h.target,h.targetId,b,j],l.router.sourceOrTargetChanged(h.endpoints[w].elementId,s.id,h,s.element,1)),h.suspendedEndpoint=h.endpoints[w],h.suspendedElement=h.endpoints[w].getElement(),h.suspendedElementId=h.endpoints[w].elementId,h.suspendedElementType=0===w?"source":"target",h.suspendedEndpoint.setHover(!1),this._jsPlumb.floatingEndpoint.referenceEndpoint=h.suspendedEndpoint,h.endpoints[w]=this._jsPlumb.floatingEndpoint,h.addClass(l.draggingClass),this._jsPlumb.floatingEndpoint.addClass(l.draggingClass)}l.registerFloatingConnection(s,h,this._jsPlumb.floatingEndpoint),l.currentlyDragging=!0}).bind(this),x=(function(){if(l.setConnectionBeingDragged(!1),h&&null!=h.endpoints){var t=l.getDropEvent(arguments),e=l.getFloatingAnchorIndex(h);if(h.endpoints[0===e?1:0].anchor.locked=!1,h.removeClass(l.draggingClass),this._jsPlumb&&(h.deleteConnectionNow||h.endpoints[e]===this._jsPlumb.floatingEndpoint)&&p&&h.suspendedEndpoint){0===e?(h.floatingElement=h.source,h.floatingId=h.sourceId,h.floatingEndpoint=h.endpoints[0],h.floatingIndex=0,h.source=f[0],h.sourceId=f[1]):(h.floatingElement=h.target,h.floatingId=h.targetId,h.floatingEndpoint=h.endpoints[1],h.floatingIndex=1,h.target=f[0],h.targetId=f[1]);var n=this._jsPlumb.floatingEndpoint;l.setDragScope(f[2],f[3]),h.endpoints[e]=h.suspendedEndpoint,h.isReattach()||h._forceReattach||h._forceDetach||!l.deleteConnection(h,{originalEvent:t})?(h.setHover(!1),h._forceDetach=null,h._forceReattach=null,this._jsPlumb.floatingEndpoint.detachFromConnection(h),h.suspendedEndpoint.addConnection(h),1===e?l.router.sourceOrTargetChanged(h.floatingId,h.targetId,h,h.target,e):l.router.sourceOrTargetChanged(h.floatingId,h.sourceId,h,h.source,e),l.repaint(f[1])):l.deleteObject({endpoint:n})}this.deleteAfterDragStop?l.deleteObject({endpoint:this}):this._jsPlumb&&this.paint({recalc:!1}),l.fire("connectionDragStop",h,t),h.pending&&l.fire("connectionAborted",h,t),l.currentlyDragging=!1,h.suspendedElement=null,h.suspendedEndpoint=null,h=null}s&&s.element&&l.remove(s.element,!1,!1),d&&l.deleteObject({endpoint:d}),this._jsPlumb&&(this.canvas.style.visibility="visible",this.anchor.locked=!1,this._jsPlumb.floatingEndpoint=null)}).bind(this);(v=t.extend({},v)).scope=this.scope||v.scope,v[P]=e.wrap(v[P],function(t){r=t.e.payload||{}},!1),v[b]=e.wrap(v[b],C,!1),v[_]=e.wrap(v[_],g.drag),v[y]=e.wrap(v[y],x),v.multipleDrop=!1,v.canDrag=(function(){return this.isSource||this.isTemporarySource||this.connections.length>0&&!1!==this.connectionsDetachable}).bind(this),l.initDraggable(this.canvas,v,"internal"),this.canvas._jsPlumbRelatedElement=this.element,m=!0}};var g=a.endpoint||this._jsPlumb.instance.Defaults.Endpoint||t.Defaults.Endpoint;this.setEndpoint(g,!0);var v=a.anchor?a.anchor:a.anchors?a.anchors:l.Defaults.Anchor||"Top";this.setAnchor(v,!0);var b=["default",a.type||""].join(" ");this.addType(b,a.data,!0),this.canvas=this.endpoint.canvas,this.canvas._jsPlumb=this,this.initDraggable();var y=(function(n,i,o,r){if(t.isDropSupported(this.element)){var s=a.dropOptions||l.Defaults.DropOptions||t.Defaults.DropOptions;(s=t.extend({},s)).scope=s.scope||this.scope;var c=t.dragEvents.drop,u=t.dragEvents.over,d=t.dragEvents.out,h=this,p=l.EndpointDropHandler({getEndpoint:function(){return h},jsPlumb:l,enabled:function(){return null==o||o.isEnabled()},isFull:function(){return o.isFull()},element:this.element,elementId:this.elementId,isSource:this.isSource,isTarget:this.isTarget,addClass:function(t){h.addClass(t)},removeClass:function(t){h.removeClass(t)},isDropAllowed:function(){return h.isDropAllowed.apply(h,arguments)},reference:r,isRedrop:function(t,e){return t.suspendedEndpoint&&e.reference&&t.suspendedEndpoint.id===e.reference.id}});s[c]=e.wrap(s[c],p,!0),s[u]=e.wrap(s[u],(function(){var e=t.getDragObject(arguments),n=l.getAttribute(t.getElement(e),"dragId"),i=l.getFloatingConnectionFor(n);if(null!=i){var o=l.getFloatingAnchorIndex(i),r=this.isTarget&&0!==o||i.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id===i.suspendedEndpoint.id;if(r){var s=l.checkCondition("checkDropAllowed",{sourceEndpoint:i.endpoints[o],targetEndpoint:this,connection:i});this[(s?"add":"remove")+"Class"](l.endpointDropAllowedClass),this[(s?"remove":"add")+"Class"](l.endpointDropForbiddenClass),i.endpoints[o].anchor.over(this.anchor,this)}}}).bind(this)),s[d]=e.wrap(s[d],(function(){var e=t.getDragObject(arguments),n=null==e?null:l.getAttribute(t.getElement(e),"dragId"),i=n?l.getFloatingConnectionFor(n):null;if(null!=i){var o=l.getFloatingAnchorIndex(i),r=this.isTarget&&0!==o||i.suspendedEndpoint&&this.referenceEndpoint&&this.referenceEndpoint.id===i.suspendedEndpoint.id;r&&(this.removeClass(l.endpointDropAllowedClass),this.removeClass(l.endpointDropForbiddenClass),i.endpoints[o].anchor.out())}}).bind(this)),l.initDroppable(n,s,"internal",i)}}).bind(this);return this.anchor.isFloating||y(this.canvas,!(a._transient||this.anchor.isFloating),this,a.reference),this},e.extend(t.Endpoint,t.OverlayCapableJsPlumbUIComponent,{setVisible:function(t,e,n){if(this._jsPlumb.visible=t,this.canvas&&(this.canvas.style.display=t?"block":"none"),this[t?"showOverlays":"hideOverlays"](),!e)for(var i=0;i<this.connections.length;i++)if(this.connections[i].setVisible(t),!n){var o=this===this.connections[i].endpoints[0]?1:0;1===this.connections[i].endpoints[o].connections.length&&this.connections[i].endpoints[o].setVisible(t,!0,!0)}},getAttachedElements:function(){return this.connections},applyType:function(e,n){this.setPaintStyle(e.endpointStyle||e.paintStyle,n),this.setHoverPaintStyle(e.endpointHoverStyle||e.hoverPaintStyle,n),null!=e.maxConnections&&(this._jsPlumb.maxConnections=e.maxConnections),e.scope&&(this.scope=e.scope),t.extend(this,e,r),null!=e.cssClass&&this.canvas&&this._jsPlumb.instance.addClass(this.canvas,e.cssClass),t.OverlayCapableJsPlumbUIComponent.applyType(this,e)},isEnabled:function(){return this._jsPlumb.enabled},setEnabled:function(t){this._jsPlumb.enabled=t},cleanup:function(){t.removeClass(this.element,this._jsPlumb.instance.endpointAnchorClassPrefix+(this._jsPlumb.currentAnchorClass?"-"+this._jsPlumb.currentAnchorClass:"")),this.anchor=null,this.endpoint.cleanup(!0),this.endpoint.destroy(),this.endpoint=null,this._jsPlumb.instance.destroyDraggable(this.canvas,"internal"),this._jsPlumb.instance.destroyDroppable(this.canvas,"internal")},setHover:function(t){this.endpoint&&this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged()&&this.endpoint.setHover(t)},isFull:function(){return 0===this._jsPlumb.maxConnections||!(this.isFloating()||this._jsPlumb.maxConnections<0||this.connections.length<this._jsPlumb.maxConnections)},isFloating:function(){return null!=this.anchor&&this.anchor.isFloating},isConnectedTo:function(t){var e=!1;if(t)for(var n=0;n<this.connections.length;n++)if(this.connections[n].endpoints[1]===t||this.connections[n].endpoints[0]===t){e=!0;break}return e},getConnectionCost:function(){return this._jsPlumb.connectionCost},setConnectionCost:function(t){this._jsPlumb.connectionCost=t},areConnectionsDirected:function(){return this._jsPlumb.connectionsDirected},setConnectionsDirected:function(t){this._jsPlumb.connectionsDirected=t},setElementId:function(t){this.elementId=t,this.anchor.elementId=t},setReferenceElement:function(e){this.element=t.getElement(e)},setDragAllowedWhenFull:function(t){this.dragAllowedWhenFull=t},equals:function(t){return this.anchor.equals(t.anchor)},getUuid:function(){return this._jsPlumb.uuid},computeAnchor:function(t){return this.anchor.compute(t)}}),this.jsPlumbInstance.prototype.EndpointDropHandler=function(t){return function(n){var i=t.jsPlumb;t.removeClass(i.endpointDropAllowedClass),t.removeClass(i.endpointDropForbiddenClass);var o=i.getDropEvent(arguments),r=i.getDragObject(arguments),s=i.getAttribute(r,"dragId"),a=(i.getAttribute(r,"elId"),i.getAttribute(r,"originalScope")),l=i.getFloatingConnectionFor(s);if(null!=l){var c=null!=l.suspendedEndpoint;if(!c||null!=l.suspendedEndpoint._jsPlumb){var u=t.getEndpoint(l);if(null!=u){if(t.isRedrop(l,t))return l._forceReattach=!0,l.setHover(!1),void(t.maybeCleanup&&t.maybeCleanup(u));var d=i.getFloatingAnchorIndex(l);if(0===d&&!t.isSource||1===d&&!t.isTarget)t.maybeCleanup&&t.maybeCleanup(u);else{t.onDrop&&t.onDrop(l),a&&i.setDragScope(r,a);var h=t.isFull(n);if(h&&u.fire("maxConnections",{endpoint:this,connection:l,maxConnections:u._jsPlumb.maxConnections},o),!h&&t.enabled()){var p=!0;0===d?(l.floatingElement=l.source,l.floatingId=l.sourceId,l.floatingEndpoint=l.endpoints[0],l.floatingIndex=0,l.source=t.element,l.sourceId=i.getId(t.element)):(l.floatingElement=l.target,l.floatingId=l.targetId,l.floatingEndpoint=l.endpoints[1],l.floatingIndex=1,l.target=t.element,l.targetId=i.getId(t.element)),c&&l.suspendedEndpoint.id!==u.id&&(l.isDetachAllowed(l)&&l.endpoints[d].isDetachAllowed(l)&&l.suspendedEndpoint.isDetachAllowed(l)&&i.checkCondition("beforeDetach",l)||(p=!1));var f=(function(n){l.endpoints[d].detachFromConnection(l),l.suspendedEndpoint&&l.suspendedEndpoint.detachFromConnection(l),l.endpoints[d]=u,u.addConnection(l);var r=u.getParameters();for(var s in r)l.setParameter(s,r[s]);if(c){var a=l.suspendedEndpoint.elementId;i.fireMoveEvent({index:d,originalSourceId:0===d?a:l.sourceId,newSourceId:0===d?u.elementId:l.sourceId,originalTargetId:1===d?a:l.targetId,newTargetId:1===d?u.elementId:l.targetId,originalSourceEndpoint:0===d?l.suspendedEndpoint:l.endpoints[0],newSourceEndpoint:0===d?u:l.endpoints[0],originalTargetEndpoint:1===d?l.suspendedEndpoint:l.endpoints[1],newTargetEndpoint:1===d?u:l.endpoints[1],connection:l},o)}else r.draggable&&i.initDraggable(this.element,t.dragOptions,"internal",i);1===d?i.router.sourceOrTargetChanged(l.floatingId,l.targetId,l,l.target,1):i.router.sourceOrTargetChanged(l.floatingId,l.sourceId,l,l.source,0),l.endpoints[0].finalEndpoint&&(l.endpoints[0].detachFromConnection(l),l.endpoints[0]=l.endpoints[0].finalEndpoint,l.endpoints[0].addConnection(l)),e.isObject(n)&&l.mergeData(n),i.finaliseConnection(l,null,o,!1),l.setHover(!1),i.revalidate(l.endpoints[0].element)}).bind(this),m=function(){l.suspendedEndpoint&&(l.endpoints[d]=l.suspendedEndpoint,l.setHover(!1),l._forceDetach=!0,0===d?(l.source=l.suspendedEndpoint.element,l.sourceId=l.suspendedEndpoint.elementId):(l.target=l.suspendedEndpoint.element,l.targetId=l.suspendedEndpoint.elementId),l.suspendedEndpoint.addConnection(l),1===d?i.router.sourceOrTargetChanged(l.floatingId,l.targetId,l,l.target,1):i.router.sourceOrTargetChanged(l.floatingId,l.sourceId,l,l.source,0),i.repaint(l.sourceId),l._forceDetach=!1)};if(p=p&&t.isDropAllowed(l.sourceId,l.targetId,l.scope,l,u))return f(p),!0;m()}t.maybeCleanup&&t.maybeCleanup(u),i.currentlyDragging=!1}}}}}}}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this,e=t.jsPlumb,n=t.jsPlumbUtil,i=function(t,i,o,r,s){if(e.Connectors[i]=e.Connectors[i]||{},null==e.Connectors[i][o]){if(null==e.Connectors[o]){if(t.Defaults.DoNotThrowErrors)return null;throw new TypeError("jsPlumb: unknown connector type '"+o+"'")}e.Connectors[i][o]=function(){e.Connectors[o].apply(this,arguments),e.ConnectorRenderers[i].apply(this,arguments)},n.extend(e.Connectors[i][o],[e.Connectors[o],e.ConnectorRenderers[i]])}return new e.Connectors[i][o](r,s)},o=function(t,e,n){return t?n.makeAnchor(t,e,n):null},r=function(t,e,i,o){null!=e&&(e._jsPlumbConnections=e._jsPlumbConnections||{},o?delete e._jsPlumbConnections[t.id]:e._jsPlumbConnections[t.id]=!0,n.isEmpty(e._jsPlumbConnections)?i.removeClass(e,i.connectedClass):i.addClass(e,i.connectedClass))};e.Connection=function(t){var i=t.newEndpoint;this.id=t.id,this.connector=null,this.idPrefix="_jsplumb_c_",this.defaultLabelLocation=.5,this.defaultOverlayKeys=["Overlays","ConnectionOverlays"],this.previousConnection=t.previousConnection,this.source=e.getElement(t.source),this.target=e.getElement(t.target),e.OverlayCapableJsPlumbUIComponent.apply(this,arguments),t.sourceEndpoint?(this.source=t.sourceEndpoint.getElement(),this.sourceId=t.sourceEndpoint.elementId):this.sourceId=this._jsPlumb.instance.getId(this.source),t.targetEndpoint?(this.target=t.targetEndpoint.getElement(),this.targetId=t.targetEndpoint.elementId):this.targetId=this._jsPlumb.instance.getId(this.target),this.scope=t.scope,this.endpoints=[],this.endpointStyles=[];var o=this._jsPlumb.instance;o.manage(this.sourceId,this.source),o.manage(this.targetId,this.target),this._jsPlumb.visible=!0,this._jsPlumb.params={cssClass:t.cssClass,container:t.container,"pointer-events":t["pointer-events"],editorParams:t.editorParams,overlays:t.overlays},this._jsPlumb.lastPaintedAt=null,this.bind("mouseover",(function(){this.setHover(!0)}).bind(this)),this.bind("mouseout",(function(){this.setHover(!1)}).bind(this)),this.makeEndpoint=function(e,n,r,s,a){return r=r||this._jsPlumb.instance.getId(n),this.prepareEndpoint(o,i,this,s,e?0:1,t,n,r,a)},t.type&&(t.endpoints=t.endpoints||this._jsPlumb.instance.deriveEndpointAndAnchorSpec(t.type).endpoints);var r=this.makeEndpoint(!0,this.source,this.sourceId,t.sourceEndpoint),s=this.makeEndpoint(!1,this.target,this.targetId,t.targetEndpoint);r&&n.addToList(t.endpointsByElement,this.sourceId,r),s&&n.addToList(t.endpointsByElement,this.targetId,s),this.scope||(this.scope=this.endpoints[0].scope),null!=t.deleteEndpointsOnEmpty&&(this.endpoints[0].setDeleteOnEmpty(t.deleteEndpointsOnEmpty),this.endpoints[1].setDeleteOnEmpty(t.deleteEndpointsOnEmpty));var a=o.Defaults.ConnectionsDetachable;!1===t.detachable&&(a=!1),!1===this.endpoints[0].connectionsDetachable&&(a=!1),!1===this.endpoints[1].connectionsDetachable&&(a=!1);var l=t.reattach||this.endpoints[0].reattachConnections||this.endpoints[1].reattachConnections||o.Defaults.ReattachConnections;this.appendToDefaultType({detachable:a,reattach:l,paintStyle:this.endpoints[0].connectorStyle||this.endpoints[1].connectorStyle||t.paintStyle||o.Defaults.PaintStyle||e.Defaults.PaintStyle,hoverPaintStyle:this.endpoints[0].connectorHoverStyle||this.endpoints[1].connectorHoverStyle||t.hoverPaintStyle||o.Defaults.HoverPaintStyle||e.Defaults.HoverPaintStyle});var c=o.getSuspendedAt();if(!o.isSuspendDrawing()){var u=o.getCachedData(this.sourceId),d=u.o,h=u.s,p=o.getCachedData(this.targetId),f=p.o,m=p.s,g=c||jsPlumbUtil.uuid(),v=this.endpoints[0].anchor.compute({xy:[d.left,d.top],wh:h,element:this.endpoints[0],elementId:this.endpoints[0].elementId,txy:[f.left,f.top],twh:m,tElement:this.endpoints[1],timestamp:g,rotation:o.getRotation(this.endpoints[0].elementId)});this.endpoints[0].paint({anchorLoc:v,timestamp:g}),v=this.endpoints[1].anchor.compute({xy:[f.left,f.top],wh:m,element:this.endpoints[1],elementId:this.endpoints[1].elementId,txy:[d.left,d.top],twh:h,tElement:this.endpoints[0],timestamp:g,rotation:o.getRotation(this.endpoints[1].elementId)}),this.endpoints[1].paint({anchorLoc:v,timestamp:g})}this.getTypeDescriptor=function(){return"connection"},this.getAttachedElements=function(){return this.endpoints},this.isDetachable=function(t){return!1!==this._jsPlumb.detachable&&(null!=t?!0===t.connectionsDetachable:!0===this._jsPlumb.detachable)},this.setDetachable=function(t){this._jsPlumb.detachable=!0===t},this.isReattach=function(){return!0===this._jsPlumb.reattach||!0===this.endpoints[0].reattachConnections||!0===this.endpoints[1].reattachConnections},this.setReattach=function(t){this._jsPlumb.reattach=!0===t},this._jsPlumb.cost=t.cost||this.endpoints[0].getConnectionCost(),this._jsPlumb.directed=t.directed,null==t.directed&&(this._jsPlumb.directed=this.endpoints[0].areConnectionsDirected());var b=e.extend({},this.endpoints[1].getParameters());e.extend(b,this.endpoints[0].getParameters()),e.extend(b,this.getParameters()),this.setParameters(b),this.setConnector(this.endpoints[0].connector||this.endpoints[1].connector||t.connector||o.Defaults.Connector||e.Defaults.Connector,!0);var y=null!=t.data&&n.isObject(t.data)?t.data:{};this.getData=function(){return y},this.setData=function(t){y=t||{}},this.mergeData=function(t){y=e.extend(y,t)};var _=["default",this.endpoints[0].connectionType,this.endpoints[1].connectionType,t.type].join(" ");/[^\s]/.test(_)&&this.addType(_,t.data,!0),this.updateConnectedClass()},n.extend(e.Connection,e.OverlayCapableJsPlumbUIComponent,{applyType:function(t,n,i){var o=null;null!=t.connector&&(null==(o=this.getCachedTypeItem("connector",i.connector))&&(o=this.prepareConnector(t.connector,i.connector),this.cacheTypeItem("connector",o,i.connector)),this.setPreparedConnector(o)),null!=t.detachable&&this.setDetachable(t.detachable),null!=t.reattach&&this.setReattach(t.reattach),t.scope&&(this.scope=t.scope),null!=t.cssClass&&this.canvas&&this._jsPlumb.instance.addClass(this.canvas,t.cssClass);var r=null;t.anchor?null==(r=this.getCachedTypeItem("anchors",i.anchor))&&(r=[this._jsPlumb.instance.makeAnchor(t.anchor),this._jsPlumb.instance.makeAnchor(t.anchor)],this.cacheTypeItem("anchors",r,i.anchor)):t.anchors&&null==(r=this.getCachedTypeItem("anchors",i.anchors))&&(r=[this._jsPlumb.instance.makeAnchor(t.anchors[0]),this._jsPlumb.instance.makeAnchor(t.anchors[1])],this.cacheTypeItem("anchors",r,i.anchors)),null!=r&&(this.endpoints[0].anchor=r[0],this.endpoints[1].anchor=r[1],this.endpoints[1].anchor.isDynamic&&this._jsPlumb.instance.repaint(this.endpoints[1].elementId)),e.OverlayCapableJsPlumbUIComponent.applyType(this,t)},addClass:function(t,e){e&&(this.endpoints[0].addClass(t),this.endpoints[1].addClass(t),this.suspendedEndpoint&&this.suspendedEndpoint.addClass(t)),this.connector&&this.connector.addClass(t)},removeClass:function(t,e){e&&(this.endpoints[0].removeClass(t),this.endpoints[1].removeClass(t),this.suspendedEndpoint&&this.suspendedEndpoint.removeClass(t)),this.connector&&this.connector.removeClass(t)},isVisible:function(){return this._jsPlumb.visible},setVisible:function(t){this._jsPlumb.visible=t,this.connector&&this.connector.setVisible(t),this.repaint()},cleanup:function(){this.updateConnectedClass(!0),this.endpoints=null,this.source=null,this.target=null,null!=this.connector&&(this.connector.cleanup(!0),this.connector.destroy(!0)),this.connector=null},updateConnectedClass:function(t){this._jsPlumb&&(r(this,this.source,this._jsPlumb.instance,t),r(this,this.target,this._jsPlumb.instance,t))},setHover:function(e){this.connector&&this._jsPlumb&&!this._jsPlumb.instance.isConnectionBeingDragged()&&(this.connector.setHover(e),t.jsPlumb[e?"addClass":"removeClass"](this.source,this._jsPlumb.instance.hoverSourceClass),t.jsPlumb[e?"addClass":"removeClass"](this.target,this._jsPlumb.instance.hoverTargetClass))},getUuids:function(){return[this.endpoints[0].getUuid(),this.endpoints[1].getUuid()]},getCost:function(){return this._jsPlumb?this._jsPlumb.cost:-1/0},setCost:function(t){this._jsPlumb.cost=t},isDirected:function(){return this._jsPlumb.directed},getConnector:function(){return this.connector},prepareConnector:function(t,e){var o,r={_jsPlumb:this._jsPlumb.instance,cssClass:this._jsPlumb.params.cssClass,container:this._jsPlumb.params.container,"pointer-events":this._jsPlumb.params["pointer-events"]},s=this._jsPlumb.instance.getRenderMode();return n.isString(t)?o=i(this._jsPlumb.instance,s,t,r,this):n.isArray(t)&&(o=i(this._jsPlumb.instance,s,t[0],1===t.length?r:n.merge(t[1],r),this)),null!=e&&(o.typeId=e),o},setPreparedConnector:function(t,e,n,i){if(this.connector!==t){var o,r="";if(null!=this.connector&&(r=(o=this.connector).getClass(),this.connector.cleanup(),this.connector.destroy()),this.connector=t,i&&this.cacheTypeItem("connector",t,i),this.canvas=this.connector.canvas,this.bgCanvas=this.connector.bgCanvas,this.connector.reattach(this._jsPlumb.instance),this.addClass(r),this.canvas&&(this.canvas._jsPlumb=this),this.bgCanvas&&(this.bgCanvas._jsPlumb=this),null!=o)for(var s=this.getOverlays(),a=0;a<s.length;a++)s[a].transfer&&s[a].transfer(this.connector);n||this.setListenerComponent(this.connector),e||this.repaint()}},setConnector:function(t,e,n,i){var o=this.prepareConnector(t,i);this.setPreparedConnector(o,e,n,i)},paint:function(t){if(!this._jsPlumb.instance.isSuspendDrawing()&&this._jsPlumb.visible){var e=(t=t||{}).timestamp,n=this.targetId;if(null==e||e!==this._jsPlumb.lastPaintedAt){var i=this._jsPlumb.instance.updateOffset({elId:this.sourceId}).o,o=this._jsPlumb.instance.updateOffset({elId:n}).o,r=this.endpoints[0],s=this.endpoints[1],a=r.anchor.getCurrentLocation({xy:[i.left,i.top],wh:[i.width,i.height],element:r,timestamp:e,rotation:this._jsPlumb.instance.getRotation(this.sourceId)}),l=s.anchor.getCurrentLocation({xy:[o.left,o.top],wh:[o.width,o.height],element:s,timestamp:e,rotation:this._jsPlumb.instance.getRotation(this.targetId)});this.connector.resetBounds(),this.connector.compute({sourcePos:a,targetPos:l,sourceOrientation:r.anchor.getOrientation(r),targetOrientation:s.anchor.getOrientation(s),sourceEndpoint:this.endpoints[0],targetEndpoint:this.endpoints[1],"stroke-width":this._jsPlumb.paintStyleInUse.strokeWidth,sourceInfo:i,targetInfo:o});var c={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(var u in this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(u)){var d=this._jsPlumb.overlays[u];d.isVisible()&&(this._jsPlumb.overlayPlacements[u]=d.draw(this.connector,this._jsPlumb.paintStyleInUse,this.getAbsoluteOverlayPosition(d)),c.minX=Math.min(c.minX,this._jsPlumb.overlayPlacements[u].minX),c.maxX=Math.max(c.maxX,this._jsPlumb.overlayPlacements[u].maxX),c.minY=Math.min(c.minY,this._jsPlumb.overlayPlacements[u].minY),c.maxY=Math.max(c.maxY,this._jsPlumb.overlayPlacements[u].maxY))}var h=parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth||1)/2,p=parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth||0),f={xmin:Math.min(this.connector.bounds.minX-(h+p),c.minX),ymin:Math.min(this.connector.bounds.minY-(h+p),c.minY),xmax:Math.max(this.connector.bounds.maxX+(h+p),c.maxX),ymax:Math.max(this.connector.bounds.maxY+(h+p),c.maxY)};for(var m in this.connector.paintExtents=f,this.connector.paint(this._jsPlumb.paintStyleInUse,null,f),this._jsPlumb.overlays)if(this._jsPlumb.overlays.hasOwnProperty(m)){var g=this._jsPlumb.overlays[m];g.isVisible()&&g.paint(this._jsPlumb.overlayPlacements[m],f)}}this._jsPlumb.lastPaintedAt=e}},repaint:function(t){var e=jsPlumb.extend(t||{},{});e.elId=this.sourceId,this.paint(e)},prepareEndpoint:function(t,n,i,r,s,a,l,c,u){var d;if(r)i.endpoints[s]=r,r.addConnection(i);else{a.endpoints||(a.endpoints=[null,null]);var h=u||a.endpoints[s]||a.endpoint||t.Defaults.Endpoints[s]||e.Defaults.Endpoints[s]||t.Defaults.Endpoint||e.Defaults.Endpoint;a.endpointStyles||(a.endpointStyles=[null,null]),a.endpointHoverStyles||(a.endpointHoverStyles=[null,null]);var p=a.endpointStyles[s]||a.endpointStyle||t.Defaults.EndpointStyles[s]||e.Defaults.EndpointStyles[s]||t.Defaults.EndpointStyle||e.Defaults.EndpointStyle;null==p.fill&&null!=a.paintStyle&&(p.fill=a.paintStyle.stroke),null==p.outlineStroke&&null!=a.paintStyle&&(p.outlineStroke=a.paintStyle.outlineStroke),null==p.outlineWidth&&null!=a.paintStyle&&(p.outlineWidth=a.paintStyle.outlineWidth);var f=a.endpointHoverStyles[s]||a.endpointHoverStyle||t.Defaults.EndpointHoverStyles[s]||e.Defaults.EndpointHoverStyles[s]||t.Defaults.EndpointHoverStyle||e.Defaults.EndpointHoverStyle;null!=a.hoverPaintStyle&&(null==f&&(f={}),null==f.fill&&(f.fill=a.hoverPaintStyle.stroke));var m=a.anchors?a.anchors[s]:a.anchor?a.anchor:o(t.Defaults.Anchors[s],c,t)||o(e.Defaults.Anchors[s],c,t)||o(t.Defaults.Anchor,c,t)||o(e.Defaults.Anchor,c,t);d=n({paintStyle:p,hoverPaintStyle:f,endpoint:h,connections:[i],uuid:a.uuids?a.uuids[s]:null,anchor:m,source:l,scope:a.scope,reattach:a.reattach||t.Defaults.ReattachConnections,detachable:a.detachable||t.Defaults.ConnectionsDetachable}),null==r&&d.setDeleteOnEmpty(!0),i.endpoints[s]=d,!1===a.drawEndpoints&&d.setVisible(!1,!0,!0)}return d},replaceEndpoint:function(t,e){var n=this.endpoints[t],i=n.elementId,o=this._jsPlumb.instance.getEndpoints(i),r=o.indexOf(n),s=this.makeEndpoint(0===t,n.element,i,null,e);this.endpoints[t]=s,o.splice(r,1,s),this._jsPlumb.instance.deleteObject({endpoint:n,deleteAttachedObjects:!1}),this._jsPlumb.instance.fire("endpointReplaced",{previous:n,current:s}),this._jsPlumb.instance.router.sourceOrTargetChanged(this.endpoints[1].elementId,this.endpoints[1].elementId,this,this.endpoints[1].element,1)}})}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this.jsPlumbUtil,e=this.jsPlumb;e.AnchorManager=function(n){var i={},o={},r={},s={},a=this,l={},c=n.jsPlumbInstance,u={},d=function(t,e){return e[0][0]-t[0][0]},h=function(t,e){return(t[0][0]<0?-Math.PI-t[0][0]:Math.PI-t[0][0])-(e[0][0]<0?-Math.PI-e[0][0]:Math.PI-e[0][0])},p={top:h,right:d,bottom:d,left:h},f=function(t,e){var n=c.getCachedData(t),i=n.s,s=n.o,a=function(e,n,i,s,a,l,u){if(s.length>0)for(var d=function(t,e,n,i,o,r,s,a){for(var l=[],c=e[o?0:1]/(i.length+1),u=0;u<i.length;u++){var d=(u+1)*c,h=r*e[o?1:0];s&&(d=e[o?0:1]-d);var p=o?d:h,f=n.left+p,m=p/e[0],g=o?h:d,v=n.top+g,b=g/e[1];if(0!==a){var y=jsPlumbUtil.rotatePoint([f,v],[n.centerx,n.centery],a);f=y[0],v=y[1]}l.push([f,v,m,b,i[u][1],i[u][2]])}return l}(0,n,i,s.sort(p[e]),a,l,"right"===e||"top"===e,c.getRotation(t)),h=function(t,e){o[t.id]=[e[0],e[1],e[2],e[3]],r[t.id]=u},f=0;f<d.length;f++){var m=d[f][4],g=m.endpoints[1].elementId===t;m.endpoints[0].elementId===t&&h(m.endpoints[0],d[f]),g&&h(m.endpoints[1],d[f])}};a("bottom",i,s,e.bottom,!0,1,[0,1]),a("top",i,s,e.top,!0,0,[0,-1]),a("left",i,s,e.left,!1,0,[-1,0]),a("right",i,s,e.right,!1,1,[1,0])};this.reset=function(){i={},s={},l={}},this.addFloatingConnection=function(t,e){u[t]=e},this.newConnection=function(n){var i=n.sourceId,o=n.targetId,r=n.endpoints,a=!0,l=function(l,c,u,d,h){i===o&&u.isContinuous&&(n._jsPlumb.instance.removeElement(r[1].canvas),a=!1),t.addToList(s,d,[h,c,u.constructor===e.DynamicAnchor])};l(0,r[0],r[0].anchor,o,n),a&&l(0,r[1],r[1].anchor,i,n)};var m=function(e){!function(e,n){if(e){var i=function(t){return t[4]===n};t.removeWithFunction(e.top,i),t.removeWithFunction(e.left,i),t.removeWithFunction(e.bottom,i),t.removeWithFunction(e.right,i)}}(l[e.elementId],e.id)};this.connectionDetached=function(e,n){var i=e.connection||e,o=e.targetId,r=function(e,n,i,o,r){t.removeWithFunction(s[o],function(t){return t[0].id===r.id})};r(0,0,0,e.sourceId,i),r(0,0,0,o,i),i.floatingId&&(r(0,0,0,i.floatingId,i),m(i.floatingEndpoint)),m(i.endpoints[0]),m(i.endpoints[1]),n||(a.redraw(i.sourceId),i.targetId!==i.sourceId&&a.redraw(i.targetId))},this.addEndpoint=function(e,n){t.addToList(i,n,e)},this.changeId=function(t,e){s[e]=s[t],i[e]=i[t],delete s[t],delete i[t]},this.getConnectionsFor=function(t){return s[t]||[]},this.getEndpointsFor=function(t){return i[t]||[]},this.deleteEndpoint=function(e){t.removeWithFunction(i[e.elementId],function(t){return t.id===e.id}),m(e)},this.elementRemoved=function(t){delete u[t],delete i[t],i[t]=[]};var g=function(e,i,o,r,s,a,l,c,u,d,h,p){var f,m,g=-1,v=r.endpoints[l],b=v.id,y=[1,0][l],_=[[i,o],r,s,a,b],P=e[u],C=v._continuousAnchorEdge?e[v._continuousAnchorEdge]:null;if(C){var x=t.findWithFunction(C,function(t){return t[4]===b});if(-1!==x)for(C.splice(x,1),f=0;f<C.length;f++)t.addWithFunction(h,m=C[f][1],function(t){return t.id===m.id}),t.addWithFunction(p,C[f][1].endpoints[l],function(t){return t.id===m.endpoints[l].id}),t.addWithFunction(p,C[f][1].endpoints[y],function(t){return t.id===m.endpoints[y].id})}for(f=0;f<P.length;f++)1===n.idx&&P[f][3]===a&&-1===g&&(g=f),t.addWithFunction(h,m=P[f][1],function(t){return t.id===m.id}),t.addWithFunction(p,P[f][1].endpoints[l],function(t){return t.id===m.endpoints[l].id}),t.addWithFunction(p,P[f][1].endpoints[y],function(t){return t.id===m.endpoints[y].id});P.splice(c?-1!==g?g:0:P.length,0,_),v._continuousAnchorEdge=u};this.sourceOrTargetChanged=function(n,i,o,r,a){if(0===a){if(n!==i){o.sourceId=i,o.source=r,t.removeWithFunction(s[n],function(t){return t[0].id===o.id});var l=t.findWithFunction(s[o.targetId],function(t){return t[0].id===o.id});l>-1&&(s[o.targetId][l][0]=o,s[o.targetId][l][1]=o.endpoints[0],s[o.targetId][l][2]=o.endpoints[0].anchor.constructor===e.DynamicAnchor),t.addToList(s,i,[o,o.endpoints[1],o.endpoints[1].anchor.constructor===e.DynamicAnchor]),o.endpoints[1].anchor.isContinuous&&(o.source===o.target?o._jsPlumb.instance.removeElement(o.endpoints[1].canvas):null==o.endpoints[1].canvas.parentNode&&o._jsPlumb.instance.appendElement(o.endpoints[1].canvas)),o.updateConnectedClass()}}else if(1===a){var c=o.endpoints[0].elementId;o.target=r,o.targetId=i;var u=t.findWithFunction(s[c],function(t){return t[0].id===o.id}),d=t.findWithFunction(s[n],function(t){return t[0].id===o.id});-1!==u&&(s[c][u][0]=o,s[c][u][1]=o.endpoints[1],s[c][u][2]=o.endpoints[1].anchor.constructor===e.DynamicAnchor),d>-1&&(s[n].splice(d,1),t.addToList(s,i,[o,o.endpoints[0],o.endpoints[0].anchor.constructor===e.DynamicAnchor])),o.updateConnectedClass()}},this.rehomeEndpoint=function(t,e,n){var o=i[e]||[],r=c.getId(n);if(r!==e){var s=o.indexOf(t);if(s>-1){var l=o.splice(s,1)[0];a.add(l,r)}}for(var u=0;u<t.connections.length;u++)t.connections[u].sourceId===e?a.sourceOrTargetChanged(e,t.elementId,t.connections[u],t.element,0):t.connections[u].targetId===e&&a.sourceOrTargetChanged(e,t.elementId,t.connections[u],t.element,1)},this.redraw=function(n,o,r,a,d,h){var p=[],m=[],v=[];if(!c.isSuspendDrawing()){var b=i[n]||[],y=s[n]||[];r=r||jsPlumbUtil.uuid(),a=a||{left:0,top:0},o&&(o={left:o.left+a.left,top:o.top+a.top});for(var _=c.updateOffset({elId:n,offset:o,recalc:!1,timestamp:r}),P={},C=0;C<y.length;C++){var x=y[C][0],w=x.sourceId,j=x.targetId,S=x.endpoints[0].anchor.isContinuous,O=x.endpoints[1].anchor.isContinuous;if(S||O){var E=w+"_"+j,k=P[E],M=x.sourceId===n?1:0,D=c.getRotation(j),I=c.getRotation(w);S&&!l[w]&&(l[w]={top:[],right:[],bottom:[],left:[]}),O&&!l[j]&&(l[j]={top:[],right:[],bottom:[],left:[]}),n!==j&&c.updateOffset({elId:j,timestamp:r}),n!==w&&c.updateOffset({elId:w,timestamp:r});var T=c.getCachedData(j),A=c.getCachedData(w);j===w&&(S||O)?(g(l[w],-Math.PI/2,0,x,!1,j,0,!1,"top",0,p,m),g(l[j],-Math.PI/2,0,x,!1,w,1,!1,"top",0,p,m)):(k||(k=this.calculateOrientation(w,j,A.o,T.o,x.endpoints[0].anchor,x.endpoints[1].anchor,x,I,D),P[E]=k),S&&g(l[w],k.theta,0,x,!1,j,0,!1,k.a[0],0,p,m),O&&g(l[j],k.theta2,-1,x,!0,w,1,!0,k.a[1],0,p,m)),S&&t.addWithFunction(v,w,function(t){return t===w}),O&&t.addWithFunction(v,j,function(t){return t===j}),t.addWithFunction(p,x,function(t){return t.id===x.id}),(S&&0===M||O&&1===M)&&t.addWithFunction(m,x.endpoints[M],function(t){return t.id===x.endpoints[M].id})}}for(C=0;C<b.length;C++)0===b[C].connections.length&&b[C].anchor.isContinuous&&(l[n]||(l[n]={top:[],right:[],bottom:[],left:[]}),g(l[n],-Math.PI/2,0,{endpoints:[b[C],b[C]],paint:function(){}},!1,n,0,!1,b[C].anchor.getDefaultFace(),0,p,m),t.addWithFunction(v,n,function(t){return t===n}));for(C=0;C<v.length;C++)f(v[C],l[v[C]]);for(C=0;C<b.length;C++)b[C].paint({timestamp:r,offset:_,dimensions:_.s,recalc:!0!==h});for(C=0;C<m.length;C++){var F=c.getCachedData(m[C].elementId);m[C].paint({timestamp:null,offset:F,dimensions:F.s})}for(C=0;C<y.length;C++){var U=y[C][1];if(U.anchor.constructor===e.DynamicAnchor){U.paint({elementWithPrecedence:n,timestamp:r}),t.addWithFunction(p,y[C][0],function(t){return t.id===y[C][0].id});for(var L=0;L<U.connections.length;L++)U.connections[L]!==y[C][0]&&t.addWithFunction(p,U.connections[L],function(t){return t.id===U.connections[L].id})}else t.addWithFunction(p,y[C][0],function(t){return t.id===y[C][0].id})}var H=u[n];for(H&&H.paint({timestamp:r,recalc:!1,elId:n}),C=0;C<p.length;C++)p[C].paint({elId:n,timestamp:null,recalc:!1,clearEdits:d})}return{c:p,e:m}};var v=function(e){t.EventGenerator.apply(this),this.type="Continuous",this.isDynamic=!0,this.isContinuous=!0;for(var n=e.faces||["top","right","bottom","left"],i=!(!1===e.clockwise),s={},a={top:"bottom",right:"left",left:"right",bottom:"top"},l={top:"right",right:"bottom",left:"top",bottom:"left"},c={top:"left",right:"top",left:"bottom",bottom:"right"},u=i?l:c,d=i?c:l,h=e.cssClass||"",p=null,f=null,m=["left","right"],g=["top","bottom"],v=null,b=0;b<n.length;b++)s[n[b]]=!0;this.getDefaultFace=function(){return 0===n.length?"top":n[0]},this.isRelocatable=function(){return!0},this.isSnapOnRelocate=function(){return!0},this.verifyEdge=function(t){return s[t]?t:s[a[t]]?a[t]:s[u[t]]?u[t]:s[d[t]]?d[t]:t},this.isEdgeSupported=function(t){return null==v?null==f?!0===s[t]:f===t:-1!==v.indexOf(t)},this.setCurrentFace=function(t,e){p=t,e&&null!=f&&(f=p)},this.getCurrentFace=function(){return p},this.getSupportedFaces=function(){var t=[];for(var e in s)s[e]&&t.push(e);return t},this.lock=function(){f=p},this.unlock=function(){f=null},this.isLocked=function(){return null!=f},this.lockCurrentAxis=function(){null!=p&&(v="left"===p||"right"===p?m:g)},this.unlockCurrentAxis=function(){v=null},this.compute=function(t){return o[t.element.id]||[0,0]},this.getCurrentLocation=function(t){return o[t.element.id]||[0,0]},this.getOrientation=function(t){return r[t.id]||[0,0]},this.getCssClass=function(){return h}};c.continuousAnchorFactory={get:function(t){return new v(t)},clear:function(t){delete o[t]}}},e.AnchorManager.prototype.calculateOrientation=function(t,e,n,i,o,r,s,a,l){var c=["left","top","right","bottom"];if(t===e)return{orientation:"identity",a:["top","top"]};var u=Math.atan2(i.centery-n.centery,i.centerx-n.centerx),d=Math.atan2(n.centery-i.centery,n.centerx-i.centerx),h=[],p={};!function(t,e){for(var n=0;n<t.length;n++)if(p[t[n]]={left:[e[n][0].left,e[n][0].centery],right:[e[n][0].right,e[n][0].centery],top:[e[n][0].centerx,e[n][0].top],bottom:[e[n][0].centerx,e[n][0].bottom]},0!==e[n][1])for(var i in p[t[n]])p[t[n]][i]=jsPlumbUtil.rotatePoint(p[t[n]][i],[e[n][0].centerx,e[n][0].centery],e[n][1])}(["source","target"],[[n,a],[i,l]]);for(var f=0;f<c.length;f++)for(var m=0;m<c.length;m++)h.push({source:c[f],target:c[m],dist:Biltong.lineLength(p.source[c[f]],p.target[c[m]])});h.sort(function(t,e){return t.dist<e.dist?-1:t.dist>e.dist?1:0});for(var g=h[0].source,v=h[0].target,b=0;b<h.length&&(g=o.isContinuous&&o.locked?o.getCurrentFace():!o.isContinuous||o.isEdgeSupported(h[b].source)?h[b].source:null,v=r.isContinuous&&r.locked?r.getCurrentFace():!r.isContinuous||r.isEdgeSupported(h[b].target)?h[b].target:null,null==g||null==v);b++);return o.isContinuous&&o.setCurrentFace(g),r.isContinuous&&r.setCurrentFace(v),{a:[g,v],theta:u,theta2:d}},e.Anchor=function(e){this.x=e.x||0,this.y=e.y||0,this.elementId=e.elementId,this.cssClass=e.cssClass||"",this.orientation=e.orientation||[0,0],this.lastReturnValue=null,this.offsets=e.offsets||[0,0],this.timestamp=null,this._unrotatedOrientation=[this.orientation[0],this.orientation[1]],this.relocatable=!1!==e.relocatable,this.snapOnRelocate=!1!==e.snapOnRelocate,this.locked=!1,t.EventGenerator.apply(this),this.compute=function(t){var e=t.xy,n=t.wh,i=t.timestamp;if(i&&i===this.timestamp)return this.lastReturnValue;var o=[e[0]+this.x*n[0]+this.offsets[0],e[1]+this.y*n[1]+this.offsets[1],this.x,this.y],r=t.rotation;if(null!=r&&0!==r){var s=jsPlumbUtil.rotatePoint(o,[e[0]+n[0]/2,e[1]+n[1]/2],r);this.orientation[0]=Math.round(this._unrotatedOrientation[0]*s[2]-this._unrotatedOrientation[1]*s[3]),this.orientation[1]=Math.round(this._unrotatedOrientation[1]*s[2]+this._unrotatedOrientation[0]*s[3]),this.lastReturnValue=[s[0],s[1],this.x,this.y]}else this.orientation[0]=this._unrotatedOrientation[0],this.orientation[1]=this._unrotatedOrientation[1],this.lastReturnValue=o;return this.timestamp=i,this.lastReturnValue},this.getCurrentLocation=function(t){return t=t||{},null==this.lastReturnValue||null!=t.timestamp&&this.timestamp!==t.timestamp?this.compute(t):this.lastReturnValue},this.setPosition=function(t,e,n,i,o){this.locked&&!o||(this.x=t,this.y=e,this.orientation=[n,i],this.lastReturnValue=null)}},t.extend(e.Anchor,t.EventGenerator,{equals:function(t){if(!t)return!1;var e=t.getOrientation(),n=this.getOrientation();return this.x===t.x&&this.y===t.y&&this.offsets[0]===t.offsets[0]&&this.offsets[1]===t.offsets[1]&&n[0]===e[0]&&n[1]===e[1]},getOrientation:function(){return this.orientation},getCssClass:function(){return this.cssClass}}),e.FloatingAnchor=function(t){e.Anchor.apply(this,arguments);var n=t.reference,i=t.referenceCanvas,o=e.getSize(i),r=0,s=0,a=null,l=null;this.orientation=null,this.x=0,this.y=0,this.isFloating=!0,this.compute=function(t){var e=t.xy,n=[e[0]+o[0]/2,e[1]+o[1]/2];return l=n,n},this.getOrientation=function(t){if(a)return a;var e=n.getOrientation(t);return[Math.abs(e[0])*r*-1,Math.abs(e[1])*s*-1]},this.over=function(t,e){a=t.getOrientation(e)},this.out=function(){a=null},this.getCurrentLocation=function(t){return null==l?this.compute(t):l}},t.extend(e.FloatingAnchor,e.Anchor);var n=function(t,n,i){return t.constructor===e.Anchor?t:n.makeAnchor(t,i,n)};e.DynamicAnchor=function(t){e.Anchor.apply(this,arguments),this.isDynamic=!0,this.anchors=[],this.elementId=t.elementId,this.jsPlumbInstance=t.jsPlumbInstance;for(var i=0;i<t.anchors.length;i++)this.anchors[i]=n(t.anchors[i],this.jsPlumbInstance,this.elementId);this.getAnchors=function(){return this.anchors};var o=this.anchors.length>0?this.anchors[0]:null,r=o,s=function(t,e,n,i,o,r,s){var a=i[0]+t.x*o[0],l=i[1]+t.y*o[1],c=i[0]+o[0]/2,u=i[1]+o[1]/2;if(null!=r&&0!==r){var d=jsPlumbUtil.rotatePoint([a,l],[c,u],r);a=d[0],l=d[1]}return Math.sqrt(Math.pow(e-a,2)+Math.pow(n-l,2))+Math.sqrt(Math.pow(c-a,2)+Math.pow(u-l,2))},a=t.selector||function(t,e,n,i,o,r,a){for(var l=n[0]+i[0]/2,c=n[1]+i[1]/2,u=-1,d=1/0,h=0;h<a.length;h++){var p=s(a[h],l,c,t,e,o,r);p<d&&(u=h+0,d=p)}return a[u]};this.compute=function(t){var e=t.xy,n=t.wh,i=t.txy,s=t.twh,l=t.rotation,c=t.tRotation;return this.timestamp=t.timestamp,this.locked||null==i||null==s?(this.lastReturnValue=o.compute(t),this.lastReturnValue):(t.timestamp=null,o=a(e,n,i,s,l,c,this.anchors),this.x=o.x,this.y=o.y,o!==r&&this.fire("anchorChanged",o),r=o,this.lastReturnValue=o.compute(t),this.lastReturnValue)},this.getCurrentLocation=function(t){return null!=o?o.getCurrentLocation(t):null},this.getOrientation=function(t){return null!=o?o.getOrientation(t):[0,0]},this.over=function(t,e){null!=o&&o.over(t,e)},this.out=function(){null!=o&&o.out()},this.setAnchor=function(t){o=t},this.getCssClass=function(){return o&&o.getCssClass()||""},this.setAnchorCoordinates=function(t){var e=jsPlumbUtil.findWithFunction(this.anchors,function(e){return e.x===t[0]&&e.y===t[1]});return-1!==e&&(this.setAnchor(this.anchors[e]),!0)}},t.extend(e.DynamicAnchor,e.Anchor);var i=function(t,n,i,o,r,s){e.Anchors[r]=function(e){var a=e.jsPlumbInstance.makeAnchor([t,n,i,o,0,0],e.elementId,e.jsPlumbInstance);return a.type=r,s&&s(a,e),a}};i(.5,0,0,-1,"TopCenter"),i(.5,1,0,1,"BottomCenter"),i(0,.5,-1,0,"LeftMiddle"),i(1,.5,1,0,"RightMiddle"),i(.5,0,0,-1,"Top"),i(.5,1,0,1,"Bottom"),i(0,.5,-1,0,"Left"),i(1,.5,1,0,"Right"),i(.5,.5,0,0,"Center"),i(1,0,0,-1,"TopRight"),i(1,1,0,1,"BottomRight"),i(0,0,0,-1,"TopLeft"),i(0,1,0,1,"BottomLeft"),e.Defaults.DynamicAnchors=function(t){return t.jsPlumbInstance.makeAnchors(["TopCenter","RightMiddle","BottomCenter","LeftMiddle"],t.elementId,t.jsPlumbInstance)},e.Anchors.AutoDefault=function(t){var n=t.jsPlumbInstance.makeDynamicAnchor(e.Defaults.DynamicAnchors(t));return n.type="AutoDefault",n};var o=function(t,n){e.Anchors[t]=function(e){var i=e.jsPlumbInstance.makeAnchor(["Continuous",{faces:n}],e.elementId,e.jsPlumbInstance);return i.type=t,i}};e.Anchors.Continuous=function(t){return t.jsPlumbInstance.continuousAnchorFactory.get(t)},o("ContinuousLeft",["left"]),o("ContinuousTop",["top"]),o("ContinuousBottom",["bottom"]),o("ContinuousRight",["right"]),i(0,0,0,0,"Assign",function(t,e){var n=e.position||"Fixed";t.positionFinder=n.constructor===String?e.jsPlumbInstance.AnchorPositionFinders[n]:n,t.constructorParams=e}),this.jsPlumbInstance.prototype.AnchorPositionFinders={Fixed:function(t,e,n){return[(t.left-e.left)/n[0],(t.top-e.top)/n[1]]},Grid:function(t,e,n,i){var o=t.top-e.top,r=n[0]/i.grid[0],s=n[1]/i.grid[1],a=Math.floor((t.left-e.left)/r),l=Math.floor(o/s);return[(a*r+r/2)/n[0],(l*s+s/2)/n[1]]}},e.Anchors.Perimeter=function(t){var e=(t=t||{}).anchorCount||60,n=t.shape;if(!n)throw new Error("no shape supplied to Perimeter Anchor type");var i=function(){for(var t=.5,n=2*Math.PI/e,i=0,o=[],r=0;r<e;r++){var s=t+t*Math.sin(i),a=t+t*Math.cos(i);o.push([s,a,0,0]),i+=n}return o},o=function(t){for(var n=e/t.length,i=[],o=function(t,o,r,s,a,l,c){for(var u=(r-t)/(n=e*a),d=(s-o)/n,h=0;h<n;h++)i.push([t+u*h,o+d*h,null==l?0:l,null==c?0:c])},r=0;r<t.length;r++)o.apply(null,t[r]);return i},r=function(t){for(var e=[],n=0;n<t.length;n++)e.push([t[n][0],t[n][1],t[n][2],t[n][3],1/t.length,t[n][4],t[n][5]]);return o(e)},s=function(){return r([[0,0,1,0,0,-1],[1,0,1,1,1,0],[1,1,0,1,0,1],[0,1,0,0,-1,0]])},a={Circle:i,Ellipse:i,Diamond:function(){return r([[.5,0,1,.5],[1,.5,.5,1],[.5,1,0,.5],[0,.5,.5,0]])},Rectangle:s,Square:s,Triangle:function(){return r([[.5,0,1,1],[1,1,0,1],[0,1,.5,0]])},Path:function(t){for(var e=t.points,n=[],i=0,r=0;r<e.length-1;r++){var s=Math.sqrt(Math.pow(e[r][2]-e[r][0])+Math.pow(e[r][3]-e[r][1]));i+=s,n.push([e[r][0],e[r][1],e[r+1][0],e[r+1][1],s])}for(var a=0;a<n.length;a++)n[a][4]=n[a][4]/i;return o(n)}};if(!a[n])throw new Error("Shape ["+n+"] is unknown by Perimeter Anchor type");var l=a[n](t);t.rotation&&(l=function(t,e){for(var n=[],i=e/180*Math.PI,o=0;o<t.length;o++){var r=t[o][0]-.5,s=t[o][1]-.5;n.push([r*Math.cos(i)-s*Math.sin(i)+.5,r*Math.sin(i)+s*Math.cos(i)+.5,t[o][2],t[o][3]])}return n}(l,t.rotation));var c=t.jsPlumbInstance.makeDynamicAnchor(l);return c.type="Perimeter",c}}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this.jsPlumb;t.DefaultRouter=function(e){this.jsPlumbInstance=e,this.anchorManager=new t.AnchorManager({jsPlumbInstance:e}),this.sourceOrTargetChanged=function(t,e,n,i,o){this.anchorManager.sourceOrTargetChanged(t,e,n,i,o)},this.reset=function(){this.anchorManager.reset()},this.changeId=function(t,e){this.anchorManager.changeId(t,e)},this.elementRemoved=function(t){this.anchorManager.elementRemoved(t)},this.newConnection=function(t){this.anchorManager.newConnection(t)},this.connectionDetached=function(t,e){this.anchorManager.connectionDetached(t,e)},this.redraw=function(t,e,n,i,o,r){return this.anchorManager.redraw(t,e,n,i,o,r)},this.deleteEndpoint=function(t){this.anchorManager.deleteEndpoint(t)},this.rehomeEndpoint=function(t,e,n){this.anchorManager.rehomeEndpoint(t,e,n)},this.addEndpoint=function(t,e){this.anchorManager.addEndpoint(t,e)}}}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this,e=t.jsPlumb,n=t.jsPlumbUtil,i=t.Biltong;e.Segments={AbstractSegment:function(t){this.params=t,this.findClosestPointOnPath=function(t,e){return{d:1/0,x:null,y:null,l:null}},this.getBounds=function(){return{minX:Math.min(t.x1,t.x2),minY:Math.min(t.y1,t.y2),maxX:Math.max(t.x1,t.x2),maxY:Math.max(t.y1,t.y2)}},this.lineIntersection=function(t,e,n,i){return[]},this.boxIntersection=function(t,e,n,i){var o=[];return o.push.apply(o,this.lineIntersection(t,e,t+n,e)),o.push.apply(o,this.lineIntersection(t+n,e,t+n,e+i)),o.push.apply(o,this.lineIntersection(t+n,e+i,t,e+i)),o.push.apply(o,this.lineIntersection(t,e+i,t,e)),o},this.boundingBoxIntersection=function(t){return this.boxIntersection(t.x,t.y,t.w,t.y)}},Straight:function(t){e.Segments.AbstractSegment.apply(this,arguments);var n,o,r,s,a,l,c,u=function(){n=Math.sqrt(Math.pow(a-s,2)+Math.pow(c-l,2)),o=i.gradient({x:s,y:l},{x:a,y:c}),r=-1/o};this.type="Straight",this.getLength=function(){return n},this.getGradient=function(){return o},this.getCoordinates=function(){return{x1:s,y1:l,x2:a,y2:c}},this.setCoordinates=function(t){s=t.x1,l=t.y1,a=t.x2,c=t.y2,u()},this.setCoordinates({x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),this.getBounds=function(){return{minX:Math.min(s,a),minY:Math.min(l,c),maxX:Math.max(s,a),maxY:Math.max(l,c)}},this.pointOnPath=function(t,e){return 0!==t||e?1!==t||e?i.pointOnLine({x:s,y:l},{x:a,y:c},e?t>0?t:n+t:t*n):{x:a,y:c}:{x:s,y:l}},this.gradientAtPoint=function(t){return o},this.pointAlongPathFrom=function(t,e,n){var o=this.pointOnPath(t,n),r=e<=0?{x:s,y:l}:{x:a,y:c};return e<=0&&Math.abs(e)>1&&(e*=-1),i.pointOnLine(o,r,e)};var d=function(t,e,n){return n>=Math.min(t,e)&&n<=Math.max(t,e)},h=function(t,e,n){return Math.abs(n-t)<Math.abs(n-e)?t:e};this.findClosestPointOnPath=function(t,e){var u={d:1/0,x:null,y:null,l:null,x1:s,x2:a,y1:l,y2:c};if(0===o)u.y=l,u.x=d(s,a,t)?t:h(s,a,t);else if(o===1/0||o===-1/0)u.x=s,u.y=d(l,c,e)?e:h(l,c,e);else{var p=l-o*s,f=(e-r*t-p)/(o-r),m=o*f+p;u.x=d(s,a,f)?f:h(s,a,f),u.y=d(l,c,m)?m:h(l,c,m)}var g=i.lineLength([u.x,u.y],[s,l]);return u.d=i.lineLength([t,e],[u.x,u.y]),u.l=g/n,u};var p=function(t,e,n){return n>e?e<=t&&t<=n:e>=t&&t>=n},f=p;this.lineIntersection=function(t,e,n,r){var u=Math.abs(i.gradient({x:t,y:e},{x:n,y:r})),d=Math.abs(o),h=d===1/0?s:l-d*s,p=[],m=u===1/0?t:e-u*t;if(u!==d)if(u===1/0&&0===d)f(t,s,a)&&f(l,e,r)&&(p=[t,l]);else if(0===u&&d===1/0)f(e,l,c)&&f(s,t,n)&&(p=[s,e]);else{var g,v;u===1/0?f(g=t,s,a)&&f(v=d*t+h,e,r)&&(p=[g,v]):0===u?f(v=e,l,c)&&f(g=(e-h)/d,t,n)&&(p=[g,v]):(v=d*(g=(m-h)/(d-u))+h,f(g,s,a)&&f(v,l,c)&&(p=[g,v]))}return p},this.boxIntersection=function(t,e,n,i){var o=[];return o.push.apply(o,this.lineIntersection(t,e,t+n,e)),o.push.apply(o,this.lineIntersection(t+n,e,t+n,e+i)),o.push.apply(o,this.lineIntersection(t+n,e+i,t,e+i)),o.push.apply(o,this.lineIntersection(t,e+i,t,e)),o},this.boundingBoxIntersection=function(t){return this.boxIntersection(t.x,t.y,t.w,t.h)}},Arc:function(t){e.Segments.AbstractSegment.apply(this,arguments);var n=function(e,n){return i.theta([t.cx,t.cy],[e,n])},o=function(t,e){if(t.anticlockwise){var n=t.startAngle<t.endAngle?t.startAngle+r:t.startAngle;return n-Math.abs(n-t.endAngle)*e}var i=Math.abs((t.endAngle<t.startAngle?t.endAngle+r:t.endAngle)-t.startAngle);return t.startAngle+i*e},r=2*Math.PI;this.radius=t.r,this.anticlockwise=t.ac,this.type="Arc",t.startAngle&&t.endAngle?(this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.x1=t.cx+this.radius*Math.cos(t.startAngle),this.y1=t.cy+this.radius*Math.sin(t.startAngle),this.x2=t.cx+this.radius*Math.cos(t.endAngle),this.y2=t.cy+this.radius*Math.sin(t.endAngle)):(this.startAngle=n(t.x1,t.y1),this.endAngle=n(t.x2,t.y2),this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2),this.endAngle<0&&(this.endAngle+=r),this.startAngle<0&&(this.startAngle+=r);var s=this.endAngle<this.startAngle?this.endAngle+r:this.endAngle;this.sweep=Math.abs(s-this.startAngle),this.anticlockwise&&(this.sweep=r-this.sweep);var a=2*Math.PI*this.radius,l=this.sweep/r,c=a*l;this.getLength=function(){return c},this.getBounds=function(){return{minX:t.cx-t.r,maxX:t.cx+t.r,minY:t.cy-t.r,maxY:t.cy+t.r}};var u=1e-10,d=function(t){var e=Math.floor(t),n=Math.ceil(t);return t-e<u?e:n-t<u?n:t};this.pointOnPath=function(e,n){if(0===e)return{x:this.x1,y:this.y1,theta:this.startAngle};if(1===e)return{x:this.x2,y:this.y2,theta:this.endAngle};n&&(e/=c);var i=o(this,e),r=t.cx+t.r*Math.cos(i),s=t.cy+t.r*Math.sin(i);return{x:d(r),y:d(s),theta:i}},this.gradientAtPoint=function(e,n){var o=this.pointOnPath(e,n),r=i.normal([t.cx,t.cy],[o.x,o.y]);return this.anticlockwise||r!==1/0&&r!==-1/0||(r*=-1),r},this.pointAlongPathFrom=function(e,n,i){var o=this.pointOnPath(e,i),r=n/a*2*Math.PI,s=o.theta+(this.anticlockwise?-1:1)*r;return{x:t.cx+this.radius*Math.cos(s),y:t.cy+this.radius*Math.sin(s)}}},Bezier:function(n){this.curve=[{x:n.x1,y:n.y1},{x:n.cp1x,y:n.cp1y},{x:n.cp2x,y:n.cp2y},{x:n.x2,y:n.y2}];var i=function(t){return t[0].x===t[1].x&&t[0].y===t[1].y},o=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},r=(function(t){var e={x:0,y:0};if(0===t)return this.curve[0];var n=this.curve.length-1;if(1===t)return this.curve[n];var i=this.curve,o=1-t;if(0===n)return this.curve[0];if(1===n)return{x:o*i[0].x+t*i[1].x,y:o*i[0].y+t*i[1].y};if(n<4){var r,s,a,l=o*o,c=t*t,u=0;return 2===n?(i=[i[0],i[1],i[2],e],r=l,s=o*t*2,a=c):3===n&&(r=l*o,s=l*t*3,a=o*c*3,u=t*c),{x:r*i[0].x+s*i[1].x+a*i[2].x+u*i[3].x,y:r*i[0].y+s*i[1].y+a*i[2].y+u*i[3].y}}return e}).bind(this),s=function(t){var e=[];t--;for(var n=0;n<=t;n++)e.push(r(n/t));return e},a=(function(){i(this.curve)&&(this.length=0);var t=s(16);this.length=0;for(var e=0;e<15;e++)this.length+=o(t[e],t[e+1])}).bind(this);e.Segments.AbstractSegment.apply(this,arguments),this.bounds={minX:Math.min(n.x1,n.x2,n.cp1x,n.cp2x),minY:Math.min(n.y1,n.y2,n.cp1y,n.cp2y),maxX:Math.max(n.x1,n.x2,n.cp1x,n.cp2x),maxY:Math.max(n.y1,n.y2,n.cp1y,n.cp2y)},this.type="Bezier",a();var l=function(e,n,i){return i&&(n=t.jsBezier.locationAlongCurveFrom(e,n>0?0:1,n)),n};this.pointOnPath=function(e,n){return e=l(this.curve,e,n),t.jsBezier.pointOnCurve(this.curve,e)},this.gradientAtPoint=function(e,n){return e=l(this.curve,e,n),t.jsBezier.gradientAtPoint(this.curve,e)},this.pointAlongPathFrom=function(e,n,i){return e=l(this.curve,e,i),t.jsBezier.pointAlongCurveFrom(this.curve,e,n)},this.getLength=function(){return this.length},this.getBounds=function(){return this.bounds},this.findClosestPointOnPath=function(e,n){var i=t.jsBezier.nearestPointOnCurve({x:e,y:n},this.curve);return{d:Math.sqrt(Math.pow(i.point.x-e,2)+Math.pow(i.point.y-n,2)),x:i.point.x,y:i.point.y,l:1-i.location,s:this}},this.lineIntersection=function(e,n,i,o){return t.jsBezier.lineIntersection(e,n,i,o,this.curve)}}},e.SegmentRenderer={getPath:function(t,e){return{Straight:function(e){var n=t.getCoordinates();return(e?"M "+n.x1+" "+n.y1+" ":"")+"L "+n.x2+" "+n.y2},Bezier:function(e){var n=t.params;return(e?"M "+n.x2+" "+n.y2+" ":"")+"C "+n.cp2x+" "+n.cp2y+" "+n.cp1x+" "+n.cp1y+" "+n.x1+" "+n.y1},Arc:function(e){var n=t.sweep>Math.PI?1:0;return(e?"M"+t.x1+" "+t.y1+" ":"")+"A "+t.radius+" "+t.params.r+" 0 "+n+","+(t.anticlockwise?0:1)+" "+t.x2+" "+t.y2}}[t.type](e)}};var o=function(){this.resetBounds=function(){this.bounds={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}},this.resetBounds()};e.Connectors.AbstractConnector=function(t){o.apply(this,arguments);var r=[],s=0,a=[],l=[],c=t.stub||0,u=n.isArray(c)?c[0]:c,d=n.isArray(c)?c[1]:c,h=t.gap||0,p=n.isArray(h)?h[0]:h,f=n.isArray(h)?h[1]:h,m=null,g=null;this.getPathData=function(){for(var t="",n=0;n<r.length;n++)t+=e.SegmentRenderer.getPath(r[n],0===n),t+=" ";return t},this.findSegmentForPoint=function(t,e){for(var n={d:1/0,s:null,x:null,y:null,l:null},i=0;i<r.length;i++){var o=r[i].findClosestPointOnPath(t,e);o.d<n.d&&(n.d=o.d,n.l=o.l,n.x=o.x,n.y=o.y,n.s=r[i],n.x1=o.x1,n.x2=o.x2,n.y1=o.y1,n.y2=o.y2,n.index=i,n.connectorLocation=a[i][0]+o.l*(a[i][1]-a[i][0]))}return n},this.lineIntersection=function(t,e,n,i){for(var o=[],s=0;s<r.length;s++)o.push.apply(o,r[s].lineIntersection(t,e,n,i));return o},this.boxIntersection=function(t,e,n,i){for(var o=[],s=0;s<r.length;s++)o.push.apply(o,r[s].boxIntersection(t,e,n,i));return o},this.boundingBoxIntersection=function(t){for(var e=[],n=0;n<r.length;n++)e.push.apply(e,r[n].boundingBoxIntersection(t));return e};var v=function(){for(var t=0,e=0;e<r.length;e++){var n=r[e].getLength();l[e]=n/s,a[e]=[t,t+=n/s]}},b=function(t,e){var n,i,o;if(e&&(t=t>0?t/s:(s+t)/s),1===t)n=r.length-1,o=1;else if(0===t)o=0,n=0;else if(t>=.5){for(n=0,o=0,i=a.length-1;i>-1;i--)if(a[i][1]>=t&&a[i][0]<=t){n=i,o=(t-a[i][0])/l[i];break}}else for(n=a.length-1,o=1,i=0;i<a.length;i++)if(a[i][1]>=t){n=i,o=(t-a[i][0])/l[i];break}return{segment:r[n],proportion:o,index:n}},y=function(t,n,i){if(i.x1!==i.x2||i.y1!==i.y2){var o=new e.Segments[n](i);r.push(o),s+=o.getLength(),t.updateBounds(o)}},_=function(){s=r.length=a.length=l.length=0};this.setSegments=function(t){m=[],s=0;for(var e=0;e<t.length;e++)m.push(t[e]),s+=t[e].getLength()},this.getLength=function(){return s};var P=function(t){this.strokeWidth=t.strokeWidth;var e=i.quadrant(t.sourcePos,t.targetPos),n=t.targetPos[0]<t.sourcePos[0],o=t.targetPos[1]<t.sourcePos[1],r=t.strokeWidth||1,s=t.sourceEndpoint.anchor.getOrientation(t.sourceEndpoint),a=t.targetEndpoint.anchor.getOrientation(t.targetEndpoint),l=n?t.targetPos[0]:t.sourcePos[0],c=o?t.targetPos[1]:t.sourcePos[1],h=Math.abs(t.targetPos[0]-t.sourcePos[0]),m=Math.abs(t.targetPos[1]-t.sourcePos[1]);if(0===s[0]&&0===s[1]||0===a[0]&&0===a[1]){var g=h>m?0:1,v=[1,0][g];a=[],(s=[])[g]=t.sourcePos[g]>t.targetPos[g]?-1:1,a[g]=t.sourcePos[g]>t.targetPos[g]?1:-1,s[v]=0,a[v]=0}var b=n?h+p*s[0]:p*s[0],y=o?m+p*s[1]:p*s[1],_=n?f*a[0]:h+f*a[0],P=o?f*a[1]:m+f*a[1],C=s[0]*a[0]+s[1]*a[1],x={sx:b,sy:y,tx:_,ty:P,lw:r,xSpan:Math.abs(_-b),ySpan:Math.abs(P-y),mx:(b+_)/2,my:(y+P)/2,so:s,to:a,x:l,y:c,w:h,h:m,segment:e,startStubX:b+s[0]*u,startStubY:y+s[1]*u,endStubX:_+a[0]*d,endStubY:P+a[1]*d,isXGreaterThanStubTimes2:Math.abs(b-_)>u+d,isYGreaterThanStubTimes2:Math.abs(y-P)>u+d,opposite:-1===C,perpendicular:0===C,orthogonal:1===C,sourceAxis:0===s[0]?"y":"x",points:[l,c,h,m,b,y,_,P],stubs:[u,d]};return x.anchorOrientation=x.opposite?"opposite":x.orthogonal?"orthogonal":"perpendicular",x};return this.getSegments=function(){return r},this.updateBounds=function(t){var e=t.getBounds();this.bounds.minX=Math.min(this.bounds.minX,e.minX),this.bounds.maxX=Math.max(this.bounds.maxX,e.maxX),this.bounds.minY=Math.min(this.bounds.minY,e.minY),this.bounds.maxY=Math.max(this.bounds.maxY,e.maxY)},this.pointOnPath=function(t,e){var n=b(t,e);return n.segment&&n.segment.pointOnPath(n.proportion,!1)||[0,0]},this.gradientAtPoint=function(t,e){var n=b(t,e);return n.segment&&n.segment.gradientAtPoint(n.proportion,!1)||0},this.pointAlongPathFrom=function(t,e,n){var i=b(t,n);return i.segment&&i.segment.pointAlongPathFrom(i.proportion,e,!1)||[0,0]},this.compute=function(t){g=P.call(this,t),_(),this._compute(g,t),this.x=g.points[0],this.y=g.points[1],this.w=g.points[2],this.h=g.points[3],this.segment=g.segment,v()},{addSegment:y,prepareCompute:P,sourceStub:u,targetStub:d,maxStub:Math.max(u,d),sourceGap:p,targetGap:f,maxGap:Math.max(p,f)}},n.extend(e.Connectors.AbstractConnector,o),e.Endpoints.AbstractEndpoint=function(t){o.apply(this,arguments);var e=this.compute=function(t,e,n,i){var o=this._compute.apply(this,arguments);return this.x=o[0],this.y=o[1],this.w=o[2],this.h=o[3],this.bounds.minX=this.x,this.bounds.minY=this.y,this.bounds.maxX=this.x+this.w,this.bounds.maxY=this.y+this.h,o};return{compute:e,cssClass:t.cssClass}},n.extend(e.Endpoints.AbstractEndpoint,o),e.Endpoints.Dot=function(t){this.type="Dot",e.Endpoints.AbstractEndpoint.apply(this,arguments),this.radius=(t=t||{}).radius||10,this.defaultOffset=.5*this.radius,this.defaultInnerRadius=this.radius/3,this._compute=function(t,e,n,i){this.radius=n.radius||this.radius;var o=t[0]-this.radius,r=t[1]-this.radius,s=2*this.radius,a=2*this.radius;if(n.stroke){var l=n.strokeWidth||1;o-=l,r-=l,s+=2*l,a+=2*l}return[o,r,s,a,this.radius]}},n.extend(e.Endpoints.Dot,e.Endpoints.AbstractEndpoint),e.Endpoints.Rectangle=function(t){this.type="Rectangle",e.Endpoints.AbstractEndpoint.apply(this,arguments),this.width=(t=t||{}).width||20,this.height=t.height||20,this._compute=function(t,e,n,i){var o=n.width||this.width,r=n.height||this.height;return[t[0]-o/2,t[1]-r/2,o,r]}},n.extend(e.Endpoints.Rectangle,e.Endpoints.AbstractEndpoint);var r=function(t){e.jsPlumbUIComponent.apply(this,arguments),this._jsPlumb.displayElements=[]};n.extend(r,e.jsPlumbUIComponent,{getDisplayElements:function(){return this._jsPlumb.displayElements},appendDisplayElement:function(t){this._jsPlumb.displayElements.push(t)}}),e.Endpoints.Image=function(i){this.type="Image",r.apply(this,arguments),e.Endpoints.AbstractEndpoint.apply(this,arguments);var o=i.onload,s=i.src||i.url,a=i.cssClass?" "+i.cssClass:"";this._jsPlumb.img=new Image,this._jsPlumb.ready=!1,this._jsPlumb.initialized=!1,this._jsPlumb.deleted=!1,this._jsPlumb.widthToUse=i.width,this._jsPlumb.heightToUse=i.height,this._jsPlumb.endpoint=i.endpoint,this._jsPlumb.img.onload=(function(){null!=this._jsPlumb&&(this._jsPlumb.ready=!0,this._jsPlumb.widthToUse=this._jsPlumb.widthToUse||this._jsPlumb.img.width,this._jsPlumb.heightToUse=this._jsPlumb.heightToUse||this._jsPlumb.img.height,o&&o(this))}).bind(this),this._jsPlumb.endpoint.setImage=(function(t,e){o=e,this._jsPlumb.img.src=t.constructor===String?t:t.src,null!=this.canvas&&this.canvas.setAttribute("src",this._jsPlumb.img.src)}).bind(this),this._jsPlumb.endpoint.setImage(s,o),this._compute=function(t,e,n,i){return this.anchorPoint=t,this._jsPlumb.ready?[t[0]-this._jsPlumb.widthToUse/2,t[1]-this._jsPlumb.heightToUse/2,this._jsPlumb.widthToUse,this._jsPlumb.heightToUse]:[0,0,0,0]},this.canvas=e.createElement("img",{position:"absolute",margin:0,padding:0,outline:0},this._jsPlumb.instance.endpointClass+a),this._jsPlumb.widthToUse&&this.canvas.setAttribute("width",this._jsPlumb.widthToUse),this._jsPlumb.heightToUse&&this.canvas.setAttribute("height",this._jsPlumb.heightToUse),this._jsPlumb.instance.appendElement(this.canvas),this.actuallyPaint=function(t,e,i){this._jsPlumb.deleted||(this._jsPlumb.initialized||(this.canvas.setAttribute("src",this._jsPlumb.img.src),this.appendDisplayElement(this.canvas),this._jsPlumb.initialized=!0),n.sizeElement(this.canvas,this.anchorPoint[0]-this._jsPlumb.widthToUse/2,this.anchorPoint[1]-this._jsPlumb.heightToUse/2,this._jsPlumb.widthToUse,this._jsPlumb.heightToUse))},this.paint=function(e,n){null!=this._jsPlumb&&(this._jsPlumb.ready?this.actuallyPaint(e,n):t.setTimeout((function(){this.paint(e,n)}).bind(this),200))}},n.extend(e.Endpoints.Image,[r,e.Endpoints.AbstractEndpoint],{cleanup:function(t){t&&(this._jsPlumb.deleted=!0,this.canvas&&this.canvas.parentNode.removeChild(this.canvas),this.canvas=null)}}),e.Endpoints.Blank=function(t){e.Endpoints.AbstractEndpoint.apply(this,arguments),this.type="Blank",r.apply(this,arguments),this._compute=function(t,e,n,i){return[t[0],t[1],10,0]};var i=t.cssClass?" "+t.cssClass:"";this.canvas=e.createElement("div",{display:"block",width:"1px",height:"1px",background:"transparent",position:"absolute"},this._jsPlumb.instance.endpointClass+i),this._jsPlumb.instance.appendElement(this.canvas),this.paint=function(t,e){n.sizeElement(this.canvas,this.x,this.y,this.w,this.h)}},n.extend(e.Endpoints.Blank,[e.Endpoints.AbstractEndpoint,r],{cleanup:function(){this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}}),e.Endpoints.Triangle=function(t){this.type="Triangle",e.Endpoints.AbstractEndpoint.apply(this,arguments);var n=this;(t=t||{}).width=t.width||55,t.height=t.height||55,this.width=t.width,this.height=t.height,this._compute=function(t,e,i,o){var r=i.width||n.width,s=i.height||n.height;return[t[0]-r/2,t[1]-s/2,r,s]}};var s=e.Overlays.AbstractOverlay=function(t){this.visible=!0,this.isAppendedAtTopLevel=!0,this.component=t.component,this.loc=null==t.location?.5:t.location,this.endpointLoc=null==t.endpointLocation?[.5,.5]:t.endpointLocation,this.visible=!1!==t.visible};s.prototype={cleanup:function(t){t&&(this.component=null,this.canvas=null,this.endpointLoc=null)},reattach:function(t,e){},setVisible:function(t){this.visible=t,this.component.repaint()},isVisible:function(){return this.visible},hide:function(){this.setVisible(!1)},show:function(){this.setVisible(!0)},incrementLocation:function(t){this.loc+=t,this.component.repaint()},setLocation:function(t){this.loc=t,this.component.repaint()},getLocation:function(){return this.loc},updateFrom:function(){}},e.Overlays.Arrow=function(t){this.type="Arrow",s.apply(this,arguments),this.isAppendedAtTopLevel=!1;var o=this;this.length=(t=t||{}).length||20,this.width=t.width||20,this.id=t.id,this.direction=(t.direction||1)<0?-1:1;var r=t.paintStyle||{"stroke-width":1},a=t.foldback||.623;this.computeMaxSize=function(){return 1.5*o.width},this.elementCreated=function(n,i){if(this.path=n,t.events)for(var o in t.events)e.on(n,o,t.events[o])},this.draw=function(t,e){var o,s,l,c;if(t.pointAlongPathFrom){if(n.isString(this.loc)||this.loc>1||this.loc<0){var u=parseInt(this.loc,10),d=this.loc<0?1:0;o=t.pointAlongPathFrom(d,u,!1),s=t.pointAlongPathFrom(d,u-this.direction*this.length/2,!1),l=i.pointOnLine(o,s,this.length)}else if(1===this.loc){if(o=t.pointOnPath(this.loc),s=t.pointAlongPathFrom(this.loc,-this.length),l=i.pointOnLine(o,s,this.length),-1===this.direction){var h=l;l=o,o=h}}else if(0===this.loc){if(l=t.pointOnPath(this.loc),s=t.pointAlongPathFrom(this.loc,this.length),o=i.pointOnLine(l,s,this.length),-1===this.direction){var p=l;l=o,o=p}}else o=t.pointAlongPathFrom(this.loc,this.direction*this.length/2),s=t.pointOnPath(this.loc),l=i.pointOnLine(o,s,this.length);return{component:t,d:{hxy:o,tail:c=i.perpendicularLineTo(o,l,this.width),cxy:i.pointOnLine(o,l,a*this.length)},"stroke-width":r.strokeWidth||e.strokeWidth,stroke:r.stroke||e.stroke,fill:r.fill||e.stroke,minX:Math.min(o.x,c[0].x,c[1].x),maxX:Math.max(o.x,c[0].x,c[1].x),minY:Math.min(o.y,c[0].y,c[1].y),maxY:Math.max(o.y,c[0].y,c[1].y)}}return{component:t,minX:0,maxX:0,minY:0,maxY:0}}},n.extend(e.Overlays.Arrow,s,{updateFrom:function(t){this.length=t.length||this.length,this.width=t.width||this.width,this.direction=null!=t.direction?t.direction:this.direction,this.foldback=t.foldback||this.foldback},cleanup:function(){this.path&&this.path.parentNode&&this.path.parentNode.removeChild(this.path)}}),e.Overlays.PlainArrow=function(t){var n=e.extend(t=t||{},{foldback:1});e.Overlays.Arrow.call(this,n),this.type="PlainArrow"},n.extend(e.Overlays.PlainArrow,e.Overlays.Arrow),e.Overlays.Diamond=function(t){var n=e.extend(t=t||{},{length:(t.length||40)/2,foldback:2});e.Overlays.Arrow.call(this,n),this.type="Diamond"},n.extend(e.Overlays.Diamond,e.Overlays.Arrow);var a=function(t,e){return(null==t._jsPlumb.cachedDimensions||e)&&(t._jsPlumb.cachedDimensions=t.getDimensions()),t._jsPlumb.cachedDimensions},l=function(t){e.jsPlumbUIComponent.apply(this,arguments),s.apply(this,arguments);var i=this.fire;this.fire=function(){i.apply(this,arguments),this.component&&this.component.fire.apply(this.component,arguments)},this.detached=!1,this.id=t.id,this._jsPlumb.div=null,this._jsPlumb.initialised=!1,this._jsPlumb.component=t.component,this._jsPlumb.cachedDimensions=null,this._jsPlumb.create=t.create,this._jsPlumb.initiallyInvisible=!1===t.visible,this.getElement=function(){if(null==this._jsPlumb.div){var n=this._jsPlumb.div=e.getElement(this._jsPlumb.create(this._jsPlumb.component));n.style.position="absolute",jsPlumb.addClass(n,this._jsPlumb.instance.overlayClass+" "+(this.cssClass?this.cssClass:t.cssClass?t.cssClass:"")),this._jsPlumb.instance.appendElement(n),this._jsPlumb.instance.getId(n),this.canvas=n;var i="translate(-50%, -50%)";n.style.webkitTransform=i,n.style.mozTransform=i,n.style.msTransform=i,n.style.oTransform=i,n.style.transform=i,n._jsPlumb=this,!1===t.visible&&(n.style.display="none")}return this._jsPlumb.div},this.draw=function(t,e,i){var o=a(this);if(null!=o&&2===o.length){var r={x:0,y:0};if(i)r={x:i[0],y:i[1]};else if(t.pointOnPath){var s=this.loc,l=!1;(n.isString(this.loc)||this.loc<0||this.loc>1)&&(s=parseInt(this.loc,10),l=!0),r=t.pointOnPath(s,l)}else{var c=this.loc.constructor===Array?this.loc:this.endpointLoc;r={x:c[0]*t.w,y:c[1]*t.h}}var u=r.x-o[0]/2,d=r.y-o[1]/2;return{component:t,d:{minx:u,miny:d,td:o,cxy:r},minX:u,maxX:u+o[0],minY:d,maxY:d+o[1]}}return{minX:0,maxX:0,minY:0,maxY:0}}};n.extend(l,[e.jsPlumbUIComponent,s],{getDimensions:function(){return[1,1]},setVisible:function(t){this._jsPlumb.div&&(this._jsPlumb.div.style.display=t?"block":"none",t&&this._jsPlumb.initiallyInvisible&&(a(this,!0),this.component.repaint(),this._jsPlumb.initiallyInvisible=!1))},clearCachedDimensions:function(){this._jsPlumb.cachedDimensions=null},cleanup:function(t){t?null!=this._jsPlumb.div&&(this._jsPlumb.div._jsPlumb=null,this._jsPlumb.instance.removeElement(this._jsPlumb.div)):(this._jsPlumb&&this._jsPlumb.div&&this._jsPlumb.div.parentNode&&this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div),this.detached=!0)},reattach:function(t,e){null!=this._jsPlumb.div&&t.getContainer().appendChild(this._jsPlumb.div),this.detached=!1},computeMaxSize:function(){var t=a(this);return Math.max(t[0],t[1])},paint:function(t,e){this._jsPlumb.initialised||(this.getElement(),t.component.appendDisplayElement(this._jsPlumb.div),this._jsPlumb.initialised=!0,this.detached&&this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div)),this._jsPlumb.div.style.left=t.component.x+t.d.minx+"px",this._jsPlumb.div.style.top=t.component.y+t.d.miny+"px"}}),e.Overlays.Custom=function(t){this.type="Custom",l.apply(this,arguments)},n.extend(e.Overlays.Custom,l),e.Overlays.GuideLines=function(){var t=this;t.length=50,t.strokeWidth=5,this.type="GuideLines",s.apply(this,arguments),e.jsPlumbUIComponent.apply(this,arguments),this.draw=function(e,n){var o=e.pointAlongPathFrom(t.loc,t.length/2),r=e.pointOnPath(t.loc),s=i.pointOnLine(o,r,t.length),a=i.perpendicularLineTo(o,s,40),l=i.perpendicularLineTo(s,o,20);return{connector:e,head:o,tail:s,headLine:l,tailLine:a,minX:Math.min(o.x,s.x,l[0].x,l[1].x),minY:Math.min(o.y,s.y,l[0].y,l[1].y),maxX:Math.max(o.x,s.x,l[0].x,l[1].x),maxY:Math.max(o.y,s.y,l[0].y,l[1].y)}}},e.Overlays.Label=function(t){this.labelStyle=t.labelStyle,this.cssClass=null!=this.labelStyle?this.labelStyle.cssClass:null;var n=e.extend({create:function(){return e.createElement("div")}},t);if(e.Overlays.Custom.call(this,n),this.type="Label",this.label=t.label||"",this.labelText=null,this.labelStyle){var i=this.getElement();this.labelStyle.font=this.labelStyle.font||"12px sans-serif",i.style.font=this.labelStyle.font,i.style.color=this.labelStyle.color||"black",this.labelStyle.fill&&(i.style.background=this.labelStyle.fill),this.labelStyle.borderWidth>0&&(i.style.border=this.labelStyle.borderWidth+"px solid "+(this.labelStyle.borderStyle?this.labelStyle.borderStyle:"black")),this.labelStyle.padding&&(i.style.padding=this.labelStyle.padding)}},n.extend(e.Overlays.Label,e.Overlays.Custom,{cleanup:function(t){t&&(this.div=null,this.label=null,this.labelText=null,this.cssClass=null,this.labelStyle=null)},getLabel:function(){return this.label},setLabel:function(t){this.label=t,this.labelText=null,this.clearCachedDimensions(),this.update(),this.component.repaint()},getDimensions:function(){return this.update(),l.prototype.getDimensions.apply(this,arguments)},update:function(){if("function"==typeof this.label){var t=this.label(this);this.getElement().innerHTML=t.replace(/\r\n/g,"<br/>")}else null==this.labelText&&(this.labelText=this.label,this.getElement().innerHTML=this.labelText.replace(/\r\n/g,"<br/>"))},updateFrom:function(t){null!=t.label&&this.setLabel(t.label)}})}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this,e=t.jsPlumbUtil,n=t.jsPlumbInstance,i="_jsPlumbGroup",o=function(t){var n={},o={},r={},s=this;function a(e,n){for(var i=t.getContainer();;){if(null==e||e===i)return!1;if(e===n)return!0;e=e.parentNode}}function l(e,n){for(var i=e.getEl().querySelectorAll(".jtk-managed"),o=0;o<i.length;o++)t[n?"show":"hide"](i[o],!0)}t.bind("connection",function(n){var i=t.getGroupFor(n.source),s=t.getGroupFor(n.target);null!=i&&null!=s&&i===s?(o[n.connection.id]=i,r[n.connection.id]=i):(null!=i&&(e.suggest(i.connections.source,n.connection),o[n.connection.id]=i),null!=s&&(e.suggest(s.connections.target,n.connection),r[n.connection.id]=s))}),t.bind("internal.connectionDetached",function(t){!function(t){delete t.proxies;var n,i=o[t.id];null!=i&&(e.removeWithFunction(i.connections.source,n=function(e){return e.id===t.id}),e.removeWithFunction(i.connections.target,n),delete o[t.id]),null!=(i=r[t.id])&&(e.removeWithFunction(i.connections.source,n=function(e){return e.id===t.id}),e.removeWithFunction(i.connections.target,n),delete r[t.id])}(t.connection)}),t.bind("connectionMoved",function(t){var e=(0===t.index?o:r)[t.connection.id];if(e){var n=e.connections[0===t.index?"source":"target"],i=n.indexOf(t.connection);-1!==i&&n.splice(i,1)}}),this.addGroup=function(e){t.addClass(e.getEl(),"jtk-group-expanded"),n[e.id]=e,e.manager=this,d(e),t.fire("group:add",{group:e})},this.addToGroup=function(e,n,i){if(e=this.getGroup(e)){var o=e.getEl();if(n._isJsPlumbGroup)return;var r=n._jsPlumbGroup;if(r!==e){t.removeFromDragSelection(n);var a=t.getOffset(n,!0),l=t.getOffset(e.collapsed?o:e.getDragArea(),!0);null!=r&&(r.remove(n,!1,i,!1,e),s.updateConnectionsForGroup(r)),e.add(n,i);var d=function(t,n){var i=0===n?1:0;t.each(function(t){t.setVisible(!1),t.endpoints[i].element._jsPlumbGroup===e?(t.endpoints[i].setVisible(!1),u(t,i,e)):(t.endpoints[n].setVisible(!1),c(t,n,e))})};e.collapsed&&(d(t.select({source:n}),0),d(t.select({target:n}),1));var h=t.getId(n);t.dragManager.setParent(n,h,o,t.getId(o),a);var p={left:a.left-l.left,top:a.top-l.top};if(t.setPosition(n,p),t.dragManager.revalidateParent(n,h,a),s.updateConnectionsForGroup(e),t.revalidate(h),!i){var f={group:e,el:n,pos:p};r&&(f.sourceGroup=r),t.fire("group:addMember",f)}}}},this.removeFromGroup=function(t,e,n){if(t=this.getGroup(t)){if(t.collapsed){var i=function(n,i){for(var o=0;o<n.length;o++){var r=n[o];if(r.proxies)for(var s=0;s<r.proxies.length;s++)if(null!=r.proxies[s]){var l=r.proxies[s].originalEp.element;(l===e||a(l,e))&&u(r,i,t)}}};i(t.connections.source.slice(),0),i(t.connections.target.slice(),1)}t.remove(e,null,n)}},this.getGroup=function(t){var i=t;if(e.isString(t)&&null==(i=n[t]))throw new TypeError("No such group ["+t+"]");return i},this.getGroups=function(){var t=[];for(var e in n)t.push(n[e]);return t},this.removeGroup=function(e,i,o,r){e=this.getGroup(e),this.expandGroup(e,!0);var s=e[i?"removeAll":"orphanAll"](o,r);return t.remove(e.getEl()),delete n[e.id],delete t._groups[e.id],t.fire("group:remove",{group:e}),s},this.removeAllGroups=function(t,e,i){for(var o in n)this.removeGroup(n[o],t,e,i)};var c=function(e,n,o){var r=e.endpoints[0===n?1:0].element;if(!r[i]||r[i].shouldProxy()||!r[i].collapsed){var s=o.getEl(),a=t.getId(s);t.proxyConnection(e,n,s,a,function(t,e){return o.getEndpoint(t,e)},function(t,e){return o.getAnchor(t,e)})}};this.collapseGroup=function(e){if(null!=(e=this.getGroup(e))&&!e.collapsed){var n=e.getEl();if(l(e,!1),e.shouldProxy()){var i=function(t,n){for(var i=0;i<t.length;i++)c(t[i],n,e)};i(e.connections.source,0),i(e.connections.target,1)}e.collapsed=!0,t.removeClass(n,"jtk-group-expanded"),t.addClass(n,"jtk-group-collapsed"),t.revalidate(n),t.fire("group:collapse",{group:e})}};var u=function(e,n,i){t.unproxyConnection(e,n,t.getId(i.getEl()))};function d(e){for(var n=e.getMembers().slice(),i=[],s=0;s<n.length;s++)Array.prototype.push.apply(i,n[s].querySelectorAll(".jtk-managed"));Array.prototype.push.apply(n,i);var a=t.getConnections({source:n,scope:"*"},!0),l=t.getConnections({target:n,scope:"*"},!0),c={};e.connections.source.length=0,e.connections.target.length=0;var u=function(n){for(var i=0;i<n.length;i++)if(!c[n[i].id]){c[n[i].id]=!0;var s=t.getGroupFor(n[i].source),a=t.getGroupFor(n[i].target);s===e?(a!==e&&e.connections.source.push(n[i]),o[n[i].id]=e):a===e&&(e.connections.target.push(n[i]),r[n[i].id]=e)}};u(a),u(l)}this.expandGroup=function(e,n){if(null!=(e=this.getGroup(e))&&e.collapsed){var i=e.getEl();if(l(e,!0),e.shouldProxy()){var o=function(t,n){for(var i=0;i<t.length;i++)u(t[i],n,e)};o(e.connections.source,0),o(e.connections.target,1)}e.collapsed=!1,t.addClass(i,"jtk-group-expanded"),t.removeClass(i,"jtk-group-collapsed"),t.revalidate(i),this.repaintGroup(e),n||t.fire("group:expand",{group:e})}},this.repaintGroup=function(e){for(var n=(e=this.getGroup(e)).getMembers(),i=0;i<n.length;i++)t.revalidate(n[i])},this.updateConnectionsForGroup=d,this.refreshAllGroups=function(){for(var e in n)d(n[e]),t.dragManager.updateOffsets(t.getId(n[e].getEl()))}},r=function(n,o){var r=this,s=o.el;this.getEl=function(){return s},this.id=o.id||e.uuid(),s._isJsPlumbGroup=!0;var a=this.getDragArea=function(){var t=n.getSelector(s,"[jtk-group-content]");return t&&t.length>0?t[0]:s},l=!0===o.ghost,c=l||!0===o.constrain,u=!1!==o.revert,d=!0===o.orphan,h=!0===o.prune,p=!0===o.dropOverride,f=!1!==o.proxied,m=[];if(this.connections={source:[],target:[],internal:[]},this.getAnchor=function(t,e){return o.anchor||"Continuous"},this.getEndpoint=function(t,e){return o.endpoint||["Dot",{radius:10}]},this.collapsed=!1,!1!==o.draggable){var g={drag:function(){for(var t=0;t<m.length;t++)n.draw(m[t])},stop:function(t){n.fire("groupDragStop",jsPlumb.extend(t,{group:r}))},scope:"_jsPlumbGroupDrag"};o.dragOptions&&t.jsPlumb.extend(g,o.dragOptions),n.draggable(o.el,g)}!1!==o.droppable&&n.droppable(o.el,{drop:function(t){var e=t.drag.el;if(!e._isJsPlumbGroup){var i=e._jsPlumbGroup;if(i!==r){if(null!=i&&i.overrideDrop(e,r))return;n.getGroupManager().addToGroup(r,e,!1)}}}});var v=function(t,e){for(var n=null==t.nodeType?t:[t],i=0;i<n.length;i++)e(n[i])};function b(t,e){var i=function(t){return t.offsetParent}(t),o=n.getSize(i),r=n.getSize(t),s=e[0],a=e[1];return s+r[0]>0&&s<o[0]&&a+r[1]>0&&a<o[1]}function y(t){var e=n.getId(t),i=n.getOffset(t);return t.parentNode.removeChild(t),n.getContainer().appendChild(t),n.setPosition(t,i),C(t),n.dragManager.clearParent(t,e),[e,i]}function _(t){var e=[];function i(t,e,i){var o=null;if(!b(t,[e,i])){var r=t._jsPlumbGroup;h?n.remove(t):o=y(t),r.remove(t)}return o}for(var o=0;o<t.selection.length;o++)e.push(i(t.selection[o][0],t.selection[o][1].left,t.selection[o][1].top));return 1===e.length?e[0]:e}function P(t){var e=n.getId(t);n.revalidate(t),n.dragManager.revalidateParent(t,e)}function C(t){t._katavorioDrag&&((h||d)&&t._katavorioDrag.off("stop",_),h||d||!u||(t._katavorioDrag.off("revert",P),t._katavorioDrag.setRevert(null)))}function x(t){t._katavorioDrag&&((h||d)&&t._katavorioDrag.on("stop",_),c&&t._katavorioDrag.setConstrain(!0),l&&t._katavorioDrag.setUseGhostProxy(!0),h||d||!u||(t._katavorioDrag.on("revert",P),t._katavorioDrag.setRevert(function(t,e){return!b(t,e)})))}this.overrideDrop=function(t,e){return p&&(u||h||d)},this.add=function(t,e){var i=a();v(t,function(t){if(null!=t._jsPlumbGroup){if(t._jsPlumbGroup===r)return;t._jsPlumbGroup.remove(t,!0,e,!1)}t._jsPlumbGroup=r,m.push(t),n.isAlreadyDraggable(t)&&x(t),t.parentNode!==i&&i.appendChild(t)}),n.getGroupManager().updateConnectionsForGroup(r)},this.remove=function(t,i,o,s,a){v(t,function(t){if(t._jsPlumbGroup===r){if(delete t._jsPlumbGroup,e.removeWithFunction(m,function(e){return e===t}),i)try{r.getDragArea().removeChild(t)}catch(l){jsPlumbUtil.log("Could not remove element from Group "+l)}if(C(t),!o){var s={group:r,el:t};a&&(s.targetGroup=a),n.fire("group:removeMember",s)}}}),s||n.getGroupManager().updateConnectionsForGroup(r)},this.removeAll=function(t,e){for(var i=0,o=m.length;i<o;i++){var s=m[0];r.remove(s,t,e,!0),n.remove(s,!0)}m.length=0,n.getGroupManager().updateConnectionsForGroup(r)},this.orphanAll=function(){for(var t={},e=0;e<m.length;e++){var n=y(m[e]);t[n[0]]=n[1]}return m.length=0,t},this.getMembers=function(){return m},s[i]=this,n.bind("elementDraggable",(function(t){t.el._jsPlumbGroup===this&&x(t.el)}).bind(this)),this.shouldProxy=function(){return f},n.getGroupManager().addGroup(this)};n.prototype.addGroup=function(t){var e=this;if(e._groups=e._groups||{},null!=e._groups[t.id])throw new TypeError("cannot create Group ["+t.id+"]; a Group with that ID exists");if(null!=t.el[i])throw new TypeError("cannot create Group ["+t.id+"]; the given element is already a Group");var n=new r(e,t);return e._groups[n.id]=n,t.collapsed&&this.collapseGroup(n),n},n.prototype.addToGroup=function(t,e,n){var i=(function(e){var i=this.getId(e);this.manage(i,e),this.getGroupManager().addToGroup(t,e,n)}).bind(this);if(Array.isArray(e))for(var o=0;o<e.length;o++)i(e[o]);else i(e)},n.prototype.removeFromGroup=function(t,e,n){this.getGroupManager().removeFromGroup(t,e,n),this.getContainer().appendChild(e)},n.prototype.removeGroup=function(t,e,n,i){return this.getGroupManager().removeGroup(t,e,n,i)},n.prototype.removeAllGroups=function(t,e,n){this.getGroupManager().removeAllGroups(t,e,n)},n.prototype.getGroup=function(t){return this.getGroupManager().getGroup(t)},n.prototype.getGroups=function(){return this.getGroupManager().getGroups()},n.prototype.expandGroup=function(t){this.getGroupManager().expandGroup(t)},n.prototype.collapseGroup=function(t){this.getGroupManager().collapseGroup(t)},n.prototype.repaintGroup=function(t){this.getGroupManager().repaintGroup(t)},n.prototype.toggleGroup=function(t){null!=(t=this.getGroupManager().getGroup(t))&&this.getGroupManager()[t.collapsed?"expandGroup":"collapseGroup"](t)},n.prototype.getGroupManager=function(){var t=this._groupManager;return null==t&&(t=this._groupManager=new o(this)),t},n.prototype.removeGroupManager=function(){delete this._groupManager},n.prototype.getGroupFor=function(t){if(t=this.getElement(t)){for(var e=this.getContainer(),n=!1,o=null;!n;)null==t||t===e?n=!0:t[i]?(o=t[i],n=!0):t=t.parentNode;return o}}}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil;t.Connectors.Flowchart=function(e){this.type="Flowchart",(e=e||{}).stub=null==e.stub?30:e.stub;var n,i=t.Connectors.AbstractConnector.apply(this,arguments),o=null==e.midpoint||isNaN(e.midpoint)?.5:e.midpoint,r=!0===e.alwaysRespectStubs,s=null,a=null,l=null!=e.cornerRadius?e.cornerRadius:0,c=function(t){return t<0?-1:0===t?0:1},u=function(t){return[c(t[2]-t[0]),c(t[3]-t[1])]},d=function(t,e,n,i){if(s!==e||a!==n){var o=null==s?i.sx:s,r=null==a?i.sy:a;s=e,a=n,t.push([o,r,e,n,o===e?"v":"h"])}},h=function(t){return Math.sqrt(Math.pow(t[0]-t[2],2)+Math.pow(t[1]-t[3],2))},p=function(t){var e=[];return e.push.apply(e,t),e},f=function(t,e,n){for(var o,r,s,a=null,c=0;c<e.length-1;c++){if(a=a||p(e[c]),o=p(e[c+1]),r=u(a),s=u(o),l>0&&a[4]!==o[4]){var d=Math.min(h(a),h(o)),f=Math.min(l,d/2);a[2]-=r[0]*f,a[3]-=r[1]*f,o[0]+=s[0]*f,o[1]+=s[1]*f;var m=r[1]===s[0]&&1===s[0]||r[1]===s[0]&&0===s[0]&&r[0]!==s[1]||r[1]===s[0]&&-1===s[0],g=(o[1]>a[3]?1:-1)==(o[0]>a[2]?1:-1),v=g&&m||!g&&!m?o[0]:a[2],b=g&&m||!g&&!m?a[3]:o[1];i.addSegment(t,"Straight",{x1:a[0],y1:a[1],x2:a[2],y2:a[3]}),i.addSegment(t,"Arc",{r:f,x1:a[2],y1:a[3],x2:o[0],y2:o[1],cx:v,cy:b,ac:m})}else{var y=a[2]===a[0]?0:a[2]>a[0]?n.lw/2:-n.lw/2,_=a[3]===a[1]?0:a[3]>a[1]?n.lw/2:-n.lw/2;i.addSegment(t,"Straight",{x1:a[0]-y,y1:a[1]-_,x2:a[2]+y,y2:a[3]+_})}a=o}null!=o&&i.addSegment(t,"Straight",{x1:o[0],y1:o[1],x2:o[2],y2:o[3]})};this.midpoint=o,this._compute=function(t,e){n=[],s=null,a=null;var l=function(){return[t.startStubX,t.startStubY,t.endStubX,t.endStubY]},c={perpendicular:l,orthogonal:l,opposite:function(e){var n=t,i="x"===e?0:1;return!r&&{x:function(){return 1===n.so[i]&&(n.startStubX>n.endStubX&&n.tx>n.startStubX||n.sx>n.endStubX&&n.tx>n.sx)||-1===n.so[i]&&(n.startStubX<n.endStubX&&n.tx<n.startStubX||n.sx<n.endStubX&&n.tx<n.sx)},y:function(){return 1===n.so[i]&&(n.startStubY>n.endStubY&&n.ty>n.startStubY||n.sy>n.endStubY&&n.ty>n.sy)||-1===n.so[i]&&(n.startStubY<n.endStubY&&n.ty<n.startStubY||n.sy<n.endStubY&&n.ty<n.sy)}}[e]()?{x:[(t.sx+t.tx)/2,t.startStubY,(t.sx+t.tx)/2,t.endStubY],y:[t.startStubX,(t.sy+t.ty)/2,t.endStubX,(t.sy+t.ty)/2]}[e]:[t.startStubX,t.startStubY,t.endStubX,t.endStubY]}}[t.anchorOrientation](t.sourceAxis),u="x"===t.sourceAxis?0:1,h="x"===t.sourceAxis?1:0,p=c[u],m=c[h],g=c[u+2],v=c[h+2];d(n,c[0],c[1],t);var b=t.startStubX+(t.endStubX-t.startStubX)*o,y=t.startStubY+(t.endStubY-t.startStubY)*o,_={x:[0,1],y:[1,0]},P={perpendicular:function(e){var n={x:[[t.startStubX,t.endStubX],null,[t.endStubX,t.startStubX]],y:[[t.startStubY,t.endStubY],null,[t.endStubY,t.startStubY]]},i={x:[t.startStubY,t.endStubY],y:[t.startStubX,t.endStubX]},o=_[e][1],r=t.so[_[e][0]]+1,s=-1===t.to[o]&&i[e][1]<i[e][0]||1===t.to[o]&&i[e][1]>i[e][0],a=n[e][r][0],l=n[e][r][1],c={x:[[[1,2,3,4],null,[2,1,4,3]],null,[[4,3,2,1],null,[3,4,1,2]]],y:[[[3,2,1,4],null,[2,3,4,1]],null,[[4,1,2,3],null,[1,4,3,2]]]}[e][r][t.to[o]+1];return t.segment===c[3]||t.segment===c[2]&&s?{x:[[b,t.startStubY],[b,t.endStubY]],y:[[t.startStubX,y],[t.endStubX,y]]}[e]:t.segment===c[2]&&l<a?{x:[[t.endStubX,t.startStubY]],y:[[t.startStubX,t.endStubY]]}[e]:t.segment===c[2]&&l>=a||t.segment===c[1]&&!s?{x:[[t.startStubX,y],[t.endStubX,y],[t.endStubX,t.endStubY]],y:[[b,t.startStubY],[b,t.endStubY],[t.endStubX,t.endStubY]]}[e]:t.segment===c[0]||t.segment===c[1]&&s?{x:[[t.startStubX,t.endStubY],[t.endStubX,t.endStubY]],y:[[t.endStubX,t.startStubY],[t.endStubX,t.endStubY]]}[e]:void 0},orthogonal:function(e,n,i,o,r){var s=t,a={x:-1===s.so[0]?Math.min(n,o):Math.max(n,o),y:-1===s.so[1]?Math.min(n,o):Math.max(n,o)}[e];return{x:[[a,i],[a,r],[o,r]],y:[[i,a],[r,a],[r,o]]}[e]},opposite:function(n,o,r,s){var a=t,l={x:"y",y:"x"}[n],c={x:"height",y:"width"}[n],d=a["is"+n.toUpperCase()+"GreaterThanStubTimes2"];if(e.sourceEndpoint.elementId===e.targetEndpoint.elementId){var h=r+(1-e.sourceEndpoint.anchor[l])*e.sourceInfo[c]+i.maxStub;return{x:[[o,h],[s,h]],y:[[h,o],[h,s]]}[n]}return!d||1===a.so[u]&&o>s||-1===a.so[u]&&o<s?{x:[[o,y],[s,y]],y:[[b,o],[b,s]]}[n]:1===a.so[u]&&o<s||-1===a.so[u]&&o>s?{x:[[b,a.sy],[b,a.ty]],y:[[a.sx,y],[a.tx,y]]}[n]:void 0}}[t.anchorOrientation](t.sourceAxis,p,m,g,v);if(P)for(var C=0;C<P.length;C++)d(n,P[C][0],P[C][1],t);d(n,c[2],c[3],t),d(n,t.tx,t.ty,t),f(this,n,t)}},e.extend(t.Connectors.Flowchart,t.Connectors.AbstractConnector)}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil;t.Connectors.AbstractBezierConnector=function(e){var n,i=!1!==(e=e||{}).showLoopback,o=e.margin||5,r=e.orientation&&"clockwise"===e.orientation,s=e.loopbackRadius||25;return this._compute=function(t,e){var a=e.sourcePos,l=e.targetPos,c=Math.abs(a[0]-l[0]),u=Math.abs(a[1]-l[1]);if(i&&e.sourceEndpoint.elementId===e.targetEndpoint.elementId){var d=e.sourcePos[0],h=e.sourcePos[1]-o,p=d,f=h-s,m=p-s,g=f-s;c=2*s,u=2*s,t.points[0]=m,t.points[1]=g,t.points[2]=c,t.points[3]=u,n.addSegment(this,"Arc",{loopback:!0,x1:d-m+4,y1:h-g,startAngle:0,endAngle:2*Math.PI,r:s,ac:!r,x2:d-m-4,y2:h-g,cx:p-m,cy:f-g})}else this._computeBezier(t,e,a,l,c,u)},n=t.Connectors.AbstractConnector.apply(this,arguments)},e.extend(t.Connectors.AbstractBezierConnector,t.Connectors.AbstractConnector);var n=function(e){e=e||{},this.type="Bezier";var n=t.Connectors.AbstractBezierConnector.apply(this,arguments),i=e.curviness||150,o=10;this.getCurviness=function(){return i},this._findControlPoint=function(t,e,n,r,s,a,l){var c=[];return a[0]!==l[0]||a[1]===l[1]?(c.push(0===l[0]?n[0]<e[0]?t[0]+o:t[0]-o:t[0]+i*l[0]),c.push(0===l[1]?n[1]<e[1]?t[1]+o:t[1]-o:t[1]+i*a[1])):(c.push(0===a[0]?e[0]<n[0]?t[0]+o:t[0]-o:t[0]-i*a[0]),c.push(0===a[1]?e[1]<n[1]?t[1]+o:t[1]-o:t[1]+i*l[1])),c},this._computeBezier=function(t,e,i,o,r,s){var a,l,c=i[0]<o[0]?r:0,u=i[1]<o[1]?s:0,d=i[0]<o[0]?0:r,h=i[1]<o[1]?0:s;a=this._findControlPoint([c,u],i,o,e.sourceEndpoint,e.targetEndpoint,t.so,t.to),l=this._findControlPoint([d,h],o,i,e.targetEndpoint,e.sourceEndpoint,t.to,t.so),n.addSegment(this,"Bezier",{x1:c,y1:u,x2:d,y2:h,cp1x:a[0],cp1y:a[1],cp2x:l[0],cp2y:l[1]})}};t.Connectors.Bezier=n,e.extend(n,t.Connectors.AbstractBezierConnector)}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil,n=function(t,e,n,i){return t<=n&&i<=e?1:t<=n&&e<=i?2:n<=t&&i>=e?3:4},i=function(t,e,n,i,o,r,s,a,l){return a<=l?[t,e]:1===n?i[3]<=0&&o[3]>=1?[t+(i[2]<.5?-1*r:r),e]:i[2]>=1&&o[2]<=0?[t,e+(i[3]<.5?-1*s:s)]:[t+-1*r,e+-1*s]:2===n?i[3]>=1&&o[3]<=0?[t+(i[2]<.5?-1*r:r),e]:i[2]>=1&&o[2]<=0?[t,e+(i[3]<.5?-1*s:s)]:[t+r,e+-1*s]:3===n?i[3]>=1&&o[3]<=0?[t+(i[2]<.5?-1*r:r),e]:i[2]<=0&&o[2]>=1?[t,e+(i[3]<.5?-1*s:s)]:[t+-1*r,e+-1*s]:4===n?i[3]<=0&&o[3]>=1?[t+(i[2]<.5?-1*r:r),e]:i[2]<=0&&o[2]>=1?[t,e+(i[3]<.5?-1*s:s)]:[t+r,e+-1*s]:void 0},o=function(e){e=e||{},this.type="StateMachine";var o,r=t.Connectors.AbstractBezierConnector.apply(this,arguments),s=e.curviness||10,a=e.margin||5,l=e.proximityLimit||80;this._computeBezier=function(t,e,c,u,d,h){var p=e.sourcePos[0]<e.targetPos[0]?0:d,f=e.sourcePos[1]<e.targetPos[1]?0:h,m=e.sourcePos[0]<e.targetPos[0]?d:0,g=e.sourcePos[1]<e.targetPos[1]?h:0;0===e.sourcePos[2]&&(p-=a),1===e.sourcePos[2]&&(p+=a),0===e.sourcePos[3]&&(f-=a),1===e.sourcePos[3]&&(f+=a),0===e.targetPos[2]&&(m-=a),1===e.targetPos[2]&&(m+=a),0===e.targetPos[3]&&(g-=a),1===e.targetPos[3]&&(g+=a);var v=(p+m)/2,b=(f+g)/2,y=n(p,f,m,g),_=Math.sqrt(Math.pow(m-p,2)+Math.pow(g-f,2));o=i(v,b,y,e.sourcePos,e.targetPos,s,s,_,l),r.addSegment(this,"Bezier",{x1:m,y1:g,x2:p,y2:f,cp1x:o[0],cp1y:o[1],cp2x:o[0],cp2y:o[1]})}};t.Connectors.StateMachine=o,e.extend(o,t.Connectors.AbstractBezierConnector)}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil,n=function(e){this.type="Straight";var n=t.Connectors.AbstractConnector.apply(this,arguments);this._compute=function(t,e){n.addSegment(this,"Straight",{x1:t.sx,y1:t.sy,x2:t.startStubX,y2:t.startStubY}),n.addSegment(this,"Straight",{x1:t.startStubX,y1:t.startStubY,x2:t.endStubX,y2:t.endStubY}),n.addSegment(this,"Straight",{x1:t.endStubX,y1:t.endStubY,x2:t.tx,y2:t.ty})}};t.Connectors.Straight=n,e.extend(n,t.Connectors.AbstractConnector)}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t=this.jsPlumb,e=this.jsPlumbUtil,n={"stroke-linejoin":"stroke-linejoin","stroke-dashoffset":"stroke-dashoffset","stroke-linecap":"stroke-linecap"},i="http://www.w3.org/2000/svg",o=function(t,e){for(var n in e)t.setAttribute(n,""+e[n])},r=function(e,n){return(n=n||{}).version="1.1",n.xmlns=i,t.createElementNS(i,e,null,null,n)},s=function(t){return"position:absolute;left:"+t[0]+"px;top:"+t[1]+"px"},a=function(t){for(var e=t.querySelectorAll(" defs,linearGradient,radialGradient"),n=0;n<e.length;n++)e[n].parentNode.removeChild(e[n])},l=function(t,e,i,o,s){if(e.setAttribute("fill",i.fill?i.fill:"none"),e.setAttribute("stroke",i.stroke?i.stroke:"none"),i.gradient?function(t,e,n,i,o){var s,l="jsplumb_gradient_"+o._jsPlumb.instance.idstamp();a(t),s=n.gradient.offset?r("radialGradient",{id:l}):r("linearGradient",{id:l,gradientUnits:"userSpaceOnUse"});var c=r("defs");t.appendChild(c),c.appendChild(s);for(var u=0;u<n.gradient.stops.length;u++){var d=n.gradient.stops[1===o.segment||2===o.segment?u:n.gradient.stops.length-1-u][1],h=r("stop",{offset:Math.floor(100*n.gradient.stops[u][0])+"%","stop-color":d});s.appendChild(h)}e.setAttribute(n.stroke?"stroke":"fill","url(#"+l+")")}(t,e,i,0,s):(a(t),e.setAttribute("style","")),i.strokeWidth&&e.setAttribute("stroke-width",i.strokeWidth),i.dashstyle&&i.strokeWidth&&!i["stroke-dasharray"]){var l=-1===i.dashstyle.indexOf(",")?" ":",",c=i.dashstyle.split(l),u="";c.forEach(function(t){u+=Math.floor(t*i.strokeWidth)+l}),e.setAttribute("stroke-dasharray",u)}else i["stroke-dasharray"]&&e.setAttribute("stroke-dasharray",i["stroke-dasharray"]);for(var d in n)i[d]&&e.setAttribute(n[d],i[d])},c=function(t,e,n){t.childNodes.length>n?t.insertBefore(e,t.childNodes[n]):t.appendChild(e)};e.svg={node:r,attr:o,pos:s};var u=function(n){var i=n.pointerEventsSpec||"all",a={};t.jsPlumbUIComponent.apply(this,n.originalArgs),this.canvas=null,this.path=null,this.svg=null,this.bgCanvas=null;var l=n.cssClass+" "+(n.originalArgs[0].cssClass||"");this.svg=r("svg",{style:"",width:0,height:0,"pointer-events":i,position:"absolute"}),n.useDivWrapper?(this.canvas=t.createElement("div",{position:"absolute"}),e.sizeElement(this.canvas,0,0,1,1),this.canvas.className=l):(o(this.svg,{class:l}),this.canvas=this.svg),n._jsPlumb.appendElement(this.canvas,n.originalArgs[0].parent),n.useDivWrapper&&this.canvas.appendChild(this.svg);var c=[this.canvas];return this.getDisplayElements=function(){return c},this.appendDisplayElement=function(t){c.push(t)},this.paint=function(t,i,r){if(null!=t){var l,c=[this.x,this.y],u=[this.w,this.h];null!=r&&(r.xmin<0&&(c[0]+=r.xmin),r.ymin<0&&(c[1]+=r.ymin),u[0]=r.xmax+(r.xmin<0?-r.xmin:0),u[1]=r.ymax+(r.ymin<0?-r.ymin:0)),n.useDivWrapper?(e.sizeElement(this.canvas,c[0],c[1],u[0]>0?u[0]:1,u[1]>0?u[1]:1),c[0]=0,c[1]=0,l=s([0,0])):l=s([c[0],c[1]]),a.paint.apply(this,arguments),o(this.svg,{style:l,width:u[0]||1,height:u[1]||1})}},{renderer:a}};e.extend(u,t.jsPlumbUIComponent,{cleanup:function(t){t||null==this.typeId?(this.canvas&&(this.canvas._jsPlumb=null),this.svg&&(this.svg._jsPlumb=null),this.bgCanvas&&(this.bgCanvas._jsPlumb=null),this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.bgCanvas&&this.bgCanvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.svg=null,this.canvas=null,this.path=null,this.group=null,this._jsPlumb=null):(this.canvas&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.bgCanvas&&this.bgCanvas.parentNode&&this.bgCanvas.parentNode.removeChild(this.bgCanvas))},reattach:function(t){var e=t.getContainer();this.canvas&&null==this.canvas.parentNode&&e.appendChild(this.canvas),this.bgCanvas&&null==this.bgCanvas.parentNode&&e.appendChild(this.bgCanvas)},setVisible:function(t){this.canvas&&(this.canvas.style.display=t?"block":"none")}}),t.ConnectorRenderers.svg=function(e){var n=this,i=u.apply(this,[{cssClass:e._jsPlumb.connectorClass,originalArgs:arguments,pointerEventsSpec:"none",_jsPlumb:e._jsPlumb}]);i.renderer.paint=function(i,s,a){var u=n.getSegments(),d=[0,0];if(a.xmin<0&&(d[0]=-a.xmin),a.ymin<0&&(d[1]=-a.ymin),u.length>0){var h={d:n.getPathData(),transform:"translate("+d[0]+","+d[1]+")","pointer-events":e["pointer-events"]||"visibleStroke"},p=null;if(i.outlineStroke){var f=i.strokeWidth+2*(i.outlineWidth||1);delete(p=t.extend({},i)).gradient,p.stroke=i.outlineStroke,p.strokeWidth=f,null==n.bgPath?(n.bgPath=r("path",h),t.addClass(n.bgPath,t.connectorOutlineClass),c(n.svg,n.bgPath,0)):o(n.bgPath,h),l(n.svg,n.bgPath,p,0,n)}null==n.path?(n.path=r("path",h),c(n.svg,n.path,i.outlineStroke?1:0)):o(n.path,h),l(n.svg,n.path,i,0,n)}}},e.extend(t.ConnectorRenderers.svg,u);var d=t.SvgEndpoint=function(e){var n=u.apply(this,[{cssClass:e._jsPlumb.endpointClass,originalArgs:arguments,pointerEventsSpec:"all",useDivWrapper:!0,_jsPlumb:e._jsPlumb}]);n.renderer.paint=(function(e){var n=t.extend({},e);n.outlineStroke&&(n.stroke=n.outlineStroke),null==this.node?(this.node=this.makeNode(n),this.svg.appendChild(this.node)):null!=this.updateNode&&this.updateNode(this.node),l(this.svg,this.node,n,0,this),s(this.node)}).bind(this)};e.extend(d,u),t.Endpoints.svg.Dot=function(){t.Endpoints.Dot.apply(this,arguments),d.apply(this,arguments),this.makeNode=function(t){return r("circle",{cx:this.w/2,cy:this.h/2,r:this.radius})},this.updateNode=function(t){o(t,{cx:this.w/2,cy:this.h/2,r:this.radius})}},e.extend(t.Endpoints.svg.Dot,[t.Endpoints.Dot,d]),t.Endpoints.svg.Rectangle=function(){t.Endpoints.Rectangle.apply(this,arguments),d.apply(this,arguments),this.makeNode=function(t){return r("rect",{width:this.w,height:this.h})},this.updateNode=function(t){o(t,{width:this.w,height:this.h})}},e.extend(t.Endpoints.svg.Rectangle,[t.Endpoints.Rectangle,d]),t.Endpoints.svg.Image=t.Endpoints.Image,t.Endpoints.svg.Blank=t.Endpoints.Blank,t.Overlays.svg.Label=t.Overlays.Label,t.Overlays.svg.Custom=t.Overlays.Custom;var h=function(e,n){e.apply(this,n),t.jsPlumbUIComponent.apply(this,n),this.isAppendedAtTopLevel=!1,this.path=null,this.paint=function(t,e){if(t.component.svg&&e){null==this.path&&(this.path=r("path",{"pointer-events":"all"}),t.component.svg.appendChild(this.path),this.elementCreated&&this.elementCreated(this.path,t.component),this.canvas=t.component.svg);var s=n&&1===n.length&&n[0].cssClass||"",a=[0,0];e.xmin<0&&(a[0]=-e.xmin),e.ymin<0&&(a[1]=-e.ymin),o(this.path,{d:i(t.d),class:s,stroke:t.stroke?t.stroke:null,fill:t.fill?t.fill:null,transform:"translate("+a[0]+","+a[1]+")"})}};var i=function(t){return isNaN(t.cxy.x)||isNaN(t.cxy.y)?"":"M"+t.hxy.x+","+t.hxy.y+" L"+t.tail[0].x+","+t.tail[0].y+" L"+t.cxy.x+","+t.cxy.y+" L"+t.tail[1].x+","+t.tail[1].y+" L"+t.hxy.x+","+t.hxy.y};this.transfer=function(t){t.canvas&&this.path&&this.path.parentNode&&(this.path.parentNode.removeChild(this.path),t.canvas.appendChild(this.path))}},p={cleanup:function(t){null!=this.path&&(t?this._jsPlumb.instance.removeElement(this.path):this.path.parentNode&&this.path.parentNode.removeChild(this.path))},reattach:function(t,e){this.path&&e.canvas&&e.canvas.appendChild(this.path)},setVisible:function(t){null!=this.path&&(this.path.style.display=t?"block":"none")}};e.extend(h,[t.jsPlumbUIComponent,t.Overlays.AbstractOverlay]),t.Overlays.svg.Arrow=function(){h.apply(this,[t.Overlays.Arrow,arguments])},e.extend(t.Overlays.svg.Arrow,[t.Overlays.Arrow,h],p),t.Overlays.svg.PlainArrow=function(){h.apply(this,[t.Overlays.PlainArrow,arguments])},e.extend(t.Overlays.svg.PlainArrow,[t.Overlays.PlainArrow,h],p),t.Overlays.svg.Diamond=function(){h.apply(this,[t.Overlays.Diamond,arguments])},e.extend(t.Overlays.svg.Diamond,[t.Overlays.Diamond,h],p),t.Overlays.svg.GuideLines=function(){var e,n,i=null,s=this;t.Overlays.GuideLines.apply(this,arguments),this.paint=function(t,l){null==i&&(i=r("path"),t.connector.svg.appendChild(i),s.attachListeners(i,t.connector),s.attachListeners(i,s),e=r("path"),t.connector.svg.appendChild(e),s.attachListeners(e,t.connector),s.attachListeners(e,s),n=r("path"),t.connector.svg.appendChild(n),s.attachListeners(n,t.connector),s.attachListeners(n,s));var c=[0,0];l.xmin<0&&(c[0]=-l.xmin),l.ymin<0&&(c[1]=-l.ymin),o(i,{d:a(t.head,t.tail),stroke:"red",fill:null,transform:"translate("+c[0]+","+c[1]+")"}),o(e,{d:a(t.tailLine[0],t.tailLine[1]),stroke:"blue",fill:null,transform:"translate("+c[0]+","+c[1]+")"}),o(n,{d:a(t.headLine[0],t.headLine[1]),stroke:"green",fill:null,transform:"translate("+c[0]+","+c[1]+")"})};var a=function(t,e){return"M "+t.x+","+t.y+" L"+e.x+","+e.y}},e.extend(t.Overlays.svg.GuideLines,t.Overlays.GuideLines)}).call("undefined"!=typeof window?window:this),(function(){"use strict";var t,e,n=this,i=n.jsPlumb,o=n.jsPlumbUtil,r=n.Katavorio,s=n.Biltong,a=function(t,e){var n="_katavorio_"+(e=e||"main"),o=t[n],a=t.getEventManager();return o||((o=new r({bind:a.on,unbind:a.off,getSize:i.getSize,getConstrainingRectangle:function(t){return[t.parentNode.scrollWidth,t.parentNode.scrollHeight]},getPosition:function(e,n){var i=t.getOffset(e,n,e._katavorioDrag?e.offsetParent:null);return[i.left,i.top]},setPosition:function(t,e){t.style.left=e[0]+"px",t.style.top=e[1]+"px"},addClass:i.addClass,removeClass:i.removeClass,intersects:s.intersects,indexOf:function(t,e){return t.indexOf(e)},scope:t.getDefaultScope(),css:{noSelect:t.dragSelectClass,droppable:"jtk-droppable",draggable:"jtk-draggable",drag:"jtk-drag",selected:"jtk-drag-selected",active:"jtk-drag-active",hover:"jtk-drag-hover",ghostProxy:"jtk-ghost-proxy"}})).setZoom(t.getZoom()),t[n]=o,t.bind("zoom",o.setZoom)),o},l=function(t){var e=t.el._jsPlumbDragOptions,n=!0;return e.canDrag&&(n=e.canDrag()),n&&(this.setHoverSuspended(!0),this.select({source:t.el}).addClass(this.elementDraggingClass+" "+this.sourceElementDraggingClass,!0),this.select({target:t.el}).addClass(this.elementDraggingClass+" "+this.targetElementDraggingClass,!0),this.setConnectionBeingDragged(!0)),n},c=function(t){var e=this.getUIPosition(arguments,this.getZoom());if(null!=e){var n=t.el._jsPlumbDragOptions;this.draw(t.el,e,null,!0),n._dragging&&this.addClass(t.el,"jtk-dragged"),n._dragging=!0}},u=function(t){for(var e,n=t.selection,i=(function(n){var i;null!=n[1]&&(e=this.getUIPosition([{el:n[2].el,pos:[n[1].left,n[1].top]}]),i=this.draw(n[2].el,e)),null!=n[0]._jsPlumbDragOptions&&delete n[0]._jsPlumbDragOptions._dragging,this.removeClass(n[0],"jtk-dragged"),this.select({source:n[2].el}).removeClass(this.elementDraggingClass+" "+this.sourceElementDraggingClass,!0),this.select({target:n[2].el}).removeClass(this.elementDraggingClass+" "+this.targetElementDraggingClass,!0),t.e._drawResult=t.e._drawResult||{c:[],e:[],a:[]},Array.prototype.push.apply(t.e._drawResult.c,i.c),Array.prototype.push.apply(t.e._drawResult.e,i.e),Array.prototype.push.apply(t.e._drawResult.a,i.a),this.getDragManager().dragEnded(n[2].el)}).bind(this),o=0;o<n.length;o++)i(n[o]);this.setHoverSuspended(!1),this.setConnectionBeingDragged(!1)},d=function(t,e){if(null==e)return[0,0];var n=g(e),i=m(n,0);return[i[t+"X"],i[t+"Y"]]},h=d.bind(this,"page"),p=d.bind(this,"screen"),f=d.bind(this,"client"),m=function(t,e){return t.item?t.item(e):t[e]},g=function(t){return t.touches&&t.touches.length>0?t.touches:t.changedTouches&&t.changedTouches.length>0?t.changedTouches:t.targetTouches&&t.targetTouches.length>0?t.targetTouches:[t]},v=function(t){var e={},n=[],i={},o={},r={};this.register=function(s){var a,l=t.getId(s);e[l]||(e[l]=s,n.push(s),i[l]={});!function e(n){if(n)for(var c=0;c<n.childNodes.length;c++)if(3!==n.childNodes[c].nodeType&&8!==n.childNodes[c].nodeType){var u=jsPlumb.getElement(n.childNodes[c]),d=t.getId(n.childNodes[c],null,!0);if(d&&o[d]&&o[d]>0){a||(a=t.getOffset(s));var h=t.getOffset(u);i[l][d]={id:d,offset:{left:h.left-a.left,top:h.top-a.top}},r[d]=l}e(n.childNodes[c])}}(s)},this.updateOffsets=function(e,n){if(null!=e){n=n||{};var o,s=jsPlumb.getElement(e),a=t.getId(s),l=i[a];if(l)for(var c in l)if(l.hasOwnProperty(c)){var u=jsPlumb.getElement(c),d=n[c]||t.getOffset(u);if(null==u.offsetParent&&null!=i[a][c])continue;o||(o=t.getOffset(s)),i[a][c]={id:c,offset:{left:d.left-o.left,top:d.top-o.top}},r[c]=a}}},this.endpointAdded=function(n,s){s=s||t.getId(n);var a=document.body,l=n.parentNode;for(o[s]=o[s]?o[s]+1:1;null!=l&&l!==a;){var c=t.getId(l,null,!0);if(c&&e[c]){var u=t.getOffset(l);if(null==i[c][s]){var d=t.getOffset(n);i[c][s]={id:s,offset:{left:d.left-u.left,top:d.top-u.top}},r[s]=c}break}l=l.parentNode}},this.endpointDeleted=function(t){if(o[t.elementId]&&(o[t.elementId]--,o[t.elementId]<=0))for(var e in i)i.hasOwnProperty(e)&&i[e]&&(delete i[e][t.elementId],delete r[t.elementId])},this.changeId=function(t,e){i[e]=i[t],i[t]={},r[e]=r[t],r[t]=null},this.getElementsForDraggable=function(t){return i[t]},this.elementRemoved=function(t){var e=r[t];e&&(i[e]&&delete i[e][t],delete r[t])},this.reset=function(){e={},n=[],i={},o={}},this.dragEnded=function(e){if(null!=e.offsetParent){var n=t.getId(e),i=r[n];i&&this.updateOffsets(i)}},this.setParent=function(e,n,o,s,a){var l=r[n];i[s]||(i[s]={});var c=t.getOffset(o),u=a||t.getOffset(e);l&&i[l]&&delete i[l][n],i[s][n]={id:n,offset:{left:u.left-c.left,top:u.top-c.top}},r[n]=s},this.clearParent=function(t,e){var n=r[e];n&&(delete i[n][e],delete r[e])},this.revalidateParent=function(e,n,i){var o=r[n];if(o){var s={};s[n]=i,this.updateOffsets(o,s),t.revalidate(o)}},this.getDragAncestor=function(e){var n=jsPlumb.getElement(e),i=t.getId(n),o=r[i];return o?jsPlumb.getElement(o):null}},b=function(t,e,n){e=o.fastTrim(e),void 0!==t.className.baseVal?t.className.baseVal=e:t.className=e;try{var i=t.classList;if(null!=i){for(;i.length>0;)i.remove(i.item(0));for(var r=0;r<n.length;r++)n[r]&&i.add(n[r])}}catch(s){o.log("JSPLUMB: cannot set class list",s)}},y=function(t){return void 0===t.className.baseVal?t.className:t.className.baseVal},_=function(t,e,n){e=null==e?[]:o.isArray(e)?e:e.split(/\s+/),n=null==n?[]:o.isArray(n)?n:n.split(/\s+/);var i=y(t).split(/\s+/),r=function(t,e){for(var n=0;n<e.length;n++)if(t)-1===i.indexOf(e[n])&&i.push(e[n]);else{var o=i.indexOf(e[n]);-1!==o&&i.splice(o,1)}};r(!0,e),r(!1,n),b(t,i.join(" "),i)};n.jsPlumb.extend(n.jsPlumbInstance.prototype,{headless:!1,pageLocation:h,screenLocation:p,clientLocation:f,getDragManager:function(){return null==this.dragManager&&(this.dragManager=new v(this)),this.dragManager},recalculateOffsets:function(t){this.getDragManager().updateOffsets(t)},createElement:function(t,e,n,i){return this.createElementNS(null,t,e,n,i)},createElementNS:function(t,e,n,i,o){var r,s=null==t?document.createElement(e):document.createElementNS(t,e);for(r in n=n||{})s.style[r]=n[r];for(r in i&&(s.className=i),o=o||{})s.setAttribute(r,""+o[r]);return s},getAttribute:function(t,e){return null!=t.getAttribute?t.getAttribute(e):null},setAttribute:function(t,e,n){null!=t.setAttribute&&t.setAttribute(e,n)},setAttributes:function(t,e){for(var n in e)e.hasOwnProperty(n)&&t.setAttribute(n,e[n])},appendToRoot:function(t){document.body.appendChild(t)},getRenderModes:function(){return["svg"]},getClass:y,addClass:function(t,e){jsPlumb.each(t,function(t){_(t,e)})},hasClass:function(t,e){return(t=jsPlumb.getElement(t)).classList?t.classList.contains(e):-1!==y(t).indexOf(e)},removeClass:function(t,e){jsPlumb.each(t,function(t){_(t,null,e)})},toggleClass:function(t,e){jsPlumb.hasClass(t,e)?jsPlumb.removeClass(t,e):jsPlumb.addClass(t,e)},updateClasses:function(t,e,n){jsPlumb.each(t,function(t){_(t,e,n)})},setClass:function(t,e){null!=e&&jsPlumb.each(t,function(t){b(t,e,e.split(/\s+/))})},setPosition:function(t,e){t.style.left=e.left+"px",t.style.top=e.top+"px"},getPosition:function(t){var e=function(e){var n=t.style[e];return n?n.substring(0,n.length-2):0};return{left:e("left"),top:e("top")}},getStyle:function(t,e){return void 0!==window.getComputedStyle?getComputedStyle(t,null).getPropertyValue(e):t.currentStyle[e]},getSelector:function(t,e){return 1===arguments.length?null!=t.nodeType?t:document.querySelectorAll(t):t.querySelectorAll(e)},getOffset:function(t,e,n){t=jsPlumb.getElement(t),n=n||this.getContainer();for(var i={left:t.offsetLeft,top:t.offsetTop},o=e||null!=n&&t!==n&&t.offsetParent!==n?t.offsetParent:null,r=(function(t){null!=t&&t!==document.body&&(t.scrollTop>0||t.scrollLeft>0)&&(i.left-=t.scrollLeft,i.top-=t.scrollTop)}).bind(this);null!=o;)i.left+=o.offsetLeft,i.top+=o.offsetTop,r(o),o=e?o.offsetParent:o.offsetParent===n?null:o.offsetParent;if(null!=n&&!e&&(n.scrollTop>0||n.scrollLeft>0)){var s=null!=t.offsetParent?this.getStyle(t.offsetParent,"position"):"static",a=this.getStyle(t,"position");"absolute"!==a&&"fixed"!==a&&"absolute"!==s&&"fixed"!==s&&(i.left-=n.scrollLeft,i.top-=n.scrollTop)}return i},getPositionOnElement:function(t,e,n){var i=void 0!==e.getBoundingClientRect?e.getBoundingClientRect():{left:0,top:0,width:0,height:0},o=document.body,r=document.documentElement,s=window.pageYOffset||r.scrollTop||o.scrollTop,a=window.pageXOffset||r.scrollLeft||o.scrollLeft,l=i.top+s-(r.clientTop||o.clientTop||0)+0*n,c=i.left+a-(r.clientLeft||o.clientLeft||0)+0*n,u=jsPlumb.pageLocation(t);return[(u[0]-c)/(i.width||e.offsetWidth*n),(u[1]-l)/(i.height||e.offsetHeight*n)]},getAbsolutePosition:function(t){var e=function(e){var n=t.style[e];if(n)return parseFloat(n.substring(0,n.length-2))};return[e("left"),e("top")]},setAbsolutePosition:function(t,e,n,i){n?this.animate(t,{left:"+="+(e[0]-n[0]),top:"+="+(e[1]-n[1])},i):(t.style.left=e[0]+"px",t.style.top=e[1]+"px")},getSize:function(t){return[t.offsetWidth,t.offsetHeight]},getWidth:function(t){return t.offsetWidth},getHeight:function(t){return t.offsetHeight},getRenderMode:function(){return"svg"},draggable:function(t,e){var n;return t=o.isArray(t)||null!=t.length&&!o.isString(t)?t:[t],Array.prototype.slice.call(t).forEach((function(t){(n=this.info(t)).el&&this._initDraggableIfNecessary(n.el,!0,e,n.id,!0)}).bind(this)),this},snapToGrid:function(t,e,n){var i=[],o=(function(t){var o=this.info(t);if(null!=o.el&&o.el._katavorioDrag){var r=o.el._katavorioDrag.snap(e,n);this.revalidate(o.el),i.push([o.el,r])}}).bind(this);if(1===arguments.length||3===arguments.length)o(t,e,n);else{var r=this.getManagedElements();for(var s in r)o(s,arguments[0],arguments[1])}return i},initDraggable:function(t,e,n){a(this,n).draggable(t,e),t._jsPlumbDragOptions=e},destroyDraggable:function(t,e){a(this,e).destroyDraggable(t),t._jsPlumbDragOptions=null,t._jsPlumbRelatedElement=null},unbindDraggable:function(t,e,n,i){a(this,i).destroyDraggable(t,e,n)},setDraggable:function(t,e){return jsPlumb.each(t,(function(t){this.isDragSupported(t)&&(this._draggableStates[this.getAttribute(t,"id")]=e,this.setElementDraggable(t,e))}).bind(this))},_draggableStates:{},toggleDraggable:function(t){var e;return jsPlumb.each(t,(function(t){var n=this.getAttribute(t,"id");return this._draggableStates[n]=e=!(e=null!=this._draggableStates[n]&&this._draggableStates[n]),this.setDraggable(t,e),e}).bind(this)),e},_initDraggableIfNecessary:function(t,e,n,i,r){if(!jsPlumb.headless&&null!=e&&e&&jsPlumb.isDragSupported(t,this)){var s=n||this.Defaults.DragOptions;if(s=jsPlumb.extend({},s),jsPlumb.isAlreadyDraggable(t,this))n.force&&this.initDraggable(t,s);else{var a=jsPlumb.dragEvents.drag,d=jsPlumb.dragEvents.stop,h=jsPlumb.dragEvents.start;this.manage(i,t),s[h]=o.wrap(s[h],l.bind(this)),s[a]=o.wrap(s[a],c.bind(this)),s[d]=o.wrap(s[d],u.bind(this));var p=this.getId(t);this._draggableStates[p]=!0;var f=this._draggableStates[p];s.disabled=null!=f&&!f,this.initDraggable(t,s),this.getDragManager().register(t),r&&this.fire("elementDraggable",{el:t,options:s})}}},animationSupported:!0,getElement:function(t){return null==t?null:"string"==typeof(t="string"==typeof t?t:null==t.tagName&&null!=t.length&&null==t.enctype?t[0]:t)?document.getElementById(t):t},removeElement:function(t){a(this).elementRemoved(t),this.getEventManager().remove(t)},doAnimate:function(t,e,n){n=n||{};var r=this.getOffset(t),s=function(t,e){var n=function(n){if(null!=e[n]){if(o.isString(e[n])){var i=e[n].match(/-=/)?-1:1,r=e[n].substring(2);return t[n]+i*r}return e[n]}return t[n]};return[n("left"),n("top")]}(r,e),a=n.duration||250,l=a/15,c=15/a*(s[0]-r.left),u=15/a*(s[1]-r.top),d=0,h=setInterval(function(){i.setPosition(t,{left:r.left+c*(d+1),top:r.top+u*(d+1)}),null!=n.step&&n.step(d,Math.ceil(l)),++d>=l&&(window.clearInterval(h),null!=n.complete&&n.complete())},15)},destroyDroppable:function(t,e){a(this,e).destroyDroppable(t)},unbindDroppable:function(t,e,n,i){a(this,i).destroyDroppable(t,e,n)},droppable:function(t,e){var n;return t=o.isArray(t)||null!=t.length&&!o.isString(t)?t:[t],(e=e||{}).allowLoopback=!1,Array.prototype.slice.call(t).forEach((function(t){(n=this.info(t)).el&&this.initDroppable(n.el,e)}).bind(this)),this},initDroppable:function(t,e,n){a(this,n).droppable(t,e)},isAlreadyDraggable:function(t){return null!=t._katavorioDrag},isDragSupported:function(t,e){return!0},isDropSupported:function(t,e){return!0},isElementDraggable:function(t){return(t=i.getElement(t))._katavorioDrag&&t._katavorioDrag.isEnabled()},getDragObject:function(t){return t[0].drag.getDragElement()},getDragScope:function(t){return t._katavorioDrag&&t._katavorioDrag.scopes.join(" ")||""},getDropEvent:function(t){return t[0].e},getUIPosition:function(t,e){var n=t[0].el;if(null==n.offsetParent)return null;var i=t[0].finalPos||t[0].pos,o={left:i[0],top:i[1]};if(n._katavorioDrag&&n.offsetParent!==this.getContainer()){var r=this.getOffset(n.offsetParent);o.left+=r.left,o.top+=r.top}return o},setDragFilter:function(t,e,n){t._katavorioDrag&&t._katavorioDrag.setFilter(e,n)},setElementDraggable:function(t,e){(t=i.getElement(t))._katavorioDrag&&t._katavorioDrag.setEnabled(e)},setDragScope:function(t,e){t._katavorioDrag&&t._katavorioDrag.k.setDragScope(t,e)},setDropScope:function(t,e){t._katavorioDrop&&t._katavorioDrop.length>0&&t._katavorioDrop[0].k.setDropScope(t,e)},addToPosse:function(t,e){var n=Array.prototype.slice.call(arguments,1),o=a(this);i.each(t,function(t){(t=[i.getElement(t)]).push.apply(t,n),o.addToPosse.apply(o,t)})},setPosse:function(t,e){var n=Array.prototype.slice.call(arguments,1),o=a(this);i.each(t,function(t){(t=[i.getElement(t)]).push.apply(t,n),o.setPosse.apply(o,t)})},removeFromPosse:function(t,e){var n=Array.prototype.slice.call(arguments,1),o=a(this);i.each(t,function(t){(t=[i.getElement(t)]).push.apply(t,n),o.removeFromPosse.apply(o,t)})},removeFromAllPosses:function(t){var e=a(this);i.each(t,function(t){e.removeFromAllPosses(i.getElement(t))})},setPosseState:function(t,e,n){var o=a(this);i.each(t,function(t){o.setPosseState(i.getElement(t),e,n)})},dragEvents:{start:"start",stop:"stop",drag:"drag",step:"step",over:"over",out:"out",drop:"drop",complete:"complete",beforeStart:"beforeStart"},animEvents:{step:"step",complete:"complete"},stopDrag:function(t){t._katavorioDrag&&t._katavorioDrag.abort()},addToDragSelection:function(t){var e=this.getElement(t);null==e||!e._isJsPlumbGroup&&null!=e._jsPlumbGroup||a(this).select(t)},removeFromDragSelection:function(t){a(this).deselect(t)},getDragSelection:function(){return a(this).getSelection()},clearDragSelection:function(){a(this).deselectAll()},trigger:function(t,e,n,i){this.getEventManager().trigger(t,e,n,i)},doReset:function(){for(var t in this)0===t.indexOf("_katavorio_")&&this[t].reset()},getEventManager:function(){return(t=this._mottle)||(t=this._mottle=new n.Mottle),t;var t},on:function(t,e,n){return this.getEventManager().on.apply(this,arguments),this},off:function(t,e,n){return this.getEventManager().off.apply(this,arguments),this}}),t=i.init,(e=function(){/complete|loaded|interactive/.test(document.readyState)&&void 0!==document.body&&null!=document.body?t():setTimeout(e,9)})()}).call("undefined"!=typeof window?window:this)},oMdE:function(n,i,r){"use strict";r.r(i),r.d(i,"OrderModule",function(){return Ze});var a=r("PCNd"),l=r("tyNb"),c=r("mrSG"),u=r("R0Ic"),d=r("3Pt+"),h=r("0IaG"),p=r("5+WD"),f=r("fXoL"),m=r("S+vS"),g=r("bUwk"),v=r("Xi3o"),b=r("Olgc"),y=r("kmnG"),_=r("qFsG"),P=r("A5z7"),C=r("ofXK"),x=r("NFeN"),w=r("STbY"),j=r("bTqV"),S=r("sYmb");function O(t,e){if(1&t){var n=f.Vb();f.Ub(0,"mat-chip",25),f.bc("removed",function(){f.wc(n);var t=e.index;return f.fc().no.remove(t)}),f.Hc(1),f.Ub(2,"mat-icon",26),f.Hc(3,"cancel"),f.Tb(),f.Tb()}if(2&t){var i=e.$implicit;f.Cb(1),f.Jc(" ",i.value," ")}}function E(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",27),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc().no.append(t)}),f.Hc(1),f.gc(2,"translate"),f.Tb()}if(2&t){var i=e.$implicit;f.Cb(1),f.Ic(f.hc(2,1,"routes.order.type.format."+i))}}function k(t,e){if(1&t&&(f.Ub(0,"span"),f.Hc(1),f.gc(2,"translate"),f.Tb()),2&t){var n=e.$implicit;f.Cb(1),f.Jc("\\ ",f.hc(2,1,n.data.header)," ")}}function M(t,e){}var D=function(t){return{$implicit:t}};function I(t,e){if(1&t&&f.Fc(0,M,0,0,"ng-template",28),2&t){var n=e.$implicit;f.fc();var i=f.uc(40);f.lc("ngTemplateOutlet",i)("ngTemplateOutletContext",f.pc(2,D,n))}}function T(t,e){}function A(t,e){if(1&t&&f.Fc(0,T,0,0,"ng-template",28),2&t){var n=e.$implicit;f.fc(3);var i=f.uc(40);f.lc("ngTemplateOutlet",i)("ngTemplateOutletContext",f.pc(2,D,n))}}function F(t,e){if(1&t){var n=f.Vb();f.Sb(0),f.Ub(1,"a",31),f.bc("click",function(){f.wc(n);var t=f.fc().$implicit;return f.fc().menu.locate(t)}),f.Ub(2,"button",32),f.bc("click",function(t){f.wc(n);var e=f.fc().$implicit;return e.collapsed=!e.collapsed,t.stopPropagation()}),f.Ub(3,"mat-icon"),f.Hc(4),f.Tb(),f.Tb(),f.Hc(5),f.gc(6,"translate"),f.Tb(),f.Ub(7,"div",33),f.Fc(8,A,1,4,void 0,15),f.Tb(),f.Rb()}if(2&t){var i=f.fc().$implicit;f.Cb(1),f.Cc("padding-left",16*i.level-8+"px"),f.Cb(3),f.Ic(i.collapsed?"expand_more":"chevron_right"),f.Cb(1),f.Jc("",f.hc(6,6,i.data.header)," "),f.Cb(2),f.lc("@expand",i.collapsed?"collapsed":"expanded"),f.Cb(1),f.lc("ngForOf",i.children)}}function U(t,e){if(1&t){var n=f.Vb();f.Ub(0,"a",31),f.bc("click",function(){f.wc(n);var t=f.fc(2).$implicit;return f.fc().menu.locate(t)}),f.Pb(1,"button",35),f.Hc(2),f.gc(3,"translate"),f.Tb()}if(2&t){var i=f.fc(2).$implicit;f.Cc("padding-left",16*i.level-8+"px"),f.Cb(2),f.Jc("",f.hc(3,3,i.data.header)," ")}}function L(t,e){if(1&t&&f.Fc(0,U,4,5,"a",34),2&t){var n=f.fc().$implicit;f.lc("ngIf",null==n.children?null:n.children.length)}}function H(t,e){if(1&t&&(f.Fc(0,F,9,8,"ng-container",29),f.Fc(1,L,1,1,"ng-template",null,30,f.Gc)),2&t){var n=e.$implicit,i=f.uc(2);f.lc("ngIf",n.internal)("ngIfElse",i)}}function R(t,e){if(1&t&&(f.Ub(0,"div",39),f.Hc(1),f.gc(2,"translate"),f.Tb()),2&t){var n=f.fc().$implicit,i=f.fc(2);f.Cc("padding-left",56+16*(n.level-2)+"px")("color",i.preview.color1),f.Cb(1),f.Jc(" ",f.hc(2,5,i.form.controls.menu.value)," ")}}function N(t,e){if(1&t&&(f.Ub(0,"mat-icon"),f.Hc(1),f.Tb()),2&t){var n=f.fc(2).$implicit;f.Cb(1),f.Ic(n.data.icon)}}function G(t,e){if(1&t&&(f.Ub(0,"div",40),f.Fc(1,N,2,1,"mat-icon",41),f.Hc(2),f.gc(3,"translate"),f.Tb()),2&t){var n=f.fc().$implicit,i=f.fc(2);f.Cc("color",i.preview.color0)("padding-left",(n.level>1?56+16*(n.level-2):16)+"px"),f.Cb(1),f.lc("ngIf",n.data.icon),f.Cb(1),f.Jc(" ",f.hc(3,6,n.data.header)," ")}}function B(t,e){if(1&t&&(f.Sb(0),f.Fc(1,R,3,7,"div",37),f.Fc(2,G,4,8,"ng-template",null,38,f.Gc),f.Rb()),2&t){var n=e.$implicit,i=f.uc(3),o=f.fc(2);f.Cb(1),f.lc("ngIf",0==n.data.id||n.data.id==o.menu.id)("ngIfElse",i)}}function $(t,e){if(1&t){var n=f.Vb();f.Ub(0,"div",36),f.bc("cdkDropListDropped",function(t){return f.wc(n),f.fc().menu.sort(t)}),f.Fc(1,B,4,2,"ng-container",15),f.Tb()}if(2&t){var i=f.fc();f.Cc("background-color",i.preview.background),f.lc("cdkDropListSortPredicate",i.menu.sortable),f.Cb(1),f.lc("ngForOf",i.menu.list)}}var V,X=function(){return["const","date","serial"]},Y=((V=function(){function t(n,i,r,s,a,l,u){var h,f,m,g,v=this;o(this,t),this._data=n,this._formBuilder=i,this._dialogService=r,this._httpService=s,this._i18nService=a,this._toastService=l,this._dialogRef=u,this.no={append:function(t){return Object(c.a)(v,void 0,void 0,regeneratorRuntime.mark(function e(){var n,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=t,e.next="const"===e.t0?3:"date"===e.t0?7:"serial"===e.t0?16:24;break;case 3:return e.next=5,this._dialogService.prompt(this._i18nService.translate("routes.order.type.format.name"));case 5:return n=e.sent,e.abrupt("break",24);case 7:return e.next=9,this._dialogService.prompt(this._i18nService.translate("routes.order.type.format.name"),"yyyyMMdd");case 9:if(n=e.sent,e.t1=n&&!/^[yMdHms]*$/.test(n),!e.t1){e.next=15;break}return n=null,e.next=15,this._dialogService.alert(this._i18nService.translate("routes.order.type.format.invalid"));case 15:return e.abrupt("break",24);case 16:return e.next=18,this._dialogService.prompt(this._i18nService.translate("routes.order.type.format.name"),"0000");case 18:if(n=e.sent,e.t2=n&&!/^0*$/.test(n),!e.t2){e.next=24;break}return n=null,e.next=24,this._dialogService.alert(this._i18nService.translate("routes.order.type.format.invalid"));case 24:n&&((i=this._form.controls.no).value.push({type:t,value:n}),i.updateValueAndValidity());case 25:case"end":return e.stop()}},e,this)}))},remove:function(t){var e=v._form.controls.no;e.value.splice(t,1),e.updateValueAndValidity()}},this.menu={tree:this._data.menu.tree,map:this._data.menu.map,id:0,parent:0,position:0,list:null,locate:function(t){if(t){var n=v.menu.map[v.menu.parent=t.data.id];v.menu.list=[].concat(e(n.slice(0,n.length).map(function(t){return Object.assign(t,{dropable:!1})})),e(n[n.length-1].children.map(function(t){return Object.assign(t,{dropable:!0})}))),v.menu.id?v.menu.list.find(function(t){return t.data.id==v.menu.id})||v.menu.list.push({data:{id:v.menu.id},level:v.menu.list[v.menu.list.length-1].level,dropable:!0}):v.menu.list.push({data:{id:0},level:v.menu.list[v.menu.list.length-1].level,dropable:!0})}else v.menu.parent=0,v.menu.list=null},sortable:function(t){return v.menu.list[t].dropable},sort:function(t){return Object(p.d)(v.menu.list,t.previousIndex,t.currentIndex)}},this.save=function(){return Object(c.a)(v,void 0,void 0,regeneratorRuntime.mark(function t(){var e,n,i,o=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n={code:this._form.controls.code.value,name:this._form.controls.name.value,no:null===(e=this._form.controls.no.value)||void 0===e?void 0:e.map(function(t){return"".concat(t.type,":").concat(t.value)}),menu:null},this.menu.parent&&this._form.controls.menu.value&&(n.menu={id:this.menu.id,parent:this.menu.parent,header:this._form.controls.menu.value,url:"/order/instance/",order:this.menu.list.filter(function(t){return t.dropable}).findIndex(function(t){return t.data.id==o.menu.id})}),i=function(t){var e,n,i,r;switch(t.status){case 409:o._toastService.show(o._i18nService.translate("routes.order.type.error.conflict."+(null===(n=null===(e=t.error)||void 0===e?void 0:e.propertyName)||void 0===n?void 0:n.toLowerCase())));break;case 410:o._toastService.show(o._i18nService.translate("routes.order.type.error.gone."+(null===(r=null===(i=t.error)||void 0===i?void 0:i.propertyName)||void 0===r?void 0:r.toLowerCase()))),o._dialogRef.close({success:!1});break;case 422:o._toastService.show(o._i18nService.translate("shared.notification.fail")),o._dialogRef.close({success:!1});break;case 423:o._toastService.show(o._i18nService.translate("routes.order.type.error.locked.id")),o._dialogRef.close({success:!1});break;default:o._dialogRef.close({success:!1})}},t.t0=void 0,!this._data.item){t.next=10;break}return t.next=7,this._httpService.put("orders/types/"+this._data.item.id,n).catch(i);case 7:t.t1=t.sent,t.next=13;break;case 10:return t.next=12,this._httpService.post("orders/types",n).catch(i);case 12:t.t1=t.sent;case 13:if(t.t2=t.t1,t.t3=t.t0!==t.t2,!t.t3){t.next=17;break}this._toastService.show(this._i18nService.translate("shared.notification.success")),this._dialogRef.close({success:!0});case 17:case"end":return t.stop()}},t,this)}))};var b=this.menu.map[null===(h=n.item)||void 0===h?void 0:h.menu];(null==b?void 0:b.length)&&(this.menu.id=b[b.length-1].data.id,this.menu.locate(b[b.length-2]),b=b[b.length-1].data),this._form=this._formBuilder.group({code:[null===(f=n.item)||void 0===f?void 0:f.code,[d.u.required]],name:[null===(m=n.item)||void 0===m?void 0:m.name,[d.u.required]],no:[(null===(g=n.item)||void 0===g?void 0:g.no.length)?e(n.item.no):[]],menu:[null==b?void 0:b.header]}),this._preview={background:window.getComputedStyle(document.querySelector(".app-body")).getPropertyValue("background-color"),color0:window.getComputedStyle(document.querySelector(".app-menu-item:not(.active)>a")).getPropertyValue("color"),color1:window.getComputedStyle(document.querySelector(".app-menu-item.active>a")).getPropertyValue("color")}}return s(t,[{key:"data",get:function(){return this._data}},{key:"form",get:function(){return this._form}},{key:"preview",get:function(){return this._preview}}]),t}()).\u0275fac=function(t){return new(t||V)(f.Ob(h.a),f.Ob(d.d),f.Ob(m.a),f.Ob(g.a),f.Ob(v.a),f.Ob(b.a),f.Ob(h.g))},V.\u0275cmp=f.Ib({type:V,selectors:[["app-order-type-edit"]],decls:54,vars:36,consts:[["mat-dialog-title",""],["mat-dialog-content",""],["autocomplete","off",3,"formGroup"],["matInput","","formControlName","code","required",""],["matInput","","formControlName","name","required",""],["formControlName","no"],[3,"removed",4,"ngFor","ngForOf"],[1,"spacer"],[1,"mat-icon-suffix",3,"matMenuTriggerFor"],["xPosition","before"],["$no","matMenu"],["mat-menu-item","",3,"click",4,"ngFor","ngForOf"],["floatLabel","always"],[1,"mat-input-join"],[1,"col-auto",3,"matMenuTriggerFor"],[4,"ngFor","ngForOf"],[1,"tree"],["$menu","matMenu"],["$node",""],["matInput","","formControlName","menu",1,"col-fill",3,"readonly"],[1,"col-auto","mat-icon-suffix",3,"click"],["cdkDropList","","class","preview mat-elevation-z4",3,"backgroundColor","cdkDropListSortPredicate","cdkDropListDropped",4,"ngIf"],["mat-dialog-actions","","align","end"],["mat-button","","color","primary",3,"disabled","click"],["mat-button","","mat-dialog-close",""],[3,"removed"],["matChipRemove",""],["mat-menu-item","",3,"click"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[4,"ngIf","ngIfElse"],["$leaf",""],["mat-menu-item","",1,"tree",3,"click"],["mat-icon-button","","disableRipple","",3,"click"],[1,"nested"],["mat-menu-item","","class","tree",3,"paddingLeft","click",4,"ngIf"],["mat-icon-button","","disabled",""],["cdkDropList","",1,"preview","mat-elevation-z4",3,"cdkDropListSortPredicate","cdkDropListDropped"],["cdkDrag","","class","preview-item",3,"paddingLeft","color",4,"ngIf","ngIfElse"],["$preview",""],["cdkDrag","",1,"preview-item"],["cdkDrag","","cdkDragDisabled","",1,"preview-item"],[4,"ngIf"]],template:function(t,e){if(1&t&&(f.Ub(0,"h2",0),f.Hc(1),f.gc(2,"translate"),f.Tb(),f.Ub(3,"div",1),f.Ub(4,"form",2),f.Ub(5,"mat-form-field"),f.Ub(6,"mat-label"),f.Hc(7),f.gc(8,"translate"),f.Tb(),f.Pb(9,"input",3),f.Tb(),f.Ub(10,"mat-form-field"),f.Ub(11,"mat-label"),f.Hc(12),f.gc(13,"translate"),f.Tb(),f.Pb(14,"input",4),f.Tb(),f.Ub(15,"mat-form-field"),f.Ub(16,"mat-label"),f.Hc(17),f.gc(18,"translate"),f.Tb(),f.Ub(19,"mat-chip-list",5),f.Fc(20,O,4,1,"mat-chip",6),f.Pb(21,"span",7),f.Ub(22,"mat-icon",8),f.Hc(23,"add_circle"),f.Tb(),f.Ub(24,"mat-menu",9,10),f.Fc(26,E,3,3,"button",11),f.Tb(),f.Tb(),f.Tb(),f.Ub(27,"mat-form-field",12),f.Ub(28,"mat-label"),f.Hc(29),f.gc(30,"translate"),f.Tb(),f.Ub(31,"div",13),f.Ub(32,"a",14),f.Fc(33,k,3,3,"span",15),f.Ub(34,"span"),f.Hc(35,"\\\xa0"),f.Tb(),f.Tb(),f.Ub(36,"mat-menu",16,17),f.Fc(38,I,1,4,void 0,15),f.Fc(39,H,3,2,"ng-template",null,18,f.Gc),f.Tb(),f.Pb(41,"input",19),f.Ub(42,"mat-icon",20),f.bc("click",function(){return e.menu.locate(null),e.form.controls.menu.setValue(null)}),f.Hc(43,"cancel"),f.Tb(),f.Tb(),f.Tb(),f.Fc(44,$,2,4,"div",21),f.Tb(),f.Tb(),f.Ub(45,"div",22),f.Ub(46,"button",23),f.bc("click",function(){return e.save()}),f.Hc(47),f.gc(48,"uppercase"),f.gc(49,"translate"),f.Tb(),f.Ub(50,"button",24),f.Hc(51),f.gc(52,"uppercase"),f.gc(53,"translate"),f.Tb(),f.Tb()),2&t){var n=f.uc(25),i=f.uc(37);f.Cb(1),f.Ic(f.hc(2,17,e.data.item?"shared.operation.edit":"shared.operation.add")),f.Cb(3),f.lc("formGroup",e.form),f.Cb(3),f.Ic(f.hc(8,19,"routes.order.type.code")),f.Cb(5),f.Ic(f.hc(13,21,"routes.order.type.name")),f.Cb(5),f.Ic(f.hc(18,23,"routes.order.type.no")),f.Cb(3),f.lc("ngForOf",e.form.controls.no.value),f.Cb(2),f.lc("matMenuTriggerFor",n),f.Cb(4),f.lc("ngForOf",f.oc(35,X)),f.Cb(3),f.Ic(f.hc(30,25,"routes.order.type.menu")),f.Cb(3),f.lc("matMenuTriggerFor",i),f.Cb(1),f.lc("ngForOf",e.menu.map[e.menu.parent]),f.Cb(5),f.lc("ngForOf",e.menu.tree),f.Cb(3),f.lc("readonly",!(null!=e.menu.list&&e.menu.list.length)),f.Cb(3),f.lc("ngIf",e.menu.parent&&e.form.controls.menu.value),f.Cb(2),f.lc("disabled",e.form.invalid),f.Cb(1),f.Ic(f.hc(48,27,f.hc(49,29,"shared.dialog.ok"))),f.Cb(4),f.Ic(f.hc(52,31,f.hc(53,33,"shared.dialog.cancel")))}},directives:[h.h,h.e,d.v,d.o,d.g,y.b,y.e,_.b,d.c,d.n,d.f,d.t,P.c,C.m,x.a,w.e,w.a,C.n,h.c,j.a,h.d,P.a,P.d,w.c,C.s,p.b,p.a],pipes:[S.d,C.v],styles:[".mat-form-field[_ngcontent-%COMP%]{width:100%}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list[_ngcontent-%COMP%] .mat-icon-suffix[_ngcontent-%COMP%]{margin-bottom:4px;margin-right:4px;cursor:pointer}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list[_ngcontent-%COMP%] .mat-chip[_ngcontent-%COMP%] ~ .mat-icon-suffix[_ngcontent-%COMP%]{margin-bottom:0}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list[_ngcontent-%COMP%] .spacer[_ngcontent-%COMP%]{flex:1 1 auto}.mat-form-field[_ngcontent-%COMP%] .mat-input-join[_ngcontent-%COMP%]{display:flex;align-items:center}.mat-form-field[_ngcontent-%COMP%] .mat-input-join[_ngcontent-%COMP%] > .mat-menu-trigger[_ngcontent-%COMP%]{font-weight:700;cursor:pointer}.mat-form-field[_ngcontent-%COMP%] .mat-input-join[_ngcontent-%COMP%] > .mat-icon-suffix[_ngcontent-%COMP%]{cursor:pointer}.mat-form-field[_ngcontent-%COMP%] .mat-input-join[_ngcontent-%COMP%] > .col-auto[_ngcontent-%COMP%]{width:auto;flex:0 0 auto}.mat-form-field[_ngcontent-%COMP%] .mat-input-join[_ngcontent-%COMP%] > .col-fill[_ngcontent-%COMP%]{width:auto;flex:1 1 auto}.mat-menu-item.tree[_ngcontent-%COMP%]{padding-right:32px}.mat-menu-item.tree[_ngcontent-%COMP%] + .nested[_ngcontent-%COMP%]{overflow:hidden}.mat-menu-item.tree[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{margin-right:0}.preview[_ngcontent-%COMP%]{display:inline-block;margin:8px 0;padding:8px 0;width:auto;min-width:255px;cursor:default}.preview[_ngcontent-%COMP%] .preview-item[_ngcontent-%COMP%]{display:flex;padding-right:56px;align-items:center;line-height:48px}.preview[_ngcontent-%COMP%] .preview-item[_ngcontent-%COMP%]:not(.cdk-drag-disabled){cursor:move}.preview[_ngcontent-%COMP%] .preview-item[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{width:18px;height:18px;margin-left:2px;margin-right:20px;font-size:18px;line-height:16px}.cdk-drag-preview[_ngcontent-%COMP%]{display:flex;align-items:center;box-sizing:border-box;border-radius:4px;box-shadow:0 5px 5px -3px rgba(0,0,0,.2),0 8px 10px 1px rgba(0,0,0,.14),0 3px 14px 2px rgba(0,0,0,.12)}.cdk-drag-placeholder[_ngcontent-%COMP%]{opacity:0}.cdk-drag-animating[_ngcontent-%COMP%], .cdk-drop-list-dragging[_ngcontent-%COMP%] .preview-item[_ngcontent-%COMP%]:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}"],data:{animation:[Object(u.m)("expand",[Object(u.j)("collapsed",Object(u.k)({height:"0"})),Object(u.j)("expanded",Object(u.k)({height:"*"})),Object(u.l)("collapsed <=> expanded",Object(u.e)("200ms cubic-bezier(.4, 0, .2, 1)"))])]}}),V),q=r("TmDA"),W=r("Qu3c"),z=["$crud"],J=["$no"],Z=["$menu"];function K(t,e){if(1&t&&(f.Ub(0,"span"),f.Hc(1),f.Tb()),2&t){var n=e.$implicit;f.Cc("font-style","const"!=n.type&&"italic"),f.Cb(1),f.Jc("",n.value," ")}}function Q(t,e){1&t&&f.Fc(0,K,2,3,"span",5),2&t&&f.lc("ngForOf",e.$implicit.no)}function tt(t,e){if(1&t&&(f.Ub(0,"span"),f.Hc(1),f.gc(2,"translate"),f.Tb()),2&t){var n=e.$implicit;f.Cb(1),f.Jc("\\ ",f.hc(2,1,n.data.header)," ")}}function et(t,e){if(1&t&&f.Fc(0,tt,3,3,"span",6),2&t){var n=e.$implicit,i=f.fc();f.lc("ngForOf",i.map[n.menu])}}function nt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",7),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc().edit(t)}),f.gc(1,"translate"),f.Ub(2,"mat-icon"),f.Hc(3,"edit"),f.Tb(),f.Tb(),f.Ub(4,"button",7),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc().delete(t.id)}),f.gc(5,"translate"),f.Ub(6,"mat-icon"),f.Hc(7,"delete"),f.Tb(),f.Tb()}2&t&&(f.mc("matTooltip",f.hc(1,2,"shared.operation.edit")),f.Cb(4),f.mc("matTooltip",f.hc(5,4,"shared.operation.delete")))}var it,ot,rt=((it=function(){function n(i,r,s,a){var l=this;o(this,n),this._dialogService=i,this._httpService=r,this._i18nService=s,this._toastService=a,this._init=function(){return new Promise(function(t,n){l._httpService.get("roles/0/menu").then(function(n){var i,o;if(l._menu={tree:null!==(i=n.menu.children)&&void 0!==i?i:[],map:{}},l._menu.tree.length)for(var r=e(l._menu.tree);r.length;){var s=r.pop();l._menu.map[s.data.id]=s.data.parent?[].concat(e(l._menu.map[s.data.parent]),[s]):[s],(null===(o=s.children)||void 0===o?void 0:o.length)&&(s.children.find(function(t){var e;return null===(e=t.children)||void 0===e?void 0:e.length})&&(s.internal=!0),r.push.apply(r,e(s.children)))}t(n)}).catch(function(t){n(t)})})},this.convertor=function(e){return e.items.forEach(function(e){if(e.no){var n,i=[],o=null,r=t(e.no);try{for(r.s();!(n=r.n()).done;){var s=n.value;switch(s){case"{":i.unshift({type:"",value:""}),o=!1;break;case":":o=!0;break;case"}":o=null;break;default:switch(o){case!1:i[0].type+=s;break;case!0:i[0].value+=s;break;case null:i.unshift({type:"const",value:s}),o=!0}}}}catch(a){r.e(a)}finally{r.f()}e.no=i.reverse()}}),e},this.edit=function(t){return Object(c.a)(l,void 0,void 0,regeneratorRuntime.mark(function e(){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._dialogService.open(Y,{autoFocus:!t,data:{item:t,menu:this._menu}});case 2:if(!e.sent){e.next=7;break}return e.next=5,this._init();case 5:n=e.sent,this._defination[3].editor.range=n.items,this._template.refresh();case 7:case"end":return e.stop()}},e,this)}))},this.delete=function(t){return Object(c.a)(l,void 0,void 0,regeneratorRuntime.mark(function e(){var n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._dialogService.confirm(this._i18nService.translate("shared.notification.confirm"));case 2:if(e.t0=e.sent,!e.t0){e.next=9;break}return e.t1=void 0,e.next=7,this._httpService.delete("orders/types/"+t).catch(function(t){switch(t.status){case 422:n._toastService.show(n._i18nService.translate("shared.notification.fail"));break;case 423:n._toastService.show(n._i18nService.translate("routes.order.type.error.locked.id"));break;default:n._toastService.show(n._i18nService.translate("shared.notification.unknown"))}});case 7:e.t2=e.sent,e.t0=e.t1!==e.t2;case 9:if(e.t3=e.t0,!e.t3){e.next=12;break}this._toastService.show(this._i18nService.translate("shared.notification.success")),this._template.refresh();case 12:case"end":return e.stop()}},e,this)}))}}return s(n,[{key:"ngAfterViewInit",value:function(){var t=this;this._init().then(function(e){t._defination=[{id:"code",header:"routes.order.type.code",editor:{field:"text",required:!0}},{id:"name",header:"routes.order.type.name",editor:{field:"text",required:!0}},{id:"no",header:"routes.order.type.no",template:t._noColumn,editor:{field:"text"}},{id:"menu",header:"routes.order.type.menu",template:t._menuColumn,editor:{field:"multi-select",range:e.items,convertor:function(t){return t.map(function(t){return t.id})}}}],t._api="orders/types",t._template.edit=t.edit})}},{key:"defination",get:function(){return this._defination}},{key:"api",get:function(){return this._api}},{key:"map",get:function(){return this._menu.map}}]),n}()).\u0275fac=function(t){return new(t||it)(f.Ob(m.a),f.Ob(g.a),f.Ob(v.a),f.Ob(b.a))},it.\u0275cmp=f.Ib({type:it,selectors:[["app-order-type"]],viewQuery:function(t,e){var n;1&t&&(f.Oc(z,!0),f.Oc(J,!0),f.Oc(Z,!0)),2&t&&(f.tc(n=f.cc())&&(e._template=n.first),f.tc(n=f.cc())&&(e._noColumn=n.first),f.tc(n=f.cc())&&(e._menuColumn=n.first))},decls:8,vars:8,consts:[[3,"selectable","pageable","editable","deletable","defination","api","convertor","row-operation-template"],["$crud",""],["$no",""],["$menu",""],["$op",""],[3,"fontStyle",4,"ngFor","ngForOf"],[4,"ngFor","ngForOf"],["mat-icon-button","",3,"matTooltip","click"]],template:function(t,e){if(1&t&&(f.Ub(0,"crud-template",0,1),f.Fc(2,Q,1,1,"ng-template",null,2,f.Gc),f.Fc(4,et,1,1,"ng-template",null,3,f.Gc),f.Fc(6,nt,8,6,"ng-template",null,4,f.Gc),f.Tb()),2&t){var n=f.uc(7);f.lc("selectable",!1)("pageable",!1)("editable",!1)("deletable",!1)("defination",e.defination)("api",e.api)("convertor",e.convertor)("row-operation-template",n)}},directives:[q.a,C.m,j.a,W.c,x.a],pipes:[S.d],styles:[""]}),it),st=r("4ZMo"),at=function(){function e(){var n=this;o(this,e),this._nodes={},this._connections={},this.newId=function(t){var e=Object.keys(t);if(e.length){var n=parseInt(e.sort(function(t,e){return parseInt(t)-parseInt(e)})[0]);return n<0?n-1:-1}return-1},this._pressNode=function(t){n._dragging=!1},this._dragNode=function(){n._dragging=!0,n._element.classList.add("bg-grid")},this._releaseNode=function(t){n._element.classList.remove("bg-grid"),n.dragNode(t.el)},this._selectNode=function(e){if(e.stopPropagation(),!n._dragging){var i,o=t(e.path);try{for(o.s();!(i=o.n()).done;){var r=i.value;if(r.id){n.selectNode({id:parseInt(r.id)});break}}}catch(s){o.e(s)}finally{o.f()}}},this._connecting=function(t){return!n._jsplumb.getAllConnections().find(function(e){return e.sourceId==t.sourceId&&e.targetId==t.targetId})},this._connected=function(t){setTimeout(function(){if(/^con/.test(t.connection.id)){n._label(t.connection,"0");var e=n.newId(n._connections);n._connections[e]={connection:Object.assign(t.connection,{id:e.toString()}),label:"0"},n.connectNodes(t)}})},this._label=function(t,e){var n,i=t.getOverlays();if(i)for(var o in i)if("Label"==i[o].type){n=i[o];break}for(var r in n&&(delete i[n.id],n.canvas.remove()),t.setLabel(e),i=t.getOverlays())if("Label"==i[r].type){(n=i[r]).canvas.classList.add("app-background");break}},this._selectConnection=function(t,e){n.selectConnection({id:parseInt(t.id),event:{x:e.clientX,y:e.clientY}})}}return s(e,[{key:"init",value:function(t){this._jsplumb=st.jsPlumb.getInstance({Container:this._element=t.nativeElement,Connector:["Flowchart",{cornerRadius:4}],Endpoint:["Dot",{radius:6}],EndpointStyle:{fill:"transparent",stroke:"transparent",strokeWidth:4},EndpointHoverStyle:{fill:"transparent",stroke:"#666",strokeWidth:4},PaintStyle:{stroke:"#666",strokeWidth:2},HoverPaintStyle:{stroke:"#666",strokeWidth:4},ConnectionOverlays:[["Arrow",{foldback:.8,length:10,location:1,width:10}]],ConnectionsDetachable:!1,DragOptions:Object.assign({containment:"parent",start:this._dragNode,stop:this._releaseNode},{grid:[24,24]})}),this._jsplumb.bind("beforeDrop",this._connecting),this._jsplumb.bind("connection",this._connected),this._jsplumb.bind("click",this._selectConnection)}},{key:"clear",value:function(){for(var t in this._nodes)this.removeNode(parseInt(t))}},{key:"repaint",value:function(){setTimeout(this._jsplumb.repaintEverything)}},{key:"getNodes",value:function(){var t=[];for(var e in this._nodes)t.push({id:parseInt(e),x:this._nodes[e].offsetLeft,y:this._nodes[e].offsetTop});return t}},{key:"newNode",value:function(){return this.newId(this._nodes)}},{key:"addNode",value:function(t){var e=this;this._nodes[t]=document.getElementById(t.toString()),this._nodes[t].addEventListener("mousedown",this._pressNode),this._nodes[t].addEventListener("click",this._selectNode),this._jsplumb.draggable(this._nodes[t]),["Top","Right","Bottom","Left"].forEach(function(n){return e._jsplumb.addEndpoint(e._nodes[t],{uuid:"".concat(t).concat(n),anchor:n,isSource:!0,isTarget:!0,maxConnections:-1})})}},{key:"repaintNode",value:function(t){var e=this,n=t.toString();setTimeout(function(){var t=st.jsPlumbUtil.uuid();e._jsplumb.updateOffset({elId:n,recalc:!0,timestamp:t}),e._jsplumb.draw(n,null,t)})}},{key:"removeNode",value:function(t){for(var e in this._nodes[t].removeEventListener("mousedown",this._pressNode),this._nodes[t].removeEventListener("click",this._selectNode),this._jsplumb.remove(this._nodes[t]),this._connections)this._connections[e].connection.sourceId!=t.toString()&&this._connections[e].connection.targetId!=t.toString()||delete this._connections[e];delete this._nodes[t]}},{key:"getConnections",value:function(){var t=[];for(var e in this._connections)t.push({id:parseInt(e),source:parseInt(this._connections[e].connection.sourceId),target:parseInt(this._connections[e].connection.targetId),anchors:this._connections[e].connection.endpoints.map(function(t){return t.anchor.type}),label:this._connections[e].label});return t}},{key:"addConnection",value:function(t,e,n,i,o){t||(t=this.newId(this._connections)),this._connections[t]={label:o,connection:Object.assign(this._jsplumb.connect({uuids:["".concat(e).concat(i[0]),"".concat(n).concat(i[1])],overlays:[["Label",{label:o,cssClass:"app-background"}]]}),{id:t.toString()})}}},{key:"labelConnection",value:function(t){return Object(c.a)(this,void 0,void 0,regeneratorRuntime.mark(function e(){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.label(this._connections[t].label);case 2:null!=(n=e.sent)&&this._label(this._connections[t].connection,this._connections[t].label=n);case 4:case"end":return e.stop()}},e,this)}))}},{key:"removeConnection",value:function(t){this._jsplumb.deleteConnection(this._connections[t].connection),delete this._connections[t]}},{key:"dispose",value:function(){for(var t in this._jsplumb.unbind("beforeDrop",this._connecting),this._jsplumb.unbind("connection",this._connected),this._jsplumb.unbind("click",this._selectConnection),this._nodes)this._nodes[t].removeEventListener("mousedown",this._pressNode),this._nodes[t].removeEventListener("click",this._selectNode)}}]),e}(),lt=r("qUOr"),ct=r("/t3+"),ut=r("f0Cb"),dt=r("XhcP"),ht=((ot=function(){function t(e,n,i){var r=this;o(this,t),this._data=e,this._formBuilder=n,this._dialogRef=i,this.save=function(){return Object(c.a)(r,void 0,void 0,regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:this._dialogRef.close(Object.assign(this._data,{name:this._form.controls.name.value,param:this._form.controls.param.value}));case 1:case"end":return t.stop()}},t,this)}))},this._form=this._formBuilder.group({name:[e.name,[d.u.required]],param:[e.param]})}return s(t,[{key:"form",get:function(){return this._form}},{key:"data",get:function(){return this._data}}]),t}()).\u0275fac=function(t){return new(t||ot)(f.Ob(h.a),f.Ob(d.d),f.Ob(h.g))},ot.\u0275cmp=f.Ib({type:ot,selectors:[["app-order-workflow-action"]],decls:28,vars:24,consts:[["mat-dialog-title",""],["mat-dialog-content",""],["autocomplete","off",3,"formGroup"],["matInput","","formControlName","name","required",""],["floatLabel","always"],[1,"mat-input-join"],[1,"col-auto"],["matInput","","formControlName","param",1,"col-fill"],["mat-dialog-actions","","align","end"],["mat-button","","color","primary",3,"disabled","click"],["mat-button","","mat-dialog-close",""]],template:function(t,e){1&t&&(f.Ub(0,"h2",0),f.Hc(1),f.gc(2,"translate"),f.Tb(),f.Ub(3,"div",1),f.Ub(4,"form",2),f.Ub(5,"mat-form-field"),f.Ub(6,"mat-label"),f.Hc(7),f.gc(8,"translate"),f.Tb(),f.Pb(9,"input",3),f.Tb(),f.Ub(10,"mat-form-field",4),f.Ub(11,"mat-label"),f.Hc(12),f.gc(13,"translate"),f.Tb(),f.Ub(14,"div",5),f.Ub(15,"span",6),f.Hc(16),f.gc(17,"translate"),f.Tb(),f.Pb(18,"input",7),f.Tb(),f.Tb(),f.Tb(),f.Tb(),f.Ub(19,"div",8),f.Ub(20,"button",9),f.bc("click",function(){return e.save()}),f.Hc(21),f.gc(22,"uppercase"),f.gc(23,"translate"),f.Tb(),f.Ub(24,"button",10),f.Hc(25),f.gc(26,"uppercase"),f.gc(27,"translate"),f.Tb(),f.Tb()),2&t&&(f.Cb(1),f.Ic(f.hc(2,8,e.data.name?"shared.operation.edit":"shared.operation.add")),f.Cb(3),f.lc("formGroup",e.form),f.Cb(3),f.Ic(f.hc(8,10,"routes.order.workflow.action.name")),f.Cb(5),f.Ic(f.hc(13,12,"routes.order.workflow.action.config")),f.Cb(4),f.Jc("",f.hc(17,14,"routes.order.workflow.action.business."+e.data.business)," \uff1a"),f.Cb(4),f.lc("disabled",e.form.invalid),f.Cb(1),f.Ic(f.hc(22,16,f.hc(23,18,"shared.dialog.ok"))),f.Cb(4),f.Ic(f.hc(26,20,f.hc(27,22,"shared.dialog.cancel"))))},directives:[h.h,h.e,d.v,d.o,d.g,y.b,y.e,_.b,d.c,d.n,d.f,d.t,h.c,j.a,h.d],pipes:[S.d,C.v],styles:[".mat-form-field[_ngcontent-%COMP%]{width:100%}.mat-form-field[_ngcontent-%COMP%] .mat-input-join[_ngcontent-%COMP%]{display:flex;align-items:center}.mat-form-field[_ngcontent-%COMP%] .mat-input-join[_ngcontent-%COMP%] > .col-auto[_ngcontent-%COMP%]{width:auto;flex:0 0 auto}.mat-form-field[_ngcontent-%COMP%] .mat-input-join[_ngcontent-%COMP%] > .col-fill[_ngcontent-%COMP%]{width:auto;flex:1 1 auto}"]}),ot),pt=r("d3UM"),ft=r("FKr1");function mt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"mat-chip",29),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc(4).editAction(t)})("removed",function(){f.wc(n);var t=e.index,i=f.fc(2).$implicit;return f.fc(2).removeAction(i,t)}),f.Hc(1),f.Ub(2,"mat-icon",30),f.Hc(3,"cancel"),f.Tb(),f.Tb()}if(2&t){var i=e.$implicit;f.Cb(1),f.Jc(" ",i.name,"")}}function gt(t,e){if(1&t&&(f.Ub(0,"mat-chip-list"),f.Ub(1,"div",27),f.Fc(2,mt,4,1,"mat-chip",28),f.Tb(),f.Tb()),2&t){var n=f.fc().$implicit;f.Cb(2),f.lc("ngForOf",n.actions)}}function vt(t,e){1&t&&(f.Ub(0,"span",31),f.Hc(1),f.gc(2,"translate"),f.Tb()),2&t&&(f.Cb(1),f.Ic(f.hc(2,1,"routes.order.workflow.action.empty")))}var bt=function(t,e){return{$implicit:t,index:e}};function yt(t,e){if(1&t&&(f.Ub(0,"mat-basic-chip",23),f.Ub(1,"div",24),f.Ub(2,"div"),f.Hc(3),f.Tb(),f.Fc(4,gt,3,1,"mat-chip-list",5),f.Fc(5,vt,3,3,"ng-template",null,25,f.Gc),f.Tb(),f.Ub(7,"mat-icon",26),f.Hc(8,"more_horiz"),f.Tb(),f.Tb()),2&t){var n=e.$implicit,i=e.index,o=f.uc(6);f.fc(2);var r=f.uc(50);f.Cb(3),f.Ic(n.name),f.Cb(1),f.lc("ngIf",n.actions.length)("ngIfElse",o),f.Cb(3),f.lc("matMenuTriggerFor",r)("matMenuTriggerData",f.qc(5,bt,n,i))}}function _t(t,e){if(1&t&&(f.Ub(0,"mat-form-field"),f.Ub(1,"mat-label"),f.Hc(2),f.gc(3,"translate"),f.Tb(),f.Ub(4,"mat-chip-list",20,21),f.Fc(6,yt,9,8,"mat-basic-chip",22),f.Tb(),f.Tb()),2&t){var n=f.fc();f.Cb(2),f.Ic(f.hc(3,2,"routes.order.workflow.order.name")),f.Cb(4),f.lc("ngForOf",n.form.controls.orders.value)}}function Pt(t,e){if(1&t&&(f.Ub(0,"mat-form-field"),f.Ub(1,"mat-label"),f.Hc(2),f.gc(3,"translate"),f.Tb(),f.Pb(4,"input",32),f.Ub(5,"mat-icon",33),f.Hc(6,"more_horiz"),f.Tb(),f.Tb()),2&t){f.fc();var n=f.uc(45);f.Cb(2),f.Ic(f.hc(3,2,"routes.order.workflow.order.name")),f.Cb(3),f.lc("matMenuTriggerFor",n)}}var Ct=function(t){return{$implicit:t}};function xt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",14),f.Hc(1),f.gc(2,"translate"),f.Tb(),f.Ub(3,"button",34),f.bc("click",function(){f.wc(n);var t=e.index;return f.fc().removeOrder(t)}),f.Hc(4),f.gc(5,"translate"),f.Tb(),f.Ub(6,"button",35),f.Hc(7),f.gc(8,"translate"),f.Tb()}if(2&t){var i=e.$implicit;f.fc();var o=f.uc(53),r=f.uc(56);f.lc("matMenuTriggerFor",o),f.Cb(1),f.Ic(f.hc(2,6,"routes.order.workflow.order.add")),f.Cb(3),f.Ic(f.hc(5,8,"routes.order.workflow.order.remove")),f.Cb(2),f.lc("matMenuTriggerFor",r)("matMenuTriggerData",f.pc(12,Ct,i)),f.Cb(1),f.Ic(f.hc(8,10,"routes.order.workflow.action.add"))}}function wt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",34),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc().addOrder(t)}),f.Hc(1),f.Tb()}if(2&t){var i=e.$implicit;f.Cb(1),f.Ic(i.name)}}function jt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",34),f.bc("click",function(){f.wc(n);var t=e.$implicit,i=f.fc().$implicit;return f.fc().addAction(i,t)}),f.Hc(1),f.gc(2,"translate"),f.Tb()}if(2&t){var i=e.$implicit;f.Cb(1),f.Ic(f.hc(2,1,"routes.order.workflow.action.business."+i))}}function St(t,e){if(1&t&&f.Fc(0,jt,3,3,"button",18),2&t){var n=f.fc();f.lc("ngForOf",n.action)}}var Ot,Et=((Ot=function(){function t(n,i,r,s){var a=this;o(this,t),this._formBuilder=n,this._dialogService=i,this._httpService=r,this._i18nService=s,this.onApply=new f.o,this.onRemove=new f.o,this.addOrder=function(t){var e=a._form.controls.orders.value;e.find(function(e){return e.id==t.id})||e.push(Object.assign({actions:[]},t))},this.removeOrder=function(t){return a._dialogService.confirm(a._i18nService.translate("shared.notification.confirm")).then(function(e){return e&&a._form.controls.orders.value.splice(t,1)})},this.addAction=function(t,e){return Object(c.a)(a,void 0,void 0,regeneratorRuntime.mark(function n(){var i;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return i={business:e,name:null,param:null},n.next=3,this._dialogService.open(ht,{data:i});case 3:(i=n.sent)&&t.actions.push(i);case 5:case"end":return n.stop()}},n,this)}))},this.editAction=function(t){return Object(c.a)(a,void 0,void 0,regeneratorRuntime.mark(function e(){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._dialogService.open(ht,{data:t});case 2:(n=e.sent)&&Object.assign(t,n);case 4:case"end":return e.stop()}},e,this)}))},this.removeAction=function(t,e){return a._dialogService.confirm(a._i18nService.translate("shared.notification.confirm")).then(function(n){return n&&t.actions.splice(e,1)})},this.apply=function(){for(var t in a._form.controls)switch(t){case"orders":a._data.orders=e(a._form.controls.orders.value.map(function(t){return Object.assign({},t,{actions:e(t.actions)})}));break;default:a._data[t]=a._form.controls[t].value}a.onApply.emit(a._data)},this.remove=function(){return a._dialogService.confirm(a._i18nService.translate("shared.notification.confirm")).then(function(t){return t&&a.onRemove.emit(a._data)})},this._httpService.get("orders/types").then(function(t){return a._order=t.items}),this._httpService.get("orders/actions").then(function(t){return a._action=t.items}),this._form=this._formBuilder.group({name:[null,[d.u.required]],type:[null],enter:[null],alive:[null],orders:[null]})}return s(t,[{key:"form",get:function(){return this._form}},{key:"order",get:function(){return this._order}},{key:"action",get:function(){return this._action}},{key:"data",set:function(t){if(this._data=t)for(var n in this._form.controls)switch(n){case"orders":this._form.controls.orders.setValue(e(t.orders.map(function(t){return Object.assign({},t,{actions:e(t.actions)})})));break;default:this._form.controls[n].setValue(t[n])}else this._form.reset()}}]),t}()).\u0275fac=function(t){return new(t||Ot)(f.Ob(d.d),f.Ob(m.a),f.Ob(g.a),f.Ob(v.a))},Ot.\u0275cmp=f.Ib({type:Ot,selectors:[["app-order-workflow-node"]],inputs:{data:"data"},outputs:{onApply:"changed",onRemove:"removed"},decls:58,vars:39,consts:[["autocomplete","off",3,"formGroup"],["matInput","","formControlName","name","required",""],["formControlName","enter"],["value","and"],["value","or"],[4,"ngIf","ngIfElse"],["$norder",""],["type","number","matInput","","formControlName","alive","min","0"],["formControlName","type"],["value","start"],["value","end"],["mat-flat-button","","color","primary",3,"disabled","click"],["mat-stroked-button","","color","warn",3,"click"],["$orderMenu0","matMenu"],["mat-menu-item","",3,"matMenuTriggerFor"],["$orderMenu1","matMenu"],["matMenuContent",""],["$orderSubMenu","matMenu"],["mat-menu-item","",3,"click",4,"ngFor","ngForOf"],["$actionSubMenu","matMenu"],[1,"mat-chip-list-stacked"],["$orderList",""],["disableRipple","true",4,"ngFor","ngForOf"],["disableRipple","true"],[1,"mat-chip-content"],["$noaction",""],[3,"matMenuTriggerFor","matMenuTriggerData"],[1,"mat-chip-list-inner-wrapper"],[3,"click","removed",4,"ngFor","ngForOf"],[3,"click","removed"],["matChipRemove",""],[1,"mat-chip-list-placeholder","app-foreground-secondary"],["matInput","","readonly",""],["matSuffix","",3,"matMenuTriggerFor"],["mat-menu-item","",3,"click"],["mat-menu-item","",3,"matMenuTriggerFor","matMenuTriggerData"]],template:function(t,e){if(1&t&&(f.Ub(0,"form",0),f.Ub(1,"mat-form-field"),f.Ub(2,"mat-label"),f.Hc(3),f.gc(4,"translate"),f.Tb(),f.Pb(5,"input",1),f.Tb(),f.Ub(6,"mat-form-field"),f.Ub(7,"mat-label"),f.Hc(8),f.gc(9,"translate"),f.Tb(),f.Ub(10,"mat-select",2),f.Pb(11,"mat-option"),f.Ub(12,"mat-option",3),f.Hc(13),f.gc(14,"translate"),f.Tb(),f.Ub(15,"mat-option",4),f.Hc(16),f.gc(17,"translate"),f.Tb(),f.Tb(),f.Tb(),f.Fc(18,_t,7,4,"mat-form-field",5),f.Fc(19,Pt,7,4,"ng-template",null,6,f.Gc),f.Ub(21,"mat-form-field"),f.Ub(22,"mat-label"),f.Hc(23),f.gc(24,"translate"),f.Tb(),f.Pb(25,"input",7),f.Tb(),f.Ub(26,"mat-form-field"),f.Ub(27,"mat-label"),f.Hc(28),f.gc(29,"translate"),f.Tb(),f.Ub(30,"mat-select",8),f.Pb(31,"mat-option"),f.Ub(32,"mat-option",9),f.Hc(33),f.gc(34,"translate"),f.Tb(),f.Ub(35,"mat-option",10),f.Hc(36),f.gc(37,"translate"),f.Tb(),f.Tb(),f.Tb(),f.Ub(38,"button",11),f.bc("click",function(){return e.apply()}),f.Hc(39),f.gc(40,"translate"),f.Tb(),f.Ub(41,"button",12),f.bc("click",function(){return e.remove()}),f.Hc(42),f.gc(43,"translate"),f.Tb(),f.Tb(),f.Ub(44,"mat-menu",null,13),f.Ub(46,"button",14),f.Hc(47),f.gc(48,"translate"),f.Tb(),f.Tb(),f.Ub(49,"mat-menu",null,15),f.Fc(51,xt,9,14,"ng-template",16),f.Tb(),f.Ub(52,"mat-menu",null,17),f.Fc(54,wt,2,1,"button",18),f.Tb(),f.Ub(55,"mat-menu",null,19),f.Fc(57,St,1,1,"ng-template",16),f.Tb()),2&t){var n=f.uc(20),i=f.uc(53);f.lc("formGroup",e.form),f.Cb(3),f.Ic(f.hc(4,17,"routes.order.workflow.node.name")),f.Cb(5),f.Ic(f.hc(9,19,"routes.order.workflow.node.enter")),f.Cb(5),f.Ic(f.hc(14,21,"routes.order.workflow.node.and")),f.Cb(3),f.Ic(f.hc(17,23,"routes.order.workflow.node.or")),f.Cb(2),f.lc("ngIf",null==e.form.controls.orders.value?null:e.form.controls.orders.value.length)("ngIfElse",n),f.Cb(5),f.Ic(f.hc(24,25,"routes.order.workflow.node.alive")),f.Cb(5),f.Ic(f.hc(29,27,"routes.order.workflow.node.endpoint")),f.Cb(5),f.Ic(f.hc(34,29,"routes.order.workflow.node.start")),f.Cb(3),f.Ic(f.hc(37,31,"routes.order.workflow.node.end")),f.Cb(2),f.lc("disabled",e.form.invalid),f.Cb(1),f.Ic(f.hc(40,33,"routes.order.workflow.apply")),f.Cb(3),f.Ic(f.hc(43,35,"routes.order.workflow.delete")),f.Cb(4),f.lc("matMenuTriggerFor",i),f.Cb(1),f.Ic(f.hc(48,37,"routes.order.workflow.order.add")),f.Cb(7),f.lc("ngForOf",e.order)}},directives:[d.v,d.o,d.g,y.b,y.e,_.b,d.c,d.n,d.f,d.t,pt.a,ft.o,C.n,d.r,j.a,w.a,w.c,w.e,w.b,C.m,P.c,P.a,x.a,P.d,y.f],pipes:[S.d],styles:[".mat-form-field[_ngcontent-%COMP%]{width:100%}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list-stacked[_ngcontent-%COMP%]{display:block;overflow:hidden}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list-stacked[_ngcontent-%COMP%] .mat-basic-chip[_ngcontent-%COMP%]{display:flex;margin-top:8px;padding:4px;width:100%;align-items:center}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list-stacked[_ngcontent-%COMP%] .mat-basic-chip[_ngcontent-%COMP%] .mat-chip-content[_ngcontent-%COMP%]{display:flex;flex-direction:column;flex-grow:1}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list-stacked[_ngcontent-%COMP%] .mat-basic-chip[_ngcontent-%COMP%] .mat-chip-content[_ngcontent-%COMP%] .mat-chip-list-inner-wrapper[_ngcontent-%COMP%]{display:flex;margin:2px;width:125%;flex-wrap:wrap;transform-origin:left;transform:scale(.75)}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list-stacked[_ngcontent-%COMP%] .mat-basic-chip[_ngcontent-%COMP%] .mat-chip-content[_ngcontent-%COMP%] .mat-chip-list-inner-wrapper[_ngcontent-%COMP%] .mat-chip[_ngcontent-%COMP%]{width:auto;white-space:nowrap}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list-stacked[_ngcontent-%COMP%] .mat-basic-chip[_ngcontent-%COMP%] .mat-chip-content[_ngcontent-%COMP%] .mat-chip-list-placeholder[_ngcontent-%COMP%]{font-size:10px;line-height:32px}.mat-form-field[_ngcontent-%COMP%] .mat-chip-list-stacked[_ngcontent-%COMP%] .mat-basic-chip[_ngcontent-%COMP%] .mat-icon[_ngcontent-%COMP%]{cursor:pointer}.mat-form-field[_ngcontent-%COMP%]:last-child{margin-bottom:8px}.mat-button-base[_ngcontent-%COMP%]{margin-top:8px;width:100%}"]}),Ot),kt=r("Wp6s"),Mt=r("Vc0j"),Dt=["$canvas"],It=["$nodeDetail"],Tt=["$menuTirgger"];function At(t,e){1&t&&(f.Ub(0,"b"),f.Hc(1,"*"),f.Tb())}function Ft(t,e){if(1&t&&(f.Ub(0,"span"),f.Hc(1),f.gc(2,"translate"),f.Fc(3,At,2,0,"b",4),f.Tb()),2&t){var n=f.fc();f.Cb(1),f.Jc("",(null==n.flow?null:n.flow.name)||f.hc(2,2,"routes.order.workflow.empty")," "),f.Cb(2),f.lc("ngIf",n.edit)}}function Ut(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",10),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc().select(t)}),f.Hc(1),f.Tb()}if(2&t){var i=e.$implicit;f.Cb(1),f.Ic(i.name)}}function Lt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",10),f.bc("click",function(){f.wc(n);var t=f.fc();return t.save(t.flow.id,!0)}),f.Hc(1),f.gc(2,"translate"),f.Tb()}2&t&&(f.Cb(1),f.Ic(f.hc(2,1,"routes.order.workflow.rename")))}function Ht(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",26),f.bc("click",function(){f.wc(n);var t=f.fc();return t.save(t.flow.id,!1)}),f.Hc(1),f.gc(2,"translate"),f.Tb()}if(2&t){var i=f.fc();f.lc("disabled",!i.edit),f.Cb(1),f.Ic(f.hc(2,2,"routes.order.workflow.save"))}}function Rt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",10),f.bc("click",function(){return f.wc(n),f.fc().delete()}),f.Hc(1),f.gc(2,"translate"),f.Tb()}2&t&&(f.Cb(1),f.Ic(f.hc(2,1,"routes.order.workflow.delete")))}function Nt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",27),f.bc("click",function(){return f.wc(n),f.fc().addNode()}),f.gc(1,"translate"),f.Ub(2,"mat-icon"),f.Hc(3,"add"),f.Tb(),f.Tb()}2&t&&f.mc("matTooltip",f.hc(1,1,"routes.order.workflow.node.add"))}function Gt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",10),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc().label(t)}),f.Hc(1),f.gc(2,"translate"),f.Tb(),f.Ub(3,"button",28),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc().disconnect(t)}),f.Hc(4),f.gc(5,"translate"),f.Tb()}2&t&&(f.Cb(1),f.Ic(f.hc(2,2,"routes.order.workflow.state")),f.Cb(3),f.Ic(f.hc(5,4,"routes.order.workflow.delete")))}var Bt=function(){return{start:"app-foreground-primary",end:"app-foreground-accent"}};function $t(t,e){if(1&t&&(f.Ub(0,"mat-icon",32),f.Hc(1,"bookmark"),f.Tb()),2&t){var n=f.fc().$implicit;f.lc("ngClass",f.oc(1,Bt)[n.type])}}function Vt(t,e){if(1&t&&(f.Ub(0,"mat-card"),f.Hc(1),f.Tb()),2&t){var n=e.$implicit;f.Cb(1),f.Ic(n.name)}}var Xt=function(t){return{"mat-elevation-z8":t}};function Yt(t,e){if(1&t){var n=f.Vb();f.Ub(0,"mat-card",29),f.bc("afterViewInit",function(t){f.wc(n);var i=e.last;return f.fc().addNode(t,i)}),f.Ub(1,"mat-card-title"),f.Ub(2,"span"),f.Hc(3),f.Tb(),f.Fc(4,$t,2,2,"mat-icon",30),f.Tb(),f.Fc(5,Vt,2,1,"mat-card",31),f.Ub(6,"mat-card-subtitle"),f.Hc(7),f.gc(8,"translate"),f.Tb(),f.Tb()}if(2&t){var i=e.$implicit,o=f.fc();f.Cc("left",i.design.x,"px")("top",i.design.y,"px"),f.lc("id",i.id)("ngClass",f.pc(14,Xt,i.id==(null==o.node?null:o.node.id)))("hookData",i.id),f.Cb(3),f.Ic(i.name),f.Cb(1),f.lc("ngIf",i.type),f.Cb(1),f.lc("ngForOf",i.orders),f.Cb(2),f.Kc("",f.hc(8,12,"routes.order.workflow.node.alive"),"\uff1a",i.alive||"N/A","")}}var qt,Wt=((qt=function(){function t(e,n,i,r){var s=this;o(this,t),this._dialogService=e,this._httpService=n,this._i18nService=i,this._toastService=r,this.select=function(t){return Object(c.a)(s,void 0,void 0,regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this._flow!=t,!e.t0){e.next=10;break}if(e.t1=this._edit,!e.t1){e.next=7;break}return e.next=6,this._dialogService.confirm(this._i18nService.translate("routes.order.workflow.confirm"));case 6:e.t1=!e.sent;case 7:if(e.t2=e.t1,e.t2){e.next=10;break}this.blur(),this._jsplumb.clear(),this._edit&&Object.assign(this._flow,JSON.parse(this._cache)),t&&(this._cache=JSON.stringify(t)),this._flow=t,this._edit=!1;case 10:case"end":return e.stop()}},e,this)}))},this.addNode=function(t,e){t?t>0?e&&(s._flow.nodes.forEach(function(t){return s._jsplumb.addNode(t.id)}),s._flow.paths.forEach(function(t){return s._jsplumb.addConnection(t.id,t.source,t.target,t.anchors,t.label)})):(s._jsplumb.addNode(t),setTimeout(function(){s._node=s._flow.nodes.find(function(e){return e.id==t}),s._sidenav.open()})):(s._edit=!0,s._flow.nodes.push({id:s._jsplumb.newNode(),name:"".concat(s._i18nService.translate("routes.order.workflow.node.new")," ").concat(-s._jsplumb.newNode()),design:{x:24,y:24},orders:[]}))},this.updateNode=function(t){s._edit=!0,s._sidenav.close(),s._jsplumb.repaintNode(t.id)},this.removeNode=function(t){s._edit=!0,s._jsplumb.removeNode(t.id),s._flow.nodes.splice(s._flow.nodes.indexOf(t),1),s.blur()},this.blur=function(){s._node=null,s._sidenav.close()},this.label=function(t){s._jsplumb.labelConnection(t)},this.disconnect=function(t){return Object(c.a)(s,void 0,void 0,regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._dialogService.confirm(this._i18nService.translate("shared.notification.confirm"));case 2:if(e.t0=e.sent,!e.t0){e.next=5;break}this._edit=!0,this._jsplumb.removeConnection(t);case 5:case"end":return e.stop()}},e,this)}))},this.refresh=function(){return Object(c.a)(s,void 0,void 0,regeneratorRuntime.mark(function t(){var e,n=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return this._loading=!0,t.next=3,this._httpService.get("orders/flows");case 3:e=t.sent,this._loading=!1,e.items.forEach(function(t){t.nodes.forEach(function(t){for(var e in t.orders=[],t.detail){var i=parseInt(e);t.orders.push({id:i,name:n._orders[i],actions:t.detail[e].map(function(t){return{business:t[0],name:t[1],param:t[2]}})}),delete t.detail}})}),this._flows=e.items;case 5:case"end":return t.stop()}},t,this)}))},this.save=function(t,e){return Object(c.a)(s,void 0,void 0,regeneratorRuntime.mark(function n(){var i,o,r,s,a,l,c,u=this;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(o=null===(i=this._flow)||void 0===i?void 0:i.name,n.t0=e,!n.t0){n.next=7;break}return n.next=5,this._dialogService.prompt(this._i18nService.translate("routes.order.workflow.name"),t?this._flow.name:null,{required:!0});case 5:o=n.sent,n.t0=!o;case 7:if(!n.t0){n.next=9;break}return n.abrupt("return");case 9:if(r=function(t){var e,n,i,o,r,s;switch(t.status){case 409:u._toastService.show(u._i18nService.translate("routes.order.workflow.error.conflict."+(null===(n=null===(e=t.error)||void 0===e?void 0:e.propertyName)||void 0===n?void 0:n.toLowerCase())));break;case 410:u._toastService.show(u._i18nService.translate("routes.order.workflow.error.gone."+(null===(o=null===(i=t.error)||void 0===i?void 0:i.propertyName)||void 0===o?void 0:o.toLowerCase())));break;case 422:u._toastService.show(u._i18nService.translate("shared.notification.fail"));break;case 423:u._toastService.show(u._i18nService.translate("routes.order.workflow.error.locked."+(null===(s=null===(r=t.error)||void 0===r?void 0:r.propertyName)||void 0===s?void 0:s.toLowerCase())))}},!t){n.next=30;break}return s={id:t,name:o,nodes:null,paths:null},e||(a=this._jsplumb.getNodes().reduce(function(t,e){return t[e.id]={x:e.x,y:e.y},t},{}),s.nodes=this._flow.nodes.map(function(t){return{id:t.id,name:t.name,type:t.type||null,enter:t.enter||null,alive:t.alive||null,design:a[t.id],detail:t.orders.reduce(function(t,e){return t[e.id]=e.actions.map(function(t){return[t.business,t.name,t.param||null]}),t},{})}}),s.paths=this._jsplumb.getConnections()),n.t1=void 0,n.next=16,this._httpService.put("orders/flows/"+t,s).catch(r);case 16:if(n.t2=n.sent,n.t3=n.t1!==n.t2,!n.t3){n.next=28;break}if(!e){n.next=23;break}this._flow.name=o,n.next=28;break;case 23:return this._edit=!1,this._toastService.show(this._i18nService.translate("shared.notification.success")),n.next=27,this.refresh();case 27:this.select(this._flows.find(function(e){return e.id==t}));case 28:n.next=41;break;case 30:return l={name:o,nodes:[],paths:[]},n.next=33,this._httpService.post("orders/flows",l).catch(r);case 33:if(c=n.sent,n.t4=c,!n.t4){n.next=41;break}return this._edit=!1,this._toastService.show(this._i18nService.translate("shared.notification.success")),n.next=40,this.refresh();case 40:this.select(this._flows.find(function(t){return t.id==c}));case 41:case"end":return n.stop()}},n,this)}))},this.delete=function(){return Object(c.a)(s,void 0,void 0,regeneratorRuntime.mark(function t(){var e=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._dialogService.confirm(this._i18nService.translate("shared.notification.confirm"));case 2:if(t.t0=t.sent,!t.t0){t.next=9;break}return t.t1=void 0,t.next=7,this._httpService.delete("orders/flows/"+this._flow.id).catch(function(t){switch(t.status){case 422:e._toastService.show(e._i18nService.translate("shared.notification.fail"));break;case 423:e._toastService.show(e._i18nService.translate("routes.order.workflow.error.locked.id"));break;default:e._toastService.show(e._i18nService.translate("shared.notification.unknown"))}});case 7:t.t2=t.sent,t.t0=t.t1!==t.t2;case 9:if(t.t3=t.t0,!t.t3){t.next=16;break}return this._edit=!1,this._toastService.show(this._i18nService.translate("shared.notification.success")),t.next=15,this.refresh();case 15:this.select(this._flows[0]);case 16:case"end":return t.stop()}},t,this)}))},this._loading=!0}return s(t,[{key:"ngAfterViewInit",value:function(){var t=this;this._jsplumb=new at,this._jsplumb.init(this._canvas.getElementRef()),this._jsplumb.selectNode=function(e){(t._node=t._flow.nodes.find(function(t){return t.id==e.id}))&&t._sidenav.open()},this._jsplumb.dragNode=function(e){t._edit=!0},this._jsplumb.connectNodes=function(e){t._edit=!0},this._jsplumb.selectConnection=function(e){t._mouse=e.event,t._menuTirgger.menuData={$implicit:e.id},t._menuTirgger.openMenu()},this._jsplumb.label=function(e){return Object(c.a)(t,void 0,void 0,regeneratorRuntime.mark(function t(){var n;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._dialogService.prompt(this._i18nService.translate("routes.order.workflow.state"),e,{required:!0});case 2:return n=t.sent,t.abrupt("return",(null!=n&&(this._edit=!0),n));case 4:case"end":return t.stop()}},t,this)}))},this._httpService.get("orders/types").then(function(e){t._orders=e.items.reduce(function(t,e){return t[e.id]=e.name,t},{}),t.refresh().then(function(){t._flows.length&&t.select(t._flows[0])})})}},{key:"ngOnDestroy",value:function(){this._jsplumb.dispose()}},{key:"init",get:function(){return this._init}},{key:"loading",get:function(){return this._loading}},{key:"flows",get:function(){return this._flows}},{key:"flow",get:function(){return this._flow}},{key:"node",get:function(){return this._node}},{key:"mouse",get:function(){return this._mouse}},{key:"edit",get:function(){return this._edit}}]),t}()).\u0275fac=function(t){return new(t||qt)(f.Ob(m.a),f.Ob(g.a),f.Ob(v.a),f.Ob(b.a))},qt.\u0275cmp=f.Ib({type:qt,selectors:[["app-order-workflow"]],viewQuery:function(t,e){var n;1&t&&(f.Oc(Dt,!0),f.Oc(It,!0),f.Oc(Tt,!0)),2&t&&(f.tc(n=f.cc())&&(e._canvas=n.first),f.tc(n=f.cc())&&(e._sidenav=n.first),f.tc(n=f.cc())&&(e._menuTirgger=n.first))},decls:38,vars:24,consts:[[1,"grid",3,"loading"],[1,"row-auto"],[1,"app-background-card"],["mat-button","",3,"matMenuTriggerFor","disabled"],[4,"ngIf"],["$flows","matMenu"],["mat-menu-item","",3,"click",4,"ngFor","ngForOf"],[1,"spacer"],["mat-icon-button","",3,"matMenuTriggerFor","disabled","matTooltip"],["$menu","matMenu"],["mat-menu-item","",3,"click"],["mat-menu-item","",3,"click",4,"ngIf"],["mat-menu-item","",3,"disabled","click",4,"ngIf"],[1,"row-fill"],["hasBackdrop","false"],["mode","over","position","end","autoFocus","false"],["$nodeDetail",""],[3,"data","changed","removed"],[3,"click"],["$canvas",""],["mat-fab","","color","primary",3,"matTooltip","click",4,"ngIf"],[3,"matMenuTriggerFor"],["$menuTirgger","matMenuTrigger"],["$path","matMenu"],["matMenuContent",""],["class","node","hook","ngAfterViewInit",3,"id","ngClass","left","top","hookData","afterViewInit",4,"ngFor","ngForOf"],["mat-menu-item","",3,"disabled","click"],["mat-fab","","color","primary",3,"matTooltip","click"],["mat-menu-item","",1,"app-foreground-warn",3,"click"],["hook","ngAfterViewInit",1,"node",3,"id","ngClass","hookData","afterViewInit"],[3,"ngClass",4,"ngIf"],[4,"ngFor","ngForOf"],[3,"ngClass"]],template:function(t,e){if(1&t&&(f.Ub(0,"div",0),f.Ub(1,"div",1),f.Ub(2,"mat-toolbar",2),f.Ub(3,"button",3),f.Ub(4,"mat-icon"),f.Hc(5,"timeline"),f.Tb(),f.Fc(6,Ft,4,4,"span",4),f.Tb(),f.Ub(7,"mat-menu",null,5),f.Fc(9,Ut,2,1,"button",6),f.Tb(),f.Pb(10,"span",7),f.Ub(11,"button",8),f.gc(12,"translate"),f.Ub(13,"mat-icon"),f.Hc(14,"settings"),f.Tb(),f.Tb(),f.Ub(15,"mat-menu",null,9),f.Ub(17,"button",10),f.bc("click",function(){return e.save(0,!0)}),f.Hc(18),f.gc(19,"translate"),f.Tb(),f.Fc(20,Lt,3,3,"button",11),f.Fc(21,Ht,3,4,"button",12),f.Fc(22,Rt,3,3,"button",11),f.Tb(),f.Tb(),f.Pb(23,"mat-divider"),f.Tb(),f.Ub(24,"div",13),f.Ub(25,"mat-sidenav-container",14),f.Ub(26,"mat-sidenav",15,16),f.Ub(28,"app-order-workflow-node",17),f.bc("changed",function(t){return e.updateNode(t)})("removed",function(t){return e.removeNode(t)}),f.Tb(),f.Tb(),f.Ub(29,"mat-sidenav-content",18,19),f.bc("click",function(){return e.blur()}),f.Fc(31,Nt,4,3,"button",20),f.Pb(32,"span",21,22),f.Ub(34,"mat-menu",null,23),f.Fc(36,Gt,6,6,"ng-template",24),f.Tb(),f.Fc(37,Yt,9,16,"mat-card",25),f.Tb(),f.Tb(),f.Tb(),f.Tb()),2&t){var n=f.uc(8),i=f.uc(16),o=f.uc(35);f.lc("loading",e.loading),f.Cb(3),f.lc("matMenuTriggerFor",n)("disabled",!e.flow),f.Cb(3),f.lc("ngIf",!e.init),f.Cb(3),f.lc("ngForOf",e.flows),f.Cb(2),f.mc("matTooltip",f.hc(12,20,"routes.order.workflow.setting")),f.lc("matMenuTriggerFor",i)("disabled",e.loading),f.Cb(7),f.Ic(f.hc(19,22,"routes.order.workflow.add")),f.Cb(2),f.lc("ngIf",e.flow),f.Cb(1),f.lc("ngIf",e.flow),f.Cb(1),f.lc("ngIf",e.flow),f.Cb(6),f.lc("data",e.node),f.Cb(3),f.lc("ngIf",e.flow),f.Cb(1),f.Cc("left",null==e.mouse?null:e.mouse.x,"px")("top",null==e.mouse?null:e.mouse.y,"px"),f.lc("matMenuTriggerFor",o),f.Cb(5),f.lc("ngForOf",null==e.flow?null:e.flow.nodes)}},directives:[lt.a,ct.a,j.a,w.e,x.a,C.n,w.a,C.m,W.c,w.c,ut.a,dt.b,dt.a,Et,dt.c,w.b,kt.a,Mt.a,C.l,kt.f,kt.e],pipes:[S.d],styles:[".grid[_ngcontent-%COMP%]{display:flex;height:100%;flex-direction:column}.grid[_ngcontent-%COMP%] > .row-auto[_ngcontent-%COMP%]{flex:0 0 auto}.grid[_ngcontent-%COMP%] > .row-auto[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%] + .mat-divider[_ngcontent-%COMP%]{margin-top:-1px}.grid[_ngcontent-%COMP%] > .row-auto[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .mat-button[_ngcontent-%COMP%]:first-child{margin-left:-8px}.grid[_ngcontent-%COMP%] > .row-auto[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .mat-button[_ngcontent-%COMP%]:first-child .mat-icon[_ngcontent-%COMP%]{margin-right:12px}.grid[_ngcontent-%COMP%] > .row-auto[_ngcontent-%COMP%] .mat-toolbar[_ngcontent-%COMP%] .spacer[_ngcontent-%COMP%]{flex:1 1 auto}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%]{position:relative;flex:auto;overflow:hidden}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%]{position:relative;height:100%}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav[_ngcontent-%COMP%]{padding:24px;width:320px}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content.bg-grid[_ngcontent-%COMP%]{background-image:linear-gradient(90deg,transparent 23px,hsla(0,0%,60%,.1) 0),linear-gradient(0deg,transparent 23px,hsla(0,0%,60%,.1) 0);background-size:24px 24px}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content[_ngcontent-%COMP%] .mat-fab[_ngcontent-%COMP%]{position:fixed;right:24px;bottom:24px}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content[_ngcontent-%COMP%] .mat-menu-trigger[_ngcontent-%COMP%]{position:fixed}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content[_ngcontent-%COMP%] .mat-card.node[_ngcontent-%COMP%]{position:absolute;box-sizing:border-box;min-width:240px}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content[_ngcontent-%COMP%] .mat-card.node[_ngcontent-%COMP%] > .mat-card-title[_ngcontent-%COMP%]{display:flex;height:24px;align-items:flex-end;font-size:16px}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content[_ngcontent-%COMP%] .mat-card.node[_ngcontent-%COMP%] > .mat-card-title[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child{flex:1 0 auto;font-weight:700}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content[_ngcontent-%COMP%] .mat-card.node[_ngcontent-%COMP%] > .mat-card-subtitle[_ngcontent-%COMP%]{font-size:10px}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content[_ngcontent-%COMP%] .mat-card.node[_ngcontent-%COMP%] > .mat-card[_ngcontent-%COMP%]{margin-bottom:8px;padding:0 16px;border-radius:0;line-height:36px}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content[_ngcontent-%COMP%] .mat-card.node[_ngcontent-%COMP%] > .mat-card[_ngcontent-%COMP%]:first-of-type{margin-top:16px}.grid[_ngcontent-%COMP%] > .row-fill[_ngcontent-%COMP%] > .mat-sidenav-container[_ngcontent-%COMP%] .mat-sidenav-content[_ngcontent-%COMP%] .mat-card.node[_ngcontent-%COMP%] > .mat-card[_ngcontent-%COMP%]:last-of-type{margin-bottom:20px}"]}),qt),zt=r("Dh3D"),Jt=r("+0xr"),Zt=r("hbEN"),Kt=r("/1cH");function Qt(t,e){if(1&t&&(f.Ub(0,"mat-option",13),f.Ub(1,"span"),f.Hc(2),f.Tb(),f.Hc(3,"|"),f.Ub(4,"small"),f.Hc(5),f.Tb(),f.Tb()),2&t){var n=e.$implicit;f.lc("value",n.code),f.Cb(2),f.Ic(n.code),f.Cb(3),f.Ic(n.name)}}var te,ee=((te=function(){function t(e,n,i,r,s,a){var l=this;o(this,t),this._data=e,this._formBuilder=n,this._httpService=i,this._i18nService=r,this._toastService=s,this._dialogRef=a,this.autocomplete=Object(Zt.a)(function(){var t=l._form.controls.code.value;(null==t?void 0:t.length)>=3?l._httpService.get("materials?code=".concat(t,"&limit=50")).then(function(t){l._material=t.items}):l._material&&(l._material.length=0)},300),this.save=function(){return Object(c.a)(l,void 0,void 0,regeneratorRuntime.mark(function t(){var e,n=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:(e=this._material.find(function(t){return t.code==n._form.controls.code.value}))?(e.material=e.id,delete e.id,this._dialogRef.close(Object.assign(e,{code:this._form.controls.code.value,quantity:this._form.controls.quantity.value,batch:this._form.controls.batch.value,bill:this._form.controls.bill.value,supplier:this._form.controls.supplier.value}))):this._toastService.show("\u7269\u6599\u4e0d\u5b58\u5728");case 2:case"end":return t.stop()}},t,this)}))},this._form=this._formBuilder.group({code:[null==e?void 0:e.code,[d.u.required]],quantity:[null==e?void 0:e.quantity,[d.u.required,d.u.min(.001)]],batch:[null==e?void 0:e.batch],bill:[null==e?void 0:e.bill],supplier:[null==e?void 0:e.supplier]}),(null==e?void 0:e.code)&&this.autocomplete()}return s(t,[{key:"data",get:function(){return this._data}},{key:"form",get:function(){return this._form}},{key:"material",get:function(){return this._material}}]),t}()).\u0275fac=function(t){return new(t||te)(f.Ob(h.a),f.Ob(d.d),f.Ob(g.a),f.Ob(v.a),f.Ob(b.a),f.Ob(h.g))},te.\u0275cmp=f.Ib({type:te,selectors:[["app-order-instance-edit-line"]],decls:42,vars:32,consts:[["mat-dialog-title",""],["mat-dialog-content",""],["autocomplete","off",3,"formGroup"],["matInput","","formControlName","code","required","",3,"matAutocomplete","ngModelChange"],["$autocomplete","matAutocomplete"],[3,"value",4,"ngFor","ngForOf"],["type","number","matInput","","formControlName","quantity","min","0","required",""],["matInput","","formControlName","batch"],["matInput","","formControlName","bill"],["matInput","","formControlName","supplier"],["mat-dialog-actions","","align","end"],["mat-button","","color","primary",3,"disabled","click"],["mat-button","","mat-dialog-close",""],[3,"value"]],template:function(t,e){if(1&t&&(f.Ub(0,"h2",0),f.Hc(1),f.gc(2,"translate"),f.Tb(),f.Ub(3,"div",1),f.Ub(4,"form",2),f.Ub(5,"mat-form-field"),f.Ub(6,"mat-label"),f.Hc(7),f.gc(8,"translate"),f.Tb(),f.Ub(9,"input",3),f.bc("ngModelChange",function(){return e.autocomplete()}),f.Tb(),f.Ub(10,"mat-autocomplete",null,4),f.Fc(12,Qt,6,3,"mat-option",5),f.Tb(),f.Tb(),f.Ub(13,"mat-form-field"),f.Ub(14,"mat-label"),f.Hc(15),f.gc(16,"translate"),f.Tb(),f.Pb(17,"input",6),f.Tb(),f.Ub(18,"mat-form-field"),f.Ub(19,"mat-label"),f.Hc(20),f.gc(21,"translate"),f.Tb(),f.Pb(22,"input",7),f.Tb(),f.Ub(23,"mat-form-field"),f.Ub(24,"mat-label"),f.Hc(25),f.gc(26,"translate"),f.Tb(),f.Pb(27,"input",8),f.Tb(),f.Ub(28,"mat-form-field"),f.Ub(29,"mat-label"),f.Hc(30),f.gc(31,"translate"),f.Tb(),f.Pb(32,"input",9),f.Tb(),f.Tb(),f.Tb(),f.Ub(33,"div",10),f.Ub(34,"button",11),f.bc("click",function(){return e.save()}),f.Hc(35),f.gc(36,"uppercase"),f.gc(37,"translate"),f.Tb(),f.Ub(38,"button",12),f.Hc(39),f.gc(40,"uppercase"),f.gc(41,"translate"),f.Tb(),f.Tb()),2&t){var n=f.uc(11);f.Cb(1),f.Ic(f.hc(2,12,e.data?"shared.operation.edit":"shared.operation.add")),f.Cb(3),f.lc("formGroup",e.form),f.Cb(3),f.Ic(f.hc(8,14,"routes.material.code")),f.Cb(2),f.lc("matAutocomplete",n),f.Cb(3),f.lc("ngForOf",e.material),f.Cb(3),f.Ic(f.hc(16,16,"routes.material.qty")),f.Cb(5),f.Ic(f.hc(21,18,"routes.material.batch")),f.Cb(5),f.Ic(f.hc(26,20,"routes.material.bill")),f.Cb(5),f.Ic(f.hc(31,22,"routes.material.supplier")),f.Cb(4),f.lc("disabled",e.form.invalid),f.Cb(1),f.Ic(f.hc(36,24,f.hc(37,26,"shared.dialog.ok"))),f.Cb(4),f.Ic(f.hc(40,28,f.hc(41,30,"shared.dialog.cancel")))}},directives:[h.h,h.e,d.v,d.o,d.g,y.b,y.e,_.b,d.c,Kt.c,d.n,d.f,d.t,Kt.a,C.m,d.r,h.c,j.a,h.d,ft.o],pipes:[S.d,C.v],styles:[".mat-form-field[_ngcontent-%COMP%]{width:100%}.mat-option[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-right:8px}.mat-option[_ngcontent-%COMP%] [_ngcontent-%COMP%]:last-child{margin-left:8px}.mat-dialog-actions[_ngcontent-%COMP%]{margin-right:-8px}"]}),te),ne=r("wd/R"),ie=r("iadO"),oe=r("7OFo"),re=r("hZOD");function se(t,e){if(1&t&&(f.Ub(0,"mat-option",24),f.Hc(1),f.Tb()),2&t){var n=e.$implicit;f.lc("value",n.id),f.Cb(1),f.Ic(n.name)}}function ae(t,e){if(1&t&&(f.Ub(0,"mat-option",25),f.Hc(1),f.Tb()),2&t){var n=e.$implicit,i=f.fc();f.lc("value",n.id)("disabled",!n.enabled[i.form.controls.type.value]),f.Cb(1),f.Ic(n.name)}}function le(t,e){1&t&&f.Pb(0,"th",31)}function ce(t,e){if(1&t){var n=f.Vb();f.Ub(0,"td",32),f.Ub(1,"button",33),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc(3).edit(t)}),f.gc(2,"translate"),f.Ub(3,"mat-icon"),f.Hc(4,"edit"),f.Tb(),f.Tb(),f.Ub(5,"button",33),f.bc("click",function(){f.wc(n);var t=e.$implicit;return f.fc(3).delete(t)}),f.gc(6,"translate"),f.Ub(7,"mat-icon"),f.Hc(8,"delete"),f.Tb(),f.Tb(),f.Tb()}2&t&&(f.Cb(1),f.mc("matTooltip",f.hc(2,2,"shared.operation.edit")),f.Cb(4),f.mc("matTooltip",f.hc(6,4,"shared.operation.delete")))}function ue(t,e){1&t&&(f.Sb(0),f.Fc(1,le,1,0,"th",29),f.Fc(2,ce,9,6,"td",30),f.Rb())}function de(t,e){if(1&t&&(f.Ub(0,"th",35),f.Hc(1),f.gc(2,"translate"),f.Tb()),2&t){var n=f.fc(2).$implicit;f.Cb(1),f.Ic(f.hc(2,1,n.header))}}function he(t,e){if(1&t&&(f.Ub(0,"td",32),f.Hc(1),f.Tb()),2&t){var n=e.$implicit,i=f.fc(2).$implicit;f.Cb(1),f.Ic(n[i.id])}}function pe(t,e){1&t&&(f.Sb(0),f.Fc(1,de,3,3,"th",34),f.Fc(2,he,2,1,"td",30),f.Rb())}function fe(t,e){if(1&t&&(f.Sb(0,26),f.Fc(1,ue,3,0,"ng-container",27),f.Fc(2,pe,3,0,"ng-container",28),f.Rb()),2&t){var n=e.$implicit;f.lc("matColumnDef",n.id)("ngSwitch",n.id)("stickyEnd","operation"==n.id),f.Cb(1),f.lc("ngSwitchCase","operation")}}function me(t,e){1&t&&f.Pb(0,"tr",36)}function ge(t,e){1&t&&f.Pb(0,"tr",37)}function ve(t,e){if(1&t&&(f.Ub(0,"tr",38),f.Ub(1,"td",39),f.Hc(2),f.gc(3,"translate"),f.Tb(),f.Tb()),2&t){var n=f.fc();f.Cb(1),f.Db("colspan",n.columns.length),f.Cb(1),f.Ic(f.hc(3,2,"routes.order.instance.empty"))}}var be,ye=function(){return[4,2,2]},_e=function(t){return{delimiter:"-",blocks:t}},Pe=((be=function(){function t(n,i,r,s,a,l,u){var h=this;o(this,t),this._data=n,this._formBuilder=i,this._dialogService=r,this._httpService=s,this._i18nService=a,this._toastService=l,this._dialogRef=u,this.type=function(t){var e=Number.isInteger(t.value)?h._types.find(function(e){return e.id==t.value}):t.value;(null==e?void 0:e.no)?(h._form.controls.no.setValue("AUTOGENERATE"),h._form.controls.no.disable()):(h._form.controls.no.setValue(null),h._form.controls.no.enable())},this.edit=function(t){return Object(c.a)(h,void 0,void 0,regeneratorRuntime.mark(function n(){var i;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._dialogService.open(ee,{autoFocus:!t,data:t});case 2:(i=n.sent)&&(t?Object.assign(t,i):this._lines.data=[].concat(e(this._lines.data),[i]));case 4:case"end":return n.stop()}},n,this)}))},this.delete=function(t){return Object(c.a)(h,void 0,void 0,regeneratorRuntime.mark(function n(){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this._dialogService.confirm(this._i18nService.translate("shared.notification.confirm"));case 2:if(n.t0=n.sent,!n.t0){n.next=5;break}this._lines.data.splice(this._lines.data.indexOf(t),1),this._lines.data=e(this._lines.data);case 5:case"end":return n.stop()}},n,this)}))},this.save=function(){return Object(c.a)(h,void 0,void 0,regeneratorRuntime.mark(function t(){var e,n=this;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e={no:this.form.controls.no.value,type:this.form.controls.type.value,flow:this.form.controls.flow.value,creater:this.form.controls.creater.value,createTime:this.form.controls.createTime.value,lines:this._lines.data.map(function(t){return Object.assign({},t,{id:t.line})})},t.t0=this._dialogRef,!this._data.id){t.next=8;break}return t.next=5,this._httpService.put("orders/"+this._data.id,e).catch(function(t){var e;n._toastService.show((null===(e=t.error)||void 0===e?void 0:e.errorMessage)||"\u672a\u77e5\u9519\u8bef")});case 5:t.t1=t.sent,t.next=11;break;case 8:return t.next=10,this._httpService.post("orders",e).catch(function(t){var e;n._toastService.show((null===(e=t.error)||void 0===e?void 0:e.errorMessage)||"\u672a\u77e5\u9519\u8bef")});case 10:t.t1=t.sent;case 11:t.t2=t.t1,t.t0.close.call(t.t0,t.t2);case 13:case"end":return t.stop()}},t,this)}))},this._form=this._formBuilder.group({no:[{value:null,disabled:n.id},[d.u.required]],type:[{value:null,disabled:n.type},[d.u.required]],flow:[{value:null,disabled:n.id},[d.u.required]],creater:[{value:null,disabled:n.id}],createTime:[{value:null,disabled:n.id}]}),this._columns=[{id:"code",header:"routes.material.code"},{id:"name",header:"routes.material.name"},{id:"model",header:"routes.material.model"},{id:"quantity",header:"routes.material.qty"},{id:"unit",header:"routes.material.unit"},{id:"batch",header:"routes.material.batch"},{id:"bill",header:"routes.material.bill"},{id:"supplier",header:"routes.material.supplier"},{id:"brand",header:"routes.material.brand"},{id:"operation"}],this._lines=new Jt.l,n.id?(this._form.controls.no.setValue(n.no),this._form.controls.type.setValue(n.type),this._form.controls.flow.setValue(n.flow),this._form.controls.creater.setValue(n.creater),this._form.controls.createTime.setValue(n.createTime),this._httpService.get("orders/".concat(n.id,"/lines")).then(function(t){return h._lines.data=t.items})):(this._form.controls.createTime.setValue(ne()),this._lines.data=[],this._httpService.get("users/current").then(function(t){return h._form.controls.creater.setValue(t.name)})),this._httpService.join(this._httpService.get("orders/types"),this._httpService.get("orders/flows")).then(function(t){if(t[1].items.forEach(function(t){var e,n=null!==(e=t.enabled)&&void 0!==e?e:t.enabled={};t.nodes.forEach(function(t){for(var e in t.detail)n[e]=!0})}),h._types=t[0].items,h._flows=t[1].items,!n.id){var e=n.type&&h._types.find(function(t){return t.id==n.type});e&&(h._form.controls.type.setValue(e.id),h.type({value:e}))}})}return s(t,[{key:"ngAfterViewInit",value:function(){this._lines.sort=this._sort}},{key:"data",get:function(){return this._data}},{key:"form",get:function(){return this._form}},{key:"columns",get:function(){return this._columns}},{key:"lines",get:function(){return this._lines}},{key:"types",get:function(){return this._types}},{key:"flows",get:function(){return this._flows}}]),t}()).\u0275fac=function(t){return new(t||be)(f.Ob(h.a),f.Ob(d.d),f.Ob(m.a),f.Ob(g.a),f.Ob(v.a),f.Ob(b.a),f.Ob(h.g))},be.\u0275cmp=f.Ib({type:be,selectors:[["app-order-instance-edit"]],viewQuery:function(t,e){var n;1&t&&f.Oc(zt.a,!0),2&t&&f.tc(n=f.cc())&&(e._sort=n.first)},decls:59,vars:53,consts:[[1,"layout"],["mat-dialog-title",""],["mat-dialog-content","","autocomplete","off",3,"formGroup"],["matInput","","formControlName","no","required",""],["formControlName","type","required","",3,"selectionChange"],[3,"value",4,"ngFor","ngForOf"],["formControlName","flow","required",""],[3,"value","disabled",4,"ngFor","ngForOf"],["matInput","","formControlName","creater"],["matInput","","formControlName","createTime",3,"matDatepicker","cleave"],["matSuffix","",3,"for"],["$picker",""],["mat-dialog-actions",""],["mat-button","","color","primary",3,"disabled","click"],["mat-button","","mat-dialog-close",""],[3,"vertical"],[1,"app-background"],[1,"viewport"],["mat-table","","matSort","",3,"dataSource"],[3,"matColumnDef","ngSwitch","stickyEnd",4,"ngFor","ngForOf"],["mat-header-row","",4,"matHeaderRowDef","matHeaderRowDefSticky"],["mat-row","",4,"matRowDef","matRowDefColumns"],["class","mat-row",4,"matNoDataRow"],["mat-fab","","color","primary",3,"matTooltip","click"],[3,"value"],[3,"value","disabled"],[3,"matColumnDef","ngSwitch","stickyEnd"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],["mat-header-cell","",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["mat-header-cell",""],["mat-cell",""],["mat-icon-button","",3,"matTooltip","click"],["mat-header-cell","","mat-sort-header","",4,"matHeaderCellDef"],["mat-header-cell","","mat-sort-header",""],["mat-header-row",""],["mat-row",""],[1,"mat-row"],[1,"mat-cell","no-data"]],template:function(t,e){if(1&t&&(f.Ub(0,"div",0),f.Ub(1,"div"),f.Ub(2,"h2",1),f.Hc(3),f.gc(4,"translate"),f.Tb(),f.Ub(5,"form",2),f.Ub(6,"mat-form-field"),f.Ub(7,"mat-label"),f.Hc(8),f.gc(9,"translate"),f.Tb(),f.Pb(10,"input",3),f.Tb(),f.Ub(11,"mat-form-field"),f.Ub(12,"mat-label"),f.Hc(13),f.gc(14,"translate"),f.Tb(),f.Ub(15,"mat-select",4),f.bc("selectionChange",function(t){return e.type(t)}),f.Fc(16,se,2,2,"mat-option",5),f.Tb(),f.Tb(),f.Ub(17,"mat-form-field"),f.Ub(18,"mat-label"),f.Hc(19),f.gc(20,"translate"),f.Tb(),f.Ub(21,"mat-select",6),f.Fc(22,ae,2,3,"mat-option",7),f.Tb(),f.Tb(),f.Ub(23,"mat-form-field"),f.Ub(24,"mat-label"),f.Hc(25),f.gc(26,"translate"),f.Tb(),f.Pb(27,"input",8),f.Tb(),f.Ub(28,"mat-form-field"),f.Ub(29,"mat-label"),f.Hc(30),f.gc(31,"translate"),f.Tb(),f.Pb(32,"input",9),f.Pb(33,"mat-datepicker-toggle",10),f.Pb(34,"mat-datepicker",null,11),f.Tb(),f.Tb(),f.Ub(36,"div",12),f.Ub(37,"button",13),f.bc("click",function(){return e.save()}),f.Hc(38),f.gc(39,"uppercase"),f.gc(40,"translate"),f.Tb(),f.Ub(41,"button",14),f.Hc(42),f.gc(43,"uppercase"),f.gc(44,"translate"),f.Tb(),f.Tb(),f.Tb(),f.Pb(45,"mat-divider",15),f.Ub(46,"div",16),f.Ub(47,"div",17),f.Ub(48,"table",18),f.Fc(49,fe,3,4,"ng-container",19),f.Fc(50,me,1,0,"tr",20),f.gc(51,"field"),f.Fc(52,ge,1,0,"tr",21),f.gc(53,"field"),f.Fc(54,ve,4,4,"tr",22),f.Tb(),f.Ub(55,"button",23),f.bc("click",function(){return e.edit()}),f.gc(56,"translate"),f.Ub(57,"mat-icon"),f.Hc(58,"add"),f.Tb(),f.Tb(),f.Tb(),f.Tb(),f.Tb()),2&t){var n=f.uc(35);f.Cb(3),f.Ic(f.hc(4,22,e.data.id?"shared.operation.edit":"shared.operation.add")),f.Cb(2),f.lc("formGroup",e.form),f.Cb(3),f.Ic(f.hc(9,24,"routes.order.no")),f.Cb(5),f.Ic(f.hc(14,26,"routes.order.type.def")),f.Cb(3),f.lc("ngForOf",e.types),f.Cb(3),f.Ic(f.hc(20,28,"routes.order.flow")),f.Cb(3),f.lc("ngForOf",e.flows),f.Cb(3),f.Ic(f.hc(26,30,"routes.order.creater")),f.Cb(5),f.Ic(f.hc(31,32,"routes.order.created")),f.Cb(2),f.lc("matDatepicker",n)("cleave",f.pc(51,_e,f.oc(50,ye))),f.Cb(1),f.lc("for",n),f.Cb(4),f.lc("disabled",e.form.invalid||!e.lines.data.length),f.Cb(1),f.Ic(f.hc(39,34,f.hc(40,36,"shared.dialog.ok"))),f.Cb(4),f.Ic(f.hc(43,38,f.hc(44,40,"shared.dialog.cancel"))),f.Cb(3),f.lc("vertical",!0),f.Cb(3),f.lc("dataSource",e.lines),f.Cb(1),f.lc("ngForOf",e.columns),f.Cb(1),f.lc("matHeaderRowDef",f.ic(51,42,e.columns,"id"))("matHeaderRowDefSticky",!0),f.Cb(2),f.lc("matRowDefColumns",f.ic(53,45,e.columns,"id")),f.Cb(3),f.mc("matTooltip",f.hc(56,48,"routes.order.instance.add"))}},directives:[h.h,d.v,d.o,h.e,d.g,y.b,y.e,_.b,d.c,d.n,d.f,d.t,pt.a,C.m,ie.g,oe.a,ie.j,y.f,ie.f,h.c,j.a,h.d,ut.a,Jt.k,zt.a,Jt.g,Jt.j,Jt.h,W.c,x.a,ft.o,Jt.c,C.p,C.q,C.r,Jt.e,Jt.b,Jt.d,Jt.a,zt.b,Jt.f,Jt.i],pipes:[S.d,C.v,re.a],styles:[".layout[_ngcontent-%COMP%]{display:flex;margin:0 -24px;height:100%}.layout[_ngcontent-%COMP%] > .mat-divider-vertical[_ngcontent-%COMP%]{margin:-24px 0}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child{display:flex;padding:0 24px;width:280px;flex:0 0 auto;flex-direction:column}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child .mat-dialog-title[_ngcontent-%COMP%]{flex:0 0 auto}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child .mat-dialog-content[_ngcontent-%COMP%]{max-height:none;flex:1 1 auto}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child .mat-dialog-content[_ngcontent-%COMP%] .mat-form-field[_ngcontent-%COMP%]{width:100%}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:first-child .mat-dialog-actions[_ngcontent-%COMP%]{margin-left:-8px;flex:0 0 auto}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child{margin:-24px 0;position:relative;flex:1 1 auto;overflow:hidden}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child .viewport[_ngcontent-%COMP%]{height:100%;overflow:auto}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child .viewport[_ngcontent-%COMP%] .mat-table[_ngcontent-%COMP%]{padding-top:56px;width:100%}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child .viewport[_ngcontent-%COMP%] .mat-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%], .layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child .viewport[_ngcontent-%COMP%] .mat-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{padding-right:56px;white-space:nowrap}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child .viewport[_ngcontent-%COMP%] .mat-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:last-child, .layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child .viewport[_ngcontent-%COMP%] .mat-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:last-child{padding-left:16px;padding-right:16px;width:80px}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child .viewport[_ngcontent-%COMP%] .mat-table[_ngcontent-%COMP%] td.no-data[_ngcontent-%COMP%], .layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child .viewport[_ngcontent-%COMP%] .mat-table[_ngcontent-%COMP%] th.no-data[_ngcontent-%COMP%]{position:absolute;width:100%;height:48px;padding:0;text-align:center;line-height:48px}.layout[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:last-child .mat-fab[_ngcontent-%COMP%]{position:absolute;right:24px;bottom:24px;z-index:1}"]}),be),Ce=function(){function t(e,n,i,r){o(this,t),this._dialogService=e,this._httpService=n,this._i18nService=i,this._toastService=r}return s(t,[{key:"invoke",value:function(t,e,n){return Object(c.a)(this,void 0,void 0,regeneratorRuntime.mark(function i(){return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.abrupt("return",this[e](t,n));case 4:return i.prev=4,i.t0=i.catch(0),i.abrupt("return",this._dialogService.alert("TODO: \u6267\u884c".concat(e,"\u4e1a\u52a1")));case 7:case"end":return i.stop()}},i,this,[[0,4]])}))}},{key:"edit",value:function(t,e){return Object(c.a)(this,void 0,void 0,regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._dialogService.open(Pe,{autoFocus:!1,data:t,height:"90vh",maxWidth:"90vw",width:"90vw"});case 2:return e.t0=e.sent,e.abrupt("return",null===e.t0);case 4:case"end":return e.stop()}},e,this)}))}},{key:"cancel",value:function(t,e){return Object(c.a)(this,void 0,void 0,regeneratorRuntime.mark(function e(){var n=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._dialogService.confirm(this._i18nService.translate("shared.notification.confirm"));case 2:if(!e.sent){e.next=7;break}return e.next=5,this._httpService.delete("orders/"+-t.id).catch(function(t){var e;n._toastService.show((null===(e=t.error)||void 0===e?void 0:e.errorMessage)||n._i18nService.translate("shared.notification.unknown"))});case 5:return e.t0=e.sent,e.abrupt("return",null===e.t0);case 7:case"end":return e.stop()}},e,this)}))}}]),t}(),xe=r("wZkO"),we=["$order"],je=["$line"],Se=["$map"],Oe=["$time"],Ee=["$flow"],ke=["$node"];function Me(t,e){if(1&t&&(f.Sb(0),f.Hc(1),f.Rb()),2&t){var n=f.fc().$implicit,i=f.fc();f.Cb(1),f.Ic(null==i.types[n.type]?null:i.types[n.type].name)}}function De(t,e){if(1&t&&(f.Sb(0),f.Hc(1),f.Rb()),2&t){var n=f.fc().$implicit,i=f.fc();f.Cb(1),f.Ic(null==i.flows[n.flow]?null:i.flows[n.flow].name)}}function Ie(t,e){if(1&t&&(f.Sb(0),f.Hc(1),f.Rb()),2&t){var n=f.fc().$implicit,i=f.fc();f.Cb(1),f.Ic(null==i.flows[n.flow]||null==i.flows[n.flow].nodes[n.node]?null:i.flows[n.flow].nodes[n.node].name)}}function Te(t,e){1&t&&(f.Sb(0,12),f.Fc(1,Me,2,1,"ng-container",13),f.Fc(2,De,2,1,"ng-container",13),f.Fc(3,Ie,2,1,"ng-container",13),f.Rb()),2&t&&(f.lc("ngSwitch",e.field.id),f.Cb(1),f.lc("ngSwitchCase","type"),f.Cb(1),f.lc("ngSwitchCase","flow"),f.Cb(1),f.lc("ngSwitchCase","node"))}function Ae(t,e){1&t&&(f.Hc(0),f.gc(1,"date")),2&t&&f.Ic(f.ic(1,1,e.$implicit[e.field.id],"yyyy-MM-dd"))}function Fe(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",18),f.bc("click",function(){f.wc(n);var t=e.$implicit,i=f.fc(2).$implicit;return f.fc().action(i,t[0],t[2])}),f.Hc(1),f.Tb()}if(2&t){var i=e.$implicit;f.Cb(1),f.Ic(i[1])}}function Ue(t,e){if(1&t&&(f.Ub(0,"button",15),f.gc(1,"translate"),f.Ub(2,"mat-icon"),f.Hc(3,"arrow_drop_down_circle"),f.Tb(),f.Ub(4,"mat-menu",null,16),f.Fc(6,Fe,2,1,"button",17),f.Tb(),f.Tb()),2&t){var n=f.uc(5),i=f.fc().$implicit;f.mc("matTooltip",f.hc(1,3,"routes.order.action")),f.lc("matMenuTriggerFor",n),f.Cb(6),f.lc("ngForOf",i.action)}}function Le(t,e){if(1&t){var n=f.Vb();f.Fc(0,Ue,7,5,"button",14),f.Ub(1,"button",8),f.bc("click",function(){f.wc(n);var t=e.$implicit,i=f.fc();return i.order=t,i.tab=1}),f.gc(2,"translate"),f.Ub(3,"mat-icon"),f.Hc(4,"more_horiz"),f.Tb(),f.Tb()}2&t&&(f.lc("ngIf",e.$implicit.action.length),f.Cb(1),f.mc("matTooltip",f.hc(2,2,"routes.order.line")))}function He(t,e){if(1&t&&(f.Ub(0,"mat-option",22),f.Hc(1),f.Tb()),2&t){var n=e.$implicit;f.lc("value",n.key),f.Cb(1),f.Ic(n.value.name)}}function Re(t,e){if(1&t&&(f.Ub(0,"mat-form-field",19),f.Ub(1,"mat-label"),f.Hc(2),f.gc(3,"translate"),f.Tb(),f.Ub(4,"mat-select",20),f.bc("selectionChange",function(){return e.$implicit.controls.node.setValue(null)}),f.Pb(5,"mat-option"),f.Fc(6,He,2,2,"mat-option",21),f.gc(7,"keyvalue"),f.Tb(),f.Tb()),2&t){var n=e.$implicit,i=f.fc();f.lc("formGroup",n),f.Cb(2),f.Ic(f.hc(3,3,"routes.order.flow")),f.Cb(4),f.lc("ngForOf",f.hc(7,5,i.flows))}}function Ne(t,e){if(1&t&&(f.Ub(0,"mat-option",22),f.Hc(1),f.Tb()),2&t){var n=e.$implicit;f.lc("value",n.key),f.Cb(1),f.Ic(n.value.name)}}function Ge(t,e){if(1&t&&(f.Ub(0,"mat-form-field",19),f.Ub(1,"mat-label"),f.Hc(2),f.gc(3,"translate"),f.Tb(),f.Ub(4,"mat-select",23),f.Pb(5,"mat-option"),f.Fc(6,Ne,2,2,"mat-option",21),f.gc(7,"keyvalue"),f.Tb(),f.Tb()),2&t){var n=e.$implicit,i=f.fc();f.lc("formGroup",n),f.Cb(2),f.Ic(f.hc(3,3,"routes.order.node")),f.Cb(4),f.lc("ngForOf",f.hc(7,5,null==i.flows[n.controls.flow.value]?null:i.flows[n.controls.flow.value].nodes))}}function Be(t,e){if(1&t){var n=f.Vb();f.Ub(0,"button",26),f.bc("click",function(){f.wc(n);var t=e.$implicit,i=f.fc(2);return i.action(i.order,t[0],t[2])}),f.Hc(1),f.Tb()}if(2&t){var i=e.$implicit;f.Cb(1),f.Ic(i[1])}}function $e(t,e){if(1&t&&(f.Fc(0,Be,2,1,"button",24),f.Pb(1,"span",25)),2&t){var n=f.fc();f.lc("ngForOf",null==n.order?null:n.order.action)}}var Ve,Xe,Ye,qe=((Ve=function(){function t(e,n,i,r,s){var a=this;o(this,t),this._activatedRoute=e,this._dialogService=n,this._httpService=i,this._i18nService=r,this._toastService=s,this.add=function(){return Object(c.a)(a,void 0,void 0,regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._dialogService.open(Pe,{autoFocus:!1,data:{type:this._type},height:"90vh",maxWidth:"90vw",width:"90vw"});case 2:if(t.t0=t.sent,!t.t0){t.next=5;break}this._toastService.show(this._i18nService.translate("shared.notification.success")),this._orderTable.refresh();case 5:case"end":return t.stop()}},t,this)}))},this.action=function(t,e,n){return Object(c.a)(a,void 0,void 0,regeneratorRuntime.mark(function i(){return regeneratorRuntime.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this._action.invoke(t,e,n);case 2:if(i.t0=i.sent,!i.t0){i.next=5;break}this._toastService.show(this._i18nService.translate("shared.notification.success")),this._orderTable.refresh();case 5:case"end":return i.stop()}},i,this)}))},this._tab=0,this._activatedRoute.params.subscribe(function(t){a._type=t.type,a._init&&a.ngAfterViewInit()}),this._action=new Ce(n,i,r,s)}return s(t,[{key:"ngAfterViewInit",value:function(){var t=this;this._init?(this._tab=0,this._orderTable.addable=this._types[this._type],this._orderTable.query="type="+this._type,this._orderTable.refresh()):this._httpService.join(this._httpService.get("orders/types"),this._httpService.get("orders/flows")).then(function(e){t._types=e[0].items.reduce(function(t,e){return t[e.id]=e,t},{}),t._flows=e[1].items.reduce(function(t,e){return e.nodes=e.nodes.reduce(function(t,e){return t[e.id]=e,t},{}),t[e.id]=e,t},{});var n=[{id:"no",header:"routes.order.no",filter:{field:"text"}},{id:"type",header:"routes.order.type.def",template:t._mapColumn,filter:{field:"select",range:Object.values(t._types)}},{id:"flow",header:"routes.order.flow",template:t._mapColumn,filter:{field:"select",template:t._flowControl}},{id:"node",header:"routes.order.node",template:t._mapColumn,filter:{field:"select",template:t._nodeControl}},{id:"creater",header:"routes.order.creater",filter:{field:"text"}},{id:"createTime",header:"routes.order.created",template:t._timeColumn,filter:{field:"date-range",range:void 0}}],i=!0;t._type&&(n.splice(1,1),t._types[t._type]||(i=!1)),t._orderTable.defination=n,t._orderTable.addable=i,t._orderTable.query=t._type&&"type="+t._type,t._orderTable.api="orders",t._orderTable.edit=t.add,n=[{id:"code",header:"routes.material.code"},{id:"name",header:"routes.material.name"},{id:"model",header:"routes.material.model"},{id:"quantity",header:"routes.material.qty"},{id:"executing",header:"routes.order.instance.executing"},{id:"finished",header:"routes.order.instance.finished"},{id:"unit",header:"routes.material.unit"},{id:"batch",header:"routes.material.batch"},{id:"bill",header:"routes.material.bill"},{id:"supplier",header:"routes.material.supplier"},{id:"brand",header:"routes.material.brand"}],t._lineTable.defination=n,t._init=!0})}},{key:"types",get:function(){return this._types}},{key:"flows",get:function(){return this._flows}},{key:"order",get:function(){return this._order},set:function(t){this._order=t}},{key:"tab",get:function(){return this._tab},set:function(t){this._tab=t,t&&(this._lineTable.api="orders/".concat(this._order.id,"/lines"),this._lineTable.refresh())}}]),t}()).\u0275fac=function(t){return new(t||Ve)(f.Ob(l.a),f.Ob(m.a),f.Ob(g.a),f.Ob(v.a),f.Ob(b.a))},Ve.\u0275cmp=f.Ib({type:Ve,selectors:[["app-order-instance"]],viewQuery:function(t,e){var n;1&t&&(f.Oc(we,!0),f.Oc(je,!0),f.Oc(Se,!0),f.Oc(Oe,!0),f.Oc(Ee,!0),f.Oc(ke,!0)),2&t&&(f.tc(n=f.cc())&&(e._orderTable=n.first),f.tc(n=f.cc())&&(e._lineTable=n.first),f.tc(n=f.cc())&&(e._mapColumn=n.first),f.tc(n=f.cc())&&(e._timeColumn=n.first),f.tc(n=f.cc())&&(e._flowControl=n.first),f.tc(n=f.cc())&&(e._nodeControl=n.first))},decls:32,vars:24,consts:[[3,"selectedIndex"],[3,"selectable","addable","editable","deletable","row-operation-template"],["$order",""],["$map",""],["$time",""],["$op",""],["$flow",""],["$node",""],["mat-icon-button","",3,"matTooltip","click"],[3,"selectable","addable","editable","deletable","toolbar-template"],["$line",""],["$action",""],[3,"ngSwitch"],[4,"ngSwitchCase"],["mat-icon-button","",3,"matMenuTriggerFor","matTooltip",4,"ngIf"],["mat-icon-button","",3,"matMenuTriggerFor","matTooltip"],["$action","matMenu"],["mat-menu-item","",3,"click",4,"ngFor","ngForOf"],["mat-menu-item","",3,"click"],[3,"formGroup"],["formControlName","flow",3,"selectionChange"],[3,"value",4,"ngFor","ngForOf"],[3,"value"],["formControlName","node"],["mat-button","","color","primary",3,"click",4,"ngFor","ngForOf"],[1,"spacer"],["mat-button","","color","primary",3,"click"]],template:function(t,e){if(1&t&&(f.Ub(0,"mat-tab-group",0),f.Ub(1,"mat-tab"),f.Ub(2,"crud-template",1,2),f.Fc(4,Te,4,4,"ng-template",null,3,f.Gc),f.Fc(6,Ae,2,4,"ng-template",null,4,f.Gc),f.Fc(8,Le,5,4,"ng-template",null,5,f.Gc),f.Fc(10,Re,8,7,"ng-template",null,6,f.Gc),f.Fc(12,Ge,8,7,"ng-template",null,7,f.Gc),f.Tb(),f.Tb(),f.Ub(14,"mat-tab"),f.Ub(15,"mat-card"),f.Ub(16,"mat-card-subtitle"),f.Hc(17),f.Tb(),f.Ub(18,"mat-card-title"),f.Hc(19),f.Tb(),f.Ub(20,"mat-card-content"),f.Hc(21),f.gc(22,"translate"),f.gc(23,"date"),f.Tb(),f.Ub(24,"button",8),f.bc("click",function(){return e.tab=0}),f.gc(25,"translate"),f.Ub(26,"mat-icon"),f.Hc(27,"reply"),f.Tb(),f.Tb(),f.Tb(),f.Ub(28,"crud-template",9,10),f.Fc(30,$e,2,1,"ng-template",null,11,f.Gc),f.Tb(),f.Tb(),f.Tb()),2&t){var n=f.uc(9),i=f.uc(31);f.lc("selectedIndex",e.tab),f.Cb(2),f.lc("selectable",!1)("addable",!1)("editable",!1)("deletable",!1)("row-operation-template",n),f.Cb(15),f.Ic(e.flows&&(null==e.flows[null==e.order?null:e.order.flow]?null:e.flows[null==e.order?null:e.order.flow].name)),f.Cb(2),f.Ic(null==e.order?null:e.order.no),f.Cb(2),f.Lc("",null==e.order?null:e.order.creater," ",f.hc(22,17,"routes.order.instance.created")," ",f.ic(23,19,null==e.order?null:e.order.createTime,"yyyy-MM-dd"),""),f.Cb(3),f.mc("matTooltip",f.hc(25,22,"routes.order.instance.return")),f.Cb(4),f.lc("selectable",!1)("addable",!1)("editable",!1)("deletable",!1)("toolbar-template",i)}},directives:[xe.b,xe.a,q.a,kt.a,kt.e,kt.f,kt.b,j.a,W.c,x.a,C.p,C.q,C.n,w.e,w.a,C.m,w.c,y.b,d.o,d.g,y.e,pt.a,d.n,d.f,ft.o],pipes:[S.d,C.e,C.g],styles:[".mat-tab-group[_ngcontent-%COMP%]{height:100%}.mat-tab-group[_ngcontent-%COMP%] .mat-tab-header{display:none}.mat-tab-group[_ngcontent-%COMP%] .mat-tab-body-wrapper{height:100%}.mat-tab-group[_ngcontent-%COMP%] .mat-tab-body-wrapper .mat-tab-body-content{display:flex;position:relative;flex-direction:column;overflow:hidden}.mat-tab-group[_ngcontent-%COMP%] .mat-card[_ngcontent-%COMP%]{padding:24px 24px 0;flex:0 0 auto;border-radius:0;box-shadow:none}.mat-tab-group[_ngcontent-%COMP%] .mat-card[_ngcontent-%COMP%] .mat-card-content[_ngcontent-%COMP%]{margin-top:12px;margin-bottom:0}.mat-tab-group[_ngcontent-%COMP%] .mat-card[_ngcontent-%COMP%] .mat-icon-button[_ngcontent-%COMP%]{position:absolute;top:16px;right:16px}.mat-tab-group[_ngcontent-%COMP%] .crud-template[_ngcontent-%COMP%]{height:0;flex:1 1 auto}.mat-tab-group[_ngcontent-%COMP%] .spacer[_ngcontent-%COMP%]{flex:1 1 auto}"]}),Ve),We=[{path:"type",component:rt},{path:"workflow",component:Wt},{path:"instance",component:qe},{path:"instance/:type",component:qe}],ze=((Xe=function t(){o(this,t)}).\u0275mod=f.Mb({type:Xe}),Xe.\u0275inj=f.Lb({factory:function(t){return new(t||Xe)},imports:[[l.h.forChild(We)],l.h]}),Xe),Je=r("95ze"),Ze=((Ye=function t(){o(this,t)}).\u0275mod=f.Mb({type:Ye}),Ye.\u0275inj=f.Lb({factory:function(t){return new(t||Ye)},imports:[[a.a,ze,Je.a]]}),Ye)}}])}();
|