lecom-modeler 0.1.0 → 0.1.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/lib/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";var Ba=Object.create;var Et=Object.defineProperty,za=Object.defineProperties,Fa=Object.getOwnPropertyDescriptor,Ua=Object.getOwnPropertyDescriptors,Wa=Object.getOwnPropertyNames,Ot=Object.getOwnPropertySymbols,Ya=Object.getPrototypeOf,xo=Object.prototype.hasOwnProperty,$o=Object.prototype.propertyIsEnumerable;var Zo=(e,t,o)=>t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))xo.call(t,o)&&Zo(e,o,t[o]);if(Ot)for(var o of Ot(t))$o.call(t,o)&&Zo(e,o,t[o]);return e},y=(e,t)=>za(e,Ua(t));var et=(e,t)=>{var o={};for(var r in e)xo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Ot)for(var r of Ot(e))t.indexOf(r)<0&&$o.call(e,r)&&(o[r]=e[r]);return o};var Ka=(e,t)=>{for(var o in t)Et(e,o,{get:t[o],enumerable:!0})},qo=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Wa(t))!xo.call(e,n)&&n!==o&&Et(e,n,{get:()=>t[n],enumerable:!(r=Fa(t,n))||r.enumerable});return e};var Za=(e,t,o)=>(o=e!=null?Ba(Ya(e)):{},qo(t||!e||!e.__esModule?Et(o,"default",{value:e,enumerable:!0}):o,e)),$a=e=>qo(Et({},"__esModule",{value:!0}),e);var ki={};Ka(ki,{Modeler:()=>Ai});module.exports=$a(ki);var Gt=require("lecom-ui"),Ht=require("react/jsx-runtime");function Xo({children:e}){return(0,Ht.jsxs)(Gt.TooltipProvider,{children:[(0,Ht.jsx)(Gt.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}var G=require("@xyflow/react"),fa=require("lecom-ui"),he=require("react"),ha=require("use-debounce");var st=require("lucide-react");var Ue=require("react/jsx-runtime"),Bt=({size:e=24,className:t})=>(0,Ue.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Ue.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Ue.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Ue.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Ue.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var _o=require("react/jsx-runtime"),tt=({size:e=24,className:t})=>(0,_o.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#f87171",stroke:"#ef4444",strokeWidth:3,className:t,children:(0,_o.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Pe=require("react/jsx-runtime"),zt=({size:e=24,className:t})=>(0,Pe.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,Pe.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var ot=require("react/jsx-runtime"),rt=({size:e=24,className:t})=>(0,ot.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,ot.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,ot.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,ot.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var nt=require("react/jsx-runtime"),Ft=({size:e=24,className:t})=>(0,nt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,nt.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,nt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,nt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var at=require("react/jsx-runtime"),jo=({size:e=24,className:t})=>(0,at.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,at.jsxs)("g",{children:[(0,at.jsx)("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),(0,at.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Jo=require("clsx"),Qo=require("tailwind-merge");function _(...e){return(0,Qo.twMerge)((0,Jo.clsx)(e))}var vt=(e,t)=>e<t?t:e;var Nt=require("react/jsx-runtime"),er=({size:e=24,className:t})=>(0,Nt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:_("stroke-2",t),children:[(0,Nt.jsx)("path",{d:"M19 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Nt.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Ut=require("react/jsx-runtime"),tr=({size:e=24,className:t})=>(0,Ut.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Ut.jsx)("g",{children:(0,Ut.jsx)("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});var wo=require("react/jsx-runtime"),Wt=({size:e=24,className:t})=>(0,wo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#84cc16",stroke:"#65a30d",strokeWidth:"2",className:t,children:(0,wo.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Co=require("react/jsx-runtime"),yt=({size:e=24,className:t})=>(0,Co.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:_("stroke-2",t),children:(0,Co.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});var it=require("react/jsx-runtime"),or=({size:e=24,className:t})=>(0,it.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,it.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,it.jsx)("path",{d:"M7.5 12C7.5 12.89 7.76392 13.76 8.25839 14.5001C8.75285 15.2401 9.45566 15.8169 10.2779 16.1575C11.1002 16.4981 12.005 16.5872 12.8779 16.4135C13.7508 16.2399 14.5526 15.8113 15.182 15.182C15.8113 14.5526 16.2399 13.7508 16.4135 12.8779C16.5872 12.005 16.4981 11.1002 16.1575 10.2779C15.8169 9.45566 15.2401 8.75285 14.5001 8.25839C13.76 7.76392 12.89 7.5 12 7.5C10.742 7.50473 9.53448 7.99561 8.63 8.87L7.5 10",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,it.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var Re=require("react/jsx-runtime"),rr=({size:e=24,className:t})=>(0,Re.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,Re.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Re.jsx)("path",{d:"M15.5 14.5V8.5C15.5 8.23478 15.3946 7.98043 15.2071 7.79289C15.0196 7.60536 14.7652 7.5 14.5 7.5H8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Re.jsx)("path",{d:"M10 16.5H16C16.2652 16.5 16.5196 16.3946 16.7071 16.2071C16.8946 16.0196 17 15.7652 17 15.5V15C17 14.8674 16.9473 14.7402 16.8536 14.6464C16.7598 14.5527 16.6326 14.5 16.5 14.5H11.5C11.3674 14.5 11.2402 14.5527 11.1464 14.6464C11.0527 14.7402 11 14.8674 11 15V15.5C11 15.7652 10.8946 16.0196 10.7071 16.2071C10.5196 16.3946 10.2652 16.5 10 16.5ZM10 16.5C9.73478 16.5 9.48043 16.3946 9.29289 16.2071C9.10536 16.0196 9 15.7652 9 15.5V8.5C9 8.23478 8.89464 7.98043 8.70711 7.79289C8.51957 7.60536 8.26522 7.5 8 7.5C7.73478 7.5 7.48043 7.60536 7.29289 7.79289C7.10536 7.98043 7 8.23478 7 8.5V9.5C7 9.63261 7.05268 9.75979 7.14645 9.85355C7.24021 9.94732 7.36739 10 7.5 10H9",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Re.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Re.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var We=require("react/jsx-runtime"),nr=({size:e=24,className:t})=>(0,We.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,We.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,We.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,We.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,We.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var M=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(M||{});var Yt={SCRIPT:{icon:st.ScrollText},SUBPROCESS:{icon:st.SquarePlus}};var Kt={LOOP:{icon:st.RotateCcw}};var Zt={EXCLUSIVE:{icon:rt},PARALLEL:{icon:Ft},COMPLEX:{icon:zt}};var Io=Za(require("@dagrejs/dagre"),1),lr=require("@xyflow/react"),dr=require("lodash");var qa={MIN_WIDTH:36,MIN_HEIGHT:36},Xa={MIN_WIDTH:36,MIN_HEIGHT:36},ja={MIN_WIDTH:56,MIN_HEIGHT:56},$t={MIN_WIDTH:176,MIN_HEIGHT:96},qt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},oe={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},Xt={MIN_WIDTH:176,MIN_HEIGHT:64},Ja={MIN_WIDTH:128,MIN_HEIGHT:64},K={START_EVENT:qa,END_EVENT:Xa,GATEWAY:ja,TASK:$t,LANE:oe,ANNOTATION:Xt,UNSUPPORTED:Ja};var ar=require("lodash");var Ae=e=>{var t,o,r,n,a,i,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(i=(a=e.measured)==null?void 0:a.width)!=null?i:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},ke=e=>(0,ar.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),ir=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:a}=Ae(t);return{x:o-n,y:r-a}};var lt=({parentId:e,nodes:t,includeTypes:o=[...Object.values(M)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),Qa=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:a}=Ae(t),i=o-n,s=r-a;return Math.sqrt(i*i+s*s)},ei=(e,t)=>{let{x:o,y:r,w:n,h:a}=Ae(e),{x:i,y:s,w:l,h:d}=Ae(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},Tt=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&ei(e,n)){let a=Qa(e,n);a<r&&(r=a,o=n)}return o},sr=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,a;return Math.max(o,(a=(n=r.measured)==null?void 0:n.width)!=null?a:0)},0);var cr=(e=[],t=[],o="LR")=>{let r=new Io.default.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:a,width:i,height:s})=>r.setNode(a,{width:i,height:s})),t.forEach(a=>r.setEdge(a.source,a.target)),Io.default.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return y(E({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},Ye=(e,t)=>{var c,h;let o=[...t],r=o.find(u=>u.id===e);if(!r)return o;let n=o.filter(u=>u.parentId===e&&u.type==="LANE");if(n.length===0)return o;let a=(0,dr.orderBy)(n,["position.y"]),i=Math.max((h=(c=r.measured)==null?void 0:c.width)!=null?h:0,qt.MIN_WIDTH),s=sr(e,a)||oe.MIN_WIDTH,l=Math.max(i,s),d=0,m=0;a.forEach(u=>{var v,g,p,b;o=o.map(w=>w.id===u.id?y(E({},w),{width:l-oe.HEADER_WIDTH,measured:y(E({},w.measured),{width:l-oe.HEADER_WIDTH}),position:{x:oe.HEADER_WIDTH,y:d}}):w),d+=(g=(v=u.measured)==null?void 0:v.height)!=null?g:0,m+=(b=(p=u.measured)==null?void 0:p.height)!=null?b:0}),o=o.map(u=>u.id===e?y(E({},u),{height:m,width:l,measured:y(E({},u.measured),{height:m,width:l})}):u);let f=o.find(u=>u.id===e);return f!=null&&f.parentId&&(o=Ye(f.parentId,o)),o},pr=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ti=50,mr=(e,t=ti)=>{let o=(0,lr.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var ur=require("zustand"),$=(0,ur.create)(e=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:t=>{e({isReadOnly:t})},setIsMultipleSelection:t=>{e({isMultipleSelection:t})},setIsMinimapOpen:t=>{e({isMinimapOpen:t})}}));var wt=require("@xyflow/react");var Ne=require("@xyflow/react");var dt=require("@xyflow/react"),Ee=require("lecom-ui"),hr=require("lucide-react");var jt=require("react"),gr=(0,jt.createContext)(null),fr=gr.Provider,Jt=()=>{let e=(0,jt.useContext)(gr);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};var Ke=require("react/jsx-runtime"),xt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ee.useTranslation)(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=(0,dt.useReactFlow)(),{onConfigureElement:s}=Jt(),l=c=>{let h=a(),u=i(),v=(0,dt.getIncomers)(c,h,u),g=(0,dt.getOutgoers)(c,h,u),p=v.some(w=>w.type==="START_EVENT"),b=g.some(w=>w.type==="END_EVENT");return p?"start":b?"end":"between"},d=()=>{let c=r(e);c&&(s==null||s({id:c.id,type:"activity",variant:l(c)}))},m=()=>{let c=n(e);c&&(s==null||s({id:c.id,type:"routing"}))};return(0,Ke.jsxs)(Ee.Tooltip,{children:[(0,Ke.jsx)(Ee.TooltipTrigger,{asChild:!0,children:(0,Ke.jsx)(Ee.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":d();break;case"edge":m();break}},children:(0,Ke.jsx)(hr.PencilIcon,{size:16})})}),(0,Ke.jsx)(Ee.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var br=require("@xyflow/react"),ve=require("lecom-ui"),Er=require("lucide-react"),Ze=require("react/jsx-runtime"),Qt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,ve.useTranslation)(),{deleteElements:r}=(0,br.useReactFlow)();return(0,Ze.jsxs)(ve.Tooltip,{children:[(0,Ze.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,Ze.jsx)(ve.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Ze.jsx)(Er.TrashIcon,{size:16})})}),(0,Ze.jsx)(ve.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var _t=require("react/jsx-runtime"),ct=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=et(n,["edgeId","edgeType"]);var s;let a=[{component:(0,_t.jsx)(Qt,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:(0,_t.jsx)(xt,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return(0,_t.jsx)("div",y(E({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>(0,_t.jsx)("div",{children:l.component},d))}))};var $e=require("react/jsx-runtime"),to={type:"ANNOTATION_EDGE",zIndex:2e3},vr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=(0,Ne.useNodes)(),{zoom:m}=(0,Ne.useViewport)(),f=d.find(b=>b.id===t),c=d.find(b=>b.id===o),[h,u,v]=(0,Ne.getStraightPath)({sourceX:r,sourceY:n,targetX:a,targetY:i}),g=s||(f==null?void 0:f.selected)||(c==null?void 0:c.selected),p=1/m;return(0,$e.jsxs)("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[(0,$e.jsx)(Ne.BaseEdge,{id:e,path:h,strokeDasharray:4,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":g&&!(l!=null&&l.hasError)})}),(0,$e.jsx)(Ne.EdgeLabelRenderer,{children:(0,$e.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${u}px, ${v}px)`},children:s&&(0,$e.jsx)(ct,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};var re=require("@xyflow/react"),Nr=require("react");var qe=require("react");var Ao=require("react/jsx-runtime"),Q=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=(0,qe.useRef)(null),[l,d]=(0,qe.useState)(!1);(0,qe.useEffect)(()=>{d(r!=null?r:!1)},[r]),(0,qe.useEffect)(()=>{if(l&&s.current){s.current.focus();let h=document.createRange();h.selectNodeContents(s.current),h.collapse(!1);let u=window.getSelection();u&&(u.removeAllRanges(),u.addRange(h))}},[l]);let m=h=>{h.stopPropagation(),d(!0)},f=h=>{let u=h.currentTarget.innerText;t&&u.length>=t&&h.preventDefault()},c=h=>{d(!1),n==null||n(),o==null||o(h.currentTarget.innerText)};return(0,Ao.jsx)("div",{className:_("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",a,{"border border-dashed border-grey-400":l}),style:i,onDoubleClick:m,children:(0,Ao.jsx)("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:c,children:e})})};var Me=require("react/jsx-runtime"),Ve={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:re.MarkerType.ArrowClosed},markerEnd:{type:re.MarkerType.Arrow},data:{label:""}},yr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:m})=>{let f=(0,re.useNodes)(),{zoom:c}=(0,re.useViewport)(),{updateEdgeData:h}=(0,re.useReactFlow)(),[u,v]=(0,Nr.useState)(!1),g=f.find(x=>x.id===t),p=f.find(x=>x.id===o),[b,w,I]=(0,re.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=m||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),O=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=u||(d==null?void 0:d.label.trim().length)>0,T=1/c,D=()=>{v(!0)},C=()=>{v(!1)},S=x=>{h(e,{label:x.trim()})};return(0,Me.jsxs)("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:D,children:[(0,Me.jsx)(re.BaseEdge,{id:e,path:b,markerEnd:`url(#${O})`,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),(0,Me.jsx)(re.EdgeLabelRenderer,{children:(0,Me.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[m&&(0,Me.jsx)(ct,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${T})`}}),N&&(0,Me.jsx)(Q,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:S})]})})]})};var Tr=({setEdges:e})=>{let{getNode:t}=(0,wt.useReactFlow)();return{isValidConnection:n=>{let a=t(n.source),i=t(n.target);if((a==null?void 0:a.id)===(i==null?void 0:i.id))return!1;switch(a==null?void 0:a.type){case"START_EVENT":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"END_EVENT":return(i==null?void 0:i.type)==="ANNOTATION";case"TASK":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"GATEWAY":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"LANE":return(i==null?void 0:i.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(a=>{let i=t(n.target);return(i==null?void 0:i.type)==="ANNOTATION"?(0,wt.addEdge)(E(E({},n),to),a):(0,wt.addEdge)(E(E({},n),Ve),a)})}}};var So=require("react"),Lr=require("lecom-ui"),Dr=require("@xyflow/react");var Ct=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Xe=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Oe=(e=[])=>e.filter(t=>t.type==="TASK")||[],xr=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),_r=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ro=(e=[])=>e.filter(t=>t.type==="GATEWAY"),wr=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),pe=(e,t=[])=>t.filter(o=>o.source===e),It=(e,t=[])=>t.filter(o=>o.target===e),Cr=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(a=>a.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Ir=(e,t)=>{let o=pe(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(a=>a.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Ar=e=>e?/\w/g.test(e.trim()):!1,R=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},ye=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},kr=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var At=[{id:"start_event_not_found",validate:e=>{let t=Ct(e.nodes);return R({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Xe(e.nodes);return R({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Ct(e.nodes),o=t.length===1;if(t.length===0)return R({isValid:!0});if(!o)return R({isValid:!1,nodeIds:t.map(a=>a.id)});let r=pe(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return R({isValid:!1,nodeIds:[...new Set(a)]})}return R({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Oe(e.nodes),o=ye(t,r=>pe(r.id,e.edges).length<=2);return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Oe(e.nodes),o=ye(t,r=>!!r.label&&r.label.trim()!=="");return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Oe(e.nodes),r=ye(o,n=>!n.label||n.label.length<=60);return R({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Oe(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let a=n.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(a=>r.push(a.id));return R({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ro(e.nodes),o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Ct(e.nodes),...Xe(e.nodes)],o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=Xe(e.nodes),o=[],r=[];for(let n of t){let a=It(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.source);if(s&&s.type==="TASK"){let l=pe(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return R({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=wr(e.nodes),o=ye(t,n=>pe(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>pe(n,e.edges).map(a=>a.id));return R({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=Oe(e.nodes),o=ye(t,r=>!r.label||Ar(r.label));return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var i,s;if(!((i=e==null?void 0:e.nodes)!=null&&i.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return R({isValid:!0});let t=Xe(e.nodes)[0];if(!t)return R({isValid:!0});let o=It(t.id,e.edges);if(!o.length)return R({isValid:!0});let n=Oe(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=ye(n,l=>!Cr(l.id,e));return R({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Oe(e.nodes),o=Xe(e.nodes)[0];if(!o)return R({isValid:!0});let r=t.filter(l=>{let d=It(l.id,e.edges),m=pe(l.id,e.edges),f=d.some(h=>{var u;return((u=e.nodes.find(v=>v.id===h.source))==null?void 0:u.type)==="START_EVENT"}),c=m.some(h=>{var u;return((u=e.nodes.find(v=>v.id===h.target))==null?void 0:u.type)==="END_EVENT"});return f&&c}),n=It(o.id,e.edges),a=n.length>1,i=n.map(l=>l.source),s={isValid:r.length===0&&!a,nodeIds:[...r.map(l=>l.id),...a?i:[]]};return R(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ro(e.nodes),o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ro(e.nodes),o=ye(t,r=>pe(r.id,e.edges).length>=1);return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Ct(e.nodes),...Xe(e.nodes)],o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=xr(e.nodes),o=ye(t,r=>!Ir(r.id,e));return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=_r(e.nodes),o=ye(t,r=>{var n,a;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((a=r.properties)==null?void 0:a.subprocessRef)!==""});return R({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Sr=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of At){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Pr=()=>{let{t:e}=(0,Lr.useTranslation)(),[t,o]=(0,So.useState)(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=(0,Dr.useReactFlow)(),[s,l]=(0,So.useState)(!1);return{validationResult:t,validateDiagram:c=>{let h=kr(c.nodes,c.edges),u=Sr(h),v=u.errors.map(g=>y(E({},g),{message:e(`validation.errors.${g.id}`)}));return s||l(!0),{isValid:u.isValid,errors:v}},handleValidationComplete:c=>{if(o(c),!c)return;let h=[],u=[];c.errors.forEach(N=>{N.nodeIds&&N.nodeIds.length>0&&N.nodeIds.forEach(T=>h.push(T)),N.edgeIds&&N.edgeIds.length>0&&N.edgeIds.forEach(T=>u.push(T))});let v=[...new Set(h)];r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})}))),n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})})));let g=a(),p=i(),b=new Set(v),w=new Set;c.errors.forEach(N=>{var C,S;let T=At.find(x=>x.id===N.id);(T==null?void 0:T.highlightRelatedEdges)!==!1&&((C=N.edgeIds)==null||C.forEach(x=>w.add(x)),(S=N.nodeIds)==null||S.forEach(x=>{p.forEach(j=>{(j.source===x||j.target===x)&&w.add(j.id)})}))});let I=new Set,A=new Set,O=new Set;g.forEach(N=>{N.type==="START_EVENT"?I.add(N.id):N.type==="END_EVENT"&&A.add(N.id)}),p.forEach(N=>{I.has(N.source)&&O.add(N.target),A.has(N.target)&&O.add(N.source)}),O.forEach(N=>{var T,D;if(b.has(N)){let C=(T=c.errors.find(x=>{var j;return(j=x.nodeIds)==null?void 0:j.includes(N)}))==null?void 0:T.id;((D=At.find(x=>x.id===C))==null?void 0:D.highlightRelatedEdges)!==!1&&p.forEach(x=>{x.source===N&&A.has(x.target)&&(b.add(x.target),w.add(x.id)),x.target===N&&I.has(x.source)&&(b.add(x.source),w.add(x.id))})}}),b.size>0&&r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:b.has(T.id)})}))),w.size>0&&n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:w.has(T.id)})})))},clearValidation:()=>{o(null),l(!1),r(c=>c.map(h=>y(E({},h),{data:y(E({},h.data),{hasError:!1})}))),n(c=>c.map(h=>y(E({},h),{data:y(E({},h.data),{hasError:!1})})))},isAutoValidationEnabled:s}};var Mr=require("@xyflow/react"),Vr=require("react"),Lo=require("uuid");var ni=15,Rr="bpmn:selection",Or=({offset:e=ni}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=(0,Mr.useReactFlow)();(0,Vr.useEffect)(()=>{let a=s=>{var h;s.preventDefault();let l=t(),d=r(),m=l.filter(u=>u.selected);if(!m.length)return;let f=d.filter(u=>m.some(v=>v.id===u.source)&&m.some(v=>v.id===u.target)),c={nodes:m,edges:f};(h=s.clipboardData)==null||h.setData(Rr,JSON.stringify(c))},i=s=>{var c,h;s.preventDefault();let l=JSON.parse(((c=s.clipboardData)==null?void 0:c.getData(Rr))||"{}");if(!((h=l.nodes)!=null&&h.length))return;let d=new Map,m=l.nodes.map(u=>{let v=(0,Lo.v7)();return d.set(u.id,v),y(E({},u),{id:v,selected:!0,position:{x:u.position.x+e,y:u.position.y+e}})}),f=l.edges.map(u=>y(E({},u),{id:(0,Lo.v7)(),selected:!0,source:d.get(u.source)||u.source,target:d.get(u.target)||u.target}));o(u=>[...u.map(v=>y(E({},v),{selected:!1})),...m]),n(u=>[...u.map(v=>y(E({},v),{selected:!1})),...f])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};var no=require("@xyflow/react"),Do=require("uuid");var Gr=require("zustand"),pt=(0,Gr.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var se=require("@xyflow/react"),Hr=require("react");var Ge=require("react/jsx-runtime"),kl={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:se.MarkerType.Arrow},data:{label:""}},Br=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:m})=>{let f=(0,se.useNodes)(),{zoom:c}=(0,se.useViewport)(),{updateEdgeData:h}=(0,se.useReactFlow)(),[u,v]=(0,Hr.useState)(!1),g=f.find(x=>x.id===t),p=f.find(x=>x.id===o),[b,w,I]=(0,se.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=m||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),O=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=u||(d==null?void 0:d.label.trim().length)>0,T=1/c,D=()=>{v(!0)},C=()=>{v(!1)},S=x=>{h(e,{label:x.trim()})};return(0,Ge.jsxs)("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:D,children:[(0,Ge.jsx)(se.BaseEdge,{id:e,path:b,markerEnd:`url(#${O})`,strokeDasharray:4,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),(0,Ge.jsx)(se.EdgeLabelRenderer,{children:(0,Ge.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[m&&(0,Ge.jsx)(ct,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${T})`}}),N&&(0,Ge.jsx)(Q,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:S})]})})]})};var kt=require("react/jsx-runtime"),zr=({fromX:e,fromY:t,toX:o,toY:r})=>(0,kt.jsxs)("g",{children:[(0,kt.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),(0,kt.jsx)("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var Fr=({nodes:e,setNodes:t,setEdges:o})=>{let r=(0,no.useStoreApi)(),{draggableNode:n,setDraggableNode:a}=pt(),{getInternalNode:i,screenToFlowPosition:s}=(0,no.useReactFlow)(),l=g=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(b=>b.map(w=>y(E({},w),{className:w.id===g?p:""})))},d=()=>{let{nodeLookup:g}=r.getState();return Array.from(g.values())},m=g=>{let p=i(g.id),b=d();if(g.type==="LANE"){if(lt({parentId:g.id,nodes:e,includeTypes:["LANE"]})){l();return}let T=b.filter(S=>S.id!==g.id&&S.type==="LANE"&&!S.parentId),D=Tt(p,T);if(!D){l();return}if(lt({parentId:D.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(D.id);return}let I=b.filter(N=>N.id!==g.id&&N.type==="LANE"),A=Tt(p,I);if(!A){l();return}if(lt({parentId:A.id,nodes:e,includeTypes:["LANE"]})){l();return}l(A.id)},f=g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"},c=(g,p)=>{g.preventDefault(),m(p)},h=(g,p,b)=>{var T,D;let w=C=>C.map(S=>y(E({},S),{className:void 0}));if(g.parentId===p.id){let C=Ye(p.id,b);t(ke(w(C)));return}if(g.type==="LANE"){if(lt({parentId:p.id,nodes:b,excludeTypes:["LANE"]}))return;let x=b.filter(J=>J.parentId===p.id).reduce((J,Qe)=>{var Ce,Fe;return J+((Fe=(Ce=Qe.measured)==null?void 0:Ce.height)!=null?Fe:0)},0),j={x:oe.HEADER_WIDTH,y:x},ie=b.map(J=>J.id===g.id?y(E({},J),{parentId:p.id,position:j,className:void 0}):y(E({},J),{className:void 0}));ie=Ye(p.id,ie),t(ke(ie));return}if(lt({parentId:p.id,nodes:b,includeTypes:["LANE"]})){let C;if(g.parentId){let x=i(g.parentId),{x:j,y:ie}=Ae(x);C={x:j+((T=g.position.x)!=null?T:0),y:ie+((D=g.position.y)!=null?D:0)}}let S=b.map(x=>x.id===g.id?y(E({},x),{position:C!=null?C:x.position,parentId:void 0,className:void 0}):y(E({},x),{className:void 0}));t(ke(S));return}let O=ir(g,p),N=b.map(C=>C.id===g.id?y(E({},C),{parentId:p.id,position:O,className:void 0}):y(E({},C),{className:void 0}));t(ke(N))};return{onDragOver:f,onDrop:g=>{if(g.preventDefault(),!(n!=null&&n.type))return;let p=s({x:g.clientX,y:g.clientY}),b={width:K[n.type].MIN_WIDTH,height:K[n.type].MIN_HEIGHT},w={id:(0,Do.v7)(),type:n.type,position:p,measured:b,data:{label:"",variant:n.variant,attribute:n.attribute}},I=y(E({},w),{internals:{positionAbsolute:p}}),A=d(),O=n.type==="LANE",N=A.filter(C=>O?C.type==="LANE"&&!C.parentId:C.type==="LANE"),T=Tt(I,N);T?h(I,T,[...A,I]):t(C=>{let S=C.concat(w);return ke(S)});let D=g.dataTransfer.getData("sourceId");if(D){let C={id:(0,Do.v7)(),source:D,target:w.id};if(n.type==="ANNOTATION"){o(S=>S.concat(E(E({},C),to)));return}o(S=>S.concat(E(E({},C),Ve)))}a(null)},onNodeDrag:c,onNodeDragStop:async(g,p)=>{var T,D;let{nodeLookup:b}=r.getState(),w=i(p.id),I=Array.from(b.values()),A=p.type==="LANE",O=I.filter(C=>C.id!==p.id&&(A?C.type==="LANE"&&!C.parentId:C.type==="LANE")),N=Tt(w,O);if(N){h(w,N,I);return}if(p.parentId){let C=i(p.parentId),{x:S,y:x}=Ae(C),j={x:S+((T=p.position.x)!=null?T:0),y:x+((D=p.position.y)!=null?D:0)},ie=e.map(J=>J.id===p.id?y(E({},J),{position:j,parentId:void 0}):J);ie=Ye(p.parentId,ie),t(ke(ie))}}}};var Wr=require("@xyflow/react"),St=require("react");function Ur(e,t,o=5){var l,d,m,f,c,h,u,v;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(g=>g.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((f=(m=n.measured)==null?void 0:m.height)!=null?f:0),width:(h=(c=n.measured)==null?void 0:c.width)!=null?h:0,height:(v=(u=n.measured)==null?void 0:u.height)!=null?v:0},i=o,s=o;return t.filter(g=>g.id!==n.id).reduce((g,p)=>{var S,x,j,ie,J,Qe,Ce,Fe;let b={left:p.position.x,right:p.position.x+((x=(S=p.measured)==null?void 0:S.width)!=null?x:0),top:p.position.y,bottom:p.position.y+((ie=(j=p.measured)==null?void 0:j.height)!=null?ie:0),width:(Qe=(J=p.measured)==null?void 0:J.width)!=null?Qe:0,height:(Fe=(Ce=p.measured)==null?void 0:Ce.height)!=null?Fe:0},w=Math.abs(a.left-b.left);w<s&&(g.snapPosition.x=b.left,g.vertical=b.left,s=w);let I=Math.abs(a.right-b.right);I<s&&(g.snapPosition.x=b.right-a.width,g.vertical=b.right,s=I);let A=Math.abs(a.left-b.right);A<s&&(g.snapPosition.x=b.right,g.vertical=b.right,s=A);let O=Math.abs(a.right-b.left);O<s&&(g.snapPosition.x=b.left-a.width,g.vertical=b.left,s=O);let N=Math.abs(a.top-b.top);N<i&&(g.snapPosition.y=b.top,g.horizontal=b.top,i=N);let T=Math.abs(a.bottom-b.top);T<i&&(g.snapPosition.y=b.top-a.height,g.horizontal=b.top,i=T);let D=Math.abs(a.bottom-b.bottom);D<i&&(g.snapPosition.y=b.bottom-a.height,g.horizontal=b.bottom,i=D);let C=Math.abs(a.top-b.bottom);return C<i&&(g.snapPosition.y=b.bottom,g.horizontal=b.bottom,i=C),g},r)}var Yr=()=>{let[e,t]=(0,St.useState)(void 0),[o,r]=(0,St.useState)(void 0),n=(0,St.useCallback)((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=Ur(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return(0,Wr.applyNodeChanges)(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};var Xr=require("@xyflow/react"),Po=require("uuid");var Zr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},$r={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Kr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],i="",s="",l="";if(o.length){switch(o[1]){case"<start>":i="start-event";break;case"<end>":i="end-event";break}e=e.replace(o[1],"")}return r.length&&(i="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(i="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:i,label:s}),{step:e,type:i,label:s,edgeLabel:l}},ai=e=>{e=e||"";let t=e.trim().split(`
2
- `),o={},r=[];return t.forEach(n=>{n=n||"";let a=n.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let i=Kr(a[0],o),s=Kr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},qr=e=>{let{components:t,connections:o}=ai(e);return{nodes:t,edges:o}};var jr=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Xr.useReactFlow)();return{createDiagram:n=>{let{nodes:a,edges:i}=qr(n),s=[],l=new Map;for(let[c,h]of Object.entries(a)){let u=(0,Po.v7)(),v=Zr[h.type],g=$r[h.type];l.set(c,u);let p=K[v].MIN_WIDTH,b=K[v].MIN_HEIGHT;s.push({id:u,type:v,data:{label:h.label||"",variant:g,attribute:""},position:{x:0,y:0},width:p,height:b,measured:{width:p,height:b}})}let d=[];for(let c of i){let h=y(E({},Ve),{id:(0,Po.v7)(),source:l.get(c.sourceId)||c.sourceId,target:l.get(c.targetId)||c.targetId});d.push(h)}let{nodes:m,edges:f}=cr(s,d);e(m),t(f),o()}}};var ao=require("react"),ii={origin:"*",debug:!1};function Jr(e,t=ii){let{origin:o,debug:r}=t,n=(0,ao.useCallback)((a,i)=>{r&&console.debug("[postMessage] sending:",{type:a,payload:i}),window.parent.postMessage({type:a,payload:i},o||"*")},[o,r]);return(0,ao.useEffect)(()=>{let a=i=>{let{type:s,data:l}=i.data||{};r&&console.debug("[postMessage] received:",i.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[e,r]),{sendMessage:n}}var en=require("@xyflow/react"),Se=require("react"),tn=require("use-debounce"),si={nodes:[],edges:[]},li=500,Qr=10,on=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=(0,en.useReactFlow)(),[n,a]=(0,Se.useState)([si]),[i,s]=(0,Se.useState)(0),l=n[i],d=i>0,m=i<n.length-1,f=(0,Se.useCallback)(b=>{o(n[b].nodes),r(n[b].edges)},[n,o,r]),c=(0,Se.useCallback)(()=>{if(i>0){let b=i-1;s(b),f(b)}},[i,f]),h=(0,Se.useCallback)(()=>{if(i<n.length-1){let b=i+1;s(b),f(b)}},[n,i,f]),u=b=>{let I=[...n.slice(0,i+1),b],A=I.length>Qr?I.slice(I.length-Qr):I;a(A),s(A.length-1)},v=(0,tn.useDebouncedCallback)(()=>{let b=e(),w=t(),I={nodes:b,edges:w};JSON.stringify(l)!==JSON.stringify(I)&&u(I)},li),g=(0,Se.useCallback)(b=>{if(b==="forceSave"){v();return}b.some(I=>I.type!=="select")&&v()},[v]),p=(0,Se.useCallback)(()=>{a([]),s(0)},[]);return{undo:c,redo:h,saveHistory:g,canUndo:d,canRedo:m,clearHistory:p}};var Ro=require("react/jsx-runtime"),Mo=({id:e,className:t})=>(0,Ro.jsx)("marker",{id:e,className:_("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:(0,Ro.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var mt=require("react/jsx-runtime"),rn=()=>(0,mt.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,mt.jsxs)("defs",{children:[(0,mt.jsx)(Mo,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,mt.jsx)(Mo,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var Go=require("@xyflow/react"),F=require("lecom-ui"),Be=require("lucide-react"),Pt=require("react");var nn=require("@xyflow/react"),di=e=>({unselectAll:e.unselectNodesAndEdges}),io=()=>{let{unselectAll:e}=(0,nn.useStore)(di);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};var Te=require("lecom-ui");var Lt=(p=>(p.START_EVENT="START_EVENT",p.END_EVENT="END_EVENT",p.TASK="TASK",p.SUBPROCESS="SUBPROCESS",p.GATEWAY="GATEWAY",p.ANNOTATION="ANNOTATION",p.CONNECTION="CONNECTION",p.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",p.ACTIVITY="ACTIVITY",p.PROCESS_INTERFACE="PROCESS_INTERFACE",p.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",p.VARIANT_ACTIVITY="VARIANT_ACTIVITY",p.AUTO_ACTIVITY="AUTO_ACTIVITY",p.DATA_STORE="DATA_STORE",p.DATA_OBJECT="DATA_OBJECT",p.DATA_OUTPUT="DATA_OUTPUT",p.DATA_INPUT="DATA_INPUT",p))(Lt||{});var En=require("@xyflow/react"),gt=require("lecom-ui");var an=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var a;t((a=n.target)==null?void 0:a.result)},r.onerror=n=>{var a;o((a=n.target)==null?void 0:a.error)},r.readAsText(e)});function sn({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(i=>i.join(",")).join(`
3
- `),a=encodeURI(n);so(a,`${o}.csv`)}var so=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};var hn=require("uuid");var Vo=require("xml-js");var ci={compact:!0,spaces:4},pi=e=>e.replaceAll(`
4
- `,"&#xA;");function ln(e,t=ci){if(e)return JSON.parse((0,Vo.xml2json)(e,y(E({},t),{attributeValueFn:pi})))}function dn(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}var mn=require("uuid");var wd={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},cn={script:"SCRIPT",subprocess:"SUBPROCESS"},pn={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var ut=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:a}=r,i=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:a||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:i,height:s,measured:{width:i,height:s}}},ui=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=K.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=K.START_EVENT.MIN_HEIGHT,{node:ut({cell:e,type:"START_EVENT"}),status:r,originalType:o}},gi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=K.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=K.END_EVENT.MIN_HEIGHT,{node:ut({cell:e,type:"END_EVENT"}),status:r,originalType:o}},fi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=cn[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=vt(e.mxGeometry._attributes.width,K.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=vt(e.mxGeometry._attributes.height,K.TASK.MIN_HEIGHT),{node:ut({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},hi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=pn[o],n=["none","inclusive","event-based"],a="imported";return n.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=K.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=K.GATEWAY.MIN_HEIGHT,{node:ut({cell:e,type:"GATEWAY",variant:r}),status:a,originalType:t}},bi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=vt(e.mxGeometry._attributes.width,K.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=vt(e.mxGeometry._attributes.height,K.ANNOTATION.MIN_HEIGHT),{node:ut({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},un=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=K.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=K.UNSUPPORTED.MIN_HEIGHT,{node:ut({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},gn=(e,t)=>{let{source:o,target:r}=e._attributes;return y(E({},Ve),{id:(0,mn.v7)(),source:t.get(o)||o,target:t.get(r)||r})},fn={TASK:fi,GATEWAY:hi,START_EVENT:ui,END_EVENT:gi,ANNOTATION:bi};var Ei=e=>{var i;let t=new Map,o=Object.values(Lt),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],a=[];for(let s of r){let l=(0,hn.v7)(),{type:d}=s._attributes,m=fn[d]||un;t.set((i=s._attributes)==null?void 0:i.id,l),s._attributes.id=l;let{node:f,status:c,originalType:h}=m(s);n.push(f),a.push({originalType:h,type:f.type,variant:f.data.variant,value:dn(f.data.label),status:c})}return{nodes:n,governanceIdToNodeIdMap:t,summary:a}},vi=(e,t)=>e.filter(n=>{var a;return(a=n._attributes)==null?void 0:a.edge}).map(n=>gn(n,t)),Ni=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=Ei(t.root.mxCell),a=vi(t.root.mxCell,r);return{nodes:o,edges:a,summary:n}},yi=async e=>{let t=await an(e),o=ln(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},a=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),i=n==null?void 0:n.root;if(!a||!i)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},bn=async e=>{try{let t=await yi(e),{nodes:o,edges:r,summary:n}=Ni(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};var Nn=require("react/jsx-runtime"),vn=()=>{let{t:e}=(0,gt.useTranslation)(),{toast:t}=(0,gt.useNotificationToast)(),{setNodes:o,setEdges:r,fitView:n}=(0,En.useReactFlow)(),a=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=s.map(m=>[m.originalType,m.value,e(`adapter.governance.report.status.${m.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,Nn.jsx)(gt.Button,{size:"small",variant:"ghost",onClick:()=>sn({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:d,summary:m}=await bn(s);if(o(c=>c.concat(l)),r(c=>c.concat(d)),n(),m.some(c=>c.status==="unsupported")){a(m);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};var yn=require("lecom-ui"),Tn=require("react");var je=require("react/jsx-runtime"),xn=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:a}=l,i=et(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=(0,Tn.useRef)(null),m=c=>{let h=c.target.files;h!=null&&h.length&&a(h),d.current&&(d.current.value="")};return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(yn.Button,y(E({onClick:c=>{var h;(h=d.current)==null||h.click(),n==null||n(c)}},i),{children:e})),(0,je.jsx)("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:m})]})};var Je=require("react/jsx-runtime"),_n=({disabled:e=!1})=>{let{t}=(0,Te.useTranslation)(),{toast:o}=(0,Te.useNotificationToast)(),{createDiagram:r}=vn(),n=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},a=i=>{let s=i[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}r(s)};return(0,Je.jsxs)(Te.Tooltip,{children:[(0,Je.jsx)(Te.TooltipTrigger,{asChild:!0,children:(0,Je.jsx)(xn,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:a,children:(0,Je.jsx)(jo,{})})}),(0,Je.jsx)(Te.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var L=require("lecom-ui"),He=require("lucide-react"),An=require("react");var wn=require("@xyflow/react"),Dt=require("html-to-image"),lo=require("lecom-ui"),Cn=require("react");var Ti=3,Oo="diagram",In=()=>{let{t:e}=(0,lo.useTranslation)(),{getNodes:t}=(0,wn.useReactFlow)(),{deselectAll:o}=io(),[r,n]=(0,Cn.useState)({png:!1,html:!1,print:!1}),a=()=>{let{x:m,y:f,width:c,height:h}=mr(t());return{width:c,height:h,style:{width:`${c}px`,height:`${h}px`,transform:`translate(${-m}px, ${-f}px)`}}},i=async(m,f)=>{n(y(E({},r),{[f]:!0})),await o();try{let c=pr();if(!c)throw new Error("Flow element not found");let h=a();return await m(c,h)}catch(c){(0,lo.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(y(E({},r),{[f]:!1}))}};return{exportAsPng:async(m=Oo)=>{await i(async(f,c)=>{let h=await(0,Dt.toPng)(f,y(E({},c),{backgroundColor:"#fcfcfc"}));so(h,`${m}.png`)},"png")},exportAsHtml:async(m=Oo)=>{await i(async(f,c)=>{let h=await(0,Dt.toSvg)(f,y(E({},c),{backgroundColor:"#fcfcfc"})),u=`
1
+ "use strict";var za=Object.create;var Et=Object.defineProperty,Fa=Object.defineProperties,Ua=Object.getOwnPropertyDescriptor,Wa=Object.getOwnPropertyDescriptors,Ya=Object.getOwnPropertyNames,Ot=Object.getOwnPropertySymbols,Ka=Object.getPrototypeOf,_o=Object.prototype.hasOwnProperty,qo=Object.prototype.propertyIsEnumerable;var $o=(e,t,o)=>t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))_o.call(t,o)&&$o(e,o,t[o]);if(Ot)for(var o of Ot(t))qo.call(t,o)&&$o(e,o,t[o]);return e},y=(e,t)=>Fa(e,Wa(t));var et=(e,t)=>{var o={};for(var r in e)_o.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Ot)for(var r of Ot(e))t.indexOf(r)<0&&qo.call(e,r)&&(o[r]=e[r]);return o};var Za=(e,t)=>{for(var o in t)Et(e,o,{get:t[o],enumerable:!0})},Xo=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ya(t))!_o.call(e,n)&&n!==o&&Et(e,n,{get:()=>t[n],enumerable:!(r=Ua(t,n))||r.enumerable});return e};var $a=(e,t,o)=>(o=e!=null?za(Ka(e)):{},Xo(t||!e||!e.__esModule?Et(o,"default",{value:e,enumerable:!0}):o,e)),qa=e=>Xo(Et({},"__esModule",{value:!0}),e);var Si={};Za(Si,{EditorMode:()=>Bt,Modeler:()=>ki});module.exports=qa(Si);var Gt=require("lecom-ui"),Ht=require("react/jsx-runtime");function jo({children:e}){return(0,Ht.jsxs)(Gt.TooltipProvider,{children:[(0,Ht.jsx)(Gt.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}var G=require("@xyflow/react"),ha=require("lecom-ui"),he=require("react"),ba=require("use-debounce");var Bt=(o=>(o.EDIT="edit",o.READONLY="readonly",o))(Bt||{});var st=require("lucide-react");var Ue=require("react/jsx-runtime"),zt=({size:e=24,className:t})=>(0,Ue.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Ue.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Ue.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Ue.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Ue.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var wo=require("react/jsx-runtime"),tt=({size:e=24,className:t})=>(0,wo.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#f87171",stroke:"#ef4444",strokeWidth:3,className:t,children:(0,wo.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Pe=require("react/jsx-runtime"),Ft=({size:e=24,className:t})=>(0,Pe.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,Pe.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Pe.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var ot=require("react/jsx-runtime"),rt=({size:e=24,className:t})=>(0,ot.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,ot.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,ot.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,ot.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var nt=require("react/jsx-runtime"),Ut=({size:e=24,className:t})=>(0,nt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,nt.jsx)("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,nt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,nt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var at=require("react/jsx-runtime"),Jo=({size:e=24,className:t})=>(0,at.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,at.jsxs)("g",{children:[(0,at.jsx)("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),(0,at.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Qo=require("clsx"),er=require("tailwind-merge");function _(...e){return(0,er.twMerge)((0,Qo.clsx)(e))}var vt=(e,t)=>e<t?t:e;var Nt=require("react/jsx-runtime"),tr=({size:e=24,className:t})=>(0,Nt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:_("stroke-2",t),children:[(0,Nt.jsx)("path",{d:"M19 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Nt.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Wt=require("react/jsx-runtime"),or=({size:e=24,className:t})=>(0,Wt.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Wt.jsx)("g",{children:(0,Wt.jsx)("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});var Co=require("react/jsx-runtime"),Yt=({size:e=24,className:t})=>(0,Co.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#84cc16",stroke:"#65a30d",strokeWidth:"2",className:t,children:(0,Co.jsx)("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});var Io=require("react/jsx-runtime"),yt=({size:e=24,className:t})=>(0,Io.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:_("stroke-2",t),children:(0,Io.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});var it=require("react/jsx-runtime"),rr=({size:e=24,className:t})=>(0,it.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,it.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,it.jsx)("path",{d:"M7.5 12C7.5 12.89 7.76392 13.76 8.25839 14.5001C8.75285 15.2401 9.45566 15.8169 10.2779 16.1575C11.1002 16.4981 12.005 16.5872 12.8779 16.4135C13.7508 16.2399 14.5526 15.8113 15.182 15.182C15.8113 14.5526 16.2399 13.7508 16.4135 12.8779C16.5872 12.005 16.4981 11.1002 16.1575 10.2779C15.8169 9.45566 15.2401 8.75285 14.5001 8.25839C13.76 7.76392 12.89 7.5 12 7.5C10.742 7.50473 9.53448 7.99561 8.63 8.87L7.5 10",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,it.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var Re=require("react/jsx-runtime"),nr=({size:e=24,className:t})=>(0,Re.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[(0,Re.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Re.jsx)("path",{d:"M15.5 14.5V8.5C15.5 8.23478 15.3946 7.98043 15.2071 7.79289C15.0196 7.60536 14.7652 7.5 14.5 7.5H8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Re.jsx)("path",{d:"M10 16.5H16C16.2652 16.5 16.5196 16.3946 16.7071 16.2071C16.8946 16.0196 17 15.7652 17 15.5V15C17 14.8674 16.9473 14.7402 16.8536 14.6464C16.7598 14.5527 16.6326 14.5 16.5 14.5H11.5C11.3674 14.5 11.2402 14.5527 11.1464 14.6464C11.0527 14.7402 11 14.8674 11 15V15.5C11 15.7652 10.8946 16.0196 10.7071 16.2071C10.5196 16.3946 10.2652 16.5 10 16.5ZM10 16.5C9.73478 16.5 9.48043 16.3946 9.29289 16.2071C9.10536 16.0196 9 15.7652 9 15.5V8.5C9 8.23478 8.89464 7.98043 8.70711 7.79289C8.51957 7.60536 8.26522 7.5 8 7.5C7.73478 7.5 7.48043 7.60536 7.29289 7.79289C7.10536 7.98043 7 8.23478 7 8.5V9.5C7 9.63261 7.05268 9.75979 7.14645 9.85355C7.24021 9.94732 7.36739 10 7.5 10H9",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Re.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Re.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var We=require("react/jsx-runtime"),ar=({size:e=24,className:t})=>(0,We.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[(0,We.jsx)("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),(0,We.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,We.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,We.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var M=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(M||{});var Kt={SCRIPT:{icon:st.ScrollText},SUBPROCESS:{icon:st.SquarePlus}};var Zt={LOOP:{icon:st.RotateCcw}};var $t={EXCLUSIVE:{icon:rt},PARALLEL:{icon:Ut},COMPLEX:{icon:Ft}};var Ao=$a(require("@dagrejs/dagre"),1),dr=require("@xyflow/react"),cr=require("lodash");var Xa={MIN_WIDTH:36,MIN_HEIGHT:36},ja={MIN_WIDTH:36,MIN_HEIGHT:36},Ja={MIN_WIDTH:56,MIN_HEIGHT:56},qt={MIN_WIDTH:176,MIN_HEIGHT:96},Xt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},oe={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},jt={MIN_WIDTH:176,MIN_HEIGHT:64},Qa={MIN_WIDTH:128,MIN_HEIGHT:64},K={START_EVENT:Xa,END_EVENT:ja,GATEWAY:Ja,TASK:qt,LANE:oe,ANNOTATION:jt,UNSUPPORTED:Qa};var ir=require("lodash");var Ae=e=>{var t,o,r,n,a,i,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(i=(a=e.measured)==null?void 0:a.width)!=null?i:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},ke=e=>(0,ir.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),sr=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:a}=Ae(t);return{x:o-n,y:r-a}};var lt=({parentId:e,nodes:t,includeTypes:o=[...Object.values(M)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),ei=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:a}=Ae(t),i=o-n,s=r-a;return Math.sqrt(i*i+s*s)},ti=(e,t)=>{let{x:o,y:r,w:n,h:a}=Ae(e),{x:i,y:s,w:l,h:d}=Ae(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},Tt=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&ti(e,n)){let a=ei(e,n);a<r&&(r=a,o=n)}return o},lr=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,a;return Math.max(o,(a=(n=r.measured)==null?void 0:n.width)!=null?a:0)},0);var pr=(e=[],t=[],o="LR")=>{let r=new Ao.default.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:a,width:i,height:s})=>r.setNode(a,{width:i,height:s})),t.forEach(a=>r.setEdge(a.source,a.target)),Ao.default.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return y(E({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},Ye=(e,t)=>{var c,h;let o=[...t],r=o.find(u=>u.id===e);if(!r)return o;let n=o.filter(u=>u.parentId===e&&u.type==="LANE");if(n.length===0)return o;let a=(0,cr.orderBy)(n,["position.y"]),i=Math.max((h=(c=r.measured)==null?void 0:c.width)!=null?h:0,Xt.MIN_WIDTH),s=lr(e,a)||oe.MIN_WIDTH,l=Math.max(i,s),d=0,m=0;a.forEach(u=>{var v,g,p,b;o=o.map(w=>w.id===u.id?y(E({},w),{width:l-oe.HEADER_WIDTH,measured:y(E({},w.measured),{width:l-oe.HEADER_WIDTH}),position:{x:oe.HEADER_WIDTH,y:d}}):w),d+=(g=(v=u.measured)==null?void 0:v.height)!=null?g:0,m+=(b=(p=u.measured)==null?void 0:p.height)!=null?b:0}),o=o.map(u=>u.id===e?y(E({},u),{height:m,width:l,measured:y(E({},u.measured),{height:m,width:l})}):u);let f=o.find(u=>u.id===e);return f!=null&&f.parentId&&(o=Ye(f.parentId,o)),o},mr=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},oi=50,ur=(e,t=oi)=>{let o=(0,dr.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var gr=require("zustand"),$=(0,gr.create)(e=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:t=>{e({isReadOnly:t})},setIsMultipleSelection:t=>{e({isMultipleSelection:t})},setIsMinimapOpen:t=>{e({isMinimapOpen:t})}}));var wt=require("@xyflow/react");var Ne=require("@xyflow/react");var dt=require("@xyflow/react"),Ee=require("lecom-ui"),br=require("lucide-react");var Jt=require("react"),fr=(0,Jt.createContext)(null),hr=fr.Provider,Qt=()=>{let e=(0,Jt.useContext)(fr);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};var Ke=require("react/jsx-runtime"),xt=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ee.useTranslation)(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=(0,dt.useReactFlow)(),{onConfigureElement:s}=Qt(),l=c=>{let h=a(),u=i(),v=(0,dt.getIncomers)(c,h,u),g=(0,dt.getOutgoers)(c,h,u),p=v.some(w=>w.type==="START_EVENT"),b=g.some(w=>w.type==="END_EVENT");return p?"start":b?"end":"between"},d=()=>{let c=r(e);c&&(s==null||s({id:c.id,type:"activity",variant:l(c)}))},m=()=>{let c=n(e);c&&(s==null||s({id:c.id,type:"routing"}))};return(0,Ke.jsxs)(Ee.Tooltip,{children:[(0,Ke.jsx)(Ee.TooltipTrigger,{asChild:!0,children:(0,Ke.jsx)(Ee.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":d();break;case"edge":m();break}},children:(0,Ke.jsx)(br.PencilIcon,{size:16})})}),(0,Ke.jsx)(Ee.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var Er=require("@xyflow/react"),ve=require("lecom-ui"),vr=require("lucide-react"),Ze=require("react/jsx-runtime"),eo=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,ve.useTranslation)(),{deleteElements:r}=(0,Er.useReactFlow)();return(0,Ze.jsxs)(ve.Tooltip,{children:[(0,Ze.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,Ze.jsx)(ve.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Ze.jsx)(vr.TrashIcon,{size:16})})}),(0,Ze.jsx)(ve.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var _t=require("react/jsx-runtime"),ct=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=et(n,["edgeId","edgeType"]);var s;let a=[{component:(0,_t.jsx)(eo,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:(0,_t.jsx)(xt,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return(0,_t.jsx)("div",y(E({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>(0,_t.jsx)("div",{children:l.component},d))}))};var $e=require("react/jsx-runtime"),oo={type:"ANNOTATION_EDGE",zIndex:2e3},Nr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=(0,Ne.useNodes)(),{zoom:m}=(0,Ne.useViewport)(),f=d.find(b=>b.id===t),c=d.find(b=>b.id===o),[h,u,v]=(0,Ne.getStraightPath)({sourceX:r,sourceY:n,targetX:a,targetY:i}),g=s||(f==null?void 0:f.selected)||(c==null?void 0:c.selected),p=1/m;return(0,$e.jsxs)("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[(0,$e.jsx)(Ne.BaseEdge,{id:e,path:h,strokeDasharray:4,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":g&&!(l!=null&&l.hasError)})}),(0,$e.jsx)(Ne.EdgeLabelRenderer,{children:(0,$e.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${u}px, ${v}px)`},children:s&&(0,$e.jsx)(ct,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};var re=require("@xyflow/react"),yr=require("react");var qe=require("react");var ko=require("react/jsx-runtime"),Q=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=(0,qe.useRef)(null),[l,d]=(0,qe.useState)(!1);(0,qe.useEffect)(()=>{d(r!=null?r:!1)},[r]),(0,qe.useEffect)(()=>{if(l&&s.current){s.current.focus();let h=document.createRange();h.selectNodeContents(s.current),h.collapse(!1);let u=window.getSelection();u&&(u.removeAllRanges(),u.addRange(h))}},[l]);let m=h=>{h.stopPropagation(),d(!0)},f=h=>{let u=h.currentTarget.innerText;t&&u.length>=t&&h.preventDefault()},c=h=>{d(!1),n==null||n(),o==null||o(h.currentTarget.innerText)};return(0,ko.jsx)("div",{className:_("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",a,{"border border-dashed border-grey-400":l}),style:i,onDoubleClick:m,children:(0,ko.jsx)("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:c,children:e})})};var Me=require("react/jsx-runtime"),Ve={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:re.MarkerType.ArrowClosed},markerEnd:{type:re.MarkerType.Arrow},data:{label:""}},Tr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:m})=>{let f=(0,re.useNodes)(),{zoom:c}=(0,re.useViewport)(),{updateEdgeData:h}=(0,re.useReactFlow)(),[u,v]=(0,yr.useState)(!1),g=f.find(x=>x.id===t),p=f.find(x=>x.id===o),[b,w,I]=(0,re.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=m||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),O=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=u||(d==null?void 0:d.label.trim().length)>0,T=1/c,D=()=>{v(!0)},C=()=>{v(!1)},S=x=>{h(e,{label:x.trim()})};return(0,Me.jsxs)("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:D,children:[(0,Me.jsx)(re.BaseEdge,{id:e,path:b,markerEnd:`url(#${O})`,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),(0,Me.jsx)(re.EdgeLabelRenderer,{children:(0,Me.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[m&&(0,Me.jsx)(ct,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${T})`}}),N&&(0,Me.jsx)(Q,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:S})]})})]})};var xr=({setEdges:e})=>{let{getNode:t}=(0,wt.useReactFlow)();return{isValidConnection:n=>{let a=t(n.source),i=t(n.target);if((a==null?void 0:a.id)===(i==null?void 0:i.id))return!1;switch(a==null?void 0:a.type){case"START_EVENT":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"END_EVENT":return(i==null?void 0:i.type)==="ANNOTATION";case"TASK":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"GATEWAY":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"LANE":return(i==null?void 0:i.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(a=>{let i=t(n.target);return(i==null?void 0:i.type)==="ANNOTATION"?(0,wt.addEdge)(E(E({},n),oo),a):(0,wt.addEdge)(E(E({},n),Ve),a)})}}};var Lo=require("react"),Dr=require("lecom-ui"),Pr=require("@xyflow/react");var Ct=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Xe=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Oe=(e=[])=>e.filter(t=>t.type==="TASK")||[],_r=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),wr=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),no=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Cr=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),pe=(e,t=[])=>t.filter(o=>o.source===e),It=(e,t=[])=>t.filter(o=>o.target===e),Ir=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(a=>a.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Ar=(e,t)=>{let o=pe(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(a=>a.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},kr=e=>e?/\w/g.test(e.trim()):!1,R=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},ye=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Sr=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var At=[{id:"start_event_not_found",validate:e=>{let t=Ct(e.nodes);return R({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Xe(e.nodes);return R({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Ct(e.nodes),o=t.length===1;if(t.length===0)return R({isValid:!0});if(!o)return R({isValid:!1,nodeIds:t.map(a=>a.id)});let r=pe(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return R({isValid:!1,nodeIds:[...new Set(a)]})}return R({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Oe(e.nodes),o=ye(t,r=>pe(r.id,e.edges).length<=2);return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Oe(e.nodes),o=ye(t,r=>!!r.label&&r.label.trim()!=="");return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Oe(e.nodes),r=ye(o,n=>!n.label||n.label.length<=60);return R({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Oe(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let a=n.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(a=>r.push(a.id));return R({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=no(e.nodes),o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Ct(e.nodes),...Xe(e.nodes)],o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=Xe(e.nodes),o=[],r=[];for(let n of t){let a=It(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.source);if(s&&s.type==="TASK"){let l=pe(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return R({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Cr(e.nodes),o=ye(t,n=>pe(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>pe(n,e.edges).map(a=>a.id));return R({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=Oe(e.nodes),o=ye(t,r=>!r.label||kr(r.label));return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var i,s;if(!((i=e==null?void 0:e.nodes)!=null&&i.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return R({isValid:!0});let t=Xe(e.nodes)[0];if(!t)return R({isValid:!0});let o=It(t.id,e.edges);if(!o.length)return R({isValid:!0});let n=Oe(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=ye(n,l=>!Ir(l.id,e));return R({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Oe(e.nodes),o=Xe(e.nodes)[0];if(!o)return R({isValid:!0});let r=t.filter(l=>{let d=It(l.id,e.edges),m=pe(l.id,e.edges),f=d.some(h=>{var u;return((u=e.nodes.find(v=>v.id===h.source))==null?void 0:u.type)==="START_EVENT"}),c=m.some(h=>{var u;return((u=e.nodes.find(v=>v.id===h.target))==null?void 0:u.type)==="END_EVENT"});return f&&c}),n=It(o.id,e.edges),a=n.length>1,i=n.map(l=>l.source),s={isValid:r.length===0&&!a,nodeIds:[...r.map(l=>l.id),...a?i:[]]};return R(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=no(e.nodes),o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=no(e.nodes),o=ye(t,r=>pe(r.id,e.edges).length>=1);return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Ct(e.nodes),...Xe(e.nodes)],o=[],r=[];for(let n of t){let a=pe(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return R({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=_r(e.nodes),o=ye(t,r=>!Ar(r.id,e));return R({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=wr(e.nodes),o=ye(t,r=>{var n,a;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((a=r.properties)==null?void 0:a.subprocessRef)!==""});return R({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Lr=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of At){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Rr=()=>{let{t:e}=(0,Dr.useTranslation)(),[t,o]=(0,Lo.useState)(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=(0,Pr.useReactFlow)(),[s,l]=(0,Lo.useState)(!1);return{validationResult:t,validateDiagram:c=>{let h=Sr(c.nodes,c.edges),u=Lr(h),v=u.errors.map(g=>y(E({},g),{message:e(`validation.errors.${g.id}`)}));return s||l(!0),{isValid:u.isValid,errors:v}},handleValidationComplete:c=>{if(o(c),!c)return;let h=[],u=[];c.errors.forEach(N=>{N.nodeIds&&N.nodeIds.length>0&&N.nodeIds.forEach(T=>h.push(T)),N.edgeIds&&N.edgeIds.length>0&&N.edgeIds.forEach(T=>u.push(T))});let v=[...new Set(h)];r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})}))),n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})})));let g=a(),p=i(),b=new Set(v),w=new Set;c.errors.forEach(N=>{var C,S;let T=At.find(x=>x.id===N.id);(T==null?void 0:T.highlightRelatedEdges)!==!1&&((C=N.edgeIds)==null||C.forEach(x=>w.add(x)),(S=N.nodeIds)==null||S.forEach(x=>{p.forEach(j=>{(j.source===x||j.target===x)&&w.add(j.id)})}))});let I=new Set,A=new Set,O=new Set;g.forEach(N=>{N.type==="START_EVENT"?I.add(N.id):N.type==="END_EVENT"&&A.add(N.id)}),p.forEach(N=>{I.has(N.source)&&O.add(N.target),A.has(N.target)&&O.add(N.source)}),O.forEach(N=>{var T,D;if(b.has(N)){let C=(T=c.errors.find(x=>{var j;return(j=x.nodeIds)==null?void 0:j.includes(N)}))==null?void 0:T.id;((D=At.find(x=>x.id===C))==null?void 0:D.highlightRelatedEdges)!==!1&&p.forEach(x=>{x.source===N&&A.has(x.target)&&(b.add(x.target),w.add(x.id)),x.target===N&&I.has(x.source)&&(b.add(x.source),w.add(x.id))})}}),b.size>0&&r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:b.has(T.id)})}))),w.size>0&&n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:w.has(T.id)})})))},clearValidation:()=>{o(null),l(!1),r(c=>c.map(h=>y(E({},h),{data:y(E({},h.data),{hasError:!1})}))),n(c=>c.map(h=>y(E({},h),{data:y(E({},h.data),{hasError:!1})})))},isAutoValidationEnabled:s}};var Vr=require("@xyflow/react"),Or=require("react"),Do=require("uuid");var ai=15,Mr="bpmn:selection",Gr=({offset:e=ai}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=(0,Vr.useReactFlow)();(0,Or.useEffect)(()=>{let a=s=>{var h;s.preventDefault();let l=t(),d=r(),m=l.filter(u=>u.selected);if(!m.length)return;let f=d.filter(u=>m.some(v=>v.id===u.source)&&m.some(v=>v.id===u.target)),c={nodes:m,edges:f};(h=s.clipboardData)==null||h.setData(Mr,JSON.stringify(c))},i=s=>{var c,h;s.preventDefault();let l=JSON.parse(((c=s.clipboardData)==null?void 0:c.getData(Mr))||"{}");if(!((h=l.nodes)!=null&&h.length))return;let d=new Map,m=l.nodes.map(u=>{let v=(0,Do.v7)();return d.set(u.id,v),y(E({},u),{id:v,selected:!0,position:{x:u.position.x+e,y:u.position.y+e}})}),f=l.edges.map(u=>y(E({},u),{id:(0,Do.v7)(),selected:!0,source:d.get(u.source)||u.source,target:d.get(u.target)||u.target}));o(u=>[...u.map(v=>y(E({},v),{selected:!1})),...m]),n(u=>[...u.map(v=>y(E({},v),{selected:!1})),...f])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};var ao=require("@xyflow/react"),Po=require("uuid");var Hr=require("zustand"),pt=(0,Hr.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var se=require("@xyflow/react"),Br=require("react");var Ge=require("react/jsx-runtime"),Sl={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:se.MarkerType.Arrow},data:{label:""}},zr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:m})=>{let f=(0,se.useNodes)(),{zoom:c}=(0,se.useViewport)(),{updateEdgeData:h}=(0,se.useReactFlow)(),[u,v]=(0,Br.useState)(!1),g=f.find(x=>x.id===t),p=f.find(x=>x.id===o),[b,w,I]=(0,se.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=m||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),O=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=u||(d==null?void 0:d.label.trim().length)>0,T=1/c,D=()=>{v(!0)},C=()=>{v(!1)},S=x=>{h(e,{label:x.trim()})};return(0,Ge.jsxs)("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:D,children:[(0,Ge.jsx)(se.BaseEdge,{id:e,path:b,markerEnd:`url(#${O})`,strokeDasharray:4,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),(0,Ge.jsx)(se.EdgeLabelRenderer,{children:(0,Ge.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[m&&(0,Ge.jsx)(ct,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${T})`}}),N&&(0,Ge.jsx)(Q,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:S})]})})]})};var kt=require("react/jsx-runtime"),Fr=({fromX:e,fromY:t,toX:o,toY:r})=>(0,kt.jsxs)("g",{children:[(0,kt.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),(0,kt.jsx)("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var Ur=({nodes:e,setNodes:t,setEdges:o})=>{let r=(0,ao.useStoreApi)(),{draggableNode:n,setDraggableNode:a}=pt(),{getInternalNode:i,screenToFlowPosition:s}=(0,ao.useReactFlow)(),l=g=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(b=>b.map(w=>y(E({},w),{className:w.id===g?p:""})))},d=()=>{let{nodeLookup:g}=r.getState();return Array.from(g.values())},m=g=>{let p=i(g.id),b=d();if(g.type==="LANE"){if(lt({parentId:g.id,nodes:e,includeTypes:["LANE"]})){l();return}let T=b.filter(S=>S.id!==g.id&&S.type==="LANE"&&!S.parentId),D=Tt(p,T);if(!D){l();return}if(lt({parentId:D.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(D.id);return}let I=b.filter(N=>N.id!==g.id&&N.type==="LANE"),A=Tt(p,I);if(!A){l();return}if(lt({parentId:A.id,nodes:e,includeTypes:["LANE"]})){l();return}l(A.id)},f=g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"},c=(g,p)=>{g.preventDefault(),m(p)},h=(g,p,b)=>{var T,D;let w=C=>C.map(S=>y(E({},S),{className:void 0}));if(g.parentId===p.id){let C=Ye(p.id,b);t(ke(w(C)));return}if(g.type==="LANE"){if(lt({parentId:p.id,nodes:b,excludeTypes:["LANE"]}))return;let x=b.filter(J=>J.parentId===p.id).reduce((J,Qe)=>{var Ce,Fe;return J+((Fe=(Ce=Qe.measured)==null?void 0:Ce.height)!=null?Fe:0)},0),j={x:oe.HEADER_WIDTH,y:x},ie=b.map(J=>J.id===g.id?y(E({},J),{parentId:p.id,position:j,className:void 0}):y(E({},J),{className:void 0}));ie=Ye(p.id,ie),t(ke(ie));return}if(lt({parentId:p.id,nodes:b,includeTypes:["LANE"]})){let C;if(g.parentId){let x=i(g.parentId),{x:j,y:ie}=Ae(x);C={x:j+((T=g.position.x)!=null?T:0),y:ie+((D=g.position.y)!=null?D:0)}}let S=b.map(x=>x.id===g.id?y(E({},x),{position:C!=null?C:x.position,parentId:void 0,className:void 0}):y(E({},x),{className:void 0}));t(ke(S));return}let O=sr(g,p),N=b.map(C=>C.id===g.id?y(E({},C),{parentId:p.id,position:O,className:void 0}):y(E({},C),{className:void 0}));t(ke(N))};return{onDragOver:f,onDrop:g=>{if(g.preventDefault(),!(n!=null&&n.type))return;let p=s({x:g.clientX,y:g.clientY}),b={width:K[n.type].MIN_WIDTH,height:K[n.type].MIN_HEIGHT},w={id:(0,Po.v7)(),type:n.type,position:p,measured:b,data:{label:"",variant:n.variant,attribute:n.attribute}},I=y(E({},w),{internals:{positionAbsolute:p}}),A=d(),O=n.type==="LANE",N=A.filter(C=>O?C.type==="LANE"&&!C.parentId:C.type==="LANE"),T=Tt(I,N);T?h(I,T,[...A,I]):t(C=>{let S=C.concat(w);return ke(S)});let D=g.dataTransfer.getData("sourceId");if(D){let C={id:(0,Po.v7)(),source:D,target:w.id};if(n.type==="ANNOTATION"){o(S=>S.concat(E(E({},C),oo)));return}o(S=>S.concat(E(E({},C),Ve)))}a(null)},onNodeDrag:c,onNodeDragStop:async(g,p)=>{var T,D;let{nodeLookup:b}=r.getState(),w=i(p.id),I=Array.from(b.values()),A=p.type==="LANE",O=I.filter(C=>C.id!==p.id&&(A?C.type==="LANE"&&!C.parentId:C.type==="LANE")),N=Tt(w,O);if(N){h(w,N,I);return}if(p.parentId){let C=i(p.parentId),{x:S,y:x}=Ae(C),j={x:S+((T=p.position.x)!=null?T:0),y:x+((D=p.position.y)!=null?D:0)},ie=e.map(J=>J.id===p.id?y(E({},J),{position:j,parentId:void 0}):J);ie=Ye(p.parentId,ie),t(ke(ie))}}}};var Yr=require("@xyflow/react"),St=require("react");function Wr(e,t,o=5){var l,d,m,f,c,h,u,v;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(g=>g.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((f=(m=n.measured)==null?void 0:m.height)!=null?f:0),width:(h=(c=n.measured)==null?void 0:c.width)!=null?h:0,height:(v=(u=n.measured)==null?void 0:u.height)!=null?v:0},i=o,s=o;return t.filter(g=>g.id!==n.id).reduce((g,p)=>{var S,x,j,ie,J,Qe,Ce,Fe;let b={left:p.position.x,right:p.position.x+((x=(S=p.measured)==null?void 0:S.width)!=null?x:0),top:p.position.y,bottom:p.position.y+((ie=(j=p.measured)==null?void 0:j.height)!=null?ie:0),width:(Qe=(J=p.measured)==null?void 0:J.width)!=null?Qe:0,height:(Fe=(Ce=p.measured)==null?void 0:Ce.height)!=null?Fe:0},w=Math.abs(a.left-b.left);w<s&&(g.snapPosition.x=b.left,g.vertical=b.left,s=w);let I=Math.abs(a.right-b.right);I<s&&(g.snapPosition.x=b.right-a.width,g.vertical=b.right,s=I);let A=Math.abs(a.left-b.right);A<s&&(g.snapPosition.x=b.right,g.vertical=b.right,s=A);let O=Math.abs(a.right-b.left);O<s&&(g.snapPosition.x=b.left-a.width,g.vertical=b.left,s=O);let N=Math.abs(a.top-b.top);N<i&&(g.snapPosition.y=b.top,g.horizontal=b.top,i=N);let T=Math.abs(a.bottom-b.top);T<i&&(g.snapPosition.y=b.top-a.height,g.horizontal=b.top,i=T);let D=Math.abs(a.bottom-b.bottom);D<i&&(g.snapPosition.y=b.bottom-a.height,g.horizontal=b.bottom,i=D);let C=Math.abs(a.top-b.bottom);return C<i&&(g.snapPosition.y=b.bottom,g.horizontal=b.bottom,i=C),g},r)}var Kr=()=>{let[e,t]=(0,St.useState)(void 0),[o,r]=(0,St.useState)(void 0),n=(0,St.useCallback)((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=Wr(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return(0,Yr.applyNodeChanges)(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};var jr=require("@xyflow/react"),Ro=require("uuid");var $r={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},qr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Zr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],i="",s="",l="";if(o.length){switch(o[1]){case"<start>":i="start-event";break;case"<end>":i="end-event";break}e=e.replace(o[1],"")}return r.length&&(i="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(i="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:i,label:s}),{step:e,type:i,label:s,edgeLabel:l}},ii=e=>{e=e||"";let t=e.trim().split(`
2
+ `),o={},r=[];return t.forEach(n=>{n=n||"";let a=n.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let i=Zr(a[0],o),s=Zr(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},Xr=e=>{let{components:t,connections:o}=ii(e);return{nodes:t,edges:o}};var Jr=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,jr.useReactFlow)();return{createDiagram:n=>{let{nodes:a,edges:i}=Xr(n),s=[],l=new Map;for(let[c,h]of Object.entries(a)){let u=(0,Ro.v7)(),v=$r[h.type],g=qr[h.type];l.set(c,u);let p=K[v].MIN_WIDTH,b=K[v].MIN_HEIGHT;s.push({id:u,type:v,data:{label:h.label||"",variant:g,attribute:""},position:{x:0,y:0},width:p,height:b,measured:{width:p,height:b}})}let d=[];for(let c of i){let h=y(E({},Ve),{id:(0,Ro.v7)(),source:l.get(c.sourceId)||c.sourceId,target:l.get(c.targetId)||c.targetId});d.push(h)}let{nodes:m,edges:f}=pr(s,d);e(m),t(f),o()}}};var io=require("react"),si={origin:"*",debug:!1};function Qr(e,t=si){let{origin:o,debug:r}=t,n=(0,io.useCallback)((a,i)=>{r&&console.debug("[postMessage] sending:",{type:a,payload:i}),window.parent.postMessage({type:a,payload:i},o||"*")},[o,r]);return(0,io.useEffect)(()=>{let a=i=>{let{type:s,data:l}=i.data||{};r&&console.debug("[postMessage] received:",i.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[e,r]),{sendMessage:n}}var tn=require("@xyflow/react"),Se=require("react"),on=require("use-debounce"),li={nodes:[],edges:[]},di=500,en=10,rn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=(0,tn.useReactFlow)(),[n,a]=(0,Se.useState)([li]),[i,s]=(0,Se.useState)(0),l=n[i],d=i>0,m=i<n.length-1,f=(0,Se.useCallback)(b=>{o(n[b].nodes),r(n[b].edges)},[n,o,r]),c=(0,Se.useCallback)(()=>{if(i>0){let b=i-1;s(b),f(b)}},[i,f]),h=(0,Se.useCallback)(()=>{if(i<n.length-1){let b=i+1;s(b),f(b)}},[n,i,f]),u=b=>{let I=[...n.slice(0,i+1),b],A=I.length>en?I.slice(I.length-en):I;a(A),s(A.length-1)},v=(0,on.useDebouncedCallback)(()=>{let b=e(),w=t(),I={nodes:b,edges:w};JSON.stringify(l)!==JSON.stringify(I)&&u(I)},di),g=(0,Se.useCallback)(b=>{if(b==="forceSave"){v();return}b.some(I=>I.type!=="select")&&v()},[v]),p=(0,Se.useCallback)(()=>{a([]),s(0)},[]);return{undo:c,redo:h,saveHistory:g,canUndo:d,canRedo:m,clearHistory:p}};var Mo=require("react/jsx-runtime"),Vo=({id:e,className:t})=>(0,Mo.jsx)("marker",{id:e,className:_("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:(0,Mo.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var mt=require("react/jsx-runtime"),nn=()=>(0,mt.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,mt.jsxs)("defs",{children:[(0,mt.jsx)(Vo,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,mt.jsx)(Vo,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var Ho=require("@xyflow/react"),F=require("lecom-ui"),Be=require("lucide-react"),Pt=require("react");var an=require("@xyflow/react"),ci=e=>({unselectAll:e.unselectNodesAndEdges}),so=()=>{let{unselectAll:e}=(0,an.useStore)(ci);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};var Te=require("lecom-ui");var Lt=(p=>(p.START_EVENT="START_EVENT",p.END_EVENT="END_EVENT",p.TASK="TASK",p.SUBPROCESS="SUBPROCESS",p.GATEWAY="GATEWAY",p.ANNOTATION="ANNOTATION",p.CONNECTION="CONNECTION",p.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",p.ACTIVITY="ACTIVITY",p.PROCESS_INTERFACE="PROCESS_INTERFACE",p.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",p.VARIANT_ACTIVITY="VARIANT_ACTIVITY",p.AUTO_ACTIVITY="AUTO_ACTIVITY",p.DATA_STORE="DATA_STORE",p.DATA_OBJECT="DATA_OBJECT",p.DATA_OUTPUT="DATA_OUTPUT",p.DATA_INPUT="DATA_INPUT",p))(Lt||{});var vn=require("@xyflow/react"),gt=require("lecom-ui");var sn=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var a;t((a=n.target)==null?void 0:a.result)},r.onerror=n=>{var a;o((a=n.target)==null?void 0:a.error)},r.readAsText(e)});function ln({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(i=>i.join(",")).join(`
3
+ `),a=encodeURI(n);lo(a,`${o}.csv`)}var lo=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};var bn=require("uuid");var Oo=require("xml-js");var pi={compact:!0,spaces:4},mi=e=>e.replaceAll(`
4
+ `,"&#xA;");function dn(e,t=pi){if(e)return JSON.parse((0,Oo.xml2json)(e,y(E({},t),{attributeValueFn:mi})))}function cn(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}var un=require("uuid");var Cd={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},pn={script:"SCRIPT",subprocess:"SUBPROCESS"},mn={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var ut=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:a}=r,i=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:a||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:i,height:s,measured:{width:i,height:s}}},gi=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=K.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=K.START_EVENT.MIN_HEIGHT,{node:ut({cell:e,type:"START_EVENT"}),status:r,originalType:o}},fi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=K.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=K.END_EVENT.MIN_HEIGHT,{node:ut({cell:e,type:"END_EVENT"}),status:r,originalType:o}},hi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=pn[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=vt(e.mxGeometry._attributes.width,K.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=vt(e.mxGeometry._attributes.height,K.TASK.MIN_HEIGHT),{node:ut({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},bi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=mn[o],n=["none","inclusive","event-based"],a="imported";return n.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=K.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=K.GATEWAY.MIN_HEIGHT,{node:ut({cell:e,type:"GATEWAY",variant:r}),status:a,originalType:t}},Ei=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=vt(e.mxGeometry._attributes.width,K.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=vt(e.mxGeometry._attributes.height,K.ANNOTATION.MIN_HEIGHT),{node:ut({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},gn=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=K.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=K.UNSUPPORTED.MIN_HEIGHT,{node:ut({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},fn=(e,t)=>{let{source:o,target:r}=e._attributes;return y(E({},Ve),{id:(0,un.v7)(),source:t.get(o)||o,target:t.get(r)||r})},hn={TASK:hi,GATEWAY:bi,START_EVENT:gi,END_EVENT:fi,ANNOTATION:Ei};var vi=e=>{var i;let t=new Map,o=Object.values(Lt),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],a=[];for(let s of r){let l=(0,bn.v7)(),{type:d}=s._attributes,m=hn[d]||gn;t.set((i=s._attributes)==null?void 0:i.id,l),s._attributes.id=l;let{node:f,status:c,originalType:h}=m(s);n.push(f),a.push({originalType:h,type:f.type,variant:f.data.variant,value:cn(f.data.label),status:c})}return{nodes:n,governanceIdToNodeIdMap:t,summary:a}},Ni=(e,t)=>e.filter(n=>{var a;return(a=n._attributes)==null?void 0:a.edge}).map(n=>fn(n,t)),yi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=vi(t.root.mxCell),a=Ni(t.root.mxCell,r);return{nodes:o,edges:a,summary:n}},Ti=async e=>{let t=await sn(e),o=dn(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},a=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),i=n==null?void 0:n.root;if(!a||!i)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},En=async e=>{try{let t=await Ti(e),{nodes:o,edges:r,summary:n}=yi(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};var yn=require("react/jsx-runtime"),Nn=()=>{let{t:e}=(0,gt.useTranslation)(),{toast:t}=(0,gt.useNotificationToast)(),{setNodes:o,setEdges:r,fitView:n}=(0,vn.useReactFlow)(),a=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=s.map(m=>[m.originalType,m.value,e(`adapter.governance.report.status.${m.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,yn.jsx)(gt.Button,{size:"small",variant:"ghost",onClick:()=>ln({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:d,summary:m}=await En(s);if(o(c=>c.concat(l)),r(c=>c.concat(d)),n(),m.some(c=>c.status==="unsupported")){a(m);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};var Tn=require("lecom-ui"),xn=require("react");var je=require("react/jsx-runtime"),_n=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:a}=l,i=et(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=(0,xn.useRef)(null),m=c=>{let h=c.target.files;h!=null&&h.length&&a(h),d.current&&(d.current.value="")};return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(Tn.Button,y(E({onClick:c=>{var h;(h=d.current)==null||h.click(),n==null||n(c)}},i),{children:e})),(0,je.jsx)("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:m})]})};var Je=require("react/jsx-runtime"),wn=({disabled:e=!1})=>{let{t}=(0,Te.useTranslation)(),{toast:o}=(0,Te.useNotificationToast)(),{createDiagram:r}=Nn(),n=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},a=i=>{let s=i[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}r(s)};return(0,Je.jsxs)(Te.Tooltip,{children:[(0,Je.jsx)(Te.TooltipTrigger,{asChild:!0,children:(0,Je.jsx)(_n,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:a,children:(0,Je.jsx)(Jo,{})})}),(0,Je.jsx)(Te.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var L=require("lecom-ui"),He=require("lucide-react"),kn=require("react");var Cn=require("@xyflow/react"),Dt=require("html-to-image"),co=require("lecom-ui"),In=require("react");var xi=3,Go="diagram",An=()=>{let{t:e}=(0,co.useTranslation)(),{getNodes:t}=(0,Cn.useReactFlow)(),{deselectAll:o}=so(),[r,n]=(0,In.useState)({png:!1,html:!1,print:!1}),a=()=>{let{x:m,y:f,width:c,height:h}=ur(t());return{width:c,height:h,style:{width:`${c}px`,height:`${h}px`,transform:`translate(${-m}px, ${-f}px)`}}},i=async(m,f)=>{n(y(E({},r),{[f]:!0})),await o();try{let c=mr();if(!c)throw new Error("Flow element not found");let h=a();return await m(c,h)}catch(c){(0,co.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(y(E({},r),{[f]:!1}))}};return{exportAsPng:async(m=Go)=>{await i(async(f,c)=>{let h=await(0,Dt.toPng)(f,y(E({},c),{backgroundColor:"#fcfcfc"}));lo(h,`${m}.png`)},"png")},exportAsHtml:async(m=Go)=>{await i(async(f,c)=>{let h=await(0,Dt.toSvg)(f,y(E({},c),{backgroundColor:"#fcfcfc"})),u=`
5
5
  <!DOCTYPE html>
6
6
  <html>
7
7
  <head>
@@ -15,7 +15,7 @@
15
15
  <img src="${h}" alt="Diagram" />
16
16
  </body>
17
17
  </html>
18
- `,v=new Blob([u],{type:"text/html"}),g=URL.createObjectURL(v);so(g,`${m}.html`),setTimeout(()=>URL.revokeObjectURL(g),100)},"html")},printDiagram:async(m=Oo)=>{await i(async(f,c)=>{let h=await(0,Dt.toPng)(f,y(E({},c),{pixelRatio:Ti})),u=window.open("","_blank");if(!u)throw new Error("Failed to open print window.");let v=u.document;v.open(),v.write(`
18
+ `,v=new Blob([u],{type:"text/html"}),g=URL.createObjectURL(v);lo(g,`${m}.html`),setTimeout(()=>URL.revokeObjectURL(g),100)},"html")},printDiagram:async(m=Go)=>{await i(async(f,c)=>{let h=await(0,Dt.toPng)(f,y(E({},c),{pixelRatio:xi})),u=window.open("","_blank");if(!u)throw new Error("Failed to open print window.");let v=u.document;v.open(),v.write(`
19
19
  <!DOCTYPE html>
20
20
  <html>
21
21
  <head>
@@ -31,4 +31,4 @@
31
31
  <img src="${h}" alt="Diagram" onload="window.print(); window.close();" />
32
32
  </body>
33
33
  </html>
34
- `),v.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var V=require("react/jsx-runtime");function kn(){let{t:e}=(0,L.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=In(),[s,l]=(0,An.useState)(!1);return(0,V.jsxs)(L.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,V.jsx)(L.DropdownMenuTrigger,{asChild:!0,children:(0,V.jsx)("div",{children:(0,V.jsxs)(L.Tooltip,{children:[(0,V.jsx)(L.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(L.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,V.jsx)(He.FolderOutputIcon,{})})}),!s&&(0,V.jsx)(L.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,V.jsxs)(L.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,V.jsxs)(L.Tooltip,{children:[(0,V.jsx)(L.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(L.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>t(),children:(0,V.jsx)(He.FileImageIcon,{})})}),(0,V.jsx)(L.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,V.jsxs)(L.Tooltip,{children:[(0,V.jsx)(L.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(L.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>o(),children:(0,V.jsx)(He.FileCodeIcon,{})})}),(0,V.jsx)(L.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,V.jsxs)(L.Tooltip,{children:[(0,V.jsx)(L.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(L.DropdownMenuItem,{className:"p-1.5",disabled:n,onClick:()=>r(),children:(0,V.jsx)(He.PrinterIcon,{})})}),(0,V.jsx)(L.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var k=require("react/jsx-runtime"),Sn=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=(0,F.useTranslation)(),{deselectAll:i}=io(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:m,isMinimapOpen:f,setIsMinimapOpen:c}=$(),h=(0,Go.useKeyPress)(["v","V"]),u=(0,Go.useKeyPress)(["h","H"]),v=(0,Pt.useCallback)(()=>{i(),m()},[i,m]),g=()=>{i();let p=n(o);r&&r(p)};return(0,Pt.useEffect)(()=>{h&&!s&&!t&&d()},[h,d,s,t]),(0,Pt.useEffect)(()=>{u&&!l&&!t&&v()},[u,v,l,t]),(0,k.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(F.Tooltip,{children:[(0,k.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,k.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",className:_(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:(0,k.jsx)(Be.MousePointerIcon,{})})}),(0,k.jsxs)(F.TooltipContent,{color:"black",children:[a("editor.controls.actions.move_tool"),(0,k.jsx)("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),(0,k.jsxs)(F.Tooltip,{children:[(0,k.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,k.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",className:_(l&&"bg-grey-400"),iconButton:!0,onClick:v,children:(0,k.jsx)(Be.HandIcon,{})})}),(0,k.jsxs)(F.TooltipContent,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",(0,k.jsx)("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),(0,k.jsxs)(F.Tooltip,{children:[(0,k.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,k.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:g,children:(0,k.jsx)(Be.ListCheckIcon,{})})}),(0,k.jsx)(F.TooltipContent,{color:"black",children:a("editor.controls.actions.check")})]})]}),(0,k.jsx)(kn,{}),!t&&(0,k.jsx)(_n,{disabled:e.length>0}),(0,k.jsxs)(F.Tooltip,{children:[(0,k.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,k.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",className:_(f&&"bg-grey-400"),iconButton:!0,onClick:()=>c(!f),children:(0,k.jsx)(Be.MapIcon,{})})}),(0,k.jsx)(F.TooltipContent,{color:"black",children:a(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var le=require("lecom-ui"),co=require("lucide-react"),me=require("react/jsx-runtime"),Ln=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=(0,le.useTranslation)();return(0,me.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,me.jsxs)(le.Tooltip,{children:[(0,me.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(le.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,me.jsx)(co.UndoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.undo")})]}),(0,me.jsxs)(le.Tooltip,{children:[(0,me.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(le.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:(0,me.jsx)(co.RedoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.redo")})]})]})};var Dn=require("@xyflow/react"),U=require("lecom-ui"),ft=require("lucide-react");var H=require("react/jsx-runtime"),Pn=()=>{let{t:e}=(0,U.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=(0,Dn.useReactFlow)();return(0,H.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,H.jsxs)(U.Tooltip,{children:[(0,H.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:(0,H.jsx)(ft.ScanIcon,{})})}),(0,H.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,H.jsxs)(U.Tooltip,{children:[(0,H.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,H.jsx)(ft.ZoomOut,{})})}),(0,H.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,H.jsxs)(U.Tooltip,{children:[(0,H.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:(0,H.jsx)(tr,{})})}),(0,H.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,H.jsxs)(U.Tooltip,{children:[(0,H.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,H.jsx)(ft.ZoomIn,{})})}),(0,H.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var fo=require("@xyflow/react");var Rn=require("@xyflow/react");var Mn=require("react/jsx-runtime"),q=({type:e,position:t,className:o})=>(0,Mn.jsx)(Rn.Handle,{type:e,position:t,className:_("size-2.5 border border-grey-400 bg-white",o)});var po=require("@xyflow/react"),Vn=require("lodash");var On=require("react/jsx-runtime"),ht=o=>{var r=o,{nodeId:e}=r,t=et(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=(0,po.useReactFlow)(),s=({width:l,height:d})=>{if(!e)return;let m=n(e);if((m==null?void 0:m.type)!=="LANE")return;let f=[...a()],c=!m.parentId,h=c?m.id:m.parentId,u=f.filter(p=>p.type==="LANE"&&p.parentId===h);if(!u.length)return;let v=(0,Vn.orderBy)(u,["position.y"]),g=0;v.forEach((p,b)=>{var A,O;let w=b===v.length-1,I=(O=(A=p.measured)==null?void 0:A.height)!=null?O:0;f=f.map(N=>{if(N.id===p.id){let T=c?l-oe.HEADER_WIDTH:l,D=y(E({},N),{width:T,measured:y(E({},N.measured),{width:T}),position:y(E({},N.position),{y:g})});return w&&c&&(D.height=d-g),D}return N}),g+=I}),f=f.map(p=>{if(p.id===h){let b=c?l:l+oe.HEADER_WIDTH;return y(E({},p),{width:b,height:c?d:g,measured:{width:b,height:c?d:g}})}return p}),i(f)};return(0,On.jsx)(po.NodeResizer,E({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};var go=require("@xyflow/react"),xe=require("lecom-ui");var mo=require("@xyflow/react"),W=require("lecom-ui"),Gn=require("lucide-react");var ne=require("react/jsx-runtime"),Hn=({nodeId:e})=>{let{t}=(0,W.useTranslation)(),{updateNodeData:o}=(0,mo.useReactFlow)(),r=(0,mo.useNodesData)(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return(0,ne.jsxs)(W.DropdownMenu,{children:[(0,ne.jsxs)(W.Tooltip,{children:[(0,ne.jsx)(W.TooltipTrigger,{asChild:!0,children:(0,ne.jsx)(W.DropdownMenuTrigger,{asChild:!0,children:(0,ne.jsx)(W.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,ne.jsx)(Gn.WrenchIcon,{})})})}),(0,ne.jsx)(W.TooltipContent,{color:"black",children:t("bpmn.gateway.menu.title")})]}),(0,ne.jsxs)(W.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,ne.jsx)(W.DropdownMenuLabel,{className:"flex items-center",children:(0,ne.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),(0,ne.jsx)(W.DropdownMenuGroup,{children:Object.entries(Zt).map(([a,i])=>(0,ne.jsxs)(W.DropdownMenuItem,{className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[(0,ne.jsx)(i.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};var uo=require("@xyflow/react"),B=require("lecom-ui"),Bn=require("lucide-react");var X=require("react/jsx-runtime"),zn=({nodeId:e})=>{let{t}=(0,B.useTranslation)(),{updateNodeData:o}=(0,uo.useReactFlow)(),r=(0,uo.useNodesData)(e),n=i=>{o(e,{variant:(r==null?void 0:r.data.variant)===i?"":i})},a=i=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===i?"":i})};return(0,X.jsxs)(B.DropdownMenu,{children:[(0,X.jsxs)(B.Tooltip,{children:[(0,X.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(B.DropdownMenuTrigger,{asChild:!0,children:(0,X.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,X.jsx)(Bn.WrenchIcon,{})})})}),(0,X.jsx)(B.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,X.jsxs)(B.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,X.jsxs)(B.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,X.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,X.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Kt).map(([i,s])=>(0,X.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:(0,X.jsx)(s.icon,{className:"stroke-inherit"})},i))})]}),(0,X.jsx)(B.DropdownMenuGroup,{children:Object.entries(Yt).map(([i,s])=>(0,X.jsxs)(B.DropdownMenuItem,{className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[(0,X.jsx)(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};var de=require("react/jsx-runtime"),ce=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var m;let{t:n}=(0,xe.useTranslation)(),{setDraggableNode:a}=pt(),i=({event:f,type:c,variant:h})=>{a({type:c,variant:h}),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:yt,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:tt,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:yt,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Bt,label:n("bpmn.annotation.variant.default")}},l=[{component:(0,de.jsx)(Qt,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(zn,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Hn,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return(0,de.jsx)(go.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:go.Position.Right,align:"start",isVisible:r,children:(m=d[t])==null?void 0:m.map((f,c)=>f.component?(0,de.jsx)("div",{children:f.component},c):(0,de.jsxs)(xe.Tooltip,{children:[(0,de.jsx)(xe.TooltipTrigger,{asChild:!0,children:(0,de.jsx)(xe.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:h=>i({event:h,type:f.type,variant:f.variant}),children:f.icon&&(0,de.jsx)(f.icon,{size:16})})}),(0,de.jsx)(xe.TooltipContent,{color:"black",children:f.label})]},c))})};var _e=require("react/jsx-runtime"),Fn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,fo.useReactFlow)(),{isMultipleSelection:a}=$(),i=s=>{n(e,{label:s})};return(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)("div",{className:_("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm overflow-hidden border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:(0,_e.jsx)(Q,{value:t.label,className:"m-1 text-grey-600",onChange:i})}),(0,_e.jsx)(ce,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!a&&o}),(0,_e.jsx)(ht,{isVisible:!r&&!a&&o,minWidth:Xt.MIN_WIDTH,minHeight:Xt.MIN_HEIGHT}),(0,_e.jsx)(q,{type:"target",position:fo.Position.Left})]})};var Rt=require("@xyflow/react"),Un=require("react");var ge=require("react/jsx-runtime"),Wn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Rt.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,Un.useState)(!1),l=f=>{n(e,{label:f})};return(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,ge.jsx)(tt,{className:_("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,ge.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ge.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,ge.jsx)(ce,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),(0,ge.jsx)(q,{type:"source",position:Rt.Position.Right}),(0,ge.jsx)(q,{type:"target",position:Rt.Position.Left})]})};var Mt=require("@xyflow/react"),Yn=require("react");var fe=require("react/jsx-runtime"),Kn=({id:e,data:t,selected:o,dragging:r})=>{let n=Zt[t.variant].icon,{updateNodeData:a}=(0,Mt.useReactFlow)(),{isMultipleSelection:i}=$(),[s,l]=(0,Yn.useState)(!1),d=c=>{a(e,{label:c})};return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsxs)("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[(0,fe.jsx)(n,{className:_("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),(0,fe.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,fe.jsx)(Q,{value:t.label,isEditing:s,onChange:d})})]}),(0,fe.jsx)(ce,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),(0,fe.jsx)(q,{type:"target",position:Mt.Position.Left}),(0,fe.jsx)(q,{type:"source",position:Mt.Position.Right})]})};var ho=require("@xyflow/react"),Zn=require("react");var be=require("react/jsx-runtime"),$n=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,ho.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,Zn.useState)(!1),l=f=>{n(e,{label:f})};return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,be.jsx)(Wt,{className:_("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,be.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,be.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,be.jsx)(ce,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),(0,be.jsx)(q,{type:"source",position:ho.Position.Right})]})};var Vt=require("@xyflow/react");var ee=require("react/jsx-runtime"),qn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Vt.useReactFlow)(),{isMultipleSelection:a}=$(),i=c=>{n(e,{label:c})},s=t.variant?Yt[t.variant].icon:null,l=t.attribute?Kt[t.attribute].icon:null,d=t.variant==="SUBPROCESS",m=s&&!d,f=l||d;return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsxs)("div",{className:_("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md overflow-hidden hover:shadow-md transition-colors duration-75",{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[(0,ee.jsx)(Q,{value:t.label,className:_("m-1",{"py-6":m||f}),onChange:i}),s&&(0,ee.jsx)("div",{className:_("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:(0,ee.jsx)(s,{size:16,className:_(t.hasError?"text-red-500":"text-grey-500")})}),l&&(0,ee.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,ee.jsx)("div",{className:_("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:(0,ee.jsx)(l,{size:16,className:_(t.hasError?"text-red-500":"text-grey-500")})})})]}),(0,ee.jsx)(ce,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),(0,ee.jsx)(ht,{isVisible:!r&&!a&&o,minWidth:$t.MIN_WIDTH,minHeight:$t.MIN_HEIGHT}),(0,ee.jsx)(q,{type:"source",position:Vt.Position.Right}),(0,ee.jsx)(q,{type:"target",position:Vt.Position.Left})]})};var Ho=require("@xyflow/react");var Le=require("react/jsx-runtime"),Xn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=$();return(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),(0,Le.jsx)(ce,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),(0,Le.jsx)(q,{type:"source",position:Ho.Position.Right}),(0,Le.jsx)(q,{type:"target",position:Ho.Position.Left})]})};var bo=require("@xyflow/react"),jn=require("lodash"),Bo=require("react");var ue=require("react/jsx-runtime"),Jn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=(0,bo.useReactFlow)(),{isMultipleSelection:s}=$(),l=i(),d=!n,m=(0,Bo.useMemo)(()=>(0,jn.orderBy)([...l.filter(u=>u.parentId===e&&u.type==="LANE")],"position.y","asc"),[l,e]),f=d?qt.MIN_WIDTH:oe.MIN_WIDTH,c=(0,Bo.useMemo)(()=>{if(d&&m.length>1){let u=[...m];return u.pop(),u.reduce((g,p)=>{var b,w;return g+((w=(b=p.measured)==null?void 0:b.height)!=null?w:0)},0)+oe.MIN_HEIGHT}return oe.MIN_HEIGHT},[d,m]),h=u=>{a(e,{label:u})};return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)("div",{className:_("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[(0,ue.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:(0,ue.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,ue.jsx)(Q,{value:t.label,className:"w-full h-full",onChange:h})})}),(0,ue.jsx)("div",{className:"flex-1"})]}),(0,ue.jsx)(ce,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),(0,ue.jsx)(ht,{nodeId:e,minWidth:f,minHeight:c,isVisible:!r&&!s&&o}),d&&(0,ue.jsx)(q,{type:"source",position:bo.Position.Right})]})};var Qn={START_EVENT:$n,END_EVENT:Wn,TASK:qn,GATEWAY:Kn,ANNOTATION:Fn,LANE:Jn,UNSUPPORTED:Xn},ea={SEQUENCE_EDGE:yr,MESSAGE_EDGE:Br,ANNOTATION_EDGE:vr},ta="#fafafa",oa="#bebebe",ra=1,na=10,aa="bottom-left",ia=.5,sa=4,la={x:0,y:0,zoom:.75};var da=require("@xyflow/react"),Eo=require("react"),pa=require("react/jsx-runtime"),xi=e=>({width:e.width,height:e.height,transform:e.transform}),ca=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=(0,da.useStore)(xi),s=(0,Eo.useRef)(null);return(0,Eo.useEffect)(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let m=window.devicePixelRatio;l.width=n*m,l.height=a*m,d.scale(m,m),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),(0,pa.jsx)("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};var Y=require("lecom-ui"),ae=require("react/jsx-runtime"),ma=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=(0,Y.useTranslation)(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(m=>m.filter(f=>!l.some(c=>c.id===f.id))),d!=null&&d.length&&r(m=>m.filter(f=>!d.some(c=>c.id===f.id))),t(null)},s=()=>{t(null)};return(0,ae.jsx)(Y.Dialog,{open:a,onOpenChange:s,children:(0,ae.jsxs)(Y.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,ae.jsx)(Y.DialogHeader,{children:(0,ae.jsx)(Y.DialogTitle,{children:(0,ae.jsx)(Y.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),(0,ae.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,ae.jsx)("div",{className:"py-2",children:(0,ae.jsx)(Y.Notification,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),(0,ae.jsx)(Y.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),(0,ae.jsxs)(Y.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,ae.jsx)(Y.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:(0,ae.jsx)(Y.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),(0,ae.jsx)(Y.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};var we=require("lecom-ui");var ze=require("react/jsx-runtime"),ua=()=>{let{t:e}=(0,we.useTranslation)(),{setDraggableNode:t}=pt(),o=[{type:"START_EVENT",icon:Wt,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:tt,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:yt,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:nr,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:rr,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:or,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Ft,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:zt,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:er,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Bt,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return(0,ze.jsx)("aside",{className:"sidebar absolute z-[1] top-4 left-4 grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:o.map((n,a)=>(0,ze.jsxs)(we.Tooltip,{children:[(0,ze.jsx)(we.TooltipTrigger,{asChild:!0,children:(0,ze.jsx)(we.Button,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:(0,ze.jsx)(n.icon,{})},a)}),(0,ze.jsx)(we.TooltipContent,{color:"black",side:"right",children:n.label})]},a))})};var vo=require("lecom-ui"),bt=require("lucide-react"),No=require("react"),te=require("react/jsx-runtime"),ga=({validationResult:e,onClose:t})=>{let{t:o}=(0,vo.useTranslation)(),[r,n]=(0,No.useState)(!1);if((0,No.useEffect)(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return(0,te.jsxs)("div",{className:_("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[(0,te.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,te.jsx)("div",{className:"flex-shrink-0",children:a?(0,te.jsx)(bt.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,te.jsx)(bt.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,te.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,te.jsx)("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&(0,te.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,te.jsx)(vo.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:(0,te.jsx)(bt.XIcon,{})})]}),(0,te.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?(0,te.jsx)("p",{children:o("validation.success.message")}):(0,te.jsx)("div",{className:"list-disc list-inside",children:i.map(s=>(0,te.jsx)("li",{className:"mb-1",children:s.message},s.id))})})]})};var Z=require("react/jsx-runtime"),_i=[],wi=({mode:e="edit"})=>{let t=(0,he.useRef)(!1),[o,r]=(0,G.useNodesState)([]),[n,a]=(0,G.useEdgesState)([]),[i,s]=(0,he.useState)(null),{isMoveTool:l,isHandTool:d,isReadOnly:m,setIsReadOnly:f,setIsMultipleSelection:c,isMinimapOpen:h}=$(),{validationResult:u,handleValidationComplete:v,clearValidation:g,isAutoValidationEnabled:p,validateDiagram:b}=Pr(),{getNode:w,getEdges:I,getNodes:A}=(0,G.useReactFlow)(),{onNodeSelected:O,onEdgeSelected:N}=Jt(),{onNodeDrag:T,onDrop:D,onDragOver:C,onNodeDragStop:S}=Fr({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:x,onConnect:j}=Tr({setEdges:a});Or();let{createDiagram:ie}=jr(),{undo:J,redo:Qe,saveHistory:Ce,canUndo:Fe,canRedo:xa}=on(),{helperLineHorizontal:_a,helperLineVertical:wa,customApplyNodeChanges:Ca}=Yr();Jr({LIA_CREATE_DIAGRAM:ie,CLEAR_DIAGRAM:()=>{r([]),a([])}}),(0,he.useEffect)(()=>{f(e==="readonly")},[e,f]);let Ia=()=>{g()},Wo=(0,he.useCallback)(z=>{let P=A(),De=I(),Ie=(0,G.getIncomers)(z,P,De),Oa=(0,G.getOutgoers)(z,P,De),Ga=Ie.some(To=>To.type==="START_EVENT"),Ha=Oa.some(To=>To.type==="END_EVENT");return Ga?"start":Ha?"end":"between"},[A,I]),Aa=(0,he.useCallback)(({nodes:z,edges:P})=>{let De=z.length+P.length>1;if(c(De),z.length===1&&P.length===0){let Ie=z[0];O==null||O({id:Ie.id,type:"activity",variant:Wo(Ie)})}else if(P.length===1&&z.length===0){let Ie=P[0];N==null||N({id:Ie.id,type:"routing"})}},[c,O,N,Wo]);(0,G.useOnSelectionChange)({onChange:Aa});let ka=z=>{let P=w(z.id);if(P!=null&&P.parentId&&(P==null?void 0:P.type)==="LANE"){let De=Ye(P.parentId,o.filter(Ie=>Ie.id!==P.id&&Ie.type==="LANE"));r(ke(De))}},Sa=z=>{z.forEach(P=>{switch(P.type){case"remove":ka(P);break}})},La=(0,he.useCallback)(()=>{if(!p){t.current=!1;return}let z=A(),P=I(),De=b({nodes:z,edges:P});v(De),t.current=!1},[p,A,I,b,v]),Yo=(0,ha.useDebouncedCallback)(La,300),Ko=(0,he.useCallback)(()=>{p&&!t.current&&(t.current=!0,Yo())},[p,Yo]),Da=z=>{r(P=>Ca(z,P)),Ce(z),Ko(),Sa(z)},Pa=z=>{a(P=>(0,G.applyEdgeChanges)(z,P)),Ce(z),Ko()},Ra=()=>{Ce("forceSave")},Ma=async({nodes:z,edges:P})=>(s({nodes:z,edges:P}),!1),Va={nodes:o,edges:n};return(0,Z.jsxs)("div",{className:"w-full h-full",children:[!m&&(0,Z.jsx)(ua,{}),(0,Z.jsx)(rn,{}),(0,Z.jsxs)(G.ReactFlow,{edges:n,nodes:o,nodeTypes:Qn,edgeTypes:ea,minZoom:ia,maxZoom:sa,panOnDrag:d||m?!0:_i,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!m&&l,nodesConnectable:!m&&l,nodesDraggable:!m&&l,isValidConnection:x,connectionLineComponent:zr,onConnect:j,onDrop:D,onDropCapture:Ra,onDragOver:C,onNodesChange:Da,onEdgesChange:Pa,onNodeDrag:T,onNodeDragStop:S,onBeforeDelete:Ma,selectionMode:G.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:la,connectOnClick:!1,children:[h&&(0,Z.jsx)(G.MiniMap,{pannable:!0,zoomable:!0,position:aa,className:"shadow-md rounded-md"}),(0,Z.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!m&&(0,Z.jsx)(Ln,{canUndo:Fe,canRedo:xa,undo:J,redo:Qe}),(0,Z.jsx)(Sn,{nodes:o,isReadOnly:m,diagram:Va,onValidationComplete:v,onValidateDiagram:b}),(0,Z.jsx)(Pn,{})]}),(0,Z.jsx)(ca,{horizontal:_a,vertical:wa}),(0,Z.jsx)(G.Background,{gap:na,size:ra,color:oa,bgColor:ta}),u&&(0,Z.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,Z.jsx)(ga,{validationResult:u,onClose:Ia})})]}),(0,Z.jsx)(ma,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},Ci=({mode:e,locale:t="pt_BR",onConfigureElement:o,onNodeSelected:r,onEdgeSelected:n})=>((0,he.useEffect)(()=>{t&&fa.i18n.changeLanguage(t)},[t]),(0,Z.jsx)(G.ReactFlowProvider,{children:(0,Z.jsx)(fr,{value:{onConfigureElement:o,onNodeSelected:r,onEdgeSelected:n},children:(0,Z.jsx)(wi,{mode:e})})})),zo=Ci;var Fo=e=>{if(typeof document=="undefined")return;let t=document.cookie.match(new RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0};var yo=require("lecom-ui");var ba={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing"},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Unsupported element"}}},adapter:{governance:{error:{DEFAULT:"Error importing diagram",NO_FILE:"No file selected",EMPTY_FILE:"Empty file",INVALID_FILE:"Invalid file",CONTAIN_NO_CELLS:"No cells found to be imported",ALREADY_INITIALIZED:"It is not possible to import the diagram from the Governance platform, since the diagram has already been initialized"},success:{default:"The diagram was imported from the Governance platform successfully and without any incompatibility detected.",incompatible_cells:"The diagram was imported from the Governance platform with incompatibilities. To know more details, click on the button below."},report:{columns:{type:"Type",value:"Value",status:"Status"},status:{imported:"Imported",adapted:"Adapted",unsupported:"Unsupported"}},action:{download:"Download report"}}}}};var Ea={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento"},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento no soportado"}}},adapter:{governance:{error:{DEFAULT:"Error al importar diagrama",NO_FILE:"No se ha seleccionado ning\xFAn archivo",EMPTY_FILE:"Archivo vac\xEDo",INVALID_FILE:"Archivo inv\xE1lido",CONTAIN_NO_CELLS:"No se encontraron c\xE9lulas para importar",ALREADY_INITIALIZED:"No es posible importar el diagrama de la plataforma Governance, ya que el diagrama ya ha sido iniciado"},success:{default:"El diagrama se ha importado de la plataforma Governance correctamente y sin ninguna incompatibilidad detectada.",incompatible_cells:"El diagrama se ha importado de la plataforma Governance con incompatibilidades. Para saber m\xE1s detalles, haz click en el bot\xF3n de abajo."},report:{columns:{type:"Tipo",value:"Valor",status:"Estado"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"No soportado"}},action:{download:"Descargar informe"}}}}};var va={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento"},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de tarefa"},variant:{default:"Tarefa",script:"Tarefa de script",subprocess:"Subprocesso"},attribute:{loop:"Tarefa com loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento n\xE3o suportado"}}},adapter:{governance:{error:{DEFAULT:"Erro ao importar diagrama",NO_FILE:"Nenhum arquivo selecionado",EMPTY_FILE:"Arquivo vazio",INVALID_FILE:"Arquivo inv\xE1lido",CONTAIN_NO_CELLS:"N\xE3o foram encontradas c\xE9lulas para serem importadas",ALREADY_INITIALIZED:"N\xE3o \xE9 poss\xEDvel importar o diagrama da plataforma Governance, pois o diagrama j\xE1 foi iniciado"},success:{default:"O diagrama foi importado da plataforma Governance com sucesso e sem nenhuma incompatibilidade detectada.",incompatible_cells:"O diagrama foi importado da plataforma Governance com incompatibilidades. Para saber mais detalhes, clique no bot\xE3o abaixo."},report:{columns:{type:"Tipo do elemento",value:"Valor",status:"Status"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"N\xE3o suportado"}},action:{download:"Baixar relat\xF3rio"}}}}};var Na={pt_BR:va,en_US:ba,es_ES:Ea};var ya,Ta,Ii=(Ta=(ya=Fo("LecomUserLanguage"))!=null?ya:Fo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Ta:yo.Translations.PT_BR;(0,yo.initializeI18n)({lng:Ii,resources:Na});var Uo=require("react/jsx-runtime"),Ai=e=>(0,Uo.jsx)(Xo,{children:(0,Uo.jsx)(zo,E({},e))});0&&(module.exports={Modeler});
34
+ `),v.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var V=require("react/jsx-runtime");function Sn(){let{t:e}=(0,L.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=An(),[s,l]=(0,kn.useState)(!1);return(0,V.jsxs)(L.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,V.jsx)(L.DropdownMenuTrigger,{asChild:!0,children:(0,V.jsx)("div",{children:(0,V.jsxs)(L.Tooltip,{children:[(0,V.jsx)(L.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(L.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,V.jsx)(He.FolderOutputIcon,{})})}),!s&&(0,V.jsx)(L.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,V.jsxs)(L.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,V.jsxs)(L.Tooltip,{children:[(0,V.jsx)(L.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(L.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>t(),children:(0,V.jsx)(He.FileImageIcon,{})})}),(0,V.jsx)(L.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,V.jsxs)(L.Tooltip,{children:[(0,V.jsx)(L.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(L.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>o(),children:(0,V.jsx)(He.FileCodeIcon,{})})}),(0,V.jsx)(L.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,V.jsxs)(L.Tooltip,{children:[(0,V.jsx)(L.TooltipTrigger,{asChild:!0,children:(0,V.jsx)(L.DropdownMenuItem,{className:"p-1.5",disabled:n,onClick:()=>r(),children:(0,V.jsx)(He.PrinterIcon,{})})}),(0,V.jsx)(L.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var k=require("react/jsx-runtime"),Ln=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=(0,F.useTranslation)(),{deselectAll:i}=so(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:m,isMinimapOpen:f,setIsMinimapOpen:c}=$(),h=(0,Ho.useKeyPress)(["v","V"]),u=(0,Ho.useKeyPress)(["h","H"]),v=(0,Pt.useCallback)(()=>{i(),m()},[i,m]),g=()=>{i();let p=n(o);r&&r(p)};return(0,Pt.useEffect)(()=>{h&&!s&&!t&&d()},[h,d,s,t]),(0,Pt.useEffect)(()=>{u&&!l&&!t&&v()},[u,v,l,t]),(0,k.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(F.Tooltip,{children:[(0,k.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,k.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",className:_(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:(0,k.jsx)(Be.MousePointerIcon,{})})}),(0,k.jsxs)(F.TooltipContent,{color:"black",children:[a("editor.controls.actions.move_tool"),(0,k.jsx)("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),(0,k.jsxs)(F.Tooltip,{children:[(0,k.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,k.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",className:_(l&&"bg-grey-400"),iconButton:!0,onClick:v,children:(0,k.jsx)(Be.HandIcon,{})})}),(0,k.jsxs)(F.TooltipContent,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",(0,k.jsx)("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),(0,k.jsxs)(F.Tooltip,{children:[(0,k.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,k.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:g,children:(0,k.jsx)(Be.ListCheckIcon,{})})}),(0,k.jsx)(F.TooltipContent,{color:"black",children:a("editor.controls.actions.check")})]})]}),(0,k.jsx)(Sn,{}),!t&&(0,k.jsx)(wn,{disabled:e.length>0}),(0,k.jsxs)(F.Tooltip,{children:[(0,k.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,k.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",className:_(f&&"bg-grey-400"),iconButton:!0,onClick:()=>c(!f),children:(0,k.jsx)(Be.MapIcon,{})})}),(0,k.jsx)(F.TooltipContent,{color:"black",children:a(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var le=require("lecom-ui"),po=require("lucide-react"),me=require("react/jsx-runtime"),Dn=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=(0,le.useTranslation)();return(0,me.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,me.jsxs)(le.Tooltip,{children:[(0,me.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(le.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,me.jsx)(po.UndoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.undo")})]}),(0,me.jsxs)(le.Tooltip,{children:[(0,me.jsx)(le.TooltipTrigger,{asChild:!0,children:(0,me.jsx)(le.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:(0,me.jsx)(po.RedoIcon,{})})}),(0,me.jsx)(le.TooltipContent,{color:"black",children:n("editor.controls.history.redo")})]})]})};var Pn=require("@xyflow/react"),U=require("lecom-ui"),ft=require("lucide-react");var H=require("react/jsx-runtime"),Rn=()=>{let{t:e}=(0,U.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=(0,Pn.useReactFlow)();return(0,H.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,H.jsxs)(U.Tooltip,{children:[(0,H.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:(0,H.jsx)(ft.ScanIcon,{})})}),(0,H.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,H.jsxs)(U.Tooltip,{children:[(0,H.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,H.jsx)(ft.ZoomOut,{})})}),(0,H.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,H.jsxs)(U.Tooltip,{children:[(0,H.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:(0,H.jsx)(or,{})})}),(0,H.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,H.jsxs)(U.Tooltip,{children:[(0,H.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(U.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,H.jsx)(ft.ZoomIn,{})})}),(0,H.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var ho=require("@xyflow/react");var Mn=require("@xyflow/react");var Vn=require("react/jsx-runtime"),q=({type:e,position:t,className:o})=>(0,Vn.jsx)(Mn.Handle,{type:e,position:t,className:_("size-2.5 border border-grey-400 bg-white",o)});var mo=require("@xyflow/react"),On=require("lodash");var Gn=require("react/jsx-runtime"),ht=o=>{var r=o,{nodeId:e}=r,t=et(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=(0,mo.useReactFlow)(),s=({width:l,height:d})=>{if(!e)return;let m=n(e);if((m==null?void 0:m.type)!=="LANE")return;let f=[...a()],c=!m.parentId,h=c?m.id:m.parentId,u=f.filter(p=>p.type==="LANE"&&p.parentId===h);if(!u.length)return;let v=(0,On.orderBy)(u,["position.y"]),g=0;v.forEach((p,b)=>{var A,O;let w=b===v.length-1,I=(O=(A=p.measured)==null?void 0:A.height)!=null?O:0;f=f.map(N=>{if(N.id===p.id){let T=c?l-oe.HEADER_WIDTH:l,D=y(E({},N),{width:T,measured:y(E({},N.measured),{width:T}),position:y(E({},N.position),{y:g})});return w&&c&&(D.height=d-g),D}return N}),g+=I}),f=f.map(p=>{if(p.id===h){let b=c?l:l+oe.HEADER_WIDTH;return y(E({},p),{width:b,height:c?d:g,measured:{width:b,height:c?d:g}})}return p}),i(f)};return(0,Gn.jsx)(mo.NodeResizer,E({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};var fo=require("@xyflow/react"),xe=require("lecom-ui");var uo=require("@xyflow/react"),W=require("lecom-ui"),Hn=require("lucide-react");var ne=require("react/jsx-runtime"),Bn=({nodeId:e})=>{let{t}=(0,W.useTranslation)(),{updateNodeData:o}=(0,uo.useReactFlow)(),r=(0,uo.useNodesData)(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return(0,ne.jsxs)(W.DropdownMenu,{children:[(0,ne.jsxs)(W.Tooltip,{children:[(0,ne.jsx)(W.TooltipTrigger,{asChild:!0,children:(0,ne.jsx)(W.DropdownMenuTrigger,{asChild:!0,children:(0,ne.jsx)(W.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,ne.jsx)(Hn.WrenchIcon,{})})})}),(0,ne.jsx)(W.TooltipContent,{color:"black",children:t("bpmn.gateway.menu.title")})]}),(0,ne.jsxs)(W.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,ne.jsx)(W.DropdownMenuLabel,{className:"flex items-center",children:(0,ne.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),(0,ne.jsx)(W.DropdownMenuGroup,{children:Object.entries($t).map(([a,i])=>(0,ne.jsxs)(W.DropdownMenuItem,{className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[(0,ne.jsx)(i.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};var go=require("@xyflow/react"),B=require("lecom-ui"),zn=require("lucide-react");var X=require("react/jsx-runtime"),Fn=({nodeId:e})=>{let{t}=(0,B.useTranslation)(),{updateNodeData:o}=(0,go.useReactFlow)(),r=(0,go.useNodesData)(e),n=i=>{o(e,{variant:(r==null?void 0:r.data.variant)===i?"":i})},a=i=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===i?"":i})};return(0,X.jsxs)(B.DropdownMenu,{children:[(0,X.jsxs)(B.Tooltip,{children:[(0,X.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(B.DropdownMenuTrigger,{asChild:!0,children:(0,X.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,X.jsx)(zn.WrenchIcon,{})})})}),(0,X.jsx)(B.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,X.jsxs)(B.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,X.jsxs)(B.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,X.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,X.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Zt).map(([i,s])=>(0,X.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:(0,X.jsx)(s.icon,{className:"stroke-inherit"})},i))})]}),(0,X.jsx)(B.DropdownMenuGroup,{children:Object.entries(Kt).map(([i,s])=>(0,X.jsxs)(B.DropdownMenuItem,{className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[(0,X.jsx)(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};var de=require("react/jsx-runtime"),ce=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var m;let{t:n}=(0,xe.useTranslation)(),{setDraggableNode:a}=pt(),i=({event:f,type:c,variant:h})=>{a({type:c,variant:h}),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:yt,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:tt,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:yt,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:zt,label:n("bpmn.annotation.variant.default")}},l=[{component:(0,de.jsx)(eo,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Fn,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:(0,de.jsx)(xt,{elementId:e})},{component:(0,de.jsx)(Bn,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return(0,de.jsx)(fo.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:fo.Position.Right,align:"start",isVisible:r,children:(m=d[t])==null?void 0:m.map((f,c)=>f.component?(0,de.jsx)("div",{children:f.component},c):(0,de.jsxs)(xe.Tooltip,{children:[(0,de.jsx)(xe.TooltipTrigger,{asChild:!0,children:(0,de.jsx)(xe.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:h=>i({event:h,type:f.type,variant:f.variant}),children:f.icon&&(0,de.jsx)(f.icon,{size:16})})}),(0,de.jsx)(xe.TooltipContent,{color:"black",children:f.label})]},c))})};var _e=require("react/jsx-runtime"),Un=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,ho.useReactFlow)(),{isMultipleSelection:a}=$(),i=s=>{n(e,{label:s})};return(0,_e.jsxs)(_e.Fragment,{children:[(0,_e.jsx)("div",{className:_("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm overflow-hidden border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:(0,_e.jsx)(Q,{value:t.label,className:"m-1 text-grey-600",onChange:i})}),(0,_e.jsx)(ce,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!a&&o}),(0,_e.jsx)(ht,{isVisible:!r&&!a&&o,minWidth:jt.MIN_WIDTH,minHeight:jt.MIN_HEIGHT}),(0,_e.jsx)(q,{type:"target",position:ho.Position.Left})]})};var Rt=require("@xyflow/react"),Wn=require("react");var ge=require("react/jsx-runtime"),Yn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Rt.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,Wn.useState)(!1),l=f=>{n(e,{label:f})};return(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,ge.jsx)(tt,{className:_("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,ge.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ge.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,ge.jsx)(ce,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),(0,ge.jsx)(q,{type:"source",position:Rt.Position.Right}),(0,ge.jsx)(q,{type:"target",position:Rt.Position.Left})]})};var Mt=require("@xyflow/react"),Kn=require("react");var fe=require("react/jsx-runtime"),Zn=({id:e,data:t,selected:o,dragging:r})=>{let n=$t[t.variant].icon,{updateNodeData:a}=(0,Mt.useReactFlow)(),{isMultipleSelection:i}=$(),[s,l]=(0,Kn.useState)(!1),d=c=>{a(e,{label:c})};return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsxs)("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[(0,fe.jsx)(n,{className:_("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),(0,fe.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,fe.jsx)(Q,{value:t.label,isEditing:s,onChange:d})})]}),(0,fe.jsx)(ce,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),(0,fe.jsx)(q,{type:"target",position:Mt.Position.Left}),(0,fe.jsx)(q,{type:"source",position:Mt.Position.Right})]})};var bo=require("@xyflow/react"),$n=require("react");var be=require("react/jsx-runtime"),qn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,bo.useReactFlow)(),{isMultipleSelection:a}=$(),[i,s]=(0,$n.useState)(!1),l=f=>{n(e,{label:f})};return(0,be.jsxs)(be.Fragment,{children:[(0,be.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,be.jsx)(Yt,{className:_("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),(0,be.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,be.jsx)(Q,{value:t.label,isEditing:i,onChange:l})})]}),(0,be.jsx)(ce,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),(0,be.jsx)(q,{type:"source",position:bo.Position.Right})]})};var Vt=require("@xyflow/react");var ee=require("react/jsx-runtime"),Xn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Vt.useReactFlow)(),{isMultipleSelection:a}=$(),i=c=>{n(e,{label:c})},s=t.variant?Kt[t.variant].icon:null,l=t.attribute?Zt[t.attribute].icon:null,d=t.variant==="SUBPROCESS",m=s&&!d,f=l||d;return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsxs)("div",{className:_("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md overflow-hidden hover:shadow-md transition-colors duration-75",{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[(0,ee.jsx)(Q,{value:t.label,className:_("m-1",{"py-6":m||f}),onChange:i}),s&&(0,ee.jsx)("div",{className:_("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:(0,ee.jsx)(s,{size:16,className:_(t.hasError?"text-red-500":"text-grey-500")})}),l&&(0,ee.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,ee.jsx)("div",{className:_("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:(0,ee.jsx)(l,{size:16,className:_(t.hasError?"text-red-500":"text-grey-500")})})})]}),(0,ee.jsx)(ce,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),(0,ee.jsx)(ht,{isVisible:!r&&!a&&o,minWidth:qt.MIN_WIDTH,minHeight:qt.MIN_HEIGHT}),(0,ee.jsx)(q,{type:"source",position:Vt.Position.Right}),(0,ee.jsx)(q,{type:"target",position:Vt.Position.Left})]})};var Bo=require("@xyflow/react");var Le=require("react/jsx-runtime"),jn=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=$();return(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsx)("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),(0,Le.jsx)(ce,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),(0,Le.jsx)(q,{type:"source",position:Bo.Position.Right}),(0,Le.jsx)(q,{type:"target",position:Bo.Position.Left})]})};var Eo=require("@xyflow/react"),Jn=require("lodash"),zo=require("react");var ue=require("react/jsx-runtime"),Qn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=(0,Eo.useReactFlow)(),{isMultipleSelection:s}=$(),l=i(),d=!n,m=(0,zo.useMemo)(()=>(0,Jn.orderBy)([...l.filter(u=>u.parentId===e&&u.type==="LANE")],"position.y","asc"),[l,e]),f=d?Xt.MIN_WIDTH:oe.MIN_WIDTH,c=(0,zo.useMemo)(()=>{if(d&&m.length>1){let u=[...m];return u.pop(),u.reduce((g,p)=>{var b,w;return g+((w=(b=p.measured)==null?void 0:b.height)!=null?w:0)},0)+oe.MIN_HEIGHT}return oe.MIN_HEIGHT},[d,m]),h=u=>{a(e,{label:u})};return(0,ue.jsxs)(ue.Fragment,{children:[(0,ue.jsxs)("div",{className:_("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[(0,ue.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:(0,ue.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,ue.jsx)(Q,{value:t.label,className:"w-full h-full",onChange:h})})}),(0,ue.jsx)("div",{className:"flex-1"})]}),(0,ue.jsx)(ce,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),(0,ue.jsx)(ht,{nodeId:e,minWidth:f,minHeight:c,isVisible:!r&&!s&&o}),d&&(0,ue.jsx)(q,{type:"source",position:Eo.Position.Right})]})};var ea={START_EVENT:qn,END_EVENT:Yn,TASK:Xn,GATEWAY:Zn,ANNOTATION:Un,LANE:Qn,UNSUPPORTED:jn},ta={SEQUENCE_EDGE:Tr,MESSAGE_EDGE:zr,ANNOTATION_EDGE:Nr},oa="#fafafa",ra="#bebebe",na=1,aa=10,ia="bottom-left",sa=.5,la=4,da={x:0,y:0,zoom:.75};var ca=require("@xyflow/react"),vo=require("react"),ma=require("react/jsx-runtime"),_i=e=>({width:e.width,height:e.height,transform:e.transform}),pa=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=(0,ca.useStore)(_i),s=(0,vo.useRef)(null);return(0,vo.useEffect)(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let m=window.devicePixelRatio;l.width=n*m,l.height=a*m,d.scale(m,m),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),(0,ma.jsx)("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};var Y=require("lecom-ui"),ae=require("react/jsx-runtime"),ua=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=(0,Y.useTranslation)(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(m=>m.filter(f=>!l.some(c=>c.id===f.id))),d!=null&&d.length&&r(m=>m.filter(f=>!d.some(c=>c.id===f.id))),t(null)},s=()=>{t(null)};return(0,ae.jsx)(Y.Dialog,{open:a,onOpenChange:s,children:(0,ae.jsxs)(Y.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,ae.jsx)(Y.DialogHeader,{children:(0,ae.jsx)(Y.DialogTitle,{children:(0,ae.jsx)(Y.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),(0,ae.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,ae.jsx)("div",{className:"py-2",children:(0,ae.jsx)(Y.Notification,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),(0,ae.jsx)(Y.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),(0,ae.jsxs)(Y.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,ae.jsx)(Y.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:(0,ae.jsx)(Y.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),(0,ae.jsx)(Y.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};var we=require("lecom-ui");var ze=require("react/jsx-runtime"),ga=()=>{let{t:e}=(0,we.useTranslation)(),{setDraggableNode:t}=pt(),o=[{type:"START_EVENT",icon:Yt,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:tt,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:yt,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:ar,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:nr,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:rr,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Ut,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Ft,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:tr,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:zt,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return(0,ze.jsx)("aside",{className:"sidebar absolute z-[1] top-4 left-4 grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:o.map((n,a)=>(0,ze.jsxs)(we.Tooltip,{children:[(0,ze.jsx)(we.TooltipTrigger,{asChild:!0,children:(0,ze.jsx)(we.Button,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:(0,ze.jsx)(n.icon,{})},a)}),(0,ze.jsx)(we.TooltipContent,{color:"black",side:"right",children:n.label})]},a))})};var No=require("lecom-ui"),bt=require("lucide-react"),yo=require("react"),te=require("react/jsx-runtime"),fa=({validationResult:e,onClose:t})=>{let{t:o}=(0,No.useTranslation)(),[r,n]=(0,yo.useState)(!1);if((0,yo.useEffect)(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return(0,te.jsxs)("div",{className:_("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[(0,te.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,te.jsx)("div",{className:"flex-shrink-0",children:a?(0,te.jsx)(bt.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,te.jsx)(bt.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,te.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,te.jsx)("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&(0,te.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,te.jsx)(No.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:(0,te.jsx)(bt.XIcon,{})})]}),(0,te.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?(0,te.jsx)("p",{children:o("validation.success.message")}):(0,te.jsx)("div",{className:"list-disc list-inside",children:i.map(s=>(0,te.jsx)("li",{className:"mb-1",children:s.message},s.id))})})]})};var Z=require("react/jsx-runtime"),wi=[],Ci=({mode:e="edit"})=>{let t=(0,he.useRef)(!1),[o,r]=(0,G.useNodesState)([]),[n,a]=(0,G.useEdgesState)([]),[i,s]=(0,he.useState)(null),{isMoveTool:l,isHandTool:d,isReadOnly:m,setIsReadOnly:f,setIsMultipleSelection:c,isMinimapOpen:h}=$(),{validationResult:u,handleValidationComplete:v,clearValidation:g,isAutoValidationEnabled:p,validateDiagram:b}=Rr(),{getNode:w,getEdges:I,getNodes:A}=(0,G.useReactFlow)(),{onNodeSelected:O,onEdgeSelected:N}=Qt(),{onNodeDrag:T,onDrop:D,onDragOver:C,onNodeDragStop:S}=Ur({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:x,onConnect:j}=xr({setEdges:a});Gr();let{createDiagram:ie}=Jr(),{undo:J,redo:Qe,saveHistory:Ce,canUndo:Fe,canRedo:_a}=rn(),{helperLineHorizontal:wa,helperLineVertical:Ca,customApplyNodeChanges:Ia}=Kr();Qr({LIA_CREATE_DIAGRAM:ie,CLEAR_DIAGRAM:()=>{r([]),a([])}}),(0,he.useEffect)(()=>{f(e==="readonly")},[e,f]);let Aa=()=>{g()},Yo=(0,he.useCallback)(z=>{let P=A(),De=I(),Ie=(0,G.getIncomers)(z,P,De),Ga=(0,G.getOutgoers)(z,P,De),Ha=Ie.some(xo=>xo.type==="START_EVENT"),Ba=Ga.some(xo=>xo.type==="END_EVENT");return Ha?"start":Ba?"end":"between"},[A,I]),ka=(0,he.useCallback)(({nodes:z,edges:P})=>{let De=z.length+P.length>1;if(c(De),z.length===1&&P.length===0){let Ie=z[0];O==null||O({id:Ie.id,type:"activity",variant:Yo(Ie)})}else if(P.length===1&&z.length===0){let Ie=P[0];N==null||N({id:Ie.id,type:"routing"})}},[c,O,N,Yo]);(0,G.useOnSelectionChange)({onChange:ka});let Sa=z=>{let P=w(z.id);if(P!=null&&P.parentId&&(P==null?void 0:P.type)==="LANE"){let De=Ye(P.parentId,o.filter(Ie=>Ie.id!==P.id&&Ie.type==="LANE"));r(ke(De))}},La=z=>{z.forEach(P=>{switch(P.type){case"remove":Sa(P);break}})},Da=(0,he.useCallback)(()=>{if(!p){t.current=!1;return}let z=A(),P=I(),De=b({nodes:z,edges:P});v(De),t.current=!1},[p,A,I,b,v]),Ko=(0,ba.useDebouncedCallback)(Da,300),Zo=(0,he.useCallback)(()=>{p&&!t.current&&(t.current=!0,Ko())},[p,Ko]),Pa=z=>{r(P=>Ia(z,P)),Ce(z),Zo(),La(z)},Ra=z=>{a(P=>(0,G.applyEdgeChanges)(z,P)),Ce(z),Zo()},Ma=()=>{Ce("forceSave")},Va=async({nodes:z,edges:P})=>(s({nodes:z,edges:P}),!1),Oa={nodes:o,edges:n};return(0,Z.jsxs)("div",{className:"w-full h-full",children:[!m&&(0,Z.jsx)(ga,{}),(0,Z.jsx)(nn,{}),(0,Z.jsxs)(G.ReactFlow,{edges:n,nodes:o,nodeTypes:ea,edgeTypes:ta,minZoom:sa,maxZoom:la,panOnDrag:d||m?!0:wi,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!m&&l,nodesConnectable:!m&&l,nodesDraggable:!m&&l,isValidConnection:x,connectionLineComponent:Fr,onConnect:j,onDrop:D,onDropCapture:Ma,onDragOver:C,onNodesChange:Pa,onEdgesChange:Ra,onNodeDrag:T,onNodeDragStop:S,onBeforeDelete:Va,selectionMode:G.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:da,connectOnClick:!1,children:[h&&(0,Z.jsx)(G.MiniMap,{pannable:!0,zoomable:!0,position:ia,className:"shadow-md rounded-md"}),(0,Z.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!m&&(0,Z.jsx)(Dn,{canUndo:Fe,canRedo:_a,undo:J,redo:Qe}),(0,Z.jsx)(Ln,{nodes:o,isReadOnly:m,diagram:Oa,onValidationComplete:v,onValidateDiagram:b}),(0,Z.jsx)(Rn,{})]}),(0,Z.jsx)(pa,{horizontal:wa,vertical:Ca}),(0,Z.jsx)(G.Background,{gap:aa,size:na,color:ra,bgColor:oa}),u&&(0,Z.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,Z.jsx)(fa,{validationResult:u,onClose:Aa})})]}),(0,Z.jsx)(ua,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},Ii=({mode:e="edit",locale:t="pt_BR",onConfigureElement:o,onNodeSelected:r,onEdgeSelected:n})=>((0,he.useEffect)(()=>{t&&ha.i18n.changeLanguage(t)},[t]),(0,Z.jsx)(G.ReactFlowProvider,{children:(0,Z.jsx)(hr,{value:{onConfigureElement:o,onNodeSelected:r,onEdgeSelected:n},children:(0,Z.jsx)(Ci,{mode:e})})})),Fo=Ii;var Uo=e=>{if(typeof document=="undefined")return;let t=document.cookie.match(new RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0};var To=require("lecom-ui");var Ea={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing"},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Unsupported element"}}},adapter:{governance:{error:{DEFAULT:"Error importing diagram",NO_FILE:"No file selected",EMPTY_FILE:"Empty file",INVALID_FILE:"Invalid file",CONTAIN_NO_CELLS:"No cells found to be imported",ALREADY_INITIALIZED:"It is not possible to import the diagram from the Governance platform, since the diagram has already been initialized"},success:{default:"The diagram was imported from the Governance platform successfully and without any incompatibility detected.",incompatible_cells:"The diagram was imported from the Governance platform with incompatibilities. To know more details, click on the button below."},report:{columns:{type:"Type",value:"Value",status:"Status"},status:{imported:"Imported",adapted:"Adapted",unsupported:"Unsupported"}},action:{download:"Download report"}}}}};var va={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento"},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento no soportado"}}},adapter:{governance:{error:{DEFAULT:"Error al importar diagrama",NO_FILE:"No se ha seleccionado ning\xFAn archivo",EMPTY_FILE:"Archivo vac\xEDo",INVALID_FILE:"Archivo inv\xE1lido",CONTAIN_NO_CELLS:"No se encontraron c\xE9lulas para importar",ALREADY_INITIALIZED:"No es posible importar el diagrama de la plataforma Governance, ya que el diagrama ya ha sido iniciado"},success:{default:"El diagrama se ha importado de la plataforma Governance correctamente y sin ninguna incompatibilidad detectada.",incompatible_cells:"El diagrama se ha importado de la plataforma Governance con incompatibilidades. Para saber m\xE1s detalles, haz click en el bot\xF3n de abajo."},report:{columns:{type:"Tipo",value:"Valor",status:"Estado"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"No soportado"}},action:{download:"Descargar informe"}}}}};var Na={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento"},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de tarefa"},variant:{default:"Tarefa",script:"Tarefa de script",subprocess:"Subprocesso"},attribute:{loop:"Tarefa com loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento n\xE3o suportado"}}},adapter:{governance:{error:{DEFAULT:"Erro ao importar diagrama",NO_FILE:"Nenhum arquivo selecionado",EMPTY_FILE:"Arquivo vazio",INVALID_FILE:"Arquivo inv\xE1lido",CONTAIN_NO_CELLS:"N\xE3o foram encontradas c\xE9lulas para serem importadas",ALREADY_INITIALIZED:"N\xE3o \xE9 poss\xEDvel importar o diagrama da plataforma Governance, pois o diagrama j\xE1 foi iniciado"},success:{default:"O diagrama foi importado da plataforma Governance com sucesso e sem nenhuma incompatibilidade detectada.",incompatible_cells:"O diagrama foi importado da plataforma Governance com incompatibilidades. Para saber mais detalhes, clique no bot\xE3o abaixo."},report:{columns:{type:"Tipo do elemento",value:"Valor",status:"Status"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"N\xE3o suportado"}},action:{download:"Baixar relat\xF3rio"}}}}};var ya={pt_BR:Na,en_US:Ea,es_ES:va};var Ta,xa,Ai=(xa=(Ta=Uo("LecomUserLanguage"))!=null?Ta:Uo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?xa:To.Translations.PT_BR;(0,To.initializeI18n)({lng:Ai,resources:ya});var Wo=require("react/jsx-runtime"),ki=e=>(0,Wo.jsx)(jo,{children:(0,Wo.jsx)(Fo,E({},e))});0&&(module.exports={EditorMode,Modeler});
package/lib/index.d.cts CHANGED
@@ -28,4 +28,4 @@ interface ModelerProps {
28
28
 
29
29
  declare const Modeler: (props: ModelerProps) => react_jsx_runtime.JSX.Element;
30
30
 
31
- export { type Element, ElementType, ElementVariant, Modeler };
31
+ export { EditorMode, type Element, ElementType, ElementVariant, Modeler };
package/lib/index.d.ts CHANGED
@@ -28,4 +28,4 @@ interface ModelerProps {
28
28
 
29
29
  declare const Modeler: (props: ModelerProps) => react_jsx_runtime.JSX.Element;
30
30
 
31
- export { type Element, ElementType, ElementVariant, Modeler };
31
+ export { EditorMode, type Element, ElementType, ElementVariant, Modeler };
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
- var Un=Object.defineProperty,Wn=Object.defineProperties;var Yn=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var eo=Object.prototype.hasOwnProperty,to=Object.prototype.propertyIsEnumerable;var Qt=(e,t,o)=>t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))eo.call(t,o)&&Qt(e,o,t[o]);if(We)for(var o of We(t))to.call(t,o)&&Qt(e,o,t[o]);return e},y=(e,t)=>Wn(e,Yn(t));var be=(e,t)=>{var o={};for(var r in e)eo.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&We)for(var r of We(e))t.indexOf(r)<0&&to.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as Kn,Notification as Zn}from"lecom-ui";import{jsx as $n,jsxs as qn}from"react/jsx-runtime";function oo({children:e}){return qn(Kn,{children:[$n(Zn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as xd,Background as _d,getIncomers as wd,getOutgoers as Cd,MiniMap as Id,ReactFlow as Ad,ReactFlowProvider as kd,SelectionMode as Sd,useEdgesState as Ld,useNodesState as Dd,useOnSelectionChange as Pd,useReactFlow as Rd}from"@xyflow/react";import{i18n as Md}from"lecom-ui";import{useCallback as Lt,useEffect as En,useRef as Vd,useState as Od}from"react";import{useDebouncedCallback as Gd}from"use-debounce";import{RotateCcw as sa,ScrollText as la,SquarePlus as da}from"lucide-react";import{jsx as Ye,jsxs as Xn}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>Xn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[Ye("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),Ye("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),Ye("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),Ye("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as ro}from"react/jsx-runtime";var Ee=({size:e=24,className:t})=>ro("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#f87171",stroke:"#ef4444",strokeWidth:3,className:t,children:ro("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Ae,jsxs as jn}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>jn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Ae("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Pt,jsxs as Jn}from"react/jsx-runtime";var ve=({size:e=24,className:t})=>Jn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Pt("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Pt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Pt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Rt,jsxs as Qn}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>Qn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Rt("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Rt("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Rt("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Mt,jsxs as ea}from"react/jsx-runtime";var no=({size:e=24,className:t})=>Mt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:ea("g",{children:[Mt("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),Mt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as ta}from"clsx";import{twMerge as oa}from"tailwind-merge";function _(...e){return oa(ta(e))}var ke=(e,t)=>e<t?t:e;import{jsx as ao,jsxs as ra}from"react/jsx-runtime";var io=({size:e=24,className:t})=>ra("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:_("stroke-2",t),children:[ao("path",{d:"M19 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),ao("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Vt}from"react/jsx-runtime";var so=({size:e=24,className:t})=>Vt("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Vt("g",{children:Vt("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});import{jsx as lo}from"react/jsx-runtime";var qe=({size:e=24,className:t})=>lo("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#84cc16",stroke:"#65a30d",strokeWidth:"2",className:t,children:lo("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as co}from"react/jsx-runtime";var Se=({size:e=24,className:t})=>co("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:_("stroke-2",t),children:co("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Ot,jsxs as na}from"react/jsx-runtime";var po=({size:e=24,className:t})=>na("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Ot("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M7.5 12C7.5 12.89 7.76392 13.76 8.25839 14.5001C8.75285 15.2401 9.45566 15.8169 10.2779 16.1575C11.1002 16.4981 12.005 16.5872 12.8779 16.4135C13.7508 16.2399 14.5526 15.8113 15.182 15.182C15.8113 14.5526 16.2399 13.7508 16.4135 12.8779C16.5872 12.005 16.4981 11.1002 16.1575 10.2779C15.8169 9.45566 15.2401 8.75285 14.5001 8.25839C13.76 7.76392 12.89 7.5 12 7.5C10.742 7.50473 9.53448 7.99561 8.63 8.87L7.5 10",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Le,jsxs as aa}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>aa("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Le("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M15.5 14.5V8.5C15.5 8.23478 15.3946 7.98043 15.2071 7.79289C15.0196 7.60536 14.7652 7.5 14.5 7.5H8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M10 16.5H16C16.2652 16.5 16.5196 16.3946 16.7071 16.2071C16.8946 16.0196 17 15.7652 17 15.5V15C17 14.8674 16.9473 14.7402 16.8536 14.6464C16.7598 14.5527 16.6326 14.5 16.5 14.5H11.5C11.3674 14.5 11.2402 14.5527 11.1464 14.6464C11.0527 14.7402 11 14.8674 11 15V15.5C11 15.7652 10.8946 16.0196 10.7071 16.2071C10.5196 16.3946 10.2652 16.5 10 16.5ZM10 16.5C9.73478 16.5 9.48043 16.3946 9.29289 16.2071C9.10536 16.0196 9 15.7652 9 15.5V8.5C9 8.23478 8.89464 7.98043 8.70711 7.79289C8.51957 7.60536 8.26522 7.5 8 7.5C7.73478 7.5 7.48043 7.60536 7.29289 7.79289C7.10536 7.98043 7 8.23478 7 8.5V9.5C7 9.63261 7.05268 9.75979 7.14645 9.85355C7.24021 9.94732 7.36739 10 7.5 10H9",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Xe,jsxs as ia}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>ia("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Xe("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),Xe("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),Xe("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Xe("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var P=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(P||{});var je={SCRIPT:{icon:la},SUBPROCESS:{icon:da}};var Je={LOOP:{icon:sa}};var Qe={EXCLUSIVE:{icon:ve},PARALLEL:{icon:$e},COMPLEX:{icon:Ze}};import ho from"@dagrejs/dagre";import{getNodesBounds as ba}from"@xyflow/react";import{orderBy as Ea}from"lodash";var ca={MIN_WIDTH:36,MIN_HEIGHT:36},pa={MIN_WIDTH:36,MIN_HEIGHT:36},ma={MIN_WIDTH:56,MIN_HEIGHT:56},et={MIN_WIDTH:176,MIN_HEIGHT:96},tt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Y={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},ot={MIN_WIDTH:176,MIN_HEIGHT:64},ua={MIN_WIDTH:128,MIN_HEIGHT:64},V={START_EVENT:ca,END_EVENT:pa,GATEWAY:ma,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:ua};import{orderBy as ga}from"lodash";var ne=e=>{var t,o,r,n,a,i,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(i=(a=e.measured)==null?void 0:a.width)!=null?i:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},ae=e=>ga(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),go=(e,t)=>{let{x:o,y:r}=ne(e),{x:n,y:a}=ne(t);return{x:o-n,y:r-a}};var Ne=({parentId:e,nodes:t,includeTypes:o=[...Object.values(P)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),fa=(e,t)=>{let{x:o,y:r}=ne(e),{x:n,y:a}=ne(t),i=o-n,s=r-a;return Math.sqrt(i*i+s*s)},ha=(e,t)=>{let{x:o,y:r,w:n,h:a}=ne(e),{x:i,y:s,w:l,h:d}=ne(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},De=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&ha(e,n)){let a=fa(e,n);a<r&&(r=a,o=n)}return o},fo=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,a;return Math.max(o,(a=(n=r.measured)==null?void 0:n.width)!=null?a:0)},0);var bo=(e=[],t=[],o="LR")=>{let r=new ho.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:a,width:i,height:s})=>r.setNode(a,{width:i,height:s})),t.forEach(a=>r.setEdge(a.source,a.target)),ho.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return y(E({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},ue=(e,t)=>{var c,h;let o=[...t],r=o.find(u=>u.id===e);if(!r)return o;let n=o.filter(u=>u.parentId===e&&u.type==="LANE");if(n.length===0)return o;let a=Ea(n,["position.y"]),i=Math.max((h=(c=r.measured)==null?void 0:c.width)!=null?h:0,tt.MIN_WIDTH),s=fo(e,a)||Y.MIN_WIDTH,l=Math.max(i,s),d=0,m=0;a.forEach(u=>{var v,g,p,b;o=o.map(w=>w.id===u.id?y(E({},w),{width:l-Y.HEADER_WIDTH,measured:y(E({},w.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):w),d+=(g=(v=u.measured)==null?void 0:v.height)!=null?g:0,m+=(b=(p=u.measured)==null?void 0:p.height)!=null?b:0}),o=o.map(u=>u.id===e?y(E({},u),{height:m,width:l,measured:y(E({},u.measured),{height:m,width:l})}):u);let f=o.find(u=>u.id===e);return f!=null&&f.parentId&&(o=ue(f.parentId,o)),o},Eo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},va=50,vo=(e,t=va)=>{let o=ba(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as Na}from"zustand";var O=Na(e=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:t=>{e({isReadOnly:t})},setIsMultipleSelection:t=>{e({isMultipleSelection:t})},setIsMinimapOpen:t=>{e({isMinimapOpen:t})}}));import{addEdge as Ao,useReactFlow as ni}from"@xyflow/react";import{BaseEdge as Ua,EdgeLabelRenderer as Wa,getStraightPath as Ya,useNodes as Ka,useViewport as Za}from"@xyflow/react";import{getIncomers as wa,getOutgoers as Ca,useReactFlow as Ia}from"@xyflow/react";import{Button as Aa,Tooltip as ka,TooltipContent as Sa,TooltipTrigger as La,useTranslation as Da}from"lecom-ui";import{PencilIcon as Pa}from"lucide-react";import{createContext as ya,useContext as Ta}from"react";var No=ya(null),yo=No.Provider,rt=()=>{let e=Ta(No);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as nt,jsxs as Ra}from"react/jsx-runtime";var Pe=({elementId:e,elementType:t="node"})=>{let{t:o}=Da(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=Ia(),{onConfigureElement:s}=rt(),l=c=>{let h=a(),u=i(),v=wa(c,h,u),g=Ca(c,h,u),p=v.some(w=>w.type==="START_EVENT"),b=g.some(w=>w.type==="END_EVENT");return p?"start":b?"end":"between"},d=()=>{let c=r(e);c&&(s==null||s({id:c.id,type:"activity",variant:l(c)}))},m=()=>{let c=n(e);c&&(s==null||s({id:c.id,type:"routing"}))};return Ra(ka,{children:[nt(La,{asChild:!0,children:nt(Aa,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":d();break;case"edge":m();break}},children:nt(Pa,{size:16})})}),nt(Sa,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Ma}from"@xyflow/react";import{Button as Va,Tooltip as Oa,TooltipContent as Ga,TooltipTrigger as Ha,useTranslation as Ba}from"lecom-ui";import{TrashIcon as za}from"lucide-react";import{jsx as at,jsxs as Fa}from"react/jsx-runtime";var it=({elementId:e,elementType:t="node"})=>{let{t:o}=Ba(),{deleteElements:r}=Ma();return Fa(Oa,{children:[at(Ha,{asChild:!0,children:at(Va,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:at(za,{size:16})})}),at(Ga,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as st}from"react/jsx-runtime";var ye=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=be(n,["edgeId","edgeType"]);var s;let a=[{component:st(it,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:st(Pe,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return st("div",y(E({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>st("div",{children:l.component},d))}))};import{jsx as dt,jsxs as $a}from"react/jsx-runtime";var ct={type:"ANNOTATION_EDGE",zIndex:2e3},To=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=Ka(),{zoom:m}=Za(),f=d.find(b=>b.id===t),c=d.find(b=>b.id===o),[h,u,v]=Ya({sourceX:r,sourceY:n,targetX:a,targetY:i}),g=s||(f==null?void 0:f.selected)||(c==null?void 0:c.selected),p=1/m;return $a("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[dt(Ua,{id:e,path:h,strokeDasharray:4,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":g&&!(l!=null&&l.hasError)})}),dt(Wa,{children:dt("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${u}px, ${v}px)`},children:s&&dt(ye,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};import{BaseEdge as ja,EdgeLabelRenderer as Ja,getSmoothStepPath as Qa,MarkerType as wo,useNodes as ei,useReactFlow as ti,useViewport as oi}from"@xyflow/react";import{useState as ri}from"react";import{useEffect as xo,useRef as qa,useState as Xa}from"react";import{jsx as _o}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=qa(null),[l,d]=Xa(!1);xo(()=>{d(r!=null?r:!1)},[r]),xo(()=>{if(l&&s.current){s.current.focus();let h=document.createRange();h.selectNodeContents(s.current),h.collapse(!1);let u=window.getSelection();u&&(u.removeAllRanges(),u.addRange(h))}},[l]);let m=h=>{h.stopPropagation(),d(!0)},f=h=>{let u=h.currentTarget.innerText;t&&u.length>=t&&h.preventDefault()},c=h=>{d(!1),n==null||n(),o==null||o(h.currentTarget.innerText)};return _o("div",{className:_("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",a,{"border border-dashed border-grey-400":l}),style:i,onDoubleClick:m,children:_o("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:c,children:e})})};import{jsx as pt,jsxs as Co}from"react/jsx-runtime";var le={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:wo.ArrowClosed},markerEnd:{type:wo.Arrow},data:{label:""}},Io=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:m})=>{let f=ei(),{zoom:c}=oi(),{updateEdgeData:h}=ti(),[u,v]=ri(!1),g=f.find(x=>x.id===t),p=f.find(x=>x.id===o),[b,w,I]=Qa({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=m||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),R=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=u||(d==null?void 0:d.label.trim().length)>0,T=1/c,S=()=>{v(!0)},C=()=>{v(!1)},k=x=>{h(e,{label:x.trim()})};return Co("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:S,children:[pt(ja,{id:e,path:b,markerEnd:`url(#${R})`,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),pt(Ja,{children:Co("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[m&&pt(ye,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${T})`}}),N&&pt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:k})]})})]})};var ko=({setEdges:e})=>{let{getNode:t}=ni();return{isValidConnection:n=>{let a=t(n.source),i=t(n.target);if((a==null?void 0:a.id)===(i==null?void 0:i.id))return!1;switch(a==null?void 0:a.type){case"START_EVENT":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"END_EVENT":return(i==null?void 0:i.type)==="ANNOTATION";case"TASK":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"GATEWAY":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"LANE":return(i==null?void 0:i.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(a=>{let i=t(n.target);return(i==null?void 0:i.type)==="ANNOTATION"?Ao(E(E({},n),ct),a):Ao(E(E({},n),le),a)})}}};import{useState as Go}from"react";import{useTranslation as ai}from"lecom-ui";import{useReactFlow as ii}from"@xyflow/react";var Re=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ge=(e=[])=>e.filter(t=>t.type==="END_EVENT"),de=(e=[])=>e.filter(t=>t.type==="TASK")||[],So=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Lo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ut=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Do=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),q=(e,t=[])=>t.filter(o=>o.source===e),Me=(e,t=[])=>t.filter(o=>o.target===e),Po=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(a=>a.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Ro=(e,t)=>{let o=q(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(a=>a.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Mo=e=>e?/\w/g.test(e.trim()):!1,D=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},Q=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Vo=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var Ve=[{id:"start_event_not_found",validate:e=>{let t=Re(e.nodes);return D({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=ge(e.nodes);return D({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Re(e.nodes),o=t.length===1;if(t.length===0)return D({isValid:!0});if(!o)return D({isValid:!1,nodeIds:t.map(a=>a.id)});let r=q(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return D({isValid:!1,nodeIds:[...new Set(a)]})}return D({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=de(e.nodes),o=Q(t,r=>q(r.id,e.edges).length<=2);return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=de(e.nodes),o=Q(t,r=>!!r.label&&r.label.trim()!=="");return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=de(e.nodes),r=Q(o,n=>!n.label||n.label.length<=60);return D({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=de(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let a=n.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(a=>r.push(a.id));return D({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let a=q(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return D({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Re(e.nodes),...ge(e.nodes)],o=[],r=[];for(let n of t){let a=q(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(i.id))}}return D({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=ge(e.nodes),o=[],r=[];for(let n of t){let a=Me(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.source);if(s&&s.type==="TASK"){let l=q(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return D({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Do(e.nodes),o=Q(t,n=>q(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>q(n,e.edges).map(a=>a.id));return D({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=de(e.nodes),o=Q(t,r=>!r.label||Mo(r.label));return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var i,s;if(!((i=e==null?void 0:e.nodes)!=null&&i.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return D({isValid:!0});let t=ge(e.nodes)[0];if(!t)return D({isValid:!0});let o=Me(t.id,e.edges);if(!o.length)return D({isValid:!0});let n=de(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=Q(n,l=>!Po(l.id,e));return D({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=de(e.nodes),o=ge(e.nodes)[0];if(!o)return D({isValid:!0});let r=t.filter(l=>{let d=Me(l.id,e.edges),m=q(l.id,e.edges),f=d.some(h=>{var u;return((u=e.nodes.find(v=>v.id===h.source))==null?void 0:u.type)==="START_EVENT"}),c=m.some(h=>{var u;return((u=e.nodes.find(v=>v.id===h.target))==null?void 0:u.type)==="END_EVENT"});return f&&c}),n=Me(o.id,e.edges),a=n.length>1,i=n.map(l=>l.source),s={isValid:r.length===0&&!a,nodeIds:[...r.map(l=>l.id),...a?i:[]]};return D(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let a=q(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(i.id))}}return D({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ut(e.nodes),o=Q(t,r=>q(r.id,e.edges).length>=1);return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Re(e.nodes),...ge(e.nodes)],o=[],r=[];for(let n of t){let a=q(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return D({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=So(e.nodes),o=Q(t,r=>!Ro(r.id,e));return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Lo(e.nodes),o=Q(t,r=>{var n,a;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((a=r.properties)==null?void 0:a.subprocessRef)!==""});return D({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Oo=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of Ve){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Ho=()=>{let{t:e}=ai(),[t,o]=Go(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=ii(),[s,l]=Go(!1);return{validationResult:t,validateDiagram:c=>{let h=Vo(c.nodes,c.edges),u=Oo(h),v=u.errors.map(g=>y(E({},g),{message:e(`validation.errors.${g.id}`)}));return s||l(!0),{isValid:u.isValid,errors:v}},handleValidationComplete:c=>{if(o(c),!c)return;let h=[],u=[];c.errors.forEach(N=>{N.nodeIds&&N.nodeIds.length>0&&N.nodeIds.forEach(T=>h.push(T)),N.edgeIds&&N.edgeIds.length>0&&N.edgeIds.forEach(T=>u.push(T))});let v=[...new Set(h)];r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})}))),n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})})));let g=a(),p=i(),b=new Set(v),w=new Set;c.errors.forEach(N=>{var C,k;let T=Ve.find(x=>x.id===N.id);(T==null?void 0:T.highlightRelatedEdges)!==!1&&((C=N.edgeIds)==null||C.forEach(x=>w.add(x)),(k=N.nodeIds)==null||k.forEach(x=>{p.forEach(z=>{(z.source===x||z.target===x)&&w.add(z.id)})}))});let I=new Set,A=new Set,R=new Set;g.forEach(N=>{N.type==="START_EVENT"?I.add(N.id):N.type==="END_EVENT"&&A.add(N.id)}),p.forEach(N=>{I.has(N.source)&&R.add(N.target),A.has(N.target)&&R.add(N.source)}),R.forEach(N=>{var T,S;if(b.has(N)){let C=(T=c.errors.find(x=>{var z;return(z=x.nodeIds)==null?void 0:z.includes(N)}))==null?void 0:T.id;((S=Ve.find(x=>x.id===C))==null?void 0:S.highlightRelatedEdges)!==!1&&p.forEach(x=>{x.source===N&&A.has(x.target)&&(b.add(x.target),w.add(x.id)),x.target===N&&I.has(x.source)&&(b.add(x.source),w.add(x.id))})}}),b.size>0&&r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:b.has(T.id)})}))),w.size>0&&n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:w.has(T.id)})})))},clearValidation:()=>{o(null),l(!1),r(c=>c.map(h=>y(E({},h),{data:y(E({},h.data),{hasError:!1})}))),n(c=>c.map(h=>y(E({},h),{data:y(E({},h.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as si}from"@xyflow/react";import{useEffect as li}from"react";import{v7 as Bo}from"uuid";var di=15,zo="bpmn:selection",Fo=({offset:e=di}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=si();li(()=>{let a=s=>{var h;s.preventDefault();let l=t(),d=r(),m=l.filter(u=>u.selected);if(!m.length)return;let f=d.filter(u=>m.some(v=>v.id===u.source)&&m.some(v=>v.id===u.target)),c={nodes:m,edges:f};(h=s.clipboardData)==null||h.setData(zo,JSON.stringify(c))},i=s=>{var c,h;s.preventDefault();let l=JSON.parse(((c=s.clipboardData)==null?void 0:c.getData(zo))||"{}");if(!((h=l.nodes)!=null&&h.length))return;let d=new Map,m=l.nodes.map(u=>{let v=Bo();return d.set(u.id,v),y(E({},u),{id:v,selected:!0,position:{x:u.position.x+e,y:u.position.y+e}})}),f=l.edges.map(u=>y(E({},u),{id:Bo(),selected:!0,source:d.get(u.source)||u.source,target:d.get(u.target)||u.target}));o(u=>[...u.map(v=>y(E({},v),{selected:!1})),...m]),n(u=>[...u.map(v=>y(E({},v),{selected:!1})),...f])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};import{useReactFlow as Ni,useStoreApi as yi}from"@xyflow/react";import{v7 as Zo}from"uuid";import{create as ci}from"zustand";var Te=ci(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as pi,EdgeLabelRenderer as mi,getSmoothStepPath as ui,MarkerType as gi,useNodes as fi,useReactFlow as hi,useViewport as bi}from"@xyflow/react";import{useState as Ei}from"react";import{jsx as gt,jsxs as Uo}from"react/jsx-runtime";var Bm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:gi.Arrow},data:{label:""}},Wo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:m})=>{let f=fi(),{zoom:c}=bi(),{updateEdgeData:h}=hi(),[u,v]=Ei(!1),g=f.find(x=>x.id===t),p=f.find(x=>x.id===o),[b,w,I]=ui({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=m||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),R=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=u||(d==null?void 0:d.label.trim().length)>0,T=1/c,S=()=>{v(!0)},C=()=>{v(!1)},k=x=>{h(e,{label:x.trim()})};return Uo("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:S,children:[gt(pi,{id:e,path:b,markerEnd:`url(#${R})`,strokeDasharray:4,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),gt(mi,{children:Uo("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[m&&gt(ye,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${T})`}}),N&&gt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:k})]})})]})};import{jsx as Yo,jsxs as vi}from"react/jsx-runtime";var Ko=({fromX:e,fromY:t,toX:o,toY:r})=>vi("g",{children:[Yo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),Yo("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var $o=({nodes:e,setNodes:t,setEdges:o})=>{let r=yi(),{draggableNode:n,setDraggableNode:a}=Te(),{getInternalNode:i,screenToFlowPosition:s}=Ni(),l=g=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(b=>b.map(w=>y(E({},w),{className:w.id===g?p:""})))},d=()=>{let{nodeLookup:g}=r.getState();return Array.from(g.values())},m=g=>{let p=i(g.id),b=d();if(g.type==="LANE"){if(Ne({parentId:g.id,nodes:e,includeTypes:["LANE"]})){l();return}let T=b.filter(k=>k.id!==g.id&&k.type==="LANE"&&!k.parentId),S=De(p,T);if(!S){l();return}if(Ne({parentId:S.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(S.id);return}let I=b.filter(N=>N.id!==g.id&&N.type==="LANE"),A=De(p,I);if(!A){l();return}if(Ne({parentId:A.id,nodes:e,includeTypes:["LANE"]})){l();return}l(A.id)},f=g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"},c=(g,p)=>{g.preventDefault(),m(p)},h=(g,p,b)=>{var T,S;let w=C=>C.map(k=>y(E({},k),{className:void 0}));if(g.parentId===p.id){let C=ue(p.id,b);t(ae(w(C)));return}if(g.type==="LANE"){if(Ne({parentId:p.id,nodes:b,excludeTypes:["LANE"]}))return;let x=b.filter(F=>F.parentId===p.id).reduce((F,he)=>{var oe,me;return F+((me=(oe=he.measured)==null?void 0:oe.height)!=null?me:0)},0),z={x:Y.HEADER_WIDTH,y:x},K=b.map(F=>F.id===g.id?y(E({},F),{parentId:p.id,position:z,className:void 0}):y(E({},F),{className:void 0}));K=ue(p.id,K),t(ae(K));return}if(Ne({parentId:p.id,nodes:b,includeTypes:["LANE"]})){let C;if(g.parentId){let x=i(g.parentId),{x:z,y:K}=ne(x);C={x:z+((T=g.position.x)!=null?T:0),y:K+((S=g.position.y)!=null?S:0)}}let k=b.map(x=>x.id===g.id?y(E({},x),{position:C!=null?C:x.position,parentId:void 0,className:void 0}):y(E({},x),{className:void 0}));t(ae(k));return}let R=go(g,p),N=b.map(C=>C.id===g.id?y(E({},C),{parentId:p.id,position:R,className:void 0}):y(E({},C),{className:void 0}));t(ae(N))};return{onDragOver:f,onDrop:g=>{if(g.preventDefault(),!(n!=null&&n.type))return;let p=s({x:g.clientX,y:g.clientY}),b={width:V[n.type].MIN_WIDTH,height:V[n.type].MIN_HEIGHT},w={id:Zo(),type:n.type,position:p,measured:b,data:{label:"",variant:n.variant,attribute:n.attribute}},I=y(E({},w),{internals:{positionAbsolute:p}}),A=d(),R=n.type==="LANE",N=A.filter(C=>R?C.type==="LANE"&&!C.parentId:C.type==="LANE"),T=De(I,N);T?h(I,T,[...A,I]):t(C=>{let k=C.concat(w);return ae(k)});let S=g.dataTransfer.getData("sourceId");if(S){let C={id:Zo(),source:S,target:w.id};if(n.type==="ANNOTATION"){o(k=>k.concat(E(E({},C),ct)));return}o(k=>k.concat(E(E({},C),le)))}a(null)},onNodeDrag:c,onNodeDragStop:async(g,p)=>{var T,S;let{nodeLookup:b}=r.getState(),w=i(p.id),I=Array.from(b.values()),A=p.type==="LANE",R=I.filter(C=>C.id!==p.id&&(A?C.type==="LANE"&&!C.parentId:C.type==="LANE")),N=De(w,R);if(N){h(w,N,I);return}if(p.parentId){let C=i(p.parentId),{x:k,y:x}=ne(C),z={x:k+((T=p.position.x)!=null?T:0),y:x+((S=p.position.y)!=null?S:0)},K=e.map(F=>F.id===p.id?y(E({},F),{position:z,parentId:void 0}):F);K=ue(p.parentId,K),t(ae(K))}}}};import{applyNodeChanges as Ti}from"@xyflow/react";import{useCallback as xi,useState as Xo}from"react";function qo(e,t,o=5){var l,d,m,f,c,h,u,v;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(g=>g.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((f=(m=n.measured)==null?void 0:m.height)!=null?f:0),width:(h=(c=n.measured)==null?void 0:c.width)!=null?h:0,height:(v=(u=n.measured)==null?void 0:u.height)!=null?v:0},i=o,s=o;return t.filter(g=>g.id!==n.id).reduce((g,p)=>{var k,x,z,K,F,he,oe,me;let b={left:p.position.x,right:p.position.x+((x=(k=p.measured)==null?void 0:k.width)!=null?x:0),top:p.position.y,bottom:p.position.y+((K=(z=p.measured)==null?void 0:z.height)!=null?K:0),width:(he=(F=p.measured)==null?void 0:F.width)!=null?he:0,height:(me=(oe=p.measured)==null?void 0:oe.height)!=null?me:0},w=Math.abs(a.left-b.left);w<s&&(g.snapPosition.x=b.left,g.vertical=b.left,s=w);let I=Math.abs(a.right-b.right);I<s&&(g.snapPosition.x=b.right-a.width,g.vertical=b.right,s=I);let A=Math.abs(a.left-b.right);A<s&&(g.snapPosition.x=b.right,g.vertical=b.right,s=A);let R=Math.abs(a.right-b.left);R<s&&(g.snapPosition.x=b.left-a.width,g.vertical=b.left,s=R);let N=Math.abs(a.top-b.top);N<i&&(g.snapPosition.y=b.top,g.horizontal=b.top,i=N);let T=Math.abs(a.bottom-b.top);T<i&&(g.snapPosition.y=b.top-a.height,g.horizontal=b.top,i=T);let S=Math.abs(a.bottom-b.bottom);S<i&&(g.snapPosition.y=b.bottom-a.height,g.horizontal=b.bottom,i=S);let C=Math.abs(a.top-b.bottom);return C<i&&(g.snapPosition.y=b.bottom,g.horizontal=b.bottom,i=C),g},r)}var jo=()=>{let[e,t]=Xo(void 0),[o,r]=Xo(void 0),n=xi((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=qo(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return Ti(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as wi}from"@xyflow/react";import{v7 as or}from"uuid";var Qo={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},er={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Jo=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],i="",s="",l="";if(o.length){switch(o[1]){case"<start>":i="start-event";break;case"<end>":i="end-event";break}e=e.replace(o[1],"")}return r.length&&(i="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(i="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:i,label:s}),{step:e,type:i,label:s,edgeLabel:l}},_i=e=>{e=e||"";let t=e.trim().split(`
2
- `),o={},r=[];return t.forEach(n=>{n=n||"";let a=n.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let i=Jo(a[0],o),s=Jo(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},tr=e=>{let{components:t,connections:o}=_i(e);return{nodes:t,edges:o}};var rr=()=>{let{setNodes:e,setEdges:t,fitView:o}=wi();return{createDiagram:n=>{let{nodes:a,edges:i}=tr(n),s=[],l=new Map;for(let[c,h]of Object.entries(a)){let u=or(),v=Qo[h.type],g=er[h.type];l.set(c,u);let p=V[v].MIN_WIDTH,b=V[v].MIN_HEIGHT;s.push({id:u,type:v,data:{label:h.label||"",variant:g,attribute:""},position:{x:0,y:0},width:p,height:b,measured:{width:p,height:b}})}let d=[];for(let c of i){let h=y(E({},le),{id:or(),source:l.get(c.sourceId)||c.sourceId,target:l.get(c.targetId)||c.targetId});d.push(h)}let{nodes:m,edges:f}=bo(s,d);e(m),t(f),o()}}};import{useEffect as Ci,useCallback as Ii}from"react";var Ai={origin:"*",debug:!1};function nr(e,t=Ai){let{origin:o,debug:r}=t,n=Ii((a,i)=>{r&&console.debug("[postMessage] sending:",{type:a,payload:i}),window.parent.postMessage({type:a,payload:i},o||"*")},[o,r]);return Ci(()=>{let a=i=>{let{type:s,data:l}=i.data||{};r&&console.debug("[postMessage] received:",i.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[e,r]),{sendMessage:n}}import{useReactFlow as ki}from"@xyflow/react";import{useCallback as Oe,useState as ar}from"react";import{useDebouncedCallback as Si}from"use-debounce";var Li={nodes:[],edges:[]},Di=500,ir=10,sr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=ki(),[n,a]=ar([Li]),[i,s]=ar(0),l=n[i],d=i>0,m=i<n.length-1,f=Oe(b=>{o(n[b].nodes),r(n[b].edges)},[n,o,r]),c=Oe(()=>{if(i>0){let b=i-1;s(b),f(b)}},[i,f]),h=Oe(()=>{if(i<n.length-1){let b=i+1;s(b),f(b)}},[n,i,f]),u=b=>{let I=[...n.slice(0,i+1),b],A=I.length>ir?I.slice(I.length-ir):I;a(A),s(A.length-1)},v=Si(()=>{let b=e(),w=t(),I={nodes:b,edges:w};JSON.stringify(l)!==JSON.stringify(I)&&u(I)},Di),g=Oe(b=>{if(b==="forceSave"){v();return}b.some(I=>I.type!=="select")&&v()},[v]),p=Oe(()=>{a([]),s(0)},[]);return{undo:c,redo:h,saveHistory:g,canUndo:d,canRedo:m,clearHistory:p}};import{jsx as lr}from"react/jsx-runtime";var Ht=({id:e,className:t})=>lr("marker",{id:e,className:_("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:lr("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as Bt,jsxs as Pi}from"react/jsx-runtime";var dr=()=>Bt("svg",{style:{position:"absolute",top:0,left:0},children:Pi("defs",{children:[Bt(Ht,{id:"sequence-edge-marker",className:"text-grey-400"}),Bt(Ht,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});import{useKeyPress as Ir}from"@xyflow/react";import{Button as yt,Tooltip as Tt,TooltipContent as xt,TooltipTrigger as _t,useTranslation as As}from"lecom-ui";import{HandIcon as ks,ListCheckIcon as Ss,MapIcon as Ls,MousePointerIcon as Ds}from"lucide-react";import{useCallback as Ps,useEffect as Ar}from"react";import{useStore as Ri}from"@xyflow/react";var Mi=e=>({unselectAll:e.unselectNodesAndEdges}),ft=()=>{let{unselectAll:e}=Ri(Mi);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as is,TooltipContent as ss,TooltipTrigger as ls,useNotificationToast as ds,useTranslation as cs}from"lecom-ui";var Ge=(p=>(p.START_EVENT="START_EVENT",p.END_EVENT="END_EVENT",p.TASK="TASK",p.SUBPROCESS="SUBPROCESS",p.GATEWAY="GATEWAY",p.ANNOTATION="ANNOTATION",p.CONNECTION="CONNECTION",p.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",p.ACTIVITY="ACTIVITY",p.PROCESS_INTERFACE="PROCESS_INTERFACE",p.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",p.VARIANT_ACTIVITY="VARIANT_ACTIVITY",p.AUTO_ACTIVITY="AUTO_ACTIVITY",p.DATA_STORE="DATA_STORE",p.DATA_OBJECT="DATA_OBJECT",p.DATA_OUTPUT="DATA_OUTPUT",p.DATA_INPUT="DATA_INPUT",p))(Ge||{});import{useReactFlow as ji}from"@xyflow/react";import{useNotificationToast as Ji,useTranslation as Qi,Button as es}from"lecom-ui";var cr=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var a;t((a=n.target)==null?void 0:a.result)},r.onerror=n=>{var a;o((a=n.target)==null?void 0:a.error)},r.readAsText(e)});function pr({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(i=>i.join(",")).join(`
3
- `),a=encodeURI(n);ht(a,`${o}.csv`)}var ht=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};import{v7 as Ki}from"uuid";import{xml2json as Vi,json2xml as Zu}from"xml-js";var Oi={compact:!0,spaces:4},Gi=e=>e.replaceAll(`
4
- `,"&#xA;");function mr(e,t=Oi){if(e)return JSON.parse(Vi(e,y(E({},t),{attributeValueFn:Gi})))}function ur(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}import{v7 as Bi}from"uuid";var Qu={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},gr={script:"SCRIPT",subprocess:"SUBPROCESS"},fr={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var xe=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:a}=r,i=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:a||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:i,height:s,measured:{width:i,height:s}}},zi=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=V.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.START_EVENT.MIN_HEIGHT,{node:xe({cell:e,type:"START_EVENT"}),status:r,originalType:o}},Fi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=V.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.END_EVENT.MIN_HEIGHT,{node:xe({cell:e,type:"END_EVENT"}),status:r,originalType:o}},Ui=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=gr[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,V.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,V.TASK.MIN_HEIGHT),{node:xe({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},Wi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=fr[o],n=["none","inclusive","event-based"],a="imported";return n.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=V.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=V.GATEWAY.MIN_HEIGHT,{node:xe({cell:e,type:"GATEWAY",variant:r}),status:a,originalType:t}},Yi=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,V.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,V.ANNOTATION.MIN_HEIGHT),{node:xe({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},hr=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=V.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=V.UNSUPPORTED.MIN_HEIGHT,{node:xe({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},br=(e,t)=>{let{source:o,target:r}=e._attributes;return y(E({},le),{id:Bi(),source:t.get(o)||o,target:t.get(r)||r})},Er={TASK:Ui,GATEWAY:Wi,START_EVENT:zi,END_EVENT:Fi,ANNOTATION:Yi};var Zi=e=>{var i;let t=new Map,o=Object.values(Ge),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],a=[];for(let s of r){let l=Ki(),{type:d}=s._attributes,m=Er[d]||hr;t.set((i=s._attributes)==null?void 0:i.id,l),s._attributes.id=l;let{node:f,status:c,originalType:h}=m(s);n.push(f),a.push({originalType:h,type:f.type,variant:f.data.variant,value:ur(f.data.label),status:c})}return{nodes:n,governanceIdToNodeIdMap:t,summary:a}},$i=(e,t)=>e.filter(n=>{var a;return(a=n._attributes)==null?void 0:a.edge}).map(n=>br(n,t)),qi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=Zi(t.root.mxCell),a=$i(t.root.mxCell,r);return{nodes:o,edges:a,summary:n}},Xi=async e=>{let t=await cr(e),o=mr(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},a=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),i=n==null?void 0:n.root;if(!a||!i)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},vr=async e=>{try{let t=await Xi(e),{nodes:o,edges:r,summary:n}=qi(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};import{jsx as ts}from"react/jsx-runtime";var Nr=()=>{let{t:e}=Qi(),{toast:t}=Ji(),{setNodes:o,setEdges:r,fitView:n}=ji(),a=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=s.map(m=>[m.originalType,m.value,e(`adapter.governance.report.status.${m.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:ts(es,{size:"small",variant:"ghost",onClick:()=>pr({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:d,summary:m}=await vr(s);if(o(c=>c.concat(l)),r(c=>c.concat(d)),n(),m.some(c=>c.status==="unsupported")){a(m);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};import{Button as os}from"lecom-ui";import{useRef as rs}from"react";import{Fragment as ns,jsx as yr,jsxs as as}from"react/jsx-runtime";var Tr=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:a}=l,i=be(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=rs(null),m=c=>{let h=c.target.files;h!=null&&h.length&&a(h),d.current&&(d.current.value="")};return as(ns,{children:[yr(os,y(E({onClick:c=>{var h;(h=d.current)==null||h.click(),n==null||n(c)}},i),{children:e})),yr("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:m})]})};import{jsx as bt,jsxs as ps}from"react/jsx-runtime";var xr=({disabled:e=!1})=>{let{t}=cs(),{toast:o}=ds(),{createDiagram:r}=Nr(),n=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},a=i=>{let s=i[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}r(s)};return ps(is,{children:[bt(ls,{asChild:!0,children:bt(Tr,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:a,children:bt(no,{})})}),bt(ss,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as Es,DropdownMenu as vs,DropdownMenuContent as Ns,DropdownMenuItem as Ft,DropdownMenuTrigger as ys,Tooltip as Et,TooltipContent as vt,TooltipTrigger as Nt,useTranslation as Ts}from"lecom-ui";import{FileCodeIcon as xs,FileImageIcon as _s,FolderOutputIcon as ws,PrinterIcon as Cs}from"lucide-react";import{useState as Is}from"react";import{useReactFlow as ms}from"@xyflow/react";import{toPng as _r,toSvg as us}from"html-to-image";import{toast as gs,useTranslation as fs}from"lecom-ui";import{useState as hs}from"react";var bs=3,zt="diagram",wr=()=>{let{t:e}=fs(),{getNodes:t}=ms(),{deselectAll:o}=ft(),[r,n]=hs({png:!1,html:!1,print:!1}),a=()=>{let{x:m,y:f,width:c,height:h}=vo(t());return{width:c,height:h,style:{width:`${c}px`,height:`${h}px`,transform:`translate(${-m}px, ${-f}px)`}}},i=async(m,f)=>{n(y(E({},r),{[f]:!0})),await o();try{let c=Eo();if(!c)throw new Error("Flow element not found");let h=a();return await m(c,h)}catch(c){gs({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(y(E({},r),{[f]:!1}))}};return{exportAsPng:async(m=zt)=>{await i(async(f,c)=>{let h=await _r(f,y(E({},c),{backgroundColor:"#fcfcfc"}));ht(h,`${m}.png`)},"png")},exportAsHtml:async(m=zt)=>{await i(async(f,c)=>{let h=await us(f,y(E({},c),{backgroundColor:"#fcfcfc"})),u=`
1
+ var Wn=Object.defineProperty,Yn=Object.defineProperties;var Kn=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var to=Object.prototype.hasOwnProperty,oo=Object.prototype.propertyIsEnumerable;var eo=(e,t,o)=>t in e?Wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,E=(e,t)=>{for(var o in t||(t={}))to.call(t,o)&&eo(e,o,t[o]);if(We)for(var o of We(t))oo.call(t,o)&&eo(e,o,t[o]);return e},y=(e,t)=>Yn(e,Kn(t));var be=(e,t)=>{var o={};for(var r in e)to.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&We)for(var r of We(e))t.indexOf(r)<0&&oo.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as Zn,Notification as $n}from"lecom-ui";import{jsx as qn,jsxs as Xn}from"react/jsx-runtime";function ro({children:e}){return Xn(Zn,{children:[qn($n,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{applyEdgeChanges as _d,Background as wd,getIncomers as Cd,getOutgoers as Id,MiniMap as Ad,ReactFlow as kd,ReactFlowProvider as Sd,SelectionMode as Ld,useEdgesState as Dd,useNodesState as Pd,useOnSelectionChange as Rd,useReactFlow as Md}from"@xyflow/react";import{i18n as Vd}from"lecom-ui";import{useCallback as Lt,useEffect as vn,useRef as Od,useState as Gd}from"react";import{useDebouncedCallback as Hd}from"use-debounce";var Pt=(o=>(o.EDIT="edit",o.READONLY="readonly",o))(Pt||{});import{RotateCcw as la,ScrollText as da,SquarePlus as ca}from"lucide-react";import{jsx as Ye,jsxs as jn}from"react/jsx-runtime";var Ke=({size:e=24,className:t})=>jn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[Ye("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),Ye("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),Ye("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),Ye("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as no}from"react/jsx-runtime";var Ee=({size:e=24,className:t})=>no("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#f87171",stroke:"#ef4444",strokeWidth:3,className:t,children:no("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Ae,jsxs as Jn}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>Jn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Ae("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ae("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Rt,jsxs as Qn}from"react/jsx-runtime";var ve=({size:e=24,className:t})=>Qn("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Rt("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Rt("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Rt("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Mt,jsxs as ea}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>ea("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Mt("path",{d:"M2.69991 10.2997C2.47586 10.5235 2.29812 10.7893 2.17685 11.0818C2.05558 11.3744 1.99316 11.688 1.99316 12.0047C1.99316 12.3214 2.05558 12.635 2.17685 12.9275C2.29812 13.2201 2.47586 13.4859 2.69991 13.7097L10.2899 21.2997C10.5137 21.5237 10.7795 21.7015 11.0721 21.8227C11.3646 21.944 11.6782 22.0064 11.9949 22.0064C12.3116 22.0064 12.6252 21.944 12.9177 21.8227C13.2103 21.7015 13.4761 21.5237 13.6999 21.2997L21.2899 13.7097C21.514 13.4859 21.6917 13.2201 21.813 12.9275C21.9342 12.635 21.9967 12.3214 21.9967 12.0047C21.9967 11.688 21.9342 11.3744 21.813 11.0818C21.6917 10.7893 21.514 10.5235 21.2899 10.2997L13.6999 2.70968C13.4761 2.48562 13.2103 2.30788 12.9177 2.18662C12.6252 2.06535 12.3116 2.00293 11.9949 2.00293C11.6782 2.00293 11.3646 2.06535 11.0721 2.18662C10.7795 2.30788 10.5137 2.48562 10.2899 2.70968L2.69991 10.2997Z",strokeLinecap:"round",strokeLinejoin:"round"}),Mt("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Mt("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Vt,jsxs as ta}from"react/jsx-runtime";var ao=({size:e=24,className:t})=>Vt("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:ta("g",{children:[Vt("path",{d:"M8.6543 11.4141V15.2148C8.51302 15.4017 8.29199 15.6068 7.99121 15.8301C7.69499 16.0488 7.30078 16.238 6.80859 16.3975C6.31641 16.557 5.70345 16.6367 4.96973 16.6367C4.34538 16.6367 3.77344 16.5319 3.25391 16.3223C2.73438 16.1081 2.28548 15.7959 1.90723 15.3857C1.53353 14.9756 1.24414 14.4766 1.03906 13.8887C0.833984 13.2962 0.731445 12.6217 0.731445 11.8652V11.1748C0.731445 10.4229 0.82487 9.75293 1.01172 9.16504C1.20312 8.57259 1.47656 8.07129 1.83203 7.66113C2.1875 7.25098 2.61589 6.94108 3.11719 6.73145C3.62305 6.51725 4.19499 6.41016 4.83301 6.41016C5.64876 6.41016 6.32324 6.54688 6.85645 6.82031C7.39421 7.08919 7.80892 7.46289 8.10059 7.94141C8.39225 8.41992 8.57682 8.9668 8.6543 9.58203H6.97266C6.91797 9.23568 6.81087 8.92578 6.65137 8.65234C6.49642 8.37891 6.27311 8.16471 5.98145 8.00977C5.69434 7.85026 5.32064 7.77051 4.86035 7.77051C4.46387 7.77051 4.11523 7.8457 3.81445 7.99609C3.51367 8.14648 3.26302 8.36751 3.0625 8.65918C2.86654 8.95085 2.71842 9.30632 2.61816 9.72559C2.5179 10.1449 2.46777 10.6234 2.46777 11.1611V11.8652C2.46777 12.4121 2.52474 12.8975 2.63867 13.3213C2.75716 13.7451 2.92578 14.1029 3.14453 14.3945C3.36784 14.6862 3.639 14.9072 3.95801 15.0576C4.27702 15.2035 4.63704 15.2764 5.03809 15.2764C5.43001 15.2764 5.7513 15.2445 6.00195 15.1807C6.2526 15.1123 6.45085 15.0326 6.59668 14.9414C6.74707 14.8457 6.86328 14.7546 6.94531 14.668V12.6924H4.87402V11.4141H8.6543ZM17.0912 11.25V11.7969C17.0912 12.5488 16.9932 13.2233 16.7973 13.8203C16.6013 14.4173 16.321 14.9255 15.9564 15.3447C15.5964 15.764 15.1635 16.0853 14.6576 16.3086C14.1518 16.5273 13.5912 16.6367 12.976 16.6367C12.3653 16.6367 11.807 16.5273 11.3012 16.3086C10.7999 16.0853 10.3646 15.764 9.99551 15.3447C9.62637 14.9255 9.33926 14.4173 9.13418 13.8203C8.93366 13.2233 8.8334 12.5488 8.8334 11.7969V11.25C8.8334 10.498 8.93366 9.82585 9.13418 9.2334C9.3347 8.63639 9.61725 8.12826 9.98184 7.70898C10.351 7.28516 10.7862 6.96387 11.2875 6.74512C11.7934 6.52181 12.3516 6.41016 12.9623 6.41016C13.5775 6.41016 14.1381 6.52181 14.6439 6.74512C15.1498 6.96387 15.585 7.28516 15.9496 7.70898C16.3142 8.12826 16.5945 8.63639 16.7904 9.2334C16.991 9.82585 17.0912 10.498 17.0912 11.25ZM15.3754 11.7969V11.2363C15.3754 10.6803 15.3207 10.1904 15.2113 9.7666C15.1065 9.33822 14.9493 8.98047 14.7396 8.69336C14.5346 8.40169 14.2816 8.18294 13.9809 8.03711C13.6801 7.88672 13.3406 7.81152 12.9623 7.81152C12.584 7.81152 12.2468 7.88672 11.9506 8.03711C11.6544 8.18294 11.4014 8.40169 11.1918 8.69336C10.9867 8.98047 10.8295 9.33822 10.7201 9.7666C10.6107 10.1904 10.5561 10.6803 10.5561 11.2363V11.7969C10.5561 12.3529 10.6107 12.8451 10.7201 13.2734C10.8295 13.7018 10.989 14.0641 11.1986 14.3604C11.4128 14.652 11.668 14.873 11.9643 15.0234C12.2605 15.1693 12.5977 15.2422 12.976 15.2422C13.3588 15.2422 13.6983 15.1693 13.9945 15.0234C14.2908 14.873 14.5414 14.652 14.7465 14.3604C14.9516 14.0641 15.1065 13.7018 15.2113 13.2734C15.3207 12.8451 15.3754 12.3529 15.3754 11.7969ZM20.6678 14.6816L23.2859 6.54688H25.1795L21.6111 16.5H20.3328L20.6678 14.6816ZM18.2479 6.54688L20.8455 14.6816L21.201 16.5H19.9158L16.3611 6.54688H18.2479Z"}),Vt("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as oa}from"clsx";import{twMerge as ra}from"tailwind-merge";function _(...e){return ra(oa(e))}var ke=(e,t)=>e<t?t:e;import{jsx as io,jsxs as na}from"react/jsx-runtime";var so=({size:e=24,className:t})=>na("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:_("stroke-2",t),children:[io("path",{d:"M19 3H5C3.89543 3 3 3.89543 3 5V19C3 20.1046 3.89543 21 5 21H19C20.1046 21 21 20.1046 21 19V5C21 3.89543 20.1046 3 19 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),io("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ot}from"react/jsx-runtime";var lo=({size:e=24,className:t})=>Ot("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Ot("g",{children:Ot("path",{d:"M4.85372 6.17472L5.31292 5.71552L5.31993 5.70863C6.88908 4.1924 8.98352 3.34122 11.1655 3.33301L11.1668 3.33301C11.167 3.33301 11.1673 3.33301 11.1675 3.33301C12.7165 3.33314 14.2308 3.79255 15.5188 4.65317C16.807 5.5139 17.811 6.7373 18.4039 8.16866C18.9968 9.60001 19.1519 11.175 18.8497 12.6945C18.5986 13.9567 18.0414 15.1334 17.232 16.1236L16.9457 16.4738L17.2655 16.7936L20.6617 20.1899L20.6617 20.1899C20.7919 20.3201 20.7919 20.5311 20.6617 20.6612L20.6616 20.6613C20.5316 20.7915 20.3205 20.7915 20.1903 20.6613L16.7941 17.265L16.4743 16.9452L16.1241 17.2315C15.1339 18.0409 13.9571 18.5981 12.695 18.8492C11.1755 19.1514 9.6005 18.9963 8.16915 18.4034C6.73778 17.8105 5.51439 16.8065 4.65365 15.5183C3.79291 14.2301 3.3335 12.7156 3.3335 11.1663C3.3335 10.9822 3.48273 10.833 3.66683 10.833C3.85093 10.833 4.00016 10.9822 4.00016 11.1663C4.00016 12.5838 4.42048 13.9694 5.20796 15.148C5.99545 16.3265 7.11474 17.245 8.42426 17.7874C9.73378 18.3299 11.1748 18.4719 12.565 18.1953C13.9552 17.9188 15.2321 17.2362 16.2344 16.234L16.2345 16.234C17.2367 15.2316 17.9193 13.9547 18.1958 12.5645C18.4724 11.1743 18.3304 9.7333 17.7879 8.42378C17.2455 7.11426 16.327 5.99497 15.1484 5.20748L14.8707 5.62322L15.1484 5.20748C13.9703 4.42031 12.5854 4.00001 11.1685 3.99968L11.1664 3.99969C9.15876 4.00767 7.23176 4.7903 5.78712 6.18424L5.78706 6.18418L5.78075 6.1905L5.32512 6.64613L4.47156 7.49968H5.67867H7.8335C8.01759 7.49968 8.16683 7.64892 8.16683 7.83302C8.16683 8.01711 8.01759 8.16635 7.8335 8.16635H3.66683C3.48274 8.16635 3.3335 8.01711 3.3335 7.83302V3.66635C3.3335 3.48225 3.48274 3.33302 3.66683 3.33302C3.85092 3.33302 4.00016 3.48225 4.00016 3.66635V5.82117V7.02827L4.85372 6.17472Z"})})});import{jsx as co}from"react/jsx-runtime";var qe=({size:e=24,className:t})=>co("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#84cc16",stroke:"#65a30d",strokeWidth:"2",className:t,children:co("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as po}from"react/jsx-runtime";var Se=({size:e=24,className:t})=>po("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:_("stroke-2",t),children:po("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"})});import{jsx as Gt,jsxs as aa}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>aa("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Gt("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),Gt("path",{d:"M7.5 12C7.5 12.89 7.76392 13.76 8.25839 14.5001C8.75285 15.2401 9.45566 15.8169 10.2779 16.1575C11.1002 16.4981 12.005 16.5872 12.8779 16.4135C13.7508 16.2399 14.5526 15.8113 15.182 15.182C15.8113 14.5526 16.2399 13.7508 16.4135 12.8779C16.5872 12.005 16.4981 11.1002 16.1575 10.2779C15.8169 9.45566 15.2401 8.75285 14.5001 8.25839C13.76 7.76392 12.89 7.5 12 7.5C10.742 7.50473 9.53448 7.99561 8.63 8.87L7.5 10",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Gt("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Le,jsxs as ia}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>ia("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:"2",className:t,children:[Le("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M15.5 14.5V8.5C15.5 8.23478 15.3946 7.98043 15.2071 7.79289C15.0196 7.60536 14.7652 7.5 14.5 7.5H8",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M10 16.5H16C16.2652 16.5 16.5196 16.3946 16.7071 16.2071C16.8946 16.0196 17 15.7652 17 15.5V15C17 14.8674 16.9473 14.7402 16.8536 14.6464C16.7598 14.5527 16.6326 14.5 16.5 14.5H11.5C11.3674 14.5 11.2402 14.5527 11.1464 14.6464C11.0527 14.7402 11 14.8674 11 15V15.5C11 15.7652 10.8946 16.0196 10.7071 16.2071C10.5196 16.3946 10.2652 16.5 10 16.5ZM10 16.5C9.73478 16.5 9.48043 16.3946 9.29289 16.2071C9.10536 16.0196 9 15.7652 9 15.5V8.5C9 8.23478 8.89464 7.98043 8.70711 7.79289C8.51957 7.60536 8.26522 7.5 8 7.5C7.73478 7.5 7.48043 7.60536 7.29289 7.79289C7.10536 7.98043 7 8.23478 7 8.5V9.5C7 9.63261 7.05268 9.75979 7.14645 9.85355C7.24021 9.94732 7.36739 10 7.5 10H9",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Le("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Xe,jsxs as sa}from"react/jsx-runtime";var go=({size:e=24,className:t})=>sa("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",strokeWidth:2,className:t,children:[Xe("path",{d:"M20 3H4C2.89543 3 2 4.34315 2 6V18C2 19.6569 2.89543 21 4 21H20C21.1046 21 22 19.6569 22 18V6C22 4.34315 21.1046 3 20 3Z",strokeLinecap:"round",strokeLinejoin:"round"}),Xe("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),Xe("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),Xe("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var P=(s=>(s.START_EVENT="START_EVENT",s.END_EVENT="END_EVENT",s.TASK="TASK",s.LANE="LANE",s.GATEWAY="GATEWAY",s.ANNOTATION="ANNOTATION",s.UNSUPPORTED="UNSUPPORTED",s))(P||{});var je={SCRIPT:{icon:da},SUBPROCESS:{icon:ca}};var Je={LOOP:{icon:la}};var Qe={EXCLUSIVE:{icon:ve},PARALLEL:{icon:$e},COMPLEX:{icon:Ze}};import bo from"@dagrejs/dagre";import{getNodesBounds as Ea}from"@xyflow/react";import{orderBy as va}from"lodash";var pa={MIN_WIDTH:36,MIN_HEIGHT:36},ma={MIN_WIDTH:36,MIN_HEIGHT:36},ua={MIN_WIDTH:56,MIN_HEIGHT:56},et={MIN_WIDTH:176,MIN_HEIGHT:96},tt={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Y={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},ot={MIN_WIDTH:176,MIN_HEIGHT:64},ga={MIN_WIDTH:128,MIN_HEIGHT:64},V={START_EVENT:pa,END_EVENT:ma,GATEWAY:ua,TASK:et,LANE:Y,ANNOTATION:ot,UNSUPPORTED:ga};import{orderBy as fa}from"lodash";var ne=e=>{var t,o,r,n,a,i,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(n=(r=e.internals)==null?void 0:r.positionAbsolute.y)!=null?n:0,w:(i=(a=e.measured)==null?void 0:a.width)!=null?i:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},ae=e=>fa(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),fo=(e,t)=>{let{x:o,y:r}=ne(e),{x:n,y:a}=ne(t);return{x:o-n,y:r-a}};var Ne=({parentId:e,nodes:t,includeTypes:o=[...Object.values(P)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),ha=(e,t)=>{let{x:o,y:r}=ne(e),{x:n,y:a}=ne(t),i=o-n,s=r-a;return Math.sqrt(i*i+s*s)},ba=(e,t)=>{let{x:o,y:r,w:n,h:a}=ne(e),{x:i,y:s,w:l,h:d}=ne(t);return o<i+l&&i<o+n&&r<s+d&&s<r+a},De=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&ba(e,n)){let a=ha(e,n);a<r&&(r=a,o=n)}return o},ho=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,a;return Math.max(o,(a=(n=r.measured)==null?void 0:n.width)!=null?a:0)},0);var Eo=(e=[],t=[],o="LR")=>{let r=new bo.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:a,width:i,height:s})=>r.setNode(a,{width:i,height:s})),t.forEach(a=>r.setEdge(a.source,a.target)),bo.layout(r),{nodes:e.map(a=>{let i=r.node(a.id);return y(E({},a),{position:{x:i.x-a.width/2,y:i.y-a.height/2}})}),edges:t}},ue=(e,t)=>{var c,h;let o=[...t],r=o.find(u=>u.id===e);if(!r)return o;let n=o.filter(u=>u.parentId===e&&u.type==="LANE");if(n.length===0)return o;let a=va(n,["position.y"]),i=Math.max((h=(c=r.measured)==null?void 0:c.width)!=null?h:0,tt.MIN_WIDTH),s=ho(e,a)||Y.MIN_WIDTH,l=Math.max(i,s),d=0,m=0;a.forEach(u=>{var v,g,p,b;o=o.map(w=>w.id===u.id?y(E({},w),{width:l-Y.HEADER_WIDTH,measured:y(E({},w.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):w),d+=(g=(v=u.measured)==null?void 0:v.height)!=null?g:0,m+=(b=(p=u.measured)==null?void 0:p.height)!=null?b:0}),o=o.map(u=>u.id===e?y(E({},u),{height:m,width:l,measured:y(E({},u.measured),{height:m,width:l})}):u);let f=o.find(u=>u.id===e);return f!=null&&f.parentId&&(o=ue(f.parentId,o)),o},vo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Na=50,No=(e,t=Na)=>{let o=Ea(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as ya}from"zustand";var O=ya(e=>({isMoveTool:!0,isHandTool:!1,isReadOnly:!1,isMultipleSelection:!1,isMinimapOpen:!1,activeMoveTool:()=>{e({isMoveTool:!0,isHandTool:!1})},activeHandTool:()=>{e({isHandTool:!0,isMoveTool:!1})},setIsReadOnly:t=>{e({isReadOnly:t})},setIsMultipleSelection:t=>{e({isMultipleSelection:t})},setIsMinimapOpen:t=>{e({isMinimapOpen:t})}}));import{addEdge as ko,useReactFlow as ai}from"@xyflow/react";import{BaseEdge as Wa,EdgeLabelRenderer as Ya,getStraightPath as Ka,useNodes as Za,useViewport as $a}from"@xyflow/react";import{getIncomers as Ca,getOutgoers as Ia,useReactFlow as Aa}from"@xyflow/react";import{Button as ka,Tooltip as Sa,TooltipContent as La,TooltipTrigger as Da,useTranslation as Pa}from"lecom-ui";import{PencilIcon as Ra}from"lucide-react";import{createContext as Ta,useContext as xa}from"react";var yo=Ta(null),To=yo.Provider,rt=()=>{let e=xa(yo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as nt,jsxs as Ma}from"react/jsx-runtime";var Pe=({elementId:e,elementType:t="node"})=>{let{t:o}=Pa(),{getNode:r,getEdge:n,getNodes:a,getEdges:i}=Aa(),{onConfigureElement:s}=rt(),l=c=>{let h=a(),u=i(),v=Ca(c,h,u),g=Ia(c,h,u),p=v.some(w=>w.type==="START_EVENT"),b=g.some(w=>w.type==="END_EVENT");return p?"start":b?"end":"between"},d=()=>{let c=r(e);c&&(s==null||s({id:c.id,type:"activity",variant:l(c)}))},m=()=>{let c=n(e);c&&(s==null||s({id:c.id,type:"routing"}))};return Ma(Sa,{children:[nt(Da,{asChild:!0,children:nt(ka,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":d();break;case"edge":m();break}},children:nt(Ra,{size:16})})}),nt(La,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Va}from"@xyflow/react";import{Button as Oa,Tooltip as Ga,TooltipContent as Ha,TooltipTrigger as Ba,useTranslation as za}from"lecom-ui";import{TrashIcon as Fa}from"lucide-react";import{jsx as at,jsxs as Ua}from"react/jsx-runtime";var it=({elementId:e,elementType:t="node"})=>{let{t:o}=za(),{deleteElements:r}=Va();return Ua(Ga,{children:[at(Ba,{asChild:!0,children:at(Oa,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:at(Fa,{size:16})})}),at(Ha,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as st}from"react/jsx-runtime";var ye=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=be(n,["edgeId","edgeType"]);var s;let a=[{component:st(it,{elementId:e,elementType:"edge"})}],i={SEQUENCE_EDGE:[{component:st(Pe,{elementId:e,elementType:"edge"})},...a],MESSAGE_EDGE:[...a],ANNOTATION_EDGE:[...a]};return st("div",y(E({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=i[t])==null?void 0:s.map((l,d)=>st("div",{children:l.component},d))}))};import{jsx as dt,jsxs as qa}from"react/jsx-runtime";var ct={type:"ANNOTATION_EDGE",zIndex:2e3},xo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,selected:s,data:l})=>{let d=Za(),{zoom:m}=$a(),f=d.find(b=>b.id===t),c=d.find(b=>b.id===o),[h,u,v]=Ka({sourceX:r,sourceY:n,targetX:a,targetY:i}),g=s||(f==null?void 0:f.selected)||(c==null?void 0:c.selected),p=1/m;return qa("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[dt(Wa,{id:e,path:h,strokeDasharray:4,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":l==null?void 0:l.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":g&&!(l!=null&&l.hasError)})}),dt(Ya,{children:dt("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${u}px, ${v}px)`},children:s&&dt(ye,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${p})`}})})})]})};import{BaseEdge as Ja,EdgeLabelRenderer as Qa,getSmoothStepPath as ei,MarkerType as Co,useNodes as ti,useReactFlow as oi,useViewport as ri}from"@xyflow/react";import{useState as ni}from"react";import{useEffect as _o,useRef as Xa,useState as ja}from"react";import{jsx as wo}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:a,style:i})=>{let s=Xa(null),[l,d]=ja(!1);_o(()=>{d(r!=null?r:!1)},[r]),_o(()=>{if(l&&s.current){s.current.focus();let h=document.createRange();h.selectNodeContents(s.current),h.collapse(!1);let u=window.getSelection();u&&(u.removeAllRanges(),u.addRange(h))}},[l]);let m=h=>{h.stopPropagation(),d(!0)},f=h=>{let u=h.currentTarget.innerText;t&&u.length>=t&&h.preventDefault()},c=h=>{d(!1),n==null||n(),o==null||o(h.currentTarget.innerText)};return wo("div",{className:_("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",a,{"border border-dashed border-grey-400":l}),style:i,onDoubleClick:m,children:wo("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:c,children:e})})};import{jsx as pt,jsxs as Io}from"react/jsx-runtime";var le={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Co.ArrowClosed},markerEnd:{type:Co.Arrow},data:{label:""}},Ao=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:m})=>{let f=ti(),{zoom:c}=ri(),{updateEdgeData:h}=oi(),[u,v]=ni(!1),g=f.find(x=>x.id===t),p=f.find(x=>x.id===o),[b,w,I]=ei({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=m||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),R=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=u||(d==null?void 0:d.label.trim().length)>0,T=1/c,S=()=>{v(!0)},C=()=>{v(!1)},k=x=>{h(e,{label:x.trim()})};return Io("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:S,children:[pt(Ja,{id:e,path:b,markerEnd:`url(#${R})`,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),pt(Qa,{children:Io("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[m&&pt(ye,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${T})`}}),N&&pt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:k})]})})]})};var So=({setEdges:e})=>{let{getNode:t}=ai();return{isValidConnection:n=>{let a=t(n.source),i=t(n.target);if((a==null?void 0:a.id)===(i==null?void 0:i.id))return!1;switch(a==null?void 0:a.type){case"START_EVENT":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"END_EVENT":return(i==null?void 0:i.type)==="ANNOTATION";case"TASK":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"GATEWAY":return(i==null?void 0:i.type)==="TASK"||(i==null?void 0:i.type)==="END_EVENT"||(i==null?void 0:i.type)==="GATEWAY"||(i==null?void 0:i.type)==="ANNOTATION";case"LANE":return(i==null?void 0:i.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(a=>{let i=t(n.target);return(i==null?void 0:i.type)==="ANNOTATION"?ko(E(E({},n),ct),a):ko(E(E({},n),le),a)})}}};import{useState as Ho}from"react";import{useTranslation as ii}from"lecom-ui";import{useReactFlow as si}from"@xyflow/react";var Re=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ge=(e=[])=>e.filter(t=>t.type==="END_EVENT"),de=(e=[])=>e.filter(t=>t.type==="TASK")||[],Lo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Do=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ut=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Po=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),q=(e,t=[])=>t.filter(o=>o.source===e),Me=(e,t=[])=>t.filter(o=>o.target===e),Ro=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(a=>a.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Mo=(e,t)=>{let o=q(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(a=>a.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Vo=e=>e?/\w/g.test(e.trim()):!1,D=e=>{let{isValid:t,nodeIds:o,edgeIds:r}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&r&&r.length>0?r:[]}},Q=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(r=>!t(r));return{isValid:o.length===0,invalidIds:o.map(r=>r.id)}},Oo=(e=[],t=[])=>({nodes:e.map(o=>{var r;return{id:o.id,type:o.type||"",label:typeof((r=o.data)==null?void 0:r.label)=="string"?o.data.label:void 0,properties:o.data}}),edges:t.map(o=>({id:o.id,source:o.source,target:o.target,type:o.type||"default"}))});var Ve=[{id:"start_event_not_found",validate:e=>{let t=Re(e.nodes);return D({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=ge(e.nodes);return D({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Re(e.nodes),o=t.length===1;if(t.length===0)return D({isValid:!0});if(!o)return D({isValid:!1,nodeIds:t.map(a=>a.id)});let r=q(t[0].id,e.edges);if(!(r.length<=1)){let a=[...t.map(i=>i.id),...r.map(i=>i.target)];return D({isValid:!1,nodeIds:[...new Set(a)]})}return D({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=de(e.nodes),o=Q(t,r=>q(r.id,e.edges).length<=2);return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=de(e.nodes),o=Q(t,r=>!!r.label&&r.label.trim()!=="");return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=de(e.nodes),r=Q(o,n=>!n.label||n.label.length<=60);return D({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=de(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let a=n.label.trim();a&&(o.has(a)||o.set(a,[]),o.get(a).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(a=>r.push(a.id));return D({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let a=q(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return D({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...Re(e.nodes),...ge(e.nodes)],o=[],r=[];for(let n of t){let a=q(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(i.id))}}return D({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=ge(e.nodes),o=[],r=[];for(let n of t){let a=Me(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.source);if(s&&s.type==="TASK"){let l=q(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return D({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Po(e.nodes),o=Q(t,n=>q(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>q(n,e.edges).map(a=>a.id));return D({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=de(e.nodes),o=Q(t,r=>!r.label||Vo(r.label));return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var i,s;if(!((i=e==null?void 0:e.nodes)!=null&&i.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return D({isValid:!0});let t=ge(e.nodes)[0];if(!t)return D({isValid:!0});let o=Me(t.id,e.edges);if(!o.length)return D({isValid:!0});let n=de(e.nodes).filter(l=>o.some(d=>d.source===l.id)),a=Q(n,l=>!Ro(l.id,e));return D({isValid:a.isValid,nodeIds:a.isValid?[]:[t.id,...a.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=de(e.nodes),o=ge(e.nodes)[0];if(!o)return D({isValid:!0});let r=t.filter(l=>{let d=Me(l.id,e.edges),m=q(l.id,e.edges),f=d.some(h=>{var u;return((u=e.nodes.find(v=>v.id===h.source))==null?void 0:u.type)==="START_EVENT"}),c=m.some(h=>{var u;return((u=e.nodes.find(v=>v.id===h.target))==null?void 0:u.type)==="END_EVENT"});return f&&c}),n=Me(o.id,e.edges),a=n.length>1,i=n.map(l=>l.source),s={isValid:r.length===0&&!a,nodeIds:[...r.map(l=>l.id),...a?i:[]]};return D(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ut(e.nodes),o=[],r=[];for(let n of t){let a=q(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(i.id))}}return D({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=ut(e.nodes),o=Q(t,r=>q(r.id,e.edges).length>=1);return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Re(e.nodes),...ge(e.nodes)],o=[],r=[];for(let n of t){let a=q(n.id,e.edges);for(let i of a){let s=e.nodes.find(l=>l.id===i.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(i.id))}}return D({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=Lo(e.nodes),o=Q(t,r=>!Mo(r.id,e));return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Do(e.nodes),o=Q(t,r=>{var n,a;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((a=r.properties)==null?void 0:a.subprocessRef)!==""});return D({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Go=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of Ve){let n=r.validate(e);n.isValid||t.push({id:r.id,message:r.id,nodeIds:n.nodeIds||[],edgeIds:n.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Bo=()=>{let{t:e}=ii(),[t,o]=Ho(null),{setNodes:r,setEdges:n,getNodes:a,getEdges:i}=si(),[s,l]=Ho(!1);return{validationResult:t,validateDiagram:c=>{let h=Oo(c.nodes,c.edges),u=Go(h),v=u.errors.map(g=>y(E({},g),{message:e(`validation.errors.${g.id}`)}));return s||l(!0),{isValid:u.isValid,errors:v}},handleValidationComplete:c=>{if(o(c),!c)return;let h=[],u=[];c.errors.forEach(N=>{N.nodeIds&&N.nodeIds.length>0&&N.nodeIds.forEach(T=>h.push(T)),N.edgeIds&&N.edgeIds.length>0&&N.edgeIds.forEach(T=>u.push(T))});let v=[...new Set(h)];r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})}))),n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:!1})})));let g=a(),p=i(),b=new Set(v),w=new Set;c.errors.forEach(N=>{var C,k;let T=Ve.find(x=>x.id===N.id);(T==null?void 0:T.highlightRelatedEdges)!==!1&&((C=N.edgeIds)==null||C.forEach(x=>w.add(x)),(k=N.nodeIds)==null||k.forEach(x=>{p.forEach(z=>{(z.source===x||z.target===x)&&w.add(z.id)})}))});let I=new Set,A=new Set,R=new Set;g.forEach(N=>{N.type==="START_EVENT"?I.add(N.id):N.type==="END_EVENT"&&A.add(N.id)}),p.forEach(N=>{I.has(N.source)&&R.add(N.target),A.has(N.target)&&R.add(N.source)}),R.forEach(N=>{var T,S;if(b.has(N)){let C=(T=c.errors.find(x=>{var z;return(z=x.nodeIds)==null?void 0:z.includes(N)}))==null?void 0:T.id;((S=Ve.find(x=>x.id===C))==null?void 0:S.highlightRelatedEdges)!==!1&&p.forEach(x=>{x.source===N&&A.has(x.target)&&(b.add(x.target),w.add(x.id)),x.target===N&&I.has(x.source)&&(b.add(x.source),w.add(x.id))})}}),b.size>0&&r(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:b.has(T.id)})}))),w.size>0&&n(N=>N.map(T=>y(E({},T),{data:y(E({},T.data),{hasError:w.has(T.id)})})))},clearValidation:()=>{o(null),l(!1),r(c=>c.map(h=>y(E({},h),{data:y(E({},h.data),{hasError:!1})}))),n(c=>c.map(h=>y(E({},h),{data:y(E({},h.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as li}from"@xyflow/react";import{useEffect as di}from"react";import{v7 as zo}from"uuid";var ci=15,Fo="bpmn:selection",Uo=({offset:e=ci}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=li();di(()=>{let a=s=>{var h;s.preventDefault();let l=t(),d=r(),m=l.filter(u=>u.selected);if(!m.length)return;let f=d.filter(u=>m.some(v=>v.id===u.source)&&m.some(v=>v.id===u.target)),c={nodes:m,edges:f};(h=s.clipboardData)==null||h.setData(Fo,JSON.stringify(c))},i=s=>{var c,h;s.preventDefault();let l=JSON.parse(((c=s.clipboardData)==null?void 0:c.getData(Fo))||"{}");if(!((h=l.nodes)!=null&&h.length))return;let d=new Map,m=l.nodes.map(u=>{let v=zo();return d.set(u.id,v),y(E({},u),{id:v,selected:!0,position:{x:u.position.x+e,y:u.position.y+e}})}),f=l.edges.map(u=>y(E({},u),{id:zo(),selected:!0,source:d.get(u.source)||u.source,target:d.get(u.target)||u.target}));o(u=>[...u.map(v=>y(E({},v),{selected:!1})),...m]),n(u=>[...u.map(v=>y(E({},v),{selected:!1})),...f])};return document.addEventListener("copy",a),document.addEventListener("paste",i),()=>{document.removeEventListener("copy",a),document.removeEventListener("paste",i)}},[t,o,r,n,e])};import{useReactFlow as yi,useStoreApi as Ti}from"@xyflow/react";import{v7 as $o}from"uuid";import{create as pi}from"zustand";var Te=pi(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as mi,EdgeLabelRenderer as ui,getSmoothStepPath as gi,MarkerType as fi,useNodes as hi,useReactFlow as bi,useViewport as Ei}from"@xyflow/react";import{useState as vi}from"react";import{jsx as gt,jsxs as Wo}from"react/jsx-runtime";var zm={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:fi.Arrow},data:{label:""}},Yo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:a,targetY:i,sourcePosition:s,targetPosition:l,data:d,selected:m})=>{let f=hi(),{zoom:c}=Ei(),{updateEdgeData:h}=bi(),[u,v]=vi(!1),g=f.find(x=>x.id===t),p=f.find(x=>x.id===o),[b,w,I]=gi({sourceX:r,sourceY:n,sourcePosition:s,targetX:a,targetY:i,targetPosition:l}),A=m||(g==null?void 0:g.selected)||(p==null?void 0:p.selected),R=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",N=u||(d==null?void 0:d.label.trim().length)>0,T=1/c,S=()=>{v(!0)},C=()=>{v(!1)},k=x=>{h(e,{label:x.trim()})};return Wo("g",{className:_("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:C,onDoubleClick:S,children:[gt(mi,{id:e,path:b,markerEnd:`url(#${R})`,strokeDasharray:4,className:_("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":d==null?void 0:d.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(d!=null&&d.hasError)})}),gt(ui,{children:Wo("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${w}px, ${I}px)`},children:[m&&gt(ye,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${T})`}}),N&&gt(U,{value:d==null?void 0:d.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:u,onChange:k})]})})]})};import{jsx as Ko,jsxs as Ni}from"react/jsx-runtime";var Zo=({fromX:e,fromY:t,toX:o,toY:r})=>Ni("g",{children:[Ko("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),Ko("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var qo=({nodes:e,setNodes:t,setEdges:o})=>{let r=Ti(),{draggableNode:n,setDraggableNode:a}=Te(),{getInternalNode:i,screenToFlowPosition:s}=yi(),l=g=>{let p="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(b=>b.map(w=>y(E({},w),{className:w.id===g?p:""})))},d=()=>{let{nodeLookup:g}=r.getState();return Array.from(g.values())},m=g=>{let p=i(g.id),b=d();if(g.type==="LANE"){if(Ne({parentId:g.id,nodes:e,includeTypes:["LANE"]})){l();return}let T=b.filter(k=>k.id!==g.id&&k.type==="LANE"&&!k.parentId),S=De(p,T);if(!S){l();return}if(Ne({parentId:S.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(S.id);return}let I=b.filter(N=>N.id!==g.id&&N.type==="LANE"),A=De(p,I);if(!A){l();return}if(Ne({parentId:A.id,nodes:e,includeTypes:["LANE"]})){l();return}l(A.id)},f=g=>{g.preventDefault(),g.dataTransfer.dropEffect="move"},c=(g,p)=>{g.preventDefault(),m(p)},h=(g,p,b)=>{var T,S;let w=C=>C.map(k=>y(E({},k),{className:void 0}));if(g.parentId===p.id){let C=ue(p.id,b);t(ae(w(C)));return}if(g.type==="LANE"){if(Ne({parentId:p.id,nodes:b,excludeTypes:["LANE"]}))return;let x=b.filter(F=>F.parentId===p.id).reduce((F,he)=>{var oe,me;return F+((me=(oe=he.measured)==null?void 0:oe.height)!=null?me:0)},0),z={x:Y.HEADER_WIDTH,y:x},K=b.map(F=>F.id===g.id?y(E({},F),{parentId:p.id,position:z,className:void 0}):y(E({},F),{className:void 0}));K=ue(p.id,K),t(ae(K));return}if(Ne({parentId:p.id,nodes:b,includeTypes:["LANE"]})){let C;if(g.parentId){let x=i(g.parentId),{x:z,y:K}=ne(x);C={x:z+((T=g.position.x)!=null?T:0),y:K+((S=g.position.y)!=null?S:0)}}let k=b.map(x=>x.id===g.id?y(E({},x),{position:C!=null?C:x.position,parentId:void 0,className:void 0}):y(E({},x),{className:void 0}));t(ae(k));return}let R=fo(g,p),N=b.map(C=>C.id===g.id?y(E({},C),{parentId:p.id,position:R,className:void 0}):y(E({},C),{className:void 0}));t(ae(N))};return{onDragOver:f,onDrop:g=>{if(g.preventDefault(),!(n!=null&&n.type))return;let p=s({x:g.clientX,y:g.clientY}),b={width:V[n.type].MIN_WIDTH,height:V[n.type].MIN_HEIGHT},w={id:$o(),type:n.type,position:p,measured:b,data:{label:"",variant:n.variant,attribute:n.attribute}},I=y(E({},w),{internals:{positionAbsolute:p}}),A=d(),R=n.type==="LANE",N=A.filter(C=>R?C.type==="LANE"&&!C.parentId:C.type==="LANE"),T=De(I,N);T?h(I,T,[...A,I]):t(C=>{let k=C.concat(w);return ae(k)});let S=g.dataTransfer.getData("sourceId");if(S){let C={id:$o(),source:S,target:w.id};if(n.type==="ANNOTATION"){o(k=>k.concat(E(E({},C),ct)));return}o(k=>k.concat(E(E({},C),le)))}a(null)},onNodeDrag:c,onNodeDragStop:async(g,p)=>{var T,S;let{nodeLookup:b}=r.getState(),w=i(p.id),I=Array.from(b.values()),A=p.type==="LANE",R=I.filter(C=>C.id!==p.id&&(A?C.type==="LANE"&&!C.parentId:C.type==="LANE")),N=De(w,R);if(N){h(w,N,I);return}if(p.parentId){let C=i(p.parentId),{x:k,y:x}=ne(C),z={x:k+((T=p.position.x)!=null?T:0),y:x+((S=p.position.y)!=null?S:0)},K=e.map(F=>F.id===p.id?y(E({},F),{position:z,parentId:void 0}):F);K=ue(p.parentId,K),t(ae(K))}}}};import{applyNodeChanges as xi}from"@xyflow/react";import{useCallback as _i,useState as jo}from"react";function Xo(e,t,o=5){var l,d,m,f,c,h,u,v;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(g=>g.id===e.id);if(!n||!e.position)return r;let a={left:e.position.x,right:e.position.x+((d=(l=n.measured)==null?void 0:l.width)!=null?d:0),top:e.position.y,bottom:e.position.y+((f=(m=n.measured)==null?void 0:m.height)!=null?f:0),width:(h=(c=n.measured)==null?void 0:c.width)!=null?h:0,height:(v=(u=n.measured)==null?void 0:u.height)!=null?v:0},i=o,s=o;return t.filter(g=>g.id!==n.id).reduce((g,p)=>{var k,x,z,K,F,he,oe,me;let b={left:p.position.x,right:p.position.x+((x=(k=p.measured)==null?void 0:k.width)!=null?x:0),top:p.position.y,bottom:p.position.y+((K=(z=p.measured)==null?void 0:z.height)!=null?K:0),width:(he=(F=p.measured)==null?void 0:F.width)!=null?he:0,height:(me=(oe=p.measured)==null?void 0:oe.height)!=null?me:0},w=Math.abs(a.left-b.left);w<s&&(g.snapPosition.x=b.left,g.vertical=b.left,s=w);let I=Math.abs(a.right-b.right);I<s&&(g.snapPosition.x=b.right-a.width,g.vertical=b.right,s=I);let A=Math.abs(a.left-b.right);A<s&&(g.snapPosition.x=b.right,g.vertical=b.right,s=A);let R=Math.abs(a.right-b.left);R<s&&(g.snapPosition.x=b.left-a.width,g.vertical=b.left,s=R);let N=Math.abs(a.top-b.top);N<i&&(g.snapPosition.y=b.top,g.horizontal=b.top,i=N);let T=Math.abs(a.bottom-b.top);T<i&&(g.snapPosition.y=b.top-a.height,g.horizontal=b.top,i=T);let S=Math.abs(a.bottom-b.bottom);S<i&&(g.snapPosition.y=b.bottom-a.height,g.horizontal=b.bottom,i=S);let C=Math.abs(a.top-b.bottom);return C<i&&(g.snapPosition.y=b.bottom,g.horizontal=b.bottom,i=C),g},r)}var Jo=()=>{let[e,t]=jo(void 0),[o,r]=jo(void 0),n=_i((a,i)=>{var s,l;if(t(void 0),r(void 0),a.length===1&&a[0].type==="position"&&a[0].dragging&&a[0].position){let d=Xo(a[0],i);a[0].position.x=(s=d.snapPosition.x)!=null?s:a[0].position.x,a[0].position.y=(l=d.snapPosition.y)!=null?l:a[0].position.y,t(d.horizontal),r(d.vertical)}return xi(a,i)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ci}from"@xyflow/react";import{v7 as rr}from"uuid";var er={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},tr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Qo=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],a=e.match(/(--.*|\|.*?\|)/i)||[],i="",s="",l="";if(o.length){switch(o[1]){case"<start>":i="start-event";break;case"<end>":i="end-event";break}e=e.replace(o[1],"")}return r.length&&(i="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(i="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),a.length&&(l=a[1].replace(/(\||--)/g,""),e=e.replace(a[1],"")),e=e.trim(),t[e]||(t[e]={type:i,label:s}),{step:e,type:i,label:s,edgeLabel:l}},wi=e=>{e=e||"";let t=e.trim().split(`
2
+ `),o={},r=[];return t.forEach(n=>{n=n||"";let a=n.trim().split("-->");if(a.length!==2){console.warn("Invalid number of steps");return}let i=Qo(a[0],o),s=Qo(a[1],o);i&&s&&r.push({sourceId:i.step,targetId:s.step,label:i.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},or=e=>{let{components:t,connections:o}=wi(e);return{nodes:t,edges:o}};var nr=()=>{let{setNodes:e,setEdges:t,fitView:o}=Ci();return{createDiagram:n=>{let{nodes:a,edges:i}=or(n),s=[],l=new Map;for(let[c,h]of Object.entries(a)){let u=rr(),v=er[h.type],g=tr[h.type];l.set(c,u);let p=V[v].MIN_WIDTH,b=V[v].MIN_HEIGHT;s.push({id:u,type:v,data:{label:h.label||"",variant:g,attribute:""},position:{x:0,y:0},width:p,height:b,measured:{width:p,height:b}})}let d=[];for(let c of i){let h=y(E({},le),{id:rr(),source:l.get(c.sourceId)||c.sourceId,target:l.get(c.targetId)||c.targetId});d.push(h)}let{nodes:m,edges:f}=Eo(s,d);e(m),t(f),o()}}};import{useEffect as Ii,useCallback as Ai}from"react";var ki={origin:"*",debug:!1};function ar(e,t=ki){let{origin:o,debug:r}=t,n=Ai((a,i)=>{r&&console.debug("[postMessage] sending:",{type:a,payload:i}),window.parent.postMessage({type:a,payload:i},o||"*")},[o,r]);return Ii(()=>{let a=i=>{let{type:s,data:l}=i.data||{};r&&console.debug("[postMessage] received:",i.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[e,r]),{sendMessage:n}}import{useReactFlow as Si}from"@xyflow/react";import{useCallback as Oe,useState as ir}from"react";import{useDebouncedCallback as Li}from"use-debounce";var Di={nodes:[],edges:[]},Pi=500,sr=10,lr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=Si(),[n,a]=ir([Di]),[i,s]=ir(0),l=n[i],d=i>0,m=i<n.length-1,f=Oe(b=>{o(n[b].nodes),r(n[b].edges)},[n,o,r]),c=Oe(()=>{if(i>0){let b=i-1;s(b),f(b)}},[i,f]),h=Oe(()=>{if(i<n.length-1){let b=i+1;s(b),f(b)}},[n,i,f]),u=b=>{let I=[...n.slice(0,i+1),b],A=I.length>sr?I.slice(I.length-sr):I;a(A),s(A.length-1)},v=Li(()=>{let b=e(),w=t(),I={nodes:b,edges:w};JSON.stringify(l)!==JSON.stringify(I)&&u(I)},Pi),g=Oe(b=>{if(b==="forceSave"){v();return}b.some(I=>I.type!=="select")&&v()},[v]),p=Oe(()=>{a([]),s(0)},[]);return{undo:c,redo:h,saveHistory:g,canUndo:d,canRedo:m,clearHistory:p}};import{jsx as dr}from"react/jsx-runtime";var Bt=({id:e,className:t})=>dr("marker",{id:e,className:_("react-flow__arrowhead",t),viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"7",markerHeight:"7",orient:"auto",markerUnits:"userSpaceOnUse",fill:"currentColor",stroke:"currentColor",children:dr("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as zt,jsxs as Ri}from"react/jsx-runtime";var cr=()=>zt("svg",{style:{position:"absolute",top:0,left:0},children:Ri("defs",{children:[zt(Bt,{id:"sequence-edge-marker",className:"text-grey-400"}),zt(Bt,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});import{useKeyPress as Ar}from"@xyflow/react";import{Button as yt,Tooltip as Tt,TooltipContent as xt,TooltipTrigger as _t,useTranslation as ks}from"lecom-ui";import{HandIcon as Ss,ListCheckIcon as Ls,MapIcon as Ds,MousePointerIcon as Ps}from"lucide-react";import{useCallback as Rs,useEffect as kr}from"react";import{useStore as Mi}from"@xyflow/react";var Vi=e=>({unselectAll:e.unselectNodesAndEdges}),ft=()=>{let{unselectAll:e}=Mi(Vi);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as ss,TooltipContent as ls,TooltipTrigger as ds,useNotificationToast as cs,useTranslation as ps}from"lecom-ui";var Ge=(p=>(p.START_EVENT="START_EVENT",p.END_EVENT="END_EVENT",p.TASK="TASK",p.SUBPROCESS="SUBPROCESS",p.GATEWAY="GATEWAY",p.ANNOTATION="ANNOTATION",p.CONNECTION="CONNECTION",p.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",p.ACTIVITY="ACTIVITY",p.PROCESS_INTERFACE="PROCESS_INTERFACE",p.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",p.VARIANT_ACTIVITY="VARIANT_ACTIVITY",p.AUTO_ACTIVITY="AUTO_ACTIVITY",p.DATA_STORE="DATA_STORE",p.DATA_OBJECT="DATA_OBJECT",p.DATA_OUTPUT="DATA_OUTPUT",p.DATA_INPUT="DATA_INPUT",p))(Ge||{});import{useReactFlow as Ji}from"@xyflow/react";import{useNotificationToast as Qi,useTranslation as es,Button as ts}from"lecom-ui";var pr=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var a;t((a=n.target)==null?void 0:a.result)},r.onerror=n=>{var a;o((a=n.target)==null?void 0:a.error)},r.readAsText(e)});function mr({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(i=>i.join(",")).join(`
3
+ `),a=encodeURI(n);ht(a,`${o}.csv`)}var ht=(e,t)=>{let o=document.createElement("a");o.setAttribute("download",t),o.setAttribute("href",e),document.body.appendChild(o),o.click(),document.body.removeChild(o)};import{v7 as Zi}from"uuid";import{xml2json as Oi,json2xml as $u}from"xml-js";var Gi={compact:!0,spaces:4},Hi=e=>e.replaceAll(`
4
+ `,"&#xA;");function ur(e,t=Gi){if(e)return JSON.parse(Oi(e,y(E({},t),{attributeValueFn:Hi})))}function gr(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}import{v7 as zi}from"uuid";var e1={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},fr={script:"SCRIPT",subprocess:"SUBPROCESS"},hr={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var xe=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:a}=r,i=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:a||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:i,height:s,measured:{width:i,height:s}}},Fi=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=V.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.START_EVENT.MIN_HEIGHT,{node:xe({cell:e,type:"START_EVENT"}),status:r,originalType:o}},Ui=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=V.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.END_EVENT.MIN_HEIGHT,{node:xe({cell:e,type:"END_EVENT"}),status:r,originalType:o}},Wi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=fr[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,V.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,V.TASK.MIN_HEIGHT),{node:xe({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},Yi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=hr[o],n=["none","inclusive","event-based"],a="imported";return n.includes(o)&&(a="adapted"),e.mxGeometry._attributes.width=V.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=V.GATEWAY.MIN_HEIGHT,{node:xe({cell:e,type:"GATEWAY",variant:r}),status:a,originalType:t}},Ki=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=ke(e.mxGeometry._attributes.width,V.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=ke(e.mxGeometry._attributes.height,V.ANNOTATION.MIN_HEIGHT),{node:xe({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},br=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=V.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=V.UNSUPPORTED.MIN_HEIGHT,{node:xe({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Er=(e,t)=>{let{source:o,target:r}=e._attributes;return y(E({},le),{id:zi(),source:t.get(o)||o,target:t.get(r)||r})},vr={TASK:Wi,GATEWAY:Yi,START_EVENT:Fi,END_EVENT:Ui,ANNOTATION:Ki};var $i=e=>{var i;let t=new Map,o=Object.values(Ge),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],a=[];for(let s of r){let l=Zi(),{type:d}=s._attributes,m=vr[d]||br;t.set((i=s._attributes)==null?void 0:i.id,l),s._attributes.id=l;let{node:f,status:c,originalType:h}=m(s);n.push(f),a.push({originalType:h,type:f.type,variant:f.data.variant,value:gr(f.data.label),status:c})}return{nodes:n,governanceIdToNodeIdMap:t,summary:a}},qi=(e,t)=>e.filter(n=>{var a;return(a=n._attributes)==null?void 0:a.edge}).map(n=>Er(n,t)),Xi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=$i(t.root.mxCell),a=qi(t.root.mxCell,r);return{nodes:o,edges:a,summary:n}},ji=async e=>{let t=await pr(e),o=ur(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},a=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),i=n==null?void 0:n.root;if(!a||!i)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},Nr=async e=>{try{let t=await ji(e),{nodes:o,edges:r,summary:n}=Xi(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};import{jsx as os}from"react/jsx-runtime";var yr=()=>{let{t:e}=es(),{toast:t}=Qi(),{setNodes:o,setEdges:r,fitView:n}=Ji(),a=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=s.map(m=>[m.originalType,m.value,e(`adapter.governance.report.status.${m.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:os(ts,{size:"small",variant:"ghost",onClick:()=>mr({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:d,summary:m}=await Nr(s);if(o(c=>c.concat(l)),r(c=>c.concat(d)),n(),m.some(c=>c.status==="unsupported")){a(m);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};import{Button as rs}from"lecom-ui";import{useRef as ns}from"react";import{Fragment as as,jsx as Tr,jsxs as is}from"react/jsx-runtime";var xr=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:a}=l,i=be(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=ns(null),m=c=>{let h=c.target.files;h!=null&&h.length&&a(h),d.current&&(d.current.value="")};return is(as,{children:[Tr(rs,y(E({onClick:c=>{var h;(h=d.current)==null||h.click(),n==null||n(c)}},i),{children:e})),Tr("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:m})]})};import{jsx as bt,jsxs as ms}from"react/jsx-runtime";var _r=({disabled:e=!1})=>{let{t}=ps(),{toast:o}=cs(),{createDiagram:r}=yr(),n=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},a=i=>{let s=i[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}r(s)};return ms(ss,{children:[bt(ds,{asChild:!0,children:bt(xr,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:a,children:bt(ao,{})})}),bt(ls,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as vs,DropdownMenu as Ns,DropdownMenuContent as ys,DropdownMenuItem as Ut,DropdownMenuTrigger as Ts,Tooltip as Et,TooltipContent as vt,TooltipTrigger as Nt,useTranslation as xs}from"lecom-ui";import{FileCodeIcon as _s,FileImageIcon as ws,FolderOutputIcon as Cs,PrinterIcon as Is}from"lucide-react";import{useState as As}from"react";import{useReactFlow as us}from"@xyflow/react";import{toPng as wr,toSvg as gs}from"html-to-image";import{toast as fs,useTranslation as hs}from"lecom-ui";import{useState as bs}from"react";var Es=3,Ft="diagram",Cr=()=>{let{t:e}=hs(),{getNodes:t}=us(),{deselectAll:o}=ft(),[r,n]=bs({png:!1,html:!1,print:!1}),a=()=>{let{x:m,y:f,width:c,height:h}=No(t());return{width:c,height:h,style:{width:`${c}px`,height:`${h}px`,transform:`translate(${-m}px, ${-f}px)`}}},i=async(m,f)=>{n(y(E({},r),{[f]:!0})),await o();try{let c=vo();if(!c)throw new Error("Flow element not found");let h=a();return await m(c,h)}catch(c){fs({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(y(E({},r),{[f]:!1}))}};return{exportAsPng:async(m=Ft)=>{await i(async(f,c)=>{let h=await wr(f,y(E({},c),{backgroundColor:"#fcfcfc"}));ht(h,`${m}.png`)},"png")},exportAsHtml:async(m=Ft)=>{await i(async(f,c)=>{let h=await gs(f,y(E({},c),{backgroundColor:"#fcfcfc"})),u=`
5
5
  <!DOCTYPE html>
6
6
  <html>
7
7
  <head>
@@ -15,7 +15,7 @@ var Un=Object.defineProperty,Wn=Object.defineProperties;var Yn=Object.getOwnProp
15
15
  <img src="${h}" alt="Diagram" />
16
16
  </body>
17
17
  </html>
18
- `,v=new Blob([u],{type:"text/html"}),g=URL.createObjectURL(v);ht(g,`${m}.html`),setTimeout(()=>URL.revokeObjectURL(g),100)},"html")},printDiagram:async(m=zt)=>{await i(async(f,c)=>{let h=await _r(f,y(E({},c),{pixelRatio:bs})),u=window.open("","_blank");if(!u)throw new Error("Failed to open print window.");let v=u.document;v.open(),v.write(`
18
+ `,v=new Blob([u],{type:"text/html"}),g=URL.createObjectURL(v);ht(g,`${m}.html`),setTimeout(()=>URL.revokeObjectURL(g),100)},"html")},printDiagram:async(m=Ft)=>{await i(async(f,c)=>{let h=await wr(f,y(E({},c),{pixelRatio:Es})),u=window.open("","_blank");if(!u)throw new Error("Failed to open print window.");let v=u.document;v.open(),v.write(`
19
19
  <!DOCTYPE html>
20
20
  <html>
21
21
  <head>
@@ -31,4 +31,4 @@ var Un=Object.defineProperty,Wn=Object.defineProperties;var Yn=Object.getOwnProp
31
31
  <img src="${h}" alt="Diagram" onload="window.print(); window.close();" />
32
32
  </body>
33
33
  </html>
34
- `),v.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as G,jsxs as _e}from"react/jsx-runtime";function Cr(){let{t:e}=Ts(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=wr(),[s,l]=Is(!1);return _e(vs,{modal:!1,open:s,onOpenChange:l,children:[G(ys,{asChild:!0,children:G("div",{children:_e(Et,{children:[G(Nt,{asChild:!0,children:G(Es,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(ws,{})})}),!s&&G(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),_e(Ns,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[_e(Et,{children:[G(Nt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:a,onClick:()=>t(),children:G(_s,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),_e(Et,{children:[G(Nt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:i,onClick:()=>o(),children:G(xs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),_e(Et,{children:[G(Nt,{asChild:!0,children:G(Ft,{className:"p-1.5",disabled:n,onClick:()=>r(),children:G(Cs,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Rs,jsx as H,jsxs as ce}from"react/jsx-runtime";var kr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=As(),{deselectAll:i}=ft(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:m,isMinimapOpen:f,setIsMinimapOpen:c}=O(),h=Ir(["v","V"]),u=Ir(["h","H"]),v=Ps(()=>{i(),m()},[i,m]),g=()=>{i();let p=n(o);r&&r(p)};return Ar(()=>{h&&!s&&!t&&d()},[h,d,s,t]),Ar(()=>{u&&!l&&!t&&v()},[u,v,l,t]),ce("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&ce(Rs,{children:[ce(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:_(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:H(Ds,{})})}),ce(xt,{color:"black",children:[a("editor.controls.actions.move_tool"),H("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),ce(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:_(l&&"bg-grey-400"),iconButton:!0,onClick:v,children:H(ks,{})})}),ce(xt,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",H("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),ce(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:g,children:H(Ss,{})})}),H(xt,{color:"black",children:a("editor.controls.actions.check")})]})]}),H(Cr,{}),!t&&H(xr,{disabled:e.length>0}),ce(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:_(f&&"bg-grey-400"),iconButton:!0,onClick:()=>c(!f),children:H(Ls,{})})}),H(xt,{color:"black",children:a(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Sr,Tooltip as Lr,TooltipContent as Dr,TooltipTrigger as Pr,useTranslation as Ms}from"lecom-ui";import{RedoIcon as Vs,UndoIcon as Os}from"lucide-react";import{jsx as pe,jsxs as Ut}from"react/jsx-runtime";var Rr=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Ms();return Ut("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Ut(Lr,{children:[pe(Pr,{asChild:!0,children:pe(Sr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:pe(Os,{})})}),pe(Dr,{color:"black",children:n("editor.controls.history.undo")})]}),Ut(Lr,{children:[pe(Pr,{asChild:!0,children:pe(Sr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:pe(Vs,{})})}),pe(Dr,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Gs}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as It,TooltipTrigger as At,useTranslation as Hs}from"lecom-ui";import{ScanIcon as Bs,ZoomIn as zs,ZoomOut as Fs}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Mr=()=>{let{t:e}=Hs(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Gs();return He("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:W(Bs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.fit")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Fs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.out")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(so,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.reset")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(zs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Sl,useReactFlow as Ll}from"@xyflow/react";import{Handle as Us}from"@xyflow/react";import{jsx as Ws}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>Ws(Us,{type:e,position:t,className:_("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Ys,useReactFlow as Ks}from"@xyflow/react";import{orderBy as Zs}from"lodash";import{jsx as $s}from"react/jsx-runtime";var we=o=>{var r=o,{nodeId:e}=r,t=be(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=Ks(),s=({width:l,height:d})=>{if(!e)return;let m=n(e);if((m==null?void 0:m.type)!=="LANE")return;let f=[...a()],c=!m.parentId,h=c?m.id:m.parentId,u=f.filter(p=>p.type==="LANE"&&p.parentId===h);if(!u.length)return;let v=Zs(u,["position.y"]),g=0;v.forEach((p,b)=>{var A,R;let w=b===v.length-1,I=(R=(A=p.measured)==null?void 0:A.height)!=null?R:0;f=f.map(N=>{if(N.id===p.id){let T=c?l-Y.HEADER_WIDTH:l,S=y(E({},N),{width:T,measured:y(E({},N.measured),{width:T}),position:y(E({},N.position),{y:g})});return w&&c&&(S.height=d-g),S}return N}),g+=I}),f=f.map(p=>{if(p.id===h){let b=c?l:l+Y.HEADER_WIDTH;return y(E({},p),{width:b,height:c?d:g,measured:{width:b,height:c?d:g}})}return p}),i(f)};return $s(Ys,E({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};import{Position as Tl,NodeToolbar as xl}from"@xyflow/react";import{Button as _l,Tooltip as wl,TooltipContent as Cl,TooltipTrigger as Il,useTranslation as Al}from"lecom-ui";import{useNodesData as qs,useReactFlow as Xs}from"@xyflow/react";import{Button as js,DropdownMenu as Js,DropdownMenuContent as Qs,DropdownMenuGroup as el,DropdownMenuItem as tl,DropdownMenuLabel as ol,DropdownMenuTrigger as rl,Tooltip as nl,TooltipContent as al,TooltipTrigger as il,useTranslation as sl}from"lecom-ui";import{WrenchIcon as ll}from"lucide-react";import{jsx as ie,jsxs as kt}from"react/jsx-runtime";var Vr=({nodeId:e})=>{let{t}=sl(),{updateNodeData:o}=Xs(),r=qs(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return kt(Js,{children:[kt(nl,{children:[ie(il,{asChild:!0,children:ie(rl,{asChild:!0,children:ie(js,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ie(ll,{})})})}),ie(al,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt(Qs,{align:"start",className:"w-60 bg-white text-grey-600",children:[ie(ol,{className:"flex items-center",children:ie("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ie(el,{children:Object.entries(Qe).map(([a,i])=>kt(tl,{className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[ie(i.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};import{useNodesData as dl,useReactFlow as cl}from"@xyflow/react";import{Button as Or,DropdownMenu as pl,DropdownMenuContent as ml,DropdownMenuGroup as ul,DropdownMenuItem as gl,DropdownMenuLabel as fl,DropdownMenuTrigger as hl,Tooltip as bl,TooltipContent as El,TooltipTrigger as vl,useTranslation as Nl}from"lecom-ui";import{WrenchIcon as yl}from"lucide-react";import{jsx as X,jsxs as Be}from"react/jsx-runtime";var Gr=({nodeId:e})=>{let{t}=Nl(),{updateNodeData:o}=cl(),r=dl(e),n=i=>{o(e,{variant:(r==null?void 0:r.data.variant)===i?"":i})},a=i=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===i?"":i})};return Be(pl,{children:[Be(bl,{children:[X(vl,{asChild:!0,children:X(hl,{asChild:!0,children:X(Or,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:X(yl,{})})})}),X(El,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(ml,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(fl,{className:"flex items-center gap-1",children:[X("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),X("div",{className:"flex items-center gap-1",children:Object.entries(Je).map(([i,s])=>X(Or,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:X(s.icon,{className:"stroke-inherit"})},i))})]}),X(ul,{children:Object.entries(je).map(([i,s])=>Be(gl,{className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[X(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};import{jsx as j,jsxs as kl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var m;let{t:n}=Al(),{setDraggableNode:a}=Te(),i=({event:f,type:c,variant:h})=>{a({type:c,variant:h}),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Se,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:Ee,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Se,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:ve,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ke,label:n("bpmn.annotation.variant.default")}},l=[{component:j(it,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(Pe,{elementId:e})},{component:j(Gr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(Pe,{elementId:e})},{component:j(Vr,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return j(xl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:Tl.Right,align:"start",isVisible:r,children:(m=d[t])==null?void 0:m.map((f,c)=>f.component?j("div",{children:f.component},c):kl(wl,{children:[j(Il,{asChild:!0,children:j(_l,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:h=>i({event:h,type:f.type,variant:f.variant}),children:f.icon&&j(f.icon,{size:16})})}),j(Cl,{color:"black",children:f.label})]},c))})};import{Fragment as Dl,jsx as ze,jsxs as Pl}from"react/jsx-runtime";var Hr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Ll(),{isMultipleSelection:a}=O(),i=s=>{n(e,{label:s})};return Pl(Dl,{children:[ze("div",{className:_("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm overflow-hidden border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:ze(U,{value:t.label,className:"m-1 text-grey-600",onChange:i})}),ze(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!a&&o}),ze(we,{isVisible:!r&&!a&&o,minWidth:ot.MIN_WIDTH,minHeight:ot.MIN_HEIGHT}),ze(B,{type:"target",position:Sl.Left})]})};import{Position as Br,useReactFlow as Rl}from"@xyflow/react";import{useState as Ml}from"react";import{Fragment as Vl,jsx as Ce,jsxs as zr}from"react/jsx-runtime";var Fr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Rl(),{isMultipleSelection:a}=O(),[i,s]=Ml(!1),l=f=>{n(e,{label:f})};return zr(Vl,{children:[zr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Ce(Ee,{className:_("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),Ce("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(U,{value:t.label,isEditing:i,onChange:l})})]}),Ce(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),Ce(B,{type:"source",position:Br.Right}),Ce(B,{type:"target",position:Br.Left})]})};import{Position as Ur,useReactFlow as Ol}from"@xyflow/react";import{useState as Gl}from"react";import{Fragment as Hl,jsx as Ie,jsxs as Wr}from"react/jsx-runtime";var Yr=({id:e,data:t,selected:o,dragging:r})=>{let n=Qe[t.variant].icon,{updateNodeData:a}=Ol(),{isMultipleSelection:i}=O(),[s,l]=Gl(!1),d=c=>{a(e,{label:c})};return Wr(Hl,{children:[Wr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ie(n,{className:_("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),Ie("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ie(U,{value:t.label,isEditing:s,onChange:d})})]}),Ie(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),Ie(B,{type:"target",position:Ur.Left}),Ie(B,{type:"source",position:Ur.Right})]})};import{Position as Bl,useReactFlow as zl}from"@xyflow/react";import{useState as Fl}from"react";import{Fragment as Ul,jsx as Fe,jsxs as Kr}from"react/jsx-runtime";var Zr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=zl(),{isMultipleSelection:a}=O(),[i,s]=Fl(!1),l=f=>{n(e,{label:f})};return Kr(Ul,{children:[Kr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(qe,{className:_("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),Fe("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Fe(U,{value:t.label,isEditing:i,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),Fe(B,{type:"source",position:Bl.Right})]})};import{Position as $r,useReactFlow as Wl}from"@xyflow/react";import{Fragment as Yl,jsx as ee,jsxs as qr}from"react/jsx-runtime";var Xr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Wl(),{isMultipleSelection:a}=O(),i=c=>{n(e,{label:c})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,d=t.variant==="SUBPROCESS",m=s&&!d,f=l||d;return qr(Yl,{children:[qr("div",{className:_("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md overflow-hidden hover:shadow-md transition-colors duration-75",{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[ee(U,{value:t.label,className:_("m-1",{"py-6":m||f}),onChange:i}),s&&ee("div",{className:_("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:_(t.hasError?"text-red-500":"text-grey-500")})}),l&&ee("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:ee("div",{className:_("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:ee(l,{size:16,className:_(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),ee(we,{isVisible:!r&&!a&&o,minWidth:et.MIN_WIDTH,minHeight:et.MIN_HEIGHT}),ee(B,{type:"source",position:$r.Right}),ee(B,{type:"target",position:$r.Left})]})};import{Position as jr}from"@xyflow/react";import{Fragment as Kl,jsx as St,jsxs as Zl}from"react/jsx-runtime";var Jr=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=O();return Zl(Kl,{children:[St("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),St(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),St(B,{type:"source",position:jr.Right}),St(B,{type:"target",position:jr.Left})]})};import{Position as $l,useReactFlow as ql}from"@xyflow/react";import{orderBy as Xl}from"lodash";import{useMemo as Qr}from"react";import{Fragment as jl,jsx as fe,jsxs as en}from"react/jsx-runtime";var tn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=ql(),{isMultipleSelection:s}=O(),l=i(),d=!n,m=Qr(()=>Xl([...l.filter(u=>u.parentId===e&&u.type==="LANE")],"position.y","asc"),[l,e]),f=d?tt.MIN_WIDTH:Y.MIN_WIDTH,c=Qr(()=>{if(d&&m.length>1){let u=[...m];return u.pop(),u.reduce((g,p)=>{var b,w;return g+((w=(b=p.measured)==null?void 0:b.height)!=null?w:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,m]),h=u=>{a(e,{label:u})};return en(jl,{children:[en("div",{className:_("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[fe("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:fe("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:fe(U,{value:t.label,className:"w-full h-full",onChange:h})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),fe(we,{nodeId:e,minWidth:f,minHeight:c,isVisible:!r&&!s&&o}),d&&fe(B,{type:"source",position:$l.Right})]})};var on={START_EVENT:Zr,END_EVENT:Fr,TASK:Xr,GATEWAY:Yr,ANNOTATION:Hr,LANE:tn,UNSUPPORTED:Jr},rn={SEQUENCE_EDGE:Io,MESSAGE_EDGE:Wo,ANNOTATION_EDGE:To},nn="#fafafa",an="#bebebe",sn=1,ln=10,dn="bottom-left",cn=.5,pn=4,mn={x:0,y:0,zoom:.75};import{useStore as Jl}from"@xyflow/react";import{useEffect as Ql,useRef as ed}from"react";import{jsx as od}from"react/jsx-runtime";var td=e=>({width:e.width,height:e.height,transform:e.transform}),un=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=Jl(td),s=ed(null);return Ql(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let m=window.devicePixelRatio;l.width=n*m,l.height=a*m,d.scale(m,m),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),od("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as gn,Dialog as rd,DialogContent as nd,DialogFooter as ad,DialogHeader as id,DialogTitle as sd,Notification as ld,Typography as Wt,useTranslation as dd}from"lecom-ui";import{jsx as te,jsxs as Yt}from"react/jsx-runtime";var fn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=dd(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(m=>m.filter(f=>!l.some(c=>c.id===f.id))),d!=null&&d.length&&r(m=>m.filter(f=>!d.some(c=>c.id===f.id))),t(null)},s=()=>{t(null)};return te(rd,{open:a,onOpenChange:s,children:Yt(nd,{className:"w-[488px] max-w-fit gap-2",children:[te(id,{children:te(sd,{children:te(Wt,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),Yt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(ld,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te(Wt,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),Yt(ad,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(gn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te(Wt,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(gn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as cd,Tooltip as pd,TooltipContent as md,TooltipTrigger as ud,useTranslation as gd}from"lecom-ui";import{jsx as Ue,jsxs as fd}from"react/jsx-runtime";var hn=()=>{let{t:e}=gd(),{setDraggableNode:t}=Te(),o=[{type:"START_EVENT",icon:qe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Ee,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Se,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:uo,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:mo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:po,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:ve,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:$e,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Ze,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:io,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ke,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return Ue("aside",{className:"sidebar absolute z-[1] top-4 left-4 grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:o.map((n,a)=>fd(pd,{children:[Ue(ud,{asChild:!0,children:Ue(cd,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:Ue(n.icon,{})},a)}),Ue(md,{color:"black",side:"right",children:n.label})]},a))})};import{Button as hd,useTranslation as bd}from"lecom-ui";import{AlertCircleIcon as Ed,CircleCheckIcon as vd,XIcon as Nd}from"lucide-react";import{useEffect as yd,useState as Td}from"react";import{jsx as J,jsxs as Kt}from"react/jsx-runtime";var bn=({validationResult:e,onClose:t})=>{let{t:o}=bd(),[r,n]=Td(!1);if(yd(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return Kt("div",{className:_("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[Kt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:a?J(vd,{className:"text-green-500 size-5"}):J(Ed,{className:"text-red-500 size-5"})}),Kt("div",{className:"body-medium-500 text-grey-800",children:[J("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&J("div",{children:o("validation.errors.subtitle")})]}),J(hd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(Nd,{})})]}),J("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?J("p",{children:o("validation.success.message")}):J("div",{className:"list-disc list-inside",children:i.map(s=>J("li",{className:"mb-1",children:s.message},s.id))})})]})};import{jsx as $,jsxs as Zt}from"react/jsx-runtime";var Hd=[],Bd=({mode:e="edit"})=>{let t=Vd(!1),[o,r]=Dd([]),[n,a]=Ld([]),[i,s]=Od(null),{isMoveTool:l,isHandTool:d,isReadOnly:m,setIsReadOnly:f,setIsMultipleSelection:c,isMinimapOpen:h}=O(),{validationResult:u,handleValidationComplete:v,clearValidation:g,isAutoValidationEnabled:p,validateDiagram:b}=Ho(),{getNode:w,getEdges:I,getNodes:A}=Rd(),{onNodeSelected:R,onEdgeSelected:N}=rt(),{onNodeDrag:T,onDrop:S,onDragOver:C,onNodeDragStop:k}=$o({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:x,onConnect:z}=ko({setEdges:a});Fo();let{createDiagram:K}=rr(),{undo:F,redo:he,saveHistory:oe,canUndo:me,canRedo:Cn}=sr(),{helperLineHorizontal:In,helperLineVertical:An,customApplyNodeChanges:kn}=jo();nr({LIA_CREATE_DIAGRAM:K,CLEAR_DIAGRAM:()=>{r([]),a([])}}),En(()=>{f(e==="readonly")},[e,f]);let Sn=()=>{g()},Xt=Lt(M=>{let L=A(),se=I(),re=wd(M,L,se),Bn=Cd(M,L,se),zn=re.some(Dt=>Dt.type==="START_EVENT"),Fn=Bn.some(Dt=>Dt.type==="END_EVENT");return zn?"start":Fn?"end":"between"},[A,I]),Ln=Lt(({nodes:M,edges:L})=>{let se=M.length+L.length>1;if(c(se),M.length===1&&L.length===0){let re=M[0];R==null||R({id:re.id,type:"activity",variant:Xt(re)})}else if(L.length===1&&M.length===0){let re=L[0];N==null||N({id:re.id,type:"routing"})}},[c,R,N,Xt]);Pd({onChange:Ln});let Dn=M=>{let L=w(M.id);if(L!=null&&L.parentId&&(L==null?void 0:L.type)==="LANE"){let se=ue(L.parentId,o.filter(re=>re.id!==L.id&&re.type==="LANE"));r(ae(se))}},Pn=M=>{M.forEach(L=>{switch(L.type){case"remove":Dn(L);break}})},Rn=Lt(()=>{if(!p){t.current=!1;return}let M=A(),L=I(),se=b({nodes:M,edges:L});v(se),t.current=!1},[p,A,I,b,v]),jt=Gd(Rn,300),Jt=Lt(()=>{p&&!t.current&&(t.current=!0,jt())},[p,jt]),Mn=M=>{r(L=>kn(M,L)),oe(M),Jt(),Pn(M)},Vn=M=>{a(L=>xd(M,L)),oe(M),Jt()},On=()=>{oe("forceSave")},Gn=async({nodes:M,edges:L})=>(s({nodes:M,edges:L}),!1),Hn={nodes:o,edges:n};return Zt("div",{className:"w-full h-full",children:[!m&&$(hn,{}),$(dr,{}),Zt(Ad,{edges:n,nodes:o,nodeTypes:on,edgeTypes:rn,minZoom:cn,maxZoom:pn,panOnDrag:d||m?!0:Hd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!m&&l,nodesConnectable:!m&&l,nodesDraggable:!m&&l,isValidConnection:x,connectionLineComponent:Ko,onConnect:z,onDrop:S,onDropCapture:On,onDragOver:C,onNodesChange:Mn,onEdgesChange:Vn,onNodeDrag:T,onNodeDragStop:k,onBeforeDelete:Gn,selectionMode:Sd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:mn,connectOnClick:!1,children:[h&&$(Id,{pannable:!0,zoomable:!0,position:dn,className:"shadow-md rounded-md"}),Zt("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!m&&$(Rr,{canUndo:me,canRedo:Cn,undo:F,redo:he}),$(kr,{nodes:o,isReadOnly:m,diagram:Hn,onValidationComplete:v,onValidateDiagram:b}),$(Mr,{})]}),$(un,{horizontal:In,vertical:An}),$(_d,{gap:ln,size:sn,color:an,bgColor:nn}),u&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(bn,{validationResult:u,onClose:Sn})})]}),$(fn,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},zd=({mode:e,locale:t="pt_BR",onConfigureElement:o,onNodeSelected:r,onEdgeSelected:n})=>(En(()=>{t&&Md.changeLanguage(t)},[t]),$(kd,{children:$(yo,{value:{onConfigureElement:o,onNodeSelected:r,onEdgeSelected:n},children:$(Bd,{mode:e})})})),$t=zd;var qt=e=>{if(typeof document=="undefined")return;let t=document.cookie.match(new RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0};import{initializeI18n as Fd,Translations as Ud}from"lecom-ui";var vn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing"},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Unsupported element"}}},adapter:{governance:{error:{DEFAULT:"Error importing diagram",NO_FILE:"No file selected",EMPTY_FILE:"Empty file",INVALID_FILE:"Invalid file",CONTAIN_NO_CELLS:"No cells found to be imported",ALREADY_INITIALIZED:"It is not possible to import the diagram from the Governance platform, since the diagram has already been initialized"},success:{default:"The diagram was imported from the Governance platform successfully and without any incompatibility detected.",incompatible_cells:"The diagram was imported from the Governance platform with incompatibilities. To know more details, click on the button below."},report:{columns:{type:"Type",value:"Value",status:"Status"},status:{imported:"Imported",adapted:"Adapted",unsupported:"Unsupported"}},action:{download:"Download report"}}}}};var Nn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento"},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento no soportado"}}},adapter:{governance:{error:{DEFAULT:"Error al importar diagrama",NO_FILE:"No se ha seleccionado ning\xFAn archivo",EMPTY_FILE:"Archivo vac\xEDo",INVALID_FILE:"Archivo inv\xE1lido",CONTAIN_NO_CELLS:"No se encontraron c\xE9lulas para importar",ALREADY_INITIALIZED:"No es posible importar el diagrama de la plataforma Governance, ya que el diagrama ya ha sido iniciado"},success:{default:"El diagrama se ha importado de la plataforma Governance correctamente y sin ninguna incompatibilidad detectada.",incompatible_cells:"El diagrama se ha importado de la plataforma Governance con incompatibilidades. Para saber m\xE1s detalles, haz click en el bot\xF3n de abajo."},report:{columns:{type:"Tipo",value:"Valor",status:"Estado"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"No soportado"}},action:{download:"Descargar informe"}}}}};var yn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento"},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de tarefa"},variant:{default:"Tarefa",script:"Tarefa de script",subprocess:"Subprocesso"},attribute:{loop:"Tarefa com loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento n\xE3o suportado"}}},adapter:{governance:{error:{DEFAULT:"Erro ao importar diagrama",NO_FILE:"Nenhum arquivo selecionado",EMPTY_FILE:"Arquivo vazio",INVALID_FILE:"Arquivo inv\xE1lido",CONTAIN_NO_CELLS:"N\xE3o foram encontradas c\xE9lulas para serem importadas",ALREADY_INITIALIZED:"N\xE3o \xE9 poss\xEDvel importar o diagrama da plataforma Governance, pois o diagrama j\xE1 foi iniciado"},success:{default:"O diagrama foi importado da plataforma Governance com sucesso e sem nenhuma incompatibilidade detectada.",incompatible_cells:"O diagrama foi importado da plataforma Governance com incompatibilidades. Para saber mais detalhes, clique no bot\xE3o abaixo."},report:{columns:{type:"Tipo do elemento",value:"Valor",status:"Status"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"N\xE3o suportado"}},action:{download:"Baixar relat\xF3rio"}}}}};var Tn={pt_BR:yn,en_US:vn,es_ES:Nn};var xn,_n,Wd=(_n=(xn=qt("LecomUserLanguage"))!=null?xn:qt("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?_n:Ud.PT_BR;Fd({lng:Wd,resources:Tn});import{jsx as wn}from"react/jsx-runtime";var qh=e=>wn(oo,{children:wn($t,E({},e))});export{qh as Modeler};
34
+ `),v.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as G,jsxs as _e}from"react/jsx-runtime";function Ir(){let{t:e}=xs(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:a,isPrintingHtml:i}=Cr(),[s,l]=As(!1);return _e(Ns,{modal:!1,open:s,onOpenChange:l,children:[G(Ts,{asChild:!0,children:G("div",{children:_e(Et,{children:[G(Nt,{asChild:!0,children:G(vs,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:G(Cs,{})})}),!s&&G(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),_e(ys,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[_e(Et,{children:[G(Nt,{asChild:!0,children:G(Ut,{className:"p-1.5",disabled:a,onClick:()=>t(),children:G(ws,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),_e(Et,{children:[G(Nt,{asChild:!0,children:G(Ut,{className:"p-1.5",disabled:i,onClick:()=>o(),children:G(_s,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),_e(Et,{children:[G(Nt,{asChild:!0,children:G(Ut,{className:"p-1.5",disabled:n,onClick:()=>r(),children:G(Is,{})})}),G(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Ms,jsx as H,jsxs as ce}from"react/jsx-runtime";var Sr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:a}=ks(),{deselectAll:i}=ft(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:m,isMinimapOpen:f,setIsMinimapOpen:c}=O(),h=Ar(["v","V"]),u=Ar(["h","H"]),v=Rs(()=>{i(),m()},[i,m]),g=()=>{i();let p=n(o);r&&r(p)};return kr(()=>{h&&!s&&!t&&d()},[h,d,s,t]),kr(()=>{u&&!l&&!t&&v()},[u,v,l,t]),ce("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&ce(Ms,{children:[ce(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:_(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:H(Ps,{})})}),ce(xt,{color:"black",children:[a("editor.controls.actions.move_tool"),H("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),ce(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:_(l&&"bg-grey-400"),iconButton:!0,onClick:v,children:H(Ss,{})})}),ce(xt,{color:"black",children:[a("editor.controls.actions.hand_tool")," ",H("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),ce(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:g,children:H(Ls,{})})}),H(xt,{color:"black",children:a("editor.controls.actions.check")})]})]}),H(Ir,{}),!t&&H(_r,{disabled:e.length>0}),ce(Tt,{children:[H(_t,{asChild:!0,children:H(yt,{size:"small",variant:"ghost",color:"grey",className:_(f&&"bg-grey-400"),iconButton:!0,onClick:()=>c(!f),children:H(Ds,{})})}),H(xt,{color:"black",children:a(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Lr,Tooltip as Dr,TooltipContent as Pr,TooltipTrigger as Rr,useTranslation as Vs}from"lecom-ui";import{RedoIcon as Os,UndoIcon as Gs}from"lucide-react";import{jsx as pe,jsxs as Wt}from"react/jsx-runtime";var Mr=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Vs();return Wt("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Wt(Dr,{children:[pe(Rr,{asChild:!0,children:pe(Lr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:pe(Gs,{})})}),pe(Pr,{color:"black",children:n("editor.controls.history.undo")})]}),Wt(Dr,{children:[pe(Rr,{asChild:!0,children:pe(Lr,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:pe(Os,{})})}),pe(Pr,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as Hs}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as It,TooltipTrigger as At,useTranslation as Bs}from"lecom-ui";import{ScanIcon as zs,ZoomIn as Fs,ZoomOut as Us}from"lucide-react";import{jsx as W,jsxs as He}from"react/jsx-runtime";var Vr=()=>{let{t:e}=Bs(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=Hs();return He("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:W(zs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.fit")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Us,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.out")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(lo,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.reset")})]}),He(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(Fs,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Ll,useReactFlow as Dl}from"@xyflow/react";import{Handle as Ws}from"@xyflow/react";import{jsx as Ys}from"react/jsx-runtime";var B=({type:e,position:t,className:o})=>Ys(Ws,{type:e,position:t,className:_("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as Ks,useReactFlow as Zs}from"@xyflow/react";import{orderBy as $s}from"lodash";import{jsx as qs}from"react/jsx-runtime";var we=o=>{var r=o,{nodeId:e}=r,t=be(r,["nodeId"]);let{getNode:n,getNodes:a,setNodes:i}=Zs(),s=({width:l,height:d})=>{if(!e)return;let m=n(e);if((m==null?void 0:m.type)!=="LANE")return;let f=[...a()],c=!m.parentId,h=c?m.id:m.parentId,u=f.filter(p=>p.type==="LANE"&&p.parentId===h);if(!u.length)return;let v=$s(u,["position.y"]),g=0;v.forEach((p,b)=>{var A,R;let w=b===v.length-1,I=(R=(A=p.measured)==null?void 0:A.height)!=null?R:0;f=f.map(N=>{if(N.id===p.id){let T=c?l-Y.HEADER_WIDTH:l,S=y(E({},N),{width:T,measured:y(E({},N.measured),{width:T}),position:y(E({},N.position),{y:g})});return w&&c&&(S.height=d-g),S}return N}),g+=I}),f=f.map(p=>{if(p.id===h){let b=c?l:l+Y.HEADER_WIDTH;return y(E({},p),{width:b,height:c?d:g,measured:{width:b,height:c?d:g}})}return p}),i(f)};return qs(Ks,E({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};import{Position as xl,NodeToolbar as _l}from"@xyflow/react";import{Button as wl,Tooltip as Cl,TooltipContent as Il,TooltipTrigger as Al,useTranslation as kl}from"lecom-ui";import{useNodesData as Xs,useReactFlow as js}from"@xyflow/react";import{Button as Js,DropdownMenu as Qs,DropdownMenuContent as el,DropdownMenuGroup as tl,DropdownMenuItem as ol,DropdownMenuLabel as rl,DropdownMenuTrigger as nl,Tooltip as al,TooltipContent as il,TooltipTrigger as sl,useTranslation as ll}from"lecom-ui";import{WrenchIcon as dl}from"lucide-react";import{jsx as ie,jsxs as kt}from"react/jsx-runtime";var Or=({nodeId:e})=>{let{t}=ll(),{updateNodeData:o}=js(),r=Xs(e),n=a=>{(r==null?void 0:r.data.variant)!==a&&o(e,{variant:a})};return kt(Qs,{children:[kt(al,{children:[ie(sl,{asChild:!0,children:ie(nl,{asChild:!0,children:ie(Js,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ie(dl,{})})})}),ie(il,{color:"black",children:t("bpmn.gateway.menu.title")})]}),kt(el,{align:"start",className:"w-60 bg-white text-grey-600",children:[ie(rl,{className:"flex items-center",children:ie("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ie(tl,{children:Object.entries(Qe).map(([a,i])=>kt(ol,{className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[ie(i.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${a.toLowerCase()}`)]},a))})]})]})};import{useNodesData as cl,useReactFlow as pl}from"@xyflow/react";import{Button as Gr,DropdownMenu as ml,DropdownMenuContent as ul,DropdownMenuGroup as gl,DropdownMenuItem as fl,DropdownMenuLabel as hl,DropdownMenuTrigger as bl,Tooltip as El,TooltipContent as vl,TooltipTrigger as Nl,useTranslation as yl}from"lecom-ui";import{WrenchIcon as Tl}from"lucide-react";import{jsx as X,jsxs as Be}from"react/jsx-runtime";var Hr=({nodeId:e})=>{let{t}=yl(),{updateNodeData:o}=pl(),r=cl(e),n=i=>{o(e,{variant:(r==null?void 0:r.data.variant)===i?"":i})},a=i=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===i?"":i})};return Be(ml,{children:[Be(El,{children:[X(Nl,{asChild:!0,children:X(bl,{asChild:!0,children:X(Gr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:X(Tl,{})})})}),X(vl,{color:"black",children:t("bpmn.task.menu.title")})]}),Be(ul,{align:"start",className:"w-60 bg-white text-grey-600",children:[Be(hl,{className:"flex items-center gap-1",children:[X("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),X("div",{className:"flex items-center gap-1",children:Object.entries(Je).map(([i,s])=>X(Gr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===i}),onClick:()=>a(i),children:X(s.icon,{className:"stroke-inherit"})},i))})]}),X(gl,{children:Object.entries(je).map(([i,s])=>Be(fl,{className:_({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[X(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${i.toLowerCase()}`)]},i))})]})]})};import{jsx as j,jsxs as Sl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var m;let{t:n}=kl(),{setDraggableNode:a}=Te(),i=({event:f,type:c,variant:h})=>{a({type:c,variant:h}),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Se,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:Ee,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Se,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:ve,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ke,label:n("bpmn.annotation.variant.default")}},l=[{component:j(it,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(Pe,{elementId:e})},{component:j(Hr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(Pe,{elementId:e})},{component:j(Or,{nodeId:e})},s.TASK,s.GATEWAY,s.ANNOTATION,...l],END_EVENT:[s.ANNOTATION,...l],LANE:[...o?[]:[s.ANNOTATION],...l],ANNOTATION:[...l],UNSUPPORTED:[...l]};return j(_l,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:xl.Right,align:"start",isVisible:r,children:(m=d[t])==null?void 0:m.map((f,c)=>f.component?j("div",{children:f.component},c):Sl(Cl,{children:[j(Al,{asChild:!0,children:j(wl,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:h=>i({event:h,type:f.type,variant:f.variant}),children:f.icon&&j(f.icon,{size:16})})}),j(Il,{color:"black",children:f.label})]},c))})};import{Fragment as Pl,jsx as ze,jsxs as Rl}from"react/jsx-runtime";var Br=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Dl(),{isMultipleSelection:a}=O(),i=s=>{n(e,{label:s})};return Rl(Pl,{children:[ze("div",{className:_("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm overflow-hidden border-l-2 border-current before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-current after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-current hover:shadow-md transition-colors duration-75",{"text-blue-500 hover:text-blue-600 shadow-md":o,"border-red-500 border-l-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)] before:absolute before:top-0 before:left-0 before:w-4 before:border-t-2 before:border-red-500 after:absolute after:bottom-0 after:left-0 after:w-4 after:border-t-2 after:border-red-500":t.hasError}),children:ze(U,{value:t.label,className:"m-1 text-grey-600",onChange:i})}),ze(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!a&&o}),ze(we,{isVisible:!r&&!a&&o,minWidth:ot.MIN_WIDTH,minHeight:ot.MIN_HEIGHT}),ze(B,{type:"target",position:Ll.Left})]})};import{Position as zr,useReactFlow as Ml}from"@xyflow/react";import{useState as Vl}from"react";import{Fragment as Ol,jsx as Ce,jsxs as Fr}from"react/jsx-runtime";var Ur=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Ml(),{isMultipleSelection:a}=O(),[i,s]=Vl(!1),l=f=>{n(e,{label:f})};return Fr(Ol,{children:[Fr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Ce(Ee,{className:_("size-9 hover:stroke-[#d33b3b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),Ce("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(U,{value:t.label,isEditing:i,onChange:l})})]}),Ce(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!a&&o}),Ce(B,{type:"source",position:zr.Right}),Ce(B,{type:"target",position:zr.Left})]})};import{Position as Wr,useReactFlow as Gl}from"@xyflow/react";import{useState as Hl}from"react";import{Fragment as Bl,jsx as Ie,jsxs as Yr}from"react/jsx-runtime";var Kr=({id:e,data:t,selected:o,dragging:r})=>{let n=Qe[t.variant].icon,{updateNodeData:a}=Gl(),{isMultipleSelection:i}=O(),[s,l]=Hl(!1),d=c=>{a(e,{label:c})};return Yr(Bl,{children:[Yr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ie(n,{className:_("size-14 stroke-1 stroke-grey-400 hover:stroke-grey-500 transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)]":t.hasError})}),Ie("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ie(U,{value:t.label,isEditing:s,onChange:d})})]}),Ie(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!i&&o}),Ie(B,{type:"target",position:Wr.Left}),Ie(B,{type:"source",position:Wr.Right})]})};import{Position as zl,useReactFlow as Fl}from"@xyflow/react";import{useState as Ul}from"react";import{Fragment as Wl,jsx as Fe,jsxs as Zr}from"react/jsx-runtime";var $r=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Fl(),{isMultipleSelection:a}=O(),[i,s]=Ul(!1),l=f=>{n(e,{label:f})};return Zr(Wl,{children:[Zr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(qe,{className:_("size-9 hover:stroke-[#54890b] transition-colors duration-75",{"stroke-blue-500 hover:stroke-blue-600":o,"stroke-red-500 hover:stroke-red-600 drop-shadow-[0_0_3px_rgba(255,0,0,0.5)] fill-red-100":t.hasError})}),Fe("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Fe(U,{value:t.label,isEditing:i,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!a&&o}),Fe(B,{type:"source",position:zl.Right})]})};import{Position as qr,useReactFlow as Yl}from"@xyflow/react";import{Fragment as Kl,jsx as ee,jsxs as Xr}from"react/jsx-runtime";var jr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Yl(),{isMultipleSelection:a}=O(),i=c=>{n(e,{label:c})},s=t.variant?je[t.variant].icon:null,l=t.attribute?Je[t.attribute].icon:null,d=t.variant==="SUBPROCESS",m=s&&!d,f=l||d;return Xr(Kl,{children:[Xr("div",{className:_("relative w-full h-full min-w-44 min-h-24 flex items-center justify-center bg-white border-2 border-grey-400 hover:border-grey-500 rounded-md overflow-hidden hover:shadow-md transition-colors duration-75",{"border-blue-500 hover:border-blue-600 shadow-md":o,"border-red-500 hover:border-red-600 shadow-[0_0_5px_rgba(255,0,0,0.5)]":t.hasError}),children:[ee(U,{value:t.label,className:_("m-1",{"py-6":m||f}),onChange:i}),s&&ee("div",{className:_("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:_(t.hasError?"text-red-500":"text-grey-500")})}),l&&ee("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:ee("div",{className:_("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:ee(l,{size:16,className:_(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!a&&o}),ee(we,{isVisible:!r&&!a&&o,minWidth:et.MIN_WIDTH,minHeight:et.MIN_HEIGHT}),ee(B,{type:"source",position:qr.Right}),ee(B,{type:"target",position:qr.Left})]})};import{Position as Jr}from"@xyflow/react";import{Fragment as Zl,jsx as St,jsxs as $l}from"react/jsx-runtime";var Qr=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=O();return $l(Zl,{children:[St("div",{className:"relative w-full h-full min-w-32 min-h-16 flex items-center justify-center bg-white border-2 border-red-400 rounded-sm overflow-hidden",children:t.label}),St(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),St(B,{type:"source",position:Jr.Right}),St(B,{type:"target",position:Jr.Left})]})};import{Position as ql,useReactFlow as Xl}from"@xyflow/react";import{orderBy as jl}from"lodash";import{useMemo as en}from"react";import{Fragment as Jl,jsx as fe,jsxs as tn}from"react/jsx-runtime";var on=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:a,getNodes:i}=Xl(),{isMultipleSelection:s}=O(),l=i(),d=!n,m=en(()=>jl([...l.filter(u=>u.parentId===e&&u.type==="LANE")],"position.y","asc"),[l,e]),f=d?tt.MIN_WIDTH:Y.MIN_WIDTH,c=en(()=>{if(d&&m.length>1){let u=[...m];return u.pop(),u.reduce((g,p)=>{var b,w;return g+((w=(b=p.measured)==null?void 0:b.height)!=null?w:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,m]),h=u=>{a(e,{label:u})};return tn(Jl,{children:[tn("div",{className:_("flex h-full min-h-64 w-full min-w-[50rem] hover:shadow-md bg-white outline outline-2 outline-grey-400",{"outline-offset-2 outline-blue-500 shadow-sm":o}),children:[fe("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:fe("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:fe(U,{value:t.label,className:"w-full h-full",onChange:h})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),fe(we,{nodeId:e,minWidth:f,minHeight:c,isVisible:!r&&!s&&o}),d&&fe(B,{type:"source",position:ql.Right})]})};var rn={START_EVENT:$r,END_EVENT:Ur,TASK:jr,GATEWAY:Kr,ANNOTATION:Br,LANE:on,UNSUPPORTED:Qr},nn={SEQUENCE_EDGE:Ao,MESSAGE_EDGE:Yo,ANNOTATION_EDGE:xo},an="#fafafa",sn="#bebebe",ln=1,dn=10,cn="bottom-left",pn=.5,mn=4,un={x:0,y:0,zoom:.75};import{useStore as Ql}from"@xyflow/react";import{useEffect as ed,useRef as td}from"react";import{jsx as rd}from"react/jsx-runtime";var od=e=>({width:e.width,height:e.height,transform:e.transform}),gn=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:a,transform:i}=Ql(od),s=td(null);return ed(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let m=window.devicePixelRatio;l.width=n*m,l.height=a*m,d.scale(m,m),d.clearRect(0,0,n,a),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*i[2]+i[0],0),d.lineTo(t*i[2]+i[0],a),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*i[2]+i[1]),d.lineTo(n,e*i[2]+i[1]),d.stroke())},[n,a,i,e,t,o,r]),rd("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as fn,Dialog as nd,DialogContent as ad,DialogFooter as id,DialogHeader as sd,DialogTitle as ld,Notification as dd,Typography as Yt,useTranslation as cd}from"lecom-ui";import{jsx as te,jsxs as Kt}from"react/jsx-runtime";var hn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=cd(),a=!!e,i=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(m=>m.filter(f=>!l.some(c=>c.id===f.id))),d!=null&&d.length&&r(m=>m.filter(f=>!d.some(c=>c.id===f.id))),t(null)},s=()=>{t(null)};return te(nd,{open:a,onOpenChange:s,children:Kt(ad,{className:"w-[488px] max-w-fit gap-2",children:[te(sd,{children:te(ld,{children:te(Yt,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),Kt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(dd,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te(Yt,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),Kt(id,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(fn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te(Yt,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(fn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:i,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as pd,Tooltip as md,TooltipContent as ud,TooltipTrigger as gd,useTranslation as fd}from"lecom-ui";import{jsx as Ue,jsxs as hd}from"react/jsx-runtime";var bn=()=>{let{t:e}=fd(),{setDraggableNode:t}=Te(),o=[{type:"START_EVENT",icon:qe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Ee,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Se,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:go,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:uo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:mo,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:ve,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:$e,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Ze,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:so,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ke,label:e("bpmn.annotation.variant.default")}],r=(n,a)=>{t({type:a.type,variant:a.variant,attribute:a.attribute}),n.dataTransfer.effectAllowed="move"};return Ue("aside",{className:"sidebar absolute z-[1] top-4 left-4 grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:o.map((n,a)=>hd(md,{children:[Ue(gd,{asChild:!0,children:Ue(pd,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:i=>r(i,n),children:Ue(n.icon,{})},a)}),Ue(ud,{color:"black",side:"right",children:n.label})]},a))})};import{Button as bd,useTranslation as Ed}from"lecom-ui";import{AlertCircleIcon as vd,CircleCheckIcon as Nd,XIcon as yd}from"lucide-react";import{useEffect as Td,useState as xd}from"react";import{jsx as J,jsxs as Zt}from"react/jsx-runtime";var En=({validationResult:e,onClose:t})=>{let{t:o}=Ed(),[r,n]=xd(!1);if(Td(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:a,errors:i}=e;return Zt("div",{className:_("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":a,"bg-red-100":!a}),children:[Zt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:a?J(Nd,{className:"text-green-500 size-5"}):J(vd,{className:"text-red-500 size-5"})}),Zt("div",{className:"body-medium-500 text-grey-800",children:[J("div",{children:o(a?"validation.success.title":"validation.errors.title")}),!a&&J("div",{children:o("validation.errors.subtitle")})]}),J(bd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(yd,{})})]}),J("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:a?J("p",{children:o("validation.success.message")}):J("div",{className:"list-disc list-inside",children:i.map(s=>J("li",{className:"mb-1",children:s.message},s.id))})})]})};import{jsx as $,jsxs as $t}from"react/jsx-runtime";var Bd=[],zd=({mode:e="edit"})=>{let t=Od(!1),[o,r]=Pd([]),[n,a]=Dd([]),[i,s]=Gd(null),{isMoveTool:l,isHandTool:d,isReadOnly:m,setIsReadOnly:f,setIsMultipleSelection:c,isMinimapOpen:h}=O(),{validationResult:u,handleValidationComplete:v,clearValidation:g,isAutoValidationEnabled:p,validateDiagram:b}=Bo(),{getNode:w,getEdges:I,getNodes:A}=Md(),{onNodeSelected:R,onEdgeSelected:N}=rt(),{onNodeDrag:T,onDrop:S,onDragOver:C,onNodeDragStop:k}=qo({nodes:o,setNodes:r,setEdges:a}),{isValidConnection:x,onConnect:z}=So({setEdges:a});Uo();let{createDiagram:K}=nr(),{undo:F,redo:he,saveHistory:oe,canUndo:me,canRedo:In}=lr(),{helperLineHorizontal:An,helperLineVertical:kn,customApplyNodeChanges:Sn}=Jo();ar({LIA_CREATE_DIAGRAM:K,CLEAR_DIAGRAM:()=>{r([]),a([])}}),vn(()=>{f(e==="readonly")},[e,f]);let Ln=()=>{g()},jt=Lt(M=>{let L=A(),se=I(),re=Cd(M,L,se),zn=Id(M,L,se),Fn=re.some(Dt=>Dt.type==="START_EVENT"),Un=zn.some(Dt=>Dt.type==="END_EVENT");return Fn?"start":Un?"end":"between"},[A,I]),Dn=Lt(({nodes:M,edges:L})=>{let se=M.length+L.length>1;if(c(se),M.length===1&&L.length===0){let re=M[0];R==null||R({id:re.id,type:"activity",variant:jt(re)})}else if(L.length===1&&M.length===0){let re=L[0];N==null||N({id:re.id,type:"routing"})}},[c,R,N,jt]);Rd({onChange:Dn});let Pn=M=>{let L=w(M.id);if(L!=null&&L.parentId&&(L==null?void 0:L.type)==="LANE"){let se=ue(L.parentId,o.filter(re=>re.id!==L.id&&re.type==="LANE"));r(ae(se))}},Rn=M=>{M.forEach(L=>{switch(L.type){case"remove":Pn(L);break}})},Mn=Lt(()=>{if(!p){t.current=!1;return}let M=A(),L=I(),se=b({nodes:M,edges:L});v(se),t.current=!1},[p,A,I,b,v]),Jt=Hd(Mn,300),Qt=Lt(()=>{p&&!t.current&&(t.current=!0,Jt())},[p,Jt]),Vn=M=>{r(L=>Sn(M,L)),oe(M),Qt(),Rn(M)},On=M=>{a(L=>_d(M,L)),oe(M),Qt()},Gn=()=>{oe("forceSave")},Hn=async({nodes:M,edges:L})=>(s({nodes:M,edges:L}),!1),Bn={nodes:o,edges:n};return $t("div",{className:"w-full h-full",children:[!m&&$(bn,{}),$(cr,{}),$t(kd,{edges:n,nodes:o,nodeTypes:rn,edgeTypes:nn,minZoom:pn,maxZoom:mn,panOnDrag:d||m?!0:Bd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!m&&l,nodesConnectable:!m&&l,nodesDraggable:!m&&l,isValidConnection:x,connectionLineComponent:Zo,onConnect:z,onDrop:S,onDropCapture:Gn,onDragOver:C,onNodesChange:Vn,onEdgesChange:On,onNodeDrag:T,onNodeDragStop:k,onBeforeDelete:Hn,selectionMode:Ld.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:un,connectOnClick:!1,children:[h&&$(Ad,{pannable:!0,zoomable:!0,position:cn,className:"shadow-md rounded-md"}),$t("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!m&&$(Mr,{canUndo:me,canRedo:In,undo:F,redo:he}),$(Sr,{nodes:o,isReadOnly:m,diagram:Bn,onValidationComplete:v,onValidateDiagram:b}),$(Vr,{})]}),$(gn,{horizontal:An,vertical:kn}),$(wd,{gap:dn,size:ln,color:sn,bgColor:an}),u&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(En,{validationResult:u,onClose:Ln})})]}),$(hn,{pendingDelete:i,setPendingDelete:s,setNodes:r,setEdges:a})]})},Fd=({mode:e="edit",locale:t="pt_BR",onConfigureElement:o,onNodeSelected:r,onEdgeSelected:n})=>(vn(()=>{t&&Vd.changeLanguage(t)},[t]),$(Sd,{children:$(To,{value:{onConfigureElement:o,onNodeSelected:r,onEdgeSelected:n},children:$(zd,{mode:e})})})),qt=Fd;var Xt=e=>{if(typeof document=="undefined")return;let t=document.cookie.match(new RegExp(`(?:^|; )${e.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0};import{initializeI18n as Ud,Translations as Wd}from"lecom-ui";var Nn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing"},controls:{zoom:{fit:"Fit zoom",in:"Zoom in",out:"Zoom out",reset:"Reset zoom"},actions:{move_tool:"Select elements",hand_tool:"Navigate the diagram",check:"Check diagram",export:{title:"Export diagram",print:"Print",html:"Export as HTML",png:"Export as PNG",feedback:{error:"Error exporting diagram"}},import_governance:"Import diagram from Governance platform",minimap:{open:"Open minimap",close:"Hide minimap"}},history:{undo:"Undo",redo:"Redo"}},modals:{delete_elements:{title:"Delete elements",callout:"When deleting, the activity and routing settings will be deleted.",content:"Are you sure you want to delete?",confirm:"Delete",cancel:"Cancel"}}},validation:{success:{title:"Validation Successful",message:"The diagram was validated successfully with no errors."},errors:{title:"The diagram contains errors",subtitle:"Please review the following:",task_label_length:"Task name exceeds the maximum character limit",multiple_start_event_not_allowed:"Multiple start events are not allowed",task_flows_limit_exceeds:"The number of output connections exceeds the limit of two",duplicate_task_name:"There are multiple activities with the same name",flows_on_end_tasks_not_allowed:"Activities connected to end events cannot have other connections",conditions_flows_limit_exceeds:"Exclusive gateway has too many output connections (maximum of two)",task_label_empty:"One or more activities have no name",activity_name_invalid:"Activity name is invalid",final_activity_has_loop:"Final activities cannot have loops",nested_gateway:"Connecting gateways directly is not allowed",concurrent_initial_and_final_event:"The same activity cannot have both initial and final events",gateway_flow_to_event:"Connecting a gateway to an output event is not allowed",gateway_missing_output_streams:"The gateway does not have the correct number of outputs",events_nested:"Connecting events directly is not allowed",event_to_condition:"Connecting an event directly to a gateway is not allowed",script_in_final_activity:"Final activity cannot be a script type",subprocess_referenced_not_configured:"The subprocess reference is not properly configured",start_event_not_found:"At least one start event is required",end_event_not_found:"At least one end event is required"}},bpmn:{start_event:{variant:{default:"Start event"}},end_event:{variant:{default:"End event"}},annotation:{variant:{default:"Annotation"}},gateway:{menu:{title:"Change gateway type"},variant:{default:"Gateway",exclusive:"Exclusive gateway",parallel:"Parallel gateway",complex:"Complex gateway"}},task:{menu:{title:"Change task type"},variant:{default:"Task",script:"Script task",subprocess:"Subprocess"},attribute:{loop:"Task with loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Unsupported element"}}},adapter:{governance:{error:{DEFAULT:"Error importing diagram",NO_FILE:"No file selected",EMPTY_FILE:"Empty file",INVALID_FILE:"Invalid file",CONTAIN_NO_CELLS:"No cells found to be imported",ALREADY_INITIALIZED:"It is not possible to import the diagram from the Governance platform, since the diagram has already been initialized"},success:{default:"The diagram was imported from the Governance platform successfully and without any incompatibility detected.",incompatible_cells:"The diagram was imported from the Governance platform with incompatibilities. To know more details, click on the button below."},report:{columns:{type:"Type",value:"Value",status:"Status"},status:{imported:"Imported",adapted:"Adapted",unsupported:"Unsupported"}},action:{download:"Download report"}}}}};var yn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento"},controls:{zoom:{fit:"Ajustar zoom",in:"Acercar",out:"Alejar",reset:"Restablecer zoom"},actions:{move_tool:"Seleccionar elementos",hand_tool:"Navegar por el diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Error al exportar diagrama"}},import_governance:"Importar diagrama de la plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Deshacer",redo:"Rehacer"}},modals:{delete_elements:{title:"Eliminar elementos",callout:"Al eliminar, las configuraciones de actividades y enrutamiento ser\xE1n eliminadas.",content:"\xBFEst\xE1s seguro de querer eliminar?",confirm:"Eliminar",cancel:"Cancelar"}}},validation:{success:{title:"Validaci\xF3n exitosa",message:"El diagrama ha sido validado correctamente sin errores."},errors:{title:"El diagrama contiene errores",subtitle:"Revise lo siguiente:",task_label_length:"El nombre de la actividad excede el l\xEDmite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"No se permite tener m\xE1s de un evento de inicio",task_flows_limit_exceeds:"El n\xFAmero de conexiones de salida supera el l\xEDmite de dos",duplicate_task_name:"Hay varias actividades con el mismo nombre",flows_on_end_tasks_not_allowed:"Las actividades conectadas a eventos finales no pueden tener otras conexiones",conditions_flows_limit_exceeds:"Compuerta exclusiva con exceso de conexiones de salida (m\xE1ximo de dos)",task_label_empty:"El nombre de una o m\xE1s actividades no ha sido completado",activity_name_invalid:"El nombre de la actividad no es v\xE1lido",final_activity_has_loop:"Las actividades finales no pueden tener bucles",nested_gateway:"No se permite conectar compuertas directamente",concurrent_initial_and_final_event:"Una misma actividad no puede tener eventos iniciales y finales",gateway_flow_to_event:"No se permite conectar una compuerta a un evento de salida",gateway_missing_output_streams:"La compuerta no tiene el n\xFAmero correcto de salidas",events_nested:"No se permite conectar eventos directamente",event_to_condition:"No se permite conectar un evento directamente a una compuerta",script_in_final_activity:"La actividad final no puede ser de tipo script",subprocess_referenced_not_configured:"La referencia al subproceso no est\xE1 configurada correctamente",start_event_not_found:"Es necesario tener al menos un evento de inicio",end_event_not_found:"Es necesario tener al menos un evento final"}},bpmn:{start_event:{variant:{default:"Evento de inicio"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anotaci\xF3n"}},gateway:{menu:{title:"Cambiar tipo de compuerta"},variant:{default:"Compuerta",exclusive:"Compuerta exclusiva",parallel:"Compuerta paralela",complex:"Compuerta compleja"}},task:{menu:{title:"Cambiar tipo de tarea"},variant:{default:"Tarea",script:"Tarea de script",subprocess:"Subproceso"},attribute:{loop:"Tarea con bucle"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento no soportado"}}},adapter:{governance:{error:{DEFAULT:"Error al importar diagrama",NO_FILE:"No se ha seleccionado ning\xFAn archivo",EMPTY_FILE:"Archivo vac\xEDo",INVALID_FILE:"Archivo inv\xE1lido",CONTAIN_NO_CELLS:"No se encontraron c\xE9lulas para importar",ALREADY_INITIALIZED:"No es posible importar el diagrama de la plataforma Governance, ya que el diagrama ya ha sido iniciado"},success:{default:"El diagrama se ha importado de la plataforma Governance correctamente y sin ninguna incompatibilidad detectada.",incompatible_cells:"El diagrama se ha importado de la plataforma Governance con incompatibilidades. Para saber m\xE1s detalles, haz click en el bot\xF3n de abajo."},report:{columns:{type:"Tipo",value:"Valor",status:"Estado"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"No soportado"}},action:{download:"Descargar informe"}}}}};var Tn={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento"},controls:{zoom:{fit:"Ajustar o zoom",in:"Aumentar o zoom",out:"Diminuir o zoom",reset:"Resetar o zoom"},actions:{move_tool:"Selecionar elementos",hand_tool:"Navegar pelo diagrama",check:"Verificar diagrama",export:{title:"Exportar diagrama",print:"Imprimir",html:"Exportar como HTML",png:"Exportar como PNG",feedback:{error:"Erro ao exportar o diagrama"}},import_governance:"Importar diagrama da plataforma Governance",minimap:{open:"Abrir minimapa",close:"Ocultar minimapa"}},history:{undo:"Desfazer",redo:"Refazer"}},modals:{delete_elements:{title:"Excluir elementos",callout:"Ao excluir, as configura\xE7\xF5es de atividades e roteamento ser\xE3o exclu\xEDdas.",content:"Deseja realmente excluir?",confirm:"Excluir",cancel:"Cancelar"}}},validation:{success:{title:"Diagrama v\xE1lidado com sucesso!",message:"Nenhum erro encontrado."},errors:{title:"O diagrama cont\xE9m erros",subtitle:"Veja abaixo o que precisa ser corrigido:",task_label_length:"O nome da atividade excede o limite m\xE1ximo de caracteres",multiple_start_event_not_allowed:"N\xE3o \xE9 permitido ter mais de um evento de in\xEDcio",task_flows_limit_exceeds:"O n\xFAmero de conex\xF5es de sa\xEDda ultrapassa o limite de dois",duplicate_task_name:"H\xE1 v\xE1rias atividades com o mesmo nome",flows_on_end_tasks_not_allowed:"Atividades conectadas a eventos finais n\xE3o podem ter outras conex\xF5es",conditions_flows_limit_exceeds:"Gateway exclusivo com excesso de conex\xF5es de sa\xEDda (m\xE1ximo de dois)",task_label_empty:"O nome de uma ou mais atividades n\xE3o foi preenchido",activity_name_invalid:"O nome da atividade n\xE3o \xE9 v\xE1lido",final_activity_has_loop:"Atividades finais n\xE3o podem ter loops",nested_gateway:"N\xE3o \xE9 permitido conectar gateways",concurrent_initial_and_final_event:"Uma mesma atividade n\xE3o pode ter eventos iniciais e finais",gateway_flow_to_event:"N\xE3o \xE9 permitido conectar um gateway a um evento de sa\xEDda",gateway_missing_output_streams:"O gateway n\xE3o possui o n\xFAmero correto de sa\xEDdas",events_nested:"N\xE3o \xE9 permitido conectar eventos",event_to_condition:"N\xE3o \xE9 permitido conectar um evento diretamente em um gateway",script_in_final_activity:"Atividade final n\xE3o pode ser do tipo script",subprocess_referenced_not_configured:"A refer\xEAncia ao subprocesso n\xE3o est\xE1 configurada corretamente",start_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento inicial",end_event_not_found:"\xC9 necess\xE1rio ter ao menos um evento final"}},bpmn:{start_event:{variant:{default:"Evento inicial"}},end_event:{variant:{default:"Evento final"}},annotation:{variant:{default:"Anota\xE7\xE3o"}},gateway:{menu:{title:"Alterar tipo de gateway"},variant:{default:"Gateway",exclusive:"Gateway exclusivo",parallel:"Gateway paralelo",complex:"Gateway complexo"}},task:{menu:{title:"Alterar tipo de tarefa"},variant:{default:"Tarefa",script:"Tarefa de script",subprocess:"Subprocesso"},attribute:{loop:"Tarefa com loop"}},lane:{variant:{default:"Lane"}},unsupported:{variant:{default:"Elemento n\xE3o suportado"}}},adapter:{governance:{error:{DEFAULT:"Erro ao importar diagrama",NO_FILE:"Nenhum arquivo selecionado",EMPTY_FILE:"Arquivo vazio",INVALID_FILE:"Arquivo inv\xE1lido",CONTAIN_NO_CELLS:"N\xE3o foram encontradas c\xE9lulas para serem importadas",ALREADY_INITIALIZED:"N\xE3o \xE9 poss\xEDvel importar o diagrama da plataforma Governance, pois o diagrama j\xE1 foi iniciado"},success:{default:"O diagrama foi importado da plataforma Governance com sucesso e sem nenhuma incompatibilidade detectada.",incompatible_cells:"O diagrama foi importado da plataforma Governance com incompatibilidades. Para saber mais detalhes, clique no bot\xE3o abaixo."},report:{columns:{type:"Tipo do elemento",value:"Valor",status:"Status"},status:{imported:"Importado",adapted:"Adaptado",unsupported:"N\xE3o suportado"}},action:{download:"Baixar relat\xF3rio"}}}}};var xn={pt_BR:Tn,en_US:Nn,es_ES:yn};var _n,wn,Yd=(wn=(_n=Xt("LecomUserLanguage"))!=null?_n:Xt("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?wn:Wd.PT_BR;Ud({lng:Yd,resources:xn});import{jsx as Cn}from"react/jsx-runtime";var eb=e=>Cn(ro,{children:Cn(qt,E({},e))});export{Pt as EditorMode,eb as Modeler};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-modeler",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",