!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);n0?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=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;mu?u=p:p0?1:-1,a=null;o=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:to};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-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-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;i0){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;i0)for(var r=0;r0&&it&&e.setPosition(L,it),et.sort(M);for(var o=0;oe.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;n0},u=(this.getMatchingDroppables=function(t){for(var e=[],n={},i=0;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-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-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;o2)for(o=2;o>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;ne.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;l0)for(var t=0;t0){var s=Array.prototype.slice.call(arguments,1);try{for(var a=0,l=o.length;a0?-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;c0&&!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;a0&&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=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;m0;)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;l0)for(var e=0;e0?"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;n0){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;m0&&!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;i0)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-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;ue.dist?1:0});for(var g=h[0].source,v=h[0].target,b=0;b0?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;h0?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)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.startAngle0?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;n0?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=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;em?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,"
")}else null==this.labelText&&(this.labelText=this.label,this.getElement().innerHTML=this.labelText.replace(/\r\n/g,"
"))},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;o0?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;t0&&s0&&a0&&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.startStubXn.endStubY&&n.ty>n.startStubY||n.sy>n.endStubY&&n.ty>n.sy)||-1===n.so[i]&&(n.startStubYi[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||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]&&os?{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=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]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;o0?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;c0){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;r0||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)}}])}();