@elyra/canvas 13.6.0 → 13.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common-canvas-37153a9b.js +2 -0
- package/dist/common-canvas-37153a9b.js.map +1 -0
- package/dist/common-canvas-feb502ad.js +2 -0
- package/dist/common-canvas-feb502ad.js.map +1 -0
- package/dist/common-canvas.es.js +1 -1
- package/dist/common-canvas.js +1 -1
- package/dist/lib/canvas.es.js +1 -1
- package/dist/lib/canvas.js +1 -1
- package/package.json +1 -1
- package/src/common-canvas/cc-text-toolbar.jsx +1 -1
- package/stats.html +1 -1
- package/dist/common-canvas-c0649f39.js +0 -2
- package/dist/common-canvas-c0649f39.js.map +0 -1
- package/dist/common-canvas-ef9e9503.js +0 -2
- package/dist/common-canvas-ef9e9503.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=require("./createClass-df7b07d6.js"),t=require("./inherits-74e481d1.js"),n=require("react"),i=require("react-redux"),o=require("react-intl"),a=require("./toolbar-2d123749.js"),r=require("./bucket-9-b3e5da9a.js"),s=require("./icon-85fb8195.js"),l=require("./isArrayLikeObject-04f333a5.js"),c=require("react-inlinesvg"),u=require("./canvas-constants-86cd0212.js"),d=require("./datarecord-metadata-v3-schema-8eae7888.js"),h=require("@carbon/react"),g=require("./canvas-logger-45fa2be6.js"),p=require("./lib/tooltip.js"),f=require("react-resize-detector"),v=require("./canvas-controller-8c472b10.js"),y=require("./context-menu-wrapper-6f20f1ac.js"),m=require("./en-e474feb0.js"),b=require("react-dom");function k(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var C=k(n),x=k(c),T=k(f),L=k(b),P="Find palette nodes",N="No results found.",S="Try adjusting your search to find what you're looking for.",_="Results restricted to 10 nodes. Try refining your search.",E="Show more",I="Show less",D="Flyout Palette",O="Dialog Palette";function w(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,A()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(A=function(){return!!e})()}var M=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=w(this,i,[t])).state={},n.mouseDown=n.mouseDown.bind(n),n.doubleClick=n.doubleClick.bind(n),n.toolbarActionHandler=n.toolbarActionHandler.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"mouseDown",value:function(e){this.props.mouseDownMethod(e)}},{key:"doubleClick",value:function(e){this.props.windowMaximizeMethod(e)}},{key:"toolbarActionHandler",value:function(e){"close"===e?this.props.canvasController.closePalette():"grid"===e?this.props.showGridMethod(!0):"list"===e&&this.props.showGridMethod(!1)}},{key:"render",value:function(){var e={leftBar:[{action:"grid",iconEnabled:C.default.createElement(a.Grid,null),enable:!0,isSelected:this.props.showGrid},{action:"list",iconEnabled:C.default.createElement(r.List,null),enable:!0,isSelected:!this.props.showGrid},{divider:!0}],rightBar:[{divider:!0},{action:"close",iconEnabled:C.default.createElement(s.CloseOutline,null),enable:!0}]};return C.default.createElement("div",{className:"palette-dialog-topbar",onMouseDown:this.mouseDown,onDoubleClick:this.doubleClick},C.default.createElement(a.Toolbar,{instanceId:0,config:e,toolbarActionHandler:this.toolbarActionHandler}))}}])}(C.default.Component);function z(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,U()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(U=function(){return!!e})()}var R=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=z(this,i,[t])).state={},n.categorySelected=n.categorySelected.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"categorySelected",value:function(e){this.props.categorySelectedMethod(e)}},{key:"render",value:function(){var e="palette-dialog-category";return this.props.selectedCategory===this.props.category.label&&(e="palette-dialog-category-selected"),C.default.createElement("div",{"data-id":this.props.category.id,className:e,onClick:this.categorySelected},this.props.category.label)}}])}(C.default.Component);function H(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,j()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(j=function(){return!!e})()}var F=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=H(this,i,[t])).state={},n}return t._inherits(i,n),e._createClass(i,[{key:"render",value:function(){for(var e=[],t=0;t<this.props.categories.length;t++)e.push(C.default.createElement(R,{key:this.props.categories[t].label,category:this.props.categories[t],selectedCategory:this.props.selectedCategory,categorySelectedMethod:this.props.categorySelectedMethod}));return C.default.createElement("div",{className:"palette-dialog-categories palette-scroll"},e)}}])}(C.default.Component),B="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2060%22%3E%20%3Cpath%20d%3D%22M32%2C42a1.61%2C1.61%2C0%2C0%2C1-.8-.2L9.28%2C30.15l1.6-2.94L32%2C38.47%2C53.12%2C27.21l1.6%2C2.94L32.8%2C41.84A1.71%2C1.71%2C0%2C0%2C1%2C32%2C42Z%22%2F%3E%20%3Cpath%20d%3D%22M32%2C52.05a1.72%2C1.72%2C0%2C0%2C1-.8-.2L9.28%2C40.17l1.6-2.94L32%2C48.48%2C53.12%2C37.23l1.6%2C2.94L32.8%2C51.85A1.72%2C1.72%2C0%2C0%2C1%2C32%2C52.05Z%22%2F%3E%20%3Cpath%20d%3D%22M32%2C32a1.72%2C1.72%2C0%2C0%2C1-.8-.2L9.28%2C20.14a1.66%2C1.66%2C0%2C0%2C1%2C0-2.94L31.2%2C5.52a1.68%2C1.68%2C0%2C0%2C1%2C1.6%2C0L54.72%2C17.2a1.66%2C1.66%2C0%2C0%2C1%2C.69%2C2.26%2C1.74%2C1.74%2C0%2C0%2C1-.69.68L32.8%2C31.82A1.72%2C1.72%2C0%2C0%2C1%2C32%2C32ZM13.64%2C18.67%2C32%2C28.46l18.36-9.79L32%2C8.88Z%22%2F%3E%20%3Crect%20x%3D%225.02%22%20y%3D%221.98%22%20width%3D%2253.96%22%20height%3D%2253.41%22%20fill%3D%22none%22%2F%3E%3C%2Fsvg%3E",G="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2060%22%3E%20%3Cpolygon%20points%3D%2217.28%204.63%2026.88%2014.07%2024.74%2015.87%2018.94%2010.35%2018.94%2026.29%2015.78%2026.29%2015.78%2010.35%209.97%2016.12%207.91%2014.04%2017.28%204.63%22%2F%3E%20%3Cpath%20d%3D%22M32.39%2C6.36l.2.1%2C20.35%2C11a2.7%2C2.7%2C0%2C0%2C1%2C1.11%2C1.11%2C2.74%2C2.74%2C0%2C0%2C1-.89%2C3.59l-.22.13L33%2C33a2.66%2C2.66%2C0%2C0%2C1-2.51%2C0l-6-3.13a1.83%2C1.83%2C0%2C1%2C1%2C1.69-3.25l5.57%2C2.89%2C18-9.69L30.85%2C9.68A1.83%2C1.83%2C0%2C0%2C1%2C30%2C7.39l.09-.19A1.83%2C1.83%2C0%2C0%2C1%2C32.39%2C6.36Z%22%2F%3E%20%3Cpath%20d%3D%22M53%2C28.53l1.62%2C3L32.52%2C43.43a1.59%2C1.59%2C0%2C0%2C1-.8.21%2C1.66%2C1.66%2C0%2C0%2C1-.81-.21L8.8%2C31.53l1.61-3L31.72%2C40Z%22%2F%3E%20%3Cpath%20d%3D%22M53%2C38.74l1.62%2C3L32.52%2C53.64a1.69%2C1.69%2C0%2C0%2C1-.8.2%2C1.76%2C1.76%2C0%2C0%2C1-.81-.2L8.8%2C41.73l1.61-3L31.72%2C50.21Z%22%2F%3E%3C%2Fsvg%3E";function W(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Y()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Y=function(){return!!e})()}var K=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=W(this,i,[t])).state={},n.ghostData=null,n.onDragStart=n.onDragStart.bind(n),n.onDragEnd=n.onDragEnd.bind(n),n.onDoubleClick=n.onDoubleClick.bind(n),n.onMouseOver=n.onMouseOver.bind(n),n.onMouseLeave=n.onMouseLeave.bind(n),n.onMouseDown=n.onMouseDown.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"onMouseDown",value:function(){this.props.canvasController.closeTip(),this.ghostData=this.props.canvasController.getGhostNode(this.props.nodeTemplate)}},{key:"onDragStart",value:function(e){this.props.canvasController.nodeTemplateDragStart(this.ghostData.nodeTemplate),e.dataTransfer.setData(u.DND_DATA_TEXT,""),this.ghostData&&e.dataTransfer.setDragImage(this.ghostData.element,this.ghostData.centerX,this.ghostData.centerY)}},{key:"onDragEnd",value:function(){this.props.canvasController.nodeTemplateDragEnd()}},{key:"onDoubleClick",value:function(){if(this.props.canvasController.createAutoNode){var e=this.props.canvasController.convertNodeTemplate(this.props.nodeTemplate);this.props.canvasController.createAutoNode(e)}}},{key:"onMouseOver",value:function(e){if(0===e.buttons){var t=this.props.category.empty_text?{app_data:{ui_data:{label:this.props.category.empty_text}}}:this.props.nodeTemplate;this.props.canvasController.openTip({id:"paletteTip_"+this.props.nodeTemplate.op,type:u.TIP_TYPE_PALETTE_ITEM,targetObj:e.currentTarget,nodeTemplate:t,category:this.props.category})}}},{key:"onMouseLeave",value:function(){this.props.canvasController.closeTip()}},{key:"render",value:function(){var t="";l.has_1(this.props.nodeTemplate,"app_data.ui_data.label")&&(t=this.props.nodeTemplate.app_data.ui_data.label);var n=C.default.createElement("div",{className:"node-icon"});if(l.has_1(this.props.nodeTemplate,"app_data.ui_data.image")){var i=this.props.nodeTemplate.app_data.ui_data.image;i===u.USE_DEFAULT_ICON?i=B:i===u.USE_DEFAULT_EXT_ICON&&(i=G),"object"===e._typeof(i)&&C.default.isValidElement(i)?n=i:"string"==typeof i&&(n=i.endsWith(".svg")?C.default.createElement(x.default,{src:i,className:"node-icon",alt:t}):C.default.createElement("img",{src:i,className:"node-icon",alt:t}))}var o=this.props.isEditingEnabled?"true":"false",a="palette-dialog-grid-node-text";return this.props.category&&0===this.props.category.node_types.length&&this.props.category.empty_text&&(t=this.props.category.empty_text,o="false",a="palette-dialog-grid-node-text-warning",n=C.default.createElement(s.Icon,{type:u.CANVAS_CARBON_ICONS.WARNING_UNFILLED,className:"palette-dialog-grid-node-icon-warning",draggable:"false"})),C.default.createElement("div",{id:this.props.nodeTemplate.id,"data-id":this.props.nodeTemplate.op,draggable:o,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave,onMouseDown:this.props.isEditingEnabled?this.onMouseDown:null,onDragStart:this.props.isEditingEnabled?this.onDragStart:null,onDragEnd:this.props.isEditingEnabled?this.onDragEnd:null,onDoubleClick:this.props.isEditingEnabled?this.onDoubleClick:null,className:"palette-dialog-grid-node-outer"},C.default.createElement("div",{className:"palette-dialog-grid-node-inner"},C.default.createElement("div",{className:"palette-dialog-grid-node-icon"},n),C.default.createElement("div",{className:a},t)))}}])}(C.default.Component),X=K;function V(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Z()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Z(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Z=function(){return!!e})()}var q=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=V(this,i,[t])).state={},n}return t._inherits(i,n),e._createClass(i,[{key:"render",value:function(){var e=[];if(this.props.category&&this.props.category.node_types&&0===this.props.category.node_types.length&&this.props.category.empty_text)e.push(C.default.createElement(X,{key:"pal_grid_node_empty",category:this.props.category,nodeTemplate:{},canvasController:this.props.canvasController,isEditingEnabled:this.props.isEditingEnabled}));else for(var t=0;t<this.props.nodeTypes.length;t++)e.push(C.default.createElement(X,{key:"pal_grid_node_"+t,category:this.props.category,nodeTemplate:this.props.nodeTypes[t],canvasController:this.props.canvasController,isEditingEnabled:this.props.isEditingEnabled}));return C.default.createElement("div",{width:"100%",className:"palette-scroll"},e)}}])}(C.default.Component);function J(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,$()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function $(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return($=function(){return!!e})()}var Q=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=J(this,i,[t])).state={showFullDescription:!1},n.ghostData=null,n.showFullDescription=n.showFullDescription.bind(n),n.showShortDescription=n.showShortDescription.bind(n),n.onDragStart=n.onDragStart.bind(n),n.onDragEnd=n.onDragEnd.bind(n),n.onDoubleClick=n.onDoubleClick.bind(n),n.onMouseOver=n.onMouseOver.bind(n),n.onMouseLeave=n.onMouseLeave.bind(n),n.onMouseDown=n.onMouseDown.bind(n),n.onKeyDown=n.onKeyDown.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"onMouseDown",value:function(){this.props.canvasController.closeTip(),this.ghostData=this.props.canvasController.getGhostNode(this.props.nodeTypeInfo.nodeType)}},{key:"onDragStart",value:function(e){this.props.canvasController.nodeTemplateDragStart(this.ghostData.nodeTemplate),e.dataTransfer.setData(u.DND_DATA_TEXT,""),this.ghostData&&e.dataTransfer.setDragImage(this.ghostData.element,this.ghostData.centerX,this.ghostData.centerY)}},{key:"onKeyDown",value:function(e){" "!==e.key&&"Space"!==e.code&&32!==e.keyCode||this.onDoubleClick()}},{key:"onDragEnd",value:function(){this.props.canvasController.nodeTemplateDragEnd()}},{key:"onDoubleClick",value:function(){if(this.props.canvasController.createAutoNode&&!this.isItemDisabled()){var e=this.props.canvasController.convertNodeTemplate(this.props.nodeTypeInfo.nodeType);this.props.canvasController.createAutoNode(e)}}},{key:"onMouseOver",value:function(e){if(!this.props.isDisplaySearchResult&&0===e.buttons){var t=this.props.nodeTypeInfo.category.empty_text?{app_data:{ui_data:{label:this.props.nodeTypeInfo.category.empty_text}}}:this.props.nodeTypeInfo.nodeType;this.props.canvasController.openTip({id:"paletteTip_"+this.props.nodeTypeInfo.nodeType.op,type:u.TIP_TYPE_PALETTE_ITEM,targetObj:e.currentTarget,nodeTemplate:t,category:this.props.nodeTypeInfo.category})}}},{key:"onMouseLeave",value:function(){this.props.canvasController.closeTip()}},{key:"getHighlightedCategoryLabel",value:function(){return this.getHighlightedText(this.props.nodeTypeInfo.category.label,this.props.nodeTypeInfo.occurrenceInfo.catLabelOccurrences)}},{key:"getHighlightedLabel",value:function(e){return this.getHighlightedText(e,this.props.nodeTypeInfo.occurrenceInfo.nodeLabelOccurrences)}},{key:"getHighlightedDesc",value:function(){var e=this.props.nodeTypeInfo.nodeType.app_data.ui_data.description,t=this.props.nodeTypeInfo.occurrenceInfo.nodeDescOccurrences,n=!1;if(e.length>150&&(n=!0,!this.state.showFullDescription)){var i=this.getAbbreviatedDescription(e,t,150);e=i.abbrDesc,t=i.occurrences}var o=this.getHighlightedText(e,t);if(n)if(this.state.showFullDescription){var a=this.props.intl.formatMessage({id:"palette.flyout.search.less",defaultMessage:I});o.push(C.default.createElement("div",{key:"l_btn",className:"palette-list-item-desc-button",onClick:this.showShortDescription},a))}else{var r=this.props.intl.formatMessage({id:"palette.flyout.search.more",defaultMessage:E});o.push(C.default.createElement("div",{key:"m_btn",className:"palette-list-item-desc-button",onClick:this.showFullDescription},r))}return o}},{key:"getAbbreviatedDescription",value:function(e,t,n){if(0===t.length)return{abbrDesc:e.substring(0,n)+" ...",occurrences:t};var i=t[0].start,o=e.length-i,a="",r=0;return i<n?(r=0,a=e.substring(r,n)+" ..."):o>n?(r=i,a="... "+e.substring(r,i+n)+" ...",r-=4):(r=e.length-n,a="... "+e.substring(r,e.length),r-=4),{abbrDesc:a,occurrences:t.map((function(e){return{start:e.start-r,end:e.end-r}}))}}},{key:"getHighlightedText",value:function(e,t){if(!t||0===t.length)return[C.default.createElement("span",{key:"o"},e)];var n=[],i=0,o="";return t.forEach((function(a,r){o=e.substring(i,a.start),n.push(C.default.createElement("span",{key:"s"+r},o)),o=e.substring(a.start,a.end),n.push(C.default.createElement("mark",{key:"m"+r},o)),i=a.end,r===t.length-1&&a.end<e.length&&(o=e.substring(a.end),n.push(C.default.createElement("span",{key:"f"+r},o)))})),n}},{key:"getMainDivClass",value:function(){var e,t,n,i,o=null===(e=this.props.nodeTypeInfo)||void 0===e||null===(t=e.nodeType)||void 0===t||null===(n=t.app_data)||void 0===n||null===(i=n.ui_data)||void 0===i?void 0:i.palette_class_name,a=this.props.isDisplaySearchResult?"palette-list-item search-result":"palette-list-item";return a+=o?" "+o:""}},{key:"showFullDescription",value:function(){this.setState({showFullDescription:!0})}},{key:"showShortDescription",value:function(){this.setState({showFullDescription:!1})}},{key:"isItemDisabled",value:function(){var e,t,n,i=null===(e=this.props.nodeTypeInfo.nodeType)||void 0===e||null===(t=e.app_data)||void 0===t||null===(n=t.ui_data)||void 0===n?void 0:n.palette_disabled;return!this.props.isEditingEnabled||i}},{key:"render",value:function(){var t=null,n=l.get_1(this.props,"nodeTypeInfo.nodeType.app_data.ui_data.label",""),i=this.isItemDisabled()?"false":"true",o=null;if(l.has_1(this.props.nodeTypeInfo.nodeType,"app_data.ui_data.image")){var a=this.props.nodeTypeInfo.nodeType.app_data.ui_data.palette_image?this.props.nodeTypeInfo.nodeType.app_data.ui_data.palette_image:this.props.nodeTypeInfo.nodeType.app_data.ui_data.image;a===u.USE_DEFAULT_ICON?a=B:a===u.USE_DEFAULT_EXT_ICON&&(a=G),"object"===e._typeof(a)&&C.default.isValidElement(a)?o=a:"string"==typeof a&&(o=a.endsWith(".svg")?C.default.createElement(x.default,{src:a,className:"palette-list-item-icon",draggable:"false"}):C.default.createElement("img",{src:a,className:"palette-list-item-icon",draggable:"false",alt:""}))}!n||!this.props.isPaletteOpen&&o||(t=this.props.isDisplaySearchResult?this.getHighlightedLabel(n):C.default.createElement("span",null,n));var r=this.props.isShowRanking&&this.props.isDisplaySearchResult&&l.has_1(this.props.nodeTypeInfo,"occurrenceInfo.ranking")?C.default.createElement("span",null,this.props.nodeTypeInfo.occurrenceInfo.ranking):null;0===this.props.nodeTypeInfo.category.node_types.length&&this.props.nodeTypeInfo.category.empty_text&&(n=this.props.nodeTypeInfo.category.empty_text,this.props.isPaletteOpen&&(t=C.default.createElement("span",null,n)),i="false",o=C.default.createElement(s.Icon,{type:u.CANVAS_CARBON_ICONS.WARNING_UNFILLED,className:"palette-list-item-icon-warning",draggable:"false"}));var c=this.getMainDivClass(),d=this.props.isDisplaySearchResult?C.default.createElement("div",{className:"palette-list-item-category-label"},this.getHighlightedCategoryLabel()):null,h=this.props.isDisplaySearchResult&&l.has_1(this.props.nodeTypeInfo.nodeType,"app_data.ui_data.description")&&this.props.nodeTypeInfo.nodeType.app_data.ui_data.description?C.default.createElement("div",{className:"palette-list-item-description"},this.getHighlightedDesc()):null,g=t?C.default.createElement("div",{className:"palette-list-item-text-div",tabIndex:"-1"},t):null;return C.default.createElement("div",{"data-id":this.props.nodeTypeInfo.nodeType.op,tabIndex:0,role:"button","aria-label":n,draggable:i,className:c,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave,onKeyDown:this.props.isEditingEnabled?this.onKeyDown:null,onMouseDown:this.props.isEditingEnabled?this.onMouseDown:null,onDragStart:this.props.isEditingEnabled?this.onDragStart:null,onDragEnd:this.props.isEditingEnabled?this.onDragEnd:null,onDoubleClick:this.props.isEditingEnabled?this.onDoubleClick:null},d,C.default.createElement("div",{className:"palette-list-item-icon-and-text",tabIndex:"-1"},o,g,r),h)}}])}(C.default.Component),ee=o.injectIntl(Q);function te(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,ne()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function ne(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ne=function(){return!!e})()}var ie=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=te(this,i,[t])).state={},n}return t._inherits(i,n),e._createClass(i,[{key:"render",value:function(){var e=[];if(this.props.category&&this.props.category.node_types&&0===this.props.category.node_types.length&&this.props.category.empty_text)e.push(C.default.createElement("div",{key:"item_empty"},C.default.createElement(ee,{nodeTypeInfo:{nodeType:{},category:this.props.category},isDisplaySearchResult:!1,canvasController:this.props.canvasController,isPaletteOpen:this.props.isPaletteOpen,isEditingEnabled:this.props.isEditingEnabled})));else for(var t=0;t<this.props.nodeTypeInfos.length;t++){var n="item_"+t;e.push(C.default.createElement(ee,{key:n,nodeTypeInfo:this.props.nodeTypeInfos[t],isDisplaySearchResult:!1,canvasController:this.props.canvasController,isPaletteOpen:this.props.isPaletteOpen,isEditingEnabled:this.props.isEditingEnabled}))}return C.default.createElement("div",{width:"100%",draggable:"false",className:"palette-content-list palette-scroll"},e)}}])}(C.default.Component);function oe(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,ae()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function ae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ae=function(){return!!e})()}var re=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=oe(this,i,[t])).state={selectedCategory:""},n.categorySelected=n.categorySelected.bind(n),n.getUniqueCategories=n.getUniqueCategories.bind(n),n.getSelectedCategory=n.getSelectedCategory.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"getUniqueCategories",value:function(e){var t=[];if(e)for(var n=0;n<e.length;n++)-1===t.indexOf(e[n].label)&&t.push(e[n]);return t}},{key:"getSelectedCategory",value:function(e){var t={};if(e)for(var n=0;n<e.length;n++)e[n].label===this.state.selectedCategory&&(t=e[n]);return t}},{key:"categorySelected",value:function(e){this.setState({selectedCategory:e.target.firstChild.data})}},{key:"render",value:function(){var e=this.getUniqueCategories(this.props.paletteJSON.categories),t=this.getSelectedCategory(this.props.paletteJSON.categories),n=t&&t.node_types?t.node_types:[],i=n.map((function(e){return{nodeType:e,category:t}})),o=this.props.showGrid?C.default.createElement(q,{category:t,nodeTypes:n,canvasController:this.props.canvasController,isEditingEnabled:this.props.isEditingEnabled}):C.default.createElement(ie,{category:t,nodeTypeInfos:i,canvasController:this.props.canvasController,isPaletteOpen:!0,isEditingEnabled:this.props.isEditingEnabled});return C.default.createElement("div",{className:"palette-dialog-content",ref:"palettecontent"},C.default.createElement(F,{categories:e,selectedCategory:this.state.selectedCategory,categorySelectedMethod:this.categorySelected}),o)}}],[{key:"getDerivedStateFromProps",value:function(e,t){return e.paletteJSON&&e.paletteJSON.categories&&e.paletteJSON.categories.length>0&&""===t.selectedCategory?{selectedCategory:e.paletteJSON.categories[0].label}:{}}}])}(C.default.Component);function se(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,le()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function le(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(le=function(){return!!e})()}var ce=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=se(this,i,[t])).state={xPos:100,yPos:100,showGrid:!0},n.showGrid=n.showGrid.bind(n),n.mouseDownOnTopBar=n.mouseDownOnTopBar.bind(n),n.mouseDownOnPalette=n.mouseDownOnPalette.bind(n),n.mouseMove=n.mouseMove.bind(n),n.mouseUp=n.mouseUp.bind(n),n.windowResize=n.windowResize.bind(n),n.windowMaximize=n.windowMaximize.bind(n),n.getPaletteDiv=n.getPaletteDiv.bind(n),n.resizePalette=n.resizePalette.bind(n),n.movePalette=n.movePalette.bind(n),n.setResizingCursors=n.setResizingCursors.bind(n),n.setSizingHoverEdge=n.setSizingHoverEdge.bind(n),n.snapToWidth=n.snapToWidth.bind(n),n.snapToHeight=n.snapToHeight.bind(n),n.removePx=n.removePx.bind(n),n.dragging=!1,n.dragOffsetY=0,n.dragOffsetX=0,n.verticalSizingAction="",n.verticalSizingHover="",n.horizontalSizingAction="",n.hoizontalSizingHover="",n.savedWidth=0,n.savedLeft=0,n.savedHeight=0,n.savedTop=0,n.hoverZoneSize=3,n.totalHoverZoneSize=2*n.hoverZoneSize,n.adjustedWidth=137,n.adjustedHeight=51,n.adjustedScrollBarWidth=15,n.isMaximized=!1,n.paletteNodes=[],n.hackPaletteOffset=46,n.hackPaletteTopOffset=n.hackPaletteOffset+4,window.addEventListener("mousemove",n.mouseMove,!1),window.addEventListener("mouseup",n.mouseUp,!1),window.addEventListener("resize",n.windowResize,!1),n}return t._inherits(i,n),e._createClass(i,[{key:"componentDidUpdate",value:function(){this.windowResize()}},{key:"componentWillUnmount",value:function(){window.removeEventListener("mousemove",this.mouseMove),window.removeEventListener("mouseup",this.mouseUp),window.removeEventListener("resize",this.windowResize)}},{key:"getAdjustedMousePositionBottom",value:function(e,t){var n=e.clientY;return n>t.offsetTop+t.offsetHeight-this.hoverZoneSize&&(n=t.offsetTop+t.offsetHeight-this.hoverZoneSize),n}},{key:"getAdjustedMousePositionLeft",value:function(e,t){var n=e.clientX;return n<t.offsetLeft+this.hoverZoneSize&&(n=t.offsetLeft+this.hoverZoneSize),n}},{key:"getAdjustedMousePositionRight",value:function(e,t){var n=e.clientX;return n>t.offsetLeft+t.offsetWidth-this.hoverZoneSize&&(n=t.offsetLeft+t.offsetWidth-this.hoverZoneSize),n}},{key:"getAdjustedMousePositionTop",value:function(e,t){var n=e.clientY;return n<t.offsetTop+this.hoverZoneSize&&(n=t.offsetTop+this.hoverZoneSize),n}},{key:"getPaletteDiv",value:function(){return this.refs.palette}},{key:"getStyleProperty",value:function(e,t){var n=e.charAt(0),i=e.substring(1),o="#"===n?document.getElementById(i):document.getElementsByClassName(i)[0];return window.getComputedStyle(o,null).getPropertyValue(t)}},{key:"setResizingCursors",value:function(e){var t=this.getPaletteDiv();this.setSizingHoverEdge(e,t),"top"===this.verticalSizingHover?"left"===this.horizontalSizingHover?t.style.cursor="nwse-resize":"right"===this.horizontalSizingHover?t.style.cursor="nesw-resize":t.style.cursor="ns-resize":"bottom"===this.verticalSizingHover?"left"===this.horizontalSizingHover?t.style.cursor="nesw-resize":"right"===this.horizontalSizingHover?t.style.cursor="nwse-resize":t.style.cursor="ns-resize":"left"===this.horizontalSizingHover||"right"===this.horizontalSizingHover?t.style.cursor="ew-resize":t.style.cursor="default"}},{key:"setContentDivHeight",value:function(e,t){var n=t-this.removePx(this.getStyleProperty(".palette-dialog-topbar","height"))-this.totalHoverZoneSize+"px",i=e.childNodes[1];i.style.height=n,i.childNodes[0].style.height=n,i.childNodes[1].style.height=n,i.childNodes[2].style.height=n}},{key:"setSizingHoverEdge",value:function(e,t){e.clientX>t.offsetLeft&&e.clientX<t.offsetLeft+this.totalHoverZoneSize?this.horizontalSizingHover="left":e.clientX<t.offsetLeft+t.offsetWidth&&e.clientX>t.offsetLeft+t.offsetWidth-this.totalHoverZoneSize?this.horizontalSizingHover="right":(this.horizontalSizingHover="",this.horizontalSizingAction=""),e.clientY>t.offsetTop+this.hackPaletteTopOffset&&e.clientY<t.offsetTop+this.hackPaletteTopOffset+this.totalHoverZoneSize?this.verticalSizingHover="top":e.clientY<t.offsetTop+t.offsetHeight+this.hackPaletteOffset&&e.clientY>t.offsetTop+t.offsetHeight+this.hackPaletteOffset-this.totalHoverZoneSize?this.verticalSizingHover="bottom":(this.verticalSizingHover="",this.verticalSizingAction="")}},{key:"mouseDownOnTopBar",value:function(e){this.dragging=!0;var t=this.getPaletteDiv();this.dragOffsetX=e.clientX-t.offsetLeft,this.dragOffsetY=e.clientY-t.offsetTop}},{key:"mouseDownOnPalette",value:function(e){var t=this.getPaletteDiv();""===this.verticalSizingHover&&""===this.horizontalSizingHover||(this.verticalSizingAction=this.verticalSizingHover,this.horizontalSizingAction=this.horizontalSizingHover,this.savedWidth=t.offsetWidth,this.savedLeft=t.offsetLeft,this.savedHeight=t.offsetHeight,this.savedTop=t.offsetTop)}},{key:"mouseMove",value:function(e){""!==this.verticalSizingAction||""!==this.horizontalSizingAction?this.resizePalette(e):!0===this.dragging?this.movePalette(e):this.setResizingCursors(e)}},{key:"mouseUp",value:function(){var e=this.getPaletteDiv();if(this.state.showGrid&&""!==this.horizontalSizingAction){var t=this.removePx(e.style.width);""!==t&&(t=this.snapToWidth(t)),e.style.width=t+"px";var n=e.childNodes[1].childNodes[1];n.clientHeight<n.scrollHeight&&(e.style.width=t+this.adjustedScrollBarWidth+"px")}if(""!==this.verticalSizingAction){var i=this.removePx(e.style.height);if(""!==i){var o=this.snapToHeight(i);e.style.height=o+"px",this.setContentDivHeight(e,o)}}this.dragging=!1,this.verticalSizingAction="",this.horizontalSizingAction="",this.verticalSizingHover="",this.horizontalSizingHover=""}},{key:"movePalette",value:function(e){var t=this.getPaletteDiv(),n=document.getElementById(this.props.parentDivId),i=e.clientX-this.dragOffsetX,o=e.clientY-this.dragOffsetY;i<n.offsetLeft+this.hoverZoneSize&&(i=n.offsetLeft+this.hoverZoneSize),o<n.offsetTop+this.hoverZoneSize&&(o=n.offsetTop+this.hoverZoneSize),i+t.offsetWidth>n.offsetLeft+n.offsetWidth&&(i=n.offsetLeft+n.offsetWidth-t.offsetWidth-this.hoverZoneSize),o+t.offsetHeight>n.offsetTop+n.offsetHeight&&(o=n.offsetTop+n.offsetHeight-t.offsetHeight-this.hoverZoneSize),t.style.left=i+"px",t.style.top=o+"px"}},{key:"removePx",value:function(e){return parseInt(e.substring(0,e.indexOf("px")),10)}},{key:"resizePalette",value:function(e){var t=this.getPaletteDiv(),n=document.getElementById(this.props.parentDivId);this.isMaximized=!1;var i=this.removePx(this.getStyleProperty(".palette-dialog-grid-node-outer","width"))+this.removePx(this.getStyleProperty(".palette-dialog-categories","min-width"))+2*this.hoverZoneSize,o=this.removePx(this.getStyleProperty(".palette-dialog-grid-node-outer","height"))+this.removePx(this.getStyleProperty(".palette-dialog-topbar","height"))+2*this.hoverZoneSize;if("left"===this.horizontalSizingAction){var a=this.getAdjustedMousePositionLeft(e,n),r=this.savedWidth-(a-this.savedLeft);r<=i?t.style.width=i+"px":(t.style.width=r+"px",t.style.left=a+"px")}if("right"===this.horizontalSizingAction){var s=this.getAdjustedMousePositionRight(e,n)-this.savedLeft;s<=i&&(s=i),t.style.width=s+"px"}if("top"===this.verticalSizingAction){var l=this.getAdjustedMousePositionTop(e,n),c=this.savedHeight-(l-this.savedTop);c<=o?(t.style.height=o+"px",this.setContentDivHeight(t,this.minHeight)):(t.style.height=c+"px",t.style.top=l-this.dragOffsetY+"px",this.setContentDivHeight(t,c))}if("bottom"===this.verticalSizingAction){var u=this.getAdjustedMousePositionBottom(e,n)-this.savedTop-this.hackPaletteOffset;u<=o&&(u=o),t.style.height=u+"px",this.setContentDivHeight(t,u)}}},{key:"snapToWidth",value:function(e){var t=this.removePx(this.getStyleProperty(".palette-dialog-grid-node-outer","width"));return Math.round((e-this.adjustedWidth)/t)*t+this.adjustedWidth}},{key:"snapToHeight",value:function(e){var t=this.state.showGrid?this.removePx(this.getStyleProperty(".palette-dialog-grid-node-outer","height")):this.removePx(this.getStyleProperty(".palette-list-item","height"));return Math.round((e-this.adjustedHeight)/t)*t+this.adjustedHeight}},{key:"windowResize",value:function(){var e=this.getPaletteDiv(),t=document.getElementById(this.props.parentDivId);if(t)if(this.isMaximized){var n=t.offsetLeft+this.hoverZoneSize;e.style.left=n+"px";var i=t.offsetWidth-this.totalHoverZoneSize;e.style.width=i+"px";var o=t.offsetTop+this.hoverZoneSize;e.style.top=o+"px";var a=t.offsetHeight-this.totalHoverZoneSize;e.style.height=a+"px",this.setContentDivHeight(e,a)}else{if(e.offsetLeft+e.offsetWidth+this.hoverZoneSize>t.offsetLeft+t.offsetWidth){var r=t.offsetLeft+t.offsetWidth-e.offsetWidth-this.hoverZoneSize;e.style.left=r+"px"}var s=t.offsetWidth-this.totalHoverZoneSize;if(s<e.offsetWidth&&(e.style.width=s+"px",e.style.left=t.offsetLeft+t.offsetWidth-e.offsetWidth-this.hoverZoneSize+"px"),e.offsetTop+e.offsetHeight+this.hoverZoneSize>t.offsetTop+t.offsetHeight){var l=t.offsetTop+t.offsetHeight-e.offsetHeight-this.hoverZoneSize;e.style.top=l+"px"}var c=t.offsetHeight-this.totalHoverZoneSize;c<e.offsetHeight&&(e.style.height=c+"px",e.style.top=t.offsetTop+t.offsetHeight-e.offsetHeight-this.hoverZoneSize+"px",this.setContentDivHeight(e,c))}}},{key:"windowMaximize",value:function(){var e=this.getPaletteDiv(),t=document.getElementById(this.props.parentDivId);if(t)if(this.isMaximized)e.style.width=this.savedWidth+"px",e.style.left=this.savedLeft+"px",e.style.height=this.savedHeight+"px",e.style.top=this.savedTop+"px",this.setContentDivHeight(e,this.savedHeight),this.isMaximized=!1,this.windowResize();else{this.savedWidth=e.offsetWidth,this.savedLeft=e.offsetLeft,this.savedHeight=e.offsetHeight,this.savedTop=e.offsetTop;var n=t.offsetWidth-this.totalHoverZoneSize+1;e.style.width=n+"px",e.style.left=t.offsetLeft+this.hoverZoneSize+"px";var i=t.offsetHeight-this.totalHoverZoneSize+1;e.style.height=i+"px",e.style.top=t.offsetTop+this.hoverZoneSize+"px",this.setContentDivHeight(e,i),this.isMaximized=!0}}},{key:"showGrid",value:function(e){this.setState({showGrid:e})}},{key:"render",value:function(){var e=this.props.showPalette?"block":"none";return C.default.createElement("nav",{"aria-label":this.props.intl.formatMessage({id:"palette.dialog.label",defaultMessage:O}),role:"navigation"},C.default.createElement("div",{className:"palette-dialog-div",ref:"palette",onMouseDown:this.mouseDownOnPalette,style:{display:e}},C.default.createElement(M,{mouseDownMethod:this.mouseDownOnTopBar,showGridMethod:this.showGrid,windowMaximizeMethod:this.windowMaximize,showGrid:this.state.showGrid,canvasController:this.props.canvasController}),C.default.createElement(re,{paletteJSON:this.props.paletteJSON,showGrid:this.state.showGrid,canvasController:this.props.canvasController,isEditingEnabled:this.props.isEditingEnabled})))}}])}(C.default.Component),ue=o.injectIntl(ce),de=l._root,he=function(){return de.Date.now()},ge=l.isObject_1,pe=he,fe=a.toNumber_1,ve=Math.max,ye=Math.min;var me=function(e,t,n){var i,o,a,r,s,l,c=0,u=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var n=i,a=o;return i=o=void 0,c=t,r=e.apply(a,n)}function p(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=a}function f(){var e=pe();if(p(e))return v(e);s=setTimeout(f,function(e){var n=t-(e-l);return d?ye(n,a-(e-c)):n}(e))}function v(e){return s=void 0,h&&i?g(e):(i=o=void 0,r)}function y(){var e=pe(),n=p(e);if(i=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(f,t),u?g(e):r}(l);if(d)return clearTimeout(s),s=setTimeout(f,t),g(l)}return void 0===s&&(s=setTimeout(f,t)),r}return t=fe(t)||0,ge(n)&&(u=!!n.leading,a=(d="maxWait"in n)?ve(fe(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==s&&clearTimeout(s),c=0,i=l=o=s=void 0},y.flush=function(){return void 0===s?r:v(pe())},y};function be(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ke(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ke(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}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 a,r=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){s=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(s)throw a}}}}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Ce(e,t){var n=[];if(e.node_types){var i,o=be(e.node_types);try{for(o.s();!(i=o.n()).done;){var a=i.value,r=xe(a,e,t);r&&n.push({nodeType:a,category:e,occurrenceInfo:r})}}catch(e){o.e(e)}finally{o.f()}}return n}function xe(e,t,n){if(n.length>0){var i=function(e,t){var n=l.has_1(e,"label")&&e.label?e.label.toLowerCase():"",i=Te(n,t),o=i.occurrences,a=i.hitCounts;return{catLabelOccurrences:o,catLabelHitCounts:a}}(t,n),o=i.catLabelOccurrences,a=i.catLabelHitCounts,r=function(e,t){var n=l.has_1(e,"app_data.ui_data.label")&&e.app_data.ui_data.label?e.app_data.ui_data.label.toLowerCase():"",i=Te(n,t),o=i.occurrences,a=i.hitCounts;return{nodeLabelOccurrences:o,nodeLabelHitCounts:a}}(e,n),s=r.nodeLabelOccurrences,c=r.nodeLabelHitCounts,u=function(e,t){var n=l.has_1(e,"app_data.ui_data.description")&&e.app_data.ui_data.description?e.app_data.ui_data.description.toLowerCase():"",i=Te(n,t),o=i.occurrences,a=i.hitCounts;return{nodeDescOccurrences:o,nodeDescHitCounts:a}}(e,n),d=u.nodeDescOccurrences,h=u.nodeDescHitCounts;if(o.length>0||s.length>0||d.length>0){var g=function(e,t,n,i){for(var o=0,a=0,r=0;r<i;r++)o+=e[r]+10*t[r]+n[r],e[r]+t[r]+n[r]>0&&a++;return o+50*a}(a,c,h,n.length);return{catLabelOccurrences:o,nodeLabelOccurrences:s,nodeDescOccurrences:d,ranking:g}}}return null}function Te(e,t){var n=[],i=[];return t.forEach((function(t){if(t){var o=function(e,t){var n=[],i=0,o=0,a=0;for(;o>-1&&a<20;)(o=e.indexOf(t,i))>-1&&(n.push({start:o,end:o+t.length}),i=o+t.length,a++);return n}(e,t);n=function(e,t){if(0===e.length)return t;if(0===t.length)return e;var n=[];t.forEach((function(t){var i=!1;e.forEach((function(e){t.start<=e.start&&t.end>=e.end?(e.start=t.start,e.end=t.end,i=!0):t.start>=e.start&&t.start<e.end?(t.end>=e.end&&(e.end=t.end),i=!0):t.end>e.start&&t.end<=e.end&&(t.start<e.start&&(e.start=t.start),i=!0)})),i||n.push(t)}));var i=e.concat(n);return i=i.sort((function(e,t){return e.start<t.start?-1:1}))}(n,o),i.push(o.length>0?1:0)}})),{occurrences:n,hitCounts:i}}function Le(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Pe()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Pe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Pe=function(){return!!e})()}var Ne=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Le(this,i,[t])).onMouseOver=n.onMouseOver.bind(n),n.onMouseLeave=n.onMouseLeave.bind(n),n.categoryClicked=n.categoryClicked.bind(n),n.categoryKeyPressed=n.categoryKeyPressed.bind(n),n.setPaletteCategory=n.setPaletteCategory.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"onMouseOver",value:function(e){this.props.canvasController.openTip({id:"paletteTip_"+this.props.category.id,type:u.TIP_TYPE_PALETTE_CATEGORY,targetObj:e.currentTarget,category:this.props.category})}},{key:"onMouseLeave",value:function(){this.props.canvasController.closeTip()}},{key:"getDisplayLabel",value:function(){return!0===this.props.isPaletteOpen?this.props.category.label:!this.props.category.image&&this.props.category.label&&this.props.category.label.length>0?this.props.category.label.substr(0,3):null}},{key:"getInlineLoadingRenderCategory",value:function(){var e="";this.props.isPaletteOpen&&(e=this.props.category.loading_text);var t=C.default.createElement("div",{className:"palette-flyout-category"},C.default.createElement("div",{className:"palette-flyout-category-item-loading"},C.default.createElement(h.InlineLoading,{description:e,onSuccess:function(){return null},status:"active",successDelay:1500})));return C.default.createElement(h.AccordionItem,{className:"palette-loading-category",title:t})}},{key:"setPaletteCategory",value:function(e){e?this.props.canvasController.closePaletteCategory(this.props.category.id):this.props.canvasController.openPaletteCategory(this.props.category.id)}},{key:"getRenderCategory",value:function(){var e=this.getTitleObj(),t=this.getContent();return C.default.createElement(h.AccordionItem,{title:e,open:this.props.category.is_open,onKeyDown:this.categoryKeyPressed},t)}},{key:"getTitleObj",value:function(){var e=this.getItemImage(),t=this.getItemText();return C.default.createElement("div",{className:"palette-flyout-category","data-id":l.get_1(this.props.category,"id",""),onClick:this.categoryClicked,value:this.props.category.label,onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},C.default.createElement("div",{className:"palette-flyout-category-item",tabIndex:-1},e,t))}},{key:"getItemText",value:function(){var e=null,t=this.getDisplayLabel();if(!0===this.props.isPaletteOpen){var n=this.props.category.image?"palette-flyout-category-text":"palette-flyout-category-text-no-image";e=C.default.createElement("span",{className:n},t)}else!this.props.category.image&&this.props.category.label&&this.props.category.label.length>0&&(e=C.default.createElement("span",{className:"palette-flyout-category-text-abbr"},t));return e}},{key:"getItemImage",value:function(){var t=null;return this.props.category.image&&""!==this.props.category.image&&(t="object"===e._typeof(this.props.category.image)&&C.default.isValidElement(this.props.category.image)?this.props.category.image:this.props.category.image.endsWith(".svg")?C.default.createElement("div",null,C.default.createElement(x.default,{src:this.props.category.image,className:"palette-flyout-category-item-icon",draggable:"false"})):C.default.createElement("div",null,C.default.createElement("img",{src:this.props.category.image,className:"palette-flyout-category-item-icon",draggable:"false",alt:this.props.category.label}))),t}},{key:"getContent",value:function(){var e=this;if(this.props.category.is_open){var t=this.props.category.node_types.map((function(t){return{nodeType:t,category:e.props.category}}));return C.default.createElement(ie,{key:this.props.category.id+"-nodes",category:this.props.category,nodeTypeInfos:t,canvasController:this.props.canvasController,isPaletteOpen:this.props.isPaletteOpen,isEditingEnabled:this.props.isEditingEnabled})}return null}},{key:"categoryClicked",value:function(e){e.stopPropagation(),this.setPaletteCategory(this.props.category.is_open)}},{key:"categoryKeyPressed",value:function(e){"cds--accordion__heading"===e.target.className&&("Enter"!==e.code&&"Space"!==e.code||(e.preventDefault(),e.stopPropagation(),this.setPaletteCategory(this.props.category.is_open)))}},{key:"render",value:function(){return this.props.category.loading_text?this.getInlineLoadingRenderCategory():this.getRenderCategory()}}])}(C.default.Component);function Se(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,_e()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function _e(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(_e=function(){return!!e})()}var Ee=function(n){function i(){var t;return e._classCallCheck(this,i),(t=Se(this,i)).state={searchString:""},t.searchOnClick=t.searchOnClick.bind(t),t.handleSearchStringChange=t.handleSearchStringChange.bind(t),t}return t._inherits(i,n),e._createClass(i,[{key:"handleSearchStringChange",value:function(e){var t=this,n=e.target.value||"";this.setState({searchString:n},(function(){return t.props.handleSearchStringChange(n)}))}},{key:"searchOnClick",value:function(){this.props.isPaletteOpen||this.props.canvasController.openPalette()}},{key:"render",value:function(){var e=this.props.intl.formatMessage({id:"palette.flyout.search.placeholder",defaultMessage:P});return C.default.createElement("div",{className:"palette-flyout-search-container",id:"palette-flyout-search"},C.default.createElement(h.Search,{id:"palette-flyout-search",className:"palette-flyout-search",placeholder:e,onChange:this.handleSearchStringChange,size:"sm",value:this.state.searchString,labelText:e,onClick:this.searchOnClick}))}}])}(C.default.Component),Ie=o.injectIntl(Ee);function De(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Oe()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Oe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Oe=function(){return!!e})()}var we=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=De(this,i,[t])).state={},n}return t._inherits(i,n),e._createClass(i,[{key:"getNoResultsDiv",value:function(){var e=this.props.intl.formatMessage({id:"palette.flyout.search.noresults",defaultMessage:N}),t=this.props.intl.formatMessage({id:"palette.flyout.search.adjustsearch",defaultMessage:S});return C.default.createElement("div",null,C.default.createElement("div",{className:"palette-no-results-title"},e),C.default.createElement("br",null),C.default.createElement("div",{className:"palette-no-results-desc"},t))}},{key:"getContentListDiv",value:function(){for(var e=[],t=0;t<this.props.nodeTypeInfos.length;t++){var n="item_"+t;e.push(C.default.createElement("div",{key:n},C.default.createElement(ee,{nodeTypeInfo:this.props.nodeTypeInfos[t],isDisplaySearchResult:!0,isShowRanking:this.props.isShowRanking,canvasController:this.props.canvasController,isPaletteOpen:this.props.isPaletteOpen,isEditingEnabled:this.props.isEditingEnabled})))}if(this.props.isNodeTypeInfosArrayTruncated){var i=this.props.intl.formatMessage({id:"palette.flyout.search.resultsrestricted",defaultMessage:_});e.push(C.default.createElement("div",{key:"restrict-item",className:"palette-flyout-restrict-item"},i))}return C.default.createElement("div",{width:"100%",draggable:"false",className:"palette-scroll"},e)}},{key:"render",value:function(){return 0===this.props.nodeTypeInfos.length?this.getNoResultsDiv():this.getContentListDiv()}}])}(C.default.Component),Ae=o.injectIntl(we);function Me(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ze(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ze(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}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 a,r=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){s=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(s)throw a}}}}function ze(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Ue(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Re()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Re=function(){return!!e})()}var He=new g.Logger("PaletteFlyoutContent"),je=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Ue(this,i,[t])).state={searchString:""},n.categories=[],n.getUniqueCategories=n.getUniqueCategories.bind(n),n.setSearchString=n.setSearchString.bind(n),n.handleSearchStringChange=n.handleSearchStringChange.bind(n),n.setSearchStringThrottled=me(n.setSearchString,200),n}return t._inherits(i,n),e._createClass(i,[{key:"getUniqueCategories",value:function(e){var t=[];if(e){var n,i=Me(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;-1===t.indexOf(o.label)&&t.push(o)}}catch(e){i.e(e)}finally{i.f()}}return t}},{key:"getContentDivs",value:function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];t.push(C.default.createElement("div",{key:i.label+"-container"},C.default.createElement(Ne,{key:i.id,category:i,canvasController:this.props.canvasController,isPaletteOpen:this.props.isPaletteOpen,isEditingEnabled:this.props.isEditingEnabled})))}return C.default.createElement(h.Accordion,null,t)}},{key:"getFilteredContentDivs",value:function(e){He.logStartTimer("getFilteredNodeTypeInfos");var t=function(e,t){for(var n=[],i=t.toLowerCase().split(" ").filter((function(e){return""!==e})),o=0;o<e.length;o++)n.push.apply(n,d._toConsumableArray(Ce(e[o],i)));return n.sort((function(e,t){return e.occurrenceInfo.ranking<=t.occurrenceInfo.ranking?1:-1}))}(this.categories,this.state.searchString);He.logEndTimer("getFilteredNodeTypeInfos");var n=!1;return t.length>10&&(t=t.slice(0,10),n=!0),[C.default.createElement(Ae,{key:"filtered-nodes",nodeTypeInfos:t,canvasController:this.props.canvasController,isPaletteOpen:this.props.isPaletteOpen,isEditingEnabled:this.props.isEditingEnabled,isNodeTypeInfosArrayTruncated:n})]}},{key:"setSearchString",value:function(){this.setState({searchString:this.ss})}},{key:"handleSearchStringChange",value:function(e){this.ss=e,this.setSearchStringThrottled()}},{key:"render",value:function(){this.categories=this.getUniqueCategories(this.props.paletteJSON.categories);var e=this.props.isPaletteOpen&&this.state.searchString?this.getFilteredContentDivs(this.categories):this.getContentDivs(this.categories),t=C.default.createElement("div",{className:"palette-flyout-categories"},e),n=C.default.createElement(Ie,{handleSearchStringChange:this.handleSearchStringChange,isPaletteOpen:this.props.isPaletteOpen,canvasController:this.props.canvasController});return C.default.createElement("div",{className:"palette-flyout-content"},n,t)}}])}(C.default.Component);function Fe(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Be()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Be(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Be=function(){return!!e})()}var Ge=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Fe(this,i,[t])).paletteNodes=[],n}return t._inherits(i,n),e._createClass(i,[{key:"render",value:function(){var e="palette-flyout-div";return this.props.showPalette?e+=" palette-flyout-div-open":(e+=" palette-flyout-div-closed",this.props.enableNarrowPalette&&(e+=" palette-flyout-div-narrow")),C.default.createElement("nav",{"aria-label":this.props.intl.formatMessage({id:"palette.flyout.label",defaultMessage:D}),role:"navigation"},C.default.createElement("div",{className:e},C.default.createElement(je,{paletteJSON:this.props.paletteJSON,canvasController:this.props.canvasController,isPaletteOpen:this.props.showPalette,isEditingEnabled:this.props.isEditingEnabled})))}}])}(C.default.Component),We=o.injectIntl(Ge);function Ye(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Ke()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Ke(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ke=function(){return!!e})()}var Xe=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Ye(this,i,[t])).logger=new g.Logger("Palette"),n}return t._inherits(i,n),e._createClass(i,[{key:"render",value:function(){this.logger.log("render");var e=null;return this.props.enablePaletteLayout===u.PALETTE_LAYOUT_FLYOUT?e=C.default.createElement(We,{enableNarrowPalette:this.props.enableNarrowPalette,paletteJSON:this.props.paletteJSON,showPalette:this.props.showPalette,canvasController:this.props.canvasController,isEditingEnabled:this.props.isEditingEnabled}):this.props.enablePaletteLayout===u.PALETTE_LAYOUT_MODAL&&(e=C.default.createElement(ue,{paletteJSON:this.props.paletteJSON,showPalette:this.props.showPalette,parentDivId:this.props.containingDivId,canvasController:this.props.canvasController,isEditingEnabled:this.props.isEditingEnabled})),e}}])}(C.default.Component),Ve=i.connect((function(e,t){return{enablePaletteLayout:e.canvasconfig.enablePaletteLayout,enableNarrowPalette:e.canvasconfig.enableNarrowPalette,isEditingEnabled:e.canvasconfig.enableEditingActions,paletteJSON:e.palette.content,showPalette:void 0!==e.palette.isOpen&&e.palette.isOpen}}))(Xe);function Ze(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,qe()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function qe(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(qe=function(){return!!e})()}var Je=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Ze(this,i,[t])).state={},n.handleClick=n.handleClick.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.handleClick,!0)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.handleClick,!0)}},{key:"handleClick",value:function(e){this.props.canvasController.closeTip()}},{key:"render",value:function(){var e=null,t=null;switch(this.props.type){case u.TIP_TYPE_PALETTE_ITEM:case u.TIP_TYPE_PALETTE_CATEGORY:t="right";break;case u.TIP_TYPE_NODE:case u.TIP_TYPE_PORT:case u.TIP_TYPE_DEC:case u.TIP_TYPE_LINK:case u.TIP_TYPE_STATE_TAG:default:t="bottom"}if(this.props.customContent)e=this.props.customContent;else switch(this.props.type){case u.TIP_TYPE_PALETTE_ITEM:e=C.default.createElement("div",{className:"tip-palette-item"},C.default.createElement("div",{className:"tip-palette-category"},this.props.category.label),C.default.createElement("div",{className:"tip-palette-label"},this.props.nodeTemplate.app_data.ui_data.label),this.props.nodeTemplate.app_data.ui_data.description?C.default.createElement("div",{className:"tip-palette-desc"},this.props.nodeTemplate.app_data.ui_data.description):"");break;case u.TIP_TYPE_PALETTE_CATEGORY:e=C.default.createElement("div",{className:"tip-palette-item"},C.default.createElement("div",{className:"tip-palette-label"},this.props.category.label),this.props.category.description?C.default.createElement("div",{className:"tip-palette-desc"},this.props.category.description):"");break;case u.TIP_TYPE_NODE:var n=null;this.props.canvasController.getObjectModel().hasErrorMessage(this.props.node)?n=C.default.createElement(s.Icon,{type:u.ERROR,className:"tip-node-status error"}):this.props.canvasController.getObjectModel().hasWarningMessage(this.props.node)&&(n=C.default.createElement(s.Icon,{type:u.WARNING,className:"tip-node-status warning"}));var i=this.props.canvasController.getObjectModel().getPaletteNode(this.props.node.op),o=this.props.node.label,a=i&&i.app_data&&i.app_data.ui_data?i.app_data.ui_data.label:o;if(o!==a&&(o+=" (".concat(a,")")),!(n||o||a||this.props.node.description))return null;e=C.default.createElement("div",{className:"tip-node"},n,C.default.createElement("div",{className:"tip-node-label"},o),this.props.node.description?C.default.createElement("div",{className:"tip-node-desc"},this.props.node.description):"");break;case u.TIP_TYPE_PORT:e=l.isEmpty_1(this.props.port.label)?null:C.default.createElement("div",{className:"tip-port"},this.props.port.label);break;case u.TIP_TYPE_DEC:e=l.isEmpty_1(this.props.decoration.tooltip)?null:C.default.createElement("div",{className:"tip-decoration"},this.props.decoration.tooltip);break;case u.TIP_TYPE_LINK:break;case u.TIP_TYPE_STATE_TAG:e=l.isEmpty_1(this.props.stateTagText)?null:C.default.createElement("div",{className:"tip-state-tag"},this.props.stateTagText);break;default:e=null}return null!==e?C.default.createElement(p,{tip:e,direction:t,id:this.props.id,targetObj:this.props.targetObj,mousePos:this.props.mousePos,className:[u.TIP_TYPE_NODE,u.TIP_TYPE_PORT,u.TIP_TYPE_DEC,u.TIP_TYPE_LINK].includes(this.props.type)?"definition-tooltip":null}):null}}])}(C.default.Component),$e=i.connect((function(e,t){return{id:e.tooltip.id,type:e.tooltip.type,targetObj:e.tooltip.targetObj,mousePos:e.tooltip.mousePos,customContent:e.tooltip.customContent,node:e.tooltip.node,port:e.tooltip.port,decoration:e.tooltip.decoration,nodeTemplate:e.tooltip.nodeTemplate,category:e.tooltip.category,stateTagText:e.tooltip.stateTagText}}))(Je);function Qe(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,et()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function et(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(et=function(){return!!e})()}var tt=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Qe(this,i,[t])).logger=new g.Logger("CC-Context-Menu"),n}return t._inherits(i,n),e._createClass(i,[{key:"render",value:function(){this.logger.log("render");var e=null;return this.props.showContextMenu&&(e=C.default.createElement(y.ContextMenuWrapper,{containingDivId:this.props.containingDivId,contextMenuDef:this.props.contextMenuDef,contextMenuActionHandler:this.props.canvasController.contextMenuActionHandler,contextMenuPos:this.props.contextMenuPos,closeContextMenu:this.props.canvasController.closeContextMenu,stopPropagation:!0})),e}}])}(C.default.Component),nt=i.connect((function(e,t){return{contextMenuDef:e.contextmenu.menuDef,contextMenuPos:e.contextmenu.source.cmPos||{x:0,y:0},showContextMenu:e.contextmenu.isOpen}}))(tt),it=l._baseFindIndex,ot=r._baseIteratee,at=a.toInteger_1,rt=Math.max,st=Math.min;var lt=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return void 0!==n&&(o=at(n),o=n<0?rt(i+o,0):st(o,i-1)),it(e,ot(t),o,!0)};function ct(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,ut()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function ut(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ut=function(){return!!e})()}var dt=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=ct(this,i,[t])).logger=new g.Logger("CC-Context-Toolbar"),n.onMouseEnter=n.onMouseEnter.bind(n),n.onMouseLeave=n.onMouseLeave.bind(n),n.toolbarActionHandler=n.toolbarActionHandler.bind(n),n.colorClicked=n.colorClicked.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"onMouseLeave",value:function(e){var t=this;this.props.canvasController.setMouseInContextToolbar(!1),setTimeout((function(){return t.props.canvasController.closeContextToolbar()}),200)}},{key:"onMouseEnter",value:function(e){this.props.canvasController.setMouseInContextToolbar(!0)}},{key:"getToolbarConfig",value:function(e){var t=this,n=e.toolbarItems,i=e.overflowMenuItems,o=[];return n.forEach((function(e){return o.push(t.getMenuItem(e))})),i.forEach((function(e){return o.push(t.getMenuItem(e))})),{leftBar:o,rightBar:[]}}},{key:"getMenuItem",value:function(e){if(e.divider)return{divider:!0};var t=this.getSubPanelInfo(e),n=!t.subPanel&&e.menu?this.getSubMenu(e):null;return{action:e.action,label:e.label,subMenu:n,subPanel:t.subPanel,subPanelData:t.subPanelData,enable:this.getEnable(e),iconEnabled:e.icon}}},{key:"getSubPanelInfo",value:function(e){var t=this;return"colorBackground"===e.action?{subPanel:y.ColorPicker,subPanelData:{clickActionHandler:function(e){return t.colorClicked(e)}}}:{}}},{key:"getSubMenu",value:function(t){var n=this;return"object"===e._typeof(t.menu)?t.menu.map((function(e){return e.divider?{divider:!0}:{action:e.action,label:e.label,enable:n.getEnable(e),iconEnabled:e.icon}})):null}},{key:"getEnable",value:function(e){return void 0===e.enable||e.enable}},{key:"getContextToolbarWidth",value:function(e,t){var n=e.filter((function(e){return e.divider})),i=n.length,o=1*i,a=t.length>0?1:0;return 34*(e.length+a-i)+o-(t.length>0?5:0)}},{key:"removeUnnecessaryDividers",value:function(e){var t=e.findIndex((function(e){return!e.divider})),n=lt(e,(function(e){return!e.divider})),i=e.slice(t,n+1),o=[],a=!1;return i.forEach((function(e){e.divider?(a||o.push(e),a=!0):(o.push(e),a=!1)})),o}},{key:"toolbarActionHandler",value:function(e,t){this.props.canvasController.setMouseInContextToolbar(!1),this.props.canvasController.closeContextToolbar(),this.props.canvasController.contextMenuActionHandler(e,t)}},{key:"colorClicked",value:function(e){this.toolbarActionHandler("colorSelectedObjects",{color:e})}},{key:"shouldCenterJustifyToolbar",value:function(){var e=this.props.contextSource.type;return"link"===e||"canvas"===e||"node"===e&&"topCenter"===this.props.contextSource.targetObject.layout.contextToolbarPosition&&!this.props.contextSource.targetObject.is_expanded}},{key:"adjustPosToFit",value:function(e,t,n,i){var o=document.getElementById(this.props.containingDivId),a=o?o.getBoundingClientRect():{top:-1e3,bottom:1e3,left:-1e3,right:1e3},r=0,s=0,l=e,c=t,u=e+n-(a.right-a.left),d=r-e,h=t+i-(a.bottom-a.top),g=s-t;return u>0?l-=u+2:d>0&&(l+=d+2),h>0?c-=h+2:g>0&&(c+=g+2),{x:l,y:c}}},{key:"render",value:function(){this.logger.log("render");var e=null;if(this.props.showContextMenu){var t=this.props.contextMenuDef.filter((function(e){return e.toolbarItem})),n=this.props.contextMenuDef.filter((function(e){return!e.toolbarItem}));n=this.removeUnnecessaryDividers(n);var i=this.getToolbarConfig({toolbarItems:t,overflowMenuItems:n}),o=this.getContextToolbarWidth(t,n),r=this.props.contextSource.cmPos||{x:0,y:0},s=this.shouldCenterJustifyToolbar()?r.x-o/2:r.x-o,l=r.y-34,c=this.adjustPosToFit(s,l,o,34);s=c.x,l=c.y,e=C.default.createElement("div",{className:"context-toolbar floating-toolbar",style:{left:s,top:l,width:o},onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave},C.default.createElement(a.Toolbar,{config:i,instanceId:this.props.canvasController.getInstanceId(),containingDivId:this.props.containingDivId,toolbarActionHandler:this.toolbarActionHandler,tooltipDirection:"top",size:"sm"}))}return e}}])}(C.default.Component),ht=i.connect((function(e,t){return{contextMenuDef:e.contextmenu.menuDef,contextSource:e.contextmenu.source,showContextMenu:e.contextmenu.isOpen}}))(dt),gt={"toolbar.palette":"Palette","toolbar.zoomIn":"Zoom in","toolbar.zoomOut":"Zoom out","toolbar.zoomToFit":"Zoom to fit","toolbar.overflowMenu":"Overflow menu","toolbar.label":"Canvas toolbar"};function pt(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,ft()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function ft(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(ft=function(){return!!e})()}var vt=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=pt(this,i,[t])).getLabel=n.getLabel.bind(n),n.logger=new g.Logger("CC-Text-Toolbar"),n}return t._inherits(i,n),e._createClass(i,[{key:"getLabel",value:function(e,t){var n=v.defaultMessages1[e]?v.defaultMessages1[e]:gt[e];return this.props.intl.formatMessage({id:e,defaultMessage:n},t)}},{key:"getJsxLabel",value:function(e,t,n){var i=v.CanvasUtils.isMacintosh()?"⌘":"Ctrl",o=t?i+" + "+t:null,a=n?i+" + "+n:null;return C.default.createElement("div",null,this.getLabel(e),C.default.createElement("br",null),o,C.default.createElement("br",null),a)}},{key:"getMarkdownToolbar",value:function(){var e=this.getJsxLabel("texttoolbar.boldAction","b"),t=this.getJsxLabel("texttoolbar.italicsAction","i"),n=this.getJsxLabel("texttoolbar.strikethroughAction","shift + x"),i=this.getJsxLabel("texttoolbar.headerAction",">","<"),o=this.getJsxLabel("texttoolbar.codeAction","e"),a=this.getJsxLabel("texttoolbar.linkAction","k"),l=this.getJsxLabel("texttoolbar.quoteAction","shift + >"),c=this.getJsxLabel("texttoolbar.numberedListAction","shift + 7"),u=this.getJsxLabel("texttoolbar.bulletedListAction","shift + 8");return{leftBar:[{action:"headerStyle",tooltip:i,enable:!0,subMenu:[{action:"title",label:this.getLabel("texttoolbar.titleAction"),enable:!0},{action:"header",label:this.getLabel("texttoolbar.headerAction"),enable:!0},{action:"subheader",label:this.getLabel("texttoolbar.subheaderAction"),enable:!0},{action:"body",label:this.getLabel("texttoolbar.bodyAction"),enable:!0}],closeSubAreaOnClick:!0,iconEnabled:C.default.createElement(s.TextScale,{size:32})},{divider:!0},{action:"bold",label:e,enable:!0,iconEnabled:C.default.createElement(s.TextBold,{size:32})},{action:"italics",label:t,enable:!0,iconEnabled:C.default.createElement(s.TextItalic,{size:32})},{action:"strikethrough",label:n,enable:!0,iconEnabled:C.default.createElement(s.TextStrikethrough,{size:32})},{divider:!0},{action:"code",label:o,enable:!0,iconEnabled:C.default.createElement(s.Code,{size:32})},{divider:!0},{action:"link",label:a,enable:!0,iconEnabled:C.default.createElement(r.Link,{size:32})},{divider:!0},{action:"quote",label:l,enable:!0,iconEnabled:C.default.createElement(s.TextIndentMore,{size:32})},{divider:!0},{action:"numberedList",label:c,enable:!0,iconEnabled:C.default.createElement(r.ListNumbered,{size:32})},{action:"bulletedList",label:u,enable:!0,iconEnabled:C.default.createElement(r.ListBulleted,{size:32})}]}}},{key:"getWysiwygToolbar",value:function(){var e=this,t=this.getLabel("texttoolbar.boldAction"),n=this.getLabel("texttoolbar.italicsAction"),i=this.getLabel("texttoolbar.underline"),o=this.getLabel("texttoolbar.strikethroughAction"),l=[{action:"font-ibm-plex-sans",label:this.getLabel("texttoolbar.fontIBMPlexSans"),enable:!0},{action:"font-ibm-plex-serif",label:this.getLabel("texttoolbar.fontIBMPlexSerif"),enable:!0},{action:"font-ibm-plex-condensed",label:this.getLabel("texttoolbar.fontIBMPlexCon"),enable:!0},{action:"font-ibm-plex-mono",label:this.getLabel("texttoolbar.fontIBMPlexMono"),enable:!0},{action:"font-arial",label:this.getLabel("texttoolbar.fontArial"),enable:!0},{action:"font-comic-sans-ms",label:this.getLabel("texttoolbar.fontComicSansMS"),enable:!0},{action:"font-gill-sans",label:this.getLabel("texttoolbar.fontGillSans"),enable:!0},{action:"font-helvetica-neue",label:this.getLabel("texttoolbar.fontHelveticaNeue"),enable:!0},{action:"font-times-new-roman",label:this.getLabel("texttoolbar.fontTimesNewRoman"),enable:!0},{action:"font-verdana",label:this.getLabel("texttoolbar.fontVerdana"),enable:!0}],c=[{action:"align-left",label:this.getLabel("texttoolbar.alignHorizLeft"),enable:!0,iconEnabled:C.default.createElement(s.TextAlignLeft,{size:32})},{action:"align-center",label:this.getLabel("texttoolbar.alignHorizCenter"),enable:!0,iconEnabled:C.default.createElement(s.TextAlignCenter,{size:32})},{action:"align-right",label:this.getLabel("texttoolbar.alignHorizRight"),enable:!0,iconEnabled:C.default.createElement(s.TextAlignRight,{size:32})}],d=[{action:"align-top",label:this.getLabel("texttoolbar.alignVertTop"),enable:!0,iconEnabled:C.default.createElement(r.AlignBoxTopCenter,{size:32})},{action:"align-middle",label:this.getLabel("texttoolbar.alignVertMiddle"),enable:!0,iconEnabled:C.default.createElement(r.AlignBoxMiddleCenter,{size:32})},{action:"align-bottom",label:this.getLabel("texttoolbar.alignVertBottom"),enable:!0,iconEnabled:C.default.createElement(r.AlignBoxBottomCenter,{size:32})}],h=[{action:"outline-none",label:this.getLabel("texttoolbar.outlineNone"),enable:!0},{action:"outline-solid",label:this.getLabel("texttoolbar.outlineSolid"),enable:!0}];return{leftBar:[{action:"submenu-font",label:this.getLabel("texttoolbar.fontAction"),iconEnabled:C.default.createElement(s.TextFont,{size:32}),enable:!0,subMenu:l,closeSubAreaOnClick:!0},{action:"submenu-text-size",label:this.getLabel("texttoolbar.textSize"),iconEnabled:C.default.createElement(s.TextScale,{size:32}),enable:!0,subMenu:[{action:"text-size-10",label:"10",enable:!0},{action:"text-size-11",label:"11",enable:!0},{action:"text-size-12",label:"12",enable:!0},{action:"text-size-14",label:"14",enable:!0},{action:"text-size-18",label:"18",enable:!0},{action:"text-size-24",label:"24",enable:!0},{action:"text-size-30",label:"30",enable:!0},{action:"text-size-36",label:"36",enable:!0},{action:"text-size-48",label:"48",enable:!0},{action:"text-size-60",label:"60",enable:!0},{action:"text-size-72",label:"72",enable:!0},{action:"text-size-96",label:"96",enable:!0}],closeSubAreaOnClick:!0},{action:"bold",label:t,enable:!0,iconEnabled:C.default.createElement(s.TextBold,{size:32})},{action:"italics",label:n,enable:!0,iconEnabled:C.default.createElement(s.TextItalic,{size:32})},{action:"underline",label:i,enable:!0,iconEnabled:C.default.createElement(s.TextUnderline,{size:32})},{action:"strikethrough",label:o,enable:!0,iconEnabled:C.default.createElement(s.TextStrikethrough,{size:32})},{divider:!0},{action:"submenu-text-color",label:this.getLabel("texttoolbar.colorText"),iconEnabled:C.default.createElement(s.TextColor,{size:32}),enable:!0,subPanel:y.ColorPicker,subPanelData:{type:u.WYSIWYG,clickActionHandler:function(t,n){return e.props.actionHandler("text-color",n,t)}},closeSubAreaOnClick:!0},{action:"submenu-align-horiz",label:this.getLabel("texttoolbar.alignHoriz"),iconEnabled:C.default.createElement(s.TextAlignCenter,{size:32}),enable:!0,subMenu:c,closeSubAreaOnClick:!0},{action:"submenu-align-vert",label:this.getLabel("texttoolbar.alignVert"),iconEnabled:C.default.createElement(r.AlignBoxMiddleCenter,{size:32}),enable:!0,subMenu:d,closeSubAreaOnClick:!0},{action:"submenu-background-color",label:this.getLabel("texttoolbar.colorBackground"),iconEnabled:C.default.createElement(s.ColorPalette,{size:32}),enable:!0,subPanel:y.ColorPicker,subPanelData:{type:u.WYSIWYG,clickActionHandler:function(t,n){return e.props.actionHandler("background-color",n,t)}},closeSubAreaOnClick:!0},{action:"sub-menu-outline",label:this.getLabel("texttoolbar.outline"),iconEnabled:C.default.createElement(a.SquareOutline,{size:32}),enable:!0,subMenu:h,closeSubAreaOnClick:!0}]}}},{key:"getTextToolbar",value:function(){return this.props.contentType===u.MARKDOWN?this.getMarkdownToolbar():this.props.contentType===u.WYSIWYG?this.getWysiwygToolbar():{leftBar:[]}}},{key:"render",value:function(){this.logger.log("render");var e=null;return this.props.isOpen&&(e=C.default.createElement("div",{className:"text-toolbar floating-toolbar",style:{left:this.props.pos_x,top:this.props.pos_y},onBlur:this.props.blurHandler},C.default.createElement(a.Toolbar,{config:this.getTextToolbar(),instanceId:this.props.canvasController.getInstanceId(),containingDivId:this.props.containingDivId,toolbarActionHandler:this.props.actionHandler,tooltipDirection:"top",size:"sm"}))),e}}])}(C.default.Component),yt=i.connect((function(e,t){return{isOpen:e.texttoolbar.isOpen,pos_x:e.texttoolbar.pos_x,pos_y:e.texttoolbar.pos_y,contentType:e.texttoolbar.contentType,actionHandler:e.texttoolbar.actionHandler,blurHandler:e.texttoolbar.blurHandler}}))(o.injectIntl(vt));function mt(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,bt()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function bt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(bt=function(){return!!e})()}var kt=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=mt(this,i,[t])).logger=new g.Logger("CC-StateTag"),n.onMouseOver=n.onMouseOver.bind(n),n.onMouseLeave=n.onMouseLeave.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"onMouseOver",value:function(e){var t;this.props.stateTagType===u.STATE_TAG_LOCKED?t=this.getLabel("canvas.stateTagTipLocked"):this.props.stateTagType===u.STATE_TAG_READ_ONLY&&(t=this.getLabel("canvas.stateTagTipReadOnly")),this.props.canvasController.openTip({id:"stateTagTip",type:u.TIP_TYPE_STATE_TAG,stateTagType:this.props.stateTagType,stateTagText:t,targetObj:e.currentTarget})}},{key:"onMouseLeave",value:function(){this.props.canvasController.closeTip()}},{key:"getLabel",value:function(e){return this.props.intl.formatMessage({id:e,defaultMessage:v.defaultMessages1[e]})}},{key:"getStateTag",value:function(e,t){return C.default.createElement("div",{className:"state-tag",onMouseOver:this.onMouseOver,onMouseLeave:this.onMouseLeave},t,C.default.createElement("span",null,e))}},{key:"render",value:function(){this.logger.log("render");var e=null;if(this.props.stateTagType===u.STATE_TAG_LOCKED){var t=this.getLabel("canvas.stateTagLocked");e=this.getStateTag(t,C.default.createElement(a.Locked,null))}else if(this.props.stateTagType===u.STATE_TAG_READ_ONLY){var n=this.getLabel("canvas.stateTagReadOnly");e=this.getStateTag(n,C.default.createElement(s.EditOff,null))}return e}}])}(C.default.Component),Ct=o.injectIntl(kt),xt="http://www.w3.org/1999/xhtml",Tt={svg:"http://www.w3.org/2000/svg",xhtml:xt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Lt(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Tt.hasOwnProperty(t)?{space:Tt[t],local:e}:e}function Pt(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===xt&&t.documentElement.namespaceURI===xt?t.createElement(e):t.createElementNS(n,e)}}function Nt(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function St(e){var t=Lt(e);return(t.local?Nt:Pt)(t)}function _t(){}function Et(e){return null==e?_t:function(){return this.querySelector(e)}}function It(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}function Dt(){return[]}function Ot(e){return null==e?Dt:function(){return this.querySelectorAll(e)}}function wt(e){return function(){return this.matches(e)}}function At(e){return function(t){return t.matches(e)}}var Mt=Array.prototype.find;function zt(){return this.firstElementChild}var Ut=Array.prototype.filter;function Rt(){return Array.from(this.children)}function Ht(e){return new Array(e.length)}function jt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function Ft(e,t,n,i,o,a){for(var r,s=0,l=t.length,c=a.length;s<c;++s)(r=t[s])?(r.__data__=a[s],i[s]=r):n[s]=new jt(e,a[s]);for(;s<l;++s)(r=t[s])&&(o[s]=r)}function Bt(e,t,n,i,o,a,r){var s,l,c,u=new Map,d=t.length,h=a.length,g=new Array(d);for(s=0;s<d;++s)(l=t[s])&&(g[s]=c=r.call(l,l.__data__,s,t)+"",u.has(c)?o[s]=l:u.set(c,l));for(s=0;s<h;++s)c=r.call(e,a[s],s,a)+"",(l=u.get(c))?(i[s]=l,l.__data__=a[s],u.delete(c)):n[s]=new jt(e,a[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(g[s])===l&&(o[s]=l)}function Gt(e){return e.__data__}function Wt(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Yt(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Kt(e){return function(){this.removeAttribute(e)}}function Xt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Vt(e,t){return function(){this.setAttribute(e,t)}}function Zt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function qt(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function Jt(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function $t(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Qt(e){return function(){this.style.removeProperty(e)}}function en(e,t,n){return function(){this.style.setProperty(e,t,n)}}function tn(e,t,n){return function(){var i=t.apply(this,arguments);null==i?this.style.removeProperty(e):this.style.setProperty(e,i,n)}}function nn(e,t){return e.style.getPropertyValue(t)||$t(e).getComputedStyle(e,null).getPropertyValue(t)}function on(e){return function(){delete this[e]}}function an(e,t){return function(){this[e]=t}}function rn(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function sn(e){return e.trim().split(/^|\s+/)}function ln(e){return e.classList||new cn(e)}function cn(e){this._node=e,this._names=sn(e.getAttribute("class")||"")}function un(e,t){for(var n=ln(e),i=-1,o=t.length;++i<o;)n.add(t[i])}function dn(e,t){for(var n=ln(e),i=-1,o=t.length;++i<o;)n.remove(t[i])}function hn(e){return function(){un(this,e)}}function gn(e){return function(){dn(this,e)}}function pn(e,t){return function(){(t.apply(this,arguments)?un:dn)(this,e)}}function fn(){this.textContent=""}function vn(e){return function(){this.textContent=e}}function yn(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function mn(){this.innerHTML=""}function bn(e){return function(){this.innerHTML=e}}function kn(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function Cn(){this.nextSibling&&this.parentNode.appendChild(this)}function xn(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Tn(){return null}function Ln(){var e=this.parentNode;e&&e.removeChild(this)}function Pn(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Nn(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Sn(e){return function(){var t=this.__on;if(t){for(var n,i=0,o=-1,a=t.length;i<a;++i)n=t[i],e.type&&n.type!==e.type||n.name!==e.name?t[++o]=n:this.removeEventListener(n.type,n.listener,n.options);++o?t.length=o:delete this.__on}}}function _n(e,t,n){return function(){var i,o=this.__on,a=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(o)for(var r=0,s=o.length;r<s;++r)if((i=o[r]).type===e.type&&i.name===e.name)return this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),void(i.value=t);this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},o?o.push(i):this.__on=[i]}}function En(e,t,n){var i=$t(e),o=i.CustomEvent;"function"==typeof o?o=new o(t,n):(o=i.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function In(e,t){return function(){return En(this,e,t)}}function Dn(e,t){return function(){return En(this,e,t.apply(this,arguments))}}jt.prototype={constructor:jt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},cn.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var On=[null];function wn(e,t){this._groups=e,this._parents=t}function An(){return new wn([[document.documentElement]],On)}function Mn(e){return"string"==typeof e?new wn([[document.querySelector(e)]],[document.documentElement]):new wn([[e]],On)}wn.prototype=An.prototype={constructor:wn,select:function(e){"function"!=typeof e&&(e=Et(e));for(var t=this._groups,n=t.length,i=new Array(n),o=0;o<n;++o)for(var a,r,s=t[o],l=s.length,c=i[o]=new Array(l),u=0;u<l;++u)(a=s[u])&&(r=e.call(a,a.__data__,u,s))&&("__data__"in a&&(r.__data__=a.__data__),c[u]=r);return new wn(i,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return It(e.apply(this,arguments))}}(e):Ot(e);for(var t=this._groups,n=t.length,i=[],o=[],a=0;a<n;++a)for(var r,s=t[a],l=s.length,c=0;c<l;++c)(r=s[c])&&(i.push(e.call(r,r.__data__,c,s)),o.push(r));return new wn(i,o)},selectChild:function(e){return this.select(null==e?zt:function(e){return function(){return Mt.call(this.children,e)}}("function"==typeof e?e:At(e)))},selectChildren:function(e){return this.selectAll(null==e?Rt:function(e){return function(){return Ut.call(this.children,e)}}("function"==typeof e?e:At(e)))},filter:function(e){"function"!=typeof e&&(e=wt(e));for(var t=this._groups,n=t.length,i=new Array(n),o=0;o<n;++o)for(var a,r=t[o],s=r.length,l=i[o]=[],c=0;c<s;++c)(a=r[c])&&e.call(a,a.__data__,c,r)&&l.push(a);return new wn(i,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,Gt);var n,i=t?Bt:Ft,o=this._parents,a=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var r=a.length,s=new Array(r),l=new Array(r),c=new Array(r),u=0;u<r;++u){var d=o[u],h=a[u],g=h.length,p=Wt(e.call(d,d&&d.__data__,u,o)),f=p.length,v=l[u]=new Array(f),y=s[u]=new Array(f);i(d,h,v,y,c[u]=new Array(g),p,t);for(var m,b,k=0,C=0;k<f;++k)if(m=v[k]){for(k>=C&&(C=k+1);!(b=y[C])&&++C<f;);m._next=b||null}}return(s=new wn(s,o))._enter=l,s._exit=c,s},enter:function(){return new wn(this._enter||this._groups.map(Ht),this._parents)},exit:function(){return new wn(this._exit||this._groups.map(Ht),this._parents)},join:function(e,t,n){var i=this.enter(),o=this,a=this.exit();return"function"==typeof e?(i=e(i))&&(i=i.selection()):i=i.append(e+""),null!=t&&(o=t(o))&&(o=o.selection()),null==n?a.remove():n(a),i&&o?i.merge(o).order():o},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,i=t._groups,o=n.length,a=i.length,r=Math.min(o,a),s=new Array(o),l=0;l<r;++l)for(var c,u=n[l],d=i[l],h=u.length,g=s[l]=new Array(h),p=0;p<h;++p)(c=u[p]||d[p])&&(g[p]=c);for(;l<o;++l)s[l]=n[l];return new wn(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var i,o=e[t],a=o.length-1,r=o[a];--a>=0;)(i=o[a])&&(r&&4^i.compareDocumentPosition(r)&&r.parentNode.insertBefore(i,r),r=i);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=Yt);for(var n=this._groups,i=n.length,o=new Array(i),a=0;a<i;++a){for(var r,s=n[a],l=s.length,c=o[a]=new Array(l),u=0;u<l;++u)(r=s[u])&&(c[u]=r);c.sort(t)}return new wn(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i=e[t],o=0,a=i.length;o<a;++o){var r=i[o];if(r)return r}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,i=t.length;n<i;++n)for(var o,a=t[n],r=0,s=a.length;r<s;++r)(o=a[r])&&e.call(o,o.__data__,r,a);return this},attr:function(e,t){var n=Lt(e);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==t?n.local?Xt:Kt:"function"==typeof t?n.local?Jt:qt:n.local?Zt:Vt)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?Qt:"function"==typeof t?tn:en)(e,t,null==n?"":n)):nn(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?on:"function"==typeof t?rn:an)(e,t)):this.node()[e]},classed:function(e,t){var n=sn(e+"");if(arguments.length<2){for(var i=ln(this.node()),o=-1,a=n.length;++o<a;)if(!i.contains(n[o]))return!1;return!0}return this.each(("function"==typeof t?pn:t?hn:gn)(n,t))},text:function(e){return arguments.length?this.each(null==e?fn:("function"==typeof e?yn:vn)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?mn:("function"==typeof e?kn:bn)(e)):this.node().innerHTML},raise:function(){return this.each(Cn)},lower:function(){return this.each(xn)},append:function(e){var t="function"==typeof e?e:St(e);return this.select((function(){return this.appendChild(t.apply(this,arguments))}))},insert:function(e,t){var n="function"==typeof e?e:St(e),i=null==t?Tn:"function"==typeof t?t:Et(t);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(Ln)},clone:function(e){return this.select(e?Nn:Pn)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var i,o,a=function(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}(e+""),r=a.length;if(!(arguments.length<2)){for(s=t?_n:Sn,i=0;i<r;++i)this.each(s(a[i],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(i=0,l=s[c];i<r;++i)if((o=a[i]).type===l.type&&o.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?Dn:In)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var i,o=e[t],a=0,r=o.length;a<r;++a)(i=o[a])&&(yield i)}};var zn=0;function Un(){return new Rn}function Rn(){this._="@"+(++zn).toString(36)}function Hn(e){let t;for(;t=e.sourceEvent;)e=t;return e}function jn(e,t){if(e=Hn(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}Rn.prototype=Un.prototype={constructor:Rn,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}};var Fn=Object.freeze({__proto__:null,create:function(e){return Mn(St(e).call(document.documentElement))},creator:St,local:Un,matcher:wt,namespace:Lt,namespaces:Tt,pointer:jn,pointers:function(e,t){return e.target&&(e=Hn(e),void 0===t&&(t=e.currentTarget),e=e.touches||[e]),Array.from(e,(e=>jn(e,t)))},select:Mn,selectAll:function(e){return"string"==typeof e?new wn([document.querySelectorAll(e)],[document.documentElement]):new wn([It(e)],On)},selection:An,selector:Et,selectorAll:Ot,style:nn,window:$t}),Bn=r._baseForOwn,Gn=v._castFunction;var Wn=function(e,t){return e&&Bn(e,Gn(t))};var Yn=function(e){return function(t){return null==e?void 0:e[t]}},Kn=Yn({"&":"&","<":"<",">":">",'"':""","'":"'"}),Xn=l.toString_1,Vn=/[&<>"']/g,Zn=RegExp(Vn.source);var qn=function(e){return(e=Xn(e))&&Zn.test(e)?e.replace(Vn,Kn):e};function Jn(e){if(!e.ok)throw new Error(e.status+" "+e.statusText);return e.blob()}function $n(e){if(!e.ok)throw new Error(e.status+" "+e.statusText);return e.arrayBuffer()}var Qn={},ei={},ti=34,ni=10,ii=13;function oi(e){return new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'})).join(",")+"}")}function ai(e){var t=Object.create(null),n=[];return e.forEach((function(e){for(var i in e)i in t||n.push(t[i]=i)})),n}function ri(e,t){var n=e+"",i=n.length;return i<t?new Array(t-i+1).join(0)+n:n}function si(e){var t,n=e.getUTCHours(),i=e.getUTCMinutes(),o=e.getUTCSeconds(),a=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+ri(-t,6):t>9999?"+"+ri(t,6):ri(t,4))+"-"+ri(e.getUTCMonth()+1,2)+"-"+ri(e.getUTCDate(),2)+(a?"T"+ri(n,2)+":"+ri(i,2)+":"+ri(o,2)+"."+ri(a,3)+"Z":o?"T"+ri(n,2)+":"+ri(i,2)+":"+ri(o,2)+"Z":i||n?"T"+ri(n,2)+":"+ri(i,2)+"Z":"")}function li(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function i(e,t){var i,o=[],a=e.length,r=0,s=0,l=a<=0,c=!1;function u(){if(l)return ei;if(c)return c=!1,Qn;var t,i,o=r;if(e.charCodeAt(o)===ti){for(;r++<a&&e.charCodeAt(r)!==ti||e.charCodeAt(++r)===ti;);return(t=r)>=a?l=!0:(i=e.charCodeAt(r++))===ni?c=!0:i===ii&&(c=!0,e.charCodeAt(r)===ni&&++r),e.slice(o+1,t-1).replace(/""/g,'"')}for(;r<a;){if((i=e.charCodeAt(t=r++))===ni)c=!0;else if(i===ii)c=!0,e.charCodeAt(r)===ni&&++r;else if(i!==n)continue;return e.slice(o,t)}return l=!0,e.slice(o,a)}for(e.charCodeAt(a-1)===ni&&--a,e.charCodeAt(a-1)===ii&&--a;(i=u())!==ei;){for(var d=[];i!==Qn&&i!==ei;)d.push(i),i=u();t&&null==(d=t(d,s++))||o.push(d)}return o}function o(t,n){return t.map((function(t){return n.map((function(e){return r(t[e])})).join(e)}))}function a(t){return t.map(r).join(e)}function r(e){return null==e?"":e instanceof Date?si(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,o,a=i(e,(function(e,i){if(n)return n(e,i-1);o=e,n=t?function(e,t){var n=oi(e);return function(i,o){return t(n(i),o,e)}}(e,t):oi(e)}));return a.columns=o||[],a},parseRows:i,format:function(t,n){return null==n&&(n=ai(t)),[n.map(r).join(e)].concat(o(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=ai(e)),o(e,t).join("\n")},formatRows:function(e){return e.map(a).join("\n")},formatRow:a,formatValue:r}}var ci=li(",").parse,ui=li("\t").parse;function di(e){if(!e.ok)throw new Error(e.status+" "+e.statusText);return e.text()}function hi(e,t){return fetch(e,t).then(di)}function gi(e){return function(t,n,i){return 2===arguments.length&&"function"==typeof n&&(i=n,n=void 0),hi(t,n).then((function(t){return e(t,i)}))}}var pi=gi(ci),fi=gi(ui);function vi(e){if(!e.ok)throw new Error(e.status+" "+e.statusText);if(204!==e.status&&205!==e.status)return e.json()}function yi(e){return(t,n)=>hi(t,n).then((t=>(new DOMParser).parseFromString(t,e)))}var mi=yi("application/xml"),bi=yi("text/html"),ki=yi("image/svg+xml"),Ci=Object.freeze({__proto__:null,blob:function(e,t){return fetch(e,t).then(Jn)},buffer:function(e,t){return fetch(e,t).then($n)},dsv:function(e,t,n,i){3===arguments.length&&"function"==typeof n&&(i=n,n=void 0);var o=li(e);return hi(t,n).then((function(e){return o.parse(e,i)}))},csv:pi,tsv:fi,image:function(e,t){return new Promise((function(n,i){var o=new Image;for(var a in t)o[a]=t[a];o.onerror=i,o.onload=function(){n(o)},o.src=e}))},json:function(e,t){return fetch(e,t).then(vi)},text:hi,xml:mi,html:bi,svg:ki}),xi=function(){return e._createClass((function t(n,i,o,a){e._classCallCheck(this,t),this.canvasController=n,this.isSubflow=i,this.pipelineId=o,this.breadcrumbs=a}),[{key:"isDisplayingCurrentPipeline",value:function(){return this.breadcrumbs[this.breadcrumbs.length-1].pipelineId===this.pipelineId}},{key:"setDisplayState",value:function(){this.breadcrumbs.length>1&&this.isDisplayingCurrentPipeline()?this.displayState="sub-flow-full-page":this.isSubflow?this.displayState="sub-flow-in-place":this.displayState="primary-flow-full-page"}},{key:"getDisplayStateMsg",value:function(){return"Display state set to "+this.displayState}},{key:"isDisplayingPrimaryFlowFullPage",value:function(){return"primary-flow-full-page"===this.displayState}},{key:"isDisplayingSubFlow",value:function(){return"sub-flow-in-place"===this.displayState||"sub-flow-full-page"===this.displayState}},{key:"isDisplayingSubFlowInPlace",value:function(){return"sub-flow-in-place"===this.displayState}},{key:"isDisplayingSubFlowFullPage",value:function(){return"sub-flow-full-page"===this.displayState}},{key:"isDisplayingFullPage",value:function(){return"primary-flow-full-page"===this.displayState||"sub-flow-full-page"===this.displayState}}])}();function Ti(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Li(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Li(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}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 a,r=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return r=e.done,e},e:function(e){s=!0,a=e},f:function(){try{r||null==n.return||n.return()}finally{if(s)throw a}}}}function Li(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}var Pi=function(){return e._createClass((function t(n){e._classCallCheck(this,t),this.canvasLayout=n}),[{key:"isPointInNodeBoundary",value:function(e,t){return e.x>=t.x_pos&&e.x<=t.x_pos+t.width&&e.y>=t.y_pos&&e.y<=t.y_pos+t.height}},{key:"getNodeLabelClass",value:function(e){if(v.CanvasUtils.isExpandedSupernode(e))return"d3-node-label d3-label-single-line "+this.getMessageLabelClass(e.messages);var t=e.layout.labelSingleLine?" d3-label-single-line":" d3-label-multi-line",n="center"===e.layout.labelAlign?" d3-label-center":"";return"d3-node-label "+this.getMessageLabelClass(e.messages)+t+n}},{key:"getNodeLabelTextAreaClass",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?"d3-node-label-entry d3-label-single-line":"d3-node-label-entry"+(e.layout.labelSingleLine?" d3-label-single-line":" d3-label-multi-line")+("center"===e.layout.labelAlign?" d3-label-center":"")}},{key:"getErrorMarkerIcon",value:function(e){var t="";switch(this.getMessageLevel(e.messages)){case u.ERROR:t=u.NODE_ERROR_ICON;break;case u.WARNING:t=u.NODE_WARNING_ICON}return t}},{key:"getMessageLevel",value:function(e){var t="";if(e&&e.length>0){var n,i=Ti(e);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.type===u.ERROR)return o.type;o.type===u.WARNING&&(t=o.type)}}catch(e){i.e(e)}finally{i.f()}}return t}},{key:"getMessageLabelClass",value:function(e){var t="";switch(this.getMessageLevel(e)){case u.ERROR:t="d3-node-error-label";break;case u.WARNING:t="d3-node-warning-label"}return t}},{key:"getErrorMarkerClass",value:function(e){var t="d3-error-circle-off";switch(this.getMessageLevel(e)){case u.ERROR:t="d3-error-circle";break;case u.WARNING:t="d3-warning-circle"}return t}},{key:"getNodeCenterPosX",value:function(e){return e.x_pos+e.width/2}},{key:"getNodeCenterPosY",value:function(e){return e.y_pos+e.height/2}},{key:"getNodeImageCenterPosX",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?e.x_pos+this.canvasLayout.supernodeImagePosX+this.canvasLayout.supernodeImageWidth/2:e.x_pos+this.getElementPosX(e.width,e.layout.imagePosX,e.layout.imagePosition)+e.layout.imageWidth/2}},{key:"getNodeImageCenterPosY",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?e.y_pos+this.canvasLayout.supernodeImagePosY+this.canvasLayout.supernodeImageHeight/2:e.y_pos+this.getElementPosY(e.height,e.layout.imagePosY,e.layout.imagePosition)+e.layout.imageHeight/2}},{key:"getNodeImagePosX",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeImagePosX:this.getElementPosX(e.width,e.layout.imagePosX,e.layout.imagePosition)}},{key:"getNodeImagePosY",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeImagePosY:this.getElementPosY(e.height,e.layout.imagePosY,e.layout.imagePosition)}},{key:"getNodeImageWidth",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeImageWidth:e.layout.imageWidth}},{key:"getNodeImageHeight",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeImageHeight:e.layout.imageHeight}},{key:"getNodeLabelPosX",value:function(e){if(v.CanvasUtils.isExpandedSupernode(e))return this.canvasLayout.supernodeLabelPosX;var t=this.getElementPosX(e.width,e.layout.labelPosX,e.layout.labelPosition);return"center"===e.layout.labelAlign?t-e.layout.labelWidth/2:t}},{key:"getNodeLabelPosY",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeLabelPosY:this.getElementPosY(e.height,e.layout.labelPosY,e.layout.labelPosition)}},{key:"getNodeLabelWidth",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?e.width-this.canvasLayout.supernodeLabelPosX+this.canvasLayout.supernodeErrorPosX:e.layout.labelWidth}},{key:"getNodeLabelHeight",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeLabelHeight:e.layout.labelHeight}},{key:"getNodeLabelEditIconTranslate",value:function(e,t,n,i){return"translate(".concat(this.getNodeLabelEditIconPosX(e,t,n,i),", ").concat(this.getNodeLabelEditIconPosY(e),")")}},{key:"getNodeLabelEditIconPosX",value:function(e,t,n,i){var o=i?this.getNodeLabelHoverWidth(e):this.getNodeLabelWidth(e),a=i?this.getNodeLabelHoverPosX(e):this.getNodeLabelPosX(e),r=t.getBoundingClientRect().width;if("center"===e.layout.labelAlign&&!v.CanvasUtils.isExpandedSupernode(e)){var s=o/2;return a+s+Math.min(s,r/n/2)}var l=Math.min(o,r/n);return this.getNodeLabelPosX(e)+l}},{key:"getNodeLabelEditIconPosY",value:function(e){return this.getNodeLabelPosY(e)}},{key:"getNodeLabelHoverPosX",value:function(e){return e.layout.labelSingleLine&&"center"===e.layout.labelAlign?this.getNodeLabelPosX(e)-250:this.getNodeLabelPosX(e)}},{key:"getNodeLabelHoverWidth",value:function(e){return e.layout.labelSingleLine?"center"===e.layout.labelAlign?e.layout.labelWidth+500:e.layout.labelWidth+40:e.layout.labelWidth}},{key:"getNodeLabelHoverHeight",value:function(e,t,n){if(e.layout.labelSingleLine)return e.layout.labelHeight;var i=t.getBoundingClientRect().height/n;return Math.max(i,e.layout.labelHeight)}},{key:"getNodeLabelTextAreaWidth",value:function(e){return this.getNodeLabelWidth(e)+2*u.TEXT_AREA_BORDER_ADJUSTMENT}},{key:"getNodeLabelTextAreaHeight",value:function(e){return this.getNodeLabelHeight(e)+2*u.TEXT_AREA_BORDER_ADJUSTMENT}},{key:"getNodeLabelTextAreaPosX",value:function(e){return this.getNodeLabelPosX(e)-u.TEXT_AREA_BORDER_ADJUSTMENT}},{key:"getNodeLabelTextAreaPosY",value:function(e){return this.getNodeLabelPosY(e)-u.TEXT_AREA_BORDER_ADJUSTMENT}},{key:"getNodeEllipsisTranslate",value:function(e){return"translate(".concat(this.getNodeEllipsisPosX(e),", ").concat(this.getNodeEllipsisPosY(e),")")}},{key:"getNodeEllipsisWidth",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeEllipsisWidth:e.layout.ellipsisWidth}},{key:"getNodeEllipsisHeight",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeEllipsisHeight:e.layout.ellipsisHeight}},{key:"getNodeEllipsisIconWidth",value:function(e){return this.getNodeEllipsisWidth(e)-2*e.layout.ellipsisHoverAreaPadding}},{key:"getNodeEllipsisIconHeight",value:function(e){return this.getNodeEllipsisHeight(e)-2*e.layout.ellipsisHoverAreaPadding}},{key:"getNodeEllipsisPosX",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?e.width+this.canvasLayout.supernodeEllipsisPosX:this.getElementPosX(e.width,e.layout.ellipsisPosX,e.layout.ellipsisPosition)}},{key:"getNodeEllipsisPosY",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeEllipsisPosY:this.getElementPosY(e.height,e.layout.ellipsisPosY,e.layout.ellipsisPosition)}},{key:"getNodeExpansionIconTranslate",value:function(e){var t=e.width+this.canvasLayout.supernodeExpansionIconPosX;return"translate(".concat(t,", ").concat(this.canvasLayout.supernodeExpansionIconPosY,")")}},{key:"getNodeErrorPosX",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?e.width+this.canvasLayout.supernodeErrorPosX:this.getElementPosX(e.width,e.layout.errorXPos,e.layout.errorPosition)}},{key:"getNodeErrorPosY",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeErrorPosY:this.getElementPosY(e.height,e.layout.errorYPos,e.layout.errorPosition)}},{key:"getNodeErrorWidth",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeErrorWidth:e.layout.errorWidth}},{key:"getNodeErrorHeight",value:function(e){return v.CanvasUtils.isExpandedSupernode(e)?this.canvasLayout.supernodeErrorHeight:e.layout.errorHeight}},{key:"getNodePortPosX",value:function(e,t){return this.getElementPosX(t.width,e.x_pos,e.pos)}},{key:"getNodePortPosY",value:function(e,t){return this.getElementPosY(t.height,e.y_pos,e.pos)}},{key:"getElementPosX",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"topLeft",i=0;return n.endsWith("Center")?i+=e/2:n.endsWith("Right")&&(i+=e),i+Number(t)}},{key:"getElementPosY",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"topLeft",i=0;return n.startsWith("middle")?i+=e/2:n.startsWith("bottom")&&(i+=e),i+Number(t)}},{key:"getSupernodePortXOffset",value:function(e,t){return t?t.find((function(t){return t.subflow_node_ref===e})).cx-this.canvasLayout.supernodeSVGAreaPadding:0}},{key:"getSupernodePortYOffset",value:function(e,t){return t?t.find((function(t){return t.subflow_node_ref===e})).cy:0}}])}(),Ni=function(){return e._createClass((function t(){e._classCallCheck(this,t)}),[{key:"getCommentCenterPosX",value:function(e){return e.x_pos+e.width/2}},{key:"getCommentCenterPosY",value:function(e){return e.y_pos+e.height/2}}])}();function Si(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function _i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Si(Object(n),!0).forEach((function(t){u._defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Si(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ei,Ii=!1,Di=!0,Oi=Math.PI,wi=function(){return e._createClass((function t(n,i,o,a){e._classCallCheck(this,t),this.canvasLayout=i,this.config=n,this.nodeUtils=o,this.commentUtils=a}),[{key:"getNewStraightCommentLinkStartPos",value:function(e,t){return v.CanvasUtils.getOuterCoord(e.x_pos,e.y_pos,e.width,e.height,this.canvasLayout.linkGap,this.commentUtils.getCommentCenterPosX(e),this.commentUtils.getCommentCenterPosY(e),t.x,t.y)}},{key:"getNewFreeformNodeLinkStartPos",value:function(e,t,n){var i,o;if("image_center"!==e.layout.drawNodeLinkLineFromTo||v.CanvasUtils.isExpanded(e))if(n){var a=this.getCenterOffset(e,n,!1);i=a.x,o=a.y}else i=this.nodeUtils.getNodeCenterPosX(e),o=this.nodeUtils.getNodeCenterPosY(e);else i=this.nodeUtils.getNodeImageCenterPosX(e),o=this.nodeUtils.getNodeImageCenterPosY(e);return v.CanvasUtils.getOuterCoord(e.x_pos,e.y_pos,e.width,e.height,this.canvasLayout.linkGap,i,o,t.x,t.y)}},{key:"getLinkCoords",value:function(e,t,n,i,o,a){return e.type===u.NODE_LINK?this.canvasLayout.linkMethod===u.LINK_METHOD_FREEFORM?this.getNodeLinkCoordsForFreeform(t,i,e):this.getNodeLinkCoordsForPortsConnection(t,n,i,o):e.type===u.ASSOCIATION_LINK?this.config.enableAssocLinkType===u.ASSOC_RIGHT_SIDE_CURVE?this.getAssociationCurveLinkCoords(t,i,a):this.getAssociationLinkCoords(t,i):this.getCommentLinkCoords(t,i)}},{key:"getNodeLinkCoordsForFreeform",value:function(e,t,n){var i,o,a,r,s,l,c,d,h=e.id===t.id;if("image_center"!==e.layout.drawNodeLinkLineFromTo||this.canvasLayout.linkType!==u.LINK_TYPE_STRAIGHT||v.CanvasUtils.isExpanded(e))if(n&&n.srcFreeformInfo){var g=this.getCenterOffset(e,n.srcFreeformInfo,h);i=g.x,o=g.y}else i=this.nodeUtils.getNodeCenterPosX(e),o=this.nodeUtils.getNodeCenterPosY(e);else i=this.nodeUtils.getNodeImageCenterPosX(e),o=this.nodeUtils.getNodeImageCenterPosY(e);if("image_center"!==t.layout.drawNodeLinkLineFromTo||this.canvasLayout.linkType!==u.LINK_TYPE_STRAIGHT||v.CanvasUtils.isExpanded(t))if(n&&n.trgFreeformInfo){var p=this.getCenterOffset(t,n.trgFreeformInfo,h);a=p.x,r=p.y}else a=this.nodeUtils.getNodeCenterPosX(t),r=this.nodeUtils.getNodeCenterPosY(t);else a=this.nodeUtils.getNodeImageCenterPosX(t),r=this.nodeUtils.getNodeImageCenterPosY(t);if(this.canvasLayout.linkType!==u.LINK_TYPE_STRAIGHT||h)return n.srcFreeformInfo.dir===u.EAST?(s=i+this.canvasLayout.linkGap,l=o):n.srcFreeformInfo.dir===u.WEST?(s=i-this.canvasLayout.linkGap,l=o):n.srcFreeformInfo.dir===u.SOUTH?(s=i,l=o+this.canvasLayout.linkGap):n.srcFreeformInfo.dir===u.NORTH&&(s=i,l=o-this.canvasLayout.linkGap),n.trgFreeformInfo.dir===u.EAST?(c=a+this.canvasLayout.linkGap,d=r):n.trgFreeformInfo.dir===u.WEST?(c=a-this.canvasLayout.linkGap,d=r):n.trgFreeformInfo.dir===u.SOUTH?(c=a,d=r+this.canvasLayout.linkGap):n.trgFreeformInfo.dir===u.NORTH&&(c=a,d=r-this.canvasLayout.linkGap),{originX:0,originY:0,x1:s,y1:l,x2:c,y2:d,srcDir:n.srcFreeformInfo.dir,trgDir:n.trgFreeformInfo.dir};var f=v.CanvasUtils.getOuterCoord(e.x_pos,e.y_pos,e.width,e.height,this.canvasLayout.linkGap,i,o,a,r),y=v.CanvasUtils.getOuterCoord(t.x_pos,t.y_pos,t.width,t.height,this.canvasLayout.linkGap,a,r,i,o);return{originX:f.originX,originY:f.originY,x1:f.x,y1:f.y,x2:y.x,y2:y.y,srcDir:f.dir,trgDir:y.dir}}},{key:"getCenterOffset",value:function(e,t,n){var i=t.len+1,o=t.idx+1,a=0,r=0;return t.dir===u.NORTH||t.dir===u.SOUTH?(a=e.x_pos+e.width/i*o,r=this.getYPosForCenterOffset(e,t.dir,n)):t.dir!==u.EAST&&t.dir!==u.WEST||(a=this.getXPosForCenterOffset(e,t.dir,n),r=e.y_pos+e.height/i*o),{x:a,y:r}}},{key:"getYPosForCenterOffset",value:function(e,t,n){return this.canvasLayout.linkType!==u.LINK_TYPE_STRAIGHT||n?t===u.SOUTH?e.y_pos+e.height:e.y_pos:this.nodeUtils.getNodeCenterPosY(e)}},{key:"getXPosForCenterOffset",value:function(e,t,n){return this.canvasLayout.linkType!==u.LINK_TYPE_STRAIGHT||n?t===u.EAST?e.x_pos+e.width:e.x_pos:this.nodeUtils.getNodeCenterPosX(e)}},{key:"getNodeLinkCoordsForPortsConnection",value:function(e,t,n,i){var o,a,r,s,l,c;if(e.outputs&&e.outputs.length>0){var u=e.outputs.find((function(e){return e.id===t}));o=u.cx,a=u.cy,l=u.dir}else o=this.nodeUtils.getNodePortPosX(e.layout.outputPortPositions[0],e),a=this.nodeUtils.getNodePortPosY(e.layout.outputPortPositions[0],e),l=v.CanvasUtils.getPortDir(o,a,e);if(n.inputs&&n.inputs.length>0){var d=n.inputs.find((function(e){return e.id===i}));r=d.cx,s=d.cy,c=d.dir}else r=this.nodeUtils.getNodePortPosX(n.layout.inputPortPositions[0],n),s=this.nodeUtils.getNodePortPosY(n.layout.inputPortPositions[0],n),c=v.CanvasUtils.getPortDir(o,a,e);return{x1:e.x_pos+o,y1:e.y_pos+a,x2:n.x_pos+r,y2:n.y_pos+s,srcDir:l,trgDir:c}}},{key:"getAssociationCurveLinkCoords",value:function(e,t,n){var i=0,o=0;return n===u.ASSOC_VAR_CURVE_RIGHT?(i=e.width,o=0):n===u.ASSOC_VAR_CURVE_LEFT?(i=0,o=t.width):n===u.ASSOC_VAR_DOUBLE_BACK_LEFT?(i=0,o=0):(i=e.width,o=t.width),{x1:e.x_pos+i,y1:e.y_pos+this.nodeUtils.getNodePortPosY(e.layout.outputPortPositions[0],e),x2:t.x_pos+o,y2:t.y_pos+this.nodeUtils.getNodePortPosY(t.layout.inputPortPositions[0],t)}}},{key:"getCommentLinkCoords",value:function(e,t){var n,i,o=this.commentUtils.getCommentCenterPosX(e),a=this.commentUtils.getCommentCenterPosY(e);"image_center"===t.layout.drawCommentLinkLineTo?(n=this.nodeUtils.getNodeImageCenterPosX(t),i=this.nodeUtils.getNodeImageCenterPosY(t)):(n=this.nodeUtils.getNodeCenterPosX(t),i=this.nodeUtils.getNodeCenterPosY(t));var r=v.CanvasUtils.getOuterCoord(e.x_pos,e.y_pos,e.width,e.height,this.canvasLayout.linkGap,o,a,n,i),s=v.CanvasUtils.getOuterCoord(t.x_pos,t.y_pos,t.width,t.height,this.canvasLayout.linkGap,n,i,o,a);return{x1:r.x,y1:r.y,x2:s.x,y2:s.y}}},{key:"getAssociationLinkCoords",value:function(e,t){var n=this.nodeUtils.getNodeCenterPosX(e),i=this.nodeUtils.getNodeCenterPosY(e),o=this.nodeUtils.getNodeCenterPosX(t),a=this.nodeUtils.getNodeCenterPosY(t),r=v.CanvasUtils.getOuterCoord(e.x_pos,e.y_pos,e.width,e.height,this.canvasLayout.linkGap,n,i,o,a),s=v.CanvasUtils.getOuterCoord(t.x_pos,t.y_pos,t.width,t.height,this.canvasLayout.linkGap,o,a,n,i);return{originX:r.originX,originY:r.originY,x1:r.x,y1:r.y,x2:s.x,y2:s.y,srcDir:r.dir,trgDir:s.dir}}},{key:"addConnectionPaths",value:function(e){var t=this;return e.forEach((function(e){e.coordsUpdated&&(e.pathInfo=t.getConnectorPathInfo(e))})),e}},{key:"getConnectorPathInfo",value:function(e,t){var n=this.getMinInitialLine(e,t);return e.type===u.NODE_LINK?this.canvasLayout.linkMethod===u.LINK_METHOD_FREEFORM&&this.canvasLayout.linkType===u.LINK_TYPE_STRAIGHT?this.getStraightPath(e,n):this.getNodeLinkPathInfo(e,n):e.type===u.ASSOCIATION_LINK&&this.config.enableAssocLinkType===u.ASSOC_RIGHT_SIDE_CURVE?this.getAssociationCurvePath(e,n):this.getStraightPath(e,n)}},{key:"getMinInitialLine",value:function(e,t){return e.type===u.COMMENT_LINK?0:e.minInitialLineForElbow?e.minInitialLineForElbow:e.srcObj&&e.srcObj.layout?e.srcObj.layout.minInitialLine:t||30}},{key:"getNodeLinkPathInfo",value:function(e,t){var n,i,o,a,r=e;r.srcObj&&r.trgNode?r.srcDir===u.SOUTH?(n=-(r.srcObj.x_pos+r.srcObj.width),o=-r.srcObj.x_pos,i=-(r.trgNode.x_pos+r.trgNode.width),a=-r.trgNode.x_pos):r.srcDir===u.NORTH?(n=r.srcObj.x_pos,o=r.srcObj.x_pos+r.srcObj.width,i=r.trgNode.x_pos,a=r.trgNode.x_pos+r.trgNode.width):r.srcDir===u.WEST?(n=-(r.srcObj.y_pos+r.srcObj.height),o=-r.srcObj.y_pos,i=-(r.trgNode.y_pos+r.trgNode.height),a=-r.trgNode.y_pos):(n=r.srcObj.y_pos,o=r.srcObj.y_pos+r.srcObj.height,i=r.trgNode.y_pos,a=r.trgNode.y_pos+r.trgNode.height):r.srcDir===u.SOUTH?(n=-r.x1,i=-r.x2,o=-r.x1,a=-r.x2):r.srcDir===u.NORTH?(n=r.x1,i=r.x2,o=r.x1,a=r.x2):r.srcDir===u.WEST?(n=-r.y1,i=-r.y2,o=-r.y1,a=-r.y2):(n=r.y1,i=r.y2,o=r.y1,a=r.y2),r.srcDir===u.SOUTH?r=this.rotateData90Degrees(r,Di):r.srcDir===u.NORTH?r=this.rotateData90Degrees(r,Ii):r.srcDir===u.WEST&&(r=this.rotateData90Degrees(r,Ii),r=this.rotateData90Degrees(r,Ii)),r.trgDir=this.getRotatedTrgDir(r);var s=r.srcDir;r.srcDir=u.EAST;var l=this.getPathInfo({link:r,minInitialLine:t,topSrc:n,topTrg:i,bottomSrc:o,bottomTrg:a});return r.srcDir=s,r.srcDir===u.SOUTH?(l.elements=this.rotateElements90Degrees(l.elements,Ii),l.centerPoint=this.rotatePoint90Degrees(l.centerPoint.x,l.centerPoint.y,Ii)):r.srcDir===u.NORTH?(l.elements=this.rotateElements90Degrees(l.elements,Di),l.centerPoint=this.rotatePoint90Degrees(l.centerPoint.x,l.centerPoint.y,Di)):r.srcDir===u.WEST&&(l.elements=this.rotateElements90Degrees(l.elements,Di),l.elements=this.rotateElements90Degrees(l.elements,Di),l.centerPoint=this.rotatePoint90Degrees(l.centerPoint.x,l.centerPoint.y,Di),l.centerPoint=this.rotatePoint90Degrees(l.centerPoint.x,l.centerPoint.y,Di)),l.path=this.createPath(l.elements),l}},{key:"rotateData90Degrees",value:function(e,t){var n=this.rotatePoint90Degrees(e.x1,e.y1,t),i=this.rotatePoint90Degrees(e.x2,e.y2,t);return _i(_i({},e),{},{x1:n.x,y1:n.y,x2:i.x,y2:i.y})}},{key:"rotateElements90Degrees",value:function(e,t){var n,i=this;return e.forEach((function(e){n=i.rotatePoint90Degrees(e.x,e.y,t),e.x=n.x,e.y=n.y,"Q"!==e.p&&"C"!==e.p||(n=i.rotatePoint90Degrees(e.x2,e.y2,t),e.x2=n.x,e.y2=n.y,"C"===e.p&&(n=i.rotatePoint90Degrees(e.x3,e.y3,t),e.x3=n.x,e.y3=n.y))})),e}},{key:"rotatePoint90Degrees",value:function(e,t,n){return n?{x:t,y:-e}:{x:-t,y:e}}},{key:"getRotatedTrgDir",value:function(e){if(e.srcDir===u.SOUTH)switch(e.trgDir){case u.SOUTH:return u.EAST;case u.NORTH:return u.WEST;case u.WEST:return u.SOUTH;default:case u.EAST:return u.NORTH}else if(e.srcDir===u.NORTH)switch(e.trgDir){case u.SOUTH:return u.WEST;case u.NORTH:return u.EAST;case u.WEST:return u.NORTH;default:case u.EAST:return u.SOUTH}else if(e.srcDir===u.WEST)switch(e.trgDir){case u.SOUTH:return u.NORTH;case u.NORTH:return u.SOUTH;case u.WEST:return u.EAST;default:case u.EAST:return u.WEST}return e.trgDir}},{key:"getStraightPath",value:function(e,t){if(e.srcNodeId&&e.trgNodeId&&e.srcNodeId===e.trgNodeId)return this.selfRefLinkPath(e,t);var n="M "+e.x1+" "+e.y1+" L "+e.x2+" "+e.y2,i=e.x2-e.x1,o=e.y2-e.y1,a={x:e.x1+i/2,y:e.y1+o/2},r=Math.atan(o/i);return i<0&&(r=Oi+r),{path:n,centerPoint:a,angle:r}}},{key:"selfRefLinkPath",value:function(e,t){var n=e.y2-t,i=e.x1+t;return{path:"M "+e.x1+" "+e.y1+" L "+i+" "+n+" "+e.x2+" "+n+" "+e.x2+" "+e.y2,centerPoint:{x:e.x2+(i-e.x2)/2,y:n},angle:180}}},{key:"getAssociationCurvePath",value:function(e,t){return e.assocLinkVariation===u.ASSOC_VAR_CURVE_LEFT?this.getCurveLeftPath(e,t):e.assocLinkVariation===u.ASSOC_VAR_DOUBLE_BACK_LEFT?this.getDoubleBackLeft(e,t):e.assocLinkVariation===u.ASSOC_VAR_DOUBLE_BACK_RIGHT?this.getDoubleBackRight(e,t):this.getCurveRightPath(e,t)}},{key:"getCurveLeftPath",value:function(e,t){var n=e.x1-(e.x1-e.x2)/2;return this.getCurveOutPath(e,t,n)}},{key:"getCurveRightPath",value:function(e,t){var n=e.x1+(e.x2-e.x1)/2;return this.getCurveOutPath(e,t,n)}},{key:"getCurveOutPath",value:function(e,t,n){var i=e.y1,o=n,a=e.y2;return{path:"M "+e.x1+" "+e.y1+" C "+n+" "+i+" "+o+" "+a+" "+e.x2+" "+e.y2,centerPoint:{x:n,y:i+(a-i)/2}}}},{key:"getDoubleBackLeft",value:function(e,t){var n=Math.min(e.x1,e.x2)-t-100;return this.getDoubleBack(e,t,n)}},{key:"getDoubleBackRight",value:function(e,t){var n=Math.max(e.x1,e.x2)+t+100;return this.getDoubleBack(e,t,n)}},{key:"getDoubleBack",value:function(e,t,n){var i=e.y1,o=n,a=e.y2;return{path:"M "+e.x1+" "+e.y1+" C "+n+" "+i+" "+o+" "+a+" "+e.x2+" "+e.y2,centerPoint:{x:v.CanvasUtils.getCenterPointCubicBezier(e.x1,n,o,e.x2),y:v.CanvasUtils.getCenterPointCubicBezier(e.y1,i,a,e.y2)}}}},{key:"getPathInfo",value:function(e){switch(e.minFinalLine=e.link.trgNode?e.link.trgNode.layout.minFinalLine:30,e.link.trgDir){case u.NORTH:return this.getPathInfoEN(e);case u.SOUTH:return this.getPathInfoES(e);case u.EAST:return this.getPathInfoEE(e);case u.WEST:default:return this.getPathInfoEW(e)}}},{key:"getPathInfoEW",value:function(e){var t=this.canvasLayout.wrapAroundNodePadding,n=e.link.x2-e.link.x1;if(n>e.minInitialLine+e.minFinalLine||n>0&&e.topSrc-t<e.bottomTrg&&e.bottomSrc+t>e.topTrg){var i={},o={};if(i.x=e.link.x1+e.minInitialLine,i.y=e.link.y1,o.x=i.x,o.y=e.link.y2,n>0){var a=2*e.minInitialLine-n;a>0&&(i.x=e.link.x1+e.minInitialLine-a/2,o.x=i.x)}return this.get3PartLink(e,i,o)}var r={},s={},l={},c={},u=this.calculateMidY(e.link,e.topSrc,e.bottomSrc,e.topTrg,e.bottomTrg);return r.x=e.link.x1+e.minInitialLine,r.y=e.link.y1,s.x=r.x,s.y=u,l.x=e.link.x2-e.minFinalLine,l.y=s.y,c.x=l.x,c.y=e.link.y2,this.get5PartLink(e,r,s,l,c)}},{key:"getPathInfoEE",value:function(e){var t=this.canvasLayout.wrapAroundNodePadding;if(e.topTrg-t<e.link.y1&&e.bottomTrg+t>e.link.y1){var n={},i={},o={},a={};return n.x=e.link.x1+e.minInitialLine,n.y=e.link.y1,i.x=n.x,i.y=e.link.x1>=e.link.x2?e.link.y1+(e.link.y2-e.link.y1)/2:e.topTrg-t,o.x=e.link.x2+e.minFinalLine,o.y=i.y,a.x=o.x,a.y=e.link.y2,e.link.x2<e.link.x1&&(i.y=e.topSrc-t,o.y=i.y),this.get5PartLink(e,n,i,o,a)}var r={},s={};return r.x=Math.max(e.link.x1+e.minInitialLine,e.link.x2+e.minFinalLine),r.y=e.link.y1,s.x=r.x,s.y=e.link.y2,this.get3PartLink(e,r,s)}},{key:"getPathInfoEN",value:function(e){if(e.link.y2>e.link.y1+e.minFinalLine&&e.link.x2>e.link.x1+e.minInitialLine){var t={};return t.x=e.link.x2,t.y=e.link.y1,this.get2PartLink(e,t)}var n={},i={},o={},a=e.link.y2-e.minFinalLine;return e.link.x2<e.link.x1&&(e.topTrg>e.bottomSrc+e.minFinalLine+this.canvasLayout.wrapAroundNodePadding?a=e.topTrg-e.minFinalLine:e.topTrg>e.topSrc&&(a=e.topSrc-this.canvasLayout.wrapAroundNodePadding)),n.x=e.link.x1+e.minInitialLine,n.y=e.link.y1,i.x=n.x,i.y=a,o.x=e.link.x2,o.y=i.y,this.get4PartLink(e,n,i,o)}},{key:"getPathInfoES",value:function(e){if(e.link.y1>e.link.y2+e.minFinalLine&&e.link.x2>e.link.x1){var t={};return t.x=e.link.x2,t.y=e.link.y1,this.get2PartLink(e,t)}var n={},i={},o={},a=e.link.y2+e.minFinalLine;return e.link.x2<e.link.x1&&(e.bottomTrg<e.topSrc-e.minFinalLine-this.canvasLayout.wrapAroundNodePadding?a=e.bottomTrg+e.minFinalLine:e.bottomTrg<e.bottomSrc&&(a=e.bottomSrc+this.canvasLayout.wrapAroundNodePadding)),n.x=e.link.x1+e.minInitialLine,n.y=e.link.y1,i.x=n.x,i.y=a,o.x=e.link.x2,o.y=i.y,this.get4PartLink(e,n,i,o)}},{key:"calculateMidY",value:function(e,t,n,i,o){var a;if(i>=n+this.canvasLayout.wrapAroundNodePadding)a=n+(i-n)/2;else if(o<=t-this.canvasLayout.wrapAroundNodePadding)a=o+(t-o)/2;else{var r=Math.max(n,o),s=r-e.y1,l=r-e.y2,c=Math.min(t,i);a=s+l>e.y1-c+(e.y2-c)?c-this.canvasLayout.wrapAroundSpacing:r+this.canvasLayout.wrapAroundSpacing}return a}},{key:"get2PartLink",value:function(e,t){switch(this.canvasLayout.linkType){case u.LINK_TYPE_ELBOW:return this.get2PartElbow(e,t);case u.LINK_TYPE_STRAIGHT:return this.get2PartStraight(e,t);case u.LINK_TYPE_PARALLAX:return this.get2PartParallax(e,t);default:return this.get2PartCurve(e,t)}}},{key:"get3PartLink",value:function(e,t,n){switch(this.canvasLayout.linkType){case u.LINK_TYPE_ELBOW:return this.get3PartElbow(e,t,n);case u.LINK_TYPE_STRAIGHT:return this.get3PartStraight(e,t,n);case u.LINK_TYPE_PARALLAX:return this.get3PartParallax(e,t,n);default:return this.get3PartCurve(e,t,n)}}},{key:"get4PartLink",value:function(e,t,n,i){switch(this.canvasLayout.linkType){case u.LINK_TYPE_ELBOW:return this.get4PartElbow(e,t,n,i);case u.LINK_TYPE_STRAIGHT:return this.get4PartStraight(e,t,n,i);case u.LINK_TYPE_PARALLAX:return this.get4PartParallax(e,t,n,i);default:return this.get4PartCurve(e,t,n,i)}}},{key:"get5PartLink",value:function(e,t,n,i,o){switch(this.canvasLayout.linkType){case u.LINK_TYPE_ELBOW:return this.get5PartElbow(e,t,n,i,o);case u.LINK_TYPE_STRAIGHT:return this.get5PartStraight(e,t,n,i,o);case u.LINK_TYPE_PARALLAX:return this.get5PartParallax(e,t,n,i,o);default:return this.get5PartCurve(e,t,n,i,o)}}},{key:"get2PartElbow",value:function(e,t){var n=e.link.y2<t.y?-this.canvasLayout.elbowSize:this.canvasLayout.elbowSize;return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x-this.canvasLayout.elbowSize,y:t.y},{p:"Q",x:t.x,y:t.y,x2:t.x,y2:t.y+n},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:e.link.x1+(e.link.x2-e.link.x1)/2,y:e.link.y1}}}},{key:"get3PartElbow",value:function(e,t,n){var i=this.canvasLayout.elbowSize,o=this.adjustElbowSize(n.y,t.y),a=e.link.x2>n.x?this.canvasLayout.elbowSize:-this.canvasLayout.elbowSize;return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x-i,y:t.y},{p:"Q",x:t.x,y:t.y,x2:t.x,y2:t.y+o},{p:"L",x:n.x,y:n.y-o},{p:"Q",x:n.x,y:n.y,x2:n.x+a,y2:n.y},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:t.x,y:e.link.y1+(e.link.y2-e.link.y1)/2}}}},{key:"get4PartElbow",value:function(e,t,n,i){var o=this.canvasLayout.elbowSize,a=this.adjustElbowSize(n.y,t.y),r=this.adjustElbowSize(t.x,i.x),s=i.y>e.link.y2?this.canvasLayout.elbowSize:-this.canvasLayout.elbowSize;return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x-o,y:t.y},{p:"Q",x:t.x,y:t.y,x2:t.x,y2:t.y+a},{p:"L",x:n.x,y:n.y-a},{p:"Q",x:n.x,y:n.y,x2:n.x-r,y2:n.y},{p:"L",x:i.x+r,y:i.y},{p:"Q",x:i.x,y:i.y,x2:i.x,y2:i.y-s},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:n.x+(i.x-n.x)/2,y:n.y}}}},{key:"get5PartElbow",value:function(e,t,n,i,o){var a=this.canvasLayout.elbowSize,r=this.adjustElbowSize(n.y,t.y),s=this.adjustElbowSize(t.x,i.x),l=this.adjustElbowSize(i.y,o.y),c=e.link.x2<o.x?-this.canvasLayout.elbowSize:this.canvasLayout.elbowSize;return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x-a,y:t.y},{p:"Q",x:t.x,y:t.y,x2:t.x,y2:t.y+r},{p:"L",x:n.x,y:n.y-r},{p:"Q",x:n.x,y:n.y,x2:n.x-s,y2:n.y},{p:"L",x:i.x+s,y:i.y},{p:"Q",x:i.x,y:i.y,x2:i.x,y2:i.y-l},{p:"L",x:o.x,y:o.y+l},{p:"Q",x:o.x,y:o.y,x2:o.x+c,y2:o.y},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:n.x+(i.x-n.x)/2,y:n.y}}}},{key:"adjustElbowSize",value:function(e,t){var n=this.canvasLayout.elbowSize,i=t-e;return i<2*this.canvasLayout.elbowSize&&i>-2*this.canvasLayout.elbowSize&&(n=Math.abs(i)/2),n=i>0?-n:n}},{key:"get2PartParallax",value:function(e,t){var n=e.link.y2>e.link.y1?-e.minFinalLine:e.minFinalLine,i={},o={};return i.x=e.link.x1+e.minInitialLine,i.y=t.y,o.x=t.x,o.y=e.link.y2+n,{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:i.x,y:t.y},{p:"L",x:o.x,y:o.y},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:i.x+(t.x-i.x)/2,y:i.y+(o.y-i.y)/2}}}},{key:"get3PartParallax",value:function(e,t,n){var i,o={x:0,y:0};if(e.link.x2>n.x){var a={};a.x=e.link.x2-Math.min(e.minFinalLine,e.link.x2-t.x),a.y=e.link.y2,i=[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x,y:t.y},{p:"L",x:a.x,y:a.y},{p:"L",x:e.link.x2,y:e.link.y2}],o={x:t.x+(a.x-t.x)/2,y:t.y+(a.y-t.y)/2}}else e.link.x2<e.link.x1+e.minInitialLine?(i=[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x,y:t.y},{p:"L",x:Math.max(n.x,e.link.x2),y:e.link.y2},{p:"L",x:e.link.x2,y:e.link.y2}],o={x:e.link.x2+(n.x-e.link.x2)/2,y:n.y}):(i=[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x,y:t.y},{p:"L",x:e.link.x2+e.minFinalLine,y:e.link.y2},{p:"L",x:e.link.x2,y:e.link.y2}],o={x:t.x,y:t.y+(e.link.y2-t.y)/2});return{elements:i,centerPoint:o}}},{key:"get4PartParallax",value:function(e,t,n,i){return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x,y:t.y},{p:"L",x:n.x,y:n.y},{p:"L",x:i.x,y:i.y},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:i.x+(n.x-i.x)/2,y:n.y}}}},{key:"get5PartParallax",value:function(e,t,n,i,o){return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x,y:t.y},{p:"L",x:n.x,y:n.y},{p:"L",x:i.x,y:i.y},{p:"L",x:o.x,y:o.y},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:i.x+(n.x-i.x)/2,y:n.y}}}},{key:"get2PartStraight",value:function(e,t){return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:e.link.x1+(e.link.x2-e.link.x1)/2,y:e.link.y1+(e.link.y2-e.link.y1)/2}}}},{key:"get3PartStraight",value:function(e,t,n){var i,o={x:0,y:0};return n.x<e.link.x2?(i=[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:e.link.x2,y:e.link.y2}],o={x:e.link.x1+(e.link.x2-e.link.x1)/2,y:e.link.y1+(e.link.y2-e.link.y1)/2}):e.link.x2<e.link.x1?(i=[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x,y:n.y},{p:"L",x:e.link.x2,y:e.link.y2}],o={x:e.link.x2+(n.x-e.link.x2)/2,y:n.y}):(i=[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x+e.minFinalLine,y:t.y},{p:"L",x:e.link.x2,y:e.link.y2}],o={x:e.link.x1+(t.x-e.link.x1)/2,y:e.link.y1}),{elements:i,centerPoint:o}}},{key:"get4PartStraight",value:function(e,t,n,i){return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:e.link.x1+e.minInitialLine,y:n.y},{p:"L",x:e.link.x2,y:n.y},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:i.x+(n.x-i.x)/2,y:n.y}}}},{key:"get5PartStraight",value:function(e,t,n,i,o){var a=o.x>e.link.x2?e.minFinalLine:-e.minFinalLine;return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"L",x:t.x,y:n.y},{p:"L",x:e.link.x2+a,y:n.y},{p:"L",x:e.link.x2+a,y:e.link.y2},{p:"L",x:e.link.x2,y:e.link.y2}],centerPoint:{x:i.x+(n.x-i.x)/2,y:n.y}}}},{key:"get2PartCurve",value:function(e,t){return{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"Q",x:t.x,y:t.y,x2:e.link.x2,y2:e.link.y2}],centerPoint:{x:v.CanvasUtils.getCenterPointQuadBezier(e.link.x1,t.x,e.link.x2),y:v.CanvasUtils.getCenterPointQuadBezier(e.link.y1,t.y,e.link.y2)}}}},{key:"get3PartCurve",value:function(e,t,n){var i,o;if(t.x>e.link.x2)i=[{p:"M",x:e.link.x1,y:e.link.y1},{p:"C",x:t.x+80,y:t.y,x2:n.x+20,y2:n.y,x3:e.link.x2,y3:e.link.y2}],o={x:v.CanvasUtils.getCenterPointCubicBezier(e.link.x1,t.x+80,n.x,e.link.x2),y:v.CanvasUtils.getCenterPointCubicBezier(e.link.y1,t.y,n.y,e.link.y2)};else{var a={};a.x=e.link.x1+(e.link.x2-e.link.x1)/2,i=[{p:"M",x:e.link.x1,y:e.link.y1},{p:"C",x:a.x,y:t.y,x2:a.x,y2:n.y,x3:e.link.x2,y3:e.link.y2}],o={x:a.x,y:t.y+(n.y-t.y)/2}}return{elements:i,centerPoint:o}}},{key:"get4PartCurve",value:function(e,t,n,i){var o=e.link.x2-t.x,a=Math.min(200,Math.abs(o)),r=o>0?-a/2:a/2,s={},l={},c={};return s.x=t.x,s.y=t.y+(n.y-t.y)/2,l.x=n.x-r,l.y=n.y,c.x=i.x+r,c.y=n.y,{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"Q",x:t.x,y:t.y,x2:s.x,y2:s.y},{p:"Q",x:n.x,y:n.y,x2:l.x,y2:l.y},{p:"L",x:c.x,y:c.y},{p:"Q",x:i.x,y:i.y,x2:e.link.x2,y2:e.link.y2}],centerPoint:l}}},{key:"get5PartCurve",value:function(e,t,n,i,o){var a=o.x-t.x,r=Math.min(200,Math.abs(a)),s=a>0?-r/2:r/2,l={},c={},u={},d={};return l.x=t.x,l.y=t.y+(n.y-t.y)/2,c.x=n.x-s,c.y=n.y,u.x=i.x+s,u.y=n.y,d.x=i.x,d.y=e.link.y2-(e.link.y2-i.y)/2,{elements:[{p:"M",x:e.link.x1,y:e.link.y1},{p:"Q",x:t.x,y:t.y,x2:l.x,y2:l.y},{p:"Q",x:n.x,y:n.y,x2:c.x,y2:c.y},{p:"L",x:u.x,y:u.y},{p:"Q",x:i.x,y:i.y,x2:d.x,y2:d.y},{p:"Q",x:o.x,y:o.y,x2:e.link.x2,y2:e.link.y2}],centerPoint:c}}},{key:"createPath",value:function(e){var t=e.length-1,n="";return e.forEach((function(e,i){"M"===e.p?n+="M "+e.x+" "+e.y:"L"===e.p?n+="L "+e.x+" "+e.y:"T"===e.p?n+="T "+e.x+" "+e.y:"Q"===e.p?n+="Q "+e.x+" "+e.y+" "+e.x2+" "+e.y2:"C"===e.p&&(n+="C "+e.x+" "+e.y+" "+e.x2+" "+e.y2+" "+e.x3+" "+e.y3),i<t&&(n+=" ")})),n}}])}(),Ai=function(){return e._createClass((function t(n){e._classCallCheck(this,t),this.canvasLayout=n}),[{key:"getDec",value:function(e,t){return t?t.find((function(t){return t.id===e})):null}},{key:"getDecLabelClass",value:function(e,t){var n=e.label_single_line?" d3-label-single-line":" d3-label-multi-line",i="center"===e.label_align?" d3-label-center":"";return this.getDecClass(e,"d3-".concat(t,"-dec-label"))+n+i}},{key:"getDecLabelTextAreaClass",value:function(e){return"d3-dec-label-entry"+(e.label_single_line?" d3-label-single-line":" d3-label-multi-line-entry")+("center"===e.label_align?" d3-label-center":"")}},{key:"getDecTransform",value:function(e,t,n){return"translate(".concat(this.getDecPosX(e,t,n),", ").concat(this.getDecPosY(e,t,n),")")}},{key:"getDecPosX",value:function(e,t,n){return n===u.DEC_LINK?this.getLinkDecPosX(e,t,n):this.getNodeDecPosX(e,t)}},{key:"getNodeDecPosX",value:function(e,t){var n=e.position||"topLeft",i=0;return"topLeft"===n||"middleLeft"===n||"bottomLeft"===n?i=void 0!==e.x_pos?Number(e.x_pos):t.layout.decoratorLeftX:"topCenter"===n||"middleCenter"===n||"bottomCenter"===n?i=t.width/2+(void 0!==e.x_pos?Number(e.x_pos):t.layout.decoratorCenterX):"topRight"!==n&&"middleRight"!==n&&"bottomRight"!==n||(i=t.width+(void 0!==e.x_pos?Number(e.x_pos):t.layout.decoratorRightX)),i}},{key:"getLinkDecPosX",value:function(e,t,n){var i=e.position||"middle",o=0;return"middle"===i?o=t.pathInfo.centerPoint?t.pathInfo.centerPoint.x:t.x1+(t.x2-t.x1)/2:"source"===i?o=t.pathInfo.sourcePoint?t.pathInfo.sourcePoint.x:t.x1:"target"===i&&(o=t.pathInfo.targetPoint?t.pathInfo.targetPoint.x:t.x2),o=void 0!==e.x_pos?o+Number(e.x_pos):o,e.distance&&l.has_1(t,"pathInfo.angle")&&(o+=Math.cos(t.pathInfo.angle)*e.distance),"center"===e.label_align&&(o-=this.getDecWidth(e,t,n)/2),o}},{key:"getDecPosY",value:function(e,t,n){return n===u.DEC_LINK?this.getLinkDecPosY(e,t):this.getNodeDecPosY(e,t)}},{key:"getNodeDecPosY",value:function(e,t){var n=e.position||"topLeft",i=0;return"topLeft"===n||"topCenter"===n||"topRight"===n?i=void 0!==e.y_pos?Number(e.y_pos):t.layout.decoratorTopY:"middleLeft"===n||"middleCenter"===n||"middleRight"===n?i=t.height/2+(void 0!==e.y_pos?Number(e.y_pos):t.layout.decoratorMiddleY):"bottomLeft"!==n&&"bottomCenter"!==n&&"bottomRight"!==n||(i=t.height+(void 0!==e.y_pos?Number(e.y_pos):t.layout.decoratorBottomY)),i}},{key:"getLinkDecPosY",value:function(e,t){var n=e.position||"middle",i=0;return"middle"===n?i=t.pathInfo.centerPoint?t.pathInfo.centerPoint.y:t.y1+(t.y2-t.y1)/2:"source"===n?i=t.pathInfo.sourcePoint?t.pathInfo.sourcePoint.y:t.y1:"target"===n&&(i=t.pathInfo.targetPoint?t.pathInfo.targetPoint.y:t.y2),i=void 0!==e.y_pos?i+Number(e.y_pos):i,e.distance&&l.has_1(t,"pathInfo.angle")&&(i+=Math.sin(t.pathInfo.angle)*e.distance),i}},{key:"getDecPadding",value:function(e,t,n){return!1===e.outline?0:n===u.DEC_LINK?this.canvasLayout.linkDecoratorPadding:t.layout.decoratorPadding}},{key:"getDecWidth",value:function(e,t,n){return void 0!==e.width?Number(e.width):n===u.DEC_LINK?this.canvasLayout.linkDecoratorWidth:t.layout.decoratorWidth}},{key:"getDecHeight",value:function(e,t,n){return void 0!==e.height?Number(e.height):n===u.DEC_LINK?this.canvasLayout.linkDecoratorHeight:t.layout.decoratorHeight}},{key:"getDecClass",value:function(e,t){var n=t;return e&&e.class_name&&(n+=" "+e.class_name),n}},{key:"getDecImage",value:function(e){return e?e.image:""}},{key:"getDecLabelEditIconTranslate",value:function(e,t,n,i,o){return"translate(".concat(this.getDecLabelEditIconPosX(e,t,n,i,o),", ").concat(this.getDecLabelEditIconPosY(e),")")}},{key:"getDecLabelEditIconPosX",value:function(e,t,n,i,o){var a=Math.min(i.getBoundingClientRect().width,this.getDecLabelWidth(e,t,n));return"center"===e.label_align?this.getDecLabelWidth(e,t,n)/2+a/2/o:a/o}},{key:"getDecLabelEditIconPosY",value:function(e){return 0}},{key:"getDecLabelWidth",value:function(e,t,n){return void 0!==e.width?Number(e.width):n===u.DEC_LINK?this.canvasLayout.linkDecoratorLabelWidth:t.layout.decoratorLabelWidth}},{key:"getDecLabelHeight",value:function(e,t,n){return void 0!==e.height?Number(e.height):n===u.DEC_LINK?this.canvasLayout.linkDecoratorLabelHeight:t.layout.decoratorLabelHeight}},{key:"getDecLabelTextAreaWidth",value:function(e,t,n){return this.getDecLabelWidth(e,t,n)+2*u.TEXT_AREA_BORDER_ADJUSTMENT}},{key:"getDecLabelTextAreaHeight",value:function(e,t,n){return this.getDecLabelHeight(e,t,n)+2*u.TEXT_AREA_BORDER_ADJUSTMENT}},{key:"getDecLabelTextAreaPosX",value:function(){return-u.TEXT_AREA_BORDER_ADJUSTMENT}},{key:"getDecLabelTextAreaPosY",value:function(){return-(u.TEXT_AREA_BORDER_ADJUSTMENT-1)}}])}(),Mi=L.default;if("production"===process.env.NODE_ENV)Ei=Mi.createRoot;else{var zi=Mi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;Ei=function(e,t){zi.usingClientEntryPoint=!0;try{return Mi.createRoot(e,t)}finally{zi.usingClientEntryPoint=!1}}}var Ui=function(){return e._createClass((function t(n){e._classCallCheck(this,t),this.logger=new g.Logger("SVGCanvasExternal"),this.ren=n}),[{key:"isValidJsxElement",value:function(e){return C.default.isValidElement(e)}},{key:"addNodeExternalObject",value:function(e,t,n){var i=C.default.createElement(e.layout.nodeExternalObject,{nodeData:e,canvasController:this.ren.canvasController,externalUtils:this});this.renderExternalObject(i,n[t])}},{key:"addNodeImageExternalObject",value:function(e,t,n){this.renderExternalObject(e,n[t])}},{key:"addDecExternalObject",value:function(e,t,n){this.renderExternalObject(e.jsx,n[t])}},{key:"renderExternalObject",value:function(e,t){Ei?(t.ccExtRoot||(t.ccExtRoot=Ei(t)),t.ccExtRoot.render(e)):L.default.render(e,t)}},{key:"removeExternalObject",value:function(e,t,n){if(Ei){var i=n[t];i.ccExtRoot||(i.ccExtRoot=Ei(i)),setTimeout((function(){i.ccExtRoot.unmount(),i.ccExtRoot=null}))}else L.default.unmountComponentAtNode(n[t])}},{key:"getActiveNodes",value:function(){return this.ren.activePipeline.getNodes()}},{key:"getActiveNode",value:function(e){return this.ren.activePipeline.getNode(e)}},{key:"setPortPositions",value:function(e){var t=this.ren.activePipeline.getNode(e.nodeId),n=this.ren.zoomUtils.getZoomScale();e.inputPositions&&e.inputPositions.forEach((function(e){var i=t.inputs.find((function(t){return t.id===e.id}));i.cx=e.cx/n,i.cy=e.cy/n,i.dir=v.CanvasUtils.getPortDir(i.cx,i.cy,t)})),e.outputPositions&&e.outputPositions.forEach((function(e){var i=t.outputs.find((function(t){return t.id===e.id}));i.cx=e.cx/n,i.cy=e.cy/n,i.dir=v.CanvasUtils.getPortDir(i.cx,i.cy,t)})),this.ren.displayMovedLinks()}},{key:"setNodesProperties",value:function(e){var t=this;e&&(e.forEach((function(e){var n=t.ren.activePipeline.getNode(e.id);e.height&&(n.height=e.height),e.width&&(n.width=e.width),e.x_pos&&(n.x_pos=e.x_pos),e.y_pos&&(n.y_pos=e.y_pos)})),this.ren.displayNodes())}},{key:"raiseNodeToTopById",value:function(e){this.ren.raiseNodeToTopById(e)}}])}(),Ri=Yn({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Hi=l.toString_1,ji=Ri,Fi=/&(?:amp|lt|gt|quot|#39);/g,Bi=RegExp(Fi.source);var Gi=function(e){return(e=Hi(e))&&Bi.test(e)?e.replace(Fi,ji):e},Wi=function(){return e._createClass((function t(){e._classCallCheck(this,t)}),null,[{key:"processMarkdownAction",value:function(e,t,n,i){var o=n,a=i,r=null;switch(o===a?(o=this.findFirstSpace(t,o),a=this.findLastSpace(t,a)):this.allWhiteSpace(t,o,a)?o=a:(o=this.findFirstNonSpace(t,o,a),a=this.findLastNonSpace(t,o,a)),e){case"title":case"header":case"subheader":case"body":case"increaseHashes":case"decreaseHashes":r=this.processHeaderCommand(t,o,a,e);break;case"bold":r=this.processWrapCommand(t,o,a,"**");break;case"italics":r=this.processWrapCommand(t,o,a,"_");break;case"strikethrough":r=this.processWrapCommand(t,o,a,"~~");break;case"code":r=this.processCodeCommand(t,o,a);break;case"link":r=this.processLinkCommand(t,o,a);break;case"quote":case"numberedList":case"bulletedList":r=this.processMultiLineCommand(t,o,a,e);break;case"return":r=this.processReturnCommand(t,o,a,n,i)}return r}},{key:"findFirstSpace",value:function(e,t){var n=e.lastIndexOf(" ",t-1)+1,i=e.lastIndexOf("\n",t-1)+1;return Math.max(n,i,0)}},{key:"findLastSpace",value:function(e,t){var n=e.indexOf(" ",t),i=e.indexOf("\n",t);return n=-1===n?e.length:n,i=-1===i?e.length:i,Math.min(n,i,e.length)}},{key:"allWhiteSpace",value:function(e,t,n){return 0===e.slice(t,n).trim().length}},{key:"findFirstNonSpace",value:function(e,t,n){for(var i=t;(" "===e[i]||"\n"===e[i])&&i<=n;)i++;return i}},{key:"findLastNonSpace",value:function(e,t,n){for(var i=n;(" "===e[i-1]||"\n"===e[i-1])&&i>=t;)i--;return i}},{key:"processHeaderCommand",value:function(e,t,n,i){var o=this.findPrecedingNewLine(e,t),a=this.findSuceedingNewLine(e,n),r=e.slice(0,o),s=e.slice(o,a),l=e.slice(a),c=o,u=a,d="",h=s,g=this.getHashCount(s);if(g>0){var p=s.indexOf(" ");d=r+(h=s.slice(p+1))+l,u-=p+1}var f=this.getHeaderSyntax(i,g);return f&&(d=r+f+h+l,c+=f.length,u+=f.length),{newText:d,newStart:c,newEnd:u}}},{key:"getHeaderSyntax",value:function(e,t){switch(e){case"title":return"# ";case"header":return"## ";case"subheader":return"### ";case"body":return!1;case"increaseHashes":return 0===t?"# ":1===t?"## ":2===t&&"### ";case"decreaseHashes":return 0===t?"### ":1!==t&&(2===t?"# ":3===t?"## ":"### ")}return!1}},{key:"getHashCount",value:function(e){return e.startsWith("# ")?1:e.startsWith("## ")?2:e.startsWith("### ")?3:e.startsWith("#### ")?4:e.startsWith("##### ")?5:e.startsWith("###### ")?6:0}},{key:"processWrapCommand",value:function(e,t,n,i){var o="",a=t,r=n,s=e.slice(0,t),l=e.slice(t,n),c=e.slice(n),u=i.length;return s.endsWith(i)&&c.startsWith(i)?(o=s.slice(0,s.length-u)+l+c.slice(u),a=t-u,r=n-u):l.startsWith(i)&&l.endsWith(i)?(o=s+l.slice(0,l.length-u).slice(u)+c,a=t,r=n-2*u):(o=s+i+l+i+c,a=t+u,r=n+u),{newText:o,newStart:a,newEnd:r}}},{key:"processCodeCommand",value:function(e,t,n){return e.slice(t,n).indexOf("\n")>-1?this.processTripleBackTicks(e,t,n):this.processWrapCommand(e,t,n,"`")}},{key:"processTripleBackTicks",value:function(e,t,n){var i=this.findPrecedingNewLine(e,t),o=this.findSuceedingNewLine(e,n),a=e.slice(0,i),r=e.slice(i,o),s=e.slice(o),l=i,c=o,u="";return a.endsWith("```\n")&&s.startsWith("\n```")?(u=a.slice(0,i-4)+r+s.slice(4),l-=4,c-=4):(u=a+"```\n"+r+"\n```"+s,l+=4,c+=4),{newText:u,newStart:l,newEnd:c}}},{key:"processLinkCommand",value:function(e,t,n){var i="",o=t,a=n,r=e.slice(0,t),s=e.slice(t,n),l=e.slice(n);return r.endsWith("[")&&l.startsWith("](url)")?(i=r.slice(0,r.length-1)+s+l.slice(6),o=t-1,a=n-1):"[](url)"===s?(i=r+l,a=o=t):t===n?(i=r+"[](url)"+l,o=t+1,a=t+1):(i=r+"["+s+"](url)"+l,o=t+1,a=n+1),{newText:i,newStart:o,newEnd:a}}},{key:"processMultiLineCommand",value:function(e,t,n,i){return this.isMultiLineMarkdown(e,t,n,i)?this.removeMultiLineMarkdown(e,t,n,i):this.addMultiLineMarkdown(e,t,n,i)}},{key:"isMultiLineMarkdown",value:function(e,t,n,i){var o=this,a=this.findPrecedingNewLine(e,t),r=this.findSuceedingNewLine(e,n);return e.slice(a,r).split("\n").every((function(e){return o.isMultiLineItem(e,i)}))}},{key:"isMultiLineItem",value:function(e,t){switch(t){case"quote":return e.startsWith("> ");case"bulletedList":return e.startsWith("* ");case"numberedList":var n=this.getPrefixNumber(e);return!isNaN(n)&&n>0}return!1}},{key:"getPrefixNumber",value:function(e){var t=e.indexOf(". "),n=e.slice(0,t);return Number(n)}},{key:"removeMultiLineMarkdown",value:function(e,t,n,i){var o=this,a=this.findPrecedingNewLine(e,t),r=this.findSuceedingNewLine(e,n),s=e.slice(0,a),l=e.slice(a,r),c=e.slice(r),u=a,d=r,h=s,g=l.split("\n");return g.forEach((function(e,t){var n=o.removeListPrefix(e,i);d-=e.length-n.length,h+=n,t<g.length-1&&(h+="\n")})),{newText:h+=c,newStart:u,newEnd:d}}},{key:"removeListPrefix",value:function(e,t){switch(t){case"quote":case"bulletedList":return e.slice(2);case"numberedList":var n=e.indexOf(". ");return e.slice(n+2)}return""}},{key:"addMultiLineMarkdown",value:function(e,t,n,i){var o=this,a=this.findPrecedingNewLine(e,t),r=this.findSuceedingNewLine(e,n),s=e.slice(0,a),l=e.slice(a,r),c=e.slice(r),u=a,d=r,h=s;if(""===l){var g=this.getListPrefix(i,1);h=s+g+c,u=a+g.length,d=u}else{var p=l.split("\n");p.forEach((function(t,n){var a=o.getListPrefix(i,n+1,t);d+=a.length-t.length,h+=a,n===p.length-1&&"\n"===e[r]&&"\n"===e[r+1]||(h+="\n")})),h+=c}return{newText:h,newStart:u,newEnd:d}}},{key:"getListPrefix",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";switch(e){case"quote":return"> "+n;case"bulletedList":return"* "+n;case"numberedList":return t+". "+n}return null}},{key:"findPrecedingNewLine",value:function(e,t){for(var n=t;n>0&&"\n"!==e[n-1];)n--;return n}},{key:"findSuceedingNewLine",value:function(e,t){for(var n=t;n<e.length&&"\n"!==e[n];)n++;return n}},{key:"processReturnCommand",value:function(e,t,n,i,o){var a=this.findPrecedingNewLine(e,t),r=this.findSuceedingNewLine(e,n),s=e.slice(0,a),l=e.slice(a,r),c=e.slice(r);if(!this.isCursorAtBeginningOfLine(a,i,o)){if(this.isMultiLineItem(l,"quote"))return this.insertMultiLineItem(">",s,l,c,r);if(this.isMultiLineItem(l,"bulletedList"))return this.insertMultiLineItem("*",s,l,c,r);if(this.isMultiLineItem(l,"numberedList")){var u=this.getPrefixNumber(l)+1,d=this.renumberEndText(c,u);return this.insertMultiLineItem(u+".",s,l,d,r)}}return null}},{key:"isCursorAtBeginningOfLine",value:function(e,t,n){return t===n&&t===e}},{key:"insertMultiLineItem",value:function(e,t,n,i,o){var a=t+n+"\n"+e+" "+i,r=o+2+e.length;return{newText:a,newStart:r,newEnd:r}}},{key:"renumberEndText",value:function(e,t){var n=this,i=e.split("\n"),o="",a=!1;return i.forEach((function(e,i){n.isMultiLineItem(e,"numberedList")&&!1===a?o+=n.renumberLine(e,t+i):(o+=e,i>0&&(a=!0))})),o}},{key:"renumberLine",value:function(e,t){var n=e.indexOf(". ");return t+". "+e.slice(n+2)}}])}(),Yi=Object.assign({},Fn),Ki="#FFFFFF",Xi="#000000",Vi=function(){return e._createClass((function t(n,i,o,a,r,s,l,c,u,d,h){e._classCallCheck(this,t),this.config=n,this.dispUtils=i,this.nodeUtils=o,this.decUtils=a,this.canvasController=r,this.canvasDiv=s,this.activePipeline=l,this.removeTempCursorOverlay=c,this.displayCommentsCallback=u,this.displayLinksCallback=d,this.getCommentToolbarPosCallback=h,this.logger=new g.Logger("SvgCanvasTextArea"),this.editingText=!1,this.editingTextId="",this.addingTextToTextArea=!1,this.textAreaHeight=null}),[{key:"isEditingText",value:function(){return this.editingText}},{key:"getEditingTextId",value:function(){return this.editingTextId}},{key:"displayCommentTextArea",value:function(e,t){if(this.editingTextData={id:e.id,text:e.content,singleLine:!1,maxCharacters:null,allowReturnKey:!0,textCanBeEmpty:!0,xPos:0,yPos:0,width:e.width,height:e.height,contentType:e.contentType,formats:e.formats,newFormats:m.cloneDeep_1(e.formats),className:"d3-comment-entry",parentDomObj:t,keyboardInputCallback:e.contentType!==u.WYSIWYG&&this.config.enableMarkdownInComments?this.commentKeyboardHandler.bind(this):null,autoSizeCallback:this.autoSizeComment.bind(this),saveTextChangesCallback:this.saveCommentChanges.bind(this),closeTextAreaCallback:this.closeCommentTextArea.bind(this)},e.contentType===u.WYSIWYG?this.displayEditableDiv(this.editingTextData):this.displayTextArea(this.editingTextData),this.dispUtils.isDisplayingFullPage()){var n=this.getCommentToolbarPosCallback(e);e.contentType===u.WYSIWYG?this.canvasController.openTextToolbar(n.x,n.y,u.WYSIWYG,this.wysiwygActionHandler.bind(this),this.blurInTextToolbar.bind(this)):this.config.enableMarkdownInComments&&this.canvasController.openTextToolbar(n.x,n.y,u.MARKDOWN,this.markdownActionHandler.bind(this),this.blurInTextToolbar.bind(this))}}},{key:"commentKeyboardHandler",value:function(e){var t=this.getMarkdownAction(e);t&&("return"!==t&&v.CanvasUtils.stopPropagationAndPreventDefault(e),this.markdownActionHandler(t,e))}},{key:"blurInTextToolbar",value:function(e){this.addingTextToTextArea||e.relatedTarget&&(v.CanvasUtils.getParentElementWithClass(e.relatedTarget,"d3-comment-entry")||v.CanvasUtils.getParentElementWithClass(e.relatedTarget,"d3-comment-text-entry-wysiwyg")||v.CanvasUtils.getParentElementWithClass(e.relatedTarget,"text-toolbar")||v.CanvasUtils.getParentElementWithClass(e.relatedTarget,"cds--overflow-menu-options__btn"))||this.completeEditing(e)}},{key:"getMarkdownAction",value:function(e){if(v.CanvasUtils.isCmndCtrlPressed(e))switch(e.keyCode){case 66:return"bold";case 73:return"italics";case 88:return e.shiftKey?"strikethrough":null;case 55:return e.shiftKey?"numberedList":null;case 56:return e.shiftKey?"bulletedList":null;case 69:return"code";case 75:return"link";case 188:return"decreaseHashes";case 190:return e.shiftKey?"quote":"increaseHashes"}else if(13===e.keyCode)return"return";return null}},{key:"markdownActionHandler",value:function(e,t){this.logger.log("markdownActionHandler - action = "+e);var n=this.canvasDiv.selectAll(".d3-comment-entry").node(),i=n.selectionStart,o=n.selectionEnd,a=n.value,r=Wi.processMarkdownAction(e,a,i,o);r&&(t.preventDefault(),this.addTextToTextArea(r,n))}},{key:"wysiwygActionHandler",value:function(e,t,n){this.logger.log("wysiwygActionHandler - action = "+e+" extra = "+n),this.editingTextData.newFormats||(this.editingTextData.newFormats=[]),"align-left"===e||"align-center"===e||"align-right"===e?this.addReplaceFormat("alignHorizontally",e):"align-top"===e||"align-middle"===e||"align-bottom"===e?this.addReplaceFormat("alignVertically",e):"underline"===e||"strikethrough"===e?this.addAdditionalFormat("textDecoration",e):"text-color"===e?this.addReplaceFormat("textColor",n):"background-color"===e?(this.addReplaceFormat("backgroundColor",n),this.setTextColorAppropriately(n)):e.startsWith("text-size")?this.addReplaceFormat("textSize",e):e.startsWith("font")?this.addReplaceFormat("fontType",e):e.startsWith("outline")?this.addReplaceFormat("outlineStyle",e):"bold"!==e&&"italics"!==e||this.toggleFormat(e)}},{key:"setTextColorAppropriately",value:function(e){var t=this.hasFormat("textColor");if(!t||t.value===Ki||t.value===Xi){var n=v.CanvasUtils.isDarkColor(e);this.addReplaceFormat("textColor",n?Ki:Xi)}}},{key:"toggleFormat",value:function(e){this.hasFormat(e)?this.removeFormat(e):this.addFormat(e)}},{key:"hasFormat",value:function(e){var t;return null===(t=this.editingTextData.newFormats)||void 0===t?void 0:t.find((function(t){return t.type===e}))}},{key:"addReplaceFormat",value:function(e,t){var n=this.hasFormat(e);n?n.value=t:(n={type:e,value:t},this.editingTextData.newFormats.push(n));var i=v.CanvasUtils.convertFormat(n),o=i.field,a=i.value;o&&a&&this.setWysiwygStyle(o,a)}},{key:"addAdditionalFormat",value:function(e,t){var n=this.hasFormat(e);if(n)if(n.value.includes(t)){if(n.value=n.value.replace(t,"").trim(),!n.value)return void this.removeFormat(e)}else n.value+=" "+t;else n={type:e,value:t},this.editingTextData.newFormats.push(n);var i=v.CanvasUtils.convertFormat(n),o=i.field,a=i.value;o&&a&&this.setWysiwygStyle(o,a)}},{key:"addFormat",value:function(e){var t={type:e};this.editingTextData.newFormats.push(t);var n=v.CanvasUtils.convertFormat(t),i=n.field,o=n.value;i&&o&&this.setWysiwygStyle(i,o)}},{key:"removeFormat",value:function(e){var t;this.editingTextData.newFormats=null===(t=this.editingTextData.newFormats)||void 0===t?void 0:t.filter((function(t){return t.type!==e}));var n=v.CanvasUtils.convertFormat({type:e}).field;n&&this.setWysiwygStyle(n,null)}},{key:"setWysiwygStyle",value:function(e,t){"background-color"===e&&"transparent"===t&&Yi.select(this.editingTextData.parentDomObj).selectAll(".d3-comment-text-wysiwyg").style("background-color","transparent");var n=this.foreignObjectWysiwyg.selectAll(".d3-comment-text-entry-wysiwyg");n.style(e,t),n.node().focus()}},{key:"addTextToTextArea",value:function(e,t){this.addingTextToTextArea=!0;var n=Gi(e.newText);t.focus(),t.select(),document.execCommand("insertText",!1,n),t.setSelectionRange(e.newStart,e.newEnd),this.addingTextToTextArea=!1}},{key:"autoSizeComment",value:function(e,t){this.logger.log("autoSizeComment - textAreaHt = "+this.textAreaHeight+" scroll ht = "+e.scrollHeight);var n=t.contentType===u.WYSIWYG?0:12,i=e.scrollHeight+n;this.textAreaHeight<i&&(this.textAreaHeight=i,this.foreignObject?this.foreignObject.style("height",this.textAreaHeight+"px"):this.foreignObjectWysiwyg&&this.foreignObjectWysiwyg.style("height",this.textAreaHeight+"px"),this.activePipeline.getComment(t.id).height=this.textAreaHeight,this.displayCommentsCallback(),this.displayLinksCallback())}},{key:"saveCommentChanges",value:function(e,t,n){var i=this.activePipeline.getComment(e.id),o={editType:"editComment",editSource:"canvas",id:i.id,content:t,width:i.width,height:n,x_pos:i.x_pos,y_pos:i.y_pos,contentType:e.contentType,formats:e.newFormats,pipelineId:this.activePipeline.id};this.canvasController.editActionHandler(o)}},{key:"closeCommentTextArea",value:function(){this.canvasController.closeTextToolbar()}},{key:"displayNodeLabelTextArea",value:function(e,t){this.displayDiv=Yi.select(t).selectAll(".d3-foreign-object-node-label div"),this.displayDivStyle=this.displayDiv.attr("style"),this.displayDiv.attr("style","display:none;"),this.editingTextData={id:e.id,text:e.label,singleLine:e.layout.labelSingleLine,maxCharacters:e.layout.labelMaxCharacters,allowReturnKey:e.layout.labelAllowReturnKey,textCanBeEmpty:!1,xPos:this.nodeUtils.getNodeLabelTextAreaPosX(e),yPos:this.nodeUtils.getNodeLabelTextAreaPosY(e),width:this.nodeUtils.getNodeLabelTextAreaWidth(e),height:this.nodeUtils.getNodeLabelTextAreaHeight(e),className:this.nodeUtils.getNodeLabelTextAreaClass(e),parentDomObj:t,autoSizeCallback:this.autoSizeMultiLineLabel.bind(this),saveTextChangesCallback:this.saveNodeLabelChanges.bind(this),closeTextAreaCallback:this.closeEntryTextArea.bind(this)},this.displayTextArea(this.editingTextData)}},{key:"autoSizeMultiLineLabel",value:function(e,t){if(this.logger.log("autoSizeNodeLabel - textAreaHt = "+this.textAreaHeight+" scroll ht = "+e.scrollHeight),t.maxCharacters&&e.value.length>t.maxCharacters&&(e.value=e.value.substring(0,t.maxCharacters)),this.foreignObject){this.foreignObject.style("height",0);var n=e.scrollHeight+12;this.textAreaHeight=n,this.foreignObject.style("height",this.textAreaHeight+"px")}}},{key:"saveNodeLabelChanges",value:function(e,t){var n={editType:"setNodeLabel",editSource:"canvas",nodeId:e.id,label:t,pipelineId:this.activePipeline.id};this.canvasController.editActionHandler(n)}},{key:"closeEntryTextArea",value:function(){this.displayDiv.attr("style",this.displayDivStyle)}},{key:"displayDecLabelTextArea",value:function(e,t,n,i){this.displayDiv=Yi.select(i).selectAll(".d3-foreign-object-dec-label div"),this.displayDivStyle=this.displayDiv.attr("style"),this.displayDiv.attr("style","display:none;"),this.editingTextData={id:e.id,text:e.label,singleLine:e.label_single_line||!1,maxCharacters:e.label_max_characters||null,allowReturnKey:e.label_allow_return_key||!1,textCanBeEmpty:!1,xPos:this.decUtils.getDecLabelTextAreaPosX(),yPos:this.decUtils.getDecLabelTextAreaPosY(),width:this.decUtils.getDecLabelTextAreaWidth(e,t,n),height:this.decUtils.getDecLabelTextAreaHeight(e,t,n),className:this.decUtils.getDecLabelTextAreaClass(e),parentDomObj:i,objId:t.id,objType:n,autoSizeCallback:this.autoSizeMultiLineLabel.bind(this),saveTextChangesCallback:this.saveDecLabelChanges.bind(this),closeTextAreaCallback:this.closeEntryTextArea.bind(this)},this.displayTextArea(this.editingTextData)}},{key:"saveDecLabelChanges",value:function(e,t){var n={editType:"editDecorationLabel",editSource:"canvas",decId:e.id,objId:e.objId,objType:e.objType,label:t,pipelineId:this.activePipeline.id};this.canvasController.editActionHandler(n)}},{key:"displayTextArea",value:function(e){this.textAreaHeight=e.height,this.editingText=!0,this.editingTextId=e.id,this.foreignObject=Yi.select(e.parentDomObj).append("foreignObject").attr("class","d3-foreign-object-text-entry").attr("width",e.width).attr("height",e.height).attr("x",e.xPos).attr("y",e.yPos);var t=this.foreignObject.append("xhtml:textarea").attr("class",e.className).text(Gi(e.text)).call(this.attachTextEntryListeners.bind(this));t.node().focus(),t.node().setSelectionRange(e.text.length,e.text.length)}},{key:"completeEditing",value:function(e){if(this.removeTempCursorOverlay(),this.foreignObject){var t=this.foreignObject.selectAll("textarea").node();this.textContentSaved=!0,this.saveAndCloseTextArea(this.editingTextData,t,e)}else if(this.foreignObjectWysiwyg){var n=this.foreignObjectWysiwyg.selectAll(".d3-comment-text-entry-wysiwyg").node();this.textContentSaved=!0,this.saveAndCloseTextArea(this.editingTextData,n,e)}}},{key:"saveAndCloseTextArea",value:function(e,t,n){var i=this.foreignObjectWysiwyg?t.innerText:t.value;if(!i&&!e.textCanBeEmpty)return this.closeTextArea(e),void v.CanvasUtils.stopPropagationAndPreventDefault(n);var o=i;this.closeTextArea(e),e.text===o&&this.textAreaHeight===e.height&&this.areFormatsTheSame(e.formats,e.newFormats)?Yi.select(e.parentDomObj).selectAll(".d3-comment-text-wysiwyg").style("display","table-cell"):e.saveTextChangesCallback(e,o,this.textAreaHeight)}},{key:"areFormatsTheSame",value:function(e,t){var n=this;return!e&&!t||!(e&&!t||!e&&t)&&(e.length===t.length&&e.filter((function(e){return n.formatArrayIncludes(e,t)})).length===e.length)}},{key:"formatArrayIncludes",value:function(e,t){return t.find((function(t){return v.isMatch_1(e,t)&&v.isMatch_1(e,e)}))}},{key:"closeTextArea",value:function(e){e.closeTextAreaCallback&&e.closeTextAreaCallback(e.id),this.foreignObject?(this.foreignObject.remove(),this.foreignObject=null):this.foreignObjectWysiwyg&&(Yi.select(this.editingTextData.parentDomObj).selectAll(".d3-comment-text-wysiwyg").style("display",null),this.foreignObjectWysiwyg.remove(),this.foreignObjectWysiwyg=null),this.editingText=!1,this.editingTextId=""}},{key:"textAreaAllowedKeys",value:function(e){return 46===e.keyCode||8===e.keyCode||37===e.keyCode||39===e.keyCode||38===e.keyCode||40===e.keyCode||65===e.keyCode&&v.CanvasUtils.isCmndCtrlPressed(e)}},{key:"displayEditableDiv",value:function(e){var t;this.textAreaHeight=e.height,this.editingText=!0,this.editingTextId=e.id,Yi.select(e.parentDomObj).selectAll(".d3-comment-text-wysiwyg").style("display","none"),this.foreignObjectWysiwyg=Yi.select(e.parentDomObj).append("foreignObject").attr("class","d3-foreign-object-text-entry-wysiwyg").attr("width",e.width).attr("height",e.height).attr("x",e.xPos).attr("y",e.yPos),this.textAreaWysiwyg=this.foreignObjectWysiwyg.append("xhtml:div").attr("class","d3-comment-text-entry-wysiwyg-outer").append("xhtml:div").attr("class","d3-comment-text-entry-wysiwyg").attr("contentEditable",!0).each((function(e,t,n){var i;(null===(i=e.formats)||void 0===i?void 0:i.length)>0&&e.formats.forEach((function(e){var i=v.CanvasUtils.convertFormat(e),o=i.field,a=i.value;Yi.select(n[t]).style(o,a)}))})).text(Gi(e.text)).call(this.attachTextEntryListeners.bind(this)),this.canvasDiv.selectAll(".d3-comment-text-entry-wysiwyg").node().focus(),this.setCursor(this.textAreaWysiwyg.node(),(null===(t=e.text)||void 0===t?void 0:t.length)||0)}},{key:"setCursor",value:function(e,t){var n,i=document.createRange(),o=window.getSelection();(null===(n=e.childNodes)||void 0===n?void 0:n.length)>0&&(i.setStart(e.childNodes[0],t),i.collapse(!0),o.removeAllRanges(),o.addRange(i))}},{key:"attachTextEntryListeners",value:function(e){var t=this,n=this.editingTextData;e.on("keydown",(function(e){if(13===e.keyCode){if("save"===n.allowReturnKey)return t.textContentSaved=!0,void t.saveAndCloseTextArea(n,e.target,e);!n.singleLine&&n.allowReturnKey||v.CanvasUtils.stopPropagationAndPreventDefault(e)}27===e.keyCode&&(v.CanvasUtils.stopPropagationAndPreventDefault(e),t.textAreaEscKeyPressed=!0,t.closeTextArea(n)),n.maxCharacters&&e.target.value.length>=n.maxCharacters&&!t.textAreaAllowedKeys(e)&&v.CanvasUtils.stopPropagationAndPreventDefault(e),n.keyboardInputCallback&&n.keyboardInputCallback(e)})).on("keyup",(function(e){n.autoSizeCallback(e.target,n)})).on("paste",(function(e){t.logger.log("Text area - Paste - Scroll Ht = "+e.target.scrollHeight),setTimeout(n.autoSizeCallback,500,e.target,n)})).on("blur",(function(e,i){t.logger.log("Text area - blur"),t.textAreaEscKeyPressed?t.textAreaEscKeyPressed=!1:t.textContentSaved?t.textContentSaved=!1:e.relatedTarget&&v.CanvasUtils.getParentElementWithClass(e.relatedTarget,"text-toolbar")||t.saveAndCloseTextArea(n,e.target,e)})).on("focus",(function(e,i){t.logger.log("Text area - focus"),n.autoSizeCallback(e.target,n)})).on("mousedown click dblclick contextmenu",(function(e,t){e.stopPropagation()}))}}])}(),Zi={value:()=>{}};function qi(){for(var e,t=0,n=arguments.length,i={};t<n;++t){if(!(e=arguments[t]+"")||e in i||/[\s.]/.test(e))throw new Error("illegal type: "+e);i[e]=[]}return new Ji(i)}function Ji(e){this._=e}function $i(e,t){for(var n,i=0,o=e.length;i<o;++i)if((n=e[i]).name===t)return n.value}function Qi(e,t,n){for(var i=0,o=e.length;i<o;++i)if(e[i].name===t){e[i]=Zi,e=e.slice(0,i).concat(e.slice(i+1));break}return null!=n&&e.push({name:t,value:n}),e}Ji.prototype=qi.prototype={constructor:Ji,on:function(e,t){var n,i,o=this._,a=(i=o,(e+"").trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}}))),r=-1,s=a.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++r<s;)if(n=(e=a[r]).type)o[n]=Qi(o[n],e.name,t);else if(null==t)for(n in o)o[n]=Qi(o[n],e.name,null);return this}for(;++r<s;)if((n=(e=a[r]).type)&&(n=$i(o[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Ji(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,i,o=new Array(n),a=0;a<n;++a)o[a]=arguments[a+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=0,n=(i=this._[e]).length;a<n;++a)i[a].value.apply(t,o)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],o=0,a=i.length;o<a;++o)i[o].value.apply(t,n)}};const eo={passive:!1},to={capture:!0,passive:!1};function no(e){e.stopImmediatePropagation()}function io(e){e.preventDefault(),e.stopImmediatePropagation()}function oo(e){var t=e.document.documentElement,n=Mn(e).on("dragstart.drag",io,to);"onselectstart"in t?n.on("selectstart.drag",io,to):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ao(e,t){var n=e.document.documentElement,i=Mn(e).on("dragstart.drag",null);t&&(i.on("click.drag",io,to),setTimeout((function(){i.on("click.drag",null)}),0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var ro=e=>()=>e;function so(e,{sourceEvent:t,subject:n,target:i,identifier:o,active:a,x:r,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:r,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function lo(e){return!e.ctrlKey&&!e.button}function co(){return this.parentNode}function uo(e,t){return null==t?{x:e.x,y:e.y}:t}function ho(){return navigator.maxTouchPoints||"ontouchstart"in this}so.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var go=Object.freeze({__proto__:null,drag:function(){var e,t,n,i,o=lo,a=co,r=uo,s=ho,l={},c=qi("start","drag","end"),u=0,d=0;function h(e){e.on("mousedown.drag",g).filter(s).on("touchstart.drag",v).on("touchmove.drag",y,eo).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(r,s){if(!i&&o.call(this,r,s)){var l=b(this,a.call(this,r,s),r,s,"mouse");l&&(Mn(r.view).on("mousemove.drag",p,to).on("mouseup.drag",f,to),oo(r.view),no(r),n=!1,e=r.clientX,t=r.clientY,l("start",r))}}function p(i){if(io(i),!n){var o=i.clientX-e,a=i.clientY-t;n=o*o+a*a>d}l.mouse("drag",i)}function f(e){Mn(e.view).on("mousemove.drag mouseup.drag",null),ao(e.view,n),io(e),l.mouse("end",e)}function v(e,t){if(o.call(this,e,t)){var n,i,r=e.changedTouches,s=a.call(this,e,t),l=r.length;for(n=0;n<l;++n)(i=b(this,s,e,t,r[n].identifier,r[n]))&&(no(e),i("start",e,r[n]))}}function y(e){var t,n,i=e.changedTouches,o=i.length;for(t=0;t<o;++t)(n=l[i[t].identifier])&&(io(e),n("drag",e,i[t]))}function m(e){var t,n,o=e.changedTouches,a=o.length;for(i&&clearTimeout(i),i=setTimeout((function(){i=null}),500),t=0;t<a;++t)(n=l[o[t].identifier])&&(no(e),n("end",e,o[t]))}function b(e,t,n,i,o,a){var s,d,g,p=c.copy(),f=jn(a||n,t);if(null!=(g=r.call(e,new so("beforestart",{sourceEvent:n,target:h,identifier:o,active:u,x:f[0],y:f[1],dx:0,dy:0,dispatch:p}),i)))return s=g.x-f[0]||0,d=g.y-f[1]||0,function n(a,r,c){var v,y=f;switch(a){case"start":l[o]=n,v=u++;break;case"end":delete l[o],--u;case"drag":f=jn(c||r,t),v=u}p.call(a,e,new so(a,{sourceEvent:r,subject:g,target:h,identifier:o,active:v,x:f[0]+s,y:f[1]+d,dx:f[0]-y[0],dy:f[1]-y[1],dispatch:p}),i)}}return h.filter=function(e){return arguments.length?(o="function"==typeof e?e:ro(!!e),h):o},h.container=function(e){return arguments.length?(a="function"==typeof e?e:ro(e),h):a},h.subject=function(e){return arguments.length?(r="function"==typeof e?e:ro(e),h):r},h.touchable=function(e){return arguments.length?(s="function"==typeof e?e:ro(!!e),h):s},h.on=function(){var e=c.on.apply(c,arguments);return e===c?h:e},h.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,h):Math.sqrt(d)},h},dragDisable:oo,dragEnable:ao}),po=Object.assign({},go,Fn),fo=function(){return e._createClass((function t(n){e._classCallCheck(this,t),this.ren=n,this.logger=new g.Logger("SVGCanvasUtilsDragObjects"),this.resizeObjInitialInfo=null,this.commentSizing=!1,this.commentSizingDirection=null,this.commentSizingCursor="",this.nodeSizing=!1,this.nodeSizingDirection=null,this.nodeSizingCursor="",this.nodeSizingObjectsInfo={},this.nodeSizingDetLinksInfo={},this.notSnappedXPos=0,this.notSnappedYPos=0,this.notSnappedWidth=0,this.notSnappedHeight=0,this.draggingObjectData=null,this.existingNodeInsertableIntoLink=!1,this.existingNodeAttachableToDetachedLinks=!1,this.dragObjectHandler=po.drag().on("start",this.dragStartObject.bind(this)).on("drag",this.dragObject.bind(this)).on("end",this.dragEndObject.bind(this))}),[{key:"getDragObjectHandler",value:function(){return this.dragObjectHandler}},{key:"isSizing",value:function(){return this.nodeSizing||this.commentSizing}},{key:"isMoving",value:function(){return this.draggingObjectData}},{key:"mouseEnterNodeSizingArea",value:function(e,t){if(this.ren.config.enableEditingActions&&this.isNodeResizable(t)&&!this.ren.isRegionSelectOrSizingInProgress()){var n="default";this.isPointerCloseToBodyEdge(e,t)||(this.nodeSizingDirection=this.getSizingDirection(e,t,t.layout.nodeCornerResizeArea),this.nodeSizingCursor=this.getCursorBasedOnDirection(this.nodeSizingDirection),n=this.nodeSizingCursor),po.select(e.currentTarget).style("cursor",n)}}},{key:"mouseDownNodeSizingArea",value:function(e){this.isNodeResizable(e)&&(this.nodeSizing=!0,this.ren.addTempCursorOverlay(this.nodeSizingCursor))}},{key:"mouseLeaveNodeSizingArea",value:function(e){po.select(e.currentTarget).style("cursor","default")}},{key:"mouseEnterCommentSizingArea",value:function(e,t){if(this.ren.config.enableEditingActions&&!this.ren.isRegionSelectOrSizingInProgress()){var n="default";this.isPointerCloseToBodyEdge(e,t)||(this.commentSizingDirection=this.getSizingDirection(e,t,this.ren.canvasLayout.commentCornerResizeArea),this.commentSizingCursor=this.getCursorBasedOnDirection(this.commentSizingDirection),n=this.commentSizingCursor),po.select(e.currentTarget).style("cursor",n)}}},{key:"mouseDownCommentSizingArea",value:function(){this.commentSizing=!0,this.ren.addTempCursorOverlay(this.commentSizingCursor)}},{key:"mouseLeaveCommentSizingArea",value:function(e){po.select(e.currentTarget).style("cursor","default")}},{key:"dragStartObject",value:function(e,t){this.logger.logStartTimer("dragStartObject"),this.ren.closeContextMenuIfOpen(),this.commentSizing||this.nodeSizing?this.initializeResizeVariables(t):this.dragObjectsStart(e,t),this.logger.logEndTimer("dragStartObject",!0)}},{key:"dragObject",value:function(e,t){this.logger.logStartTimer("dragObject"),this.commentSizing?this.resizeComment(e,t):this.nodeSizing?this.resizeNode(e,t):this.dragObjectsAction(e),this.logger.logEndTimer("dragObject",!0)}},{key:"dragEndObject",value:function(e,t){this.logger.logStartTimer("dragEndObject"),this.ren.removeTempCursorOverlay(),this.commentSizing?(this.endCommentSizing(t),this.commentSizing=!1):this.nodeSizing?(this.endNodeSizing(t),this.nodeSizing=!1):this.dragObjectsEnd(e,t),this.logger.logEndTimer("dragEndObject",!0)}},{key:"initializeResizeVariables",value:function(e){this.resizeObjInitialInfo={x_pos:e.x_pos,y_pos:e.y_pos,width:e.width,height:e.height},this.notSnappedXPos=e.x_pos,this.notSnappedYPos=e.y_pos,this.notSnappedWidth=e.width,this.notSnappedHeight=e.height}},{key:"isPointerCloseToBodyEdge",value:function(e,t){var n=this.ren.getTransformedMousePos(e),i=t.x_pos+t.width,o=t.y_pos+t.height,a=n.x>=i&&n.x<=i+1&&n.y>=0&&n.y<=o,r=n.y>=o&&n.y<=o+1&&n.x>=0&&n.x<=i;return a||r}},{key:"getSizingDirection",value:function(e,t,n){var i="",o="",a=this.ren.getTransformedMousePos(e);return a.x<t.x_pos+n?i="w":a.x>t.x_pos+t.width-n&&(i="e"),a.y<t.y_pos+n?o="n":a.y>t.y_pos+t.height-n&&(o="s"),o+i}},{key:"getCursorBasedOnDirection",value:function(e){var t;switch(e){case"n":case"s":t="ns-resize";break;case"e":case"w":t="ew-resize";break;case"nw":case"se":t="nwse-resize";break;case"ne":case"sw":t="nesw-resize";break;default:t=""}return t}},{key:"isNodeResizable",value:function(e){return!(!this.ren.config.enableEditingActions||v.CanvasUtils.isSuperBindingNode(e)||v.CanvasUtils.isCollapsedSupernode(e)||!this.ren.config.enableResizableNodes&&!v.CanvasUtils.isExpandedSupernode(e))}},{key:"resizeNode",value:function(e,t){var n=Object.assign({},t),i=this.getMinHeight(t),o=this.getMinWidth(t),a=this.resizeObject(e,t,this.nodeSizingDirection,o,i);if(a&&(0!==a.x_pos||0!==a.y_pos||0!==a.width||0!==a.height)){if(v.CanvasUtils.isSupernode(t)&&this.ren.config.enableMoveNodesOnSupernodeResize){var r=v.CanvasUtils.moveSurroundingObjects(n,this.ren.activePipeline.getNodesAndComments(),this.nodeSizingDirection,t.width,t.height,!0),s=v.CanvasUtils.moveSurroundingDetachedLinks(n,this.ren.activePipeline.links,this.nodeSizingDirection,t.width,t.height,!0);this.nodeSizingObjectsInfo=Object.assign(this.nodeSizingObjectsInfo,r),this.nodeSizingDetLinksInfo=Object.assign(this.nodeSizingDetLinksInfo,s)}this.logger.logStartTimer("displayObjects"),this.ren.displayMovedComments(),this.ren.displayMovedNodes(),this.ren.displaySingleNode(t),this.ren.displayMovedLinks(),this.ren.displayCanvasAccoutrements(),v.CanvasUtils.isSupernode(t)&&(this.ren.dispUtils.isDisplayingSubFlow()&&this.ren.displayBindingNodesToFitSVG(),this.ren.superRenderers.forEach((function(e){return e.displaySVGToFitSupernode()}))),this.logger.logEndTimer("displayObjects")}}},{key:"resizeComment",value:function(e,t){this.resizeObject(e,t,this.commentSizingDirection,20,20),this.ren.displaySingleComment(t),this.ren.displayMovedLinks(),this.ren.displayCanvasAccoutrements()}},{key:"resizeObject",value:function(e,t,n,i,o){var a=0,r=0,s=0,l=0;n.indexOf("e")>-1&&(s+=e.dx),n.indexOf("s")>-1&&(l+=e.dy),n.indexOf("n")>-1&&(r+=e.dy,l-=e.dy),n.indexOf("w")>-1&&(a+=e.dx,s-=e.dx);var c=0,d=0,h=0,g=0;if(this.ren.config.enableSnapToGridType===u.SNAP_TO_GRID_DURING?(this.notSnappedXPos+=a,this.notSnappedYPos+=r,this.notSnappedWidth+=s,this.notSnappedHeight+=l,c=v.CanvasUtils.snapToGrid(this.notSnappedXPos,this.ren.canvasLayout.snapToGridXPx),d=v.CanvasUtils.snapToGrid(this.notSnappedYPos,this.ren.canvasLayout.snapToGridYPx),h=v.CanvasUtils.snapToGrid(this.notSnappedWidth,this.ren.canvasLayout.snapToGridXPx),g=v.CanvasUtils.snapToGrid(this.notSnappedHeight,this.ren.canvasLayout.snapToGridYPx),h=Math.max(h,i),g=Math.max(g,o)):(c=t.x_pos+a,d=t.y_pos+r,h=t.width+s,g=t.height+l),h<i||g<o)return null;var p={width:h-t.width,height:g-t.height,x_pos:c-t.x_pos,y_pos:d-t.y_pos};return t.x_pos=c,t.y_pos=d,t.width=h,t.height=g,p}},{key:"endNodeSizing",value:function(e){var t=e;this.ren.config.enableSnapToGridType===u.SNAP_TO_GRID_AFTER&&(t=this.snapToGridObject(t),t=this.restrictNodeSizingToMinimums(t)),this.resizeObjInitialInfo.x_pos===t.x_pos&&this.resizeObjInitialInfo.y_pos===t.y_pos&&this.resizeObjInitialInfo.width===t.width&&this.resizeObjInitialInfo.height===t.height||(this.nodeSizingObjectsInfo[t.id]={width:t.width,height:t.height,x_pos:t.x_pos,y_pos:t.y_pos},(t.height>t.layout.defaultNodeHeight+2||t.width>t.layout.defaultNodeWidth+2)&&(this.nodeSizingObjectsInfo[t.id].isResized=!0,this.nodeSizingObjectsInfo[t.id].resizeWidth=t.width,this.nodeSizingObjectsInfo[t.id].resizeHeight=t.height),this.ren.canvasController.editActionHandler({editType:"resizeObjects",editSource:"canvas",objectsInfo:this.nodeSizingObjectsInfo,detachedLinksInfo:this.nodeSizingDetLinksInfo,pipelineId:this.ren.activePipeline.id}),this.nodeSizingObjectsInfo={})}},{key:"endCommentSizing",value:function(e){var t=e;if(this.ren.config.enableSnapToGridType===u.SNAP_TO_GRID_AFTER&&(t=this.snapToGridObject(t)),this.resizeObjInitialInfo.x_pos!==t.x_pos||this.resizeObjInitialInfo.y_pos!==t.y_pos||this.resizeObjInitialInfo.width!==t.width||this.resizeObjInitialInfo.height!==t.height){var n=[];n[t.id]={width:t.width,height:t.height,x_pos:t.x_pos,y_pos:t.y_pos};var i={editType:"resizeObjects",editSource:"canvas",objectsInfo:n,detachedLinksInfo:{},pipelineId:this.ren.activePipeline.id};this.ren.canvasController.editActionHandler(i)}}},{key:"restrictNodeSizingToMinimums",value:function(e){var t=this.getMinHeight(e),n=this.getMinWidth(e);return e.width=Math.max(e.width,n),e.height=Math.max(e.height,t),e}},{key:"getMinHeight",value:function(e){if(v.CanvasUtils.isSupernode(e)){var t=Math.max(e.inputPortsHeight,e.outputPortsHeight)+this.ren.canvasLayout.supernodeTopAreaHeight+this.ren.canvasLayout.supernodeSVGAreaPadding;return Math.max(this.ren.canvasLayout.supernodeMinHeight,t)}return e.layout.defaultNodeHeight}},{key:"getMinWidth",value:function(e){return v.CanvasUtils.isSupernode(e)?this.ren.canvasLayout.supernodeMinWidth:e.layout.defaultNodeWidth}},{key:"dragObjectsStart",value:function(e,t){var n,i=this;this.existingNodeInsertableIntoLink=!1,this.existingNodeAttachableToDetachedLinks=!1,this.draggingObjectData={dragOffsetX:0,dragOffsetY:0,dragRunningX:0,dragRunningY:0,dragObjects:this.getDragObjects(t)},(null===(n=this.draggingObjectData.dragObjects)||void 0===n?void 0:n.length)>0&&(this.draggingObjectData.dragStartX=this.draggingObjectData.dragObjects[0].x_pos,this.draggingObjectData.dragStartY=this.draggingObjectData.dragObjects[0].y_pos,this.switchIsMovingClass(this.draggingObjectData.dragObjects,!0)),this.isExistingNodeInsertableIntoLink()&&(this.startNodeInsertingInLink=setTimeout((function(){i.existingNodeInsertableIntoLink=!0,i.setNodeTranslucentState(i.draggingObjectData.dragObjects[0].id,!0),i.ren.setDataLinkSelectionAreaWider(!0)}),200)),this.isExistingNodeAttachableToDetachedLinks()&&(this.startNodeAttachingToDetachedLinks=setTimeout((function(){i.existingNodeAttachableToDetachedLinks=!0,i.setNodeTranslucentState(i.draggingObjectData.dragObjects[0].id,!0)}),200))}},{key:"dragObjectsAction",value:function(e){if(this.draggingObjectData.dragOffsetX+=e.dx,this.draggingObjectData.dragOffsetY+=e.dy,this.ren.dispUtils.isDisplayingSubFlowInPlace()&&(this.draggingObjectData.dragOffsetX>1e3||this.draggingObjectData.dragOffsetX<-1e3||this.draggingObjectData.dragOffsetY>1e3||this.draggingObjectData.dragOffsetY<-1e3))this.draggingObjectData.dragOffsetX-=e.dx,this.draggingObjectData.dragOffsetY-=e.dy;else{var t={x:0,y:0};if(this.ren.config.enableSnapToGridType===u.SNAP_TO_GRID_DURING){var n=this.snapToGridDraggedNode(this.draggingObjectData);t={x:n.x-this.draggingObjectData.dragObjects[0].x_pos,y:n.y-this.draggingObjectData.dragObjects[0].y_pos}}else t={x:e.dx,y:e.dy};this.draggingObjectData.dragRunningX+=t.x,this.draggingObjectData.dragRunningY+=t.y,this.draggingObjectData.dragObjects.forEach((function(e){e.x_pos+=t.x,e.y_pos+=t.y})),this.ren.config.enableLinkSelection===u.LINK_SELECTION_DETACHABLE&&this.ren.activePipeline.getSelectedLinks().forEach((function(e){e.srcPos&&(e.srcPos.x_pos+=t.x,e.srcPos.y_pos+=t.y),e.trgPos&&(e.trgPos.x_pos+=t.x,e.trgPos.y_pos+=t.y)}))}if(this.ren.displayMovedComments(),this.ren.displayMovedNodes(),this.ren.displayMovedLinks(),this.ren.displayCanvasAccoutrements(),this.ren.dispUtils.isDisplayingSubFlowInPlace()&&this.ren.displaySVGToFitSupernode(),this.existingNodeInsertableIntoLink){var i=this.ren.getLinkAtMousePos(e.sourceEvent.clientX,e.sourceEvent.clientY);(!i||this.ren.isLinkFullyAttached(i)&&this.draggingObjectData.dragObjects[0].id!==i.srcNodeId&&this.draggingObjectData.dragObjects[0].id!==i.trgNodeId)&&this.ren.setInsertNodeIntoLinkHighlighting(i)}if(this.existingNodeAttachableToDetachedLinks){var o=this.draggingObjectData.dragObjects[0],a={x1:o.x_pos,y1:o.y_pos,x2:o.x_pos+o.width,y2:o.y_pos+o.height},r=this.ren.getAttachableLinksForNodeAtPos(o,a);this.ren.setDetachedLinkHighlighting(r)}}},{key:"dragObjectsEnd",value:function(e,t){var n=this.draggingObjectData;if(this.draggingObjectData=null,clearTimeout(this.startNodeInsertingInLink),clearTimeout(this.startNodeAttachingToDetachedLinks),this.switchIsMovingClass(n.dragObjects,!1),0===n.dragOffsetX&&0===n.dragOffsetY&&this.ren.config.enableDragWithoutSelect)this.ren.selectObjectSourceEvent(e,t);else if(0!==n.dragRunningX||0!==n.dragRunningY){var i=null;if(this.ren.config.enableSnapToGridType===u.SNAP_TO_GRID_AFTER){var o=this.snapToGridDraggedNode(n);i={x:o.x-n.dragStartX,y:o.y-n.dragStartY}}else i={x:n.dragRunningX,y:n.dragRunningY};this.existingNodeInsertableIntoLink&&this.ren.dragOverLink?this.ren.canvasController.editActionHandler({editType:"insertNodeIntoLink",editSource:"canvas",node:n.dragObjects[0],link:this.ren.dragOverLink,offsetX:i.x,offsetY:i.y,pipelineId:this.ren.activePipeline.id}):this.existingNodeAttachableToDetachedLinks&&this.ren.dragOverDetachedLinks.length>0?this.ren.canvasController.editActionHandler({editType:"attachNodeToLinks",editSource:"canvas",node:n.dragObjects[0],detachedLinks:this.ren.dragOverDetachedLinks,offsetX:i.x,offsetY:i.y,pipelineId:this.ren.activePipeline.id}):this.ren.canvasController.editActionHandler({editType:"moveObjects",editSource:"canvas",nodes:n.dragObjects.map((function(e){return e.id})),links:this.ren.activePipeline.getSelectedDetachedLinks(),offsetX:i.x,offsetY:i.y,pipelineId:this.ren.activePipeline.id})}this.ren.setDataLinkSelectionAreaWider(!1),this.unsetNodeTranslucentState(n.dragObjects),this.ren.unsetInsertNodeIntoLinkHighlighting(),this.ren.unsetDetachedLinkHighlighting()}},{key:"getDragObjects",value:function(e){var t=this.ren.activePipeline.getSelectedNodesAndComments();return this.ren.config.enableDragWithoutSelect&&-1===t.findIndex((function(t){return t.id===e.id}))?[e]:t}},{key:"switchIsMovingClass",value:function(e,t){var n=this;e.forEach((function(e){v.CanvasUtils.isNode(e)?n.ren.getNodeGroupSelectionById(e.id).classed("d3-is-moving",t):n.ren.getCommentGroupSelectionById(e.id).classed("d3-is-monving",t)}))}},{key:"isExistingNodeInsertableIntoLink",value:function(){return this.ren.config.enableInsertNodeDroppedOnLink&&1===this.draggingObjectData.dragObjects.length&&v.CanvasUtils.isNode(this.draggingObjectData.dragObjects[0])&&v.CanvasUtils.hasInputAndOutputPorts(this.draggingObjectData.dragObjects[0])&&!v.CanvasUtils.isNodeDefaultPortsCardinalityAtMax(this.draggingObjectData.dragObjects[0],this.ren.activePipeline.links)}},{key:"isExistingNodeAttachableToDetachedLinks",value:function(){return this.ren.config.enableLinkSelection===u.LINK_SELECTION_DETACHABLE&&1===this.draggingObjectData.dragObjects.length&&v.CanvasUtils.isNode(this.draggingObjectData.dragObjects[0])}},{key:"setNodeTranslucentState",value:function(e,t){this.ren.getNodeGroupSelectionById(e).classed("d3-node-group-translucent",t)}},{key:"unsetNodeTranslucentState",value:function(e){(null==e?void 0:e.length)>0&&this.setNodeTranslucentState(e[0].id,!1)}},{key:"snapToGridDraggedNode",value:function(e){var t=e.dragStartX+e.dragOffsetX,n=e.dragStartY+e.dragOffsetY;return this.ren.snapToGridPosition({x:t,y:n})}},{key:"snapToGridObject",value:function(e){var t=e;return t.x_pos=v.CanvasUtils.snapToGrid(t.x_pos,this.ren.canvasLayout.snapToGridXPx),t.y_pos=v.CanvasUtils.snapToGrid(t.y_pos,this.ren.canvasLayout.snapToGridYPx),t.width=v.CanvasUtils.snapToGrid(t.width,this.ren.canvasLayout.snapToGridXPx),t.height=v.CanvasUtils.snapToGrid(t.height,this.ren.canvasLayout.snapToGridYPx),t}}])}();function vo(e){return((e*=2)<=1?e*e:--e*(2-e)+1)/2}function yo(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var mo=function e(t){function n(e){return Math.pow(e,t)}return t=+t,n.exponent=e,n}(3),bo=function e(t){function n(e){return 1-Math.pow(1-e,t)}return t=+t,n.exponent=e,n}(3),ko=function e(t){function n(e){return((e*=2)<=1?Math.pow(e,t):2-Math.pow(2-e,t))/2}return t=+t,n.exponent=e,n}(3),Co=Math.PI,xo=Co/2;function To(e){return(1-Math.cos(Co*e))/2}function Lo(e){return 1.0009775171065494*(Math.pow(2,-10*e)-.0009765625)}function Po(e){return((e*=2)<=1?Lo(1-e):2-Lo(e-1))/2}function No(e){return((e*=2)<=1?1-Math.sqrt(1-e*e):Math.sqrt(1-(e-=2)*e)+1)/2}var So=4/11,_o=6/11,Eo=8/11,Io=3/4,Do=9/11,Oo=10/11,wo=15/16,Ao=21/22,Mo=63/64,zo=1/So/So;function Uo(e){return(e=+e)<So?zo*e*e:e<Eo?zo*(e-=_o)*e+Io:e<Oo?zo*(e-=Do)*e+wo:zo*(e-=Ao)*e+Mo}var Ro=1.70158,Ho=function e(t){function n(e){return(e=+e)*e*(t*(e-1)+e)}return t=+t,n.overshoot=e,n}(Ro),jo=function e(t){function n(e){return--e*e*((e+1)*t+e)+1}return t=+t,n.overshoot=e,n}(Ro),Fo=function e(t){function n(e){return((e*=2)<1?e*e*((t+1)*e-t):(e-=2)*e*((t+1)*e+t)+2)/2}return t=+t,n.overshoot=e,n}(Ro),Bo=2*Math.PI,Go=function e(t,n){var i=Math.asin(1/(t=Math.max(1,t)))*(n/=Bo);function o(e){return t*Lo(- --e)*Math.sin((i-e)/n)}return o.amplitude=function(t){return e(t,n*Bo)},o.period=function(n){return e(t,n)},o}(1,.3),Wo=function e(t,n){var i=Math.asin(1/(t=Math.max(1,t)))*(n/=Bo);function o(e){return 1-t*Lo(e=+e)*Math.sin((e+i)/n)}return o.amplitude=function(t){return e(t,n*Bo)},o.period=function(n){return e(t,n)},o}(1,.3),Yo=function e(t,n){var i=Math.asin(1/(t=Math.max(1,t)))*(n/=Bo);function o(e){return((e=2*e-1)<0?t*Lo(-e)*Math.sin((i-e)/n):2-t*Lo(e)*Math.sin((i+e)/n))/2}return o.amplitude=function(t){return e(t,n*Bo)},o.period=function(n){return e(t,n)},o}(1,.3),Ko=Object.freeze({__proto__:null,easeLinear:e=>+e,easeQuad:vo,easeQuadIn:function(e){return e*e},easeQuadOut:function(e){return e*(2-e)},easeQuadInOut:vo,easeCubic:yo,easeCubicIn:function(e){return e*e*e},easeCubicOut:function(e){return--e*e*e+1},easeCubicInOut:yo,easePoly:ko,easePolyIn:mo,easePolyOut:bo,easePolyInOut:ko,easeSin:To,easeSinIn:function(e){return 1==+e?1:1-Math.cos(e*xo)},easeSinOut:function(e){return Math.sin(e*xo)},easeSinInOut:To,easeExp:Po,easeExpIn:function(e){return Lo(1-+e)},easeExpOut:function(e){return 1-Lo(e)},easeExpInOut:Po,easeCircle:No,easeCircleIn:function(e){return 1-Math.sqrt(1-e*e)},easeCircleOut:function(e){return Math.sqrt(1- --e*e)},easeCircleInOut:No,easeBounce:Uo,easeBounceIn:function(e){return 1-Uo(1-e)},easeBounceOut:Uo,easeBounceInOut:function(e){return((e*=2)<=1?1-Uo(1-e):Uo(e-1)+1)/2},easeBack:Fo,easeBackIn:Ho,easeBackOut:jo,easeBackInOut:Fo,easeElastic:Wo,easeElasticIn:Go,easeElasticOut:Wo,easeElasticInOut:Yo}),Xo=Object.assign({},go,Ko,Fn),Vo=function(){return e._createClass((function t(n){e._classCallCheck(this,t),this.ren=n,this.logger=new g.Logger("SVGCanvasUtilsDragNewLink"),this.drawingNewLinkData=null,this.dragNewLinkHandler=Xo.drag().on("start",this.dragStartNewLink.bind(this)).on("drag",this.dragMoveNewLink.bind(this)).on("end",this.dragEndNewLink.bind(this))}),[{key:"getDragNewLinkHandler",value:function(){return this.dragNewLinkHandler}},{key:"isDragging",value:function(){return this.drawingNewLinkData}},{key:"dragStartNewLink",value:function(e,t){if(this.isEventForOutputPort(e)){var n=this.getNodeForPort(e);this.startOutputPortNewLink(t,n)}else if(this.isEventForInputPort(e)){var i=this.getNodeForPort(e);this.startInputPortNewLink(t,i)}else"comment"===this.ren.activePipeline.getObjectTypeName(t)&&this.startCommentNewLink(t)}},{key:"dragMoveNewLink",value:function(e){this.drawNewLink(e)}},{key:"dragEndNewLink",value:function(e){this.completeNewLink(e)}},{key:"isEventForInputPort",value:function(e){return this.targetContainsClass(e,"d3-node-port-input")||this.targetContainsClass(e,"d3-node-port-input-assoc")}},{key:"isEventForOutputPort",value:function(e){return this.targetContainsClass(e,"d3-node-port-output")||this.targetContainsClass(e,"d3-node-port-output-assoc")}},{key:"targetContainsClass",value:function(e,t){var n,i,o;return null===(n=e.sourceEvent)||void 0===n||null===(i=n.currentTarget)||void 0===i||null===(o=i.classList)||void 0===o?void 0:o.contains(t)}},{key:"getNodeForPort",value:function(e){var t,n;return Xo.select(null===(t=e.sourceEvent)||void 0===t||null===(n=t.currentTarget)||void 0===n?void 0:n.parentNode).datum()}},{key:"startCommentNewLink",value:function(e){this.drawingNewLinkData={srcObjId:e.id,action:u.COMMENT_LINK,startPos:{x:e.x_pos-this.ren.canvasLayout.commentHighlightGap,y:e.y_pos-this.ren.canvasLayout.commentHighlightGap},linkArray:[]}}},{key:"startInputPortNewLink",value:function(e,t){if(this.ren.config.enableAssocLinkCreation){var n=this.ren.activePipeline.getNode(t.id);this.drawingNewLinkData={srcObjId:t.id,srcPortId:e.id,action:this.ren.config.enableAssocLinkCreation?u.ASSOCIATION_LINK:u.NODE_LINK,srcNode:n,startPos:{x:n.x_pos+e.cx,y:n.y_pos+e.cy},portType:"input",portObject:t.layout.inputPortObject,portImage:t.layout.inputPortImage,portWidth:t.layout.inputPortWidth,portHeight:t.layout.inputPortHeight,portRadius:this.ren.getPortRadius(n),minInitialLine:n.layout.minInitialLine,guideObject:t.layout.inputPortGuideObject,guideImage:t.layout.inputPortGuideImage,linkArray:[]}}}},{key:"startOutputPortNewLink",value:function(e,t){var n=this.ren.activePipeline.getNode(t.id);v.CanvasUtils.isSrcCardinalityAtMax(e.id,n,this.ren.activePipeline.links)||(this.drawingNewLinkData={srcObjId:t.id,srcPortId:e.id,action:this.ren.config.enableAssocLinkCreation?u.ASSOCIATION_LINK:u.NODE_LINK,srcNode:n,startPos:{x:n.x_pos+e.cx,y:n.y_pos+e.cy},portType:"output",portObject:t.layout.outputPortObject,portImage:t.layout.outputPortImage,portWidth:t.layout.outputPortWidth,portHeight:t.layout.outputPortHeight,portRadius:this.ren.getPortRadius(n),minInitialLine:n.layout.minInitialLine,guideObject:t.layout.outputPortGuideObject,guideImage:t.layout.outputPortGuideImage,linkArray:[]},this.ren.config.enableHighlightUnavailableNodes&&this.ren.setUnavailableTargetNodesHighlighting(n,e.id,this.ren.activePipeline.links))}},{key:"drawNewLink",value:function(e){if(!1!==this.ren.config.enableEditingActions&&this.drawingNewLinkData){this.ren.closeContextMenuIfOpen();var t=this.ren.getTransformedMousePos(e);this.drawingNewLinkData.action===u.COMMENT_LINK?this.drawNewCommentLink(t):this.drawNewNodeLink(t),this.ren.config.enableHighlightNodeOnNewLinkDrag&&this.setNewLinkOverNode(e)}}},{key:"drawNewCommentLink",value:function(e){var t=this,n=this.ren.activePipeline.getComment(this.drawingNewLinkData.srcObjId),i=this.ren.linkUtils.getNewStraightCommentLinkStartPos(n,e),o=u.COMMENT_LINK;this.drawingNewLinkData.linkArray=[{x1:i.x,y1:i.y,x2:e.x,y2:e.y,type:o}];var a=this.ren.nodesLinksGrp.selectAll(".d3-new-connection-line"),r=this.ren.nodesLinksGrp.selectAll(".d3-new-connection-guide");if(a.data(this.drawingNewLinkData.linkArray).enter().append("path").attr("class","d3-new-connection-line").attr("linkType",o).merge(a).attr("d",(function(e){return t.ren.linkUtils.getConnectorPathInfo(e).path})),r.data(this.drawingNewLinkData.linkArray).enter().append("circle").attr("class","d3-new-connection-guide").attr("linkType",o).merge(r).attr("cx",(function(e){return e.x2})).attr("cy",(function(e){return e.y2})).attr("r",this.ren.canvasLayout.commentPortRadius),this.ren.canvasLayout.commentLinkArrowHead){var s=this.ren.nodesLinksGrp.selectAll(".d3-new-connection-arrow");s.data(this.drawingNewLinkData.linkArray).enter().append("path").attr("class","d3-new-connection-arrow").attr("linkType",o).merge(s).attr("d",(function(e){return t.ren.getArrowHead(e)})).attr("transform",(function(e){return t.ren.getArrowHeadTransform(e)}))}}},{key:"drawNewNodeLink",value:function(e){var t=this,n=this.ren.config.enableAssocLinkCreation?u.ASSOCIATION_LINK:u.NODE_LINK,i=n===u.ASSOCIATION_LINK&&"input"===this.drawingNewLinkData.portType?{type:n,trgNode:this.drawingNewLinkData.srcNode,trgNodeId:this.drawingNewLinkData.srcObjId,trgNodePortId:this.drawingNewLinkData.srcPortId,srcPos:{x_pos:e.x,y_pos:e.y}}:{type:n,srcObj:this.drawingNewLinkData.srcNode,srcNodeId:this.drawingNewLinkData.srcObjId,srcNodePortId:this.drawingNewLinkData.srcPortId,trgPos:{x_pos:e.x,y_pos:e.y}},o=this.ren.getDetachedLinkObj(i);this.drawingNewLinkData.linkArray=this.ren.linkUtils.addConnectionPaths([o]),this.ren.config.enableAssocLinkCreation&&(this.drawingNewLinkData.linkArray[0].assocLinkVariation=this.ren.getNewLinkAssocVariation(this.drawingNewLinkData.linkArray[0].x1,this.drawingNewLinkData.linkArray[0].x2,this.drawingNewLinkData.portType));var a=this.ren.linkUtils.getConnectorPathInfo(this.drawingNewLinkData.linkArray[0],this.drawingNewLinkData.minInitialLine),r=this.ren.nodesLinksGrp.selectAll(".d3-new-connection-line"),s=this.ren.nodesLinksGrp.selectAll(".d3-new-connection-start"),l=this.ren.nodesLinksGrp.selectAll(".d3-new-connection-guide");n===u.NODE_LINK&&this.ren.canvasLayout.linkType===u.LINK_TYPE_STRAIGHT&&this.ren.nodeUtils.isPointInNodeBoundary(e,this.drawingNewLinkData.srcNode)?this.removeNewLinkLine():r.data(this.drawingNewLinkData.linkArray).enter().append("path").attr("class","d3-new-connection-line").attr("linkType",n).merge(r).attr("d",a.path).attr("transform",a.transform),this.ren.canvasLayout.linkType!==u.LINK_TYPE_STRAIGHT&&s.data(this.drawingNewLinkData.linkArray).enter().append(this.drawingNewLinkData.portObject).attr("class","d3-new-connection-start").attr("linkType",n).merge(s).each((function(e,n,i){t.drawingNewLinkData.portObject===u.PORT_OBJECT_CIRCLE&&Xo.select(i[n]).attr("cx",e.x1).attr("cy",e.y1).attr("r",t.drawingNewLinkData.portRadius)})),l.data(this.drawingNewLinkData.linkArray).enter().append(this.drawingNewLinkData.guideObject).attr("class","d3-new-connection-guide").attr("linkType",n).merge(l).each((function(e,n,i){t.drawingNewLinkData.guideObject===u.PORT_OBJECT_IMAGE?Xo.select(i[n]).attr("xlink:href",t.drawingNewLinkData.guideImage).attr("x",e.x2-t.drawingNewLinkData.portWidth/2).attr("y",e.y2-t.drawingNewLinkData.portHeight/2).attr("width",t.drawingNewLinkData.portWidth).attr("height",t.drawingNewLinkData.portHeight).attr("transform",t.ren.getLinkImageTransform(e)):Xo.select(i[n]).attr("cx",e.x2).attr("cy",e.y2).attr("r",t.drawingNewLinkData.portRadius)}))}},{key:"removeNewLinkLine",value:function(){this.ren.nodesLinksGrp.selectAll(".d3-new-connection-line").remove()}},{key:"completeNewLink",value:function(e){if(!1!==this.ren.config.enableEditingActions&&this.drawingNewLinkData){var t=this.drawingNewLinkData;this.drawingNewLinkData=null,this.ren.config.enableHighlightUnavailableNodes&&this.ren.unsetUnavailableNodesHighlighting();var n=this.ren.getNodeAtMousePos(e);null!==n?this.completeNewLinkOnNode(e,n,t):this.ren.config.enableLinkSelection!==u.LINK_SELECTION_DETACHABLE||t.action!==u.NODE_LINK||this.ren.config.enableAssocLinkCreation?this.stopDrawingNewLink(t):this.completeNewDetachedLink(e,t)}}},{key:"completeNewLinkOnNode",value:function(e,t,n){if(this.removeNewLink(),this.ren.config.enableHighlightNodeOnNewLinkDrag&&this.ren.setLinkOverNodeCancel(),null!==t){var i=n.action;if(i===u.NODE_LINK){var o=this.ren.activePipeline.getNode(n.srcObjId),a=n.srcPortId,r=this.ren.getInputNodePortId(e,t);if(v.CanvasUtils.isDataConnectionAllowed(a,r,o,t,this.ren.activePipeline.links,this.ren.config.enableSelfRefLinks))this.ren.canvasController.editActionHandler({editType:"linkNodes",editSource:"canvas",nodes:[{id:n.srcObjId,portId:n.srcPortId}],targetNodes:[{id:t.id,portId:r}],type:i,linkType:"data",pipelineId:this.ren.activePipeline.id});else if(this.ren.config.enableLinkReplaceOnNewConnection&&v.CanvasUtils.isDataLinkReplacementAllowed(a,r,o,t,this.ren.activePipeline.links,this.ren.config.enableSelfRefLinks)){var s=v.CanvasUtils.getDataLinksConnectedTo(r,t,this.ren.activePipeline.links);1===s.length&&this.ren.canvasController.editActionHandler({editType:"linkNodesAndReplace",editSource:"canvas",nodes:[{id:n.srcObjId,portId:n.srcPortId}],targetNodes:[{id:t.id,portId:r}],type:i,pipelineId:this.pipelineId,replaceLink:s[0]})}}else if(i===u.ASSOCIATION_LINK){var l=this.ren.activePipeline.getNode(n.srcObjId);v.CanvasUtils.isAssocConnectionAllowed(l,t,this.ren.activePipeline.links)&&this.ren.canvasController.editActionHandler({editType:"linkNodes",editSource:"canvas",nodes:[{id:n.srcObjId}],targetNodes:[{id:t.id}],type:i,pipelineId:this.ren.activePipeline.id})}else v.CanvasUtils.isCommentLinkConnectionAllowed(n.srcObjId,t.id,this.ren.activePipeline.links)&&this.ren.canvasController.editActionHandler({editType:"linkComment",editSource:"canvas",nodes:[n.srcObjId],targetNodes:[t.id],type:u.COMMENT_LINK,linkType:"comment",pipelineId:this.ren.activePipeline.id})}}},{key:"completeNewDetachedLink",value:function(e,t){this.removeNewLink(),this.ren.config.enableHighlightNodeOnNewLinkDrag&&this.ren.setLinkOverNodeCancel();var n=this.ren.getTransformedMousePos(e);this.ren.canvasController.editActionHandler({editType:"createDetachedLink",editSource:"canvas",srcNodeId:t.srcObjId,srcNodePortId:t.srcPortId,trgPos:n,type:u.NODE_LINK,pipelineId:this.ren.activePipeline.id})}},{key:"stopDrawingNewLink",value:function(e){this.ren.config.enableHighlightNodeOnNewLinkDrag&&this.ren.setLinkOverNodeCancel(),this.stopDrawingNewLinkForPorts(e)}},{key:"stopDrawingNewLinkForPorts",value:function(e){var t=this,n=e.linkArray[0].x1,i=e.linkArray[0].y1,o=e.linkArray[0].x2,a=e.linkArray[0].y2;e.action===u.ASSOCIATION_LINK&&"input"===e.portType&&(n=e.linkArray[0].x2,i=e.linkArray[0].y2,o=e.linkArray[0].x1,a=e.linkArray[0].y1);var r=Object.assign({},e),s="",l=350;this.ren.canvasLayout.linkType===u.LINK_TYPE_CURVE?s="M "+n+" "+i+"C "+o+" "+a+" "+o+" "+a+" "+o+" "+a:this.ren.canvasLayout.linkType===u.LINK_TYPE_STRAIGHT?(n<o&&(l=0),s="M "+n+" "+i+"L "+o+" "+a+" "+o+" "+a+" "+o+" "+a):s="M "+n+" "+i+"L "+o+" "+a+"Q "+o+" "+a+" "+o+" "+a+"L "+o+" "+a+"Q "+o+" "+a+" "+o+" "+a+"L "+o+" "+a+"Q "+o+" "+a+" "+o+" "+a+"L "+o+" "+a+"Q "+o+" "+a+" "+o+" "+a+"L "+o+" "+a,this.ren.nodesLinksGrp.selectAll(".d3-new-connection-line").transition().duration(l).attr("d",s).on("end",(function(){t.ren.nodesLinksGrp.selectAll(".d3-new-connection-arrow").remove(),t.ren.nodesLinksGrp.selectAll(".d3-new-connection-guide").transition().duration(1e3).ease(Xo.easeElastic).attr("x",n-r.portWidth/2).attr("y",i-r.portHeight/2).attr("cx",n).attr("cy",i).attr("transform",null),t.ren.nodesLinksGrp.selectAll(".d3-new-connection-line").transition().duration(1e3).ease(Xo.easeElastic).attr("d","M "+n+" "+i+"L "+n+" "+i).on("end",t.removeNewLink.bind(t))}))}},{key:"removeNewLink",value:function(){this.ren.nodesLinksGrp.selectAll(".d3-new-connection-line").remove(),this.ren.nodesLinksGrp.selectAll(".d3-new-connection-start").remove(),this.ren.nodesLinksGrp.selectAll(".d3-new-connection-guide").remove(),this.ren.nodesLinksGrp.selectAll(".d3-new-connection-arrow").remove()}},{key:"setNewLinkOverNode",value:function(e){var t=this.ren.getNodeNearMousePos(e,this.ren.canvasLayout.nodeProximity),n=t&&this.isNewLinkAllowedToNode(t);this.ren.setHighlightingOverNode(n,t)}},{key:"isNewLinkAllowedToNode",value:function(e){if(this.drawingNewLinkData){if(this.drawingNewLinkData.action===u.NODE_LINK){var t=this.drawingNewLinkData.srcNode,n=e,i=this.drawingNewLinkData.srcPortId,o=v.CanvasUtils.getDefaultInputPortId(n);return v.CanvasUtils.isDataConnectionAllowed(i,o,t,n,this.ren.activePipeline.links,this.ren.config.enableSelfRefLinks)}if(this.drawingNewLinkData.action===u.ASSOCIATION_LINK){var a=this.drawingNewLinkData.srcNode,r=e;return v.CanvasUtils.isAssocConnectionAllowed(a,r,this.ren.activePipeline.links)}if(this.drawingNewLinkData.action===u.COMMENT_LINK){var s=this.drawingNewLinkData.srcObjId,l=e.id;return v.CanvasUtils.isCommentLinkConnectionAllowed(s,l,this.ren.activePipeline.links)}}return!1}}])}(),Zo=Object.assign({},go,Fn),qo="output_type",Jo=function(){return e._createClass((function t(n){e._classCallCheck(this,t),this.ren=n,this.logger=new g.Logger("SVGCanvasUtilsDragDetLink"),this.draggingLinkData=null,this.dragDetLinkHandler=Zo.drag().on("start",this.dragStartDetLinkHandle.bind(this)).on("drag",this.dragMoveDetLinkHandle.bind(this)).on("end",this.dragEndDetLinkHandle.bind(this))}),[{key:"getDragDetachedLinkHandler",value:function(){return this.dragDetLinkHandler}},{key:"isDragging",value:function(){return this.draggingLinkData}},{key:"isLinkBeingDragged",value:function(e){return this.draggingLinkData&&this.draggingLinkData.link.id===e.id}},{key:"dragStartDetLinkHandle",value:function(e,t){this.logger.logStartTimer("dragStartDetLinkHandle"),this.ren.closeContextMenuIfOpen();var n=Zo.select(e.sourceEvent.currentTarget),i=this.ren.activePipeline.getLink(t.id),o=m.cloneDeep_1(i),a=this.ren.getLinkGroupSelectionById(t.id);if(this.draggingLinkData={lineInfo:t,link:i,oldLink:o,linkGrpSelection:Zo.select(a)},n.attr("class").includes("d3-link-handle-end")?this.draggingLinkData.endBeingDragged="end":n.attr("class").includes("d3-link-handle-start")&&(this.draggingLinkData.endBeingDragged="start"),this.ren.config.enableHighlightUnavailableNodes)if("end"===this.draggingLinkData.endBeingDragged){var r=this.ren.activePipeline.links.filter((function(e){return e.id!==i.id}));this.ren.setUnavailableTargetNodesHighlighting(this.ren.activePipeline.getNode(this.draggingLinkData.link.srcNodeId),this.draggingLinkData.link.srcNodePortId,r)}else if("start"===this.draggingLinkData.endBeingDragged){var s=this.ren.activePipeline.links.filter((function(e){return e.id!==i.id}));this.ren.setUnavailableSourceNodesHighlighting(this.ren.activePipeline.getNode(this.draggingLinkData.oldLink.trgNodeId),this.draggingLinkData.link.trgNodePortId,s)}this.dragLinkHandle(e),this.logger.logEndTimer("dragStartDetLinkHandle",!0)}},{key:"dragMoveDetLinkHandle",value:function(e){this.logger.logStartTimer("dragMoveDetLinkHandle"),this.dragLinkHandle(e),this.logger.logEndTimer("dragMoveDetLinkHandle",!0)}},{key:"dragEndDetLinkHandle",value:function(e){this.logger.logStartTimer("dragEndLinkHandle"),this.completeDraggedDetLink(e),this.logger.logEndTimer("dragEndLinkHandle",!0)}},{key:"dragLinkHandle",value:function(e){var t=this.ren.getTransformedMousePos(e),n=this.draggingLinkData.link;"start"===this.draggingLinkData.endBeingDragged?(n.srcPos={x_pos:t.x,y_pos:t.y},delete n.srcNodeId,delete n.srcNodePortId,delete n.srcObj):(n.trgPos={x_pos:t.x,y_pos:t.y},delete n.trgNodeId,delete n.trgNodePortId,delete n.trgNode),this.ren.displayLinks(),this.ren.config.enableHighlightNodeOnNewLinkDrag&&this.setDetachedLinkOverNode(e)}},{key:"completeDraggedDetLink",value:function(e){var t=this.getNewLinkOnDrag(e),n=this.draggingLinkData;if(this.draggingLinkData=null,t){var i=this.getLinkEditSubType(n.oldLink,t);if(i)this.ren.canvasController.editActionHandler({editType:"updateLink",editSubType:i,editSource:"canvas",newLink:t,pipelineId:this.ren.activePipeline.id})||this.snapBackOldLink(n.oldLink);else this.snapBackOldLink(n.oldLink)}else this.snapBackOldLink(n.oldLink);this.ren.config.enableHighlightNodeOnNewLinkDrag&&this.ren.setLinkOverNodeCancel(),this.ren.unsetUnavailableNodesHighlighting()}},{key:"getLinkEditSubType",value:function(e,t){return e.srcNodeId&&!t.srcNodeId?"detachFromSrcNode":e.trgNodeId&&!t.trgNodeId?"detachFromTrgNode":!e.srcNodeId&&t.srcNodeId?"attachToSrcNode":!e.trgNodeId&&t.trgNodeId?"attachToTrgNode":e.srcNodeId||t.srcNodeId||e.srcPos.x_pos===t.srcPos.x_pos&&e.srcPos.y_pos===t.srcPos.y_pos?e.trgNodeId||t.trgNodeId||e.trgPos.x_pos===t.trgPos.x_pos&&e.trgPos.y_pos===t.trgPos.y_pos?e.srcNodeId&&t.srcNodeId&&e.srcNodeId!==t.srcNodeId?"switchSrcNode":e.trgNodeId&&t.trgNodeId&&e.trgNodeId!==t.trgNodeId?"switchTrgNode":e.srcNodeId&&t.srcNodeId&&e.srcNodeId===t.srcNodeId&&e.srcNodePortId!==t.srcNodePortId?"switchSrcNodePort":e.trgNodeId&&t.trgNodeId&&e.trgNodeId===t.trgNodeId&&e.trgNodePortId!==t.trgNodePortId?"switchTrgNodePort":null:"moveTrgPosition":"moveSrcPosition"}},{key:"snapBackOldLink",value:function(e){this.ren.activePipeline.replaceLink(e),this.ren.displayLinks()}},{key:"setDetachedLinkOverNode",value:function(e){var t=this.ren.getNodeNearMousePos(e,this.ren.canvasLayout.nodeProximity),n=t&&this.isDetLinkConnectionAllowedToNearbyNode(e);this.ren.setHighlightingOverNode(n,t)}},{key:"isDetLinkConnectionAllowedToNearbyNode",value:function(e){if(this.draggingLinkData&&this.getNewLinkOnDrag(e,this.ren.canvasLayout.nodeProximity))return!0;return!1}},{key:"getNewLinkOnDrag",value:function(e,t){var n=this.draggingLinkData.oldLink,i=m.cloneDeep_1(n);if("start"===this.draggingLinkData.endBeingDragged){delete i.srcObj,delete i.srcNodeId,delete i.srcNodePortId,delete i.srcPos;var o=t?this.ren.getNodeNearMousePos(e,t):this.ren.getNodeAtMousePos(e);o?(i.srcNodeId=o.id,i.srcObj=this.ren.activePipeline.getNode(o.id),i.srcNodePortId=t?this.getNodePortIdNearMousePos(e,qo,o):this.ren.getOutputNodePortId(e,o)):i.srcPos=this.draggingLinkData.link.srcPos}else{delete i.trgNode,delete i.trgNodeId,delete i.trgNodePortId,delete i.trgPos;var a=t?this.ren.getNodeNearMousePos(e,t):this.ren.getNodeAtMousePos(e);a?(i.trgNodeId=a.id,i.trgNode=this.ren.activePipeline.getNode(a.id),i.trgNodePortId=t?this.getNodePortIdNearMousePos(e,"input_type",a):this.ren.getInputNodePortId(e,a)):i.trgPos=this.draggingLinkData.link.trgPos}return this.ren.config.enableLinkSelection!==u.LINK_SELECTION_DETACHABLE&&(i.srcPos||i.trgPos)?null:this.canExecuteUpdateLinkCommand(i,n)?i:null}},{key:"getNodePortIdNearMousePos",value:function(e,t,n){var i=this.ren.getTransformedMousePos(e),o=null,a=null;if(n)if(t===qo){var r=this.ren.getAllNodeGroupsSelection().selectChildren("."+this.ren.getNodeOutputPortClassName()).selectChildren(".d3-node-port-output-main");o=this.searchForPortNearMouse(n,i,r,n.layout.outputPortObject,n.width),a=v.CanvasUtils.getDefaultOutputPortId(n)}else{var s=this.ren.getAllNodeGroupsSelection().selectChildren("."+this.ren.getNodeInputPortClassName()).selectChildren(".d3-node-port-input-main");o=this.searchForPortNearMouse(n,i,s,n.layout.inputPortObject,0),a=v.CanvasUtils.getDefaultInputPortId(n)}return o||(o=a),o}},{key:"searchForPortNearMouse",value:function(e,t,n,i,o){var a=null;return n.each((function(n,r,s){var l=Zo.select(s[r]);if(i===u.PORT_OBJECT_IMAGE){var c=e.x_pos+Number(l.attr("x")),d=e.y_pos+Number(l.attr("y")),h=Number(l.attr("width")),g=Number(l.attr("height"));t.x>=c&&t.x<=c+o+h&&t.y>=d&&t.y<=d+g&&(a=s[r].getAttribute("data-port-id"))}else{var p=e.x_pos+Number(l.attr("cx")),f=e.y_pos+Number(l.attr("cy"));t.x>=p-e.layout.portRadius&&t.x<=p+e.layout.portRadius&&t.y>=f-e.layout.portRadius&&t.y<=f+e.layout.portRadius&&(a=s[r].getAttribute("data-port-id"))}})),a}},{key:"canExecuteUpdateLinkCommand",value:function(e,t){var n=this.ren.activePipeline.getNode(e.srcNodeId),i=this.ren.activePipeline.getNode(e.trgNodeId),o=this.hasLinkSrcChanged(e,t),a=this.hasLinkTrgChanged(e,t),r=this.ren.activePipeline.links,s=!0;return o&&n&&!v.CanvasUtils.isSrcConnectionAllowedWithDetachedLinks(e.srcNodePortId,n,r)&&(s=!1),a&&i&&!v.CanvasUtils.isTrgConnectionAllowedWithDetachedLinks(e.trgNodePortId,i,r)&&(s=!1),n&&i&&!v.CanvasUtils.isConnectionAllowedWithDetachedLinks(e.srcNodePortId,e.trgNodePortId,n,i,r,this.ren.config.enableSelfRefLinks)&&(s=!1),s}},{key:"hasLinkSrcChanged",value:function(e,t){var n=!1;return e.srcNodeId?(e.srcNodeId!==t.srcNodeId&&(n=!0),e.srcNodePortId!==t.srcNodePortId&&(n=!0)):t.srcPos&&e.srcPos.x_pos===t.srcPos.x_pos&&e.srcPos.y_pos===t.srcPos.y_pos||(n=!0),n}},{key:"hasLinkTrgChanged",value:function(e,t){var n=!1;return e.trgNodeId?(e.trgNodeId!==t.trgNodeId&&(n=!0),e.trgNodePortId!==t.trgNodePortId&&(n=!0)):t.trgPos&&e.trgPos.x_pos===t.trgPos.x_pos&&e.trgPos.y_pos===t.trgPos.y_pos||(n=!0),n}}])}();function $o(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Qo(e,t){var n=Object.create(e.prototype);for(var i in t)n[i]=t[i];return n}function ea(){}var ta=.7,na=1/ta,ia="\\s*([+-]?\\d+)\\s*",oa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",aa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ra=/^#([0-9a-f]{3,8})$/,sa=new RegExp(`^rgb\\(${ia},${ia},${ia}\\)$`),la=new RegExp(`^rgb\\(${aa},${aa},${aa}\\)$`),ca=new RegExp(`^rgba\\(${ia},${ia},${ia},${oa}\\)$`),ua=new RegExp(`^rgba\\(${aa},${aa},${aa},${oa}\\)$`),da=new RegExp(`^hsl\\(${oa},${aa},${aa}\\)$`),ha=new RegExp(`^hsla\\(${oa},${aa},${aa},${oa}\\)$`),ga={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function pa(){return this.rgb().formatHex()}function fa(){return this.rgb().formatRgb()}function va(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=ra.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?ya(t):3===n?new ka(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ma(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ma(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=sa.exec(e))?new ka(t[1],t[2],t[3],1):(t=la.exec(e))?new ka(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=ca.exec(e))?ma(t[1],t[2],t[3],t[4]):(t=ua.exec(e))?ma(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=da.exec(e))?Na(t[1],t[2]/100,t[3]/100,1):(t=ha.exec(e))?Na(t[1],t[2]/100,t[3]/100,t[4]):ga.hasOwnProperty(e)?ya(ga[e]):"transparent"===e?new ka(NaN,NaN,NaN,0):null}function ya(e){return new ka(e>>16&255,e>>8&255,255&e,1)}function ma(e,t,n,i){return i<=0&&(e=t=n=NaN),new ka(e,t,n,i)}function ba(e,t,n,i){return 1===arguments.length?((o=e)instanceof ea||(o=va(o)),o?new ka((o=o.rgb()).r,o.g,o.b,o.opacity):new ka):new ka(e,t,n,null==i?1:i);var o}function ka(e,t,n,i){this.r=+e,this.g=+t,this.b=+n,this.opacity=+i}function Ca(){return`#${Pa(this.r)}${Pa(this.g)}${Pa(this.b)}`}function xa(){const e=Ta(this.opacity);return`${1===e?"rgb(":"rgba("}${La(this.r)}, ${La(this.g)}, ${La(this.b)}${1===e?")":`, ${e})`}`}function Ta(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function La(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Pa(e){return((e=La(e))<16?"0":"")+e.toString(16)}function Na(e,t,n,i){return i<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new _a(e,t,n,i)}function Sa(e){if(e instanceof _a)return new _a(e.h,e.s,e.l,e.opacity);if(e instanceof ea||(e=va(e)),!e)return new _a;if(e instanceof _a)return e;var t=(e=e.rgb()).r/255,n=e.g/255,i=e.b/255,o=Math.min(t,n,i),a=Math.max(t,n,i),r=NaN,s=a-o,l=(a+o)/2;return s?(r=t===a?(n-i)/s+6*(n<i):n===a?(i-t)/s+2:(t-n)/s+4,s/=l<.5?a+o:2-a-o,r*=60):s=l>0&&l<1?0:r,new _a(r,s,l,e.opacity)}function _a(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function Ea(e){return(e=(e||0)%360)<0?e+360:e}function Ia(e){return Math.max(0,Math.min(1,e||0))}function Da(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}$o(ea,va,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:pa,formatHex:pa,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Sa(this).formatHsl()},formatRgb:fa,toString:fa}),$o(ka,ba,Qo(ea,{brighter(e){return e=null==e?na:Math.pow(na,e),new ka(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?ta:Math.pow(ta,e),new ka(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ka(La(this.r),La(this.g),La(this.b),Ta(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ca,formatHex:Ca,formatHex8:function(){return`#${Pa(this.r)}${Pa(this.g)}${Pa(this.b)}${Pa(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:xa,toString:xa})),$o(_a,(function(e,t,n,i){return 1===arguments.length?Sa(e):new _a(e,t,n,null==i?1:i)}),Qo(ea,{brighter(e){return e=null==e?na:Math.pow(na,e),new _a(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?ta:Math.pow(ta,e),new _a(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*t,o=2*n-i;return new ka(Da(e>=240?e-240:e+120,o,i),Da(e,o,i),Da(e<120?e+240:e-120,o,i),this.opacity)},clamp(){return new _a(Ea(this.h),Ia(this.s),Ia(this.l),Ta(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Ta(this.opacity);return`${1===e?"hsl(":"hsla("}${Ea(this.h)}, ${100*Ia(this.s)}%, ${100*Ia(this.l)}%${1===e?")":`, ${e})`}`}}));var Oa=e=>()=>e;function wa(e){return 1==(e=+e)?Aa:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(i){return Math.pow(e+i*t,n)}}(t,n,e):Oa(isNaN(t)?n:t)}}function Aa(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Oa(isNaN(e)?t:e)}var Ma=function e(t){var n=wa(t);function i(e,t){var i=n((e=ba(e)).r,(t=ba(t)).r),o=n(e.g,t.g),a=n(e.b,t.b),r=Aa(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=o(t),e.b=a(t),e.opacity=r(t),e+""}}return i.gamma=e,i}(1);function za(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Ua=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ra=new RegExp(Ua.source,"g");function Ha(e,t){var n,i,o,a=Ua.lastIndex=Ra.lastIndex=0,r=-1,s=[],l=[];for(e+="",t+="";(n=Ua.exec(e))&&(i=Ra.exec(t));)(o=i.index)>a&&(o=t.slice(a,o),s[r]?s[r]+=o:s[++r]=o),(n=n[0])===(i=i[0])?s[r]?s[r]+=i:s[++r]=i:(s[++r]=null,l.push({i:r,x:za(n,i)})),a=Ra.lastIndex;return a<t.length&&(o=t.slice(a),s[r]?s[r]+=o:s[++r]=o),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,i=0;i<t;++i)s[(n=l[i]).i]=n.x(e);return s.join("")})}var ja,Fa=180/Math.PI,Ba={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ga(e,t,n,i,o,a){var r,s,l;return(r=Math.sqrt(e*e+t*t))&&(e/=r,t/=r),(l=e*n+t*i)&&(n-=e*l,i-=t*l),(s=Math.sqrt(n*n+i*i))&&(n/=s,i/=s,l/=s),e*i<t*n&&(e=-e,t=-t,l=-l,r=-r),{translateX:o,translateY:a,rotate:Math.atan2(t,e)*Fa,skewX:Math.atan(l)*Fa,scaleX:r,scaleY:s}}function Wa(e,t,n,i){function o(e){return e.length?e.pop()+" ":""}return function(a,r){var s=[],l=[];return a=e(a),r=e(r),function(e,i,o,a,r,s){if(e!==o||i!==a){var l=r.push("translate(",null,t,null,n);s.push({i:l-4,x:za(e,o)},{i:l-2,x:za(i,a)})}else(o||a)&&r.push("translate("+o+t+a+n)}(a.translateX,a.translateY,r.translateX,r.translateY,s,l),function(e,t,n,a){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(o(n)+"rotate(",null,i)-2,x:za(e,t)})):t&&n.push(o(n)+"rotate("+t+i)}(a.rotate,r.rotate,s,l),function(e,t,n,a){e!==t?a.push({i:n.push(o(n)+"skewX(",null,i)-2,x:za(e,t)}):t&&n.push(o(n)+"skewX("+t+i)}(a.skewX,r.skewX,s,l),function(e,t,n,i,a,r){if(e!==n||t!==i){var s=a.push(o(a)+"scale(",null,",",null,")");r.push({i:s-4,x:za(e,n)},{i:s-2,x:za(t,i)})}else 1===n&&1===i||a.push(o(a)+"scale("+n+","+i+")")}(a.scaleX,a.scaleY,r.scaleX,r.scaleY,s,l),a=r=null,function(e){for(var t,n=-1,i=l.length;++n<i;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var Ya=Wa((function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ba:Ga(t.a,t.b,t.c,t.d,t.e,t.f)}),"px, ","px)","deg)"),Ka=Wa((function(e){return null==e?Ba:(ja||(ja=document.createElementNS("http://www.w3.org/2000/svg","g")),ja.setAttribute("transform",e),(e=ja.transform.baseVal.consolidate())?Ga((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Ba)}),", ",")",")");function Xa(e){return((e=Math.exp(e))+1/e)/2}var Va,Za,qa=function e(t,n,i){function o(e,o){var a,r,s=e[0],l=e[1],c=e[2],u=o[0],d=o[1],h=o[2],g=u-s,p=d-l,f=g*g+p*p;if(f<1e-12)r=Math.log(h/c)/t,a=function(e){return[s+e*g,l+e*p,c*Math.exp(t*e*r)]};else{var v=Math.sqrt(f),y=(h*h-c*c+i*f)/(2*c*n*v),m=(h*h-c*c-i*f)/(2*h*n*v),b=Math.log(Math.sqrt(y*y+1)-y),k=Math.log(Math.sqrt(m*m+1)-m);r=(k-b)/t,a=function(e){var i,o=e*r,a=Xa(b),u=c/(n*v)*(a*(i=t*o+b,((i=Math.exp(2*i))-1)/(i+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+u*g,l+u*p,c*a/Xa(t*o+b)]}}return a.duration=1e3*r*t/Math.SQRT2,a}return o.rho=function(t){var n=Math.max(.001,+t),i=n*n;return e(n,i,i*i)},o}(Math.SQRT2,2,4),Ja=0,$a=0,Qa=0,er=1e3,tr=0,nr=0,ir=0,or="object"==typeof performance&&performance.now?performance:Date,ar="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function rr(){return nr||(ar(sr),nr=or.now()+ir)}function sr(){nr=0}function lr(){this._call=this._time=this._next=null}function cr(e,t,n){var i=new lr;return i.restart(e,t,n),i}function ur(){nr=(tr=or.now())+ir,Ja=$a=0;try{!function(){rr(),++Ja;for(var e,t=Va;t;)(e=nr-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ja}()}finally{Ja=0,function(){var e,t,n=Va,i=1/0;for(;n;)n._call?(i>n._time&&(i=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Va=t);Za=e,hr(i)}(),nr=0}}function dr(){var e=or.now(),t=e-tr;t>er&&(ir-=t,tr=e)}function hr(e){Ja||($a&&($a=clearTimeout($a)),e-nr>24?(e<1/0&&($a=setTimeout(ur,e-or.now()-ir)),Qa&&(Qa=clearInterval(Qa))):(Qa||(tr=or.now(),Qa=setInterval(dr,er)),Ja=1,ar(ur)))}function gr(e,t,n){var i=new lr;return t=null==t?0:+t,i.restart((n=>{i.stop(),e(n+t)}),t,n),i}lr.prototype=cr.prototype={constructor:lr,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?rr():+n)+(null==t?0:+t),this._next||Za===this||(Za?Za._next=this:Va=this,Za=this),this._call=e,this._time=n,hr()},stop:function(){this._call&&(this._call=null,this._time=1/0,hr())}};var pr=qi("start","end","cancel","interrupt"),fr=[],vr=0,yr=1,mr=2,br=3,kr=4,Cr=5,xr=6;function Tr(e,t,n,i,o,a){var r=e.__transition;if(r){if(n in r)return}else e.__transition={};!function(e,t,n){var i,o=e.__transition;function a(e){n.state=yr,n.timer.restart(r,n.delay,n.time),n.delay<=e&&r(e-n.delay)}function r(a){var c,u,d,h;if(n.state!==yr)return l();for(c in o)if((h=o[c]).name===n.name){if(h.state===br)return gr(r);h.state===kr?(h.state=xr,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[c]):+c<t&&(h.state=xr,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[c])}if(gr((function(){n.state===br&&(n.state=kr,n.timer.restart(s,n.delay,n.time),s(a))})),n.state=mr,n.on.call("start",e,e.__data__,n.index,n.group),n.state===mr){for(n.state=br,i=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=h);i.length=u+1}}function s(t){for(var o=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=Cr,1),a=-1,r=i.length;++a<r;)i[a].call(e,o);n.state===Cr&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var i in n.state=xr,n.timer.stop(),delete o[t],o)return;delete e.__transition}o[t]=n,n.timer=cr(a,0,n.time)}(e,n,{name:t,index:i,group:o,on:pr,tween:fr,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:vr})}function Lr(e,t){var n=Nr(e,t);if(n.state>vr)throw new Error("too late; already scheduled");return n}function Pr(e,t){var n=Nr(e,t);if(n.state>br)throw new Error("too late; already running");return n}function Nr(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Sr(e,t){var n,i,o,a=e.__transition,r=!0;if(a){for(o in t=null==t?null:t+"",a)(n=a[o]).name===t?(i=n.state>mr&&n.state<Cr,n.state=xr,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete a[o]):r=!1;r&&delete e.__transition}}function _r(e,t){var n,i;return function(){var o=Pr(this,e),a=o.tween;if(a!==n)for(var r=0,s=(i=n=a).length;r<s;++r)if(i[r].name===t){(i=i.slice()).splice(r,1);break}o.tween=i}}function Er(e,t,n){var i,o;if("function"!=typeof n)throw new Error;return function(){var a=Pr(this,e),r=a.tween;if(r!==i){o=(i=r).slice();for(var s={name:t,value:n},l=0,c=o.length;l<c;++l)if(o[l].name===t){o[l]=s;break}l===c&&o.push(s)}a.tween=o}}function Ir(e,t,n){var i=e._id;return e.each((function(){var e=Pr(this,i);(e.value||(e.value={}))[t]=n.apply(this,arguments)})),function(e){return Nr(e,i).value[t]}}function Dr(e,t){var n;return("number"==typeof t?za:t instanceof va?Ma:(n=va(t))?(t=n,Ma):Ha)(e,t)}function Or(e){return function(){this.removeAttribute(e)}}function wr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ar(e,t,n){var i,o,a=n+"";return function(){var r=this.getAttribute(e);return r===a?null:r===i?o:o=t(i=r,n)}}function Mr(e,t,n){var i,o,a=n+"";return function(){var r=this.getAttributeNS(e.space,e.local);return r===a?null:r===i?o:o=t(i=r,n)}}function zr(e,t,n){var i,o,a;return function(){var r,s,l=n(this);if(null!=l)return(r=this.getAttribute(e))===(s=l+"")?null:r===i&&s===o?a:(o=s,a=t(i=r,l));this.removeAttribute(e)}}function Ur(e,t,n){var i,o,a;return function(){var r,s,l=n(this);if(null!=l)return(r=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:r===i&&s===o?a:(o=s,a=t(i=r,l));this.removeAttributeNS(e.space,e.local)}}function Rr(e,t){var n,i;function o(){var o=t.apply(this,arguments);return o!==i&&(n=(i=o)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,o)),n}return o._value=t,o}function Hr(e,t){var n,i;function o(){var o=t.apply(this,arguments);return o!==i&&(n=(i=o)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,o)),n}return o._value=t,o}function jr(e,t){return function(){Lr(this,e).delay=+t.apply(this,arguments)}}function Fr(e,t){return t=+t,function(){Lr(this,e).delay=t}}function Br(e,t){return function(){Pr(this,e).duration=+t.apply(this,arguments)}}function Gr(e,t){return t=+t,function(){Pr(this,e).duration=t}}var Wr=An.prototype.constructor;function Yr(e){return function(){this.style.removeProperty(e)}}var Kr=0;function Xr(e,t,n,i){this._groups=e,this._parents=t,this._name=n,this._id=i}function Vr(){return++Kr}var Zr=An.prototype;Xr.prototype={constructor:Xr,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Et(e));for(var i=this._groups,o=i.length,a=new Array(o),r=0;r<o;++r)for(var s,l,c=i[r],u=c.length,d=a[r]=new Array(u),h=0;h<u;++h)(s=c[h])&&(l=e.call(s,s.__data__,h,c))&&("__data__"in s&&(l.__data__=s.__data__),d[h]=l,Tr(d[h],t,n,h,d,Nr(s,n)));return new Xr(a,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Ot(e));for(var i=this._groups,o=i.length,a=[],r=[],s=0;s<o;++s)for(var l,c=i[s],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var h,g=e.call(l,l.__data__,d,c),p=Nr(l,n),f=0,v=g.length;f<v;++f)(h=g[f])&&Tr(h,t,n,f,g,p);a.push(g),r.push(l)}return new Xr(a,r,t,n)},selectChild:Zr.selectChild,selectChildren:Zr.selectChildren,filter:function(e){"function"!=typeof e&&(e=wt(e));for(var t=this._groups,n=t.length,i=new Array(n),o=0;o<n;++o)for(var a,r=t[o],s=r.length,l=i[o]=[],c=0;c<s;++c)(a=r[c])&&e.call(a,a.__data__,c,r)&&l.push(a);return new Xr(i,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,i=t.length,o=n.length,a=Math.min(i,o),r=new Array(i),s=0;s<a;++s)for(var l,c=t[s],u=n[s],d=c.length,h=r[s]=new Array(d),g=0;g<d;++g)(l=c[g]||u[g])&&(h[g]=l);for(;s<i;++s)r[s]=t[s];return new Xr(r,this._parents,this._name,this._id)},selection:function(){return new Wr(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Vr(),i=this._groups,o=i.length,a=0;a<o;++a)for(var r,s=i[a],l=s.length,c=0;c<l;++c)if(r=s[c]){var u=Nr(r,t);Tr(r,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Xr(i,this._parents,e,n)},call:Zr.call,nodes:Zr.nodes,node:Zr.node,size:Zr.size,empty:Zr.empty,each:Zr.each,on:function(e,t){var n=this._id;return arguments.length<2?Nr(this.node(),n).on.on(e):this.each(function(e,t,n){var i,o,a=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?Lr:Pr;return function(){var r=a(this,e),s=r.on;s!==i&&(o=(i=s).copy()).on(t,n),r.on=o}}(n,e,t))},attr:function(e,t){var n=Lt(e),i="transform"===n?Ka:Dr;return this.attrTween(e,"function"==typeof t?(n.local?Ur:zr)(n,i,Ir(this,"attr."+e,t)):null==t?(n.local?wr:Or)(n):(n.local?Mr:Ar)(n,i,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var i=Lt(e);return this.tween(n,(i.local?Rr:Hr)(i,t))},style:function(e,t,n){var i="transform"==(e+="")?Ya:Dr;return null==t?this.styleTween(e,function(e,t){var n,i,o;return function(){var a=nn(this,e),r=(this.style.removeProperty(e),nn(this,e));return a===r?null:a===n&&r===i?o:o=t(n=a,i=r)}}(e,i)).on("end.style."+e,Yr(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var i,o,a;return function(){var r=nn(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=nn(this,e)),r===l?null:r===i&&l===o?a:(o=l,a=t(i=r,s))}}(e,i,Ir(this,"style."+e,t))).each(function(e,t){var n,i,o,a,r="style."+t,s="end."+r;return function(){var l=Pr(this,e),c=l.on,u=null==l.value[r]?a||(a=Yr(t)):void 0;c===n&&o===u||(i=(n=c).copy()).on(s,o=u),l.on=i}}(this._id,e)):this.styleTween(e,function(e,t,n){var i,o,a=n+"";return function(){var r=nn(this,e);return r===a?null:r===i?o:o=t(i=r,n)}}(e,i,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(null==t)return this.tween(i,null);if("function"!=typeof t)throw new Error;return this.tween(i,function(e,t,n){var i,o;function a(){var a=t.apply(this,arguments);return a!==o&&(i=(o=a)&&function(e,t,n){return function(i){this.style.setProperty(e,t.call(this,i),n)}}(e,a,n)),i}return a._value=t,a}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(Ir(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function i(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&function(e){return function(t){this.textContent=e.call(this,t)}}(i)),t}return i._value=e,i}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var i,o=Nr(this.node(),n).tween,a=0,r=o.length;a<r;++a)if((i=o[a]).name===e)return i.value;return null}return this.each((null==t?_r:Er)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?jr:Fr)(t,e)):Nr(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Br:Gr)(t,e)):Nr(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Pr(this,e).ease=t}}(t,e)):Nr(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;Pr(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,i=n._id,o=n.size();return new Promise((function(a,r){var s={value:r},l={value:function(){0==--o&&a()}};n.each((function(){var n=Pr(this,i),o=n.on;o!==e&&((t=(e=o).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t})),0===o&&a()}))},[Symbol.iterator]:Zr[Symbol.iterator]};var qr={time:null,delay:0,duration:250,ease:yo};function Jr(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}An.prototype.interrupt=function(e){return this.each((function(){Sr(this,e)}))},An.prototype.transition=function(e){var t,n;e instanceof Xr?(t=e._id,e=e._name):(t=Vr(),(n=qr).time=rr(),e=null==e?null:e+"");for(var i=this._groups,o=i.length,a=0;a<o;++a)for(var r,s=i[a],l=s.length,c=0;c<l;++c)(r=s[c])&&Tr(r,e,t,c,s,n||Jr(r,t));return new Xr(i,this._parents,e,t)};var $r=function(e){return function(){return e}};function Qr(e,t){var n=t.sourceEvent,i=t.target,o=t.transform,a=t.dispatch;Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:a}})}function es(e,t,n){this.k=e,this.x=t,this.y=n}es.prototype={constructor:es,scale:function(e){return 1===e?this:new es(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new es(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ts=new es(1,0,0);function ns(e){for(;!e.__zoom;)if(!(e=e.parentNode))return ts;return e.__zoom}function is(e){e.stopImmediatePropagation()}function os(e){e.preventDefault(),e.stopImmediatePropagation()}function as(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function rs(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function ss(){return this.__zoom||ts}function ls(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function cs(){return navigator.maxTouchPoints||"ontouchstart"in this}function us(e,t,n){var i=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],r=e.invertY(t[1][1])-n[1][1];return e.translate(o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o),r>a?(a+r)/2:Math.min(0,a)||Math.max(0,r))}ns.prototype=es.prototype;var ds=Object.freeze({__proto__:null,zoom:function(){var e,t,n,i=as,o=rs,a=us,r=ls,s=cs,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=qa,h=qi("start","zoom","end"),g=500,p=150,f=0,v=10,y=!1,m=!1;function b(e){e.property("__zoom",ss).on("wheel.zoom",N).on("mousedown.zoom",I).on("dblclick.zoom",D).on("gesturestart",S).on("gesturechange",_).on("gestureend",E).filter(s).on("touchstart.zoom",O).on("touchmove.zoom",w).on("touchend.zoom touchcancel.zoom",A).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function k(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new es(t,e.x,e.y)}function C(e,t,n){var i=t[0]-n[0]*e.k,o=t[1]-n[1]*e.k;return i===e.x&&o===e.y?e:new es(e.k,i,o)}function x(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function T(e,t,n,i){e.on("start.zoom",(function(){L(this,arguments).event(i).start()})).on("interrupt.zoom end.zoom",(function(){L(this,arguments).event(i).end()})).tween("zoom",(function(){var e=this,a=arguments,r=L(e,a).event(i),s=o.apply(e,a),l=null==n?x(s):"function"==typeof n?n.apply(e,a):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=e.__zoom,h="function"==typeof t?t.apply(e,a):t,g=d(u.invert(l).concat(c/u.k),h.invert(l).concat(c/h.k));return function(e){if(1===e)e=h;else{var t=g(e),n=c/t[2];e=new es(n,l[0]-t[0]*n,l[1]-t[1]*n)}r.zoom(null,e)}}))}function L(e,t,n){return!n&&e.__zooming||new P(e,t)}function P(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,t),this.taps=0}function N(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];if(m&&os(e),i.apply(this,arguments)){var s=L(this,n).event(e),u=this.__zoom,d=Math.max(l[0],Math.min(l[1],u.k*Math.pow(2,r.apply(this,arguments)))),h=jn(e);if(s.wheel)s.mouse[0][0]===h[0]&&s.mouse[0][1]===h[1]||(s.mouse[1]=u.invert(s.mouse[0]=h)),clearTimeout(s.wheel);else{if(u.k===d)return;!y||e.ctrlKey||e.safariPinchZoom||(s.wheelTransX=-u.x,s.wheelTransY=-u.y),s.mouse=[h,u.invert(h)],Sr(this),s.start()}if(os(e),s.wheel=setTimeout((function(){s.wheel=null,s.end()}),p),!y||e.ctrlKey||e.safariPinchZoom)s.zoom("mouse",a(C(k(u,d),s.mouse[0],s.mouse[1]),s.extent,c));else{s.wheelTransX+=e.deltaX,s.wheelTransY+=e.deltaY;var g=[u.x,u.y],f=[u.x+s.wheelTransX,u.y+s.wheelTransY];s.zoom("mouse",a(C(u,g,f),s.extent,c))}}}function S(e){os(e),this.scale=e.scale}function _(e){os(e),this.__zoom&&(e.deltaY=100*(this.scale-e.scale),this.scale=e.scale),e.safariPinchZoom=!0,N.apply(this,[e].concat(Array.prototype.slice.call(arguments)))}function E(e){os(e)}function I(e){for(var t=arguments.length,o=new Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];if(!n&&i.apply(this,arguments)){var s=L(this,o,!0).event(e),l=Mn(e.view).on("mousemove.zoom",(function(e){if(os(e),!s.moved){var t=e.clientX-h,n=e.clientY-g;s.moved=t*t+n*n>f}s.event(e).zoom("mouse",a(C(s.that.__zoom,s.mouse[0]=jn(e,d),s.mouse[1]),s.extent,c))}),!0).on("mouseup.zoom",(function(e){l.on("mousemove.zoom mouseup.zoom",null),ao(e.view,s.moved),os(e),s.event(e).end()}),!0),u=jn(e,d),d=e.currentTarget,h=e.clientX,g=e.clientY;oo(e.view),is(e),s.mouse=[u,this.__zoom.invert(u)],Sr(this),s.start()}}function D(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(i.apply(this,arguments)){var s=this.__zoom,l=jn(e.changedTouches?e.changedTouches[0]:e,this),d=s.invert(l),h=s.k*(e.shiftKey?.5:2),g=a(C(k(s,h),l,d),o.apply(this,n),c);os(e),u>0?Mn(this).transition().duration(u).call(T,g,l,e):Mn(this).call(b.transform,g,l,e)}}function O(n){for(var o=arguments.length,a=new Array(o>1?o-1:0),r=1;r<o;r++)a[r-1]=arguments[r];if(i.apply(this,arguments)){var s,l,c,u,d=n.touches,h=d.length,p=L(this,a,n.changedTouches.length===h).event(n);for(is(n),l=0;l<h;++l)u=[u=jn(c=d[l],this),this.__zoom.invert(u),c.identifier],p.touch0?p.touch1||p.touch0[2]===u[2]||(p.touch1=u,p.taps=0):(p.touch0=u,s=!0,p.taps=1+!!e);e&&(e=clearTimeout(e)),s&&(p.taps<2&&(t=u[0],e=setTimeout((function(){e=null}),g)),Sr(this),p.start())}}function w(e){if(this.__zooming){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var o,r,s,l,u=L(this,n).event(e),d=e.changedTouches,h=d.length;for(os(e),o=0;o<h;++o)s=jn(r=d[o],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=s:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=s);if(r=u.that.__zoom,u.touch1){var g=u.touch0[0],p=u.touch0[1],f=u.touch1[0],v=u.touch1[1],y=(y=f[0]-g[0])*y+(y=f[1]-g[1])*y,m=(m=v[0]-p[0])*m+(m=v[1]-p[1])*m;r=k(r,Math.sqrt(y/m)),s=[(g[0]+f[0])/2,(g[1]+f[1])/2],l=[(p[0]+v[0])/2,(p[1]+v[1])/2]}else{if(!u.touch0)return;s=u.touch0[0],l=u.touch0[1]}u.zoom("touch",a(C(r,s,l),u.extent,c))}}function A(e){for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(this.__zooming){var r,s,l=L(this,o).event(e),c=e.changedTouches,u=c.length;for(is(e),n&&clearTimeout(n),n=setTimeout((function(){n=null}),g),r=0;r<u;++r)s=c[r],l.touch0&&l.touch0[2]===s.identifier?delete l.touch0:l.touch1&&l.touch1[2]===s.identifier&&delete l.touch1;if(l.touch1&&!l.touch0&&(l.touch0=l.touch1,delete l.touch1),l.touch0)l.touch0[1]=this.__zoom.invert(l.touch0[0]);else if(l.end(),2===l.taps&&(s=jn(s,this),Math.hypot(t[0]-s[0],t[1]-s[1])<v)){var d=Mn(this).on("dblclick.zoom");d&&d.apply(this,arguments)}}}return b.transform=function(e,t,n,i){var o=e.selection?e.selection():e;o.property("__zoom",ss),e!==o?T(e,t,n,i):o.interrupt().each((function(){L(this,arguments).event(i).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()}))},b.scaleBy=function(e,t,n,i){b.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)}),n,i)},b.scaleTo=function(e,t,n,i){b.transform(e,(function(){var e=o.apply(this,arguments),i=this.__zoom,r=null==n?x(e):"function"==typeof n?n.apply(this,arguments):n,s=i.invert(r),l="function"==typeof t?t.apply(this,arguments):t;return a(C(k(i,l),r,s),e,c)}),n,i)},b.translateBy=function(e,t,n,i){b.transform(e,(function(){return a(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),o.apply(this,arguments),c)}),null,i)},b.translateTo=function(e,t,n,i,r){b.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,s=null==i?x(e):"function"==typeof i?i.apply(this,arguments):i;return a(ts.translate(s[0],s[1]).scale(r.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)}),i,r)},P.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=Mn(this.that).datum();h.call(e,this.that,new Qr(e,{sourceEvent:this.sourceEvent,target:b,type:e,transform:this.that.__zoom,dispatch:h}),t)}},b.wheelDelta=function(e){return arguments.length?(r="function"==typeof e?e:$r(+e),b):r},b.filter=function(e){return arguments.length?(i="function"==typeof e?e:$r(!!e),b):i},b.touchable=function(e){return arguments.length?(s="function"==typeof e?e:$r(!!e),b):s},b.extent=function(e){return arguments.length?(o="function"==typeof e?e:$r([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),b):o},b.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],b):[l[0],l[1]]},b.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],b):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},b.constrain=function(e){return arguments.length?(a=e,b):a},b.trackpad=function(e){return arguments.length?(y=e,b):y},b.preventBackGesture=function(e){return arguments.length?(m=e,b):m},b.duration=function(e){return arguments.length?(u=+e,b):u},b.interpolate=function(e){return arguments.length?(d=e,b):d},b.on=function(){var e=h.on.apply(h,arguments);return e===h?b:e},b.clickDistance=function(e){return arguments.length?(f=(e=+e)*e,b):Math.sqrt(f)},b.tapDistance=function(e){return arguments.length?(v=+e,b):v},b},zoomTransform:ns,zoomIdentity:ts});function hs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function gs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?hs(Object(n),!0).forEach((function(t){u._defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):hs(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ps=Object.assign({},Fn,ds),fs=function(){return e._createClass((function t(n){var i=this;e._classCallCheck(this,t),this.ren=n,this.logger=new g.Logger("SVGCanvasUtilsZoom"),this.minScaleExtent=.2,this.maxScaleExtent=1.8,this.contextMenuClosedOnZoom=!1,this.textEditingClosedOnZoom=!1,this.regionSelect=!1,this.zoomStartPoint={x:0,y:0,k:0,startX:0,startY:0},this.previousD3Event={},this.zoomCanvasDimensions={},this.regionStartTransformX=0,this.regionStartTransformY=0,this.zoomTransform=ps.zoomIdentity.translate(0,0).scale(1),this.zooming=!1,this.zoomingAction=!1,this.spaceKeyPressed=!1,this.zoomHandler=ps.zoom().trackpad(this.ren.config.enableInteractionType===u.INTERACTION_TRACKPAD).preventBackGesture(!0).wheelDelta((function(e){return-e.deltaY*(i.ren.config.enableInteractionType===u.INTERACTION_TRACKPAD?.02:.002)})).scaleExtent([this.minScaleExtent,this.maxScaleExtent]).on("start",this.zoomStart.bind(this)).on("zoom",this.zoomAction.bind(this)).on("end",this.zoomEnd.bind(this))}),[{key:"setSpaceKeyPressed",value:function(e){this.spaceKeyPressed=e}},{key:"isSpaceKeyPressed",value:function(){return this.spaceKeyPressed}},{key:"getZoomHandler",value:function(){return this.zoomHandler}},{key:"getZoomTransform",value:function(){return this.zoomTransform}},{key:"getZoom",value:function(){return gs({},this.zoomTransform)}},{key:"getZoomScale",value:function(){return this.zoomTransform.k}},{key:"resetZoomTransform",value:function(){this.zoomTransform=ps.zoomIdentity.translate(0,0).scale(1)}},{key:"zoomTo",value:function(e,t){var n=void 0===t?500:t;this.zoomCanvasInvokeZoomBehavior(e,n)}},{key:"translateBy",value:function(e,t,n){var i=this.getZoomTransform(),o=ps.zoomIdentity.translate(i.x+e,i.y+t).scale(i.k);this.zoomCanvasInvokeZoomBehavior(o,n)}},{key:"zoomIn",value:function(){if(this.zoomTransform.k<this.maxScaleExtent){var e=Math.min(1.1*this.zoomTransform.k,this.maxScaleExtent);this.ren.canvasSVG.call(this.zoomHandler.scaleTo,e)}}},{key:"zoomOut",value:function(){if(this.zoomTransform.k>this.minScaleExtent){var e=Math.max(this.zoomTransform.k/1.1,this.minScaleExtent);this.ren.canvasSVG.call(this.zoomHandler.scaleTo,e)}}},{key:"isZoomedToMax",value:function(){return!!this.zoomTransform&&this.zoomTransform.k===this.maxScaleExtent}},{key:"isZoomedToMin",value:function(){return!!this.zoomTransform&&this.zoomTransform.k===this.minScaleExtent}},{key:"setMaxZoomExtent",value:function(e){if(!this.zooming){var t=this.maxScaleExtent*e;this.zoomHandler=this.zoomHandler.scaleExtent([this.minScaleExtent,t]),this.ren.resetCanvasSVGBehaviors()}}},{key:"transformPos",value:function(e){return{x:(e.x-this.zoomTransform.x)/this.zoomTransform.k,y:(e.y-this.zoomTransform.y)/this.zoomTransform.k}}},{key:"unTransformPos",value:function(e){return{x:e.x*this.zoomTransform.k+this.zoomTransform.x,y:e.y*this.zoomTransform.k+this.zoomTransform.y}}},{key:"getTransformedRect",value:function(e,t){var n=t/this.zoomTransform.k;return{x:-this.zoomTransform.x/this.zoomTransform.k+n,y:-this.zoomTransform.y/this.zoomTransform.k+n,height:e.height/this.zoomTransform.k-2*n,width:e.width/this.zoomTransform.k-2*n}}},{key:"zoomStart",value:function(e){var t=this;this.logger.log("zoomStart - "+JSON.stringify(e.transform)),this.ren.canvasController.closeTip(),this.zooming=!0,this.ren.canvasController.isContextMenuDisplayed()&&!this.ren.dispUtils.isDisplayingSubFlowInPlace()&&(this.ren.canvasController.closeContextMenu(),this.contextMenuClosedOnZoom=!0),this.ren.svgCanvasTextArea.isEditingText()&&(this.textEditingClosedOnZoom=!0),this.regionSelect=this.isRegionSelectActivated(e),this.regionSelect?(this.addingCursorOverlay=setTimeout((function(){return t.ren.addTempCursorOverlay("crosshair")}),200),this.regionStartTransformX=e.transform.x,this.regionStartTransformY=e.transform.y):this.isDragActivated(e)?this.addingCursorOverlay=setTimeout((function(){return t.ren.addTempCursorOverlay("grabbing")}),200):this.addingCursorOverlay=setTimeout((function(){return t.ren.addTempCursorOverlay("default")}),200);var n=this.ren.getTransformedMousePos(e);this.zoomStartPoint={x:e.transform.x,y:e.transform.y,k:e.transform.k,startX:n.x,startY:n.y},this.previousD3Event=gs({},e.transform),this.zoomCanvasDimensions=this.getCanvasDimensions()}},{key:"zoomAction",value:function(e){this.logger.log("zoomAction - "+JSON.stringify(e.transform)),e.transform.k===this.zoomStartPoint.k?this.regionSelect?this.drawRegionSelector(e):this.zoomCanvasBackground(e):(this.ren.addTempCursorOverlay("default"),this.zoomCanvasBackground(e),this.ren.repositionCommentToolbar())}},{key:"zoomEnd",value:function(e){this.logger.log("zoomEnd - "+JSON.stringify(e.transform)),clearTimeout(this.addingCursorOverlay);var t=this.ren.getTransformedMousePos(e);t.x!==this.zoomStartPoint.startX||t.y!==this.zoomStartPoint.startY||this.zoomChanged()?this.regionSelect?this.zoomEndRegionSelect(e):this.ren.dispUtils.isDisplayingFullPage()&&this.zoomChanged()&&this.zoomSave():this.zoomClick(e),this.ren.resetCanvasCursor(e),this.ren.removeTempCursorOverlay(),this.contextMenuClosedOnZoom=!1,this.textEditingClosedOnZoom=!1,this.regionSelect=!1,this.zooming=!1}},{key:"zoomChanged",value:function(){return this.zoomTransform.k!==this.zoomStartPoint.k||this.zoomTransform.x!==this.zoomStartPoint.x||this.zoomTransform.y!==this.zoomStartPoint.y}},{key:"isDragActivated",value:function(e){return this.ren.config.enableInteractionType===u.INTERACTION_CARBON?this.isSpaceKeyPressed():e&&e.sourceEvent&&!e.sourceEvent.shiftKey}},{key:"isRegionSelectActivated",value:function(e){return!this.zoomingAction&&(!!(this.ren.config.enableInteractionType===u.INTERACTION_MOUSE&&e&&e.sourceEvent&&e.sourceEvent.shiftKey)||(this.ren.config.enableInteractionType===u.INTERACTION_CARBON&&!this.isSpaceKeyPressed()||!(this.ren.config.enableInteractionType!==u.INTERACTION_TRACKPAD||!e.sourceEvent||1!==e.sourceEvent.buttons||this.isSpaceKeyPressed())))}},{key:"drawRegionSelector",value:function(e){this.removeRegionSelector();var t=this.getRegionDimensions(e),n=t.x,i=t.y,o=t.width,a=t.height;this.ren.canvasGrp.append("rect").attr("width",o).attr("height",a).attr("x",n).attr("y",i).attr("class","d3-region-selector")}},{key:"zoomEndRegionSelect",value:function(e){this.removeRegionSelector(),e.transform.x=this.regionStartTransformX,e.transform.y=this.regionStartTransformY,this.ren.selectObjsInRegion(this.getRegionDimensions(e))}},{key:"removeRegionSelector",value:function(){this.ren.canvasGrp.selectAll(".d3-region-selector").remove()}},{key:"getRegionDimensions",value:function(e){var t=this.ren.getTransformedMousePos(e),n=this.zoomStartPoint.startX,i=this.zoomStartPoint.startY,o=t.x-n,a=t.y-i;return o<0&&(n-=o=Math.abs(o)),a<0&&(i-=a=Math.abs(a)),{x:n,y:i,width:o,height:a}}},{key:"zoomCanvasBackground",value:function(e){if(this.regionSelect=!1,this.ren.dispUtils.isDisplayingPrimaryFlowFullPage()){var t=this.getTransformIncrement(e);this.zoomTransform=this.zoomConstrainRegular(t,this.getViewportDimensions(),this.zoomCanvasDimensions)}else this.zoomTransform=ps.zoomIdentity.translate(e.transform.x,e.transform.y).scale(e.transform.k);this.ren.canvasGrp.attr("transform",this.zoomTransform),this.ren.displayCanvasAccoutrements()}},{key:"zoomClick",value:function(e){var t,n,i;this.ren.dispUtils.isDisplayingCurrentPipeline()&&!this.contextMenuClosedOnZoom&&!this.textEditingClosedOnZoom&&(this.ren.config.enableEditingActions||null!==(t=e.sourceEvent)&&void 0!==t&&null!==(n=t.target)&&void 0!==n&&null!==(i=n.classList)&&void 0!==i&&i.contains("d3-svg-background"))&&this.ren.canvasController.clearSelections()}},{key:"zoomSave",value:function(){this.ren.canvasSVG.property("__zoom",this.zoomTransform);var e={editType:"setZoom",editSource:"canvas",zoom:this.zoomTransform,pipelineId:this.ren.activePipeline.id};this.ren.canvasController.editActionHandler(e)}},{key:"getTransformIncrement",value:function(e){var t=e.transform.x-this.previousD3Event.x,n=e.transform.y-this.previousD3Event.y,i={x:this.zoomTransform.x+t,y:this.zoomTransform.y+n,k:e.transform.k};return this.previousD3Event=gs({},e.transform),i}},{key:"zoomConstrainRegular",value:function(e,t,n){if(!n)return this.zoomTransform;var i=e.k,o=e.x,a=e.y,r=this.convertRectAdjustedForScaleWithPadding(n,i,this.getZoomToFitPadding()),s=t.width-Math.min(.25*t.width,.25*r.width),l=-Math.max(r.width-.25*t.width,.75*r.width),c=t.height-Math.min(.25*t.height,.25*r.height),u=-Math.max(r.height-.25*t.height,.75*r.height);return o>-r.left+s?o=-r.left+s:o<-r.left+l&&(o=-r.left+l),a>-r.top+c?a=-r.top+c:a<-r.top+u&&(a=-r.top+u),ps.zoomIdentity.translate(o,a).scale(i)}},{key:"restoreZoom",value:function(){var e=this.ren.canvasController.getSavedZoom(this.ren.activePipeline.id);if(!e&&this.ren.config.enablePanIntoViewOnOpen){var t=this.getCanvasDimensionsWithPadding();t&&(e={x:-t.left,y:-t.top,k:1})}!e&&this.ren.canvasLayout.initialPanX&&this.ren.canvasLayout.initialPanY&&(e={x:this.ren.canvasLayout.initialPanX,y:this.ren.canvasLayout.initialPanY,k:1}),!e||e.k===this.zoomTransform.k&&e.x===this.zoomTransform.x&&e.y===this.zoomTransform.y||this.zoomCanvasInvokeZoomBehavior(e)}},{key:"zoomCanvasInvokeZoomBehavior",value:function(e,t){if(isFinite(e.x)&&isFinite(e.y)&&isFinite(e.k)&&this.zoomHasChanged(e)){this.zoomingAction=!0;var n=ps.zoomIdentity.translate(e.x,e.y).scale(e.k);t?this.ren.canvasSVG.call(this.zoomHandler).transition().duration(t).call(this.zoomHandler.transform,n):this.ren.canvasSVG.call(this.zoomHandler.transform,n),this.zoomingAction=!1}}},{key:"zoomHasChanged",value:function(e){return e.k!==this.zoomTransform.k||e.x!==this.zoomTransform.x||e.y!==this.zoomTransform.y}},{key:"zoomToFit",value:function(){var e=this.getCanvasDimensionsWithPadding(),t=this.getViewportDimensions();if(e){var n=t.width/e.width,i=t.height/e.height,o=Math.min(n,i,1),a=(t.width-e.width*o)/2,r=(t.height-e.height*o)/2;a-=o*e.left,r-=o*e.top,this.zoomCanvasInvokeZoomBehavior({x:a,y:r,k:o})}}},{key:"getZoomToReveal",value:function(e,t,n){var i=this.getTransformedViewportDimensions(),o=this.ren.activePipeline.getNodes(e),a=this.ren.activePipeline.getComments(e),r=this.ren.activePipeline.getLinks(e);if(o.length>0||a.length>0||r.length>0){var s,l,c=v.CanvasUtils.getCanvasDimensions(o,a,r,0,0,!0),u=this.convertRectAdjustedForScaleWithPadding(c,1,10),d=parseInt(t,10),h=void 0===n?d:parseInt(n,10);if(u)if(Number.isNaN(d)||Number.isNaN(h)?(u.right>i.x+i.width&&(s=i.x+i.width-u.right),u.left<i.x&&(s=i.x-u.left),u.bottom>i.y+i.height&&(l=i.y+i.height-u.bottom),u.top<i.y&&(l=i.y-u.top)):(s=i.x+i.width*(d/100)-(u.left+u.width/2),l=i.y+i.height*(h/100)-(u.top+u.height/2)),void 0!==s||void 0!==l)return{x:this.zoomTransform.x+(s||0)*this.zoomTransform.k||0,y:this.zoomTransform.y+(l||0)*this.zoomTransform.k||0,k:this.zoomTransform.k}}return null}},{key:"getMaxZoomToFitPaddingForConnections",value:function(){var e=this.getMaxPaddingForConnectionsFromInputBindingNodes(),t=this.getMaxPaddingForConnectionsToOutputBindingNodes();return Math.max(e,t)}},{key:"getMaxPaddingForConnectionsFromInputBindingNodes",value:function(){var e=this,t=0;return this.ren.activePipeline.nodes.filter((function(e){return e.isSupernodeInputBinding})).forEach((function(n){var i=v.CanvasUtils.getNodePaddingToTargetNodes(n,e.ren.activePipeline.nodes,e.ren.activePipeline.links,e.ren.canvasLayout.linkType);t=Math.max(t,i)})),t}},{key:"getMaxPaddingForConnectionsToOutputBindingNodes",value:function(){var e=this,t=0,n=this.ren.activePipeline.nodes.filter((function(e){return e.isSupernodeOutputBinding}));return this.ren.activePipeline.nodes.forEach((function(i){var o=v.CanvasUtils.getNodePaddingToTargetNodes(i,n,e.ren.activePipeline.links,e.ren.canvasLayout.linkType);t=Math.max(t,o)})),t}},{key:"getTransformedViewportDimensions",value:function(){var e=this.getViewportDimensions();return this.getTransformedRect(e,0)}},{key:"getViewportDimensions",value:function(){var e={};if(this.ren.dispUtils.isDisplayingSubFlowInPlace()){var t=this.ren.getParentSupernodeSVGDimensions();e.width=t.width,e.height=t.height}else e=this.ren.canvasSVG&&this.ren.canvasSVG.node()?this.ren.canvasSVG.node().getBoundingClientRect():{x:0,y:0,width:1100,height:640};return e}},{key:"getCanvasDimensionsWithPadding",value:function(){return this.getCanvasDimensions(this.getZoomToFitPadding())}},{key:"getCanvasDimensions",value:function(e){var t=this.ren.canvasLayout.commentHighlightGap,n=this.ren.activePipeline.getCanvasDimensions(t);return this.convertRectAdjustedForScaleWithPadding(n,1,e)}},{key:"convertRectAdjustedForScaleWithPadding",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return e?{left:e.left*t-n,top:e.top*t-n,right:e.right*t+n,bottom:e.bottom*t+n,width:e.width*t+2*n,height:e.height*t+2*n}:null}},{key:"getZoomToFitPadding",value:function(){var e=this.ren.canvasLayout.zoomToFitPadding;if(this.ren.dispUtils.isDisplayingSubFlow()){var t=this.getMaxZoomToFitPaddingForConnections()+2*this.ren.canvasLayout.supernodeBindingPortRadius;e=Math.max(e,t)}return e}}])}(),vs=function(){return e._createClass((function t(n,i,o){e._classCallCheck(this,t),this.logger=new g.Logger("SVGCanvasActivePipeline"),this.logger.log("constructor - start"),this.initialize(n,i,o),this.logger.log("constructor - end")}),[{key:"initialize",value:function(e,t,n){this.logger.logStartTimer("initialize"),this.canvasInfo=t,this.selections=n.pipelineId===e?n.selections:[],this.pipeline=this.getPipeline(e,t),this.id=this.pipeline.id,this.zoom=this.pipeline.zoom,this.nodes=this.pipeline.nodes,this.comments=this.pipeline.comments,this.links=this.pipeline.links,this.mappedNodes=this.getMappedArray(this.pipeline.nodes),this.mappedComments=this.getMappedArray(this.pipeline.comments),this.mappedLinks=this.getMappedArray(this.pipeline.links),this.pipeline=this.preProcessPipeline(this.pipeline),this.logger.logEndTimer("initialize")}},{key:"getCanvasDimensions",value:function(e){return v.CanvasUtils.getCanvasDimensions(this.pipeline.nodes,this.pipeline.comments,this.pipeline.links,e)}},{key:"getObjectTypeName",value:function(e){return this.getComment(e.id)?"comment":this.getNode(e.id)?"node":"link"}},{key:"getNode",value:function(e){var t=this.mappedNodes[e];return void 0===t?null:t}},{key:"getNodes",value:function(e){var t=this;if(!e)return this.pipeline.nodes;var n=[];return e.forEach((function(e){var i=t.getNode(e);i&&n.push(i)})),n}},{key:"getSupernodes",value:function(){return this.pipeline.nodes.filter((function(e){return v.CanvasUtils.isSupernode(e)}))}},{key:"isEmptyOrBindingsOnly",value:function(){return(l.isEmpty_1(this.pipeline.nodes)||this.containsOnlyBindingNodes())&&l.isEmpty_1(this.pipeline.comments)&&l.isEmpty_1(this.pipeline.links)}},{key:"containsOnlyBindingNodes",value:function(){return!this.pipeline.nodes.find((function(e){return!v.CanvasUtils.isSuperBindingNode(e)}))}},{key:"getComment",value:function(e){var t=this.mappedComments[e];return void 0===t?null:t}},{key:"getComments",value:function(e){var t=this,n=[];return e.forEach((function(e){var i=t.getComment(e);i&&n.push(i)})),n}},{key:"getNodesAndComments",value:function(){return this.pipeline.nodes.concat(this.pipeline.comments)}},{key:"getNodeOrComment",value:function(e){var t=this.getNode(e);return null===t&&(t=this.getComment(e)),t}},{key:"getLink",value:function(e){var t=this.mappedLinks[e];return void 0===t?null:t}},{key:"getLinks",value:function(e){var t=this,n=[];return e.forEach((function(e){var i=t.getLink(e);i&&n.push(i)})),n}},{key:"replaceLink",value:function(e){var t=this.pipeline.links.findIndex((function(t){return t.id===e.id}));this.pipeline.links.splice(t,1,e),this.mappedLinks=this.getMappedArray(this.pipeline.links)}},{key:"getPipeline",value:function(e,t){var n=t.pipelines.find((function(t){return t.id===e}));return n||{id:e,nodes:[],comments:[],links:[]}}},{key:"preProcessPipeline",value:function(e){var t=this;return this.setAllPortsDisconnected(e),e.links.forEach((function(e){e.type===u.COMMENT_LINK?(e.srcObj=t.getComment(e.srcNodeId),e.trgNode=t.getNode(e.trgNodeId)):(e.srcObj=t.getNode(e.srcNodeId),e.trgNode=t.getNode(e.trgNodeId),e.type===u.NODE_LINK&&(e.srcObj&&t.setOutputPortConnected(e.srcObj,e.srcNodePortId),e.trgNode&&t.setInputPortConnected(e.trgNode,e.trgNodePortId)))})),e}},{key:"setAllPortsDisconnected",value:function(e){e.nodes.forEach((function(e){e.inputs&&e.inputs.forEach((function(e){return e.isConnected=!1})),e.outputs&&e.outputs.forEach((function(e){return e.isConnected=!1}))}))}},{key:"setInputPortConnected",value:function(e,t){var n=t||v.CanvasUtils.getDefaultInputPortId(e);e.inputs&&e.inputs.forEach((function(e){e.id===n&&(e.isConnected=!0)}))}},{key:"setOutputPortConnected",value:function(e,t){var n=t||v.CanvasUtils.getDefaultOutputPortId(e);e.outputs&&e.outputs.forEach((function(e){e.id===n&&(e.isConnected=!0)}))}},{key:"getMappedArray",value:function(e){return e.reduce((function(e,t){return e[t.id]=t,e}),{})}},{key:"getSelectedObjectIds",value:function(){return this.selections}},{key:"getSelectedNodesAndComments",value:function(){var e=this,t=this.getSelectedNodes();return this.comments.forEach((function(n){e.getSelectedObjectIds().includes(n.id)&&t.push(n)})),t}},{key:"getSelectedNodes",value:function(){var e=this,t=[];return this.nodes.forEach((function(n){e.getSelectedObjectIds().includes(n.id)&&t.push(n)})),t}},{key:"getSelectedNodeIds",value:function(){return this.getSelectedNodes().map((function(e){return e.id}))}},{key:"getSelectedLinks",value:function(){var e=this,t=[];return this.links.forEach((function(n){e.getSelectedObjectIds().includes(n.id)&&t.push(n)})),t}},{key:"getSelectedDetachedLinks",value:function(){return this.getSelectedLinks().filter((function(e){return e.srcPos||e.trgPos}))}},{key:"getSelectedLinksCount",value:function(){return this.getSelectedLinks().length}},{key:"isSelected",value:function(e){return this.getSelectedObjectIds().indexOf(e)>=0}}])}(),ys=Object.assign({},Fn,Ci),ms=require("markdown-it")({html:!0,linkify:!1,typographer:!0}),bs=function(){function t(n,i,o,a,r,s,l,c,u){var d=arguments.length>9&&void 0!==arguments[9]?arguments[9]:{};e._classCallCheck(this,t),this.logger=new g.Logger(["SVGCanvasRenderer","PipeId",n]),this.logger.logStartTimer("constructor"+n.substring(0,5)),this.pipelineId=n,this.supernodeInfo=d,this.canvasDiv=i,this.canvasInfo=a,this.selectionInfo=r,this.breadcrumbs=s,this.nodeLayout=l,this.canvasLayout=c,this.config=u,this.canvasController=o,this.activePipeline=new vs(n,a,r),this.superRenderers=[],this.instanceId=this.canvasController.getInstanceId(),this.dispUtils=new xi(this.canvasController,this.supernodeInfo.d3Selection,this.pipelineId,s),this.nodeUtils=new Pi(this.canvasLayout),this.commentUtils=new Ni,this.linkUtils=new wi(this.config,this.canvasLayout,this.nodeUtils,this.commentUtils),this.decUtils=new Ai(this.canvasLayout),this.dragObjectUtils=new fo(this),this.dragNewLinkUtils=new Vo(this),this.dragDetLinkUtils=new Jo(this),this.zoomUtils=new fs(this),this.externalUtils=new Ui(this),this.svgCanvasTextArea=new Vi(this.config,this.dispUtils,this.nodeUtils,this.decUtils,this.canvasController,this.canvasDiv,this.activePipeline,this.removeTempCursorOverlay.bind(this),this.displayComments.bind(this),this.displayLinks.bind(this),this.getCommentToolbarPos.bind(this)),this.dispUtils.setDisplayState(),this.logger.log(this.dispUtils.getDisplayStateMsg()),this.dragOverLink=null,this.dragOverDetachedLinks=[],this.dragPointerOffsetInNode=null,this.dragNewLinkOverNode=null,this.initializeGhostDiv(),this.canvasSVG=this.createCanvasSVG(),this.canvasDefs=this.canvasSVG.selectChildren("defs"),this.canvasGrp=this.createCanvasGroup(this.canvasSVG,"d3-canvas-group"),this.canvasUnderlay=this.createCanvasUnderlay(this.canvasGrp,"d3-canvas-underlay"),this.commentsGrp=this.createCanvasGroup(this.canvasGrp,"d3-comments-group"),this.nodesLinksGrp=this.createCanvasGroup(this.canvasGrp,"d3-nodes-links-group"),this.boundingRectsGrp=this.createBoundingRectanglesGrp(this.canvasGrp,"d3-bounding-rect-group"),this.resetCanvasSVGBehaviors(),this.displayCanvas(),this.dispUtils.isDisplayingFullPage()&&this.zoomUtils.restoreZoom(),this.dispUtils.isDisplayingSubFlowFullPage()&&!this.canvasController.getSavedZoom(this.pipelineId)&&this.zoomToFit(),this.dispUtils.isDisplayingSubFlowInPlace()&&(this.supernodeInfo.d3Selection.selectAll(".d3-node-port-input").raise(),this.supernodeInfo.d3Selection.selectAll(".d3-node-port-output").raise()),this.logger.logEndTimer("constructor"+n.substring(0,5))}return e._createClass(t,[{key:"setSpaceKeyPressed",value:function(e){this.zoomUtils.setSpaceKeyPressed(e),this.resetCanvasCursor()}},{key:"isSpaceKeyPressed",value:function(){return this.zoomUtils.isSpaceKeyPressed()}},{key:"zoomTo",value:function(e,t){this.zoomUtils.zoomTo(e,t)}},{key:"translateBy",value:function(e,t,n){this.zoomUtils.translateBy(e,t,n)}},{key:"zoomIn",value:function(){this.zoomUtils.zoomIn()}},{key:"zoomOut",value:function(){this.zoomUtils.zoomOut()}},{key:"zoomToFit",value:function(){this.zoomUtils.zoomToFit()}},{key:"isZoomedToMax",value:function(){return this.zoomUtils.isZoomedToMax()}},{key:"isZoomedToMin",value:function(){return this.zoomUtils.isZoomedToMin()}},{key:"getZoomToReveal",value:function(e,t,n){return this.zoomUtils.getZoomToReveal(e,t,n)}},{key:"getZoom",value:function(){return this.zoomUtils.getZoom()}},{key:"getTransformedViewportDimensions",value:function(){return this.zoomUtils.getTransformedViewportDimensions()}},{key:"getCanvasDimensionsWithPadding",value:function(){return this.zoomUtils.getCanvasDimensionsWithPadding()}},{key:"getParentSupernodeDatum",value:function(){var e=this,t=null;return this.canvasInfo.pipelines.forEach((function(n){n.id===e.supernodeInfo.pipelineId&&(t||(t=n.nodes.find((function(t){return v.CanvasUtils.isSupernode(t)&&t.id===e.supernodeInfo.id}))))})),t}},{key:"setCanvasInfoRenderer",value:function(e,t,n,i,o,a){this.logger.logStartTimer("setCanvasInfoRenderer"+this.pipelineId.substring(0,5)),this.config=a,this.canvasInfo=e,this.selectionInfo=t,this.breadcrumbs=n,this.nodeLayout=i,this.canvasLayout=o,this.activePipeline.initialize(this.pipelineId,e,t),this.linkUtils=new wi(this.config,this.canvasLayout,this.nodeUtils,this.commentUtils),this.svgCanvasTextArea=new Vi(this.config,this.dispUtils,this.nodeUtils,this.decUtils,this.canvasController,this.canvasDiv,this.activePipeline,this.removeTempCursorOverlay.bind(this),this.displayComments.bind(this),this.displayLinks.bind(this),this.getCommentToolbarPos.bind(this)),this.dispUtils.setDisplayState(),this.logger.log(this.dispUtils.getDisplayStateMsg()),this.resetCanvasSVGBehaviors(),this.superRenderers=this.cleanUpSuperRenderers(),this.displayCanvas(),this.logger.logEndTimer("setCanvasInfoRenderer"+this.pipelineId.substring(0,5))}},{key:"setSelectionInfo",value:function(e){this.selectionInfo=e,this.activePipeline.initialize(this.pipelineId,this.canvasInfo,e),this.displayCommentsSelectionStatus(),this.displayNodesSelectionStatus(),this.displayLinksSelectionStatus(),this.superRenderers.forEach((function(t){t.setSelectionInfo(e)}))}},{key:"cleanUpSuperRenderers",value:function(){var e=this,t=[];return this.activePipeline.getSupernodes().forEach((function(n){var i=e.getRendererForSupernode(n);i&&t.push(i),e.getDiscardedRenderersForSupernode(n).forEach((function(e){return e.canvasSVG.remove()}))})),t}},{key:"clearCanvas",value:function(){this.zoomUtils.resetZoomTransform(),this.canvasSVG.remove()}},{key:"refreshOnSizeChange",value:function(){if(this.logger.log("refreshOnSizeChange"),this.dispUtils.isDisplayingSubFlowFullPage()&&this.displayBindingNodesToFitSVG(),this.config.enableBoundingRectangles&&this.displayBoundingRectangles(),this.config.enablePositionNodeOnRightFlyoutOpen&&this.canvasController.isRightFlyoutOpen()){var e="boolean"==typeof this.config.enablePositionNodeOnRightFlyoutOpen?{x:50,y:50}:this.config.enablePositionNodeOnRightFlyoutOpen,t=e.x?e.x:50,n=e.y?e.y:50,i=this.activePipeline.getSelectedNodeIds(),o=this.getZoomToReveal(i,t,n);this.zoomTo(o)}}},{key:"hideCanvas",value:function(){this.canvasSVG.style("display","none")}},{key:"displayCanvas",value:function(){this.logger.logStartTimer("displayCanvas"),this.canvasSVG.style("display","inherit"),this.displayComments(),this.displayNodes(),this.displayLinks(),this.dispUtils.isDisplayingSubFlowInPlace()&&this.displaySVGToFitSupernode(),this.displayCanvasAccoutrements(),this.logger.logEndTimer("displayCanvas")}},{key:"displayCanvasAccoutrements",value:function(){this.config.enableBoundingRectangles&&this.displayBoundingRectangles(),"None"!==this.config.enableCanvasUnderlay&&this.dispUtils.isDisplayingPrimaryFlowFullPage()&&this.setCanvasUnderlaySize(),this.dispUtils.isDisplayingSubFlowFullPage()&&this.displayPortsForSubFlowFullPage()}},{key:"displayPortsForSubFlowFullPage",value:function(){this.setPortPositionsForNode(this.getParentSupernodeDatum()),this.displayBindingNodesToFitSVG()}},{key:"displaySVGToFitSupernode",value:function(){this.logger.log("displaySVGToFitSupernode - start");var e=this.getParentSupernodeSVGDimensions();this.canvasSVG.attr("width",e.width),this.canvasSVG.attr("height",e.height),this.canvasSVG.attr("x",e.x),this.canvasSVG.attr("y",e.y);var t=this.canvasSVG.selectChildren(".d3-svg-background");t.attr("width",e.width),t.attr("height",e.height),this.zoomToFit(),this.displayBindingNodesToFitSVG(),this.logger.log("displaySVGToFitSupernode - end")}},{key:"displayBindingNodesToFitSVG",value:function(){this.logger.log("displayBindingNodesToFitSVG - start"),this.setPortPositionsAllNodes(),this.moveSuperBindingNodes(),this.displayMovedNodes(),this.displayMovedLinks(),this.logger.log("displayBindingNodesToFitSVG - end")}},{key:"getParentSupernodeSVGDimensions",value:function(){var e=this.getParentSupernodeDatum();return{width:e.width-2*this.canvasLayout.supernodeSVGAreaPadding,height:e.height-this.canvasLayout.supernodeTopAreaHeight-this.canvasLayout.supernodeSVGAreaPadding,x:this.canvasLayout.supernodeSVGAreaPadding,y:this.canvasLayout.supernodeTopAreaHeight,x_pos:e.x_pos+this.canvasLayout.supernodeSVGAreaPadding,y_pos:e.y_pos+this.canvasLayout.supernodeTopAreaHeight}}},{key:"moveSuperBindingNodes",value:function(){var e=this,t=this.zoomUtils.getTransformedViewportDimensions(),n=this.getParentSupernodeDatum();if(this.canvasLayout.linkDirection===u.LINK_DIR_TOP_BOTTOM||this.canvasLayout.linkDirection===u.LINK_DIR_BOTTOM_TOP){var i=n.width-2*this.canvasLayout.supernodeSVGAreaPadding;this.activePipeline.nodes.forEach((function(o){if(o.isSupernodeInputBinding){var a=e.nodeUtils.getSupernodePortXOffset(o.id,n.inputs);o.x_pos=t.width*(a/i)+t.x-o.outputs[0].cx,o.y_pos=e.canvasLayout.linkDirection===u.LINK_DIR_TOP_BOTTOM?t.y-o.height:t.y+t.height}if(o.isSupernodeOutputBinding){var r=e.nodeUtils.getSupernodePortXOffset(o.id,n.outputs);o.x_pos=t.width*(r/i)+t.x-o.inputs[0].cx,o.y_pos=e.canvasLayout.linkDirection===u.LINK_DIR_TOP_BOTTOM?o.y_pos=t.y+t.height:o.y_pos=t.y-o.height}}))}else{var o,a;v.CanvasUtils.isExpanded(n)?(o=this.canvasLayout.supernodeTopAreaHeight,a=n.height-(this.canvasLayout.supernodeTopAreaHeight+this.canvasLayout.supernodeSVGAreaPadding)):(o=0,a=n.height),this.activePipeline.nodes.forEach((function(i){if(i.isSupernodeInputBinding){i.x_pos=e.canvasLayout.linkDirection===u.LINK_DIR_LEFT_RIGHT?t.x-i.width:t.x+t.width;var r=e.nodeUtils.getSupernodePortYOffset(i.id,n.inputs)-o;i.y_pos=t.height*(r/a)+t.y-i.outputs[0].cy}if(i.isSupernodeOutputBinding){i.x_pos=e.canvasLayout.linkDirection===u.LINK_DIR_LEFT_RIGHT?t.x+t.width:t.x-i.width;var s=e.nodeUtils.getSupernodePortYOffset(i.id,n.outputs)-o;i.y_pos=t.height*(s/a)+t.y-i.inputs[0].cy}}))}}},{key:"displayBoundingRectangles",value:function(){if(this.activePipeline){var e=this.zoomUtils.getViewportDimensions(),t=this.zoomUtils.getTransformedRect(e,1),n=this.zoomUtils.getCanvasDimensions(),i=this.zoomUtils.getCanvasDimensionsWithPadding();this.boundingRectsGrp.selectChildren(".d3-bounding").remove();var o=this.boundingRectsGrp.append("g").attr("class","d3-bounding");o.append("rect").attr("height",e.height).attr("width",e.width).attr("x",0).attr("y",0).style("fill","none").style("stroke","darkorange"),o.append("rect").attr("height",t.height).attr("width",t.width-2).attr("x",t.x).attr("y",t.y).style("fill","none").style("stroke","red"),n&&o.append("rect").attr("height",n.height).attr("width",n.width).attr("x",n.left).attr("y",n.top).style("fill","none").style("stroke","blue"),i&&o.append("rect").attr("height",i.height).attr("width",i.width).attr("x",i.left).attr("y",i.top).style("fill","none").style("stroke","green"),this.config.enableBoundingRectangles&&this.superRenderers.length>0&&this.superRenderers.forEach((function(e){return e.displayBoundingRectangles()}))}}},{key:"selectObjsInRegion",value:function(e){var t=v.CanvasUtils.selectInRegion(e,this.activePipeline,this.config.enableLinkSelection!==u.LINK_SELECTION_NONE,this.config.enableLinkType,this.config.enableAssocLinkType);this.canvasController.setSelections(t,this.activePipeline.id)}},{key:"isEditingText",value:function(){if(this.svgCanvasTextArea.isEditingText())return!0;var e=!1;return this.superRenderers.forEach((function(t){e||(e=t.isEditingText())})),e}},{key:"isDragging",value:function(){return this.dragObjectUtils.isMoving()||this.dragNewLinkUtils.isDragging()||this.dragDetLinkUtils.isDragging()}},{key:"isSizing",value:function(){this.dragObjectUtils.isSizing()}},{key:"isMoving",value:function(){this.dragObjectUtils.isMoving()}},{key:"shouldDisplayNodeSizingArea",value:function(e){return!v.CanvasUtils.isSuperBindingNode(e)&&(v.CanvasUtils.isSupernode(e)||this.config.enableResizableNodes)}},{key:"getAllNodeGroupsSelection",value:function(){return this.nodesLinksGrp.selectChildren(".d3-node-group")}},{key:"getAllLinkGroupsSelection",value:function(){return this.nodesLinksGrp.selectChildren(".d3-link-group")}},{key:"getAllCommentGroupsSelection",value:function(){return this.commentsGrp.selectChildren(".d3-comment-group")}},{key:"getNodeGroupSelectionById",value:function(e){var t=this.getSelectorForId("node_grp",e);return this.nodesLinksGrp.selectChildren(t)}},{key:"getLinkGroupSelectionById",value:function(e){var t=this.getSelectorForId("link_grp",e);return this.nodesLinksGrp.selectChildren(t)}},{key:"getCommentGroupSelectionById",value:function(e){var t=this.getSelectorForId("comment_grp",e);return this.commentsGrp.selectChildren(t)}},{key:"getNodeDecSelectionById",value:function(e,t){var n=this.getNodeGroupSelectionById(t),i=this.getSelectorForId("node_dec_group",e);return n.selectAll(i)}},{key:"getLinkDecSelectionById",value:function(e,t){var n=this.getLinkGroupSelectionById(t),i=this.getSelectorForId("link_dec_group",e);return n.selectAll(i)}},{key:"getSelectorForId",value:function(e,t,n){return"[data-id='".concat(this.getId(e,t,n),"']")}},{key:"getId",value:function(e,t,n){var i="".concat(e,"_").concat(this.instanceId);return t&&(i+="_".concat(t)),n&&(i+="_".concat(n)),i}},{key:"getMousePosSnapToGrid",value:function(e){var t=e;return this.config.enableSnapToGridType!==u.SNAP_TO_GRID_DURING&&this.config.enableSnapToGridType!==u.SNAP_TO_GRID_AFTER||(t=this.snapToGridPosition(t)),t}},{key:"getTransformedMousePos",value:function(e){return this.zoomUtils.transformPos(this.getMousePos(e,this.canvasSVG))}},{key:"getMousePos",value:function(e,t){if(e.sourceEvent||e.pageX){var n=ys.pointer(e,t.node());return{x:n[0],y:n[1]}}return{x:0,y:0}}},{key:"convertPageCoordsToSnappedCanvasCoords",value:function(e){var t=this.convertPageCoordsToCanvasCoords(e.x,e.y);return t=this.getMousePosSnapToGrid(t)}},{key:"convertPageCoordsToCanvasCoords",value:function(e,t){var n=this.canvasSVG.node().getBoundingClientRect();return this.zoomUtils.transformPos({x:e-Math.round(n.left),y:t-Math.round(n.top)})}},{key:"initializeGhostDiv",value:function(){this.dispUtils.isDisplayingFullPage()&&this.getGhostDivSel().empty()&&this.canvasDiv.append("div").attr("class","d3-ghost-div")}},{key:"getGhostDivSel",value:function(){return this.canvasDiv.selectAll(".d3-ghost-div")}},{key:"getGhostNode",value:function(e){var t=this,n=this.getGhostDivSel(),i=this.zoomUtils.getZoomScale(),o=Math.max(this.nodeLayout.labelWidth,e.width),a=0;n.selectAll(".d3-ghost-svg").remove();var r=n.append("svg").attr("width",o*i).attr("height",(50+e.height)*i).attr("x",0).attr("y",0).attr("class","d3-ghost-svg").append("g").attr("class","d3-node-group");if(r.append("rect").attr("class","d3-ghost-node").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height),!this.nodeLayout.nodeExternalObject){r.append((function(){return t.getImageElement(e)})).each((function(n,i,o){return t.setNodeImageContent(e,i,o)})).attr("x",this.nodeUtils.getNodeImagePosX(e)).attr("y",this.nodeUtils.getNodeImagePosY(e)).attr("width",this.nodeUtils.getNodeImageWidth(e)).attr("height",this.nodeUtils.getNodeImageHeight(e));var s=r.append("foreignObject").attr("x",this.nodeUtils.getNodeLabelPosX(e)).attr("y",this.nodeUtils.getNodeLabelPosY(e)).attr("width",this.nodeUtils.getNodeLabelWidth(e)).attr("height",this.nodeUtils.getNodeLabelHeight(e)).attr("class","d3-foreign-object-ghost-label"),l=s.append("xhtml:div").attr("class",this.nodeUtils.getNodeLabelClass(e)),c=l.append("xhtml:span").html(e.label).node().getBoundingClientRect().width+4,u=this.nodeUtils.getNodeLabelWidth(e),d=Math.min(u,c);if(a=Math.max(0,(d-e.width)/2)*i,"center"===e.layout.labelAlign){var h=Math.max(0,(u-d)/2);s.attr("width",d).attr("x",this.nodeUtils.getNodeLabelPosX(e)+h),l.attr("width",d)}}r.attr("transform","translate(".concat(a,", 0) scale(").concat(i,")"));var g=this.getBrowserZoom(),p=(a+e.width/2*i)*g,f=e.height/2*i*g;return{element:n.node(),centerX:p,centerY:f,nodeTemplate:e}}},{key:"getBrowserZoom",value:function(){var e=window.devicePixelRatio;return navigator.userAgent.includes("Chrome")?e=1:navigator.userAgent.includes("Safari")?e=(window.outerWidth-8)/window.innerWidth:navigator.userAgent.includes("Firefox")&&(e=1),e}},{key:"nodeTemplateDragStart",value:function(e){this.isNodeTemplateInsertableIntoLink(e)&&this.setDataLinkSelectionAreaWider(!0)}},{key:"nodeTemplateDragEnd",value:function(e){this.isNodeTemplateInsertableIntoLink(e)&&this.setDataLinkSelectionAreaWider(!1)}},{key:"nodeTemplateDragOver",value:function(e,t,n){if(this.isNodeTemplateInsertableIntoLink(e)){var i=this.getLinkAtMousePos(t,n);i&&!this.isLinkFullyAttached(i)||this.setInsertNodeIntoLinkHighlighting(i)}if(this.isNodeTemplateAttachableToDetachedLinks(e)){var o=this.convertPageCoordsToCanvasCoords(t,n),a={x1:o.x-e.width/2,y1:o.y-e.height/2,x2:o.x+e.width/2,y2:o.y+e.height/2},r=this.canvasController.convertNodeTemplate(e),s=this.getAttachableLinksForNodeAtPos(r,a);this.setDetachedLinkHighlighting(s)}"None"!==this.config.enableCanvasUnderlay&&this.dispUtils.isDisplayingPrimaryFlowFullPage()&&this.setCanvasUnderlaySize(t,n)}},{key:"setInsertNodeIntoLinkHighlighting",value:function(e){e?this.dragOverLink?e.id!==this.dragOverLink.id&&(this.unsetInsertNodeIntoLinkHighlighting(),this.dragOverLink=e,this.setNodeDragOverLinkHighlighting(this.dragOverLink,!0)):(this.dragOverLink=e,this.setNodeDragOverLinkHighlighting(this.dragOverLink,!0)):this.unsetInsertNodeIntoLinkHighlighting()}},{key:"unsetInsertNodeIntoLinkHighlighting",value:function(e){this.dragOverLink&&(this.setNodeDragOverLinkHighlighting(this.dragOverLink,!1),this.dragOverLink=null)}},{key:"setDetachedLinkHighlighting",value:function(e){var t=this;e&&e.length>0?(this.unsetDetachedLinkHighlighting(),this.dragOverDetachedLinks=e,this.dragOverDetachedLinks.forEach((function(e){return t.setNodeDragOverLinkHighlighting(e,!0)}))):this.dragOverDetachedLinks.length>0&&this.unsetDetachedLinkHighlighting()}},{key:"unsetDetachedLinkHighlighting",value:function(){var e=this;this.dragOverDetachedLinks.forEach((function(t){return e.setNodeDragOverLinkHighlighting(t,!1)})),this.dragOverDetachedLinks=[]}},{key:"setNodeDragOverLinkHighlighting",value:function(e,t){this.getLinkGroupSelectionById(e.id).attr("data-drag-node-over",!!t||null)}},{key:"setHighlightingOverNode",value:function(e,t){e?this.dragNewLinkOverNode?t.id!==this.dragNewLinkOverNode.id&&(this.setLinkOverNode(this.dragNewLinkOverNode,!1),this.dragNewLinkOverNode=t,this.setLinkOverNode(this.dragNewLinkOverNode,!0)):(this.dragNewLinkOverNode=t,this.setLinkOverNode(this.dragNewLinkOverNode,!0)):this.dragNewLinkOverNode&&(this.setLinkOverNode(this.dragNewLinkOverNode,!1),this.dragNewLinkOverNode=null)}},{key:"setLinkOverNode",value:function(e,t){e&&this.getNodeGroupSelectionById(e.id).attr("data-new-link-over",t?"yes":"no")}},{key:"setLinkOverNodeCancel",value:function(){this.setLinkOverNode(this.dragNewLinkOverNode,!1),this.dragNewLinkOverNode=null}},{key:"nodeTemplateDropped",value:function(e,t,n){if(null!==e){var i=this.transformMousePosForNode(t,n,e);this.dragOverLink?(this.canvasController.createNodeFromTemplateOnLinkAt(e,this.dragOverLink,i,this.pipelineId),this.unsetInsertNodeIntoLinkHighlighting()):this.dragOverDetachedLinks.length>0?(this.canvasController.createNodeFromTemplateAttachLinks(e,this.dragOverDetachedLinks,i,this.pipelineId),this.unsetDetachedLinkHighlighting()):this.canvasController.createNodeFromTemplateAt(e,i,this.pipelineId)}}},{key:"externalObjectDropped",value:function(e,t,n){if(null!==e){var i=this.transformMousePosForNode(t,n);this.canvasController.createDroppedExternalObject(e,i,this.pipelineId)}}},{key:"transformMousePosForNode",value:function(e,t,n){var i=this.convertPageCoordsToCanvasCoords(e,t);return n&&n.width&&n.height?(i.x-=n.width/2,i.y-=n.height/2):(i.x-=this.nodeLayout.defaultNodeWidth/2,i.y-=this.nodeLayout.defaultNodeHeight/2),this.getMousePosSnapToGrid(i)}},{key:"isNodeTemplateInsertableIntoLink",value:function(e){return this.config.enableInsertNodeDroppedOnLink&&v.CanvasUtils.hasInputAndOutputPorts(e)&&!this.isPortMaxCardinalityZero(e.inputs[0])&&!this.isPortMaxCardinalityZero(e.outputs[0])}},{key:"isNodeTemplateAttachableToDetachedLinks",value:function(e){return this.config.enableLinkSelection===u.LINK_SELECTION_DETACHABLE}},{key:"getAttachableLinksForNodeAtPos",value:function(e,t){var n=this,i=e.inputs&&e.inputs.length>0,o=e.outputs&&e.outputs.length>0,a=this.activePipeline.links.filter((function(e){return e.srcPos&&o&&v.CanvasUtils.isPosInArea(e.srcPos,t,n.canvasLayout.ghostAreaPadding)?(e.nodeOverSrcPos=!0,!0):e.trgPos&&i&&v.CanvasUtils.isPosInArea(e.trgPos,t,n.canvasLayout.ghostAreaPadding)?(e.nodeOverTrgPos=!0,!0):(e.nodeOverSrcPos=!1,e.nodeOverTrgPos=!1,!1)}));a.length>0&&(a=v.CanvasUtils.getDetachedLinksToUpdate(e,a,this.activePipeline.links).oldLinks);return a}},{key:"isLinkFullyAttached",value:function(e){return!!e&&(void 0!==e.srcNodeId&&void 0!==e.trgNodeId)}},{key:"setMaxZoomExtent",value:function(e){if(this.dispUtils.isDisplayingFullPage())this.zoomUtils.setMaxZoomExtent(e);else{var t=1*Number(e)/this.zoomUtils.getZoomScale();this.supernodeInfo.renderer.setMaxZoomExtent(t)}}},{key:"createCanvasSVG",value:function(){var e=this;this.logger.log("Create Canvas SVG.");var t=this.canvasDiv,n={width:"100%",height:"100%",x:0,y:0};this.dispUtils.isDisplayingSubFlowInPlace()&&(t=this.supernodeInfo.d3Selection,n=this.getParentSupernodeSVGDimensions());var i=t.append("svg").attr("class","svg-area").attr("data-pipeline-id",this.activePipeline.id).attr("width",n.width).attr("height",n.height).attr("x",n.x).attr("y",n.y).on("mouseenter",(function(t,n){e.supernodeInfo.renderer&&e.config.enableZoomIntoSubFlows&&e.supernodeInfo.renderer.setMaxZoomExtent(1/e.zoomUtils.getZoomScale())})).on("mouseleave",(function(t,n){e.supernodeInfo.renderer&&e.config.enableZoomIntoSubFlows&&e.supernodeInfo.renderer.setMaxZoomExtent(1)}));if(i.append("rect").attr("x",0).attr("y",0).attr("width",n.width).attr("height",n.height).attr("data-pipeline-id",this.activePipeline.id).attr("class","d3-svg-background").attr("pointer-events","all").style("cursor","default"),this.dispUtils.isDisplayingFullPage()){var o=i.append("defs");this.createDropShadow(o)}return i}},{key:"resetCanvasSVGBehaviors",value:function(){var e=this;this.canvasSVG.on(".zoom",null),!this.activePipeline.isEmptyOrBindingsOnly()&&this.dispUtils.isDisplayingFullPage()&&this.canvasSVG.call(this.zoomUtils.getZoomHandler()),this.canvasSVG.on("mousedown",(function(t){e.logger.log("Canvas - mousedown"),e.dispUtils.isDisplayingSubFlowInPlace()&&t.button===u.CONTEXT_MENU_BUTTON&&t.stopPropagation()})).on("click.zoom",(function(t){e.logger.log("Canvas - click-zoom"),e.canvasController.clickActionHandler({clickType:"contextmenu"===t.type?"SINGLE_CLICK_CONTEXTMENU":"SINGLE_CLICK",objectType:"canvas",selectedObjectIds:e.activePipeline.getSelectedObjectIds()})})).on("dblclick.zoom",(function(){e.logger.log("Zoom - double click"),e.canvasController.clickActionHandler({clickType:"DOUBLE_CLICK",objectType:"canvas",selectedObjectIds:e.activePipeline.getSelectedObjectIds()})})).on("contextmenu.zoom",(function(t,n){e.logger.log("Zoom - context menu"),e.openContextMenu(t,"canvas")}))}},{key:"resetCanvasCursor",value:function(){var e=".d3-svg-background[data-pipeline-id='"+this.activePipeline.id+"']";this.canvasSVG.select(e).style("cursor",this.zoomUtils.isDragActivated()&&this.dispUtils.isDisplayingFullPage()?"grab":"default")}},{key:"createCanvasGroup",value:function(e,t){return e.append("g").attr("class",t)}},{key:"createCanvasUnderlay",value:function(e,t){return"None"!==this.config.enableCanvasUnderlay&&this.dispUtils.isDisplayingPrimaryFlowFullPage()?e.append("rect").attr("class",t):null}},{key:"createBoundingRectanglesGrp",value:function(e,t){return this.config.enableBoundingRectangles?e.append("g").attr("class",t):null}},{key:"setCanvasUnderlaySize",value:function(){var e=this.zoomUtils.getCanvasDimensionsWithPadding();e&&this.canvasUnderlay.attr("x",e.left-50).attr("y",e.top-50).attr("width",e.width+100).attr("height",e.height+100)}},{key:"createDropShadow",value:function(e){var t=e.append("filter").attr("id",this.getId("node_drop_shadow")).attr("x","-20%").attr("y","-20%").attr("width","200%").attr("height","200%");t.append("feOffset").attr("in","SourceAlpha").attr("dx",1).attr("dy",1).attr("result","offOut"),t.append("feGaussianBlur").attr("in","offOut").attr("stdDeviation","3").attr("result","blurOut"),t.append("feBlend").attr("in","SourceGraphic").attr("in2","blurOut").attr("mode","normal"),t.append("feComponentTransfer").append("feFuncA").attr("type","linear").attr("slope","0.2");var n=t.append("feMerge");n.append("feMergeNode"),n.append("feMergeNode").attr("in","SourceGraphic")}},{key:"setCommentEditingMode",value:function(e,t){if(this.pipelineId===t){var n=this.activePipeline.getComment(e);if(n&&this.config.enableEditingActions){var i=this.getCommentGroupSelectionById(e).node();this.displayCommentTextArea(n,i)}}else this.superRenderers.forEach((function(n){n.setCommentEditingMode(e,t)}))}},{key:"setNodeLabelEditingMode",value:function(e,t){if(this.pipelineId===t){var n=this.activePipeline.getNode(e);if(n&&n.layout.labelEditable&&this.config.enableEditingActions){var i=this.getNodeGroupSelectionById(e).node();this.displayNodeLabelTextArea(n,i)}}else this.superRenderers.forEach((function(n){n.setNodeLabelEditingMode(e,t)}))}},{key:"setNodeDecorationLabelEditingMode",value:function(e,t,n){if(this.pipelineId===n){var i=this.activePipeline.getNode(t);if(i&&i.decorations){var o=i.decorations.find((function(t){return t.id===e}));if(o&&void 0!==o.label&&o.label_editable&&this.config.enableEditingActions){var a=this.getNodeDecSelectionById(e,t).node();this.displayDecLabelTextArea(o,i,"node",a)}}}else this.superRenderers.forEach((function(i){i.setLinkDecorationLabelEditingMode(e,t,n)}))}},{key:"setLinkDecorationLabelEditingMode",value:function(e,t,n){if(this.pipelineId===n){var i=this.activePipeline.getLink(t);if(i&&i.decorations){var o=i.decorations.find((function(t){return t.id===e}));if(o&&void 0!==o.label&&o.label_editable&&this.config.enableEditingActions){var a=this.getLinkDecSelectionById(e,t).node();this.displayDecLabelTextArea(o,i,"link",a)}}}else this.superRenderers.forEach((function(i){i.setLinkDecorationLabelEditingMode(e,t,n)}))}},{key:"repositionCommentToolbar",value:function(){if(this.dispUtils.isDisplayingFullPage()&&this.svgCanvasTextArea.isEditingText()){var e=this.activePipeline.getComment(this.svgCanvasTextArea.getEditingTextId());if(e&&(e.contentType===u.WYSIWYG||this.config.enableMarkdownInComments)){var t=this.getCommentToolbarPos(e);this.canvasController.moveTextToolbar(t.x,t.y)}}}},{key:"getCommentToolbarPos",value:function(e){var t=this.zoomUtils.unTransformPos({x:e.x_pos,y:e.y_pos});return{x:t.x+this.canvasLayout.commentToolbarPosX,y:t.y+this.canvasLayout.commentToolbarPosY}}},{key:"snapToGridPosition",value:function(e){return{x:v.CanvasUtils.snapToGrid(e.x,this.canvasLayout.snapToGridXPx),y:v.CanvasUtils.snapToGrid(e.y,this.canvasLayout.snapToGridYPx)}}},{key:"displayNodes",value:function(){this.logger.logStartTimer("displayNodes "+this.getFlags()),this.setPortPositionsAllNodes();var e=this.getAllNodeGroupsSelection();this.displayNodesSubset(e,this.activePipeline.nodes),this.logger.logEndTimer("displayNodes "+this.getFlags())}},{key:"displayMovedNodes",value:function(){var e=this;this.logger.logStartTimer("displayMovedNodes");var t=this.getAllNodeGroupsSelection();t.datum((function(t){return e.activePipeline.getNode(t.id)})).attr("transform",(function(e){return"translate(".concat(e.x_pos,", ").concat(e.y_pos,")")})),this.dispUtils.isDisplayingSubFlow()&&t.each((function(t,n,i){t.isSupernodeInputBinding&&e.updatePortRadiusAndPos(i[n],t,"d3-node-port-output-main"),t.isSupernodeOutputBinding&&(e.updatePortRadiusAndPos(i[n],t,"d3-node-port-input-main"),e.updatePortArrowPath(i[n],"d3-node-port-input-arrow"))})),this.logger.logEndTimer("displayMovedNodes")}},{key:"displayNodesSelectionStatus",value:function(e){var t=this;this.logger.logStartTimer("displayNodesSelectionStatus"),this.getAllNodeGroupsSelection().selectChildren(".d3-node-selection-highlight").attr("data-selected",(function(e){return t.activePipeline.isSelected(e.id)?"yes":"no"})),this.logger.logEndTimer("displayNodesSelectionStatus")}},{key:"displaySingleNode",value:function(e){this.logger.logStartTimer("displaySingleNode "+this.getFlags()),this.setPortPositionsForNode(e);var t=this.getNodeGroupSelectionById(e.id);this.displayNodesSubset(t,[e]),this.logger.logEndTimer("displaySingleNode "+this.getFlags())}},{key:"displayNodesSubset",value:function(e,t){var n=this;e.data(t,(function(e){return e.id})).join((function(e){return n.createNodes(e)}),null,(function(e){return n.removeNodes(e)})).attr("transform",(function(e){return"translate(".concat(e.x_pos,", ").concat(e.y_pos,")")})).attr("class",(function(e){return n.getNodeGroupClass(e)})).attr("style",(function(e){return n.getNodeGrpStyle(e)})).call((function(e){return n.updateNodes(e,t)}))}},{key:"createNodes",value:function(e){var t=this;this.logger.logStartTimer("createNodes");var n=e.append("g").attr("data-id",(function(e){return t.getId("node_grp",e.id)})).call(this.attachNodeGroupListeners.bind(this));return this.logger.logEndTimer("createNodes"),n}},{key:"updateNodes",value:function(e,t){var n=this;this.logger.logStartTimer("updateNodes");var i=e.filter((function(e){return!v.CanvasUtils.isSuperBindingNode(e)}));if(i.selectChildren(".d3-node-sizing").data((function(e){return n.shouldDisplayNodeSizingArea(e)?[e]:[]}),(function(e){return e.id})).join((function(e){return e.append("path").attr("class","d3-node-sizing").call(n.attachNodeSizingListeners.bind(n))})).datum((function(e){return n.activePipeline.getNode(e.id)})).attr("d",(function(e){return n.getNodeShapePathSizing(e)})),i.selectChildren(".d3-node-selection-highlight").data((function(e){return[e]}),(function(e){return e.id})).join((function(e){return e.append("path").attr("class","d3-node-selection-highlight")})).datum((function(e){return n.activePipeline.getNode(e.id)})).attr("d",(function(e){return n.getNodeSelectionOutline(e)})).attr("data-selected",(function(e){return n.activePipeline.isSelected(e.id)?"yes":"no"})).attr("style",(function(e){return n.getNodeSelectionOutlineStyle(e,"default")})),i.selectChildren(".d3-node-body-outline").data((function(e){return e.layout.nodeShapeDisplay?[e]:[]}),(function(e){return e.id})).join((function(e){return e.append("path").attr("class","d3-node-body-outline")})).datum((function(e){return n.activePipeline.getNode(e.id)})).attr("d",(function(e){return n.getNodeShapePath(e)})).attr("style",(function(e){return n.getNodeBodyStyle(e,"default")})),i.selectChildren(".d3-foreign-object-external-node").data((function(e){return e.layout.nodeExternalObject?[e]:[]}),(function(e){return e.id})).join((function(e){return e.append("foreignObject").attr("class","d3-foreign-object-external-node")}),null,(function(e){e.each((function(e,t,i){return n.externalUtils.removeExternalObject(e,t,i)})),e.remove()})).datum((function(e){return n.activePipeline.getNode(e.id)})).attr("width",(function(e){return e.width})).attr("height",(function(e){return e.height})).attr("x",0).attr("y",0).each((function(e,t,i){return n.externalUtils.addNodeExternalObject(e,t,i)})),i.selectChildren(".d3-node-image").data((function(e){return e.layout.imageDisplay?[e]:[]}),(function(e){return e.id})).join((function(e){return e.append((function(e){return n.getImageElement(e)}))})).datum((function(e){return n.activePipeline.getNode(e.id)})).each((function(e,t,i){return n.setNodeImageContent(e,t,i)})).attr("x",(function(e){return n.nodeUtils.getNodeImagePosX(e)})).attr("y",(function(e){return n.nodeUtils.getNodeImagePosY(e)})).attr("width",(function(e){return n.nodeUtils.getNodeImageWidth(e)})).attr("height",(function(e){return n.nodeUtils.getNodeImageHeight(e)})).attr("style",(function(e){return n.getNodeImageStyle(e,"default")})),i.selectChildren(".d3-foreign-object-node-label").data((function(e){return e.layout.labelDisplay?[e]:[]}),(function(e){return e.id})).join((function(e){var t=e.append("foreignObject").attr("class","d3-foreign-object-node-label").call(n.attachNodeLabelListeners.bind(n));return t.append("xhtml:div").append("xhtml:span").call(n.attachNodeLabelSpanListeners.bind(n)),t})).datum((function(e){return n.activePipeline.getNode(e.id)})).attr("x",(function(e){return n.nodeUtils.getNodeLabelPosX(e)})).attr("y",(function(e){return n.nodeUtils.getNodeLabelPosY(e)})).attr("width",(function(e){return n.nodeUtils.getNodeLabelWidth(e)})).attr("height",(function(e){return n.nodeUtils.getNodeLabelHeight(e)})).select("div").attr("class",(function(e){return n.nodeUtils.getNodeLabelClass(e)})).attr("style",(function(e){return n.getNodeLabelStyle(e,"default")})).select("span").html((function(e){return qn(e.label)})),i.selectChildren(".d3-node-ellipsis-group").attr("transform",(function(e){return n.nodeUtils.getNodeEllipsisTranslate(e)})),i.selectChildren(".d3-node-super-expand-icon-group").attr("transform",(function(e){return n.nodeUtils.getNodeExpansionIconTranslate(e)})),e.each((function(e,t,i){var o=ys.select(i[t]);if(n.displayPorts(o,e),v.CanvasUtils.isSupernode(e)&&n.displaySupernodeContents(e,ys.select(i[t])),!v.CanvasUtils.isSuperBindingNode(e)){n.addErrorMarker(e,o);var a=v.CanvasUtils.getCombinedDecorations(e.layout.decorations,e.decorations);n.displayDecorations(e,u.DEC_NODE,o,a)}})),this.config.enableEditingActions){var o=this.dragObjectUtils.getDragObjectHandler();i.call(o)}else i.on(".drag",null);this.logger.logEndTimer("updateNodes")}},{key:"removeNodes",value:function(e){var t=this;e.selectAll(".d3-foreign-object-node-image").each((function(e,n,i){return t.externalUtils.removeExternalObject(e,n,i)})),e.selectAll(".d3-foreign-object-dec-jsx").each((function(e,n,i){return t.externalUtils.removeExternalObject(e,n,i)})),e.selectChildren(".d3-foreign-object-external-node").each((function(e,n,i){return t.externalUtils.removeExternalObject(e,n,i)})),e.remove()}},{key:"displaySupernodeContents",value:function(e,t){var n=this.getRendererForSupernode(e);v.CanvasUtils.isExpanded(e)?n?n.setCanvasInfoRenderer(this.canvasInfo,this.selectionInfo,this.breadcrumbs,this.nodeLayout,this.canvasLayout,this.config):(n=this.createSupernodeRenderer(e,t),this.superRenderers.push(n)):n&&n.hideCanvas(e)}},{key:"displayPorts",value:function(e,t){this.displayInputPorts(e,t),this.displayOutputPorts(e,t)}},{key:"displayInputPorts",value:function(e,t){var n=this,i="."+this.getNodeInputPortClassName(),o=t.inputs||[];o=t.layout.inputPortDisplay?o:[],e.selectChildren(i).data(o,(function(e){return e.id})).join((function(e){return n.createInputPorts(e,t)})).attr("connected",(function(e){return e.isConnected?"yes":"no"})).attr("class",(function(e){return n.getNodeInputPortClassName()+(e.class_name?" "+e.class_name:"")})).call((function(e){return n.updateInputPorts(e,t)}))}},{key:"createInputPorts",value:function(e,t){var n=e.append("g").attr("data-port-id",(function(e){return e.id})).attr("isSupernodeBinding",v.CanvasUtils.isSuperBindingNode(t)?"yes":"no").call(this.attachInputPortListeners.bind(this),t);return n.append(t.layout.inputPortObject).attr("class","d3-node-port-input-main"),this.config.enableAssocLinkCreation||"circle"!==t.layout.inputPortObject||v.CanvasUtils.isSuperBindingNode(t)||n.append("path").attr("class","d3-node-port-input-arrow"),n}},{key:"updateInputPorts",value:function(e,t){var n=this;if(e.selectChildren(".d3-node-port-input-main").datum((function(e){return t.inputs.find((function(t){return e.id===t.id}))})).each((function(e,i,o){var a=ys.select(o[i]);t.layout.inputPortObject===u.PORT_OBJECT_IMAGE?a.attr("xlink:href",t.layout.inputPortImage).attr("x",e.cx-t.layout.inputPortWidth/2).attr("y",e.cy-t.layout.inputPortHeight/2).attr("width",t.layout.inputPortWidth).attr("height",t.layout.inputPortHeight):a.attr("r",n.getPortRadius(t)).attr("cx",e.cx).attr("cy",e.cy)})),e.selectChildren(".d3-node-port-input-arrow").datum((function(e){return t.inputs.find((function(t){return e.id===t.id}))})).each((function(e,i,o){var a=ys.select(o[i]);t.layout.inputPortObject!==u.PORT_OBJECT_IMAGE&&a.attr("d",n.getPortArrowPath(e)).attr("transform",n.getInputPortArrowPathTransform(e))})),this.config.enableEditingActions){var i=this.dragNewLinkUtils.getDragNewLinkHandler();e.call(i)}else e.on(".drag",null)}},{key:"displayOutputPorts",value:function(e,t){var n=this,i="."+this.getNodeOutputPortClassName(),o=t.outputs||[];o=t.layout.outputPortDisplay?o:[],o=this.config.enableSingleOutputPortDisplay&&o.length>1?[o[o.length-1]]:o,e.selectChildren(i).data(o,(function(e){return e.id})).join((function(e){return n.createOutputPorts(e,t)})).attr("connected",(function(e){return e.isConnected?"yes":"no"})).attr("class",(function(e){return n.getNodeOutputPortClassName()+(e.class_name?" "+e.class_name:"")})).call((function(e){return n.updateOutputPorts(e,t)}))}},{key:"createOutputPorts",value:function(e,t){var n=e.append("g").attr("data-port-id",(function(e){return e.id})).attr("isSupernodeBinding",v.CanvasUtils.isSuperBindingNode(t)?"yes":"no").call(this.attachOutputPortListeners.bind(this),t);return n.append(t.layout.outputPortObject).attr("class","d3-node-port-output-main"),n}},{key:"updateOutputPorts",value:function(e,t){var n=this;if(e.selectChildren(".d3-node-port-output-main").datum((function(e){return t.outputs.find((function(t){return e.id===t.id}))})).each((function(e,i,o){var a=ys.select(o[i]);t.layout.outputPortObject===u.PORT_OBJECT_IMAGE?a.attr("xlink:href",t.layout.outputPortImage).attr("x",e.cx-t.layout.outputPortWidth/2).attr("y",e.cy-t.layout.outputPortHeight/2).attr("width",t.layout.outputPortWidth).attr("height",t.layout.outputPortHeight).attr("transform",n.getPortImageTransform(e)):a.attr("r",n.getPortRadius(t)).attr("cx",e.cx).attr("cy",e.cy)})),this.config.enableEditingActions){var i=this.dragNewLinkUtils.getDragNewLinkHandler();e.call(i)}else e.on(".drag",null)}},{key:"attachNodeGroupListeners",value:function(e){var t=this;e.on("mouseenter",(function(e,n){if(!t.isDragging()){var i=ys.select(e.currentTarget);t.raiseNodeToTop(i),t.setNodeStyles(n,"hover",i),t.config.enableContextToolbar?t.addContextToolbar(e,n,"node"):t.addDynamicNodeIcons(e,n,i)}})).on("mouseover",(function(e,n){if(e.stopPropagation(),t.canOpenTip(u.TIP_TYPE_NODE)){var i=t.canvasController.getTipId(),o=t.getId("node_tip",n.id);null!==i&&i===o||(t.canvasController.closeTip(),t.canvasController.openTip({id:o,type:u.TIP_TYPE_NODE,targetObj:e.currentTarget,pipelineId:t.activePipeline.id,node:n}))}})).on("mouseleave",(function(e,n){var i=ys.select(e.currentTarget);t.setNodeStyles(n,"default",i),t.config.enableContextToolbar?t.removeContextToolbar():t.removeDynamicNodeIcons(e,n,i),t.canvasController.closeTip()})).on("mousedown",(function(e,n){t.logger.logStartTimer("Node Group - mouse down"),e.stopPropagation(),t.svgCanvasTextArea.isEditingText()&&t.svgCanvasTextArea.completeEditing(e),t.config.enableDragWithoutSelect||t.selectObjectD3Event(e,n,"node"),t.logger.logEndTimer("Node Group - mouse down")})).on("mousemove",(function(e,t){})).on("click",(function(e,n){t.logger.log("Node Group - click"),e.stopPropagation()})).on("dblclick",(function(e,n){t.logger.log("Node Group - double click"),v.CanvasUtils.stopPropagationAndPreventDefault(e),t.canvasController.clickActionHandler({clickType:"DOUBLE_CLICK",objectType:"node",id:n.id,selectedObjectIds:t.activePipeline.getSelectedObjectIds(),pipelineId:t.activePipeline.id})})).on("contextmenu",(function(e,n){t.logger.log("Node Group - context menu"),v.CanvasUtils.stopPropagationAndPreventDefault(e),v.CanvasUtils.isSuperBindingNode(n)||(t.config.enableDragWithoutSelect&&t.selectObjectD3Event(e,n,"node"),t.openContextMenu(e,"node",n))}))}},{key:"attachNodeSizingListeners",value:function(e){var t=this;e.on("mousedown",(function(e,n){t.dragObjectUtils.mouseDownNodeSizingArea(n)})).on("mousemove mouseenter",(function(e,n){t.dragObjectUtils.mouseEnterNodeSizingArea(e,n)})).on("mouseleave",(function(e,n){t.dragObjectUtils.mouseLeaveNodeSizingArea(e,n)}))}},{key:"attachNodeLabelListeners",value:function(e){var t=this;e.on("mouseenter",(function(e,n){var i=ys.select(e.currentTarget);if(t.config.enableDisplayFullLabelOnHover&&!v.CanvasUtils.isExpandedSupernode(n)){var o=i.selectAll("span");i.attr("x",t.nodeUtils.getNodeLabelHoverPosX(n)).attr("width",t.nodeUtils.getNodeLabelHoverWidth(n)).attr("height",t.nodeUtils.getNodeLabelHoverHeight(n,o.node(),t.zoomUtils.getZoomScale())),o.classed("d3-label-full",!0)}})).on("mouseleave",(function(e,n){var i=ys.select(e.currentTarget);t.config.enableDisplayFullLabelOnHover&&!v.CanvasUtils.isExpandedSupernode(n)&&(i.attr("x",t.nodeUtils.getNodeLabelPosX(n)).attr("width",t.nodeUtils.getNodeLabelWidth(n)).attr("height",t.nodeUtils.getNodeLabelHeight(n)),i.selectAll("span").classed("d3-label-full",!1))})).on("dblclick",(function(e,n){t.logger.log("Node Label - double click"),n.layout.labelEditable&&t.config.enableEditingActions&&(v.CanvasUtils.stopPropagationAndPreventDefault(e),t.displayNodeLabelTextArea(n,e.currentTarget.parentNode))}))}},{key:"attachNodeLabelSpanListeners",value:function(e){var t=this;e.on("mouseenter",(function(e,n){n.layout.labelEditable&&t.config.enableEditingActions&&t.displayNodeLabelEditIcon(e.currentTarget,n)})).on("mouseleave",(function(e,n){n.layout.labelEditable&&t.config.enableEditingActions&&(t.hideEditIconPending=setTimeout(t.hideEditIcon.bind(t),500,e.currentTarget,n))}))}},{key:"attachInputPortListeners",value:function(e,t){var n=this;e.on("mouseenter",(function(e,i){v.CanvasUtils.stopPropagationAndPreventDefault(e),n.canOpenTip(u.TIP_TYPE_PORT)&&(n.canvasController.closeTip(),n.canvasController.openTip({id:n.getId("node_port_tip",i.id),type:u.TIP_TYPE_PORT,targetObj:e.currentTarget,pipelineId:n.activePipeline.id,node:t,port:i}))})).on("mouseleave",(function(){n.canvasController.closeTip()})).on("contextmenu",(function(e,i){n.logger.log("Input Port Circle - context menu"),v.CanvasUtils.stopPropagationAndPreventDefault(e),n.config.enableDragWithoutSelect&&n.selectObjectD3Event(e,t,"node"),n.openContextMenu(e,"input_port",t,i)}))}},{key:"attachOutputPortListeners",value:function(e,t){var n=this;e.on("mouseenter",(function(e,i){v.CanvasUtils.stopPropagationAndPreventDefault(e),n.canOpenTip(u.TIP_TYPE_PORT)&&(n.canvasController.closeTip(),n.canvasController.openTip({id:n.getId("node_port_tip",i.id),type:u.TIP_TYPE_PORT,targetObj:e.currentTarget,pipelineId:n.activePipeline.id,node:t,port:i}))})).on("mouseleave",(function(){n.canvasController.closeTip()})).on("contextmenu",(function(e,i){n.logger.log("Output Port Circle - context menu"),v.CanvasUtils.stopPropagationAndPreventDefault(e),n.config.enableDragWithoutSelect&&n.selectObjectD3Event(e,t,"node"),n.openContextMenu(e,"output_port",t,i)}))}},{key:"setUnavailableTargetNodesHighlighting",value:function(e,t,n){this.getAllNodeGroupsSelection().filter((function(i){return!v.CanvasUtils.isTrgNodeAvailable(i,e,t,n)})).classed("d3-node-unavailable",!0)}},{key:"setUnavailableSourceNodesHighlighting",value:function(e,t,n){this.getAllNodeGroupsSelection().filter((function(i){return!v.CanvasUtils.isSrcNodeAvailable(i,e,t,n)})).classed("d3-node-unavailable",!0)}},{key:"unsetUnavailableNodesHighlighting",value:function(){this.getAllNodeGroupsSelection().classed("d3-node-unavailable",!1)}},{key:"displayNodeLabelEditIcon",value:function(e,t){var n=this,i=e.parentElement.parentElement.parentElement,o=ys.select(i),a=this.nodeUtils.getNodeLabelEditIconTranslate(t,e,this.zoomUtils.getZoomScale(),this.config.enableDisplayFullLabelOnHover);this.displayEditIcon(e,o,a,(function(e,t){return n.displayNodeLabelTextArea(t,e.currentTarget.parentNode)}))}},{key:"displayDecLabelEditIcon",value:function(e,t,n,i){var o=this,a=e.parentElement.parentElement.parentElement,r=ys.select(a),s=this.decUtils.getDecLabelEditIconTranslate(t,n,i,e,this.zoomUtils.getZoomScale());this.displayEditIcon(e,r,s,(function(e,a){return o.displayDecLabelTextArea(t,n,i,e.currentTarget.parentNode)}))}},{key:"displayEditIcon",value:function(e,t,n,i){var o=this,a=t.append("g").attr("class","d3-label-edit-icon-group").attr("transform",n).on("mouseenter",(function(e,t){o.mouseOverLabelEditIcon=!0})).on("mouseleave",(function(e,t){o.mouseOverLabelEditIcon=!1,o.hideEditIcon(this)})).on("click",(function(e,t){i(e,t),o.mouseOverLabelEditIcon=!1,o.hideEditIcon(this)}));a.append("rect").attr("class","d3-label-edit-icon-background1").attr("width",29).attr("height",24).attr("x",0).attr("y",-4),a.append("rect").attr("class","d3-label-edit-icon-background2").attr("width",24).attr("height",24).attr("x",5).attr("y",-4),a.append("svg").attr("class","d3-node-edit-label-icon").html(u.EDIT_ICON).attr("width",16).attr("height",16).attr("x",9).attr("y",0)}},{key:"hideEditIcon",value:function(e){if(!this.mouseOverLabelEditIcon){var t=e.parentElement;if(t){var n=t.parentElement.parentElement;ys.select(n).selectAll(".d3-label-edit-icon-group").remove()}}}},{key:"selectObjectD3Event",value:function(e,t,n){this.selectObject(t,e.type,e.shiftKey,v.CanvasUtils.isCmndCtrlPressed(e)),this.recreateContextToolbar(e,t,n)}},{key:"selectObjectSourceEvent",value:function(e,t){this.selectObject(t,e.type,e.sourceEvent.shiftKey,v.CanvasUtils.isCmndCtrlPressed(e.sourceEvent))}},{key:"selectObject",value:function(e,t,n,i){this.canvasController.selectObject(e.id,n,i,this.activePipeline.id);var o=this.activePipeline.getObjectTypeName(e);"node"!==o&&"link"!==o||(this.canvasController.clickActionHandler({clickType:"contextmenu"===t||this.ellipsisClicked?"SINGLE_CLICK_CONTEXTMENU":"SINGLE_CLICK",objectType:o,id:e.id,selectedObjectIds:this.activePipeline.getSelectedObjectIds(),pipelineId:this.activePipeline.id}),this.ellipsisClicked=!1)}},{key:"displayDecorations",value:function(e,t,n,i){var o=this,a=this,r=i||[],s="d3-".concat(t,"-dec-group"),l="."+s;n.selectChildren(l).data(r,(function(e){return e.id})).join((function(e){return o.createDecorations(e,t,s)})).attr("transform",(function(n){return o.decUtils.getDecTransform(n,e,t)})).on("mousedown",(function(t,n){return n.hotspot&&0===t.button?a.callDecoratorCallback(t,e,n):null})).each((function(n,i,a){return o.updateDecoration(n,ys.select(a[i]),t,e)}))}},{key:"createDecorations",value:function(e,t,n){var i=this;return e.append("g").attr("data-id",(function(e){return i.getId("".concat(t,"_dec_group"),e.id)})).attr("class",n).call(this.attachDecGroupListeners.bind(this))}},{key:"updateDecoration",value:function(e,t,n,i){this.updateDecOutlines(e,t,n,i),this.updateDecPaths(e,t,n),this.updateDecImages(e,t,n,i),this.updateDecLabels(e,t,n,i),this.updateDecJsxObjs(e,t,n,i)}},{key:"updateDecOutlines",value:function(e,t,n,i){var o=t.selectChild("rect");e.label||e.path||e.jsx||!1===e.outline?o.remove():(o=o.empty()?t.append("rect"):o).attr("class",this.decUtils.getDecClass(e,"d3-".concat(n,"-dec-outline"))).attr("x",0).attr("y",0).attr("width",this.decUtils.getDecWidth(e,i,n)).attr("height",this.decUtils.getDecHeight(e,i,n)).lower()}},{key:"updateDecPaths",value:function(e,t,n){var i=t.selectChild("path");e.path?(i=i.empty()?t.append("path"):i).attr("class",this.decUtils.getDecClass(e,"d3-".concat(n,"-dec-path"))).attr("x",0).attr("y",0).attr("d",e.path):i.remove()}},{key:"updateDecImages",value:function(e,t,n,i){var o=this,a=t.selectChild("g");if(e.image){var r=this.getImageType(e.image);(a=a.empty()?t.append("g").append(r):a.select(r)).attr("class",this.decUtils.getDecClass(e,"d3-".concat(n,"-dec-image"))).attr("x",this.decUtils.getDecPadding(e,i,n)).attr("y",this.decUtils.getDecPadding(e,i,n)).attr("width",this.decUtils.getDecWidth(e,i,n)-2*this.decUtils.getDecPadding(e,i,n)).attr("height",this.decUtils.getDecHeight(e,i,n)-2*this.decUtils.getDecPadding(e,i,n)).each((function(){return o.setDecImageContent(a,e.image)}))}else a.remove()}},{key:"updateDecLabels",value:function(e,t,n,i){var o=t.selectChild(".d3-foreign-object-dec-label");e.label?(o.empty()&&(o=t.append("foreignObject").attr("class","d3-foreign-object-dec-label").attr("x",0).attr("y",0).call(this.attachDecLabelListeners.bind(this,i,n))).append("xhtml:div").append("xhtml:span").call(this.attachDecLabelSpanListeners.bind(this,i,n)),o.attr("width",this.decUtils.getDecLabelWidth(e,i,n)).attr("height",this.decUtils.getDecLabelHeight(e,i,n)).select("div").attr("class",this.decUtils.getDecLabelClass(e,n)).select("span").html(qn(e.label))):o.remove()}},{key:"updateDecJsxObjs",value:function(e,t,n,i){var o=this,a=t.selectChild(".d3-foreign-object-dec-jsx");e.jsx?(a.empty()&&(a=t.append("foreignObject").attr("class","d3-foreign-object-dec-jsx").attr("tabindex",-1).attr("x",0).attr("y",0).call(this.attachDecLabelListeners.bind(this,i,n))),a.attr("width",this.decUtils.getDecWidth(e,i,n)).attr("height",this.decUtils.getDecHeight(e,i,n)).each((function(e,t,n){return o.externalUtils.addDecExternalObject(e,t,n)}))):(a.each((function(e,t,n){return o.externalUtils.removeExternalObject(e,t,n)})),a.remove())}},{key:"attachDecLabelListeners",value:function(e,t,n){var i=this;n.on("dblclick",(function(n,o){i.logger.log("Decoration Label - double click"),o.label_editable&&i.config.enableEditingActions&&(v.CanvasUtils.stopPropagationAndPreventDefault(n),i.displayDecLabelTextArea(o,e,t,n.currentTarget.parentNode))}))}},{key:"attachDecLabelSpanListeners",value:function(e,t,n){var i=this;n.on("mouseenter",(function(n,o){o.label_editable&&i.config.enableEditingActions&&i.displayDecLabelEditIcon(n.currentTarget,o,e,t)})).on("mouseleave",(function(e,t){t.label_editable&&i.config.enableEditingActions&&(i.hideEditIconPending=setTimeout(i.hideEditIcon.bind(i),500,e.currentTarget,t))}))}},{key:"attachDecGroupListeners",value:function(e){var t=this;e.on("mouseenter",(function(e,n){t.canOpenTip(u.TIP_TYPE_DEC)&&n.tooltip&&(t.canvasController.closeTip(),t.canvasController.openTip({id:t.getId("dec_tip",n.id),type:u.TIP_TYPE_DEC,targetObj:e.currentTarget,pipelineId:t.activePipeline.id,decoration:n}))})).on("mouseleave",(function(e,n){t.canOpenTip(u.TIP_TYPE_DEC)&&n.tooltip&&t.canvasController.closeTip()}))}},{key:"addErrorMarker",value:function(e,t){var n=this,i=t.selectChildren(".node-error-marker");e.messages&&e.messages.length>0?(i.empty()&&t.append("svg").attr("class","node-error-marker"),t.selectChildren(".node-error-marker").attr("class",(function(){return"node-error-marker "+n.nodeUtils.getErrorMarkerClass(e.messages)})).html(this.nodeUtils.getErrorMarkerIcon(e)).attr("width",this.nodeUtils.getNodeErrorWidth(e)).attr("height",this.nodeUtils.getNodeErrorHeight(e)).attr("x",this.nodeUtils.getNodeErrorPosX(e)).attr("y",this.nodeUtils.getNodeErrorPosY(e))):i.empty()||i.remove()}},{key:"getNodeInputPortClassName",value:function(){return this.config.enableAssocLinkCreation?"d3-node-port-input-assoc":"d3-node-port-input"}},{key:"getNodeOutputPortClassName",value:function(){return this.config.enableAssocLinkCreation?"d3-node-port-output-assoc":"d3-node-port-output"}},{key:"setNodeImageContent",value:function(e,t,n){var i=this.getNodeImage(e),o=this.getImageType(i);if("jsx"===o)this.externalUtils.addNodeImageExternalObject(i,t,n);else{var a=ys.select(n[t]);this.setImageContent(a,i,o)}}},{key:"setDecImageContent",value:function(e,t){var n=this.getImageType(t);this.setImageContent(e,t,n)}},{key:"setImageContent",value:function(e,t,n){t!==e.attr("data-image")&&(e.attr("data-image",t),"svg"===n?"LoadSVGToDefs"===this.config.enableImageDisplay?this.loadSVGToDefs(e,t):(e.selectChild("svg").remove(),ys.svg(t,{cache:"force-cache"}).then((function(t){e.node().append(t.documentElement)}))):e.attr("xlink:href",t))}},{key:"loadSVGToDefs",value:function(e,t){var n=this,i="img"+t.replaceAll(/[/.]/g,"-"),o="#"+i;this.canvasDefs.selectChildren(o).empty()&&(this.canvasDefs.append("symbol").attr("id",i),ys.svg(t,{cache:"force-cache"}).then((function(e){n.canvasDefs.selectChildren(o).node().append(e.documentElement)}))),e.selectChild("use").remove(),e.append("use").attr("href",o)}},{key:"getNodeImage",value:function(e){if(!e.image)return null;if(e.image===u.USE_DEFAULT_ICON){if(v.CanvasUtils.isSupernode(e))return B}else if(e.image===u.USE_DEFAULT_EXT_ICON&&v.CanvasUtils.isSupernode(e))return G;return e.image}},{key:"getImageType",value:function(t){if(t)if("object"===e._typeof(t)){if(this.externalUtils.isValidJsxElement(t))return"jsx"}else if("string"==typeof t)return t.endsWith(".svg")&&"SVGAsImage"!==this.config.enableImageDisplay?"svg":"image";return null}},{key:"getImageElement",value:function(e){var t=this.getNodeImage(e),n=this.getImageType(t);return"jsx"===n?ys.create("svg:foreignObject").attr("tabindex",-1).attr("class","d3-foreign-object-node-image d3-node-image").node():"svg"===n?ys.create("svg").attr("class","d3-node-image").node():ys.create("svg:image").attr("class","d3-node-image").node()}},{key:"setNodeStyles",value:function(e,t,n){this.setNodeBodyStyles(e,t,n),this.setNodeSelectionOutlineStyles(e,t,n),this.setNodeImageStyles(e,t,n),this.setNodeLabelStyles(e,t,n)}},{key:"setNodeBodyStyles",value:function(e,t,n){var i=this.getNodeBodyStyle(e,t);n.selectChildren(".d3-node-body-outline").attr("style",i)}},{key:"setNodeSelectionOutlineStyles",value:function(e,t,n){var i=this.getNodeSelectionOutlineStyle(e,t);n.selectChildren(".d3-node-selection-highlight").attr("style",i)}},{key:"setNodeImageStyles",value:function(e,t,n){var i=this.getNodeImageStyle(e,t);n.selectChildren(".d3-node-image").attr("style",i)}},{key:"setNodeLabelStyles",value:function(e,t,n){var i=this.getNodeLabelStyle(e,t);n.selectChildren(".d3-node-label").attr("style",i)}},{key:"getNodeBodyStyle",value:function(e,t){var n=v.CanvasUtils.getObjectStyle(e,"body",t);return null===n&&e.layout.dropShadow&&(n="filter:url(".concat(this.getId("#node_drop_shadow"),")")),n}},{key:"getNodeSelectionOutlineStyle",value:function(e,t){return v.CanvasUtils.getObjectStyle(e,"selection_outline",t)}},{key:"getNodeImageStyle",value:function(e,t){return v.CanvasUtils.getObjectStyle(e,"image",t)}},{key:"getNodeLabelStyle",value:function(e,t){return v.CanvasUtils.getObjectStyle(e,"label",t)}},{key:"getNodeGrpStyle",value:function(e){return e.style_temp||e.style||!this.canvasInfo.subdueStyle||this.doesExpandedSupernodeHaveStyledNodes(e)?null:this.canvasInfo.subdueStyle}},{key:"getLinkGrpStyle",value:function(e){return e.style_temp||e.style||!this.canvasInfo.subdueStyle?null:this.canvasInfo.subdueStyle}},{key:"doesExpandedSupernodeHaveStyledNodes",value:function(e){var t=this,n=!1;v.CanvasUtils.isExpandedSupernode(e)&&e.subflow_ref&&e.subflow_ref.pipeline_id_ref&&new vs(e.subflow_ref.pipeline_id_ref,this.canvasInfo).nodes.forEach((function(e){e.style||e.style_temp?n=!0:!n&&v.CanvasUtils.isExpandedSupernode(e)&&(n=t.doesExpandedSupernodeHaveStyledNodes(e))}));return n}},{key:"getPortRadius",value:function(e){return v.CanvasUtils.isSuperBindingNode(e)?this.getBindingPortRadius():e.layout.portRadius}},{key:"getBindingPortRadius",value:function(){return this.canvasLayout.supernodeBindingPortRadius/this.zoomUtils.getZoomScale()}},{key:"addDynamicNodeIcons",value:function(e,t,n){this.isSizing()||v.CanvasUtils.isSuperBindingNode(t)||(t.layout.ellipsisDisplay&&this.addEllipsisIcon(t,n),v.CanvasUtils.isExpandedSupernode(t)&&this.addSuperNodeFullPageIcon(n))}},{key:"getContextToolbarPos",value:function(e,t){return"link"===e?t.pathInfo.centerPoint:"node"!==e||"topCenter"!==t.layout.contextToolbarPosition||t.is_expanded?{x:t.x_pos+t.width,y:t.y_pos}:{x:t.x_pos+t.width/2,y:t.y_pos}}},{key:"addContextToolbar",value:function(e,t,n){if(!(this.isSizing()||this.isDragging()||this.svgCanvasTextArea.isEditingText()||v.CanvasUtils.isSuperBindingNode(t))){this.canvasController.setMouseInObject(t.id);var i=this.getContextToolbarPos(n,t);i=this.zoomUtils.unTransformPos(i),this.openContextMenu(e,n,t,null,i)}}},{key:"removeContextToolbar",value:function(){var e=this;this.canvasController.setMouseInObject(null),this.canvasController.isContextMenuDisplayed()&&setTimeout((function(){return e.canvasController.closeContextToolbar()}),200)}},{key:"recreateContextToolbar",value:function(e,t,n){this.config.enableContextToolbar&&(this.removeContextToolbar(),this.addContextToolbar(e,t,n))}},{key:"addEllipsisIcon",value:function(e,t){var n=this,i=t.append("g").attr("class","d3-node-ellipsis-group").attr("transform",(function(e){return n.nodeUtils.getNodeEllipsisTranslate(e)})).on("mousedown",(function(t){if(v.CanvasUtils.stopPropagationAndPreventDefault(t),n.ellipsisClicked=!0,n.selectObjectD3Event(t,e,"node"),n.canvasController.isContextMenuDisplayed())n.canvasController.closeContextMenu();else{var o=i.node().getBoundingClientRect(),a=n.canvasSVG.node().getBoundingClientRect(),r={x:o.left-a.left,y:o.bottom-a.top};n.openContextMenu(t,"node",e,null,r)}}));i.append("rect").attr("class","d3-node-ellipsis-background").attr("width",(function(e){return n.nodeUtils.getNodeEllipsisWidth(e)})).attr("height",(function(e){return n.nodeUtils.getNodeEllipsisHeight(e)})).attr("x",0).attr("y",0),i.append("svg").attr("class","d3-node-ellipsis").html(u.NODE_MENU_ICON).attr("width",(function(e){return n.nodeUtils.getNodeEllipsisIconWidth(e)})).attr("height",(function(e){return n.nodeUtils.getNodeEllipsisIconHeight(e)})).attr("x",(function(e){return e.layout.ellipsisHoverAreaPadding})).attr("y",(function(e){return e.layout.ellipsisHoverAreaPadding}))}},{key:"addSuperNodeFullPageIcon",value:function(e){var t=this,n=e.append("g").attr("transform",(function(e){return t.nodeUtils.getNodeExpansionIconTranslate(e)})).attr("class","d3-node-super-expand-icon-group").on("mousedown",(function(e){v.CanvasUtils.stopPropagationAndPreventDefault(e);var n=t.getSupernodeBreadcrumbs(e.currentTarget);t.canvasController.displaySubPipelineForBreadcrumbs(n)})).on("mouseenter",(function(){ys.select(this).attr("data-pointer-hover","yes")})).on("mouseleave",(function(){ys.select(this).attr("data-pointer-hover","no")}));n.append("rect").attr("class","d3-node-super-expand-icon-background").attr("width",this.canvasLayout.supernodeExpansionIconWidth).attr("height",this.canvasLayout.supernodeExpansionIconHeight).attr("x",0).attr("y",0),n.append("svg").attr("class","d3-node-super-expand-icon").html(u.SUPER_NODE_EXPAND_ICON).attr("width",this.canvasLayout.supernodeExpansionIconWidth-2*this.canvasLayout.supernodeExpansionIconHoverAreaPadding).attr("height",this.canvasLayout.supernodeExpansionIconHeight-2*this.canvasLayout.supernodeExpansionIconHoverAreaPadding).attr("x",this.canvasLayout.supernodeExpansionIconHoverAreaPadding).attr("y",this.canvasLayout.supernodeExpansionIconHoverAreaPadding)}},{key:"getSupernodeBreadcrumbs",value:function(e){for(var t=[],n=e.closest(".d3-node-group");n;){var i=n.closest(".svg-area"),o=this.getD3DatumFromDomEl(n),a=i.getAttribute("data-pipeline-id");t.push(this.canvasController.createBreadcrumb(o,a)),n=i.closest(".d3-node-group")}return t.reverse()}},{key:"getD3DatumFromDomEl",value:function(e){var t=ys.select(e);return t?t.datum():null}},{key:"updatePortRadiusAndPos",value:function(e,t,n){var i=this;ys.select(e).selectAll("."+n).attr("r",(function(){return i.getPortRadius(t)})).attr("cx",(function(e){return e.cx})).attr("cy",(function(e){return e.cy}))}},{key:"updatePortArrowPath",value:function(e,t){var n=this;ys.select(e).selectAll("."+t).attr("d",(function(e){return n.getPortArrowPath(e)})).attr("transform",(function(e){return n.getInputPortArrowPathTransform(e)}))}},{key:"isPortMaxCardinalityZero",value:function(e){return 0===l.get_1(e,"app_data.ui_data.cardinality.max",1)}},{key:"isMouseOverContextToolbar",value:function(e){return this.getElementWithClassAtMousePos(e,"context-toolbar")}},{key:"removeDynamicNodeIcons",value:function(e,t,n){t.layout.ellipsisDisplay&&n.selectChildren(".d3-node-ellipsis-group").remove(),n.selectChildren(".d3-node-super-expand-icon-group").remove()}},{key:"createSupernodeRenderer",value:function(e,n){return e.subflow_ref&&e.subflow_ref.pipeline_id_ref?new t(e.subflow_ref.pipeline_id_ref,this.canvasDiv,this.canvasController,this.canvasInfo,this.selectionInfo,this.breadcrumbs,this.nodeLayout,this.canvasLayout,this.config,{id:e.id,pipelineId:this.activePipeline.id,renderer:this,d3Selection:n}):null}},{key:"getRendererForSupernode",value:function(e){return this.superRenderers.find((function(t){return t.supernodeInfo.id===e.id&&t.activePipeline.id===e.subflow_ref.pipeline_id_ref}))}},{key:"getDiscardedRenderersForSupernode",value:function(e){return this.superRenderers.filter((function(t){return t.supernodeInfo.id===e.id&&t.activePipeline.id!==e.subflow_ref.pipeline_id_ref}))}},{key:"openContextMenu",value:function(e,t,n,i,o){v.CanvasUtils.stopPropagationAndPreventDefault(e),this.canvasController.contextMenuHandler({type:t,targetObject:"canvas"===t?null:n,id:"canvas"===t?null:n.id,pipelineId:this.activePipeline.id,cmPos:o||this.getMousePos(e,this.canvasDiv.selectAll("svg")),mousePos:this.getMousePosSnapToGrid(this.getTransformedMousePos(e)),selectedObjectIds:this.canvasController.getSelectedObjectIds(),addBreadcrumbs:n&&n.type===u.SUPER_NODE?this.getSupernodeBreadcrumbs(e.currentTarget):null,port:i,zoom:this.zoomUtils.getZoomScale()})}},{key:"closeContextMenuIfOpen",value:function(){this.canvasController.isContextMenuDisplayed()&&this.canvasController.closeContextMenu(),this.config.enableContextToolbar&&this.removeContextToolbar()}},{key:"callDecoratorCallback",value:function(e,t,n){e.stopPropagation(),this.canvasController.decorationActionHandler&&this.canvasController.decorationActionHandler(t,n.id,this.activePipeline.id)}},{key:"getLinkImageTransform",value:function(e){var t=0;if(this.canvasLayout.linkType===u.LINK_TYPE_STRAIGHT){var n=e.x2-(e.originX||e.x1),i=e.y2-(e.originY||e.y1);return 0===n&&0===i?t=0:(t=Math.atan(i/n)*(180/Math.PI),t=n>=0?t:t+180,this.canvasLayout.linkDirection===u.LINK_DIR_TOP_BOTTOM?t-=90:this.canvasLayout.linkDirection===u.LINK_DIR_BOTTOM_TOP&&(t+=90)),"rotate(".concat(t,",").concat(e.x2,",").concat(e.y2,")")}return null}},{key:"getLinkAtMousePos",value:function(e,t){var n=this.getElementWithClassAtPosition(e,t,"d3-data-link");return this.getNodeLinkForElement(n)}},{key:"getNodeLinkForElement",value:function(e){if(e){var t=ys.select(e).datum();if(t){var n=this.activePipeline.getLink(t.id);if(n&&n.type===u.NODE_LINK)return n}}return null}},{key:"setDataLinkSelectionAreaWider",value:function(e){this.nodesLinksGrp.selectAll(".d3-data-link-selection-area").classed("d3-extra-width",e)}},{key:"getNodeAtMousePos",value:function(e){var t=this.getElementWithClassAtMousePos(e,"d3-node-group");return this.getNodeForElement(t)}},{key:"getInputNodePortId",value:function(e,t){var n=this.getInputNodePortIdAtMousePos(e);return n||(n=v.CanvasUtils.getDefaultInputPortId(t)),n}},{key:"getInputNodePortIdAtMousePos",value:function(e){var t=this.getElementWithClassAtMousePos(e,this.getNodeInputPortClassName());return this.getNodePortIdForElement(t)}},{key:"getOutputNodePortId",value:function(e,t){var n=this.getOutputNodePortIdAtMousePos(e);return n||(n=v.CanvasUtils.getDefaultOutputPortId(t)),n}},{key:"getOutputNodePortIdAtMousePos",value:function(e){var t=this.getElementWithClassAtMousePos(e,this.getNodeOutputPortClassName());return this.getNodePortIdForElement(t)}},{key:"getElementWithClassAtMousePos",value:function(e,t){var n=e.clientX?e.clientX:e.sourceEvent.clientX,i=e.clientY?e.clientY:e.sourceEvent.clientY;return this.getElementWithClassAtPosition(n,i,t)}},{key:"getElementWithClassAtPosition",value:function(e,t,n){for(var i=document.elementsFromPoint(e,t),o=null,a=0;!o&&a<i.length;)o=v.CanvasUtils.getParentElementWithClass(i[a],n),a++;return o}},{key:"getNodeForElement",value:function(e){if(e&&"g"===e.nodeName){var t=ys.select(e).datum();if(t)return this.activePipeline.getNode(t.id)}return null}},{key:"getNodePortIdForElement",value:function(e){return e?ys.select(e).attr("data-port-id"):null}},{key:"getNodeNearMousePos",value:function(e,t){var n=this,i=this.getTransformedMousePos(e),o=null,a=t||0;return this.getAllNodeGroupsSelection().each((function(e){var t=e.layout.portRadius;v.CanvasUtils.isSuperBindingNode(e)&&(t=n.canvasLayout.supernodeBindingPortRadius/n.zoomUtils.getZoomScale()),i.x>=e.x_pos-t-a&&i.x<=e.x_pos+e.width+t+a&&i.y>=e.y_pos-a&&i.y<=e.y_pos+e.height+a&&(o=e)})),o}},{key:"getNodeShapePathSizing",value:function(e){return this.getRectangleNodeShapePath(e,e.layout.nodeSizingArea)}},{key:"getNodeSelectionOutline",value:function(e){return e.layout.selectionPath&&!v.CanvasUtils.isExpanded(e)?"function"==typeof e.layout.selectionPath?e.layout.selectionPath(e):e.layout.selectionPath:"port-arcs"===e.layout.nodeShape?this.getPortArcsNodeShapePath(e):this.getRectangleNodeShapePath(e,e.layout.nodeHighlightGap)}},{key:"getNodeShapePath",value:function(e){return e.layout.bodyPath&&!v.CanvasUtils.isExpanded(e)?"function"==typeof e.layout.bodyPath?e.layout.bodyPath(e):e.layout.bodyPath:"port-arcs"===e.layout.nodeShape?this.getPortArcsNodeShapePath(e):this.getRectangleNodeShapePath(e)}},{key:"getRectangleNodeShapePath",value:function(e,t){var n=t||0,i=0-n,o=0-n,a=e.width+n,r=e.height+n,s="M "+i+" "+o+" L "+a+" "+o;return s+=" L "+a+" "+r,s+=" L "+i+" "+r,s+=" Z"}},{key:"getPortArcsNodeShapePath",value:function(e){return this.canvasLayout.linkDirection===u.LINK_DIR_TOP_BOTTOM?this.getPortArcsNodeShapePathVertical(e,e.inputs,e.inputPortsWidth,e.outputs,e.outputPortsWidth):this.canvasLayout.linkDirection===u.LINK_DIR_BOTTOM_TOP?this.getPortArcsNodeShapePathVertical(e,e.outputs,e.outputPortsWidth,e.inputs,e.inputPortsWidth):this.canvasLayout.linkDirection===u.LINK_DIR_RIGHT_LEFT?this.getPortArcsNodeShapePathHoriz(e,e.outputs,e.outputPortsHeight,e.inputs,e.inputPortsHeight):this.getPortArcsNodeShapePathHoriz(e,e.inputs,e.inputPortsHeight,e.outputs,e.outputPortsHeight)}},{key:"getPortArcsNodeShapePathHoriz",value:function(e,t,n,i,o){var a="M 0 0 L "+e.width+" 0 ";if(i&&i.length>0){var r=e.layout.portArcOffset;o<e.height&&(r=i[0].cy-e.layout.portArcRadius),a+=" L "+e.width+" "+r,i.forEach((function(t,n){r+=2*e.layout.portArcRadius,a+=" A "+e.layout.portArcRadius+" "+e.layout.portArcRadius+" 180 0 1 "+e.width+" "+r,n<i.length-1&&(r+=e.layout.portArcSpacing,a+=" L "+e.width+" "+r)})),a+=" L "+e.width+" "+e.height}else a+=" L "+e.width+" "+e.height;if(a+=" L 0 "+e.height,t&&t.length>0){var s=e.height-e.layout.portArcOffset;n<e.height&&(s=t[t.length-1].cy+e.layout.portArcRadius),a+=" L 0 "+s,t.forEach((function(n,i){s-=2*e.layout.portArcRadius,a+=" A "+e.layout.portArcRadius+" "+e.layout.portArcRadius+" 180 0 1 0 "+s,i<t.length-1&&(s-=e.layout.portArcSpacing,a+=" L 0 "+s)})),a+=" Z"}else a+=" Z";return a}},{key:"getPortArcsNodeShapePathVertical",value:function(e,t,n,i,o){var a="M 0 0 L 0 "+e.height;if(i&&i.length>0){var r=e.layout.portArcOffset;o<e.width&&(r=i[0].cx-e.layout.portArcRadius),a+=" L "+r+" "+e.height,i.forEach((function(t,n){r+=2*e.layout.portArcRadius,a+=" A "+e.layout.portArcRadius+" "+e.layout.portArcRadius+" 180 0 0 "+r+" "+e.height,n<i.length-1&&(r+=e.layout.portArcSpacing,a+=" L "+r+" "+e.height)})),a+=" L "+e.width+" "+e.height}else a+=" L "+e.width+" "+e.height;if(a+=" L "+e.width+" 0 ",t&&t.length>0){var s=e.width-e.layout.portArcOffset;n<e.width&&(s=t[t.length-1].cx+e.layout.portArcRadius),a+=" L "+s+" 0 ",t.forEach((function(n,i){s-=2*e.layout.portArcRadius,a+=" A "+e.layout.portArcRadius+" "+e.layout.portArcRadius+" 180 0 0 "+s+" 0 ",i<t.length-1&&(s-=e.layout.portArcSpacing,a+=" L "+s+" 0 ")})),a+=" Z"}else a+=" Z";return a}},{key:"setPortPositionsAllNodes",value:function(){var e=this;this.activePipeline.nodes.forEach((function(t){e.setPortPositionsForNode(t)}))}},{key:"setPortPositionsForNode",value:function(e){this.canvasLayout.linkDirection===u.LINK_DIR_TOP_BOTTOM||this.canvasLayout.linkDirection===u.LINK_DIR_BOTTOM_TOP?(this.setPortPositionsVertical(e,e.inputs,e.inputPortsWidth,e.layout.inputPortPositions,e.layout.inputPortAutoPosition),this.setPortPositionsVertical(e,e.outputs,e.outputPortsWidth,e.layout.outputPortPositions,e.layout.outputPortAutoPosition,this.config.enableSingleOutputPortDisplay)):(this.setPortPositionsHoriz(e,e.inputs,e.inputPortsHeight,e.layout.inputPortPositions,e.layout.inputPortAutoPosition),this.setPortPositionsHoriz(e,e.outputs,e.outputPortsHeight,e.layout.outputPortPositions,e.layout.outputPortAutoPosition,this.config.enableSingleOutputPortDisplay))}},{key:"setPortPositionsVertical",value:function(e,t,n,i,o){var a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(t&&t.length>0){var r=this.nodeUtils.getNodePortPosX(i[0],e),s=this.nodeUtils.getNodePortPosY(i[0],e);e.width<=e.layout.defaultNodeWidth&&1===t.length?(t[0].cx=r,t[0].cy=s,t[0].dir=v.CanvasUtils.getPortDir(t[0].cx,t[0].cy,e)):a?this.setPortPositionsVerticalDisplaySingle(e,t,r,s):o||v.CanvasUtils.isExpandedSupernode(e)?this.setPortPositionsVerticalAuto(e,t,n,s):this.setPortPositionsCustom(t,i,e,r,s)}}},{key:"setPortPositionsVerticalDisplaySingle",value:function(e,t,n,i){var o=0;if(v.CanvasUtils.isExpandedSupernode(e)){var a=e.width-2*this.canvasLayout.supernodeSVGAreaPadding;o=a/2}else o=n;t.forEach((function(t){t.cx=o,t.cy=i,t.dir=v.CanvasUtils.getPortDir(t.cx,t.cy,e)}))}},{key:"setPortPositionsVerticalAuto",value:function(e,t,n,i){var o=0;if(v.CanvasUtils.isExpandedSupernode(e)){var a=e.width-2*this.canvasLayout.supernodeSVGAreaPadding-n;o=this.canvasLayout.supernodeSVGAreaPadding+a/2}else n<e.width&&(o=(e.width-n)/2);o+=e.layout.portArcOffset;var r=1;v.CanvasUtils.isSuperBindingNode(e)&&(r=1/this.zoomUtils.getZoomScale()),t.forEach((function(t){o+=e.layout.portArcRadius*r,t.cx=o,t.cy=i,t.dir=v.CanvasUtils.getPortDir(t.cx,t.cy,e),o+=(e.layout.portArcRadius+e.layout.portArcSpacing)*r}))}},{key:"setPortPositionsHoriz",value:function(e,t,n,i,o){var a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(t&&t.length>0){var r=this.nodeUtils.getNodePortPosX(i[0],e),s=this.nodeUtils.getNodePortPosY(i[0],e);e.height<=e.layout.defaultNodeHeight&&1===t.length?(t[0].cx=r,t[0].cy=s,t[0].dir=v.CanvasUtils.getPortDir(t[0].cx,t[0].cy,e)):a?this.setPortPositionsHorizDisplaySingle(e,t,r,s):o||v.CanvasUtils.isExpandedSupernode(e)?this.setPortPositionsHorizAuto(e,t,n,r):this.setPortPositionsCustom(t,i,e,r,s)}}},{key:"setPortPositionsHorizDisplaySingle",value:function(e,t,n,i){var o=0;if(v.CanvasUtils.isExpandedSupernode(e)){var a=e.height-this.canvasLayout.supernodeTopAreaHeight-this.canvasLayout.supernodeSVGAreaPadding;o=this.canvasLayout.supernodeTopAreaHeight+a/2}else o=i;t.forEach((function(t){t.cx=n,t.cy=o,t.dir=v.CanvasUtils.getPortDir(t.cx,t.cy,e)}))}},{key:"setPortPositionsHorizAuto",value:function(e,t,n,i){var o=0;if(v.CanvasUtils.isExpandedSupernode(e)){var a=e.height-this.canvasLayout.supernodeTopAreaHeight-this.canvasLayout.supernodeSVGAreaPadding-n;o=this.canvasLayout.supernodeTopAreaHeight+a/2}else n<e.height&&(o=(e.height-n)/2);o+=e.layout.portArcOffset;var r=1;v.CanvasUtils.isSuperBindingNode(e)&&(r=1/this.zoomUtils.getZoomScale()),t.forEach((function(t){o+=e.layout.portArcRadius*r,t.cx=i,t.cy=o,t.dir=v.CanvasUtils.getPortDir(t.cx,t.cy,e),o+=(e.layout.portArcRadius+e.layout.portArcSpacing)*r}))}},{key:"setPortPositionsCustom",value:function(e,t,n,i,o){var a=this,r=i,s=o;e.forEach((function(e,i){i>0&&i<t.length&&(r=a.nodeUtils.getNodePortPosX(t[i],n),s=a.nodeUtils.getNodePortPosY(t[i],n)),e.cx=r,e.cy=s,e.dir=v.CanvasUtils.getPortDir(e.cx,e.cy,n)}))}},{key:"displayComments",value:function(){this.logger.logStartTimer("displayComments "+this.getFlags());var e=this.getAllCommentGroupsSelection();this.displayCommentsSubset(e,this.activePipeline.comments),this.logger.logEndTimer("displayComments "+this.getFlags())}},{key:"displayMovedComments",value:function(){var e=this;this.logger.logStartTimer("displayMovedComments"),this.getAllCommentGroupsSelection().attr("transform",(function(e){return"translate(".concat(e.x_pos,", ").concat(e.y_pos,")")})).datum((function(t){return e.activePipeline.getComment(t.id)})),this.logger.logEndTimer("displayMovedComments")}},{key:"displayCommentsSelectionStatus",value:function(){var e=this;this.logger.logStartTimer("displayCommentsSelectionStatus"),this.getAllCommentGroupsSelection().selectChildren(".d3-comment-selection-highlight").attr("data-selected",(function(t){return e.activePipeline.isSelected(t.id)?"yes":"no"})),this.logger.logEndTimer("displayCommentsSelectionStatus")}},{key:"displaySingleComment",value:function(e){var t=this.getCommentGroupSelectionById(e.id);this.displayCommentsSubset(t,[e])}},{key:"displayCommentsSubset",value:function(e,t){var n=this,i=this.canvasInfo.hideComments?[]:t;e.data(i,(function(e){return e.id})).join((function(e){return n.createComments(e)})).attr("transform",(function(e){return"translate(".concat(e.x_pos,", ").concat(e.y_pos,")")})).attr("class",(function(e){return n.getCommentGroupClass(e)})).call((function(e){return n.updateComments(e)}))}},{key:"createComments",value:function(e){var t=this;this.logger.logStartTimer("createComments");var n=e.append("g").attr("data-id",(function(e){return t.getId("comment_grp",e.id)})).call(this.attachCommentGroupListeners.bind(this));return this.logger.logEndTimer("createComments"),n}},{key:"updateComments",value:function(e){var t=this;if(this.logger.logStartTimer("updateComments"),e.selectChildren(".d3-comment-sizing").data((function(e){return[e]}),(function(e){return e.id})).join((function(e){return e.append("rect").attr("class","d3-comment-sizing").call(t.attachCommentSizingListeners.bind(t))})).datum((function(e){return t.activePipeline.getComment(e.id)})).attr("x",-this.canvasLayout.commentSizingArea).attr("y",-this.canvasLayout.commentSizingArea).attr("height",(function(e){return e.height+2*t.canvasLayout.commentSizingArea})).attr("width",(function(e){return e.width+2*t.canvasLayout.commentSizingArea})).attr("class","d3-comment-sizing"),e.selectChildren(".d3-comment-selection-highlight").data((function(e){return[e]}),(function(e){return e.id})).join((function(e){return e.append("rect").attr("class","d3-comment-selection-highlight")})).datum((function(e){return t.activePipeline.getComment(e.id)})).attr("x",-this.canvasLayout.commentHighlightGap).attr("y",-this.canvasLayout.commentHighlightGap).attr("height",(function(e){return e.height+2*t.canvasLayout.commentHighlightGap})).attr("width",(function(e){return e.width+2*t.canvasLayout.commentHighlightGap})).attr("data-selected",(function(e){return t.activePipeline.isSelected(e.id)?"yes":"no"})).attr("style",(function(e){return t.getNodeSelectionOutlineStyle(e,"default")})),e.selectChildren(".d3-comment-rect").data((function(e){return e.contentType!==u.WYSIWYG?[e]:[]}),(function(e){return e.id})).join((function(e){return e.append("rect").attr("class","d3-comment-selection-highlight")})).datum((function(e){return t.activePipeline.getComment(e.id)})).attr("height",(function(e){return e.height})).attr("width",(function(e){return e.width})).attr("class","d3-comment-rect").attr("style",(function(e){return t.getCommentBodyStyle(e,"default")})),e.selectChildren(".d3-foreign-object-comment-text").data((function(e){return e.contentType!==u.WYSIWYG?[e]:[]}),(function(e){return e.id})).join((function(e){var t=e.append("foreignObject").attr("class","d3-foreign-object-comment-text").attr("x",0).attr("y",0);return t.append("xhtml:div").attr("class","d3-comment-text"),t})).datum((function(e){return t.activePipeline.getComment(e.id)})).attr("width",(function(e){return e.width})).attr("height",(function(e){return e.height})).select("div").attr("style",(function(e){return t.getCommentTextStyle(e,"default")})).html((function(e){return t.config.enableMarkdownInComments?ms.render(e.content):qn(e.content)})),e.selectChildren(".d3-foreign-object-comment-text-wysiwyg").data((function(e){return e.contentType===u.WYSIWYG?[e]:[]}),(function(e){return e.id})).join((function(e){var t=e.append("foreignObject").attr("class","d3-foreign-object-comment-text-wysiwyg").attr("x",0).attr("y",0);return t.append("xhtml:div").attr("class","d3-comment-text-wysiwyg-outer").append("xhtml:div").attr("class","d3-comment-text-wysiwyg"),t})).datum((function(e){return t.activePipeline.getComment(e.id)})).attr("width",(function(e){return e.width})).attr("height",(function(e){return e.height})).select(".d3-comment-text-wysiwyg-outer").select(".d3-comment-text-wysiwyg").attr("style",null).each((function(e,t,n){var i;(null===(i=e.formats)||void 0===i?void 0:i.length)>0&&e.formats.forEach((function(e){var i=v.CanvasUtils.convertFormat(e),o=i.field,a=i.value;ys.select(n[t]).style(o,a)}))})).html((function(e){return qn(e.content)})),this.config.enableEditingActions){var n=this.dragObjectUtils.getDragObjectHandler();e.call(n)}else e.on(".drag",null)}},{key:"attachCommentGroupListeners",value:function(e){var t=this;e.on("mouseenter",(function(e,n){t.isDragging()||(t.config.enableEditingActions&&n.id!==t.svgCanvasTextArea.getEditingTextId()&&t.createCommentPort(e.currentTarget,n),t.config.enableContextToolbar&&t.addContextToolbar(e,n,"comment"))})).on("mouseleave",(function(e,n){t.config.enableContextToolbar&&t.removeContextToolbar(),t.config.enableEditingActions&&t.deleteCommentPort(e.currentTarget)})).on("mousedown",(function(e,n){t.logger.logStartTimer("Comment Group - mouse down"),e.stopPropagation(),t.svgCanvasTextArea.isEditingText()&&t.svgCanvasTextArea.completeEditing(e),t.config.enableDragWithoutSelect||t.selectObjectD3Event(e,n,"comment"),t.logger.logEndTimer("Comment Group - mouse down")})).on("click",(function(e,n){t.logger.log("Comment Group - click"),e.stopPropagation()})).on("dblclick",(function(e,n){t.logger.log("Comment Group - double click"),t.config.enableEditingActions&&(v.CanvasUtils.stopPropagationAndPreventDefault(e),t.deleteCommentPort(e.currentTarget),t.displayCommentTextArea(n,e.currentTarget),t.canvasController.clickActionHandler({clickType:"DOUBLE_CLICK",objectType:"comment",id:n.id,selectedObjectIds:t.activePipeline.getSelectedObjectIds(),pipelineId:t.activePipeline.id}))})).on("contextmenu",(function(e,n){t.logger.log("Comment Group - context menu"),t.config.enableDragWithoutSelect&&t.selectObjectD3Event(e,n,"comment"),t.openContextMenu(e,"comment",n)}))}},{key:"attachCommentSizingListeners",value:function(e){var t=this;e.on("mousedown",(function(e,n){t.dragObjectUtils.mouseDownCommentSizingArea()})).on("mousemove mouseenter",(function(e,n){t.dragObjectUtils.mouseEnterCommentSizingArea(e,n)})).on("mouseleave",(function(e,n){t.dragObjectUtils.mouseLeaveCommentSizingArea(e,n)}))}},{key:"createCommentPort",value:function(e,t){var n=this,i=ys.select(e).append("circle").attr("cx",(function(e){return e.width/2})).attr("cy",(function(e){return e.height+n.canvasLayout.commentHighlightGap})).attr("r",this.canvasLayout.commentPortRadius).attr("class","d3-comment-port-circle");if(this.config.enableEditingActions){var o=this.dragNewLinkUtils.getDragNewLinkHandler();i.call(o)}else i.on(".drag",null)}},{key:"deleteCommentPort",value:function(e){ys.select(e).selectChildren(".d3-comment-port-circle").remove()}},{key:"setCommentStyles",value:function(e,t,n){this.setCommentSelectionOutlineStyles(e,t,n),this.setCommentBodyStyles(e,t,n),this.setCommentTextStyles(e,t,n)}},{key:"setCommentSelectionOutlineStyles",value:function(e,t,n){var i=this.getCommentSelectionOutlineStyle(e,t);n.selectChildren(".d3-comment-selection-highlight").attr("style",i)}},{key:"setCommentBodyStyles",value:function(e,t,n){var i=this.getCommentBodyStyle(e,t);n.selectChildren(".d3-comment-rect").attr("style",i)}},{key:"setCommentTextStyles",value:function(e,t,n){var i=this.getCommentTextStyle(e,t);n.selectChildren(".d3-foreign-object-comment-text").select("div").attr("style",i)}},{key:"getCommentSelectionOutlineStyle",value:function(e,t){return v.CanvasUtils.getObjectStyle(e,"selection_outline",t)}},{key:"getCommentBodyStyle",value:function(e,t){return v.CanvasUtils.getObjectStyle(e,"body",t)}},{key:"getCommentTextStyle",value:function(e,t){return v.CanvasUtils.getObjectStyle(e,"text",t)}},{key:"displayCommentTextArea",value:function(e,t){this.svgCanvasTextArea.displayCommentTextArea(e,t)}},{key:"displayNodeLabelTextArea",value:function(e,t){this.svgCanvasTextArea.displayNodeLabelTextArea(e,t)}},{key:"displayDecLabelTextArea",value:function(e,t,n,i){this.svgCanvasTextArea.displayDecLabelTextArea(e,t,n,i)}},{key:"addTempCursorOverlay",value:function(e){this.dispUtils.isDisplayingFullPage()&&(this.canvasDiv.selectAll(".d3-temp-cursor-overlay").size()>0&&this.removeTempCursorOverlay(),this.canvasSVG.append("rect").attr("x",0).attr("y",0).attr("width","100%").attr("height","100%").attr("data-pipeline-id",this.activePipeline.id).attr("class","d3-temp-cursor-overlay").attr("pointer-events","all").style("cursor",e))}},{key:"removeTempCursorOverlay",value:function(){this.dispUtils.isDisplayingFullPage()&&this.canvasDiv.selectAll(".d3-temp-cursor-overlay").remove()}},{key:"isRegionSelectOrSizingInProgress",value:function(){return!(!this.regionSelect&&!this.isSizing())||!(!this.supernodeInfo.renderer||!this.supernodeInfo.renderer.isRegionSelectOrSizingInProgress())}},{key:"displayLinks",value:function(){this.logger.logStartTimer("displayLinks");var e=this.buildLinksArray(),t=this.getAllLinkGroupsSelection();this.displayLinksSubset(t,e),this.logger.logEndTimer("displayLinks")}},{key:"displayLinksSelectionStatus",value:function(){var e=this;this.logger.logStartTimer("displayLinksSelectionStatus"),this.config.enableLinkSelection!==u.LINK_SELECTION_NONE&&this.getAllLinkGroupsSelection().attr("data-selected",(function(t){return!!e.activePipeline.isSelected(t.id)||null})),this.logger.logEndTimer("displayLinksSelectionStatus")}},{key:"displayMovedLinks",value:function(){var e=this;this.logger.logStartTimer("displayMovedLinks"),this.buildLinksArray().filter((function(e){return e.coordsUpdated})).forEach((function(t){e.displaySingleLink(t)})),this.logger.logEndTimer("displayMovedLinks")}},{key:"displaySingleLink",value:function(e){var t=this.getLinkGroupSelectionById(e.id);this.displayLinksSubset(t,[e])}},{key:"displayLinksSubset",value:function(e,t){var n=this;e.data(t,(function(e){return e.id})).join((function(e){return n.createLinks(e)})).attr("class",(function(e){return n.getLinkGroupClass(e)})).attr("style",(function(e){return n.getLinkGrpStyle(e)})).attr("data-selected",(function(e){return!!n.activePipeline.isSelected(e.id)||null})).call((function(e){n.updateLinks(e,t)}))}},{key:"createLinks",value:function(e){var t=this;this.logger.logStartTimer("createLinks");var n=e.append("g").attr("data-id",(function(e){return t.getId("link_grp",e.id)})).call(this.attachLinkGroupListeners.bind(this));return n.append("path").attr("class",(function(e){return t.getLinkSelectionAreaClass(e)})),n.append("path").attr("class","d3-link-line"),n.filter((function(e){return e.type===u.NODE_LINK&&t.canvasLayout.dataLinkArrowHead||e.type===u.COMMENT_LINK&&t.canvasLayout.commentLinkArrowHead})).append("path").attr("class","d3-link-line-arrow-head"),n.append("g").attr("class","d3-link-decorations-group"),this.config.enableLinkSelection!==u.LINK_SELECTION_HANDLES&&this.config.enableLinkSelection!==u.LINK_SELECTION_DETACHABLE||n.append("g").attr("class","d3-link-handles-group").each((function(e,n,i){e.type===u.NODE_LINK&&t.createNewHandles(ys.select(i[n]))})),this.logger.logEndTimer("createLinks"),n}},{key:"updateLinks",value:function(e,t){var n=this;this.logger.logStartTimer("updateLinks"),e.selectAll(".d3-link-selection-area").datum((function(e){return n.activePipeline.getLink(e.id)})).attr("d",(function(e){return e.pathInfo.path})),e.selectAll(".d3-link-line").datum((function(e){return n.activePipeline.getLink(e.id)})).attr("d",(function(e){return e.pathInfo.path})).attr("class","d3-link-line").attr("style",(function(e){return v.CanvasUtils.getObjectStyle(e,"line","default")})),e.filter((function(e){return e.type===u.NODE_LINK&&n.canvasLayout.dataLinkArrowHead||e.type===u.COMMENT_LINK&&n.canvasLayout.commentLinkArrowHead})).selectAll(".d3-link-line-arrow-head").datum((function(e){return n.activePipeline.getLink(e.id)})).attr("d",(function(e){return n.getArrowHead(e)})).attr("transform",(function(e){return n.getArrowHeadTransform(e)})).attr("class","d3-link-line-arrow-head").attr("style",(function(e){return v.CanvasUtils.getObjectStyle(e,"line","default")})),e.each((function(e,t,i){if(e.type===u.NODE_LINK||e.type===u.ASSOCIATION_LINK){var o=ys.select(i[t]).selectAll(".d3-link-decorations-group");n.displayDecorations(e,u.DEC_LINK,o,e.decorations)}})),this.config.enableLinkSelection!==u.LINK_SELECTION_HANDLES&&this.config.enableLinkSelection!==u.LINK_SELECTION_DETACHABLE||e.each((function(e,i,o){e.type===u.NODE_LINK&&n.updateHandles(ys.select(o[i]).selectAll(".d3-link-handles-group"),t)})),this.isMoving()||this.isSizing()||this.config.enableLinksOverNodes||this.setDisplayOrder(e),this.logger.logEndTimer("updateLinks")}},{key:"attachLinkGroupListeners",value:function(e){var t=this;e.on("mousedown",(function(e,n,i,o){t.logger.log("Link Group - mouse down"),t.svgCanvasTextArea.isEditingText()&&t.svgCanvasTextArea.completeEditing(e),t.config.enableLinkSelection!==u.LINK_SELECTION_NONE&&t.selectObjectD3Event(e,n,"link"),e.stopPropagation()})).on("mouseup",(function(){t.logger.log("Link Group - mouse up")})).on("click",(function(e,n){t.logger.log("Link Group - click"),e.stopPropagation()})).on("contextmenu",(function(e,n){t.logger.log("Link Group - context menu"),t.config.enableLinkSelection!==u.LINK_SELECTION_NONE&&t.selectObjectD3Event(e,n,"link"),t.openContextMenu(e,"link",n)})).on("mouseenter",(function(e,n){if(!t.isDragging()){var i=e.currentTarget;t.config.enableLinkSelection!==u.LINK_SELECTION_HANDLES&&t.config.enableLinkSelection!==u.LINK_SELECTION_DETACHABLE||t.raiseLinkToTop(i),t.setLinkLineStyles(i,n,"hover"),t.config.enableContextToolbar&&t.addContextToolbar(e,n,"link")}})).on("mouseover",(function(e,n){if(e.stopPropagation(),t.canOpenTip(u.TIP_TYPE_LINK)){var i=t.canvasController.getTipId(),o=t.getId("link_tip",n.id);null!==i&&i===o||(t.canvasController.closeTip(),t.canvasController.openTip({id:o,type:u.TIP_TYPE_LINK,targetObj:e.currentTarget,mousePos:{x:e.clientX,y:e.clientY},pipelineId:t.activePipeline.id,link:n}))}})).on("mouseleave",(function(e,n){var i=e.currentTarget;i.getAttribute("data-selected")||t.config.enableLinksOverNodes||t.lowerLinkToBottom(i),t.setLinkLineStyles(i,n,"default"),t.canvasController.closeTip(),t.config.enableContextToolbar&&t.removeContextToolbar()}))}},{key:"createNewHandles",value:function(e){e.append(this.canvasLayout.linkStartHandleObject).attr("class",(function(e){return"d3-link-handle-start"})).call(this.attachStartHandleListeners.bind(this)),e.append(this.canvasLayout.linkEndHandleObject).attr("class",(function(e){return"d3-link-handle-end"})).call(this.attachEndHandleListeners.bind(this))}},{key:"updateHandles",value:function(e,t){var n=this,i=e.selectAll(".d3-link-handle-start").datum((function(e){return n.activePipeline.getLink(e.id)})).each((function(e,t,i){var o=ys.select(i[t]);"image"===n.canvasLayout.linkStartHandleObject?o.attr("xlink:href",n.canvasLayout.linkStartHandleImage).attr("x",(function(e){return e.x1-n.canvasLayout.linkStartHandleWidth/2})).attr("y",(function(e){return e.y1-n.canvasLayout.linkStartHandleHeight/2})).attr("width",n.canvasLayout.linkStartHandleWidth).attr("height",n.canvasLayout.linkStartHandleHeight):"circle"===n.canvasLayout.linkStartHandleObject&&o.attr("r",n.canvasLayout.linkStartHandleRadius).attr("cx",(function(e){return e.x1})).attr("cy",(function(e){return e.y1}))}));if(this.config.enableEditingActions){var o=this.dragDetLinkUtils.getDragDetachedLinkHandler();i.call(o)}else i.on(".drag",null);var a=e.selectAll(".d3-link-handle-end").datum((function(e){return n.activePipeline.getLink(e.id)})).each((function(e,t,i){var o=ys.select(i[t]);"image"===n.canvasLayout.linkEndHandleObject?o.attr("xlink:href",n.canvasLayout.linkEndHandleImage).attr("x",(function(e){return e.x2-n.canvasLayout.linkEndHandleWidth/2})).attr("y",(function(e){return e.y2-n.canvasLayout.linkEndHandleHeight/2})).attr("width",n.canvasLayout.linkEndHandleWidth).attr("height",n.canvasLayout.linkEndHandleHeight).attr("transform",(function(e){return n.getLinkImageTransform(e)})):"circle"===n.canvasLayout.linkEndHandleObject&&o.attr("r",n.canvasLayout.linkEndHandleRadius).attr("cx",(function(e){return e.x2})).attr("cy",(function(e){return e.y2}))}));if(this.config.enableEditingActions){var r=this.dragDetLinkUtils.getDragDetachedLinkHandler();a.call(r)}else a.on(".drag",null)}},{key:"attachStartHandleListeners",value:function(e){var t=this;e.on("mousedown",(function(e,n){t.logger.log("Link start handle - mouse down"),t.config.enableDragWithoutSelect||t.selectObjectD3Event(e,n,"link"),t.logger.log("Link end handle - finished mouse down")}))}},{key:"attachEndHandleListeners",value:function(e){var t=this;e.on("mousedown",(function(e,n){t.logger.log("Link end handle - mouse down"),t.config.enableDragWithoutSelect||t.selectObjectD3Event(e,n,"link"),t.logger.log("Link end handle - finished mouse down")}))}},{key:"setLinkLineStyles",value:function(e,t,n){var i=v.CanvasUtils.getObjectStyle(t,"line",n),o=ys.select(e);o.select(".d3-link-line").attr("style",i),o.select(".d3-link-line-arrow-head").attr("style",i)}},{key:"getLinkSelectionAreaClass",value:function(e){return"d3-link-selection-area "+(e.type===u.ASSOCIATION_LINK?"d3-association-link-selection-area":e.type===u.COMMENT_LINK?"d3-comment-link-selection-area":"d3-data-link-selection-area")}},{key:"getLinkGroupClass",value:function(e){return"d3-link-group "+this.getLinkTypeClass(e)+" "+this.getLinkBranchHighlightCLass(e)+" "+this.getLinkCustomClass(e)}},{key:"getLinkBranchHighlightCLass",value:function(e){return e.branchHighlight?"d3-branch-highlight":""}},{key:"getLinkCustomClass",value:function(e){return e.class_name&&"canvas-data-link"!==e.class_name&&"canvas-object-link"!==e.class_name&&"canvas-comment-link"!==e.class_name&&"d3-data-link"!==e.class_name&&"d3-association-link"!==e.class_name&&"d3-object-link"!==e.class_name&&"d3-comment-link"!==e.class_name?e.class_name:""}},{key:"getLinkTypeClass",value:function(e){return e.type===u.ASSOCIATION_LINK?this.config.enableAssocLinkType===u.ASSOC_RIGHT_SIDE_CURVE?"d3-association-link":"d3-object-link":e.type===u.COMMENT_LINK?"d3-comment-link":"d3-data-link"}},{key:"getCommentGroupClass",value:function(e){var t="";return e.class_name&&"canvas-comment"!==e.class_name&&"d3-comment-rect"!==e.class_name&&(t=" "+e.class_name),"d3-comment-group"+(this.config.enableEditingActions?" d3-draggable":" d3-non-draggable")+t}},{key:"getNodeGroupClass",value:function(e){var t=" "+e.layout.className||"";e.class_name&&"canvas-node"!==e.class_name&&"d3-node-body"!==e.class_name&&"d3-node-body-outline"!==e.class_name&&(t=" "+e.class_name);var n=v.CanvasUtils.isExpandedSupernode(e)?" d3-node-supernode-expanded":"",i=this.config.enableEditingActions?" d3-draggable":" d3-non-draggable";return"d3-node-group"+n+(e.isResized?" d3-resized":"")+i+(e.branchHighlight?" d3-branch-highlight":"")+t}},{key:"setDisplayOrder",value:function(e){var t=this;e.filter((function(e){return t.hasOneDecorationOrMore(e)})).lower(),e.filter((function(e){return!t.hasOneDecorationOrMore(e)})).lower(),this.config.enableLinkSelection!==u.LINK_SELECTION_HANDLES&&this.config.enableLinkSelection!==u.LINK_SELECTION_DETACHABLE||this.raiseSelectedLinksToTop()}},{key:"raiseNodeToTopById",value:function(e){this.getNodeGroupSelectionById(e).raise()}},{key:"raiseNodeToTop",value:function(e){!this.config.enableRaiseNodesToTopOnHover||this.isDragging()||0!==this.activePipeline.getSelectedLinksCount()||this.isEditingText()||this.config.enableLinksOverNodes||e.raise()}},{key:"raiseSelectedLinksToTop",value:function(){this.nodesLinksGrp.selectAll(".d3-link-group[data-selected]").raise()}},{key:"raiseLinkToTop",value:function(e){ys.select(e).raise()}},{key:"lowerLinkToBottom",value:function(e){ys.select(e).lower()}},{key:"hasOneDecorationOrMore",value:function(e){return e.decorations&&e.decorations.length>0}},{key:"buildLinksArray",value:function(){var e=this;this.logger.logStartTimer("buildLinksArray");var t=[];return this.canvasLayout.linkMethod===u.LINK_METHOD_FREEFORM&&this.updateFreeformLinksForNodes(),this.activePipeline.links.forEach((function(n){var i=null;(i=!(e.config.enableLinkSelection===u.LINK_SELECTION_HANDLES&&e.dragDetLinkUtils.isLinkBeingDragged(n)||e.config.enableLinkSelection===u.LINK_SELECTION_DETACHABLE)||n.srcObj&&n.trgNode?e.getAttachedLinkObj(n):e.getDetachedLinkObj(n))&&t.push(i)})),this.canvasLayout.linkType===u.LINK_TYPE_ELBOW&&(t=this.addMinInitialLineForElbow(t)),t=this.linkUtils.addConnectionPaths(t),this.logger.logEndTimer("buildLinksArray"),t}},{key:"getAttachedLinkObj",value:function(e){var t=e.srcObj,n=e.trgNode;if(t||this.logger.error("Common Canvas error trying to draw a link. A link was specified for source ID '"+e.srcNodeId+"' in the Canvas data that does not have a valid source node/comment."),n||this.logger.error("Common Canvas error trying to draw a link. A link was specified for target ID '"+e.trgNodeId+"' in the Canvas data that does not have a valid target node."),t&&n&&this.shouldDisplayLink(t,n,e.type)){var i=v.CanvasUtils.getSourcePortId(e,t),o=v.CanvasUtils.getTargetPortId(e,n),a=e.type===u.ASSOCIATION_LINK&&this.config.enableAssocLinkType===u.ASSOC_RIGHT_SIDE_CURVE?this.getAssocLinkVariation(t,n):null,r=this.linkUtils.getLinkCoords(e,t,i,n,o,a);return e.coordsUpdated=e.x1!==r.x1||e.y1!==r.y1||e.x2!==r.x2||e.y2!==r.y2,e.assocLinkVariation=a,e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.originX=r.originX,e.originY=r.originY,e.srcDir=r.srcDir,e.trgDir=r.trgDir,e}return null}},{key:"getDetachedLinkObj",value:function(e){var t=e.srcObj,n=e.trgNode,i=e.x1,o=e.y1,a=e.x2,r=e.y2;if(t||n)if(n){var s=this.getTargetEndInfo(e,n);e.x1=e.srcPos.x_pos,e.y1=e.srcPos.y_pos,e.x2=s.x2,e.y2=s.y2,e.trgDir=s.trgDir,e.originX=0,e.originY=0,e.srcDir=this.getSrcDirForDetachedLink(e,e.x1,e.y1)}else{var l=this.getSourceEndInfo(e,t);e.x1=l.x1,e.y1=l.y1,e.x2=e.trgPos.x_pos,e.y2=e.trgPos.y_pos,e.srcDir=l.srcDir,e.originX=l.originX,e.originY=l.originY,e.trgDir=this.getTrgDirForDetachedLink(e,e.x2,e.y2)}else e.x1=e.srcPos.x_pos,e.y1=e.srcPos.y_pos,e.x2=e.trgPos.x_pos,e.y2=e.trgPos.y_pos,e.originX=0,e.originY=0,this.canvasLayout.linkMethod===u.LINK_METHOD_FREEFORM?(e.srcDir=v.CanvasUtils.getPortDir(e.x2-e.x1,e.y2-e.y1,{width:10,height:10}),e.trgDir=this.reverseDir(e.srcDir)):(e.srcDir=this.getDefaultSrcDirForPorts(),e.trgDir=this.reverseDir(e.srcDir));return e.coordsUpdated=e.x1!==i||e.y1!==o||e.x2!==a||e.y2!==r,e}},{key:"getSourceEndInfo",value:function(e,t){var n={};if(this.canvasLayout.linkMethod===u.LINK_METHOD_FREEFORM){var i={x:e.trgPos.x_pos,y:e.trgPos.y_pos},o=this.linkUtils.getNewFreeformNodeLinkStartPos(t,i,e.srcFreeformInfo);n.x1=o.x,n.y1=o.y,n.originX=o.originX,n.originY=o.originY,n.srcDir=o.dir}else{var a=v.CanvasUtils.getSourcePortId(e,t),r=v.CanvasUtils.getOutputPort(a,t);r||(r=v.CanvasUtils.getInputPort(a,t)),r&&(n.x1=t.x_pos+r.cx,n.y1=t.y_pos+r.cy,n.srcDir=r.dir)}return n}},{key:"getTargetEndInfo",value:function(e,t){var n={};if(this.canvasLayout.linkMethod===u.LINK_METHOD_FREEFORM){var i={x:e.srcPos.x_pos,y:e.srcPos.y_pos},o=this.linkUtils.getNewFreeformNodeLinkStartPos(t,i,e.trgFreeformInfo);n.x2=o.x,n.y2=o.y,n.trgDir=o.dir}else{var a=v.CanvasUtils.getTargetPortId(e,t),r=v.CanvasUtils.getInputPort(a,t);r&&(n.x2=t.x_pos+r.cx,n.y2=t.y_pos+r.cy,n.trgDir=r.dir)}return n}},{key:"getDefaultSrcDirForPorts",value:function(){return this.canvasLayout.linkDirection===u.LINK_DIR_LEFT_RIGHT?u.EAST:this.canvasLayout.linkDirection===u.LINK_DIR_RIGHT_LEFT?u.WEST:this.canvasLayout.linkDirection===u.LINK_DIR_BOTTOM_TOP?u.NORTH:this.canvasLayout.linkDirection===u.LINK_DIR_TOP_BOTTOM?u.SOUTH:u.EAST}},{key:"getSrcDirForDetachedLink",value:function(e,t,n){if(e.trgNode){if(this.canvasLayout.linkMethod===u.LINK_METHOD_PORTS){if(e.trgDir===u.WEST&&this.canvasLayout.linkDirection===u.LINK_DIR_LEFT_RIGHT)return u.EAST;if(e.trgDir===u.EAST&&this.canvasLayout.linkDirection===u.LINK_DIR_RIGHT_LEFT)return u.WEST;if(e.trgDir===u.SOUTH&&this.canvasLayout.linkDirection===u.LINK_DIR_BOTTOM_TOP)return u.NORTH;if(e.trgDir===u.NORTH&&this.canvasLayout.linkDirection===u.LINK_DIR_TOP_BOTTOM)return u.SOUTH}var i=v.CanvasUtils.getPortDir(t-e.trgNode.x_pos,n-e.trgNode.y_pos,e.trgNode);return this.reverseDir(i)}var o=v.CanvasUtils.getPortDir(t-e.trgPos.x_pos,n-e.trgPos.y_pos,{width:10,height:10});return this.reverseDir(o)}},{key:"getTrgDirForDetachedLink",value:function(e,t,n){if(e.srcObj){if(this.canvasLayout.linkMethod===u.LINK_METHOD_PORTS){if(e.srcDir===u.EAST&&this.canvasLayout.linkDirection===u.LINK_DIR_LEFT_RIGHT)return u.WEST;if(e.srcDir===u.WEST&&this.canvasLayout.linkDirection===u.LINK_DIR_RIGHT_LEFT)return u.EAST;if(e.srcDir===u.NORTH&&this.canvasLayout.linkDirection===u.LINK_DIR_BOTTOM_TOP)return u.SOUTH;if(e.srcDir===u.SOUTH&&this.canvasLayout.linkDirection===u.LINK_DIR_TOP_BOTTOM)return u.NORTH}var i=v.CanvasUtils.getPortDir(t-e.srcObj.x_pos,n-e.srcObj.y_pos,e.srcObj);return this.reverseDir(i)}var o=v.CanvasUtils.getPortDir(t-e.srcPos.x_pos,n-e.srcPos.y_pos,{width:10,height:10});return this.reverseDir(o)}},{key:"reverseDir",value:function(e){switch(e){case u.NORTH:return u.SOUTH;case u.SOUTH:return u.NORTH;case u.EAST:return u.WEST;case u.WEST:default:return u.EAST}}},{key:"shouldDisplayLink",value:function(e,t,n){return(n!==u.COMMENT_LINK||!this.canvasInfo.hideComments)&&(!1!==this.canvasLayout.displayLinkOnOverlap||!this.areLinkedObjectsOverlapping(e,t,n))}},{key:"areLinkedObjectsOverlapping",value:function(e,t,n){var i=n===u.COMMENT_LINK?this.canvasLayout.commentHighlightGap:e.layout.nodeHighlightGap,o=t.layout.nodeHighlightGap,a=e.x_pos-i,r=e.x_pos+e.width+i,s=t.x_pos-o,l=t.x_pos+t.width+o,c=e.y_pos-i,d=e.y_pos+e.height+i,h=t.y_pos-o,g=t.y_pos+t.height+o;return r>=s&&l>=a&&d>=h&&g>=c}},{key:"addMinInitialLineForElbow",value:function(e){var t=this;return this.activePipeline.nodes.forEach((function(n){if(n.outputs&&n.outputs.length>1){var i=t.getNodeOutputLinks(n,e),o=t.sortNodeOutputLinks(i);t.applyMinInitialLine(n,o)}})),e}},{key:"getNodeOutputLinks",value:function(e,t){var n=[];return t.forEach((function(t){t.srcObj&&t.srcObj.id===e.id&&n.push(t)})),n}},{key:"sortNodeOutputLinks",value:function(e){var t=this;return e.sort((function(e,n){var i,o;return t.canvasLayout.linkDirection===u.LINK_DIR_LEFT_RIGHT?(i=Math.abs(e.y1-e.y2),o=Math.abs(n.y1-n.y2)):(i=Math.abs(e.x1-e.x2),o=Math.abs(n.x1-n.x2)),i===o?t.canvasLayout.linkDirection===u.LINK_DIR_LEFT_RIGHT?e.y1<e.y2?1:-1:e.x1<e.x2?1:-1:i<o?1:-1}))}},{key:"applyMinInitialLine",value:function(e,t){var n=e.layout.minInitialLine;t.forEach((function(e){e.minInitialLineForElbow=n,n+=e.srcObj.layout.minInitialLineIncrement}))}},{key:"updateFreeformLinksForNodes",value:function(){var e=this;this.activePipeline.nodes.forEach((function(t){return e.updateFreeformLinksForNode(t)}))}},{key:"updateFreeformLinksForNode",value:function(e){var t=this,n={n:[],s:[],e:[],w:[]};this.activePipeline.links.forEach((function(i){var o,a,r;if(i.type===u.NODE_LINK)if(e.id===(null===(o=i.srcObj)||void 0===o?void 0:o.id)&&(null===(a=i.srcObj)||void 0===a?void 0:a.id)===(null===(r=i.trgNode)||void 0===r?void 0:r.id))n[u.NORTH].push({type:"in",endNode:i.srcObj,link:i}),n[u.EAST].push({type:"out",endNode:i.trgNode,link:i});else if(i.trgNode&&i.trgNode.id===e.id){if(i.srcObj){var s=t.getDirAdjusted(i.trgNode,i.srcObj);n[s].push({type:"in",endNode:i.srcObj,link:i})}else if(i.srcPos){var l=t.getDirToEndPos(i.trgNode,i.srcPos.x_pos,i.srcPos.y_pos);n[l].push({type:"in",x:i.srcPos.x_pos,y:i.srcPos.y_pos,link:i})}}else if(i.srcObj&&i.srcObj.id===e.id)if(i.trgNode){var c=t.getDirAdjusted(i.srcObj,i.trgNode);n[c].push({type:"out",endNode:i.trgNode,link:i})}else if(i.trgPos){var d=t.getDirToEndPos(i.srcObj,i.trgPos.x_pos,i.trgPos.y_pos);n[d].push({type:"out",x:i.trgPos.x_pos,y:i.trgPos.y_pos,link:i})}})),n.n=this.sortLinksInfo(n.n,u.NORTH),n.s=this.sortLinksInfo(n.s,u.SOUTH),n.e=this.sortLinksInfo(n.e,u.EAST),n.w=this.sortLinksInfo(n.w,u.WEST),this.updateLinksInfo(n.n,u.NORTH),this.updateLinksInfo(n.s,u.SOUTH),this.updateLinksInfo(n.e,u.EAST),this.updateLinksInfo(n.w,u.WEST)}},{key:"getDirAdjusted",value:function(e,t){var n=this.getDirToNode(e,t);if(n===u.SOUTH)this.getDirToNode(t,e)===u.WEST&&(n=u.EAST);else if(n===u.NORTH){this.getDirToNode(t,e)===u.EAST&&(n=u.WEST)}return n}},{key:"getDirToNode",value:function(e,t){var n=this.nodeUtils.getNodeCenterPosX(t),i=this.nodeUtils.getNodeCenterPosY(t);return this.getDirToEndPos(e,n,i)}},{key:"getDirToEndPos",value:function(e,t,n){var i=this.nodeUtils.getNodeCenterPosX(e),o=this.nodeUtils.getNodeCenterPosY(e),a=e.x_pos,r=e.y_pos,s=e.width,l=e.height;return v.CanvasUtils.getDir(a,r,s,l,i,o,t,n)}},{key:"sortLinksInfo",value:function(e,t){var n=this,i=e;if(i.length>1){var o=this.getLinkInfoGroups(i);Wn(o,(function(e){e.forEach((function(i,o){var a=i.endNode,r=e.length+1;t===u.NORTH||t===u.SOUTH?(i.x=a.x_pos+a.width/r*(o+1),i.y=n.nodeUtils.getNodeCenterPosY(a)):(i.x=n.nodeUtils.getNodeCenterPosX(a),i.y=a.y_pos+a.height/r*(o+1))}))})),i=t===u.NORTH||t===u.SOUTH?i.sort((function(e,t){return e.x>t.x?1:-1})):i.sort((function(e,t){return e.y>t.y?1:-1}))}return i}},{key:"getLinkInfoGroups",value:function(e){var t={};return e.forEach((function(e){e.endNode&&(t[e.endNode.id]||(t[e.endNode.id]=[]),t[e.endNode.id].push(e))})),t}},{key:"updateLinksInfo",value:function(e,t){e.forEach((function(n,i){"out"===n.type?n.link.srcFreeformInfo={dir:t,idx:i,len:e.length}:n.link.trgFreeformInfo={dir:t,idx:i,len:e.length}}))}},{key:"getNewLinkAssocVariation",value:function(e,t,n){return"input"===n&&e>t?u.ASSOC_VAR_CURVE_LEFT:"output"===n&&e<t?u.ASSOC_VAR_CURVE_RIGHT:u.ASSOC_VAR_DOUBLE_BACK_RIGHT}},{key:"getAssocLinkVariation",value:function(e,t){var n=e.layout.minInitialLine;return t.x_pos>=e.x_pos+e.width+n?u.ASSOC_VAR_CURVE_RIGHT:e.x_pos>=t.x_pos+t.width+n?u.ASSOC_VAR_CURVE_LEFT:u.ASSOC_VAR_DOUBLE_BACK_RIGHT}},{key:"getPortArrowPath",value:function(e){return"M -2 3 L 2 0 -2 -3"}},{key:"getInputPortArrowPathTransform",value:function(e){var t=this.getAngleBasedForInputPorts(e.dir);return"translate(".concat(e.cx,", ").concat(e.cy,") rotate(").concat(t,")")}},{key:"getArrowHead",value:function(e){return e.type===u.COMMENT_LINK?"string"==typeof this.canvasLayout.commentLinkArrowHead?this.canvasLayout.commentLinkArrowHead:"M -8 3 L 0 0 -8 -3":"string"==typeof this.canvasLayout.dataLinkArrowHead?this.canvasLayout.dataLinkArrowHead:"M -6 6 L 0 0 -6 -6"}},{key:"getArrowHeadTransform",value:function(e){var t=0;return t=this.canvasLayout.linkMethod===u.LINK_METHOD_FREEFORM?this.getAngleBasedForFreeformLink(e):this.getAngleBasedForInputPorts(e.trgDir),"translate(".concat(e.x2,", ").concat(e.y2,") rotate(").concat(t,")")}},{key:"getPortImageTransform",value:function(e){var t=this.getAngleBasedForOutputPorts(e.dir);return"rotate(".concat(t,",").concat(e.cx,",").concat(e.cy,")")}},{key:"getAngleBasedForFreeformLink",value:function(e){var t=e.srcNodeId&&e.trgNodeId&&e.srcNodeId===e.trgNodeId;return this.canvasLayout.linkType!==u.LINK_TYPE_STRAIGHT||t?this.getAngleBasedForInputPorts(e.trgDir):Math.atan2(e.y2-e.y1,e.x2-e.x1)*(180/Math.PI)}},{key:"getAngleBasedForOutputPorts",value:function(e){switch(e){case u.NORTH:return-90;case u.SOUTH:return 90;case u.WEST:return 180;default:return 0}}},{key:"getAngleBasedForInputPorts",value:function(e){switch(e){case u.NORTH:return 90;case u.SOUTH:return-90;case u.WEST:return 0;default:return 180}}},{key:"canOpenTip",value:function(e){return this.canvasController.isTipEnabled(e)&&!this.regionSelect&&!this.isDragging()&&!this.isSizing()}},{key:"getDefaultCommentOffset",value:function(){var e=this.canvasLayout.addCommentOffsetX,t=this.canvasLayout.addCommentOffsetY,n=this.zoomUtils.getZoomTransform();if(n){var i=n.x/n.k,o=n.y/n.k;e=-i+this.canvasLayout.addCommentOffsetX,t=-o+this.canvasLayout.addCommentOffsetY}return this.config.enableSnapToGridType===u.SNAP_TO_GRID_DURING||this.config.enableSnapToGridType===u.SNAP_TO_GRID_AFTER?this.snapToGridPosition({x:e,y:t}):{x:e,y:t}}},{key:"getFlags",value:function(){var e="Flags:";return this.isDragging()&&(e+=" dragging = true"),this.isSizing()&&(e+=" sizing = true"),this.regionSelect&&(e+=" regionSelect = true"),"Flags:"===e&&(e+=" None"),e}}])}(),ks=function(){return e._createClass((function t(n,i,o){e._classCallCheck(this,t),this.logger=new g.Logger(["SVGCanvasD3","FlowId",n]),this.logger.logStartTimer("constructor"),this.canvasController=o,this.canvasDiv=Mn(i),this.logger.logEndTimer("constructor",!0)}),[{key:"setCanvasInfo",value:function(e,t,n,i,o,a){if(this.logger=new g.Logger(["SVGCanvasD3","FlowId",e.id]),this.config&&this.renderer&&this.canvasInfo&&e.id===this.canvasInfo.id&&(!this.renderer||this.renderer.pipelineId===this.canvasController.getCurrentBreadcrumb().pipelineId)&&v.ConfigUtils.compareCanvasConfigsOmitFields(this.config,a))this.logger.logStartTimer("set canvas info"),this.canvasInfo=this.cloneCanvasInfo(e),this.config=this.cloneConfig(a),this.renderer.setCanvasInfoRenderer(this.canvasInfo,t,n,i,o,this.config),this.logger.logEndTimer("set canvas info",!0);else{this.logger.logStartTimer("initializing"),this.canvasInfo=this.cloneCanvasInfo(e),this.config=this.cloneConfig(a),this.renderer&&(this.renderer.clearCanvas(),this.renderer=null);var r=this.canvasController.getCurrentBreadcrumb();this.renderer=new bs(r.pipelineId,this.canvasDiv,this.canvasController,this.canvasInfo,t,n,i,o,a,{id:r.supernodeId,pipelineId:r.supernodeParentPipelineId}),this.logger.logEndTimer("initializing",!0)}}},{key:"setSelectionInfo",value:function(e){this.renderer&&this.renderer.setSelectionInfo(e)}},{key:"cloneConfig",value:function(e){return Object.assign({},e)}},{key:"cloneCanvasInfo",value:function(e){return m.cloneDeep_1(e)}},{key:"isEditingText",value:function(){return this.renderer.isEditingText()}},{key:"isDragging",value:function(){return this.renderer.isDragging()}},{key:"convertPageCoordsToSnappedCanvasCoords",value:function(e){return this.renderer.convertPageCoordsToSnappedCanvasCoords(e)}},{key:"nodeTemplateDragStart",value:function(e){this.renderer.nodeTemplateDragStart(e)}},{key:"nodeTemplateDragOver",value:function(e,t,n){this.renderer.nodeTemplateDragOver(e,t,n)}},{key:"nodeTemplateDragEnd",value:function(e){this.renderer.nodeTemplateDragEnd(e)}},{key:"nodeTemplateDropped",value:function(e,t,n){this.renderer.nodeTemplateDropped(e,t,n)}},{key:"externalObjectDropped",value:function(e,t,n){this.renderer.externalObjectDropped(e,t,n)}},{key:"zoomTo",value:function(e,t){this.renderer.zoomTo(e,t)}},{key:"translateBy",value:function(e,t,n){this.renderer.translateBy(e,t,n)}},{key:"zoomIn",value:function(){this.renderer.zoomIn()}},{key:"zoomOut",value:function(){this.renderer.zoomOut()}},{key:"zoomToFit",value:function(){this.renderer.zoomToFit()}},{key:"isZoomedToMax",value:function(){return!!this.renderer&&this.renderer.isZoomedToMax()}},{key:"isZoomedToMin",value:function(){return!!this.renderer&&this.renderer.isZoomedToMin()}},{key:"getZoomToReveal",value:function(e,t,n){return this.renderer?this.renderer.getZoomToReveal(e,t,n):null}},{key:"getZoom",value:function(){return this.renderer?this.renderer.getZoom():null}},{key:"setCommentEditingMode",value:function(e,t){this.renderer.setCommentEditingMode(e,t)}},{key:"setNodeLabelEditingMode",value:function(e,t){this.renderer.setNodeLabelEditingMode(e,t)}},{key:"setNodeDecorationLabelEditingMode",value:function(e,t,n){this.renderer.setNodeDecorationLabelEditingMode(e,t,n)}},{key:"setLinkDecorationLabelEditingMode",value:function(e,t,n){this.renderer.setLinkDecorationLabelEditingMode(e,t,n)}},{key:"refreshOnSizeChange",value:function(){this.renderer&&this.renderer.refreshOnSizeChange()}},{key:"getDefaultCommentOffset",value:function(){return this.renderer.getDefaultCommentOffset()}},{key:"getTransformedViewportDimensions",value:function(){return this.renderer.getTransformedViewportDimensions()}},{key:"getCanvasDimensionsWithPadding",value:function(){return this.renderer.getCanvasDimensionsWithPadding()}},{key:"getGhostNode",value:function(e){return this.renderer.getGhostNode(e)}},{key:"setSpaceKeyPressed",value:function(e){this.renderer.setSpaceKeyPressed(e)}},{key:"isSpaceKeyPressed",value:function(){return this.renderer.isSpaceKeyPressed()}}])}();function Cs(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,xs()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function xs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(xs=function(){return!!e})()}var Ts=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Cs(this,i,[t])).state={isDropZoneDisplayed:!1},n.logger=new g.Logger("CC-Contents"),n.mainCanvasDivId="canvas-div-"+n.props.canvasController.getInstanceId(),n.svgCanvasDivId="d3-svg-canvas-div-"+n.props.canvasController.getInstanceId(),n.svgCanvasDivSelector="#"+n.svgCanvasDivId,n.dragX=null,n.dragY=null,n.contentsRef=C.default.createRef(),n.eventListenersAdded=!1,n.mousePos={x:0,y:0},n.drop=n.drop.bind(n),n.focusOnCanvas=n.focusOnCanvas.bind(n),n.setIsDropZoneDisplayed=n.setIsDropZoneDisplayed.bind(n),n.dragOver=n.dragOver.bind(n),n.dragEnter=n.dragEnter.bind(n),n.dragLeave=n.dragLeave.bind(n),n.refreshOnSizeChange=n.refreshOnSizeChange.bind(n),n.getLabel=n.getLabel.bind(n),n.onCut=n.onCut.bind(n),n.onCopy=n.onCopy.bind(n),n.onPaste=n.onPaste.bind(n),n.onKeyDown=n.onKeyDown.bind(n),n.onKeyUp=n.onKeyUp.bind(n),n.onMouseMove=n.onMouseMove.bind(n),n.onClickReturnToPrevious=n.onClickReturnToPrevious.bind(n),n.first=!1,n.second=!1,n.afterUpdateCallbacks=[],t.canvasController.setCanvasContents(n),n}return t._inherits(i,n),e._createClass(i,[{key:"componentDidMount",value:function(){this.logger.log("componentDidMount"),this.svgCanvasD3=new ks(this.props.canvasInfo.id,this.svgCanvasDivSelector,this.props.canvasController),this.setCanvasInfo(),this.props.canvasConfig.enableBrowserEditMenu&&this.addEventListeners(),this.focusOnCanvas()}},{key:"componentDidUpdate",value:function(e){this.logger.log("componentDidUpdate"),this.svgCanvasD3&&!this.isDropZoneDisplayed()&&(e.canvasInfo!==this.props.canvasInfo||e.canvasConfig!==this.props.canvasConfig||e.breadcrumbs!==this.props.breadcrumbs?(this.setCanvasInfo(),this.afterUpdate()):e.selectionInfo!==this.props.selectionInfo&&this.svgCanvasD3.setSelectionInfo(this.props.selectionInfo)),this.props.canvasConfig.enableBrowserEditMenu?this.addEventListeners():this.removeEventListeners()}},{key:"componentWillUnmount",value:function(){this.removeEventListeners()}},{key:"onCut",value:function(e){e.currentTarget.activeElement.id===this.svgCanvasDivId&&this.props.canvasConfig.enableEditingActions&&(e.preventDefault(),this.props.canvasController.cutToClipboard())}},{key:"onCopy",value:function(e){e.currentTarget.activeElement.id===this.svgCanvasDivId&&this.props.canvasConfig.enableEditingActions&&(e.preventDefault(),this.props.canvasController.copyToClipboard())}},{key:"onPaste",value:function(e){e.currentTarget.activeElement.id===this.svgCanvasDivId&&this.props.canvasConfig.enableEditingActions&&(e.preventDefault(),this.props.canvasController.pasteFromClipboard())}},{key:"onKeyDown",value:function(e){this.props.canvasController.closeTip();var t=this.props.canvasController.getKeyboardConfig().actions;if(!this.svgCanvasD3.isEditingText()&&!this.svgCanvasD3.isDragging()){if(this.props.canvasConfig.enableEditingActions)if(8!==e.keyCode&&46!==e.keyCode||!t.delete){if(v.CanvasUtils.isCmndCtrlPressed(e)&&!e.shiftKey&&90===e.keyCode&&t.undo)v.CanvasUtils.stopPropagationAndPreventDefault(e),this.props.canvasController.canUndo()&&this.props.canvasController.keyboardActionHandler("undo");else if(v.CanvasUtils.isCmndCtrlPressed(e)&&(e.shiftKey&&90===e.keyCode||89===e.keyCode&&t.redo))v.CanvasUtils.stopPropagationAndPreventDefault(e),this.props.canvasController.canRedo()&&this.props.canvasController.keyboardActionHandler("redo");else if(v.CanvasUtils.isCmndCtrlPressed(e)&&67===e.keyCode&&t.copyToClipboard)v.CanvasUtils.stopPropagationAndPreventDefault(e),this.props.canvasController.keyboardActionHandler("copy");else if(v.CanvasUtils.isCmndCtrlPressed(e)&&88===e.keyCode&&t.cutToClipboard)v.CanvasUtils.stopPropagationAndPreventDefault(e),this.props.canvasController.keyboardActionHandler("cut");else if(v.CanvasUtils.isCmndCtrlPressed(e)&&86===e.keyCode&&t.pasteFromClipboard)if(v.CanvasUtils.stopPropagationAndPreventDefault(e),this.mousePos){var n=this.svgCanvasD3.convertPageCoordsToSnappedCanvasCoords(this.mousePos);this.props.canvasController.keyboardActionHandler("paste",n)}else this.props.canvasController.keyboardActionHandler("paste")}else v.CanvasUtils.stopPropagationAndPreventDefault(e),this.props.canvasController.keyboardActionHandler("deleteSelectedObjects");v.CanvasUtils.isCmndCtrlPressed(e)&&65===e.keyCode&&t.selectAll?(v.CanvasUtils.stopPropagationAndPreventDefault(e),this.props.canvasController.keyboardActionHandler("selectAll")):32===e.keyCode?this.svgCanvasD3.isSpaceKeyPressed()||(v.CanvasUtils.stopPropagationAndPreventDefault(e),this.svgCanvasD3.setSpaceKeyPressed(!0)):v.CanvasUtils.isCmndCtrlPressed(e)&&e.shiftKey&&e.altKey&&80===e.keyCode&&(v.CanvasUtils.stopPropagationAndPreventDefault(e),g.Logger.switchLoggingState())}}},{key:"onKeyUp",value:function(){this.svgCanvasD3.setSpaceKeyPressed(!1)}},{key:"onMouseMove",value:function(e){e.target&&e.target.className&&("svg-area"===e.target.className.baseVal||"d3-svg-background"===e.target.className.baseVal)?this.mousePos={x:e.clientX,y:e.clientY}:this.mousePos=null}},{key:"onClickReturnToPrevious",value:function(e){e.stopPropagation(),e.preventDefault(),this.props.canvasController.displayPreviousPipeline()}},{key:"setCanvasInfo",value:function(){var e=this.props.canvasController.objectModel.getNodeLayout(),t=this.props.canvasController.objectModel.getCanvasLayout();this.svgCanvasD3.setCanvasInfo(this.props.canvasInfo,this.props.selectionInfo,this.props.breadcrumbs,e,t,this.props.canvasConfig)}},{key:"getLabel",value:function(e){return this.props.intl.formatMessage({id:e,defaultMessage:v.defaultMessages1[e]})}},{key:"getDNDJson",value:function(e){try{return JSON.parse(e.dataTransfer.getData(u.DND_DATA_TEXT))}catch(e){return this.logger.warn("The dragged object's data does not conform to the expected internal format: "+e),null}}},{key:"getSVGCanvasD3",value:function(){return this.svgCanvasD3}},{key:"getStateTag",value:function(){var e=null;return this.props.canvasConfig.enableStateTag!==u.STATE_TAG_READ_ONLY&&this.props.canvasConfig.enableStateTag!==u.STATE_TAG_LOCKED||(e=C.default.createElement(Ct,{stateTagType:this.props.canvasConfig.enableStateTag,canvasController:this.props.canvasController})),e}},{key:"getEmptyCanvas",value:function(){var e=null;return this.props.canvasController.isPrimaryPipelineEmpty()&&(e=this.props.canvasConfig.emptyCanvasContent?C.default.createElement("div",{className:"empty-canvas"},this.props.canvasConfig.emptyCanvasContent):C.default.createElement("div",{className:"empty-canvas"},C.default.createElement("div",{className:"empty-canvas-image"},C.default.createElement(s.FlowData,null)),C.default.createElement("span",{className:"empty-canvas-text1"},this.getLabel("canvas.flowIsEmpty")),C.default.createElement("span",{className:"empty-canvas-text2"},this.getLabel("canvas.addNodeToStart")))),e}},{key:"getReturnToPreviousBtn",value:function(){var e,t,n=null;if(!this.props.canvasController.isPrimaryPipelineEmpty()&&(this.props.canvasController.isDisplayingFullPageSubFlow()||null!==(e=this.props.canvasConfig)&&void 0!==e&&null!==(t=e.enableCanvasLayout)&&void 0!==t&&t.alwaysDisplayBackToParentFlow)){var i=this.getLabel("canvas.returnToPrevious");n=C.default.createElement("div",{className:"return-to-previous"},C.default.createElement(h.Button,{kind:"tertiary",onClick:this.onClickReturnToPrevious,"aria-label":i,size:"md"},C.default.createElement("div",{className:"return-to-previous-content"},C.default.createElement(r.ArrowLeft,null),C.default.createElement("span",null,i))))}return n}},{key:"getContextMenu",value:function(){return this.props.canvasConfig.enableContextToolbar?C.default.createElement(ht,{canvasController:this.props.canvasController,containingDivId:this.mainCanvasDivId}):C.default.createElement(nt,{canvasController:this.props.canvasController,containingDivId:this.mainCanvasDivId})}},{key:"getTextToolbar",value:function(){return C.default.createElement(yt,{canvasController:this.props.canvasController,containingDivId:this.mainCanvasDivId})}},{key:"getDropZone",value:function(){var e=null;return this.isDropZoneDisplayed()&&(e=this.props.canvasConfig.dropZoneCanvasContent?this.props.canvasConfig.dropZoneCanvasContent:C.default.createElement("div",null,C.default.createElement("div",{className:"dropzone-canvas"}),C.default.createElement("div",{className:"dropzone-canvas-rect"}))),e}},{key:"getSVGCanvasDiv",value:function(){return C.default.createElement("div",{tabIndex:"-1",className:"d3-svg-canvas-div",id:this.svgCanvasDivId,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp})}},{key:"setIsDropZoneDisplayed",value:function(e){e!==this.state.isDropZoneDisplayed&&this.setState({isDropZoneDisplayed:e})}},{key:"isDropZoneDisplayed",value:function(){return this.props.canvasConfig.enableDropZoneOnExternalDrag&&this.state.isDropZoneDisplayed}},{key:"isDataTypeBeingDraggedFile",value:function(e){return!(!e.dataTransfer||!Array.isArray(e.dataTransfer.types))&&e.dataTransfer.types.includes("Files")}},{key:"afterUpdate",value:function(){this.afterUpdateCallbacks.forEach((function(e){return e()}))}},{key:"addAfterUpdateCallback",value:function(e){-1===this.afterUpdateCallbacks.findIndex((function(t){return t===e}))&&this.afterUpdateCallbacks.push(e)}},{key:"removeAfterUpdateCallback",value:function(e){var t=this.afterUpdateCallbacks.findIndex((function(t){return t===e}));t>-1&&this.afterUpdateCallbacks.splice(t,1)}},{key:"addEventListeners",value:function(){this.eventListenersAdded||(document.addEventListener("cut",this.onCut,!0),document.addEventListener("copy",this.onCopy,!0),document.addEventListener("paste",this.onPaste,!0),document.addEventListener("mousemove",this.onMouseMove,!0),this.eventListenersAdded=!0)}},{key:"removeEventListeners",value:function(){this.eventListenersAdded&&(document.removeEventListener("cut",this.onCut,!0),document.removeEventListener("copy",this.onCopy,!0),document.removeEventListener("paste",this.onPaste,!0),document.removeEventListener("mousemove",this.onMouseMove,!0),this.eventListenersAdded=!1)}},{key:"drop",value:function(e){if(e.preventDefault(),this.setIsDropZoneDisplayed(!1),this.first=!1,this.second=!1,this.props.canvasConfig.enableEditingActions){var t=this.props.canvasController.getDragNodeTemplate();if(t)this.svgCanvasD3.nodeTemplateDropped(t,e.clientX,e.clientY),this.props.canvasController.nodeTemplateDragEnd();else{var n=this.getDNDJson(e);n||(n={operation:"addToCanvas",data:{dataTransfer:e.dataTransfer,editType:"createFromExternalObject"}}),this.svgCanvasD3.externalObjectDropped(n,e.clientX,e.clientY)}}}},{key:"dragOver",value:function(e){if(Math.abs(this.dragX-e.clientX)>5||Math.abs(this.dragY-e.clientY)>5){this.dragX=e.clientX,this.dragY=e.clientY;var t=this.props.canvasController.getDragNodeTemplate();t&&this.svgCanvasD3.nodeTemplateDragOver(t,e.clientX,e.clientY)}}},{key:"dragEnter",value:function(e){this.dragX=null,this.dragY=null,this.isDataTypeBeingDraggedFile(e)&&(this.first?this.second=!0:(this.first=!0,this.setIsDropZoneDisplayed(!0))),e.preventDefault()}},{key:"dragLeave",value:function(e){this.isDataTypeBeingDraggedFile(e)&&(this.second?this.second=!1:this.first&&(this.first=!1),this.first||this.second||this.setIsDropZoneDisplayed(!1)),e.preventDefault()}},{key:"focusOnCanvas",value:function(){document.getElementById(this.svgCanvasDivId)&&document.getElementById(this.svgCanvasDivId).focus()}},{key:"refreshOnSizeChange",value:function(){this.svgCanvasD3&&this.svgCanvasD3.refreshOnSizeChange()}},{key:"render",value:function(){this.logger.log("render");var e=this.getStateTag(),t=this.getEmptyCanvas(),n=this.getReturnToPreviousBtn(),i=this.getContextMenu(),o=this.getTextToolbar(),a=this.getDropZone(),r=this.getSVGCanvasDiv();return C.default.createElement("main",{"aria-label":this.getLabel("canvas.label"),role:"main"},C.default.createElement(T.default,{handleWidth:!0,handleHeight:!0,onResize:this.refreshOnSizeChange,targetRef:this.contentsRef},C.default.createElement("div",{id:this.mainCanvasDivId,ref:this.contentsRef,className:"common-canvas-drop-div",onDrop:this.drop,onDragOver:this.dragOver,onDragEnter:this.dragEnter,onDragLeave:this.dragLeave},r,t,n,e,i,o,a)))}}])}(C.default.Component),Ls=i.connect((function(e,t){return{canvasInfo:e.canvasinfo,canvasConfig:e.canvasconfig,bottomPanelIsOpen:e.bottompanel.isOpen,selectionInfo:e.selectioninfo,breadcrumbs:e.breadcrumbs}}))(o.injectIntl(Ts)),Ps="Close";function Ns(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Ss()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Ss(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ss=function(){return!!e})()}var _s=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Ns(this,i,[t])).state={},n.logger=new g.Logger("NotificationPanel"),n.keyDownOnPanel=n.keyDownOnPanel.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"componentDidMount",value:function(){this.setFocusOnFirstItem()}},{key:"setFocusOnFirstItem",value:function(){this.allRefs.length>0&&this.allRefs[0].focus()}},{key:"getNotifications",value:function(){var e=this,t=[];if(!this.props.messages)return t;for(var n=0;n<this.props.messages.length;n++){var i=this.props.messages[n],o=i.callback?" clickable ":"",a=i.type,r=C.default.createElement("div",{className:"notification-message-type"},C.default.createElement(s.Icon,{type:a,className:"notification-message-icon-".concat(a)})),l=i.title?C.default.createElement("div",{className:"notification-message-title"},i.title):null,c=i.subtitle?C.default.createElement("div",{className:"notification-message-subtitle"},i.subtitle,C.default.createElement("hr",null)):null,u=i.closeMessage?C.default.createElement("div",{tabIndex:0,ref:function(t){return!t||e.allRefs.push(t)},className:"notification-message-close",onClick:this.clickOnCloseButton.bind(this,i),onKeyDown:this.keyDownOnCloseButton.bind(this,i)},i.closeMessage):null,d=i.timestamp?C.default.createElement("div",{className:"notification-message-timestamp"},C.default.createElement("div",{className:"notification-message-timestamp-icon"},C.default.createElement(s.Icon,{type:"time"})),C.default.createElement("div",{className:"notification-message-string"},i.timestamp)):null;t.push(C.default.createElement("div",{className:"notifications-button-container",key:n+"-"+i.id},C.default.createElement("div",{className:"notifications "+o+i.type,onClick:this.notificationCallback.bind(this,i.id,i.callback),tabIndex:0,ref:function(t){return!t||e.allRefs.push(t)}},r,C.default.createElement("div",{className:"notification-message-details"},l,c,C.default.createElement("div",{className:"notification-message-content"},i.content),d,u))))}return t}},{key:"notificationCallback",value:function(e,t){t&&t(e)}},{key:"clickOnCloseButton",value:function(e){this.deleteNotification(e.id)}},{key:"keyDownOnCloseButton",value:function(e,t){32!==t.keyCode&&13!==t.keyCode||this.deleteNotification(e.id)}},{key:"deleteNotification",value:function(e){this.props.subPanelData.canvasController.deleteNotificationMessages(e)}},{key:"clearNotificationMessages",value:function(){this.props.subPanelData.canvasController.clearNotificationMessages(),this.setFocusOnFirstItem(),"function"==typeof this.props.notificationConfig.clearAllCallback&&this.props.notificationConfig.clearAllCallback()}},{key:"keyDownOnPanel",value:function(e){if(9!==e.keyCode||e.shiftKey){if(9===e.keyCode&&e.shiftKey){var t=this.allRefs[this.allRefs.length-1];e.target===this.allRefs[0]&&(e.stopPropagation(),e.preventDefault(),t.focus())}}else{var n=this.allRefs[this.allRefs.length-1];e.target===n&&(e.stopPropagation(),e.preventDefault(),this.allRefs[0].focus())}}},{key:"render",value:function(){var e=this;if(this.logger.log("render"),this.allRefs=[],!this.props.notificationConfig)return null;var t=this.props.notificationConfig&&this.props.notificationConfig.notificationHeader?this.props.notificationConfig.notificationHeader:u.DEFAULT_NOTIFICATION_HEADER,n=C.default.createElement("div",{className:"notification-panel-header"},t),i=this.props.notificationConfig&&this.props.notificationConfig.notificationSubtitle?C.default.createElement("div",{className:"notification-panel-subtitle"},this.props.notificationConfig.notificationSubtitle):null,o=C.default.createElement("div",{className:"notification-panel-close-button"},C.default.createElement(h.Button,{ref:function(t){return!t||e.allRefs.push(t)},size:"sm",kind:"ghost",renderIcon:s.Close,hasIconOnly:!0,iconDescription:this.props.intl.formatMessage({id:"notification.panel.close.button.description",defaultMessage:Ps}),onClick:this.props.closeSubPanel,tooltipAlignment:"end",tooltipPosition:"bottom"})),a=this.props.messages.length>0?this.getNotifications():C.default.createElement("div",{tabIndex:0,ref:function(t){return!t||e.allRefs.push(t)},className:"notification-panel-empty-message-container"},C.default.createElement("div",{className:"notification-panel-empty-message"},this.props.notificationConfig&&this.props.notificationConfig.emptyMessage?this.props.notificationConfig.emptyMessage:null)),r=this.props.notificationConfig&&this.props.notificationConfig.clearAllMessage?C.default.createElement("div",{className:"notification-panel-clear-all-container"},C.default.createElement(h.Button,{ref:function(t){return!t||0===e.props.messages.length||e.allRefs.push(t)},className:"notification-panel-clear-all",onClick:this.clearNotificationMessages.bind(this),kind:"ghost",size:"sm",disabled:0===this.props.messages.length},this.props.notificationConfig.clearAllMessage)):null,l=this.props.notificationConfig&&this.props.notificationConfig.secondaryButtonLabel&&this.props.notificationConfig.secondaryButtonCallback?C.default.createElement("div",{className:"notification-panel-secondary-button-container"},C.default.createElement(h.Button,{ref:function(t){return!t||e.props.secondaryButtonDisabled||e.allRefs.push(t)},className:"notification-panel-secondary-button",onClick:this.props.notificationConfig.secondaryButtonCallback.bind(this),kind:"ghost",size:"sm",disabled:this.props.secondaryButtonDisabled},this.props.notificationConfig.secondaryButtonLabel)):null;return C.default.createElement("div",{className:"notification-panel",onKeyDown:this.keyDownOnPanel},C.default.createElement("div",{className:"notification-panel-header-container",tabIndex:0,ref:function(t){return!t||e.allRefs.push(t)}},n,i),o,C.default.createElement("div",{className:"notification-panel-messages"},a),C.default.createElement("div",{className:"notification-panel-button-container"},r,l))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return e.messages!==t.messages?{messages:e.messages}:{}}}])}(C.default.Component),Es=i.connect((function(e,t){return{notificationConfig:e.notificationpanel.config,secondaryButtonDisabled:!!e.notificationpanel.config&&e.notificationpanel.config.secondaryButtonDisabled,messages:e.notifications}}))(o.injectIntl(_s));function Is(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Ds()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Ds(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ds=function(){return!!e})()}var Os=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Is(this,i,[t])).logger=new g.Logger("CC-Toolbar"),n.getLabel=n.getLabel.bind(n),n.toolbarActionHandler=n.toolbarActionHandler.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"getLabel",value:function(e,t){var n=v.defaultMessages1[e]?v.defaultMessages1[e]:gt[e];return this.props.intl.formatMessage({id:e,defaultMessage:n},t)}},{key:"getDefaultToolbar",value:function(){return{leftBar:[{action:"undo",label:this.getLabel("canvas.undo"),enable:!0},{action:"redo",label:this.getLabel("canvas.redo"),enable:!0},{action:"cut",label:this.getLabel("edit.cutSelection"),enable:!0},{action:"copy",label:this.getLabel("edit.copySelection"),enable:!0},{action:"paste",label:this.getLabel("edit.pasteSelection"),enable:!0},{action:"createAutoComment",label:this.getLabel("canvas.addComment"),enable:!0},{action:"deleteSelectedObjects",label:this.getLabel("canvas.deleteObject"),enable:!0}],rightBar:[{action:"zoomIn",label:this.getLabel("toolbar.zoomIn"),enable:!0},{action:"zoomOut",label:this.getLabel("toolbar.zoomOut"),enable:!0},{action:"zoomToFit",label:this.getLabel("toolbar.zoomToFit"),enable:!0}]}}},{key:"getConvertedLegacyToolbar",value:function(e){return{leftBar:e,rightBar:this.getDefaultRightBar()}}},{key:"getDefaultRightBar",value:function(){return[{action:"zoomIn",label:this.getLabel("toolbar.zoomIn"),enable:!0},{action:"zoomOut",label:this.getLabel("toolbar.zoomOut"),enable:!0},{action:"zoomToFit",label:this.getLabel("toolbar.zoomToFit"),enable:!0}]}},{key:"getNotificationClassName",value:function(){var e=this.props.canvasController.getNotificationMessagesMaxType(),t=u.NOTIFICATION_ICON_CLASS;return e===u.ERROR?t+=" error":e===u.WARNING?t+=" warning":e===u.SUCCESS?t+=" success":e===u.INFO&&(t+=" info"),t}},{key:"generateToolbarConfig",value:function(){var e=this.copyConfig();return e?Array.isArray(e)?e=this.getConvertedLegacyToolbar(e):void 0===e.rightBar&&(e.rightBar=this.getDefaultRightBar()):e=this.getDefaultToolbar(),e=Object.assign({},e,{leftBar:this.optionallyAddPaletteTool(e.leftBar||[])},{rightBar:this.optionallyAddNotificationTool(e.rightBar||[])})}},{key:"copyConfig",value:function(){if(!this.props.config)return null;if(Array.isArray(this.props.config))return d._toConsumableArray(this.props.config);var e={};return this.props.config.overrideAutoEnableDisable&&(e.overrideAutoEnableDisable=!0),this.props.config&&this.props.config.leftBar&&(e.leftBar=d._toConsumableArray(this.props.config.leftBar)),this.props.config&&this.props.config.rightBar&&(e.rightBar=d._toConsumableArray(this.props.config.rightBar)),e}},{key:"toolbarActionHandler",value:function(e){this.props.canvasController.toolbarActionHandler(e)}},{key:"optionallyAddPaletteTool",value:function(e){var t=this.getLabel("toolbar.palette"),n=e;if(e&&e.length>0&&"palette"===e[0].action&&(t=e[0].label?e[0].label:t,n=e.slice(1),e.length>1&&e[1].divider&&(n=e.slice(2))),this.props.isPaletteEnabled){var i=this.props.isPaletteOpen?"paletteClose-action":"paletteOpen-action";return[{action:u.TOOLBAR_TOGGLE_PALETTE,label:t,enable:!0,isSelected:this.props.isPaletteOpen,className:i},{divider:!0}].concat(n)}return n}},{key:"optionallyAddNotificationTool",value:function(e){if(this.props.notificationConfigExists){var t=this.props.notificationMessages.length,n=[{divider:!0},{action:u.TOOLBAR_TOGGLE_NOTIFICATION_PANEL,label:this.props.notificationConfigLabel,enable:this.props.notificationConfigEnable,extIsSubAreaDisplayed:this.props.isNotificationOpen,setExtIsSubAreaDisplayed:this.callExtIsSubAreaDisplayed.bind(this),className:this.getNotificationClassName(),textContent:t>9?"9+":t.toString(),subPanel:Es,subPanelData:{canvasController:this.props.canvasController},leaveSubAreaOpenOnClickOutside:this.props.notificationConfigKeepOpen}];return e.concat(n)}return e}},{key:"callExtIsSubAreaDisplayed",value:function(e){e?this.props.canvasController.openNotificationPanel():this.props.canvasController.closeNotificationPanel()}},{key:"configureToolbarButtonsState",value:function(e){if(!this.props.enableInternalObjectModel||e.overrideAutoEnableDisable)return e;if(void 0!==e){var t=this.props.enableEditingActions;this.applyToolState("undo",e,t&&this.props.canUndo),this.applyToolState("redo",e,t&&this.props.canRedo),this.applyToolState("cut",e,t&&this.props.canCutCopy),this.applyToolState("copy",e,t&&this.props.canCutCopy),this.applyToolState("paste",e,t&&this.props.canPaste),this.applyToolState("deleteSelectedObjects",e,t&&this.props.canDelete),this.applyToolState("createAutoComment",e,t),this.applyToolState("arrangeHorizontally",e,t),this.applyToolState("arrangeVertically",e,t),this.applyToolState("zoomIn",e,this.props.canZoomIn),this.applyToolState("zoomOut",e,this.props.canZoomOut),this.applyToolState("zoomToFit",e,this.props.canZoomToFit)}return e}},{key:"addUndoRedoCommandLabels",value:function(e){var t=this.props.undoLabel,n=this.props.redoLabel;if(t){var i=this.findTool("undo",e);i&&(i.label=this.getLabel("canvas.undoCommand",{undo_command:t}))}if(n){var o=this.findTool("redo",e);o&&(o.label=this.getLabel("canvas.redoCommand",{redo_command:n}))}return e}},{key:"applyToolState",value:function(e,t,n){var i=this.findTool(e,t);i?i.enable=n:this.logger.log("Toolbar tool "+e+" could not be found to set state to "+n)}},{key:"findTool",value:function(e,t){var n={};return t.leftBar&&(n=t.leftBar.find((function(t){return t.action===e}))),!n&&t.rightBar&&(n=t.rightBar.find((function(t){return t.action===e}))),n}},{key:"render",value:function(){this.logger.log("render");var e=this.generateToolbarConfig();e=this.configureToolbarButtonsState(e),e=this.addUndoRedoCommandLabels(e);var t=null;return this.props.enableToolbarLayout===u.TOOLBAR_LAYOUT_TOP&&(t=C.default.createElement("div",{"aria-label":this.getLabel("toolbar.label"),role:"navigation",className:"common-canvas-toolbar"},C.default.createElement(a.Toolbar,{config:e,containingDivId:this.props.containingDivId,instanceId:this.props.canvasController.getInstanceId(),toolbarActionHandler:this.toolbarActionHandler,additionalText:{overflowMenuLabel:this.getLabel("toolbar.overflowMenu")}}))),t}}])}(C.default.Component),ws=i.connect((function(e,t){var n,i,o,a,r,s,l;return{enableToolbarLayout:e.canvasconfig.enableToolbarLayout,config:e.canvastoolbar.config,isPaletteEnabled:e.canvasconfig.enablePaletteLayout!==u.PALETTE_LAYOUT_NONE,isPaletteOpen:e.palette.isOpen,isNotificationOpen:e.notificationpanel.isOpen,notificationConfigExists:null===(n=e.notificationpanel)||void 0===n?void 0:n.config,notificationConfigEnable:null===(i=e.notificationpanel)||void 0===i||null===(o=i.config)||void 0===o?void 0:o.enable,notificationConfigLabel:null===(a=e.notificationpanel)||void 0===a||null===(r=a.config)||void 0===r?void 0:r.label,notificationConfigKeepOpen:null===(s=e.notificationpanel)||void 0===s||null===(l=s.config)||void 0===l?void 0:l.keepOpen,notificationMessages:e.notifications,enableInternalObjectModel:e.canvasconfig.enableInternalObjectModel,enableEditingActions:e.canvasconfig.enableEditingActions,canUndo:t.canvasController.canUndo(),canRedo:t.canvasController.canRedo(),canCutCopy:t.canvasController.canCutCopy(),canPaste:t.canvasController.canPaste(),canDelete:t.canvasController.canDelete(),canZoomIn:t.canvasController.canZoomIn(),canZoomOut:t.canvasController.canZoomOut(),canZoomToFit:t.canvasController.canZoomToFit(),undoLabel:t.canvasController.getUndoLabel(),redoLabel:t.canvasController.getRedoLabel()}}))(o.injectIntl(Os));function As(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Ms()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Ms(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Ms=function(){return!!e})()}var zs=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=As(this,i,[t])).logger=new g.Logger("CC-RightFlyout"),n}return t._inherits(i,n),e._createClass(i,[{key:"render",value:function(){this.logger.log("render");var e=null;if(this.props.content&&this.props.isOpen){var t=this.props.enableRightFlyoutUnderToolbar?"right-flyout-panel under-toolbar":"right-flyout-panel";e=C.default.createElement("div",{className:t},this.props.content)}return e}}])}(C.default.Component),Us=i.connect((function(e,t){return{isOpen:e.rightflyout.isOpen,content:e.rightflyout.content,enableRightFlyoutUnderToolbar:e.canvasconfig.enableRightFlyoutUnderToolbar}}))(zs);function Rs(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Hs()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Hs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Hs=function(){return!!e})()}var js=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Rs(this,i,[t])).logger=new g.Logger("CC-Bottom-Panel"),n.onMouseUp=n.onMouseUp.bind(n),n.onMouseDown=n.onMouseDown.bind(n),n.onMouseMoveY=n.onMouseMoveY.bind(n),n}return t._inherits(i,n),e._createClass(i,[{key:"onMouseDown",value:function(e){0===e.button&&(document.addEventListener("mousemove",this.onMouseMoveY,!0),document.addEventListener("mouseup",this.onMouseUp,!0),this.posY=e.clientY,e.preventDefault())}},{key:"onMouseUp",value:function(e){document.removeEventListener("mousemove",this.onMouseMoveY,!0),document.removeEventListener("mouseup",this.onMouseUp,!0)}},{key:"onMouseMoveY",value:function(e){if(e.clientY){var t=e.clientY-this.posY,n=this.props.panelHeight-t;this.props.canvasController.setBottomPanelHeight(this.limitHeight(n)),this.posY=e.clientY}}},{key:"limitHeight",value:function(e){var t=document.getElementById(this.props.containingDivId),n=e;if(t){var i=t.getBoundingClientRect().height-100;n=Math.min(Math.max(n,75),i)}return n}},{key:"render",value:function(){this.logger.log("render");var e=null;if(this.props.bottomPanelIsOpen){var t=this.limitHeight(this.props.panelHeight)+"px";e=C.default.createElement("div",{className:"bottom-panel",style:{height:t}},C.default.createElement("div",{className:"bottom-panel-drag",onMouseDown:this.onMouseDown}),C.default.createElement("div",{className:"bottom-panel-contents"},this.props.bottomPanelContent))}return e}}])}(C.default.Component),Fs=i.connect((function(e,t){return{bottomPanelIsOpen:e.bottompanel.isOpen,bottomPanelContent:e.bottompanel.content,panelHeight:e.bottompanel.panelHeight}}))(js);function Bs(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Gs()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Gs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Gs=function(){return!!e})()}var Ws=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Bs(this,i,[t])).logger=new g.Logger("CC-Top-Panel"),n}return t._inherits(i,n),e._createClass(i,[{key:"render",value:function(){this.logger.log("render");var e=null,t="top-panel";return this.props.toolbarIsOpen&&(t+=" common-canvas-toolbar-none"),this.props.topPanelIsOpen&&(e=C.default.createElement("div",{className:t},this.props.topPanelContent)),e}}])}(C.default.Component),Ys=i.connect((function(e,t){return{topPanelIsOpen:e.toppanel.isOpen,topPanelContent:e.toppanel.content,toolbarIsOpen:"None"===e.canvasconfig.enableToolbarLayout}}))(Ws);function Ks(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Xs()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Xs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Xs=function(){return!!e})()}var Vs=function(n){function i(t){var n;return e._classCallCheck(this,i),(n=Ks(this,i,[t])).logger=new g.Logger("CC-CentralItems"),n}return t._inherits(i,n),e._createClass(i,[{key:"onDragOver",value:function(e){e.preventDefault()}},{key:"onDrop",value:function(e){e.preventDefault()}},{key:"generateClass",value:function(){var e="common-canvas";return e+=this.props.enableEditingActions?"":" config-editing-actions-false",e+=this.props.enableParentClass?" "+this.props.enableParentClass:""}},{key:"render",value:function(){this.logger.log("render");var e=C.default.createElement($e,{canvasController:this.props.canvasController}),t=C.default.createElement(Ve,{canvasController:this.props.canvasController,containingDivId:this.props.containingDivId}),n=C.default.createElement(Us,null),i=C.default.createElement(ws,{canvasController:this.props.canvasController,containingDivId:this.props.containingDivId}),o=C.default.createElement(Ls,{canvasController:this.props.canvasController}),a=C.default.createElement(Fs,{canvasController:this.props.canvasController,containingDivId:this.props.containingDivId}),r=C.default.createElement(Ys,{canvasController:this.props.canvasController,containingDivId:this.props.containingDivId}),s=null;if(this.props.enableRightFlyoutUnderToolbar){var l=this.props.toolbarIsOpen?"auto 1fr":"1fr",c=this.props.rightFlyoutIsOpen?"1fr auto":"1fr",u=this.props.topPanelIsOpen?"auto 1fr":"1fr";u+=this.props.bottomPanelIsOpen?" auto":"",s=C.default.createElement("div",{className:"common-canvas-right-side-items-under-toolbar",style:{gridTemplateRows:l}},i,C.default.createElement("div",{id:this.props.containingDivId,className:"common-canvas-items-container-under-toolbar",style:{gridTemplateColumns:c}},C.default.createElement("div",{className:"common-canvas-with-top-and-bottom-panel",style:{gridTemplateRows:u}},r,o,a),n))}else{var d="";d+=this.props.toolbarIsOpen?"auto":"",d+=this.props.topPanelIsOpen?" auto":"",d+=" 1fr",d+=this.props.bottomPanelIsOpen?" auto":"",s=C.default.createElement("div",{className:"common-canvas-right-side-items"},C.default.createElement("div",{id:this.props.containingDivId,className:"common-canvas-items-container",style:{gridTemplateRows:d}},i,r,o,a),n)}var h=this.generateClass();return C.default.createElement("div",{className:h,onDragOver:this.onDragOver,onDrop:this.onDrop},t,s,e)}}])}(C.default.Component),Zs=i.connect((function(e,t){return{enableParentClass:e.canvasconfig.enableParentClass,enableEditingActions:e.canvasconfig.enableEditingActions,enableRightFlyoutUnderToolbar:e.canvasconfig.enableRightFlyoutUnderToolbar,toolbarIsOpen:"None"!==e.canvasconfig.enableToolbarLayout,topPanelIsOpen:e.toppanel.isOpen,bottomPanelIsOpen:e.bottompanel.isOpen,rightFlyoutIsOpen:e.rightflyout.isOpen}}))(Vs);function qs(e,n,i){return n=t._getPrototypeOf(n),t._possibleConstructorReturn(e,Js()?Reflect.construct(n,i||[],t._getPrototypeOf(e).constructor):n.apply(e,i))}function Js(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(Js=function(){return!!e})()}var $s=function(n){function o(t){var n;return e._classCallCheck(this,o),(n=qs(this,o,[t])).logger=new g.Logger(["CommonCanvas"]),n.logger.log("constructor"),n.initializeController=n.initializeController.bind(n),n.containingDivId="common-canvas-items-container-"+t.canvasController.getInstanceId(),t.canvasController.setIntl(t.intl),n.initializeController(t),n}return t._inherits(o,n),e._createClass(o,[{key:"componentDidUpdate",value:function(){this.logger.log("componentDidUpdate"),this.initializeController(this.props)}},{key:"initializeController",value:function(e){this.logger.logStartTimer("initializeController"),e.canvasController.setCanvasConfig(e.config),e.canvasController.setContextMenuConfig(e.contextMenuConfig),e.canvasController.setKeyboardConfig(e.keyboardConfig),e.canvasController.setToolbarConfig(e.toolbarConfig),e.canvasController.setNotificationPanelConfig(e.notificationConfig),e.canvasController.setRightFlyoutConfig({content:e.rightFlyoutContent,isOpen:e.showRightFlyout}),e.canvasController.setBottomPanelConfig({content:e.bottomPanelContent,isOpen:e.showBottomPanel}),e.canvasController.setTopPanelConfig({content:e.topPanelContent,isOpen:e.showTopPanel}),e.canvasController.setHandlers({contextMenuHandler:e.contextMenuHandler,beforeEditActionHandler:e.beforeEditActionHandler,editActionHandler:e.editActionHandler,clickActionHandler:e.clickActionHandler,decorationActionHandler:e.decorationActionHandler,tipHandler:e.tipHandler,layoutHandler:e.layoutHandler,idGeneratorHandler:e.idGeneratorHandler,selectionChangeHandler:e.selectionChangeHandler,actionLabelHandler:e.actionLabelHandler}),this.logger.logEndTimer("initializeController")}},{key:"render",value:function(){return this.logger.log("render"),C.default.createElement(i.Provider,{store:this.props.canvasController.getStore()},C.default.createElement(Zs,{canvasController:this.props.canvasController,containingDivId:this.containingDivId}))}}])}(C.default.Component),Qs=o.injectIntl($s);exports.commonCanvas=Qs;
|
|
2
|
+
//# sourceMappingURL=common-canvas-37153a9b.js.map
|