Liferay.Loader.define("portal-workflow-kaleo-designer-web@5.0.115/designer/js/definition-builder/diagram-builder/components/transitions/Edge",["module","exports","require","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","liferay!frontend-js-dependencies-web$react-flow-renderer","../../../DefinitionBuilderContext","../../../constants","../../DiagramBuilderContext","../../util/getBezierEdgeCenter","./MarkerEndDefinition","./utils"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;_interopRequireDefault(r("liferay!frontend-js-react-web$prop-types"));var n=_interopRequireWildcard(r("liferay!frontend-js-react-web$react")),a=r("liferay!frontend-js-dependencies-web$react-flow-renderer"),o=r("../../../DefinitionBuilderContext"),i=r("../../../constants"),l=r("../../DiagramBuilderContext"),d=_interopRequireDefault(r("../../util/getBezierEdgeCenter")),u=_interopRequireWildcard(r("./MarkerEndDefinition")),c=r("./utils");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}return r.default=e,t&&t.set(e,r),r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s={transition:function Edge(e){var t;const{data:{defaultEdge:r=!0,label:s},id:f,source:g,style:p={},target:y}=e,{elements:b,selectedLanguageId:w}=(0,n.useContext)(o.DefinitionBuilderContext),{selectedItem:j,setSelectedItem:O}=(0,n.useContext)(l.DiagramBuilderContext);let _=s;_&&_[i.defaultLanguageId]||(_={[i.defaultLanguageId]:Liferay.Language.get("task")});let P=_[i.defaultLanguageId];w&&_[w]&&(P=_[w]);const m=(0,a.useStoreState)((e=>e.nodes)),h=(0,n.useMemo)((()=>m.find((e=>e.id===g))),[g,m]),v=(0,n.useMemo)((()=>m.find((e=>e.id===y))),[y,m]),{sourcePos:C,sx:D,sy:E,targetPos:x,tx:B,ty:k}=(0,c.getEdgeParams)(h,v),q=b.filter((e=>e.source===y&&e.target===g)).length,R=b.findIndex((e=>e.source===y&&e.target===g)),S=b.findIndex((e=>e.id===f));let W=D,I=B;q&&(W=S>R?W+40:W-40,I=S>R?I+40:I-40);const M=(0,a.getBezierPath)({sourcePosition:C,sourceX:W,sourceY:E,targetPosition:x,targetX:I,targetY:k});let[F,L]=(0,d.default)({curvature:.25,sourcePosition:C,sourceX:W,sourceY:E,targetPosition:x,targetX:I,targetY:k});q&&(L=S>R?L+21:L-21);const[$,X]=(null==j?void 0:j.id)===f?["#80ACFF","#0B5FFF"]:["#A7A9BC","#6B6C7E"],Y=_objectSpread(_objectSpread({},p),{},{stroke:$,strokeDasharray:0,strokeWidth:2});return r||(Y.strokeDasharray=5),n.default.createElement("g",{className:"react-flow__connection"},n.default.createElement(u.default,{color:$}),n.default.createElement("path",{className:"react-flow__edge-path",d:M,id:f,markerEnd:"url(#".concat(u.markerEndId,")"),style:Y}),n.default.createElement(a.EdgeText,{className:"react-flow-__edge-text",label:null===(t=P)||void 0===t?void 0:t.toUpperCase(),labelBgBorderRadius:"13px",labelBgPadding:[8,4],labelBgStyle:{fill:X},labelShowBg:!0,labelStyle:{fill:"#FFF",fontWeight:600},onClick:()=>O(e),x:F,y:L}))}};t.default=s}}));
//# sourceMappingURL=Edge.js.map