You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
68 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@angular/cdk/coercion"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-flowchart",["exports","@angular/core","rxjs","rxjs/operators","@angular/cdk/coercion","@angular/common"],t):t((e=e||self)["ngx-flowchart"]={},e.ng.core,e.rxjs,e.rxjs.operators,e.ng.cdk.coercion,e.ng.common)}(this,(function(e,t,n,o,i,r){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function a(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var d=function(){return(d=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function c(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}var l=new t.InjectionToken("fc-node.component.config"),g={htmlPrefix:"fc",leftConnectorType:"leftConnector",rightConnectorType:"rightConnector",curvedStyle:"curved",lineStyle:"line",dragAnimationRepaint:"repaint",dragAnimationShadow:"shadow",canvasClass:"fc-canvas",selectedClass:"fc-selected",editClass:"fc-edit",activeClass:"fc-active",hoverClass:"fc-hover",draggingClass:"fc-dragging",edgeClass:"fc-edge",edgeLabelClass:"fc-edge-label",connectorClass:"fc-connector",magnetClass:"fc-magnet",nodeClass:"fc-node",nodeOverlayClass:"fc-node-overlay",leftConnectorClass:"fc-leftConnectors",rightConnectorClass:"fc-rightConnectors",canvasResizeThreshold:200,canvasResizeStep:200},h=function(){Error.apply(this,arguments)};Object.defineProperty(h,"prototype",new Error);var u=function(e){function t(t){var n=e.call(this)||this;return n.message=t,n}return a(t,e),t}(h);function f(e){var t,n,o,i,r={};e.nodes.forEach((function(e){r[e.id]={incoming:0,outgoing:[]}})),e.edges.forEach((function(t){var n=e.nodes.filter((function(e){return e.connectors.some((function(e){return e.id===t.source}))}))[0],o=e.nodes.filter((function(e){return e.connectors.some((function(e){return e.id===t.destination}))}))[0];r[n.id].outgoing.push(o.id),r[o.id].incoming++}));var s=[],a=[];try{for(var d=c(Object.keys(r)),l=d.next();!l.done;l=d.next()){var g=l.value;0===r[g].incoming&&a.push(g)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}for(;0!==a.length;){for(var h=a.pop(),u=0;u<r[h].outgoing.length;u++){var f=r[h].outgoing[u];r[f].incoming--,0===r[f].incoming&&a.push(f),r[h].outgoing.splice(u,1),u--}s.push(h)}var p=!1;try{for(var m=c(Object.keys(r)),v=m.next();!v.done;v=m.next()){g=v.value;0!==r[g].incoming&&(p=!0)}}catch(e){o={error:e}}finally{try{v&&!v.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}return p?null:s}var p=function(){function e(e,t,i,r,s,a,c,l,g,h,u,f){var p=this;this.connectorsRectInfos={},this.nodesHtmlElements={},this.canvasHtmlElement=null,this.dragImage=null,this.svgHtmlElement=null,this.debouncer=new n.Subject,this.modelValidation=e,this.model=t,this.modelChanged=i,this.detectChangesSubject=r,this.canvasHtmlElement=u,this.svgHtmlElement=f,this.modelValidation.validateModel(this.model),this.selectedObjects=s,this.dropNode=a||function(){},this.createEdge=c||function(e,t){return n.of(d(d({},t),{label:"label"}))},this.edgeAddedCallback=l||function(){},this.nodeRemovedCallback=g||function(){},this.edgeRemovedCallback=h||function(){},this.connectors=new v(this),this.nodes=new y(this),this.edges=new C(this),this.debouncer.pipe(o.debounceTime(100)).subscribe((function(){return p.modelChanged.emit()}))}return e.prototype.notifyModelChanged=function(){this.debouncer.next()},e.prototype.detectChanges=function(){var e=this;setTimeout((function(){e.detectChangesSubject.next()}),0)},e.prototype.selectObject=function(e){this.isEditable()&&-1===this.selectedObjects.indexOf(e)&&this.selectedObjects.push(e)},e.prototype.deselectObject=function(e){if(this.isEditable()){var t=this.selectedObjects.indexOf(e);if(-1===t)throw new Error("Tried to deselect an unselected object");this.selectedObjects.splice(t,1)}},e.prototype.toggleSelectedObject=function(e){this.isSelectedObject(e)?this.deselectObject(e):this.selectObject(e)},e.prototype.isSelectedObject=function(e){return-1!==this.selectedObjects.indexOf(e)},e.prototype.selectAll=function(){var e=this;this.model.nodes.forEach((function(t){t.readonly||e.nodes.select(t)})),this.model.edges.forEach((function(t){e.edges.select(t)})),this.detectChanges()},e.prototype.deselectAll=function(){this.selectedObjects.splice(0,this.selectedObjects.length),this.detectChanges()},e.prototype.isEditObject=function(e){return 1===this.selectedObjects.length&&-1!==this.selectedObjects.indexOf(e)},e.prototype.inRectBox=function(e,t,n){return e>=n.left&&e<=n.right&&t>=n.top&&t<=n.bottom},e.prototype.getItemInfoAtPoint=function(e,t){return{node:this.getNodeAtPoint(e,t),edge:this.getEdgeAtPoint(e,t)}},e.prototype.getNodeAtPoint=function(e,t){var n,o;try{for(var i=c(this.model.nodes),r=i.next();!r.done;r=i.next()){var s=r.value,a=this.nodes.getHtmlElement(s.id).getBoundingClientRect();if(e>=a.left&&e<=a.right&&t>=a.top&&t<=a.bottom)return s}}catch(e){n={error:e}}finally{try{r&&!r.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}return null},e.prototype.getEdgeAtPoint=function(e,t){var n=document.elementFromPoint(e,t).id,o=-1;return n&&(n.startsWith("fc-edge-path-")?o=Number(n.substring("fc-edge-path-".length)):n.startsWith("fc-edge-label-")&&(o=Number(n.substring("fc-edge-label-".length)))),o>-1?this.model.edges[o]:null},e.prototype.selectAllInRect=function(e){var t=this;this.model.nodes.forEach((function(n){var o=t.nodes.getHtmlElement(n.id).getBoundingClientRect();if(!n.readonly){var i=o.left+o.width/2,r=o.top+o.height/2;t.inRectBox(i,r,e)?t.nodes.select(n):t.nodes.isSelected(n)&&t.nodes.deselect(n)}}));var n=this.canvasHtmlElement.getBoundingClientRect();this.model.edges.forEach((function(o){var i=t.edges.sourceCoord(o),r=t.edges.destCoord(o),s=(i.x+r.x)/2+n.left,a=(i.y+r.y)/2+n.top;t.inRectBox(s,a,e)?t.edges.select(o):t.edges.isSelected(o)&&t.edges.deselect(o)}))},e.prototype.deleteSelected=function(){var e=this;this.edges.getSelectedEdges().forEach((function(t){e.edges.delete(t)})),this.nodes.getSelectedNodes().forEach((function(t){e.nodes.delete(t)}))},e.prototype.isEditable=function(){return void 0===this.dropTargetId},e.prototype.isDropSource=function(){return void 0!==this.dropTargetId},e.prototype.getDragImage=function(){return this.dragImage||(this.dragImage=new Image,this.dragImage.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",this.dragImage.style.visibility="hidden"),this.dragImage},e}(),m=function(){function e(e){this.modelService=e}return e.prototype.select=function(e){this.modelService.selectObject(e)},e.prototype.deselect=function(e){this.modelService.deselectObject(e)},e.prototype.toggleSelected=function(e){this.modelService.toggleSelectedObject(e)},e.prototype.isSelected=function(e){return this.modelService.isSelectedObject(e)},e.prototype.isEdit=function(e){return this.modelService.isEditObject(e)},e}(),v=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.getConnector=function(e){var t,n,o,i,r=this.modelService.model;try{for(var s=c(r.nodes),a=s.next();!a.done;a=s.next()){var d=a.value;try{for(var l=(o=void 0,c(d.connectors)),g=l.next();!g.done;g=l.next()){var h=g.value;if(h.id===e)return h}}catch(e){o={error:e}}finally{try{g&&!g.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}},t.prototype.getConnectorRectInfo=function(e){return this.modelService.connectorsRectInfos[e]},t.prototype.setConnectorRectInfo=function(e,t){this.modelService.connectorsRectInfos[e]=t,this.modelService.detectChanges()},t.prototype._getCoords=function(e,t){var n=this.getConnectorRectInfo(e),o=this.modelService.canvasHtmlElement;if(null==n||null===o)return{x:0,y:0};var i=n.type===g.leftConnectorType?n.nodeRectInfo.left():n.nodeRectInfo.right(),r=n.nodeRectInfo.top()+n.nodeRectInfo.height()/2;return t||(i-=n.width/2,r-=n.height/2),{x:Math.round(i),y:Math.round(r)}},t.prototype.getCoords=function(e){return this._getCoords(e,!1)},t.prototype.getCenteredCoord=function(e){return this._getCoords(e,!0)},t}(m),y=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.getConnectorsByType=function(e,t){return e.connectors.filter((function(e){return e.type===t}))},t.prototype._addConnector=function(e,t){e.connectors.push(t);try{this.modelService.modelValidation.validateNode(e)}catch(n){throw e.connectors.splice(e.connectors.indexOf(t),1),n}},t.prototype.delete=function(e){this.isSelected(e)&&this.deselect(e);var t=this.modelService.model,n=t.nodes.indexOf(e);if(-1===n){if(void 0===e)throw new Error("Passed undefined");throw new Error("Tried to delete not existing node")}for(var o=this.getConnectorIds(e),i=0;i<t.edges.length;i++){var r=t.edges[i];-1===o.indexOf(r.source)&&-1===o.indexOf(r.destination)||(this.modelService.edges.delete(r),i--)}t.nodes.splice(n,1),this.modelService.notifyModelChanged(),this.modelService.nodeRemovedCallback(e)},t.prototype.getSelectedNodes=function(){var e=this;return this.modelService.model.nodes.filter((function(t){return e.modelService.nodes.isSelected(t)}))},t.prototype.handleClicked=function(e,t){t?this.modelService.nodes.toggleSelected(e):(this.modelService.deselectAll(),this.modelService.nodes.select(e))},t.prototype._addNode=function(e){var t=this.modelService.model;try{t.nodes.push(e),this.modelService.modelValidation.validateNodes(t.nodes)}catch(n){throw t.nodes.splice(t.nodes.indexOf(e),1),n}},t.prototype.getConnectorIds=function(e){return e.connectors.map((function(e){return e.id}))},t.prototype.getNodeByConnectorId=function(e){var t,n,o=this.modelService.model;try{for(var i=c(o.nodes),r=i.next();!r.done;r=i.next()){var s=r.value;if(this.getConnectorIds(s).indexOf(e)>-1)return s}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return null},t.prototype.getHtmlElement=function(e){return this.modelService.nodesHtmlElements[e]},t.prototype.setHtmlElement=function(e,t){this.modelService.nodesHtmlElements[e]=t,this.modelService.detectChanges()},t}(m),C=function(e){function t(t){return e.call(this,t)||this}return a(t,e),t.prototype.sourceCoord=function(e){return this.modelService.connectors.getCenteredCoord(e.source)},t.prototype.destCoord=function(e){return this.modelService.connectors.getCenteredCoord(e.destination)},t.prototype.delete=function(e){var t=this.modelService.model,n=t.edges.indexOf(e);if(-1===n)throw new Error("Tried to delete not existing edge");this.isSelected(e)&&this.deselect(e),t.edges.splice(n,1),this.modelService.notifyModelChanged(),this.modelService.edgeRemovedCallback(e)},t.prototype.getSelectedEdges=function(){var e=this;return this.modelService.model.edges.filter((function(t){return e.modelService.edges.isSelected(t)}))},t.prototype.handleEdgeMouseClick=function(e,t){t?this.modelService.edges.toggleSelected(e):(this.modelService.deselectAll(),this.modelService.edges.select(e))},t.prototype.putEdge=function(e){this.modelService.model.edges.push(e),this.modelService.notifyModelChanged()},t.prototype._addEdge=function(e,t,n,o){var i=this;this.modelService.modelValidation.validateConnector(t),this.modelService.modelValidation.validateConnector(n);var r={};r.source=t.id,r.destination=n.id,r.label=o;var s=this.modelService.model;this.modelService.modelValidation.validateEdges(s.edges.concat([r]),s.nodes),this.modelService.createEdge(e,r).subscribe((function(e){s.edges.push(e),i.modelService.notifyModelChanged(),i.modelService.edgeAddedCallback(e)}))},t}(m),S=function(){function e(){}return e.prototype.validateModel=function(e){return this.validateNodes(e.nodes),this._validateEdges(e.edges,e.nodes),e},e.prototype.validateNodes=function(e){var t=this,n=[];e.forEach((function(e){if(t.validateNode(e),-1!==n.indexOf(e.id))throw new u("Id not unique.");n.push(e.id)}));var o=[];return e.forEach((function(e){e.connectors.forEach((function(e){if(-1!==o.indexOf(e.id))throw new u("Id not unique.");o.push(e.id)}))})),e},e.prototype.validateNode=function(e){var t=this;if(void 0===e.id)throw new u("Id not valid.");if("string"!=typeof e.name)throw new u("Name not valid.");if("number"!=typeof e.x||e.x<0||Math.round(e.x)!==e.x)throw new u("Coordinates not valid.");if("number"!=typeof e.y||e.y<0||Math.round(e.y)!==e.y)throw new u("Coordinates not valid.");if(!Array.isArray(e.connectors))throw new u("Connectors not valid.");return e.connectors.forEach((function(e){t.validateConnector(e)})),e},e.prototype._validateEdges=function(e,t){var n=this;if(e.forEach((function(e){n._validateEdge(e,t)})),e.forEach((function(t,n){e.forEach((function(e,o){if(n!==o&&(t.source===e.source&&t.destination===e.destination||t.source===e.destination&&t.destination===e.source))throw new u("Duplicated edge.")}))})),null===f({nodes:t,edges:e}))throw new u("Graph has a circle.");return e},e.prototype.validateEdges=function(e,t){return this.validateNodes(t),this._validateEdges(e,t)},e.prototype._validateEdge=function(e,t){if(void 0===e.source)throw new u("Source not valid.");if(void 0===e.destination)throw new u("Destination not valid.");if(e.source===e.destination)throw new u("Edge with same source and destination connectors.");var n=t.filter((function(t){return t.connectors.some((function(t){return t.id===e.source}))}))[0];if(void 0===n)throw new u("Source not valid.");var o=t.filter((function(t){return t.connectors.some((function(t){return t.id===e.destination}))}))[0];if(void 0===o)throw new u("Destination not valid.");if(n===o)throw new u("Edge with same source and destination nodes.");return e},e.prototype.validateEdge=function(e,t){return this.validateNodes(t),this._validateEdge(e,t)},e.prototype.validateConnector=function(e){if(void 0===e.id)throw new u("Id not valid.");if(void 0===e.type||null===e.type||"string"!=typeof e.type)throw new u("Type not valid.");return e},e.ɵfac=function(t){return new(t||e)},e.ɵprov=t["ɵɵdefineInjectable"]({token:e,factory:e.ɵfac}),e}(),b={dropElement:null},E=function(){function e(e,t,n,o){this.nodeDraggingScope={shadowDragStarted:!1,dropElement:null,draggedNodes:[],shadowElements:[]},this.dragOffsets=[],this.draggedElements=[],this.destinationHtmlElements=[],this.oldDisplayStyles=[],this.modelService=e,this.automaticResize=n,this.dragAnimation=o,this.applyFunction=t}return e.prototype.getCoordinate=function(e,t){return e=Math.max(e,0),e=Math.min(e,t)},e.prototype.getXCoordinate=function(e){return this.getCoordinate(e,this.modelService.canvasHtmlElement.offsetWidth)},e.prototype.getYCoordinate=function(e){return this.getCoordinate(e,this.modelService.canvasHtmlElement.offsetHeight)},e.prototype.resizeCanvas=function(e,t){if(this.automaticResize&&!this.modelService.isDropSource()){var n=this.modelService.canvasHtmlElement;n.offsetWidth<e.x+t.offsetWidth+g.canvasResizeThreshold&&(n.style.width=n.offsetWidth+g.canvasResizeStep+"px"),n.offsetHeight<e.y+t.offsetHeight+g.canvasResizeThreshold&&(n.style.height=n.offsetHeight+g.canvasResizeStep+"px")}},e.prototype.isDraggingNode=function(e){return this.nodeDraggingScope.draggedNodes.includes(e)},e.prototype.dragstart=function(e,t){var n,o,i,r;if(!t.readonly){this.dragOffsets.length=0,this.draggedElements.length=0,this.nodeDraggingScope.draggedNodes.length=0,this.nodeDraggingScope.shadowElements.length=0,this.destinationHtmlElements.length=0,this.oldDisplayStyles.length=0;var s=[],a=[];if(this.modelService.nodes.isSelected(t)){var d=this.modelService.nodes.getSelectedNodes();try{for(var l=c(d),h=l.next();!h.done;h=l.next()){var u=h.value,f=$(this.modelService.nodes.getHtmlElement(u.id));s.push(f),a.push(u)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}}else s.push($(e.target)),a.push(t);var p=[],m=[];try{for(var v=c(s),y=v.next();!y.done;y=v.next()){f=y.value;p.push(parseInt(f.css("left"),10)-e.clientX),m.push(parseInt(f.css("top"),10)-e.clientY)}}catch(e){i={error:e}}finally{try{y&&!y.done&&(r=v.return)&&r.call(v)}finally{if(i)throw i.error}}var C=e.originalEvent||e;if(this.modelService.isDropSource()){b.dropElement&&(b.dropElement.parentNode.removeChild(b.dropElement),b.dropElement=null),b.dropElement=s[0][0].cloneNode(!0);var S=$(this.modelService.canvasHtmlElement).offset();b.dropElement.offsetInfo={offsetX:Math.round(p[0]+S.left),offsetY:Math.round(m[0]+S.top)},b.dropElement.style.position="absolute",b.dropElement.style.pointerEvents="none",b.dropElement.style.zIndex="9999",document.body.appendChild(b.dropElement);var E={node:t,dropTargetId:this.modelService.dropTargetId,offsetX:Math.round(p[0]+S.left),offsetY:Math.round(m[0]+S.top)};if(C.dataTransfer.setData("text",JSON.stringify(E)),C.dataTransfer.setDragImage)C.dataTransfer.setDragImage(this.modelService.getDragImage(),0,0);else{var x=e.target,w=x.cloneNode(!0);x.parentNode.insertBefore(w,x),x.style.visibility="collapse",setTimeout((function(){x.parentNode.removeChild(w),x.style.visibility="visible"}),0)}}else{this.nodeDraggingScope.draggedNodes=a;for(var D=0;D<s.length;D++)this.draggedElements.push(s[D][0]),this.dragOffsets.push({x:p[D],y:m[D]});if(this.dragAnimation===g.dragAnimationShadow)for(D=0;D<this.draggedElements.length;D++){var k=this.dragOffsets[D],O=this.nodeDraggingScope.draggedNodes[D],M=$('<div style="position: absolute; opacity: 0.7; top: '+this.getYCoordinate(k.y+e.clientY)+"px; left: "+this.getXCoordinate(k.x+e.clientX)+'px; "><div class="innerNode"><p style="padding: 0 15px;">'+O.name+"</p> </div></div>"),P=$(this.draggedElements[D]).children()[0];M.children()[0].style.backgroundColor=P.style.backgroundColor,this.nodeDraggingScope.shadowElements.push(M),this.modelService.canvasHtmlElement.appendChild(this.nodeDraggingScope.shadowElements[D][0])}if(C.dataTransfer.setData("text","Just to support firefox"),C.dataTransfer.setDragImage)C.dataTransfer.setDragImage(this.modelService.getDragImage(),0,0);else if(this.draggedElements.forEach((function(e){var t=e.cloneNode(!0);e.parentNode.insertBefore(t,e),e.style.visibility="collapse",setTimeout((function(){e.parentNode.removeChild(t),e.style.visibility="visible"}),0)})),this.dragAnimation===g.dragAnimationShadow){for(D=0;D<this.draggedElements.length;D++)this.destinationHtmlElements.push(this.draggedElements[D]),this.oldDisplayStyles.push(this.destinationHtmlElements[D].style.display),this.destinationHtmlElements[D].style.display="none";this.nodeDraggingScope.shadowDragStarted=!0}}}},e.prototype.drop=function(e){var t=this;if(this.modelService.isDropSource())return e.preventDefault(),!1;var n=null,o=(e.originalEvent||e).dataTransfer.getData("text");if(o){var i=null;try{i=JSON.parse(o)}catch(e){}if(i&&i.dropTargetId&&this.modelService.canvasHtmlElement.id&&this.modelService.canvasHtmlElement.id===i.dropTargetId){n=i.node;var r=$(this.modelService.canvasHtmlElement).offset(),s=e.clientX-r.left,a=e.clientY-r.top;n.x=Math.round(this.getXCoordinate(i.offsetX+s)),n.y=Math.round(this.getYCoordinate(i.offsetY+a))}}return n?(this.modelService.dropNode(e,n),e.preventDefault(),!1):this.nodeDraggingScope.draggedNodes.length?this.applyFunction((function(){for(var n=0;n<t.nodeDraggingScope.draggedNodes.length;n++){var o=t.nodeDraggingScope.draggedNodes[n],i=t.dragOffsets[n];o.x=Math.round(t.getXCoordinate(i.x+e.clientX)),o.y=Math.round(t.getYCoordinate(i.y+e.clientY))}return e.preventDefault(),t.modelService.notifyModelChanged(),!1})):void 0},e.prototype.dragover=function(e){var t=this;if(b.dropElement){var n=b.dropElement.offsetInfo;return b.dropElement.style.left=n.offsetX+e.clientX+"px",b.dropElement.style.top=n.offsetY+e.clientY+"px",this.nodeDraggingScope.shadowDragStarted&&this.applyFunction((function(){t.destinationHtmlElements[0].style.display=t.oldDisplayStyles[0],t.nodeDraggingScope.shadowDragStarted=!1})),void e.preventDefault()}if(this.modelService.isDropSource())e.preventDefault();else if(this.nodeDraggingScope.draggedNodes.length){if(this.dragAnimation===g.dragAnimationRepaint){if(this.nodeDraggingScope.draggedNodes.length)return this.applyFunction((function(){for(var n=0;n<t.nodeDraggingScope.draggedNodes.length;n++){var o=t.nodeDraggingScope.draggedNodes[n],i=t.dragOffsets[n];o.x=t.getXCoordinate(i.x+e.clientX),o.y=t.getYCoordinate(i.y+e.clientY),t.resizeCanvas(o,t.draggedElements[n])}return e.preventDefault(),t.modelService.notifyModelChanged(),!1}))}else if(this.dragAnimation===g.dragAnimationShadow&&this.nodeDraggingScope.draggedNodes.length){this.nodeDraggingScope.shadowDragStarted&&this.applyFunction((function(){for(var e=0;e<t.nodeDraggingScope.draggedNodes.length;e++)t.destinationHtmlElements[e].style.display=t.oldDisplayStyles[e];t.nodeDraggingScope.shadowDragStarted=!1}));for(var o=0;o<this.nodeDraggingScope.draggedNodes.length;o++){var i=this.nodeDraggingScope.draggedNodes[o],r=this.dragOffsets[o];this.nodeDraggingScope.shadowElements[o].css("left",this.getXCoordinate(r.x+e.clientX)+"px"),this.nodeDraggingScope.shadowElements[o].css("top",this.getYCoordinate(r.y+e.clientY)+"px"),this.resizeCanvas(i,this.draggedElements[o])}e.preventDefault()}}else e.preventDefault()},e.prototype.dragend=function(e){var t=this;this.applyFunction((function(){if(b.dropElement&&(b.dropElement.parentNode.removeChild(b.dropElement),b.dropElement=null),!t.modelService.isDropSource()){if(t.nodeDraggingScope.shadowElements.length){for(var e=0;e<t.nodeDraggingScope.draggedNodes.length;e++){var n=t.nodeDraggingScope.draggedNodes[e],o=t.nodeDraggingScope.shadowElements[e];n.x=parseInt(o.css("left").replace("px",""),10),n.y=parseInt(o.css("top").replace("px",""),10),t.modelService.canvasHtmlElement.removeChild(o[0])}t.nodeDraggingScope.shadowElements.length=0,t.modelService.notifyModelChanged()}t.nodeDraggingScope.draggedNodes.length&&(t.nodeDraggingScope.draggedNodes.length=0,t.draggedElements.length=0,t.dragOffsets.length=0)}}))},e}(),x=function(){function e(){}return e.prototype.getEdgeDAttribute=function(e,t,n){var o="M "+e.x+", "+e.y+" ";if(n===g.curvedStyle){var i=this.computeEdgeSourceTangent(e,t),r=this.computeEdgeDestinationTangent(e,t);o+="C "+i.x+", "+i.y+" "+(r.x-50)+", "+r.y+" "+t.x+", "+t.y}else o+="L "+t.x+", "+t.y;return o},e.prototype.getEdgeCenter=function(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}},e.prototype.computeEdgeTangentOffset=function(e,t){return(t.y-e.y)/2},e.prototype.computeEdgeSourceTangent=function(e,t){return{x:e.x,y:e.y+this.computeEdgeTangentOffset(e,t)}},e.prototype.computeEdgeDestinationTangent=function(e,t){return{x:t.x,y:t.y-this.computeEdgeTangentOffset(e,t)}},e.ɵfac=function(t){return new(t||e)},e.ɵprov=t["ɵɵdefineInjectable"]({token:e,factory:e.ɵfac}),e}(),w=function(){function e(e,t,n,o,i,r,s,a){this.edgeDragging={isDragging:!1,dragPoint1:null,dragPoint2:null,shadowDragStarted:!1},this.draggedEdgeSource=null,this.dragOffset={},this.destinationHtmlElement=null,this.oldDisplayStyle="",this.modelValidation=e,this.edgeDrawingService=t,this.modelService=n,this.model=o,this.isValidEdgeCallback=i||function(){return!0},this.applyFunction=r,this.dragAnimation=s,this.edgeStyle=a}return e.prototype.dragstart=function(e,t){var n,o,i,r,s,a=this;if(t.type===g.leftConnectorType){var d=function(e){if(e.destination===t.id)return i=l.modelService.connectors.getConnector(e.source),r=e.label,s=e,l.applyFunction((function(){a.modelService.edges.delete(e)})),"break"},l=this;try{for(var h=c(this.model.edges),u=h.next();!u.done;u=h.next()){if("break"===d(u.value))break}}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}}this.edgeDragging.isDragging=!0,void 0!==i?(this.draggedEdgeSource=i,this.edgeDragging.dragPoint1=this.modelService.connectors.getCenteredCoord(i.id),this.edgeDragging.dragLabel=r,this.edgeDragging.prevEdge=s):(this.draggedEdgeSource=t,this.edgeDragging.dragPoint1=this.modelService.connectors.getCenteredCoord(t.id));var f=this.modelService.canvasHtmlElement;if(!f)throw new Error("No canvas while edgedraggingService found.");this.dragOffset.x=-f.getBoundingClientRect().left,this.dragOffset.y=-f.getBoundingClientRect().top,this.edgeDragging.dragPoint2={x:e.clientX+this.dragOffset.x,y:e.clientY+this.dragOffset.y};var p=e.originalEvent||e;p.dataTransfer.setData("Text","Just to support firefox"),p.dataTransfer.setDragImage?p.dataTransfer.setDragImage(this.modelService.getDragImage(),0,0):(this.destinationHtmlElement=e.target,this.oldDisplayStyle=this.destinationHtmlElement.style.display,this.destinationHtmlElement.style.display="none",this.dragAnimation===g.dragAnimationShadow&&(this.edgeDragging.shadowDragStarted=!0)),this.dragAnimation===g.dragAnimationShadow&&(void 0===this.edgeDragging.gElement&&(this.edgeDragging.gElement=$(document.querySelectorAll(".shadow-svg-class")),this.edgeDragging.pathElement=$(document.querySelectorAll(".shadow-svg-class")).find("path"),this.edgeDragging.circleElement=$(document.querySelectorAll(".shadow-svg-class")).find("circle")),this.edgeDragging.gElement.css("display","block"),this.edgeDragging.pathElement.attr("d",this.edgeDrawingService.getEdgeDAttribute(this.edgeDragging.dragPoint1,this.edgeDragging.dragPoint2,this.edgeStyle)),this.edgeDragging.circleElement.attr("cx",this.edgeDragging.dragPoint2.x),this.edgeDragging.circleElement.attr("cy",this.edgeDragging.dragPoint2.y)),e.stopPropagation()},e.prototype.dragover=function(e){var t=this;if(this.edgeDragging.isDragging)if(this.edgeDragging.magnetActive||this.dragAnimation!==g.dragAnimationShadow){if(this.dragAnimation===g.dragAnimationRepaint)return this.applyFunction((function(){null!==t.destinationHtmlElement&&(t.destinationHtmlElement.style.display=t.oldDisplayStyle),t.edgeDragging.dragPoint2={x:e.clientX+t.dragOffset.x,y:e.clientY+t.dragOffset.y}}))}else null!==this.destinationHtmlElement&&(this.destinationHtmlElement.style.display=this.oldDisplayStyle),this.edgeDragging.shadowDragStarted&&this.applyFunction((function(){t.edgeDragging.shadowDragStarted=!1})),this.edgeDragging.dragPoint2={x:e.clientX+this.dragOffset.x,y:e.clientY+this.dragOffset.y},this.edgeDragging.pathElement.attr("d",this.edgeDrawingService.getEdgeDAttribute(this.edgeDragging.dragPoint1,this.edgeDragging.dragPoint2,this.edgeStyle)),this.edgeDragging.circleElement.attr("cx",this.edgeDragging.dragPoint2.x),this.edgeDragging.circleElement.attr("cy",this.edgeDragging.dragPoint2.y)},e.prototype.dragoverConnector=function(e,t){if(this.edgeDragging.isDragging){this.dragover(e);try{this.modelValidation.validateEdges(this.model.edges.concat([{source:this.draggedEdgeSource.id,destination:t.id}]),this.model.nodes)}catch(e){if(e instanceof u)return!0;throw e}if(this.isValidEdgeCallback(this.draggedEdgeSource,t))return e.preventDefault(),e.stopPropagation(),!1}},e.prototype.dragleaveMagnet=function(e){this.edgeDragging.magnetActive=!1},e.prototype.dragoverMagnet=function(e,t){var n=this;if(this.edgeDragging.isDragging){this.dragover(e);try{this.modelValidation.validateEdges(this.model.edges.concat([{source:this.draggedEdgeSource.id,destination:t.id}]),this.model.nodes)}catch(e){if(e instanceof u)return!0;throw e}if(this.isValidEdgeCallback(this.draggedEdgeSource,t)){if(this.dragAnimation===g.dragAnimationShadow)return this.edgeDragging.magnetActive=!0,this.edgeDragging.dragPoint2=this.modelService.connectors.getCenteredCoord(t.id),this.edgeDragging.pathElement.attr("d",this.edgeDrawingService.getEdgeDAttribute(this.edgeDragging.dragPoint1,this.edgeDragging.dragPoint2,this.edgeStyle)),this.edgeDragging.circleElement.attr("cx",this.edgeDragging.dragPoint2.x),this.edgeDragging.circleElement.attr("cy",this.edgeDragging.dragPoint2.y),e.preventDefault(),e.stopPropagation(),!1;if(this.dragAnimation===g.dragAnimationRepaint)return this.applyFunction((function(){return n.edgeDragging.dragPoint2=n.modelService.connectors.getCenteredCoord(t.id),e.preventDefault(),e.stopPropagation(),!1}))}}},e.prototype.dragend=function(e){var t=this;if(this.edgeDragging.isDragging&&(this.edgeDragging.isDragging=!1,this.edgeDragging.dragPoint1=null,this.edgeDragging.dragPoint2=null,this.edgeDragging.dragLabel=null,e.stopPropagation(),this.dragAnimation===g.dragAnimationShadow&&this.edgeDragging.gElement.css("display","none"),this.edgeDragging.prevEdge)){var n=this.edgeDragging.prevEdge;this.edgeDragging.prevEdge=null,this.applyFunction((function(){t.modelService.edges.putEdge(n)}))}},e.prototype.drop=function(e,t){if(this.edgeDragging.isDragging){try{this.modelValidation.validateEdges(this.model.edges.concat([{source:this.draggedEdgeSource.id,destination:t.id}]),this.model.nodes)}catch(e){if(e instanceof u)return!0;throw e}if(this.isValidEdgeCallback(this.draggedEdgeSource,t))return this.edgeDragging.prevEdge=null,this.modelService.edges._addEdge(e,this.draggedEdgeSource,t,this.edgeDragging.dragLabel),e.stopPropagation(),e.preventDefault(),!1}},e}(),D=function(){function e(e){this.mouseoverscope={connector:null,edge:null,node:null},this.applyFunction=e}return e.prototype.nodeMouseOver=function(e,t){var n=this;return this.applyFunction((function(){n.mouseoverscope.node=t}))},e.prototype.nodeMouseOut=function(e,t){var n=this;return this.applyFunction((function(){n.mouseoverscope.node=null}))},e.prototype.connectorMouseEnter=function(e,t){var n=this;return this.applyFunction((function(){n.mouseoverscope.connector=t}))},e.prototype.connectorMouseLeave=function(e,t){var n=this;return this.applyFunction((function(){n.mouseoverscope.connector=null}))},e.prototype.edgeMouseEnter=function(e,t){this.mouseoverscope.edge=t},e.prototype.edgeMouseLeave=function(e,t){this.mouseoverscope.edge=null},e}(),k=/(auto|scroll)/,O=function(e,t){return getComputedStyle(e,null).getPropertyValue(t)},M=function(e){return e&&e!==document.body?function(e){return k.test(O(e,"overflow")+O(e,"overflow-y")+O(e,"overflow-x"))}(e)?e:M(e.parentNode):document.body},P=function(){function e(e,t,n){this.selectRect={x1:0,x2:0,y1:0,y2:0},this.modelService=e,this.selectElement=t,this.$canvasElement=$(this.modelService.canvasHtmlElement),this.$scrollParent=$(M(this.modelService.canvasHtmlElement)),this.applyFunction=n}return e.prototype.mousedown=function(e){if(this.modelService.isEditable()&&!e.ctrlKey&&!e.metaKey&&0===e.button&&this.selectElement.hidden){this.selectElement.hidden=!1;var t=this.$canvasElement.offset();this.selectRect.x1=Math.round(e.pageX-t.left),this.selectRect.y1=Math.round(e.pageY-t.top),this.selectRect.x2=this.selectRect.x1,this.selectRect.y2=this.selectRect.y1,this.updateSelectRect()}},e.prototype.mousemove=function(e){if(this.modelService.isEditable()&&!e.ctrlKey&&!e.metaKey&&0===e.button&&!this.selectElement.hidden){var t=this.$canvasElement.offset();this.selectRect.x2=Math.round(e.pageX-t.left),this.selectRect.y2=Math.round(e.pageY-t.top),this.updateScroll(t),this.updateSelectRect()}},e.prototype.updateScroll=function(e){var t=this.$scrollParent[0].getBoundingClientRect(),n=t.bottom-e.top,o=t.right-e.left,i=t.top-e.top,r=t.left-e.left;if(this.selectRect.y2-i<25){var s=25-(this.selectRect.y2-i),a=this.$scrollParent.scrollTop();this.$scrollParent.scrollTop(a-s)}else if(n-this.selectRect.y2<40){var d=40-(n-this.selectRect.y2),c=this.$scrollParent.scrollTop();this.$scrollParent.scrollTop(c+d)}if(this.selectRect.x2-r<25){var l=25-(this.selectRect.x2-r),g=this.$scrollParent.scrollLeft();this.$scrollParent.scrollLeft(g-l)}else if(o-this.selectRect.x2<40){var h=40-(o-this.selectRect.x2),u=this.$scrollParent.scrollLeft();this.$scrollParent.scrollLeft(u+h)}},e.prototype.mouseup=function(e){if(this.modelService.isEditable()&&!e.ctrlKey&&!e.metaKey&&0===e.button&&!this.selectElement.hidden){var t=this.selectElement.getBoundingClientRect();this.selectElement.hidden=!0,this.selectObjects(t)}},e.prototype.updateSelectRect=function(){var e=Math.min(this.selectRect.x1,this.selectRect.x2),t=Math.max(this.selectRect.x1,this.selectRect.x2),n=Math.min(this.selectRect.y1,this.selectRect.y2),o=Math.max(this.selectRect.y1,this.selectRect.y2);this.selectElement.style.left=e+"px",this.selectElement.style.top=n+"px",this.selectElement.style.width=t-e+"px",this.selectElement.style.height=o-n+"px"},e.prototype.selectObjects=function(e){var t=this;this.applyFunction((function(){t.modelService.selectAllInRect(e)}))},e}(),I=["nodeContent"];function R(e,t){}var _=function(){function e(e,t,n){this.nodeComponentConfig=e,this.elementRef=t,this.componentFactoryResolver=n}return Object.defineProperty(e.prototype,"nodeId",{get:function(){return this.node.id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.node.y+"px"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"left",{get:function(){return this.node.x+"px"},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.userNodeCallbacks||(this.userNodeCallbacks={}),this.userNodeCallbacks.nodeEdit=this.userNodeCallbacks.nodeEdit||function(){},this.userNodeCallbacks.doubleClick=this.userNodeCallbacks.doubleClick||function(){},this.userNodeCallbacks.mouseDown=this.userNodeCallbacks.mouseDown||function(){},this.userNodeCallbacks.mouseEnter=this.userNodeCallbacks.mouseEnter||function(){},this.userNodeCallbacks.mouseLeave=this.userNodeCallbacks.mouseLeave||function(){};var e=$(this.elementRef.nativeElement);e.addClass(g.nodeClass),this.node.readonly||e.attr("draggable","true"),this.updateNodeClass(),this.modelservice.nodes.setHtmlElement(this.node.id,e[0]),this.nodeContentContainer.clear();var t=this.componentFactoryResolver.resolveComponentFactory(this.nodeComponentConfig.nodeComponentType),n=this.nodeContentContainer.createComponent(t);this.nodeComponent=n.instance,this.nodeComponent.callbacks=this.callbacks,this.nodeComponent.userNodeCallbacks=this.userNodeCallbacks,this.nodeComponent.node=this.node,this.nodeComponent.modelservice=this.modelservice,this.updateNodeComponent(),this.nodeComponent.width=this.elementRef.nativeElement.offsetWidth,this.nodeComponent.height=this.elementRef.nativeElement.offsetHeight},e.prototype.ngAfterViewInit=function(){this.nodeComponent.width=this.elementRef.nativeElement.offsetWidth,this.nodeComponent.height=this.elementRef.nativeElement.offsetHeight},e.prototype.ngOnChanges=function(e){var t,n,o=!1;try{for(var i=c(Object.keys(e)),r=i.next();!r.done;r=i.next()){var s=r.value,a=e[s];a.firstChange||a.currentValue===a.previousValue||["selected","edit","underMouse","mouseOverConnector","dragging"].includes(s)&&(o=!0)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}o&&(this.updateNodeClass(),this.updateNodeComponent())},e.prototype.updateNodeClass=function(){var e=$(this.elementRef.nativeElement);this.toggleClass(e,g.selectedClass,this.selected),this.toggleClass(e,g.editClass,this.edit),this.toggleClass(e,g.hoverClass,this.underMouse),this.toggleClass(e,g.draggingClass,this.dragging)},e.prototype.updateNodeComponent=function(){this.nodeComponent.selected=this.selected,this.nodeComponent.edit=this.edit,this.nodeComponent.underMouse=this.underMouse,this.nodeComponent.mouseOverConnector=this.mouseOverConnector,this.nodeComponent.dragging=this.dragging},e.prototype.toggleClass=function(e,t,n){n?e.addClass(t):e.removeClass(t)},e.prototype.mousedown=function(e){e.stopPropagation()},e.prototype.dragstart=function(e){this.node.readonly||this.callbacks.nodeDragstart(e,this.node)},e.prototype.dragend=function(e){this.node.readonly||this.callbacks.nodeDragend(e)},e.prototype.click=function(e){this.node.readonly||this.callbacks.nodeClicked(e,this.node)},e.prototype.mouseover=function(e){this.node.readonly||this.callbacks.nodeMouseOver(e,this.node)},e.prototype.mouseout=function(e){this.node.readonly||this.callbacks.nodeMouseOut(e,this.node)},e.ɵfac=function(n){return new(n||e)(t["ɵɵdirectiveInject"](l),t["ɵɵdirectiveInject"](t.ElementRef),t["ɵɵdirectiveInject"](t.ComponentFactoryResolver))},e.ɵcmp=t["ɵɵdefineComponent"]({type:e,selectors:[["fc-node"]],viewQuery:function(e,n){var o;(1&e&&t["ɵɵstaticViewQuery"](I,!0,t.ViewContainerRef),2&e)&&(t["ɵɵqueryRefresh"](o=t["ɵɵloadQuery"]())&&(n.nodeContentContainer=o.first))},hostVars:5,hostBindings:function(e,n){1&e&&t["ɵɵlistener"]("mousedown",(function(e){return n.mousedown(e)}))("dragstart",(function(e){return n.dragstart(e)}))("dragend",(function(e){return n.dragend(e)}))("click",(function(e){return n.click(e)}))("mouseover",(function(e){return n.mouseover(e)}))("mouseout",(function(e){return n.mouseout(e)})),2&e&&(t["ɵɵattribute"]("id",n.nodeId),t["ɵɵstyleProp"]("top",n.top)("left",n.left))},inputs:{callbacks:"callbacks",userNodeCallbacks:"userNodeCallbacks",node:"node",selected:"selected",edit:"edit",underMouse:"underMouse",mouseOverConnector:"mouseOverConnector",modelservice:"modelservice",dragging:"dragging"},features:[t["ɵɵNgOnChangesFeature"]()],decls:2,vars:0,consts:[["nodeContent",""]],template:function(e,n){1&e&&t["ɵɵtemplate"](0,R,0,0,"ng-template",null,0,t["ɵɵtemplateRefExtractor"])},styles:["[_nghost-%COMP%]{position:absolute;z-index:1}.fc-dragging[_nghost-%COMP%]{z-index:10}[_nghost-%COMP%] .fc-leftConnectors, [_nghost-%COMP%] .fc-rightConnectors{position:absolute;top:0;height:100%;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;z-index:-10}[_nghost-%COMP%] .fc-leftConnectors .fc-magnet, [_nghost-%COMP%] .fc-rightConnectors .fc-magnet{-webkit-box-align:center;align-items:center}[_nghost-%COMP%] .fc-leftConnectors{left:-20px}[_nghost-%COMP%] .fc-rightConnectors{right:-20px}[_nghost-%COMP%] .fc-magnet{display:-webkit-box;display:flex;-webkit-box-flex:1;flex-grow:1;height:60px;-webkit-box-pack:center;justify-content:center}[_nghost-%COMP%] .fc-connector{width:18px;height:18px;border:10px solid transparent;-moz-background-clip:padding;-webkit-background-clip:padding;background-clip:padding-box;border-radius:50%;background-color:#f7a789;color:#fff;pointer-events:all}[_nghost-%COMP%] .fc-connector.fc-hover{background-color:#000}"]}),e}(),N=function(){function e(){var e=this;this.flowchartConstants=g,this.nodeRectInfo={top:function(){return e.node.y},left:function(){return e.node.x},bottom:function(){return e.node.y+e.height},right:function(){return e.node.x+e.width},width:function(){return e.width},height:function(){return e.height}}}return e.prototype.ngOnInit=function(){},e.ɵfac=function(t){return new(t||e)},e.ɵdir=t["ɵɵdefineDirective"]({type:e,inputs:{callbacks:"callbacks",userNodeCallbacks:"userNodeCallbacks",node:"node",selected:"selected",edit:"edit",underMouse:"underMouse",mouseOverConnector:"mouseOverConnector",modelservice:"modelservice",dragging:"dragging"}}),e}();function A(e,n){if(1&e){var o=t["ɵɵgetCurrentView"]();t["ɵɵnamespaceSVG"](),t["ɵɵelementStart"](0,"g"),t["ɵɵelementStart"](1,"path",12),t["ɵɵlistener"]("mousedown",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeMouseDown(e,i)}))("click",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeClick(e,i)}))("dblclick",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeDoubleClick(e,i)}))("mouseover",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeMouseOver(e,i)}))("mouseenter",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeMouseEnter(e,i)}))("mouseleave",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeMouseLeave(e,i)})),t["ɵɵelementEnd"](),t["ɵɵelementEnd"]()}if(2&e){var i=n.$implicit,r=n.index,s=t["ɵɵnextContext"]();t["ɵɵadvance"](1),t["ɵɵattribute"]("id","fc-edge-path-"+r)("class",s.modelService.edges.isSelected(i)&&s.flowchartConstants.selectedClass+" "+s.flowchartConstants.edgeClass||i===s.mouseoverService.mouseoverscope.edge&&s.flowchartConstants.hoverClass+" "+s.flowchartConstants.edgeClass||i.active&&s.flowchartConstants.activeClass+" "+s.flowchartConstants.edgeClass||s.flowchartConstants.edgeClass)("d",s.getEdgeDAttribute(i))("marker-end","url(#"+(s.modelService.edges.isSelected(i)?s.arrowDefIdSelected:s.arrowDefId)+")")}}function j(e,n){if(1&e&&(t["ɵɵnamespaceSVG"](),t["ɵɵelementStart"](0,"g"),t["ɵɵelement"](1,"path"),t["ɵɵelement"](2,"circle",13),t["ɵɵelementEnd"]()),2&e){var o=t["ɵɵnextContext"]();t["ɵɵadvance"](1),t["ɵɵattribute"]("class",o.flowchartConstants.edgeClass+" "+o.flowchartConstants.draggingClass)("d",o.edgeDrawingService.getEdgeDAttribute(o.edgeDraggingService.edgeDragging.dragPoint1,o.edgeDraggingService.edgeDragging.dragPoint2,o.edgeStyle)),t["ɵɵadvance"](1),t["ɵɵattribute"]("cx",o.edgeDraggingService.edgeDragging.dragPoint2.x)("cy",o.edgeDraggingService.edgeDragging.dragPoint2.y)}}function T(e,n){if(1&e&&(t["ɵɵnamespaceSVG"](),t["ɵɵelementStart"](0,"g",14),t["ɵɵelement"](1,"path",15),t["ɵɵelement"](2,"circle",13),t["ɵɵelementEnd"]()),2&e){var o=t["ɵɵnextContext"]();t["ɵɵclassMapInterpolate2"]("shadow-svg-class ",o.flowchartConstants.edgeClass," ",o.flowchartConstants.draggingClass,"")}}function H(e,n){if(1&e&&(t["ɵɵnamespaceSVG"](),t["ɵɵnamespaceHTML"](),t["ɵɵelementContainerStart"](0),t["ɵɵelement"](1,"fc-node",16),t["ɵɵelementContainerEnd"]()),2&e){var o=n.$implicit,i=t["ɵɵnextContext"]();t["ɵɵadvance"](1),t["ɵɵproperty"]("selected",i.modelService.nodes.isSelected(o))("edit",i.modelService.nodes.isEdit(o))("underMouse",o===i.mouseoverService.mouseoverscope.node)("node",o)("mouseOverConnector",i.mouseoverService.mouseoverscope.connector)("modelservice",i.modelService)("dragging",i.nodeDraggingService.isDraggingNode(o))("callbacks",i.callbacks)("userNodeCallbacks",i.userNodeCallbacks)}}function V(e,n){if(1&e&&(t["ɵɵelementStart"](0,"span"),t["ɵɵtext"](1),t["ɵɵelementEnd"]()),2&e){var o=t["ɵɵnextContext"](2);t["ɵɵattribute"]("id","fc-edge-label-dragging"),t["ɵɵadvance"](1),t["ɵɵtextInterpolate"](o.edgeDraggingService.edgeDragging.dragLabel)}}var F=function(e,t){return{top:e,left:t}};function z(e,n){if(1&e&&(t["ɵɵnamespaceSVG"](),t["ɵɵnamespaceHTML"](),t["ɵɵelementStart"](0,"div",17),t["ɵɵelementStart"](1,"div",18),t["ɵɵtemplate"](2,V,2,2,"span",7),t["ɵɵelementEnd"](),t["ɵɵelementEnd"]()),2&e){var o=t["ɵɵnextContext"]();t["ɵɵproperty"]("ngStyle",t["ɵɵpureFunction2"](3,F,o.edgeDrawingService.getEdgeCenter(o.edgeDraggingService.edgeDragging.dragPoint1,o.edgeDraggingService.edgeDragging.dragPoint2).y+"px",o.edgeDrawingService.getEdgeCenter(o.edgeDraggingService.edgeDragging.dragPoint1,o.edgeDraggingService.edgeDragging.dragPoint2).x+"px")),t["ɵɵattribute"]("class","fc-noselect "+o.flowchartConstants.edgeLabelClass),t["ɵɵadvance"](2),t["ɵɵproperty"]("ngIf",o.edgeDraggingService.edgeDragging.dragLabel)}}function B(e,n){if(1&e){var o=t["ɵɵgetCurrentView"]();t["ɵɵelementStart"](0,"div",22),t["ɵɵlistener"]("click",(function(e){t["ɵɵrestoreView"](o);var n=t["ɵɵnextContext"]().$implicit;return t["ɵɵnextContext"]().edgeEdit(e,n)})),t["ɵɵelement"](1,"i",23),t["ɵɵelementEnd"]()}}function L(e,n){if(1&e){var o=t["ɵɵgetCurrentView"]();t["ɵɵelementStart"](0,"div",24),t["ɵɵlistener"]("click",(function(e){t["ɵɵrestoreView"](o);var n=t["ɵɵnextContext"]().$implicit;return t["ɵɵnextContext"]().edgeRemove(e,n)})),t["ɵɵtext"](1," × "),t["ɵɵelementEnd"]()}}function X(e,n){if(1&e&&(t["ɵɵelementStart"](0,"span"),t["ɵɵtext"](1),t["ɵɵelementEnd"]()),2&e){var o=t["ɵɵnextContext"](),i=o.index,r=o.$implicit;t["ɵɵattribute"]("id","fc-edge-label-"+i),t["ɵɵadvance"](1),t["ɵɵtextInterpolate"](r.label)}}function Y(e,n){if(1&e){var o=t["ɵɵgetCurrentView"]();t["ɵɵnamespaceSVG"](),t["ɵɵnamespaceHTML"](),t["ɵɵelementStart"](0,"div",19),t["ɵɵlistener"]("mousedown",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeMouseDown(e,i)}))("click",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeClick(e,i)}))("dblclick",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeDoubleClick(e,i)}))("mouseover",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeMouseOver(e,i)}))("mouseenter",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeMouseEnter(e,i)}))("mouseleave",(function(e){t["ɵɵrestoreView"](o);var i=n.$implicit;return t["ɵɵnextContext"]().edgeMouseLeave(e,i)})),t["ɵɵelementStart"](1,"div",18),t["ɵɵtemplate"](2,B,2,0,"div",20),t["ɵɵtemplate"](3,L,2,0,"div",21),t["ɵɵtemplate"](4,X,2,2,"span",7),t["ɵɵelementEnd"](),t["ɵɵelementEnd"]()}if(2&e){var i=n.$implicit,r=t["ɵɵnextContext"]();t["ɵɵproperty"]("ngStyle",t["ɵɵpureFunction2"](5,F,r.edgeDrawingService.getEdgeCenter(r.modelService.edges.sourceCoord(i),r.modelService.edges.destCoord(i)).y+"px",r.edgeDrawingService.getEdgeCenter(r.modelService.edges.sourceCoord(i),r.modelService.edges.destCoord(i)).x+"px")),t["ɵɵattribute"]("class","fc-noselect "+(r.modelService.edges.isEdit(i)&&r.flowchartConstants.editClass+" "+r.flowchartConstants.edgeLabelClass||r.modelService.edges.isSelected(i)&&r.flowchartConstants.selectedClass+" "+r.flowchartConstants.edgeLabelClass||i===r.mouseoverService.mouseoverscope.edge&&r.flowchartConstants.hoverClass+" "+r.flowchartConstants.edgeLabelClass||i.active&&r.flowchartConstants.activeClass+" "+r.flowchartConstants.edgeLabelClass||r.flowchartConstants.edgeLabelClass)),t["ɵɵadvance"](2),t["ɵɵproperty"]("ngIf",r.modelService.isEditable()),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngIf",r.modelService.isEditable()),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngIf",i.label)}}var W=function(){function e(e,i,r,s,a,d){var c=this;this.elementRef=e,this.differs=i,this.modelValidation=r,this.edgeDrawingService=s,this.cd=a,this.zone=d,this.modelChanged=new t.EventEmitter,this.fitModelSizeByDefaultValue=!0,this.flowchartConstants=g,this.nodesDiffer=this.differs.find([]).create((function(e,t){return t})),this.edgesDiffer=this.differs.find([]).create((function(e,t){return t})),this.detectChangesSubject=new n.Subject,this.arrowDefId="arrow-"+Math.random(),this.arrowDefIdSelected=this.arrowDefId+"-selected",this.detectChangesSubject.pipe(o.debounceTime(50)).subscribe((function(){return c.cd.detectChanges()}))}return Object.defineProperty(e.prototype,"canvasClass",{get:function(){return g.canvasClass},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fitModelSizeByDefault",{get:function(){return this.fitModelSizeByDefaultValue},set:function(e){this.fitModelSizeByDefaultValue=i.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e,t,n=this;if(!this.dropTargetId&&this.edgeStyle!==g.curvedStyle&&this.edgeStyle!==g.lineStyle)throw new Error("edgeStyle not supported.");this.nodeHeight=this.nodeHeight||200,this.nodeWidth=this.nodeWidth||200,this.dragAnimation=this.dragAnimation||g.dragAnimationRepaint,this.userCallbacks=this.userCallbacks||{},this.automaticResize=this.automaticResize||!1;try{for(var o=c(Object.keys(this.userCallbacks)),i=o.next();!i.done;i=o.next()){var r=i.value;if("function"!=typeof this.userCallbacks[r]&&"nodeCallbacks"!==r)throw new Error("All callbacks should be functions.")}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.userNodeCallbacks=this.userCallbacks.nodeCallbacks;var s=$(this.elementRef.nativeElement);this.modelService=new p(this.modelValidation,this.model,this.modelChanged,this.detectChangesSubject,this.selectedObjects,this.userCallbacks.dropNode,this.userCallbacks.createEdge,this.userCallbacks.edgeAdded,this.userCallbacks.nodeRemoved,this.userCallbacks.edgeRemoved,s[0],s[0].querySelector("svg")),this.dropTargetId&&(this.modelService.dropTargetId=this.dropTargetId);var a=this.zone.run.bind(this.zone);this.nodeDraggingService=new E(this.modelService,a,this.automaticResize,this.dragAnimation),this.edgeDraggingService=new w(this.modelValidation,this.edgeDrawingService,this.modelService,this.model,this.userCallbacks.isValidEdge||null,a,this.dragAnimation,this.edgeStyle),this.mouseoverService=new D(a),this.rectangleSelectService=new P(this.modelService,s[0].querySelector("#select-rectangle"),a),this.callbacks={nodeDragstart:this.nodeDraggingService.dragstart.bind(this.nodeDraggingService),nodeDragend:this.nodeDraggingService.dragend.bind(this.nodeDraggingService),edgeDragstart:this.edgeDraggingService.dragstart.bind(this.edgeDraggingService),edgeDragend:this.edgeDraggingService.dragend.bind(this.edgeDraggingService),edgeDrop:this.edgeDraggingService.drop.bind(this.edgeDraggingService),edgeDragoverConnector:this.edgeDraggingService.dragoverConnector.bind(this.edgeDraggingService),edgeDragoverMagnet:this.edgeDraggingService.dragoverMagnet.bind(this.edgeDraggingService),edgeDragleaveMagnet:this.edgeDraggingService.dragleaveMagnet.bind(this.edgeDraggingService),nodeMouseOver:this.mouseoverService.nodeMouseOver.bind(this.mouseoverService),nodeMouseOut:this.mouseoverService.nodeMouseOut.bind(this.mouseoverService),connectorMouseEnter:this.mouseoverService.connectorMouseEnter.bind(this.mouseoverService),connectorMouseLeave:this.mouseoverService.connectorMouseLeave.bind(this.mouseoverService),nodeClicked:function(e,t){n.modelService.nodes.handleClicked(t,e.ctrlKey),e.stopPropagation(),e.preventDefault()}},this.adjustCanvasSize(this.fitModelSizeByDefault)},e.prototype.ngDoCheck=function(){if(this.model){var e=this.nodesDiffer.diff(this.model.nodes),t=this.edgesDiffer.diff(this.model.edges),n=!1,o=!1;null!==e&&(e.forEachAddedItem((function(){n=!0})),e.forEachRemovedItem((function(){n=!0}))),null!==t&&(t.forEachAddedItem((function(){o=!0})),t.forEachRemovedItem((function(){o=!0}))),n&&this.adjustCanvasSize(this.fitModelSizeByDefault),(n||o)&&this.detectChangesSubject.next()}},e.prototype.getEdgeDAttribute=function(e){return this.edgeDrawingService.getEdgeDAttribute(this.modelService.edges.sourceCoord(e),this.modelService.edges.destCoord(e),this.edgeStyle)},e.prototype.adjustCanvasSize=function(e){var t,n,o=this,i=0,r=0,s=$(this.elementRef.nativeElement);this.model.nodes.forEach((function(e){i=Math.max(e.x+o.nodeWidth,i),r=Math.max(e.y+o.nodeHeight,r)})),e?(t=i,n=r):(t=Math.max(i,s.prop("offsetWidth")),n=Math.max(r,s.prop("offsetHeight"))),s.css("width",t+"px"),s.css("height",n+"px")},e.prototype.canvasClick=function(e){},e.prototype.edgeMouseDown=function(e,t){e.stopPropagation()},e.prototype.edgeClick=function(e,t){this.modelService.edges.handleEdgeMouseClick(t,e.ctrlKey),e.stopPropagation(),e.preventDefault()},e.prototype.edgeRemove=function(e,t){this.modelService.edges.delete(t),e.stopPropagation(),e.preventDefault()},e.prototype.edgeEdit=function(e,t){this.userCallbacks.edgeEdit&&this.userCallbacks.edgeEdit(e,t)},e.prototype.edgeDoubleClick=function(e,t){this.userCallbacks.edgeDoubleClick&&this.userCallbacks.edgeDoubleClick(e,t)},e.prototype.edgeMouseOver=function(e,t){this.userCallbacks.edgeMouseOver&&this.userCallbacks.edgeMouseOver(e,t)},e.prototype.edgeMouseEnter=function(e,t){this.mouseoverService.edgeMouseEnter(e,t)},e.prototype.edgeMouseLeave=function(e,t){this.mouseoverService.edgeMouseLeave(e,t)},e.prototype.dragover=function(e){this.nodeDraggingService.dragover(e),this.edgeDraggingService.dragover(e)},e.prototype.drop=function(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation(),this.nodeDraggingService.drop(e)},e.prototype.mousedown=function(e){this.rectangleSelectService.mousedown(e)},e.prototype.mousemove=function(e){this.rectangleSelectService.mousemove(e)},e.prototype.mouseup=function(e){this.rectangleSelectService.mouseup(e)},e.ɵfac=function(n){return new(n||e)(t["ɵɵdirectiveInject"](t.ElementRef),t["ɵɵdirectiveInject"](t.IterableDiffers),t["ɵɵdirectiveInject"](S),t["ɵɵdirectiveInject"](x),t["ɵɵdirectiveInject"](t.ChangeDetectorRef),t["ɵɵdirectiveInject"](t.NgZone))},e.ɵcmp=t["ɵɵdefineComponent"]({type:e,selectors:[["fc-canvas"]],hostVars:1,hostBindings:function(e,n){1&e&&t["ɵɵlistener"]("dragover",(function(e){return n.dragover(e)}))("drop",(function(e){return n.drop(e)}))("mousedown",(function(e){return n.mousedown(e)}))("mousemove",(function(e){return n.mousemove(e)}))("mouseup",(function(e){return n.mouseup(e)})),2&e&&t["ɵɵattribute"]("class",n.canvasClass)},inputs:{model:"model",selectedObjects:"selectedObjects",edgeStyle:"edgeStyle",userCallbacks:"userCallbacks",automaticResize:"automaticResize",dragAnimation:"dragAnimation",nodeWidth:"nodeWidth",nodeHeight:"nodeHeight",dropTargetId:"dropTargetId",fitModelSizeByDefault:"fitModelSizeByDefault"},outputs:{modelChanged:"modelChanged"},decls:14,vars:8,consts:[[1,"fc-canvas-container",3,"click"],[1,"fc-canvas-svg"],["markerWidth","5","markerHeight","5","viewBox","-6 -6 12 12","refX","10","refY","0","markerUnits","strokeWidth","orient","auto",1,"fc-arrow-marker"],["points","-2,0 -5,5 5,0 -5,-5","stroke","gray","fill","gray","stroke-width","1px"],["markerWidth","5","markerHeight","5","viewBox","-6 -6 12 12","refX","10","refY","0","markerUnits","strokeWidth","orient","auto",1,"fc-arrow-marker-selected"],["points","-2,0 -5,5 5,0 -5,-5","stroke","red","fill","red","stroke-width","1px"],[4,"ngFor","ngForOf"],[4,"ngIf"],["style","display:none",3,"class",4,"ngIf"],[3,"ngStyle",4,"ngIf"],[3,"ngStyle","mousedown","click","dblclick","mouseover","mouseenter","mouseleave",4,"ngFor","ngForOf"],["id","select-rectangle","hidden","",1,"fc-select-rectangle"],[3,"mousedown","click","dblclick","mouseover","mouseenter","mouseleave"],["r","4",1,"edge-endpoint"],[2,"display","none"],["d",""],[3,"selected","edit","underMouse","node","mouseOverConnector","modelservice","dragging","callbacks","userNodeCallbacks"],[3,"ngStyle"],[1,"fc-edge-label-text"],[3,"ngStyle","mousedown","click","dblclick","mouseover","mouseenter","mouseleave"],["class","fc-noselect fc-nodeedit",3,"click",4,"ngIf"],["class","fc-noselect fc-nodedelete",3,"click",4,"ngIf"],[1,"fc-noselect","fc-nodeedit",3,"click"],["aria-hidden","true",1,"fa","fa-pencil"],[1,"fc-noselect","fc-nodedelete",3,"click"]],template:function(e,n){1&e&&(t["ɵɵelementStart"](0,"div",0),t["ɵɵlistener"]("click",(function(e){return n.canvasClick(e)})),t["ɵɵnamespaceSVG"](),t["ɵɵelementStart"](1,"svg",1),t["ɵɵelementStart"](2,"defs"),t["ɵɵelementStart"](3,"marker",2),t["ɵɵelement"](4,"polygon",3),t["ɵɵelementEnd"](),t["ɵɵelementStart"](5,"marker",4),t["ɵɵelement"](6,"polygon",5),t["ɵɵelementEnd"](),t["ɵɵelementEnd"](),t["ɵɵtemplate"](7,A,2,4,"g",6),t["ɵɵtemplate"](8,j,3,4,"g",7),t["ɵɵtemplate"](9,T,3,4,"g",8),t["ɵɵelementEnd"](),t["ɵɵtemplate"](10,H,2,9,"ng-container",6),t["ɵɵtemplate"](11,z,3,6,"div",9),t["ɵɵtemplate"](12,Y,5,8,"div",10),t["ɵɵnamespaceHTML"](),t["ɵɵelement"](13,"div",11),t["ɵɵelementEnd"]()),2&e&&(t["ɵɵadvance"](3),t["ɵɵattribute"]("id",n.arrowDefId),t["ɵɵadvance"](2),t["ɵɵattribute"]("id",n.arrowDefIdSelected),t["ɵɵadvance"](2),t["ɵɵproperty"]("ngForOf",n.model.edges),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngIf",n.dragAnimation===n.flowchartConstants.dragAnimationRepaint&&n.edgeDraggingService.edgeDragging.isDragging),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngIf",n.dragAnimation===n.flowchartConstants.dragAnimationShadow),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngForOf",n.model.nodes),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngIf",n.dragAnimation===n.flowchartConstants.dragAnimationRepaint&&n.edgeDraggingService.edgeDragging.isDragging),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngForOf",n.model.edges))},directives:[r.NgForOf,r.NgIf,_,r.NgStyle],styles:["[_nghost-%COMP%]{display:block;position:relative;width:100%;height:100%;background-size:25px 25px;background-image:linear-gradient(to right,rgba(0,0,0,.1) 1px,transparent 1px),linear-gradient(to bottom,rgba(0,0,0,.1) 1px,transparent 1px);background-color:transparent;min-width:100%;min-height:100%;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[_nghost-%COMP%] .fc-canvas-container[_ngcontent-%COMP%]{display:block;position:relative;width:100%;height:100%}[_nghost-%COMP%] .fc-canvas-container[_ngcontent-%COMP%] svg.fc-canvas-svg[_ngcontent-%COMP%]{display:block;position:relative;width:100%;height:100%}[_nghost-%COMP%] .fc-edge[_ngcontent-%COMP%]{stroke:gray;stroke-width:4;-webkit-transition:stroke-width .2s;transition:stroke-width .2s;fill:transparent}[_nghost-%COMP%] .fc-edge.fc-hover[_ngcontent-%COMP%]{stroke:gray;stroke-width:6;fill:transparent}[_nghost-%COMP%] .fc-edge.fc-selected[_ngcontent-%COMP%]{stroke:red;stroke-width:4;fill:transparent}[_nghost-%COMP%] .fc-edge.fc-active[_ngcontent-%COMP%]{-webkit-animation:3s linear infinite dash;animation:3s linear infinite dash;stroke-dasharray:20}[_nghost-%COMP%] .fc-edge.fc-dragging[_ngcontent-%COMP%]{pointer-events:none}[_nghost-%COMP%] .fc-arrow-marker[_ngcontent-%COMP%] polygon[_ngcontent-%COMP%]{stroke:gray;fill:gray}[_nghost-%COMP%] .fc-arrow-marker-selected[_ngcontent-%COMP%] polygon[_ngcontent-%COMP%]{stroke:red;fill:red}[_nghost-%COMP%] .edge-endpoint[_ngcontent-%COMP%]{fill:gray}[_nghost-%COMP%] .fc-noselect[_ngcontent-%COMP%]{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[_nghost-%COMP%] .fc-edge-label[_ngcontent-%COMP%]{position:absolute;opacity:.8;-webkit-transition:-webkit-transform .2s;transition:transform .2s;transition:transform .2s,-webkit-transform .2s;-webkit-transform-origin:bottom left;transform-origin:bottom left;margin:0 auto}[_nghost-%COMP%] .fc-edge-label[_ngcontent-%COMP%] .fc-edge-label-text[_ngcontent-%COMP%]{position:absolute;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);white-space:nowrap;text-align:center;font-size:16px}[_nghost-%COMP%] .fc-edge-label[_ngcontent-%COMP%] .fc-edge-label-text[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{cursor:default;border:solid #ff3d00;border-radius:10px;color:#ff3d00;background-color:#fff;padding:3px 5px}[_nghost-%COMP%] .fc-edge-label[_ngcontent-%COMP%] .fc-nodeedit[_ngcontent-%COMP%]{top:-30px;right:14px}[_nghost-%COMP%] .fc-edge-label[_ngcontent-%COMP%] .fc-nodedelete[_ngcontent-%COMP%]{top:-30px;right:-13px}[_nghost-%COMP%] .fc-edge-label.fc-hover[_ngcontent-%COMP%]{-webkit-transform:scale(1.25);transform:scale(1.25)}[_nghost-%COMP%] .fc-edge-label.fc-edit[_ngcontent-%COMP%] .fc-edge-label-text[_ngcontent-%COMP%] span[_ngcontent-%COMP%], [_nghost-%COMP%] .fc-edge-label.fc-selected[_ngcontent-%COMP%] .fc-edge-label-text[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{border:solid red;color:#fff;font-weight:600;background-color:red}[_nghost-%COMP%] .fc-select-rectangle[_ngcontent-%COMP%]{border:2px dashed #5262ff;position:absolute;background:rgba(20,125,255,.1);z-index:2}@-webkit-keyframes dash{from{stroke-dashoffset:500}}@keyframes dash{from{stroke-dashoffset:500}}[_nghost-%COMP%] .fc-nodeedit{display:none;font-size:15px}[_nghost-%COMP%] .fc-nodedelete{display:none;font-size:18px}[_nghost-%COMP%] .fc-edit .fc-nodedelete, [_nghost-%COMP%] .fc-edit .fc-nodeedit{display:block;position:absolute;border:2px solid #eee;border-radius:50%;font-weight:600;line-height:20px;height:20px;padding-top:2px;width:22px;background:#494949;color:#fff;text-align:center;vertical-align:bottom;cursor:pointer}[_nghost-%COMP%] .fc-edit .fc-nodeedit{top:-24px;right:16px}[_nghost-%COMP%] .fc-edit .fc-nodedelete{top:-24px;right:-13px}"],changeDetection:0}),e}(),q=function(){function e(e){this.elementRef=e}return e.prototype.ngOnInit=function(){$(this.elementRef.nativeElement).addClass(g.magnetClass)},e.prototype.dragover=function(e){return this.callbacks.edgeDragoverMagnet(e,this.connector)},e.prototype.dragleave=function(e){this.callbacks.edgeDragleaveMagnet(e)},e.prototype.drop=function(e){return this.callbacks.edgeDrop(e,this.connector)},e.prototype.dragend=function(e){this.callbacks.edgeDragend(e)},e.ɵfac=function(n){return new(n||e)(t["ɵɵdirectiveInject"](t.ElementRef))},e.ɵdir=t["ɵɵdefineDirective"]({type:e,selectors:[["","fc-magnet",""]],hostBindings:function(e,n){1&e&&t["ɵɵlistener"]("dragover",(function(e){return n.dragover(e)}))("dragleave",(function(e){return n.dragleave(e)}))("drop",(function(e){return n.drop(e)}))("dragend",(function(e){return n.dragend(e)}))},inputs:{callbacks:"callbacks",connector:"connector"}}),e}(),G=function(){function e(e){this.elementRef=e}return e.prototype.ngOnInit=function(){var e=$(this.elementRef.nativeElement);e.addClass(g.connectorClass),this.modelservice.isEditable()&&(e.attr("draggable","true"),this.updateConnectorClass());var t={type:this.connector.type,width:this.elementRef.nativeElement.offsetWidth,height:this.elementRef.nativeElement.offsetHeight,nodeRectInfo:this.nodeRectInfo};this.modelservice.connectors.setConnectorRectInfo(this.connector.id,t)},e.prototype.ngOnChanges=function(e){var t,n,o=!1;try{for(var i=c(Object.keys(e)),r=i.next();!r.done;r=i.next()){var s=r.value,a=e[s];a.firstChange||a.currentValue===a.previousValue||"mouseOverConnector"===s&&(o=!0)}}catch(e){t={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}o&&this.modelservice.isEditable()&&this.updateConnectorClass()},e.prototype.updateConnectorClass=function(){var e=$(this.elementRef.nativeElement);this.connector===this.mouseOverConnector?e.addClass(g.hoverClass):e.removeClass(g.hoverClass)},e.prototype.dragover=function(e){},e.prototype.drop=function(e){if(this.modelservice.isEditable())return this.callbacks.edgeDrop(e,this.connector)},e.prototype.dragend=function(e){this.modelservice.isEditable()&&this.callbacks.edgeDragend(e)},e.prototype.dragstart=function(e){this.modelservice.isEditable()&&this.callbacks.edgeDragstart(e,this.connector)},e.prototype.mouseenter=function(e){this.modelservice.isEditable()&&this.callbacks.connectorMouseEnter(e,this.connector)},e.prototype.mouseleave=function(e){this.modelservice.isEditable()&&this.callbacks.connectorMouseLeave(e,this.connector)},e.ɵfac=function(n){return new(n||e)(t["ɵɵdirectiveInject"](t.ElementRef))},e.ɵdir=t["ɵɵdefineDirective"]({type:e,selectors:[["","fc-connector",""]],hostBindings:function(e,n){1&e&&t["ɵɵlistener"]("dragover",(function(e){return n.dragover(e)}))("drop",(function(e){return n.drop(e)}))("dragend",(function(e){return n.dragend(e)}))("dragstart",(function(e){return n.dragstart(e)}))("mouseenter",(function(e){return n.mouseenter(e)}))("mouseleave",(function(e){return n.mouseleave(e)}))},inputs:{callbacks:"callbacks",modelservice:"modelservice",connector:"connector",nodeRectInfo:"nodeRectInfo",mouseOverConnector:"mouseOverConnector"},features:[t["ɵɵNgOnChangesFeature"]()]}),e}();function K(e,n){if(1&e&&(t["ɵɵelementStart"](0,"div",5),t["ɵɵelement"](1,"div",6),t["ɵɵelementEnd"]()),2&e){var o=n.$implicit,i=t["ɵɵnextContext"]();t["ɵɵproperty"]("connector",o)("callbacks",i.callbacks),t["ɵɵadvance"](1),t["ɵɵproperty"]("connector",o)("nodeRectInfo",i.nodeRectInfo)("mouseOverConnector",i.mouseOverConnector)("callbacks",i.callbacks)("modelservice",i.modelservice)}}function J(e,n){if(1&e&&(t["ɵɵelementStart"](0,"div",5),t["ɵɵelement"](1,"div",6),t["ɵɵelementEnd"]()),2&e){var o=n.$implicit,i=t["ɵɵnextContext"]();t["ɵɵproperty"]("connector",o)("callbacks",i.callbacks),t["ɵɵadvance"](1),t["ɵɵproperty"]("connector",o)("nodeRectInfo",i.nodeRectInfo)("mouseOverConnector",i.mouseOverConnector)("callbacks",i.callbacks)("modelservice",i.modelservice)}}function Q(e,n){if(1&e){var o=t["ɵɵgetCurrentView"]();t["ɵɵelementStart"](0,"div",7),t["ɵɵlistener"]("click",(function(e){t["ɵɵrestoreView"](o);var n=t["ɵɵnextContext"]();return n.userNodeCallbacks.nodeEdit(e,n.node)})),t["ɵɵelement"](1,"i",8),t["ɵɵelementEnd"]()}}function U(e,n){if(1&e){var o=t["ɵɵgetCurrentView"]();t["ɵɵelementStart"](0,"div",9),t["ɵɵlistener"]("click",(function(e){t["ɵɵrestoreView"](o);var n=t["ɵɵnextContext"]();return n.modelservice.nodes.delete(n.node)})),t["ɵɵtext"](1," × "),t["ɵɵelementEnd"]()}}var Z=function(e){function n(){return e.call(this)||this}return a(n,e),n.ɵfac=function(e){return new(e||n)},n.ɵcmp=t["ɵɵdefineComponent"]({type:n,selectors:[["fc-default-node"]],features:[t["ɵɵInheritDefinitionFeature"]],decls:11,vars:14,consts:[[3,"dblclick"],[1,"innerNode"],["fc-magnet","",3,"connector","callbacks",4,"ngFor","ngForOf"],["class","fc-nodeedit",3,"click",4,"ngIf"],["class","fc-nodedelete",3,"click",4,"ngIf"],["fc-magnet","",3,"connector","callbacks"],["fc-connector","",3,"connector","nodeRectInfo","mouseOverConnector","callbacks","modelservice"],[1,"fc-nodeedit",3,"click"],["aria-hidden","true",1,"fa","fa-pencil"],[1,"fc-nodedelete",3,"click"]],template:function(e,n){1&e&&(t["ɵɵelementStart"](0,"div",0),t["ɵɵlistener"]("dblclick",(function(e){return n.userNodeCallbacks.doubleClick(e,n.node)})),t["ɵɵelement"](1,"div"),t["ɵɵelementStart"](2,"div",1),t["ɵɵelementStart"](3,"p"),t["ɵɵtext"](4),t["ɵɵelementEnd"](),t["ɵɵelementStart"](5,"div"),t["ɵɵtemplate"](6,K,2,7,"div",2),t["ɵɵelementEnd"](),t["ɵɵelementStart"](7,"div"),t["ɵɵtemplate"](8,J,2,7,"div",2),t["ɵɵelementEnd"](),t["ɵɵelementEnd"](),t["ɵɵtemplate"](9,Q,2,0,"div",3),t["ɵɵtemplate"](10,U,2,0,"div",4),t["ɵɵelementEnd"]()),2&e&&(t["ɵɵadvance"](1),t["ɵɵclassMap"](n.flowchartConstants.nodeOverlayClass),t["ɵɵadvance"](3),t["ɵɵtextInterpolate"](n.node.name),t["ɵɵadvance"](1),t["ɵɵclassMap"](n.flowchartConstants.leftConnectorClass),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngForOf",n.modelservice.nodes.getConnectorsByType(n.node,n.flowchartConstants.leftConnectorType)),t["ɵɵadvance"](1),t["ɵɵclassMap"](n.flowchartConstants.rightConnectorClass),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngForOf",n.modelservice.nodes.getConnectorsByType(n.node,n.flowchartConstants.rightConnectorType)),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngIf",n.modelservice.isEditable()&&!n.node.readonly),t["ɵɵadvance"](1),t["ɵɵproperty"]("ngIf",n.modelservice.isEditable()&&!n.node.readonly))},directives:[r.NgForOf,r.NgIf,q,G],styles:["[_nghost-%COMP%] .fc-node-overlay[_ngcontent-%COMP%]{position:absolute;pointer-events:none;left:0;top:0;right:0;bottom:0;background-color:#000;opacity:0}[_nghost-%COMP%] .fc-hover[_nghost-%COMP%] .fc-node-overlay[_ngcontent-%COMP%], .fc-hover [_nghost-%COMP%] .fc-node-overlay[_ngcontent-%COMP%]{opacity:.25;-webkit-transition:opacity .2s;transition:opacity .2s}[_nghost-%COMP%] .fc-selected[_nghost-%COMP%] .fc-node-overlay[_ngcontent-%COMP%], .fc-selected [_nghost-%COMP%] .fc-node-overlay[_ngcontent-%COMP%]{opacity:.25}[_nghost-%COMP%] .innerNode[_ngcontent-%COMP%]{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;min-width:100px;border-radius:5px;background-color:#f15b26;color:#fff;font-size:16px;pointer-events:none}[_nghost-%COMP%] .innerNode[_ngcontent-%COMP%] p[_ngcontent-%COMP%]{padding:0 15px;text-align:center}"]}),n}(N),ee=function(){function e(){}return e.ɵmod=t["ɵɵdefineNgModule"]({type:e}),e.ɵinj=t["ɵɵdefineInjector"]({factory:function(t){return new(t||e)},providers:[S,x,{provide:l,useValue:{nodeComponentType:Z}}],imports:[[r.CommonModule]]}),e}();("undefined"==typeof ngJitMode||ngJitMode)&&t["ɵɵsetNgModuleScope"](ee,{declarations:[W,q,G,_,Z],imports:[r.CommonModule],exports:[W,q,G,Z]}),e.DefaultFcNodeComponent=Z,e.FC_NODE_COMPONENT_CONFIG=l,e.FcConnectorDirective=G,e.FcMagnetDirective=q,e.FcNodeComponent=N,e.FlowchartConstants=g,e.ModelvalidationError=u,e.NgxFlowchartComponent=W,e.NgxFlowchartModule=ee,e.fcTopSort=f,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ngx-flowchart.umd.min.js.map