lecom-modeler 0.1.24 → 0.1.25
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 +4 -4
- package/lib/index.d.cts +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -4
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var Wa=Object.create;var vt=Object.defineProperty,Ya=Object.defineProperties,Ka=Object.getOwnPropertyDescriptor,Za=Object.getOwnPropertyDescriptors,$a=Object.getOwnPropertyNames,Gt=Object.getOwnPropertySymbols,Xa=Object.getPrototypeOf,Io=Object.prototype.hasOwnProperty,jo=Object.prototype.propertyIsEnumerable;var qo=(e,t,o)=>t in e?vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))Io.call(t,o)&&qo(e,o,t[o]);if(Gt)for(var o of Gt(t))jo.call(t,o)&&qo(e,o,t[o]);return e},_=(e,t)=>Ya(e,Za(t));var et=(e,t)=>{var o={};for(var r in e)Io.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Gt)for(var r of Gt(e))t.indexOf(r)<0&&jo.call(e,r)&&(o[r]=e[r]);return o};var qa=(e,t)=>{for(var o in t)vt(e,o,{get:t[o],enumerable:!0})},Jo=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $a(t))!Io.call(e,n)&&n!==o&&vt(e,n,{get:()=>t[n],enumerable:!(r=Ka(t,n))||r.enumerable});return e};var ja=(e,t,o)=>(o=e!=null?Wa(Xa(e)):{},Jo(t||!e||!e.__esModule?vt(o,"default",{value:e,enumerable:!0}):o,e)),Ja=e=>Jo(vt({},"__esModule",{value:!0}),e);var Li={};qa(Li,{ActivityVariant:()=>Ft,ComplexVariant:()=>Wt,ElementType:()=>zt,ExclusiveVariant:()=>Yt,GatewayVariant:()=>Ie,Modeler:()=>ki,RoutingVariant:()=>Ut,useSelectionUtils:()=>mt});module.exports=Ja(Li);var Ht=require("lecom-ui"),Bt=require("react/jsx-runtime");function Qo({children:e}){return(0,Bt.jsxs)(Ht.TooltipProvider,{children:[(0,Bt.jsx)(Ht.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}var X=require("@xyflow/react"),ya=require("lecom-ui"),ie=require("react"),Ta=require("use-debounce");var zt=(n=>(n.ACTIVITY="activity",n.ROUTING="routing",n.GATEWAY="gateway",n.SUB_PROCESS="sub_process",n))(zt||{}),Ft=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(Ft||{}),Ut=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Ut||{}),Wt=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Wt||{}),Yt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Yt||{});var st=require("lucide-react");var Ue=require("react/jsx-runtime"),Kt=({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 Ao=require("react/jsx-runtime"),tt=({size:e=24,className:t})=>(0,Ao.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,Ao.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"),$t=({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"),er=({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 tr=require("clsx"),or=require("tailwind-merge");function S(...e){return(0,or.twMerge)((0,tr.clsx)(e))}var Nt=(e,t)=>e<t?t:e;var yt=require("react/jsx-runtime"),rr=({size:e=24,className:t})=>(0,yt.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:S("stroke-2",t),children:[(0,yt.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,yt.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Xt=require("react/jsx-runtime"),nr=({size:e=24,className:t})=>(0,Xt.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Xt.jsx)("g",{children:(0,Xt.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 So=require("react/jsx-runtime"),qt=({size:e=24,className:t})=>(0,So.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,So.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 ko=require("react/jsx-runtime"),Tt=({size:e=24,className:t})=>(0,ko.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:S("stroke-2",t),children:(0,ko.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"),ar=({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 De=require("react/jsx-runtime"),ir=({size:e=24,className:t})=>(0,De.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,De.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,De.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,De.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,De.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,De.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var We=require("react/jsx-runtime"),sr=({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 V=(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))(V||{});var jt={SCRIPT:{icon:st.ScrollText},SUBPROCESS:{icon:st.SquarePlus}};var Jt={LOOP:{icon:st.RotateCcw}},Ie=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(Ie||{}),Qt={EXCLUSIVE:{icon:rt},PARALLEL:{icon:$t},COMPLEX:{icon:Zt}};var Lo=ja(require("@dagrejs/dagre"),1),pr=require("@xyflow/react"),mr=require("lodash");var Qa={MIN_WIDTH:36,MIN_HEIGHT:36},ei={MIN_WIDTH:36,MIN_HEIGHT:36},ti={MIN_WIDTH:56,MIN_HEIGHT:56},eo={MIN_WIDTH:176,MIN_HEIGHT:96},to={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},oe={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},oo={MIN_WIDTH:176,MIN_HEIGHT:64},oi={MIN_WIDTH:128,MIN_HEIGHT:64},Y={START_EVENT:Qa,END_EVENT:ei,GATEWAY:ti,TASK:eo,LANE:oe,ANNOTATION:oo,UNSUPPORTED:oi};var lr=require("lodash");var Ae=e=>{var t,o,r,n,i,a,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:(a=(i=e.measured)==null?void 0:i.width)!=null?a:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},Se=e=>(0,lr.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),dr=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:i}=Ae(t);return{x:o-n,y:r-i}};var lt=({parentId:e,nodes:t,includeTypes:o=[...Object.values(V)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),ri=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:i}=Ae(t),a=o-n,s=r-i;return Math.sqrt(a*a+s*s)},ni=(e,t)=>{let{x:o,y:r,w:n,h:i}=Ae(e),{x:a,y:s,w:l,h:d}=Ae(t);return o<a+l&&a<o+n&&r<s+d&&s<r+i},xt=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&ni(e,n)){let i=ri(e,n);i<r&&(r=i,o=n)}return o},cr=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,i;return Math.max(o,(i=(n=r.measured)==null?void 0:n.width)!=null?i:0)},0);var ur=(e=[],t=[],o="LR")=>{let r=new Lo.default.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>r.setNode(i,{width:a,height:s})),t.forEach(i=>r.setEdge(i.source,i.target)),Lo.default.layout(r),{nodes:e.map(i=>{let a=r.node(i.id);return _(N({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},Ye=(e,t)=>{var m,p;let o=[...t],r=o.find(g=>g.id===e);if(!r)return o;let n=o.filter(g=>g.parentId===e&&g.type==="LANE");if(n.length===0)return o;let i=(0,mr.orderBy)(n,["position.y"]),a=Math.max((p=(m=r.measured)==null?void 0:m.width)!=null?p:0,to.MIN_WIDTH),s=cr(e,i)||oe.MIN_WIDTH,l=Math.max(a,s),d=0,E=0;i.forEach(g=>{var T,b,u,c;o=o.map(v=>v.id===g.id?_(N({},v),{width:l-oe.HEADER_WIDTH,measured:_(N({},v.measured),{width:l-oe.HEADER_WIDTH}),position:{x:oe.HEADER_WIDTH,y:d}}):v),d+=(b=(T=g.measured)==null?void 0:T.height)!=null?b:0,E+=(c=(u=g.measured)==null?void 0:u.height)!=null?c:0}),o=o.map(g=>g.id===e?_(N({},g),{height:E,width:l,measured:_(N({},g.measured),{height:E,width:l})}):g);let f=o.find(g=>g.id===e);return f!=null&&f.parentId&&(o=Ye(f.parentId,o)),o},fr=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ai=50,gr=(e,t=ai)=>{let o=(0,pr.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Er=require("zustand"),G=(0,Er.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 Ct=require("@xyflow/react");var ye=require("@xyflow/react");var be=require("@xyflow/react"),ve=require("lecom-ui"),Nr=require("lucide-react");var ro=require("react"),br=(0,ro.createContext)(null),hr=br.Provider,vr=()=>{let e=(0,ro.useContext)(br);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};var Ke=require("react/jsx-runtime"),_t=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,ve.useTranslation)(),{getNode:r,getEdge:n,getNodes:i,getEdges:a}=(0,be.useReactFlow)(),{onConfigureElement:s}=vr(),l=c=>{let v=i(),C=a(),y=(0,be.getIncomers)(c,v,C),A=(0,be.getOutgoers)(c,v,C),h=y.some(k=>k.type==="START_EVENT"),x=A.some(k=>k.type==="END_EVENT");return h?"start":x?"end":"between"},d=c=>{var k,w,L;let v=i(),C=a(),y=r(c.source),A=r(c.target);if(!y||!A)return"simple";if((0,be.getOutgoers)(y,v,C).some(I=>I.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((k=y.data)==null?void 0:k.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let I=(w=y.data)==null?void 0:w.variant,P=(L=y.data)==null?void 0:L.attribute;return I==="SCRIPT"?"script":P==="LOOP"?"loop":"simple"}return"simple"},E=c=>{var k;let v=r(c.source);if(!v||v.type!=="GATEWAY"||((k=v.data)==null?void 0:k.variant)!=="COMPLEX")return;let C=i(),y=a(),A=(0,be.getIncomers)(v,C,y),h=!1,x=!1;if(A.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(x=!0))}),h&&x)return"script_loop";if(h)return"script";if(x)return"loop"},f=c=>{var k;let v=r(c.source);if(!v||v.type!=="GATEWAY"||((k=v.data)==null?void 0:k.variant)!=="EXCLUSIVE")return;let C=i(),y=a(),A=(0,be.getIncomers)(v,C,y),h=!1,x=!1;if(A.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(x=!0))}),h)return"script";if(x)return"loop"},m=c=>{var x,k;if(c.type!=="GATEWAY")return;let v=i(),C=a(),y=(0,be.getIncomers)(c,v,C),A=!1,h=!1;if(y.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(A=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(h=!0))}),((x=c.data)==null?void 0:x.variant)==="COMPLEX"){if(A&&h)return"script_loop";if(A)return"script";if(h)return"loop"}else if(((k=c.data)==null?void 0:k.variant)==="EXCLUSIVE"){if(A)return"script";if(h)return"loop"}},p=c=>(0,be.getOutgoers)(c,i(),a()).map(y=>{var A,h;return{id:y.id,type:y.type,variant:(A=y.data)==null?void 0:A.variant,label:(h=y.data)==null?void 0:h.label}}),g=c=>a().filter(y=>y.source===c.id).map(y=>{var A;return{id:y.id,type:"routing",variant:d(y),label:(A=y.data)==null?void 0:A.label,target:r(y.target)}}),T=()=>{var v,C,y,A,h;let c=r(e);if(c){if(c.type==="TASK"&&((v=c.data)==null?void 0:v.variant)==="SUBPROCESS"){s==null||s({id:c.id,type:"sub_process",variant:l(c),label:(C=c.data)==null?void 0:C.label,targets:p(c),edgeTargets:g(c)});return}if(c.type!=="GATEWAY"){s==null||s({id:c.id,type:"activity",variant:l(c),label:(y=c.data)==null?void 0:y.label,targets:p(c),edgeTargets:g(c)});return}s==null||s({id:c.id,type:"gateway",variant:((A=c.data)==null?void 0:A.variant)||"EXCLUSIVE",label:(h=c.data)==null?void 0:h.label,subVariant:m(c),targets:p(c)})}},b=()=>{let c=n(e);if(c){let v=d(c),C;v==="complex"?C=E(c):v==="exclusive"&&(C=f(c)),s==null||s({id:c.id,type:"routing",variant:v,subVariant:C,target:r(c.target)})}};return(0,Ke.jsxs)(ve.Tooltip,{children:[(0,Ke.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,Ke.jsx)(ve.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":T();break;case"edge":b();break}},children:(0,Ke.jsx)(Nr.PencilIcon,{size:16})})}),(0,Ke.jsx)(ve.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var yr=require("@xyflow/react"),Ne=require("lecom-ui"),Tr=require("lucide-react"),Ze=require("react/jsx-runtime"),ao=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ne.useTranslation)(),{deleteElements:r}=(0,yr.useReactFlow)();return(0,Ze.jsxs)(Ne.Tooltip,{children:[(0,Ze.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,Ze.jsx)(Ne.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Ze.jsx)(Tr.TrashIcon,{size:16})})}),(0,Ze.jsx)(Ne.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var wt=require("react/jsx-runtime"),dt=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=et(n,["edgeId","edgeType"]);var s;let i=[{component:(0,wt.jsx)(ao,{elementId:e,elementType:"edge"})}],a={SEQUENCE_EDGE:[{component:(0,wt.jsx)(_t,{elementId:e,elementType:"edge"})},...i],MESSAGE_EDGE:[...i],ANNOTATION_EDGE:[...i]};return(0,wt.jsx)("div",_(N({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=a[t])==null?void 0:s.map((l,d)=>(0,wt.jsx)("div",{children:l.component},d))}))};var $e=require("react/jsx-runtime"),so={type:"ANNOTATION_EDGE",zIndex:2e3},xr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,selected:s,data:l})=>{let d=(0,ye.useNodes)(),{zoom:E}=(0,ye.useViewport)(),{isMultipleSelection:f}=G(),m=d.find(v=>v.id===t),p=d.find(v=>v.id===o),[g,T,b]=(0,ye.getStraightPath)({sourceX:r,sourceY:n,targetX:i,targetY:a}),u=s||(m==null?void 0:m.selected)||(p==null?void 0:p.selected),c=1/E;return(0,$e.jsxs)("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":u}),children:[(0,$e.jsx)(ye.BaseEdge,{id:e,path:g,strokeDasharray:4,className:S("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)]":u&&!(l!=null&&l.hasError)})}),(0,$e.jsx)(ye.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(${T}px, ${b}px)`},children:s&&!f&&(0,$e.jsx)(dt,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${c})`}})})})]})};var re=require("@xyflow/react"),_r=require("react");var Xe=require("react");var Po=require("react/jsx-runtime"),Q=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:i,style:a})=>{let s=(0,Xe.useRef)(null),[l,d]=(0,Xe.useState)(!1);(0,Xe.useEffect)(()=>{d(r!=null?r:!1)},[r]),(0,Xe.useEffect)(()=>{if(l&&s.current){s.current.focus();let p=document.createRange();p.selectNodeContents(s.current),p.collapse(!1);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(p))}},[l]);let E=p=>{p.stopPropagation(),d(!0)},f=p=>{let g=p.currentTarget.innerText;t&&g.length>=t&&p.preventDefault()},m=p=>{d(!1),n==null||n(),o==null||o(p.currentTarget.innerText)};return(0,Po.jsx)("div",{className:S("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",i,{"border border-dashed border-grey-400":l}),style:a,onDoubleClick:E,children:(0,Po.jsx)("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:m,children:e})})};var Re=require("react/jsx-runtime"),Me={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:re.MarkerType.ArrowClosed},markerEnd:{type:re.MarkerType.Arrow},data:{label:""}},wr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:d,selected:E})=>{let f=(0,re.useNodes)(),{zoom:m}=(0,re.useViewport)(),{updateEdgeData:p}=(0,re.useReactFlow)(),{isMultipleSelection:g}=G(),[T,b]=(0,_r.useState)(!1),u=f.find(P=>P.id===t),c=f.find(P=>P.id===o),[v,C,y]=(0,re.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),A=E||(u==null?void 0:u.selected)||(c==null?void 0:c.selected),h=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",x=T||(d==null?void 0:d.label.trim().length)>0,k=1/m,w=()=>{b(!0)},L=()=>{b(!1)},I=P=>{p(e,{label:P.trim()})};return(0,Re.jsxs)("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:L,onDoubleClick:w,children:[(0,Re.jsx)(re.BaseEdge,{id:e,path:v,markerEnd:`url(#${h})`,className:S("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,Re.jsx)(re.EdgeLabelRenderer,{children:(0,Re.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C}px, ${y}px)`},children:[E&&!g&&(0,Re.jsx)(dt,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${k})`}}),x&&(0,Re.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:T,onChange:I})]})})]})};var Cr=({setEdges:e})=>{let{getNode:t}=(0,Ct.useReactFlow)();return{isValidConnection:n=>{let i=t(n.source),a=t(n.target);if((i==null?void 0:i.id)===(a==null?void 0:a.id))return!1;switch(i==null?void 0:i.type){case"START_EVENT":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"END_EVENT":return(a==null?void 0:a.type)==="ANNOTATION";case"TASK":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"GATEWAY":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"LANE":return(a==null?void 0:a.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(i=>{let a=t(n.target);return(a==null?void 0:a.type)==="ANNOTATION"?(0,Ct.addEdge)(N(N({},n),so),i):(0,Ct.addEdge)(N(N({},n),Me),i)})}}};var Do=require("react"),Mr=require("lecom-ui"),Vr=require("@xyflow/react");var It=(e=[])=>e.filter(t=>t.type==="START_EVENT"),qe=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Ve=(e=[])=>e.filter(t=>t.type==="TASK")||[],Ir=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Ar=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),lo=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Sr=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),me=(e,t=[])=>t.filter(o=>o.source===e),At=(e,t=[])=>t.filter(o=>o.target===e),kr=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(i=>i.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Lr=(e,t)=>{let o=me(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(i=>i.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Pr=e=>e?/\w/g.test(e.trim()):!1,M=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:[]}},Te=(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)}},Dr=(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 St=[{id:"start_event_not_found",validate:e=>{let t=It(e.nodes);return M({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=qe(e.nodes);return M({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=It(e.nodes),o=t.length===1;if(t.length===0)return M({isValid:!0});if(!o)return M({isValid:!1,nodeIds:t.map(i=>i.id)});let r=me(t[0].id,e.edges);if(!(r.length<=1)){let i=[...t.map(a=>a.id),...r.map(a=>a.target)];return M({isValid:!1,nodeIds:[...new Set(i)]})}return M({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Ve(e.nodes),o=Te(t,r=>me(r.id,e.edges).length<=2);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Ve(e.nodes),o=Te(t,r=>!!r.label&&r.label.trim()!=="");return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Ve(e.nodes),r=Te(o,n=>!n.label||n.label.length<=60);return M({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Ve(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let i=n.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(i=>r.push(i.id));return M({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=lo(e.nodes),o=[],r=[];for(let n of t){let i=me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...It(e.nodes),...qe(e.nodes)],o=[],r=[];for(let n of t){let i=me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(a.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=qe(e.nodes),o=[],r=[];for(let n of t){let i=At(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.source);if(s&&s.type==="TASK"){let l=me(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>r.push(d.id)))}}}return M({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Sr(e.nodes),o=Te(t,n=>me(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>me(n,e.edges).map(i=>i.id));return M({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=Ve(e.nodes),o=Te(t,r=>!r.label||Pr(r.label));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var a,s;if(!((a=e==null?void 0:e.nodes)!=null&&a.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return M({isValid:!0});let t=qe(e.nodes)[0];if(!t)return M({isValid:!0});let o=At(t.id,e.edges);if(!o.length)return M({isValid:!0});let n=Ve(e.nodes).filter(l=>o.some(d=>d.source===l.id)),i=Te(n,l=>!kr(l.id,e));return M({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Ve(e.nodes),o=qe(e.nodes)[0];if(!o)return M({isValid:!0});let r=t.filter(l=>{let d=At(l.id,e.edges),E=me(l.id,e.edges),f=d.some(p=>{var g;return((g=e.nodes.find(T=>T.id===p.source))==null?void 0:g.type)==="START_EVENT"}),m=E.some(p=>{var g;return((g=e.nodes.find(T=>T.id===p.target))==null?void 0:g.type)==="END_EVENT"});return f&&m}),n=At(o.id,e.edges),i=n.length>1,a=n.map(l=>l.source),s={isValid:r.length===0&&!i,nodeIds:[...r.map(l=>l.id),...i?a:[]]};return M(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=lo(e.nodes),o=[],r=[];for(let n of t){let i=me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(a.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=lo(e.nodes),o=Te(t,r=>me(r.id,e.edges).length>=1);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...It(e.nodes),...qe(e.nodes)],o=[],r=[];for(let n of t){let i=me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=Ir(e.nodes),o=Te(t,r=>!Lr(r.id,e));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Ar(e.nodes),o=Te(t,r=>{var n,i;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((i=r.properties)==null?void 0:i.subprocessRef)!==""});return M({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Rr=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of St){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 Or=()=>{let{t:e}=(0,Mr.useTranslation)(),[t,o]=(0,Do.useState)(null),{setNodes:r,setEdges:n,getNodes:i,getEdges:a}=(0,Vr.useReactFlow)(),[s,l]=(0,Do.useState)(!1);return{validationResult:t,validateDiagram:m=>{let p=Dr(m.nodes,m.edges),g=Rr(p),T=g.errors.map(b=>_(N({},b),{message:e(`validation.errors.${b.id}`)}));return s||l(!0),{isValid:g.isValid,errors:T}},handleValidationComplete:m=>{if(o(m),!m)return;let p=[],g=[];m.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(x=>p.push(x)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(x=>g.push(x))});let T=[...new Set(p)];r(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:!1})}))),n(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:!1})})));let b=i(),u=a(),c=new Set(T),v=new Set;m.errors.forEach(h=>{var w,L;let x=St.find(I=>I.id===h.id);(x==null?void 0:x.highlightRelatedEdges)!==!1&&((w=h.edgeIds)==null||w.forEach(I=>v.add(I)),(L=h.nodeIds)==null||L.forEach(I=>{u.forEach(P=>{(P.source===I||P.target===I)&&v.add(P.id)})}))});let C=new Set,y=new Set,A=new Set;b.forEach(h=>{h.type==="START_EVENT"?C.add(h.id):h.type==="END_EVENT"&&y.add(h.id)}),u.forEach(h=>{C.has(h.source)&&A.add(h.target),y.has(h.target)&&A.add(h.source)}),A.forEach(h=>{var x,k;if(c.has(h)){let w=(x=m.errors.find(I=>{var P;return(P=I.nodeIds)==null?void 0:P.includes(h)}))==null?void 0:x.id;((k=St.find(I=>I.id===w))==null?void 0:k.highlightRelatedEdges)!==!1&&u.forEach(I=>{I.source===h&&y.has(I.target)&&(c.add(I.target),v.add(I.id)),I.target===h&&C.has(I.source)&&(c.add(I.source),v.add(I.id))})}}),c.size>0&&r(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:c.has(x.id)})}))),v.size>0&&n(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:v.has(x.id)})})))},clearValidation:()=>{o(null),l(!1),r(m=>m.map(p=>_(N({},p),{data:_(N({},p.data),{hasError:!1})}))),n(m=>m.map(p=>_(N({},p),{data:_(N({},p.data),{hasError:!1})})))},isAutoValidationEnabled:s}};var Hr=require("@xyflow/react"),Br=require("react"),Ro=require("uuid");var si=15,Gr="bpmn:selection",zr=({offset:e=si}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=(0,Hr.useReactFlow)();(0,Br.useEffect)(()=>{let i=s=>{var p;s.preventDefault();let l=t(),d=r(),E=l.filter(g=>g.selected);if(!E.length)return;let f=d.filter(g=>E.some(T=>T.id===g.source)&&E.some(T=>T.id===g.target)),m={nodes:E,edges:f};(p=s.clipboardData)==null||p.setData(Gr,JSON.stringify(m))},a=s=>{var m,p;s.preventDefault();let l=JSON.parse(((m=s.clipboardData)==null?void 0:m.getData(Gr))||"{}");if(!((p=l.nodes)!=null&&p.length))return;let d=new Map,E=l.nodes.map(g=>{let T=(0,Ro.v7)();return d.set(g.id,T),_(N({},g),{id:T,selected:!0,position:{x:g.position.x+e,y:g.position.y+e}})}),f=l.edges.map(g=>_(N({},g),{id:(0,Ro.v7)(),selected:!0,source:d.get(g.source)||g.source,target:d.get(g.target)||g.target}));o(g=>[...g.map(T=>_(N({},T),{selected:!1})),...E]),n(g=>[...g.map(T=>_(N({},T),{selected:!1})),...f])};return document.addEventListener("copy",i),document.addEventListener("paste",a),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",a)}},[t,o,r,n,e])};var co=require("@xyflow/react"),Mo=require("uuid");var Fr=require("zustand"),ct=(0,Fr.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var le=require("@xyflow/react"),Ur=require("react");var Oe=require("react/jsx-runtime"),Vl={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:le.MarkerType.Arrow},data:{label:""}},Wr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:d,selected:E})=>{let f=(0,le.useNodes)(),{zoom:m}=(0,le.useViewport)(),{updateEdgeData:p}=(0,le.useReactFlow)(),{isMultipleSelection:g}=G(),[T,b]=(0,Ur.useState)(!1),u=f.find(P=>P.id===t),c=f.find(P=>P.id===o),[v,C,y]=(0,le.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),A=E||(u==null?void 0:u.selected)||(c==null?void 0:c.selected),h=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",x=T||(d==null?void 0:d.label.trim().length)>0,k=1/m,w=()=>{b(!0)},L=()=>{b(!1)},I=P=>{p(e,{label:P.trim()})};return(0,Oe.jsxs)("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:L,onDoubleClick:w,children:[(0,Oe.jsx)(le.BaseEdge,{id:e,path:v,markerEnd:`url(#${h})`,strokeDasharray:4,className:S("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,Oe.jsx)(le.EdgeLabelRenderer,{children:(0,Oe.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C}px, ${y}px)`},children:[E&&!g&&(0,Oe.jsx)(dt,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${k})`}}),x&&(0,Oe.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:T,onChange:I})]})})]})};var kt=require("react/jsx-runtime"),Yr=({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 Kr=({nodes:e,setNodes:t,setEdges:o})=>{let r=(0,co.useStoreApi)(),{draggableNode:n,setDraggableNode:i}=ct(),{getInternalNode:a,screenToFlowPosition:s}=(0,co.useReactFlow)(),l=b=>{let u="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(c=>c.map(v=>_(N({},v),{className:v.id===b?u:""})))},d=()=>{let{nodeLookup:b}=r.getState();return Array.from(b.values())},E=b=>{let u=a(b.id),c=d();if(b.type==="LANE"){if(lt({parentId:b.id,nodes:e,includeTypes:["LANE"]})){l();return}let x=c.filter(L=>L.id!==b.id&&L.type==="LANE"&&!L.parentId),k=xt(u,x);if(!k){l();return}if(lt({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let C=c.filter(h=>h.id!==b.id&&h.type==="LANE"),y=xt(u,C);if(!y){l();return}if(lt({parentId:y.id,nodes:e,includeTypes:["LANE"]})){l();return}l(y.id)},f=b=>{b.preventDefault(),b.dataTransfer.dropEffect="move"},m=(b,u)=>{b.preventDefault(),E(u)},p=(b,u,c)=>{var x,k;let v=w=>w.map(L=>_(N({},L),{className:void 0}));if(b.parentId===u.id){let w=Ye(u.id,c);t(Se(v(w)));return}if(b.type==="LANE"){if(lt({parentId:u.id,nodes:c,excludeTypes:["LANE"]}))return;let I=c.filter(j=>j.parentId===u.id).reduce((j,Qe)=>{var ze,Fe;return j+((Fe=(ze=Qe.measured)==null?void 0:ze.height)!=null?Fe:0)},0),P={x:oe.HEADER_WIDTH,y:I},se=c.map(j=>j.id===b.id?_(N({},j),{parentId:u.id,position:P,className:void 0}):_(N({},j),{className:void 0}));se=Ye(u.id,se),t(Se(se));return}if(lt({parentId:u.id,nodes:c,includeTypes:["LANE"]})){let w;if(b.parentId){let I=a(b.parentId),{x:P,y:se}=Ae(I);w={x:P+((x=b.position.x)!=null?x:0),y:se+((k=b.position.y)!=null?k:0)}}let L=c.map(I=>I.id===b.id?_(N({},I),{position:w!=null?w:I.position,parentId:void 0,className:void 0}):_(N({},I),{className:void 0}));t(Se(L));return}let A=dr(b,u),h=c.map(w=>w.id===b.id?_(N({},w),{parentId:u.id,position:A,className:void 0}):_(N({},w),{className:void 0}));t(Se(h))};return{onDragOver:f,onDrop:b=>{if(b.preventDefault(),!(n!=null&&n.type))return;let u=s({x:b.clientX,y:b.clientY}),c={width:Y[n.type].MIN_WIDTH,height:Y[n.type].MIN_HEIGHT},v={id:(0,Mo.v7)(),type:n.type,position:u,measured:c,data:{label:"",variant:n.variant,attribute:n.attribute}},C=_(N({},v),{internals:{positionAbsolute:u}}),y=d(),A=n.type==="LANE",h=y.filter(w=>A?w.type==="LANE"&&!w.parentId:w.type==="LANE"),x=xt(C,h);x?p(C,x,[...y,C]):t(w=>{let L=w.concat(v);return Se(L)});let k=b.dataTransfer.getData("sourceId");if(k){let w={id:(0,Mo.v7)(),source:k,target:v.id};if(n.type==="ANNOTATION"){o(L=>L.concat(N(N({},w),so)));return}o(L=>L.concat(N(N({},w),Me)))}i(null)},onNodeDrag:m,onNodeDragStop:async(b,u)=>{var x,k;let{nodeLookup:c}=r.getState(),v=a(u.id),C=Array.from(c.values()),y=u.type==="LANE",A=C.filter(w=>w.id!==u.id&&(y?w.type==="LANE"&&!w.parentId:w.type==="LANE")),h=xt(v,A);if(h){p(v,h,C);return}if(u.parentId){let w=a(u.parentId),{x:L,y:I}=Ae(w),P={x:L+((x=u.position.x)!=null?x:0),y:I+((k=u.position.y)!=null?k:0)},se=e.map(j=>j.id===u.id?_(N({},j),{position:P,parentId:void 0}):j);se=Ye(u.parentId,se),t(Se(se))}}}};var $r=require("@xyflow/react"),Lt=require("react");function Zr(e,t,o=5){var l,d,E,f,m,p,g,T;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(b=>b.id===e.id);if(!n||!e.position)return r;let i={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=(E=n.measured)==null?void 0:E.height)!=null?f:0),width:(p=(m=n.measured)==null?void 0:m.width)!=null?p:0,height:(T=(g=n.measured)==null?void 0:g.height)!=null?T:0},a=o,s=o;return t.filter(b=>b.id!==n.id).reduce((b,u)=>{var L,I,P,se,j,Qe,ze,Fe;let c={left:u.position.x,right:u.position.x+((I=(L=u.measured)==null?void 0:L.width)!=null?I:0),top:u.position.y,bottom:u.position.y+((se=(P=u.measured)==null?void 0:P.height)!=null?se:0),width:(Qe=(j=u.measured)==null?void 0:j.width)!=null?Qe:0,height:(Fe=(ze=u.measured)==null?void 0:ze.height)!=null?Fe:0},v=Math.abs(i.left-c.left);v<s&&(b.snapPosition.x=c.left,b.vertical=c.left,s=v);let C=Math.abs(i.right-c.right);C<s&&(b.snapPosition.x=c.right-i.width,b.vertical=c.right,s=C);let y=Math.abs(i.left-c.right);y<s&&(b.snapPosition.x=c.right,b.vertical=c.right,s=y);let A=Math.abs(i.right-c.left);A<s&&(b.snapPosition.x=c.left-i.width,b.vertical=c.left,s=A);let h=Math.abs(i.top-c.top);h<a&&(b.snapPosition.y=c.top,b.horizontal=c.top,a=h);let x=Math.abs(i.bottom-c.top);x<a&&(b.snapPosition.y=c.top-i.height,b.horizontal=c.top,a=x);let k=Math.abs(i.bottom-c.bottom);k<a&&(b.snapPosition.y=c.bottom-i.height,b.horizontal=c.bottom,a=k);let w=Math.abs(i.top-c.bottom);return w<a&&(b.snapPosition.y=c.bottom,b.horizontal=c.bottom,a=w),b},r)}var Xr=()=>{let[e,t]=(0,Lt.useState)(void 0),[o,r]=(0,Lt.useState)(void 0),n=(0,Lt.useCallback)((i,a)=>{var s,l;if(t(void 0),r(void 0),i.length===1&&i[0].type==="position"&&i[0].dragging&&i[0].position){let d=Zr(i[0],a);i[0].position.x=(s=d.snapPosition.x)!=null?s:i[0].position.x,i[0].position.y=(l=d.snapPosition.y)!=null?l:i[0].position.y,t(d.horizontal),r(d.vertical)}return(0,$r.applyNodeChanges)(i,a)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};var en=require("@xyflow/react"),Vo=require("uuid");var jr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},Jr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},qr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],a="",s="",l="";if(o.length){switch(o[1]){case"<start>":a="start-event";break;case"<end>":a="end-event";break}e=e.replace(o[1],"")}return r.length&&(a="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(a="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:a,label:s}),{step:e,type:a,label:s,edgeLabel:l}},li=e=>{e=e||"";let t=e.trim().split(`
|
|
2
|
-
`),o={},r=[];return t.forEach(n=>{n=n||"";let i=n.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=qr(i[0],o),s=qr(i[1],o);a&&s&&r.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},Qr=e=>{let{components:t,connections:o}=li(e);return{nodes:t,edges:o}};var tn=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,en.useReactFlow)();return{createDiagram:n=>{let{nodes:i,edges:a}=Qr(n),s=[],l=new Map;for(let[m,p]of Object.entries(i)){let g=(0,Vo.v7)(),T=jr[p.type],b=Jr[p.type];l.set(m,g);let u=Y[T].MIN_WIDTH,
|
|
1
|
+
"use strict";var Wa=Object.create;var vt=Object.defineProperty,Ya=Object.defineProperties,Ka=Object.getOwnPropertyDescriptor,Za=Object.getOwnPropertyDescriptors,$a=Object.getOwnPropertyNames,Gt=Object.getOwnPropertySymbols,Xa=Object.getPrototypeOf,Io=Object.prototype.hasOwnProperty,jo=Object.prototype.propertyIsEnumerable;var qo=(e,t,o)=>t in e?vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))Io.call(t,o)&&qo(e,o,t[o]);if(Gt)for(var o of Gt(t))jo.call(t,o)&&qo(e,o,t[o]);return e},_=(e,t)=>Ya(e,Za(t));var et=(e,t)=>{var o={};for(var r in e)Io.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Gt)for(var r of Gt(e))t.indexOf(r)<0&&jo.call(e,r)&&(o[r]=e[r]);return o};var qa=(e,t)=>{for(var o in t)vt(e,o,{get:t[o],enumerable:!0})},Jo=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of $a(t))!Io.call(e,n)&&n!==o&&vt(e,n,{get:()=>t[n],enumerable:!(r=Ka(t,n))||r.enumerable});return e};var ja=(e,t,o)=>(o=e!=null?Wa(Xa(e)):{},Jo(t||!e||!e.__esModule?vt(o,"default",{value:e,enumerable:!0}):o,e)),Ja=e=>Jo(vt({},"__esModule",{value:!0}),e);var Li={};qa(Li,{ActivityVariant:()=>Ut,ComplexVariant:()=>Wt,ElementType:()=>zt,ExclusiveVariant:()=>Yt,GatewayVariant:()=>Ie,Modeler:()=>ki,RoutingVariant:()=>Ft,useSelectionUtils:()=>mt});module.exports=Ja(Li);var Ht=require("lecom-ui"),Bt=require("react/jsx-runtime");function Qo({children:e}){return(0,Bt.jsxs)(Ht.TooltipProvider,{children:[(0,Bt.jsx)(Ht.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}var X=require("@xyflow/react"),ya=require("lecom-ui"),se=require("react"),Ta=require("use-debounce");var zt=(n=>(n.ACTIVITY="activity",n.ROUTING="routing",n.GATEWAY="gateway",n.SUB_PROCESS="sub_process",n))(zt||{}),Ut=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(Ut||{}),Ft=(l=>(l.SIMPLE="simple",l.LOOP="loop",l.SCRIPT="script",l.COMPLEX="complex",l.EXCLUSIVE="exclusive",l.PARALLEL="parallel",l.FINAL="final",l.TO_SUB_PROCESS="to_sub_process",l))(Ft||{}),Wt=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Wt||{}),Yt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Yt||{});var st=require("lucide-react");var Fe=require("react/jsx-runtime"),Kt=({size:e=24,className:t})=>(0,Fe.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Fe.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Fe.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Fe.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Fe.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var Ao=require("react/jsx-runtime"),tt=({size:e=24,className:t})=>(0,Ao.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,Ao.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"),$t=({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"),er=({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 tr=require("clsx"),or=require("tailwind-merge");function S(...e){return(0,or.twMerge)((0,tr.clsx)(e))}var Nt=(e,t)=>e<t?t:e;var yt=require("react/jsx-runtime"),rr=({size:e=24,className:t})=>(0,yt.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:S("stroke-2",t),children:[(0,yt.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,yt.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Xt=require("react/jsx-runtime"),nr=({size:e=24,className:t})=>(0,Xt.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Xt.jsx)("g",{children:(0,Xt.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 So=require("react/jsx-runtime"),qt=({size:e=24,className:t})=>(0,So.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,So.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 ko=require("react/jsx-runtime"),Tt=({size:e=24,className:t})=>(0,ko.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:S("stroke-2",t),children:(0,ko.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"),ar=({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 De=require("react/jsx-runtime"),ir=({size:e=24,className:t})=>(0,De.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,De.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,De.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,De.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,De.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,De.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var We=require("react/jsx-runtime"),sr=({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 V=(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))(V||{});var jt={SCRIPT:{icon:st.ScrollText},SUBPROCESS:{icon:st.SquarePlus}};var Jt={LOOP:{icon:st.RotateCcw}},Ie=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(Ie||{}),Qt={EXCLUSIVE:{icon:rt},PARALLEL:{icon:$t},COMPLEX:{icon:Zt}};var Lo=ja(require("@dagrejs/dagre"),1),pr=require("@xyflow/react"),mr=require("lodash");var Qa={MIN_WIDTH:36,MIN_HEIGHT:36},ei={MIN_WIDTH:36,MIN_HEIGHT:36},ti={MIN_WIDTH:56,MIN_HEIGHT:56},eo={MIN_WIDTH:176,MIN_HEIGHT:96},to={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},re={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},oo={MIN_WIDTH:176,MIN_HEIGHT:64},oi={MIN_WIDTH:128,MIN_HEIGHT:64},Y={START_EVENT:Qa,END_EVENT:ei,GATEWAY:ti,TASK:eo,LANE:re,ANNOTATION:oo,UNSUPPORTED:oi};var lr=require("lodash");var Ae=e=>{var t,o,r,n,i,a,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:(a=(i=e.measured)==null?void 0:i.width)!=null?a:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},Se=e=>(0,lr.orderBy)(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),dr=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:i}=Ae(t);return{x:o-n,y:r-i}};var lt=({parentId:e,nodes:t,includeTypes:o=[...Object.values(V)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),ri=(e,t)=>{let{x:o,y:r}=Ae(e),{x:n,y:i}=Ae(t),a=o-n,s=r-i;return Math.sqrt(a*a+s*s)},ni=(e,t)=>{let{x:o,y:r,w:n,h:i}=Ae(e),{x:a,y:s,w:l,h:c}=Ae(t);return o<a+l&&a<o+n&&r<s+c&&s<r+i},xt=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&ni(e,n)){let i=ri(e,n);i<r&&(r=i,o=n)}return o},cr=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,i;return Math.max(o,(i=(n=r.measured)==null?void 0:n.width)!=null?i:0)},0);var ur=(e=[],t=[],o="LR")=>{let r=new Lo.default.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>r.setNode(i,{width:a,height:s})),t.forEach(i=>r.setEdge(i.source,i.target)),Lo.default.layout(r),{nodes:e.map(i=>{let a=r.node(i.id);return _(N({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},Ye=(e,t)=>{var m,p;let o=[...t],r=o.find(g=>g.id===e);if(!r)return o;let n=o.filter(g=>g.parentId===e&&g.type==="LANE");if(n.length===0)return o;let i=(0,mr.orderBy)(n,["position.y"]),a=Math.max((p=(m=r.measured)==null?void 0:m.width)!=null?p:0,to.MIN_WIDTH),s=cr(e,i)||re.MIN_WIDTH,l=Math.max(a,s),c=0,E=0;i.forEach(g=>{var T,b,u,d;o=o.map(v=>v.id===g.id?_(N({},v),{width:l-re.HEADER_WIDTH,measured:_(N({},v.measured),{width:l-re.HEADER_WIDTH}),position:{x:re.HEADER_WIDTH,y:c}}):v),c+=(b=(T=g.measured)==null?void 0:T.height)!=null?b:0,E+=(d=(u=g.measured)==null?void 0:u.height)!=null?d:0}),o=o.map(g=>g.id===e?_(N({},g),{height:E,width:l,measured:_(N({},g.measured),{height:E,width:l})}):g);let f=o.find(g=>g.id===e);return f!=null&&f.parentId&&(o=Ye(f.parentId,o)),o},fr=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},ai=50,gr=(e,t=ai)=>{let o=(0,pr.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Er=require("zustand"),G=(0,Er.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 Ct=require("@xyflow/react");var ye=require("@xyflow/react");var be=require("@xyflow/react"),ve=require("lecom-ui"),Nr=require("lucide-react");var ro=require("react"),br=(0,ro.createContext)(null),hr=br.Provider,vr=()=>{let e=(0,ro.useContext)(br);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};var Ke=require("react/jsx-runtime"),_t=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,ve.useTranslation)(),{getNode:r,getEdge:n,getNodes:i,getEdges:a}=(0,be.useReactFlow)(),{onConfigureElement:s}=vr(),l=d=>{let v=i(),C=a(),y=(0,be.getIncomers)(d,v,C),A=(0,be.getOutgoers)(d,v,C),h=y.some(k=>k.type==="START_EVENT"),x=A.some(k=>k.type==="END_EVENT");return h?"start":x?"end":"between"},c=d=>{var k,w,L,I;let v=i(),C=a(),y=r(d.source),A=r(d.target);if(!y||!A)return"simple";if((0,be.getOutgoers)(y,v,C).some(P=>P.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((k=y.data)==null?void 0:k.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let P=(w=y.data)==null?void 0:w.variant,j=(L=y.data)==null?void 0:L.attribute;return A.type==="TASK"&&((I=A.data)==null?void 0:I.variant)==="SUBPROCESS"?"to_sub_process":P==="SCRIPT"?"script":j==="LOOP"?"loop":"simple"}return"simple"},E=d=>{var k;let v=r(d.source);if(!v||v.type!=="GATEWAY"||((k=v.data)==null?void 0:k.variant)!=="COMPLEX")return;let C=i(),y=a(),A=(0,be.getIncomers)(v,C,y),h=!1,x=!1;if(A.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(x=!0))}),h&&x)return"script_loop";if(h)return"script";if(x)return"loop"},f=d=>{var k;let v=r(d.source);if(!v||v.type!=="GATEWAY"||((k=v.data)==null?void 0:k.variant)!=="EXCLUSIVE")return;let C=i(),y=a(),A=(0,be.getIncomers)(v,C,y),h=!1,x=!1;if(A.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(x=!0))}),h)return"script";if(x)return"loop"},m=d=>{var x,k;if(d.type!=="GATEWAY")return;let v=i(),C=a(),y=(0,be.getIncomers)(d,v,C),A=!1,h=!1;if(y.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(A=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(h=!0))}),((x=d.data)==null?void 0:x.variant)==="COMPLEX"){if(A&&h)return"script_loop";if(A)return"script";if(h)return"loop"}else if(((k=d.data)==null?void 0:k.variant)==="EXCLUSIVE"){if(A)return"script";if(h)return"loop"}},p=d=>(0,be.getOutgoers)(d,i(),a()).map(y=>{var A,h;return{id:y.id,type:y.type,variant:(A=y.data)==null?void 0:A.variant,label:(h=y.data)==null?void 0:h.label}}),g=d=>a().filter(y=>y.source===d.id).map(y=>{var A;return{id:y.id,type:"routing",variant:c(y),label:(A=y.data)==null?void 0:A.label,target:r(y.target)}}),T=()=>{var v,C,y,A,h;let d=r(e);if(d){if(d.type==="TASK"&&((v=d.data)==null?void 0:v.variant)==="SUBPROCESS"){s==null||s({id:d.id,type:"sub_process",variant:l(d),label:(C=d.data)==null?void 0:C.label,targets:p(d),edgeTargets:g(d)});return}if(d.type!=="GATEWAY"){s==null||s({id:d.id,type:"activity",variant:l(d),label:(y=d.data)==null?void 0:y.label,targets:p(d),edgeTargets:g(d)});return}s==null||s({id:d.id,type:"gateway",variant:((A=d.data)==null?void 0:A.variant)||"EXCLUSIVE",label:(h=d.data)==null?void 0:h.label,subVariant:m(d),targets:p(d)})}},b=()=>{let d=n(e);if(d){let v=c(d),C;v==="complex"?C=E(d):v==="exclusive"&&(C=f(d)),s==null||s({id:d.id,type:"routing",variant:v,subVariant:C,target:r(d.target)}),console.log({id:d.id,type:"routing",variant:v,subVariant:C,target:r(d.target)})}};return(0,Ke.jsxs)(ve.Tooltip,{children:[(0,Ke.jsx)(ve.TooltipTrigger,{asChild:!0,children:(0,Ke.jsx)(ve.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":T();break;case"edge":b();break}},children:(0,Ke.jsx)(Nr.PencilIcon,{size:16})})}),(0,Ke.jsx)(ve.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var yr=require("@xyflow/react"),Ne=require("lecom-ui"),Tr=require("lucide-react"),Ze=require("react/jsx-runtime"),ao=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Ne.useTranslation)(),{deleteElements:r}=(0,yr.useReactFlow)();return(0,Ze.jsxs)(Ne.Tooltip,{children:[(0,Ze.jsx)(Ne.TooltipTrigger,{asChild:!0,children:(0,Ze.jsx)(Ne.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Ze.jsx)(Tr.TrashIcon,{size:16})})}),(0,Ze.jsx)(Ne.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var wt=require("react/jsx-runtime"),dt=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=et(n,["edgeId","edgeType"]);var s;let i=[{component:(0,wt.jsx)(ao,{elementId:e,elementType:"edge"})}],a={SEQUENCE_EDGE:[{component:(0,wt.jsx)(_t,{elementId:e,elementType:"edge"})},...i],MESSAGE_EDGE:[...i],ANNOTATION_EDGE:[...i]};return(0,wt.jsx)("div",_(N({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=a[t])==null?void 0:s.map((l,c)=>(0,wt.jsx)("div",{children:l.component},c))}))};var $e=require("react/jsx-runtime"),so={type:"ANNOTATION_EDGE",zIndex:2e3},xr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,selected:s,data:l})=>{let c=(0,ye.useNodes)(),{zoom:E}=(0,ye.useViewport)(),{isMultipleSelection:f}=G(),m=c.find(v=>v.id===t),p=c.find(v=>v.id===o),[g,T,b]=(0,ye.getStraightPath)({sourceX:r,sourceY:n,targetX:i,targetY:a}),u=s||(m==null?void 0:m.selected)||(p==null?void 0:p.selected),d=1/E;return(0,$e.jsxs)("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":u}),children:[(0,$e.jsx)(ye.BaseEdge,{id:e,path:g,strokeDasharray:4,className:S("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)]":u&&!(l!=null&&l.hasError)})}),(0,$e.jsx)(ye.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(${T}px, ${b}px)`},children:s&&!f&&(0,$e.jsx)(dt,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${d})`}})})})]})};var ne=require("@xyflow/react"),_r=require("react");var Xe=require("react");var Po=require("react/jsx-runtime"),ee=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:i,style:a})=>{let s=(0,Xe.useRef)(null),[l,c]=(0,Xe.useState)(!1);(0,Xe.useEffect)(()=>{c(r!=null?r:!1)},[r]),(0,Xe.useEffect)(()=>{if(l&&s.current){s.current.focus();let p=document.createRange();p.selectNodeContents(s.current),p.collapse(!1);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(p))}},[l]);let E=p=>{p.stopPropagation(),c(!0)},f=p=>{let g=p.currentTarget.innerText;t&&g.length>=t&&p.preventDefault()},m=p=>{c(!1),n==null||n(),o==null||o(p.currentTarget.innerText)};return(0,Po.jsx)("div",{className:S("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",i,{"border border-dashed border-grey-400":l}),style:a,onDoubleClick:E,children:(0,Po.jsx)("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:m,children:e})})};var Re=require("react/jsx-runtime"),Me={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:ne.MarkerType.ArrowClosed},markerEnd:{type:ne.MarkerType.Arrow},data:{label:""}},wr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:c,selected:E})=>{let f=(0,ne.useNodes)(),{zoom:m}=(0,ne.useViewport)(),{updateEdgeData:p}=(0,ne.useReactFlow)(),{isMultipleSelection:g}=G(),[T,b]=(0,_r.useState)(!1),u=f.find(P=>P.id===t),d=f.find(P=>P.id===o),[v,C,y]=(0,ne.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),A=E||(u==null?void 0:u.selected)||(d==null?void 0:d.selected),h=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",x=T||(c==null?void 0:c.label.trim().length)>0,k=1/m,w=()=>{b(!0)},L=()=>{b(!1)},I=P=>{p(e,{label:P.trim()})};return(0,Re.jsxs)("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:L,onDoubleClick:w,children:[(0,Re.jsx)(ne.BaseEdge,{id:e,path:v,markerEnd:`url(#${h})`,className:S("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(c!=null&&c.hasError)})}),(0,Re.jsx)(ne.EdgeLabelRenderer,{children:(0,Re.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C}px, ${y}px)`},children:[E&&!g&&(0,Re.jsx)(dt,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${k})`}}),x&&(0,Re.jsx)(ee,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:T,onChange:I})]})})]})};var Cr=({setEdges:e})=>{let{getNode:t}=(0,Ct.useReactFlow)();return{isValidConnection:n=>{let i=t(n.source),a=t(n.target);if((i==null?void 0:i.id)===(a==null?void 0:a.id))return!1;switch(i==null?void 0:i.type){case"START_EVENT":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"END_EVENT":return(a==null?void 0:a.type)==="ANNOTATION";case"TASK":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"GATEWAY":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"LANE":return(a==null?void 0:a.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(i=>{let a=t(n.target);return(a==null?void 0:a.type)==="ANNOTATION"?(0,Ct.addEdge)(N(N({},n),so),i):(0,Ct.addEdge)(N(N({},n),Me),i)})}}};var Do=require("react"),Mr=require("lecom-ui"),Vr=require("@xyflow/react");var It=(e=[])=>e.filter(t=>t.type==="START_EVENT"),qe=(e=[])=>e.filter(t=>t.type==="END_EVENT"),Ve=(e=[])=>e.filter(t=>t.type==="TASK")||[],Ir=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Ar=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),lo=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Sr=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),me=(e,t=[])=>t.filter(o=>o.source===e),At=(e,t=[])=>t.filter(o=>o.target===e),kr=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(i=>i.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Lr=(e,t)=>{let o=me(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(i=>i.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},Pr=e=>e?/\w/g.test(e.trim()):!1,M=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:[]}},Te=(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)}},Dr=(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 St=[{id:"start_event_not_found",validate:e=>{let t=It(e.nodes);return M({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=qe(e.nodes);return M({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=It(e.nodes),o=t.length===1;if(t.length===0)return M({isValid:!0});if(!o)return M({isValid:!1,nodeIds:t.map(i=>i.id)});let r=me(t[0].id,e.edges);if(!(r.length<=1)){let i=[...t.map(a=>a.id),...r.map(a=>a.target)];return M({isValid:!1,nodeIds:[...new Set(i)]})}return M({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=Ve(e.nodes),o=Te(t,r=>me(r.id,e.edges).length<=2);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=Ve(e.nodes),o=Te(t,r=>!!r.label&&r.label.trim()!=="");return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=Ve(e.nodes),r=Te(o,n=>!n.label||n.label.length<=60);return M({isValid:r.isValid,nodeIds:r.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=Ve(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let i=n.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(i=>r.push(i.id));return M({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=lo(e.nodes),o=[],r=[];for(let n of t){let i=me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"events_nested",validate:e=>{let t=[...It(e.nodes),...qe(e.nodes)],o=[],r=[];for(let n of t){let i=me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(a.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=qe(e.nodes),o=[],r=[];for(let n of t){let i=At(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.source);if(s&&s.type==="TASK"){let l=me(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>r.push(c.id)))}}}return M({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Sr(e.nodes),o=Te(t,n=>me(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>me(n,e.edges).map(i=>i.id));return M({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=Ve(e.nodes),o=Te(t,r=>!r.label||Pr(r.label));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var a,s;if(!((a=e==null?void 0:e.nodes)!=null&&a.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return M({isValid:!0});let t=qe(e.nodes)[0];if(!t)return M({isValid:!0});let o=At(t.id,e.edges);if(!o.length)return M({isValid:!0});let n=Ve(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Te(n,l=>!kr(l.id,e));return M({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=Ve(e.nodes),o=qe(e.nodes)[0];if(!o)return M({isValid:!0});let r=t.filter(l=>{let c=At(l.id,e.edges),E=me(l.id,e.edges),f=c.some(p=>{var g;return((g=e.nodes.find(T=>T.id===p.source))==null?void 0:g.type)==="START_EVENT"}),m=E.some(p=>{var g;return((g=e.nodes.find(T=>T.id===p.target))==null?void 0:g.type)==="END_EVENT"});return f&&m}),n=At(o.id,e.edges),i=n.length>1,a=n.map(l=>l.source),s={isValid:r.length===0&&!i,nodeIds:[...r.map(l=>l.id),...i?a:[]]};return M(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=lo(e.nodes),o=[],r=[];for(let n of t){let i=me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(a.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"gateway_missing_output_streams",validate:e=>{let t=lo(e.nodes),o=Te(t,r=>me(r.id,e.edges).length>=1);return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...It(e.nodes),...qe(e.nodes)],o=[],r=[];for(let n of t){let i=me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.id))}}return M({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:r})}},{id:"script_in_final_activity",validate:e=>{let t=Ir(e.nodes),o=Te(t,r=>!Lr(r.id,e));return M({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Ar(e.nodes),o=Te(t,r=>{var n,i;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((i=r.properties)==null?void 0:i.subprocessRef)!==""});return M({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Rr=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let r of St){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 Or=()=>{let{t:e}=(0,Mr.useTranslation)(),[t,o]=(0,Do.useState)(null),{setNodes:r,setEdges:n,getNodes:i,getEdges:a}=(0,Vr.useReactFlow)(),[s,l]=(0,Do.useState)(!1);return{validationResult:t,validateDiagram:m=>{let p=Dr(m.nodes,m.edges),g=Rr(p),T=g.errors.map(b=>_(N({},b),{message:e(`validation.errors.${b.id}`)}));return s||l(!0),{isValid:g.isValid,errors:T}},handleValidationComplete:m=>{if(o(m),!m)return;let p=[],g=[];m.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(x=>p.push(x)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(x=>g.push(x))});let T=[...new Set(p)];r(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:!1})}))),n(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:!1})})));let b=i(),u=a(),d=new Set(T),v=new Set;m.errors.forEach(h=>{var w,L;let x=St.find(I=>I.id===h.id);(x==null?void 0:x.highlightRelatedEdges)!==!1&&((w=h.edgeIds)==null||w.forEach(I=>v.add(I)),(L=h.nodeIds)==null||L.forEach(I=>{u.forEach(P=>{(P.source===I||P.target===I)&&v.add(P.id)})}))});let C=new Set,y=new Set,A=new Set;b.forEach(h=>{h.type==="START_EVENT"?C.add(h.id):h.type==="END_EVENT"&&y.add(h.id)}),u.forEach(h=>{C.has(h.source)&&A.add(h.target),y.has(h.target)&&A.add(h.source)}),A.forEach(h=>{var x,k;if(d.has(h)){let w=(x=m.errors.find(I=>{var P;return(P=I.nodeIds)==null?void 0:P.includes(h)}))==null?void 0:x.id;((k=St.find(I=>I.id===w))==null?void 0:k.highlightRelatedEdges)!==!1&&u.forEach(I=>{I.source===h&&y.has(I.target)&&(d.add(I.target),v.add(I.id)),I.target===h&&C.has(I.source)&&(d.add(I.source),v.add(I.id))})}}),d.size>0&&r(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:d.has(x.id)})}))),v.size>0&&n(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:v.has(x.id)})})))},clearValidation:()=>{o(null),l(!1),r(m=>m.map(p=>_(N({},p),{data:_(N({},p.data),{hasError:!1})}))),n(m=>m.map(p=>_(N({},p),{data:_(N({},p.data),{hasError:!1})})))},isAutoValidationEnabled:s}};var Hr=require("@xyflow/react"),Br=require("react"),Ro=require("uuid");var si=15,Gr="bpmn:selection",zr=({offset:e=si}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=(0,Hr.useReactFlow)();(0,Br.useEffect)(()=>{let i=s=>{var p;s.preventDefault();let l=t(),c=r(),E=l.filter(g=>g.selected);if(!E.length)return;let f=c.filter(g=>E.some(T=>T.id===g.source)&&E.some(T=>T.id===g.target)),m={nodes:E,edges:f};(p=s.clipboardData)==null||p.setData(Gr,JSON.stringify(m))},a=s=>{var m,p;s.preventDefault();let l=JSON.parse(((m=s.clipboardData)==null?void 0:m.getData(Gr))||"{}");if(!((p=l.nodes)!=null&&p.length))return;let c=new Map,E=l.nodes.map(g=>{let T=(0,Ro.v7)();return c.set(g.id,T),_(N({},g),{id:T,selected:!0,position:{x:g.position.x+e,y:g.position.y+e}})}),f=l.edges.map(g=>_(N({},g),{id:(0,Ro.v7)(),selected:!0,source:c.get(g.source)||g.source,target:c.get(g.target)||g.target}));o(g=>[...g.map(T=>_(N({},T),{selected:!1})),...E]),n(g=>[...g.map(T=>_(N({},T),{selected:!1})),...f])};return document.addEventListener("copy",i),document.addEventListener("paste",a),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",a)}},[t,o,r,n,e])};var co=require("@xyflow/react"),Mo=require("uuid");var Ur=require("zustand"),ct=(0,Ur.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var le=require("@xyflow/react"),Fr=require("react");var Oe=require("react/jsx-runtime"),Vl={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:le.MarkerType.Arrow},data:{label:""}},Wr=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:c,selected:E})=>{let f=(0,le.useNodes)(),{zoom:m}=(0,le.useViewport)(),{updateEdgeData:p}=(0,le.useReactFlow)(),{isMultipleSelection:g}=G(),[T,b]=(0,Fr.useState)(!1),u=f.find(P=>P.id===t),d=f.find(P=>P.id===o),[v,C,y]=(0,le.getSmoothStepPath)({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),A=E||(u==null?void 0:u.selected)||(d==null?void 0:d.selected),h=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",x=T||(c==null?void 0:c.label.trim().length)>0,k=1/m,w=()=>{b(!0)},L=()=>{b(!1)},I=P=>{p(e,{label:P.trim()})};return(0,Oe.jsxs)("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:L,onDoubleClick:w,children:[(0,Oe.jsx)(le.BaseEdge,{id:e,path:v,markerEnd:`url(#${h})`,strokeDasharray:4,className:S("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(c!=null&&c.hasError)})}),(0,Oe.jsx)(le.EdgeLabelRenderer,{children:(0,Oe.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C}px, ${y}px)`},children:[E&&!g&&(0,Oe.jsx)(dt,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${k})`}}),x&&(0,Oe.jsx)(ee,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:T,onChange:I})]})})]})};var kt=require("react/jsx-runtime"),Yr=({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 Kr=({nodes:e,setNodes:t,setEdges:o})=>{let r=(0,co.useStoreApi)(),{draggableNode:n,setDraggableNode:i}=ct(),{getInternalNode:a,screenToFlowPosition:s}=(0,co.useReactFlow)(),l=b=>{let u="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(d=>d.map(v=>_(N({},v),{className:v.id===b?u:""})))},c=()=>{let{nodeLookup:b}=r.getState();return Array.from(b.values())},E=b=>{let u=a(b.id),d=c();if(b.type==="LANE"){if(lt({parentId:b.id,nodes:e,includeTypes:["LANE"]})){l();return}let x=d.filter(L=>L.id!==b.id&&L.type==="LANE"&&!L.parentId),k=xt(u,x);if(!k){l();return}if(lt({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let C=d.filter(h=>h.id!==b.id&&h.type==="LANE"),y=xt(u,C);if(!y){l();return}if(lt({parentId:y.id,nodes:e,includeTypes:["LANE"]})){l();return}l(y.id)},f=b=>{b.preventDefault(),b.dataTransfer.dropEffect="move"},m=(b,u)=>{b.preventDefault(),E(u)},p=(b,u,d)=>{var x,k;let v=w=>w.map(L=>_(N({},L),{className:void 0}));if(b.parentId===u.id){let w=Ye(u.id,d);t(Se(v(w)));return}if(b.type==="LANE"){if(lt({parentId:u.id,nodes:d,excludeTypes:["LANE"]}))return;let I=d.filter(J=>J.parentId===u.id).reduce((J,Qe)=>{var ze,Ue;return J+((Ue=(ze=Qe.measured)==null?void 0:ze.height)!=null?Ue:0)},0),P={x:re.HEADER_WIDTH,y:I},j=d.map(J=>J.id===b.id?_(N({},J),{parentId:u.id,position:P,className:void 0}):_(N({},J),{className:void 0}));j=Ye(u.id,j),t(Se(j));return}if(lt({parentId:u.id,nodes:d,includeTypes:["LANE"]})){let w;if(b.parentId){let I=a(b.parentId),{x:P,y:j}=Ae(I);w={x:P+((x=b.position.x)!=null?x:0),y:j+((k=b.position.y)!=null?k:0)}}let L=d.map(I=>I.id===b.id?_(N({},I),{position:w!=null?w:I.position,parentId:void 0,className:void 0}):_(N({},I),{className:void 0}));t(Se(L));return}let A=dr(b,u),h=d.map(w=>w.id===b.id?_(N({},w),{parentId:u.id,position:A,className:void 0}):_(N({},w),{className:void 0}));t(Se(h))};return{onDragOver:f,onDrop:b=>{if(b.preventDefault(),!(n!=null&&n.type))return;let u=s({x:b.clientX,y:b.clientY}),d={width:Y[n.type].MIN_WIDTH,height:Y[n.type].MIN_HEIGHT},v={id:(0,Mo.v7)(),type:n.type,position:u,measured:d,data:{label:"",variant:n.variant,attribute:n.attribute}},C=_(N({},v),{internals:{positionAbsolute:u}}),y=c(),A=n.type==="LANE",h=y.filter(w=>A?w.type==="LANE"&&!w.parentId:w.type==="LANE"),x=xt(C,h);x?p(C,x,[...y,C]):t(w=>{let L=w.concat(v);return Se(L)});let k=b.dataTransfer.getData("sourceId");if(k){let w={id:(0,Mo.v7)(),source:k,target:v.id};if(n.type==="ANNOTATION"){o(L=>L.concat(N(N({},w),so)));return}o(L=>L.concat(N(N({},w),Me)))}i(null)},onNodeDrag:m,onNodeDragStop:async(b,u)=>{var x,k;let{nodeLookup:d}=r.getState(),v=a(u.id),C=Array.from(d.values()),y=u.type==="LANE",A=C.filter(w=>w.id!==u.id&&(y?w.type==="LANE"&&!w.parentId:w.type==="LANE")),h=xt(v,A);if(h){p(v,h,C);return}if(u.parentId){let w=a(u.parentId),{x:L,y:I}=Ae(w),P={x:L+((x=u.position.x)!=null?x:0),y:I+((k=u.position.y)!=null?k:0)},j=e.map(J=>J.id===u.id?_(N({},J),{position:P,parentId:void 0}):J);j=Ye(u.parentId,j),t(Se(j))}}}};var $r=require("@xyflow/react"),Lt=require("react");function Zr(e,t,o=5){var l,c,E,f,m,p,g,T;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(b=>b.id===e.id);if(!n||!e.position)return r;let i={left:e.position.x,right:e.position.x+((c=(l=n.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((f=(E=n.measured)==null?void 0:E.height)!=null?f:0),width:(p=(m=n.measured)==null?void 0:m.width)!=null?p:0,height:(T=(g=n.measured)==null?void 0:g.height)!=null?T:0},a=o,s=o;return t.filter(b=>b.id!==n.id).reduce((b,u)=>{var L,I,P,j,J,Qe,ze,Ue;let d={left:u.position.x,right:u.position.x+((I=(L=u.measured)==null?void 0:L.width)!=null?I:0),top:u.position.y,bottom:u.position.y+((j=(P=u.measured)==null?void 0:P.height)!=null?j:0),width:(Qe=(J=u.measured)==null?void 0:J.width)!=null?Qe:0,height:(Ue=(ze=u.measured)==null?void 0:ze.height)!=null?Ue:0},v=Math.abs(i.left-d.left);v<s&&(b.snapPosition.x=d.left,b.vertical=d.left,s=v);let C=Math.abs(i.right-d.right);C<s&&(b.snapPosition.x=d.right-i.width,b.vertical=d.right,s=C);let y=Math.abs(i.left-d.right);y<s&&(b.snapPosition.x=d.right,b.vertical=d.right,s=y);let A=Math.abs(i.right-d.left);A<s&&(b.snapPosition.x=d.left-i.width,b.vertical=d.left,s=A);let h=Math.abs(i.top-d.top);h<a&&(b.snapPosition.y=d.top,b.horizontal=d.top,a=h);let x=Math.abs(i.bottom-d.top);x<a&&(b.snapPosition.y=d.top-i.height,b.horizontal=d.top,a=x);let k=Math.abs(i.bottom-d.bottom);k<a&&(b.snapPosition.y=d.bottom-i.height,b.horizontal=d.bottom,a=k);let w=Math.abs(i.top-d.bottom);return w<a&&(b.snapPosition.y=d.bottom,b.horizontal=d.bottom,a=w),b},r)}var Xr=()=>{let[e,t]=(0,Lt.useState)(void 0),[o,r]=(0,Lt.useState)(void 0),n=(0,Lt.useCallback)((i,a)=>{var s,l;if(t(void 0),r(void 0),i.length===1&&i[0].type==="position"&&i[0].dragging&&i[0].position){let c=Zr(i[0],a);i[0].position.x=(s=c.snapPosition.x)!=null?s:i[0].position.x,i[0].position.y=(l=c.snapPosition.y)!=null?l:i[0].position.y,t(c.horizontal),r(c.vertical)}return(0,$r.applyNodeChanges)(i,a)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};var en=require("@xyflow/react"),Vo=require("uuid");var jr={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},Jr={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},qr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],a="",s="",l="";if(o.length){switch(o[1]){case"<start>":a="start-event";break;case"<end>":a="end-event";break}e=e.replace(o[1],"")}return r.length&&(a="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(a="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:a,label:s}),{step:e,type:a,label:s,edgeLabel:l}},li=e=>{e=e||"";let t=e.trim().split(`
|
|
2
|
+
`),o={},r=[];return t.forEach(n=>{n=n||"";let i=n.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=qr(i[0],o),s=qr(i[1],o);a&&s&&r.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},Qr=e=>{let{components:t,connections:o}=li(e);return{nodes:t,edges:o}};var tn=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,en.useReactFlow)();return{createDiagram:n=>{let{nodes:i,edges:a}=Qr(n),s=[],l=new Map;for(let[m,p]of Object.entries(i)){let g=(0,Vo.v7)(),T=jr[p.type],b=Jr[p.type];l.set(m,g);let u=Y[T].MIN_WIDTH,d=Y[T].MIN_HEIGHT;s.push({id:g,type:T,data:{label:p.label||"",variant:b,attribute:""},position:{x:0,y:0},width:u,height:d,measured:{width:u,height:d}})}let c=[];for(let m of a){let p=_(N({},Me),{id:(0,Vo.v7)(),source:l.get(m.sourceId)||m.sourceId,target:l.get(m.targetId)||m.targetId});c.push(p)}let{nodes:E,edges:f}=ur(s,c);e(E),t(f),o()}}};var po=require("react"),di={origin:"*",debug:!1};function on(e,t=di){let{origin:o,debug:r}=t,n=(0,po.useCallback)((i,a)=>{r&&console.debug("[postMessage] sending:",{type:i,payload:a}),window.parent.postMessage({type:i,payload:a},o||"*")},[o,r]);return(0,po.useEffect)(()=>{let i=a=>{let{type:s,data:l}=a.data||{};r&&console.debug("[postMessage] received:",a.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,r]),{sendMessage:n}}var rn=require("@xyflow/react");var nn=(e,t)=>{let{getNodes:o,getEdges:r}=(0,rn.useReactFlow)();return{selectElement:a=>{let s=o().map(c=>_(N({},c),{selected:c.id===a})),l=r().map(c=>_(N({},c),{selected:c.id===a}));return e(s),t(l),!0},isReady:()=>!0}};var sn=require("@xyflow/react"),ke=require("react"),ln=require("use-debounce"),ci={nodes:[],edges:[]},pi=500,an=10,dn=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=(0,sn.useReactFlow)(),[n,i]=(0,ke.useState)([ci]),[a,s]=(0,ke.useState)(0),l=n[a],c=a>0,E=a<n.length-1,f=(0,ke.useCallback)(d=>{o(n[d].nodes),r(n[d].edges)},[n,o,r]),m=(0,ke.useCallback)(()=>{if(a>0){let d=a-1;s(d),f(d)}},[a,f]),p=(0,ke.useCallback)(()=>{if(a<n.length-1){let d=a+1;s(d),f(d)}},[n,a,f]),g=d=>{let C=[...n.slice(0,a+1),d],y=C.length>an?C.slice(C.length-an):C;i(y),s(y.length-1)},T=(0,ln.useDebouncedCallback)(()=>{let d=e(),v=t(),C={nodes:d,edges:v};JSON.stringify(l)!==JSON.stringify(C)&&g(C)},pi),b=(0,ke.useCallback)(d=>{if(d==="forceSave"){T();return}d.some(C=>C.type!=="select")&&T()},[T]),u=(0,ke.useCallback)(()=>{i([]),s(0)},[]);return{undo:m,redo:p,saveHistory:b,canUndo:c,canRedo:E,clearHistory:u}};var Oo=require("react/jsx-runtime"),Go=({id:e,className:t})=>(0,Oo.jsx)("marker",{id:e,className:S("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,Oo.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var pt=require("react/jsx-runtime"),cn=()=>(0,pt.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,pt.jsxs)("defs",{children:[(0,pt.jsx)(Go,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,pt.jsx)(Go,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var zo=require("@xyflow/react"),z=require("lecom-ui"),He=require("lucide-react"),Rt=require("react");var pn=require("@xyflow/react"),mi=e=>({unselectAll:e.unselectNodesAndEdges}),mt=()=>{let{unselectAll:e}=(0,pn.useStore)(mi);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};var xe=require("lecom-ui");var Pt=(u=>(u.START_EVENT="START_EVENT",u.END_EVENT="END_EVENT",u.TASK="TASK",u.SUBPROCESS="SUBPROCESS",u.GATEWAY="GATEWAY",u.ANNOTATION="ANNOTATION",u.CONNECTION="CONNECTION",u.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",u.ACTIVITY="ACTIVITY",u.PROCESS_INTERFACE="PROCESS_INTERFACE",u.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",u.VARIANT_ACTIVITY="VARIANT_ACTIVITY",u.AUTO_ACTIVITY="AUTO_ACTIVITY",u.DATA_STORE="DATA_STORE",u.DATA_OBJECT="DATA_OBJECT",u.DATA_OUTPUT="DATA_OUTPUT",u.DATA_INPUT="DATA_INPUT",u))(Pt||{});var _n=require("@xyflow/react"),ft=require("lecom-ui");var mn=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var i;t((i=n.target)==null?void 0:i.result)},r.onerror=n=>{var i;o((i=n.target)==null?void 0:i.error)},r.readAsText(e)});function un({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
|
|
3
3
|
`),i=encodeURI(n);mo(i,`${o}.csv`)}var mo=(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 Tn=require("uuid");var Ho=require("xml-js");var ui={compact:!0,spaces:4},fi=e=>e.replaceAll(`
|
|
4
|
-
`,"
");function fn(e,t=ui){if(e)return JSON.parse((0,Ho.xml2json)(e,_(N({},t),{attributeValueFn:fi})))}function gn(e){return e==null?void 0:e.replaceAll("
"," ")}var hn=require("uuid");var Rd={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},En={script:"SCRIPT",subprocess:"SUBPROCESS"},bn={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var ut=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:i}=r,a=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:a,height:s,measured:{width:a,height:s}}},Ei=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=Y.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=Y.START_EVENT.MIN_HEIGHT,{node:ut({cell:e,type:"START_EVENT"}),status:r,originalType:o}},bi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=Y.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=Y.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=En[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=Nt(e.mxGeometry._attributes.width,Y.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Nt(e.mxGeometry._attributes.height,Y.TASK.MIN_HEIGHT),{node:ut({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},vi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=bn[o],n=["none","inclusive","event-based"],i="imported";return n.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=Y.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=Y.GATEWAY.MIN_HEIGHT,{node:ut({cell:e,type:"GATEWAY",variant:r}),status:i,originalType:t}},Ni=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Nt(e.mxGeometry._attributes.width,Y.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Nt(e.mxGeometry._attributes.height,Y.ANNOTATION.MIN_HEIGHT),{node:ut({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},vn=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Y.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=Y.UNSUPPORTED.MIN_HEIGHT,{node:ut({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Nn=(e,t)=>{let{source:o,target:r}=e._attributes;return _(N({},Me),{id:(0,hn.v7)(),source:t.get(o)||o,target:t.get(r)||r})},yn={TASK:hi,GATEWAY:vi,START_EVENT:Ei,END_EVENT:bi,ANNOTATION:Ni};var yi=e=>{var a;let t=new Map,o=Object.values(Pt),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],i=[];for(let s of r){let l=(0,Tn.v7)(),{type:
|
|
4
|
+
`,"
");function fn(e,t=ui){if(e)return JSON.parse((0,Ho.xml2json)(e,_(N({},t),{attributeValueFn:fi})))}function gn(e){return e==null?void 0:e.replaceAll("
"," ")}var hn=require("uuid");var Rd={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},En={script:"SCRIPT",subprocess:"SUBPROCESS"},bn={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var ut=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:i}=r,a=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:a,height:s,measured:{width:a,height:s}}},Ei=e=>{let{subType:t,style:o}=e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=Y.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=Y.START_EVENT.MIN_HEIGHT,{node:ut({cell:e,type:"START_EVENT"}),status:r,originalType:o}},bi=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r="imported";return["none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=Y.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=Y.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=En[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=Nt(e.mxGeometry._attributes.width,Y.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Nt(e.mxGeometry._attributes.height,Y.TASK.MIN_HEIGHT),{node:ut({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},vi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=bn[o],n=["none","inclusive","event-based"],i="imported";return n.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=Y.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=Y.GATEWAY.MIN_HEIGHT,{node:ut({cell:e,type:"GATEWAY",variant:r}),status:i,originalType:t}},Ni=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Nt(e.mxGeometry._attributes.width,Y.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Nt(e.mxGeometry._attributes.height,Y.ANNOTATION.MIN_HEIGHT),{node:ut({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},vn=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Y.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=Y.UNSUPPORTED.MIN_HEIGHT,{node:ut({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},Nn=(e,t)=>{let{source:o,target:r}=e._attributes;return _(N({},Me),{id:(0,hn.v7)(),source:t.get(o)||o,target:t.get(r)||r})},yn={TASK:hi,GATEWAY:vi,START_EVENT:Ei,END_EVENT:bi,ANNOTATION:Ni};var yi=e=>{var a;let t=new Map,o=Object.values(Pt),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],i=[];for(let s of r){let l=(0,Tn.v7)(),{type:c}=s._attributes,E=yn[c]||vn;t.set((a=s._attributes)==null?void 0:a.id,l),s._attributes.id=l;let{node:f,status:m,originalType:p}=E(s);n.push(f),i.push({originalType:p,type:f.type,variant:f.data.variant,value:gn(f.data.label),status:m})}return{nodes:n,governanceIdToNodeIdMap:t,summary:i}},Ti=(e,t)=>e.filter(n=>{var i;return(i=n._attributes)==null?void 0:i.edge}).map(n=>Nn(n,t)),xi=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=yi(t.root.mxCell),i=Ti(t.root.mxCell,r);return{nodes:o,edges:i,summary:n}},_i=async e=>{let t=await mn(e),o=fn(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},i=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),a=n==null?void 0:n.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},xn=async e=>{try{let t=await _i(e),{nodes:o,edges:r,summary:n}=xi(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};var Cn=require("react/jsx-runtime"),wn=()=>{let{t:e}=(0,ft.useTranslation)(),{toast:t}=(0,ft.useNotificationToast)(),{setNodes:o,setEdges:r,fitView:n}=(0,_n.useReactFlow)(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=s.map(E=>[E.originalType,E.value,e(`adapter.governance.report.status.${E.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,Cn.jsx)(ft.Button,{size:"small",variant:"ghost",onClick:()=>un({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:c,summary:E}=await xn(s);if(o(m=>m.concat(l)),r(m=>m.concat(c)),n(),E.some(m=>m.status==="unsupported")){i(E);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let c=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${c}`)})}}}};var In=require("lecom-ui"),An=require("react");var je=require("react/jsx-runtime"),Sn=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:i}=l,a=et(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,An.useRef)(null),E=m=>{let p=m.target.files;p!=null&&p.length&&i(p),c.current&&(c.current.value="")};return(0,je.jsxs)(je.Fragment,{children:[(0,je.jsx)(In.Button,_(N({onClick:m=>{var p;(p=c.current)==null||p.click(),n==null||n(m)}},a),{children:e})),(0,je.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:E})]})};var Je=require("react/jsx-runtime"),kn=({disabled:e=!1})=>{let{t}=(0,xe.useTranslation)(),{toast:o}=(0,xe.useNotificationToast)(),{createDiagram:r}=wn(),n=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=a=>{let s=a[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}r(s)};return(0,Je.jsxs)(xe.Tooltip,{children:[(0,Je.jsx)(xe.TooltipTrigger,{asChild:!0,children:(0,Je.jsx)(Sn,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:i,children:(0,Je.jsx)(er,{})})}),(0,Je.jsx)(xe.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var R=require("lecom-ui"),Ge=require("lucide-react"),Rn=require("react");var Ln=require("@xyflow/react"),Dt=require("html-to-image"),uo=require("lecom-ui"),Pn=require("react");var wi=3,Bo="diagram",Dn=()=>{let{t:e}=(0,uo.useTranslation)(),{getNodes:t}=(0,Ln.useReactFlow)(),{deselectAll:o}=mt(),[r,n]=(0,Pn.useState)({png:!1,html:!1,print:!1}),i=()=>{let{x:E,y:f,width:m,height:p}=gr(t());return{width:m,height:p,style:{width:`${m}px`,height:`${p}px`,transform:`translate(${-E}px, ${-f}px)`}}},a=async(E,f)=>{n(_(N({},r),{[f]:!0})),await o();try{let m=fr();if(!m)throw new Error("Flow element not found");let p=i();return await E(m,p)}catch(m){(0,uo.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(_(N({},r),{[f]:!1}))}};return{exportAsPng:async(E=Bo)=>{await a(async(f,m)=>{let p=await(0,Dt.toPng)(f,_(N({},m),{backgroundColor:"#fcfcfc"}));mo(p,`${E}.png`)},"png")},exportAsHtml:async(E=Bo)=>{await a(async(f,m)=>{let p=await(0,Dt.toSvg)(f,_(N({},m),{backgroundColor:"#fcfcfc"})),g=`
|
|
5
5
|
<!DOCTYPE html>
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
<img src="${p}" alt="Diagram" onload="window.print(); window.close();" />
|
|
32
32
|
</body>
|
|
33
33
|
</html>
|
|
34
|
-
`),T.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var O=require("react/jsx-runtime");function Mn(){let{t:e}=(0,R.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:i,isPrintingHtml:a}=Dn(),[s,l]=(0,Rn.useState)(!1);return(0,O.jsxs)(R.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,O.jsx)(R.DropdownMenuTrigger,{asChild:!0,children:(0,O.jsx)("div",{children:(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,O.jsx)(Ge.FolderOutputIcon,{})})}),!s&&(0,O.jsx)(R.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,O.jsxs)(R.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,O.jsx)(Ge.FileImageIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>o(),children:(0,O.jsx)(Ge.FileCodeIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:n,onClick:()=>r(),children:(0,O.jsx)(Ge.PrinterIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var D=require("react/jsx-runtime"),Vn=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:i}=(0,z.useTranslation)(),{deselectAll:a}=mt(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:E,isMinimapOpen:f,setIsMinimapOpen:m}=G(),p=(0,zo.useKeyPress)(["v","V"]),g=(0,zo.useKeyPress)(["h","H"]),T=(0,Rt.useCallback)(()=>{a(),E()},[a,E]),b=()=>{a();let u=n(o);r&&r(u)};return(0,Rt.useEffect)(()=>{p&&!s&&!t&&d()},[p,d,s,t]),(0,Rt.useEffect)(()=>{g&&!l&&!t&&T()},[g,T,l,t]),(0,D.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(z.Tooltip,{children:[(0,D.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,D.jsx)(z.Button,{size:"small",variant:"ghost",color:"grey",className:S(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:(0,D.jsx)(He.MousePointerIcon,{})})}),(0,D.jsxs)(z.TooltipContent,{color:"black",children:[i("editor.controls.actions.move_tool"),(0,D.jsx)("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),(0,D.jsxs)(z.Tooltip,{children:[(0,D.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,D.jsx)(z.Button,{size:"small",variant:"ghost",color:"grey",className:S(l&&"bg-grey-400"),iconButton:!0,onClick:T,children:(0,D.jsx)(He.HandIcon,{})})}),(0,D.jsxs)(z.TooltipContent,{color:"black",children:[i("editor.controls.actions.hand_tool")," ",(0,D.jsx)("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),(0,D.jsxs)(z.Tooltip,{children:[(0,D.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,D.jsx)(z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:b,children:(0,D.jsx)(He.ListCheckIcon,{})})}),(0,D.jsx)(z.TooltipContent,{color:"black",children:i("editor.controls.actions.check")})]})]}),(0,D.jsx)(Mn,{}),!t&&(0,D.jsx)(kn,{disabled:e.length>0}),(0,D.jsxs)(z.Tooltip,{children:[(0,D.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,D.jsx)(z.Button,{size:"small",variant:"ghost",color:"grey",className:S(f&&"bg-grey-400"),iconButton:!0,onClick:()=>m(!f),children:(0,D.jsx)(He.MapIcon,{})})}),(0,D.jsx)(z.TooltipContent,{color:"black",children:i(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var de=require("lecom-ui"),fo=require("lucide-react"),ue=require("react/jsx-runtime"),On=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=(0,de.useTranslation)();return(0,ue.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,ue.jsxs)(de.Tooltip,{children:[(0,ue.jsx)(de.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(de.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,ue.jsx)(fo.UndoIcon,{})})}),(0,ue.jsx)(de.TooltipContent,{color:"black",children:n("editor.controls.history.undo")})]}),(0,ue.jsxs)(de.Tooltip,{children:[(0,ue.jsx)(de.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(de.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:(0,ue.jsx)(fo.RedoIcon,{})})}),(0,ue.jsx)(de.TooltipContent,{color:"black",children:n("editor.controls.history.redo")})]})]})};var Gn=require("@xyflow/react"),F=require("lecom-ui"),gt=require("lucide-react");var H=require("react/jsx-runtime"),Hn=()=>{let{t:e}=(0,F.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=(0,Gn.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)(F.Tooltip,{children:[(0,H.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:(0,H.jsx)(gt.ScanIcon,{})})}),(0,H.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,H.jsxs)(F.Tooltip,{children:[(0,H.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,H.jsx)(gt.ZoomOut,{})})}),(0,H.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,H.jsxs)(F.Tooltip,{children:[(0,H.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:(0,H.jsx)(nr,{})})}),(0,H.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,H.jsxs)(F.Tooltip,{children:[(0,H.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,H.jsx)(F.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,H.jsx)(gt.ZoomIn,{})})}),(0,H.jsx)(F.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var vo=require("@xyflow/react");var Bn=require("@xyflow/react");var zn=require("react/jsx-runtime"),Z=({type:e,position:t,className:o})=>(0,zn.jsx)(Bn.Handle,{type:e,position:t,className:S("size-2.5 border border-grey-400 bg-white",o)});var go=require("@xyflow/react"),Fn=require("lodash");var Un=require("react/jsx-runtime"),Et=o=>{var r=o,{nodeId:e}=r,t=et(r,["nodeId"]);let{getNode:n,getNodes:i,setNodes:a}=(0,go.useReactFlow)(),s=({width:l,height:d})=>{if(!e)return;let E=n(e);if((E==null?void 0:E.type)!=="LANE")return;let f=[...i()],m=!E.parentId,p=m?E.id:E.parentId,g=f.filter(u=>u.type==="LANE"&&u.parentId===p);if(!g.length)return;let T=(0,Fn.orderBy)(g,["position.y"]),b=0;T.forEach((u,c)=>{var y,A;let v=c===T.length-1,C=(A=(y=u.measured)==null?void 0:y.height)!=null?A:0;f=f.map(h=>{if(h.id===u.id){let x=m?l-oe.HEADER_WIDTH:l,k=_(N({},h),{width:x,measured:_(N({},h.measured),{width:x}),position:_(N({},h.position),{y:b})});return v&&m&&(k.height=d-b),k}return h}),b+=C}),f=f.map(u=>{if(u.id===p){let c=m?l:l+oe.HEADER_WIDTH;return _(N({},u),{width:c,height:m?d:b,measured:{width:c,height:m?d:b}})}return u}),a(f)};return(0,Un.jsx)(go.NodeResizer,N({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,d)=>s(d)},t))};var ho=require("@xyflow/react"),_e=require("lecom-ui");var Eo=require("@xyflow/react"),U=require("lecom-ui"),Wn=require("lucide-react");var ne=require("react/jsx-runtime"),Yn=({nodeId:e})=>{let{t}=(0,U.useTranslation)(),{updateNodeData:o}=(0,Eo.useReactFlow)(),r=(0,Eo.useNodesData)(e),n=i=>{(r==null?void 0:r.data.variant)!==i&&o(e,{variant:i})};return(0,ne.jsxs)(U.DropdownMenu,{children:[(0,ne.jsxs)(U.Tooltip,{children:[(0,ne.jsx)(U.TooltipTrigger,{asChild:!0,children:(0,ne.jsx)(U.DropdownMenuTrigger,{asChild:!0,children:(0,ne.jsx)(U.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,ne.jsx)(Wn.WrenchIcon,{})})})}),(0,ne.jsx)(U.TooltipContent,{color:"black",children:t("bpmn.gateway.menu.title")})]}),(0,ne.jsxs)(U.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,ne.jsx)(U.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)(U.DropdownMenuGroup,{children:Object.entries(Qt).map(([i,a])=>(0,ne.jsxs)(U.DropdownMenuItem,{className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[(0,ne.jsx)(a.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${i.toLowerCase()}`)]},i))})]})]})};var bo=require("@xyflow/react"),B=require("lecom-ui"),Kn=require("lucide-react");var $=require("react/jsx-runtime"),Zn=({nodeId:e})=>{let{t}=(0,B.useTranslation)(),{updateNodeData:o}=(0,bo.useReactFlow)(),r=(0,bo.useNodesData)(e),n=a=>{o(e,{variant:(r==null?void 0:r.data.variant)===a?"":a})},i=a=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===a?"":a})};return(0,$.jsxs)(B.DropdownMenu,{children:[(0,$.jsxs)(B.Tooltip,{children:[(0,$.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(B.DropdownMenuTrigger,{asChild:!0,children:(0,$.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,$.jsx)(Kn.WrenchIcon,{})})})}),(0,$.jsx)(B.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,$.jsxs)(B.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,$.jsxs)(B.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,$.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,$.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Jt).map(([a,s])=>(0,$.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===a}),onClick:()=>i(a),children:(0,$.jsx)(s.icon,{className:"stroke-inherit"})},a))})]}),(0,$.jsx)(B.DropdownMenuGroup,{children:Object.entries(jt).map(([a,s])=>(0,$.jsxs)(B.DropdownMenuItem,{className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[(0,$.jsx)(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${a.toLowerCase()}`)]},a))})]})]})};var ce=require("react/jsx-runtime"),pe=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var E;let{t:n}=(0,_e.useTranslation)(),{setDraggableNode:i}=ct(),a=({event:f,type:m,variant:p})=>{i({type:m,variant:p}),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Tt,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:Tt,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Kt,label:n("bpmn.annotation.variant.default")}},l=[{component:(0,ce.jsx)(ao,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:(0,ce.jsx)(_t,{elementId:e})},{component:(0,ce.jsx)(Zn,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:(0,ce.jsx)(_t,{elementId:e})},{component:(0,ce.jsx)(Yn,{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,ce.jsx)(ho.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:ho.Position.Right,align:"start",isVisible:r,children:(E=d[t])==null?void 0:E.map((f,m)=>f.component?(0,ce.jsx)("div",{children:f.component},m):(0,ce.jsxs)(_e.Tooltip,{children:[(0,ce.jsx)(_e.TooltipTrigger,{asChild:!0,children:(0,ce.jsx)(_e.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:p=>a({event:p,type:f.type,variant:f.variant}),children:f.icon&&(0,ce.jsx)(f.icon,{size:16})})}),(0,ce.jsx)(_e.TooltipContent,{color:"black",children:f.label})]},m))})};var we=require("react/jsx-runtime"),$n=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,vo.useReactFlow)(),{isMultipleSelection:i}=G(),a=s=>{n(e,{label:s})};return(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)("div",{className:S("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,we.jsx)(Q,{value:t.label,className:"m-1 text-grey-600",onChange:a})}),(0,we.jsx)(pe,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!i&&o}),(0,we.jsx)(Et,{isVisible:!r&&!i&&o,minWidth:oo.MIN_WIDTH,minHeight:oo.MIN_HEIGHT}),(0,we.jsx)(Z,{type:"target",position:vo.Position.Left})]})};var Mt=require("@xyflow/react"),Xn=require("react");var ge=require("react/jsx-runtime"),qn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Mt.useReactFlow)(),{isMultipleSelection:i}=G(),[a,s]=(0,Xn.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:S("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:a,onChange:l})})]}),(0,ge.jsx)(pe,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!i&&o}),(0,ge.jsx)(Z,{type:"source",position:Mt.Position.Right}),(0,ge.jsx)(Z,{type:"target",position:Mt.Position.Left})]})};var Vt=require("@xyflow/react"),jn=require("react");var Ee=require("react/jsx-runtime"),Jn=({id:e,data:t,selected:o,dragging:r})=>{let n=Qt[t.variant].icon,{updateNodeData:i}=(0,Vt.useReactFlow)(),{isMultipleSelection:a}=G(),[s,l]=(0,jn.useState)(!1),d=m=>{i(e,{label:m})};return(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsxs)("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[(0,Ee.jsx)(n,{className:S("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,Ee.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Ee.jsx)(Q,{value:t.label,isEditing:s,onChange:d})})]}),(0,Ee.jsx)(pe,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!a&&o}),(0,Ee.jsx)(Z,{type:"target",position:Vt.Position.Left}),(0,Ee.jsx)(Z,{type:"source",position:Vt.Position.Right})]})};var No=require("@xyflow/react"),Qn=require("react");var he=require("react/jsx-runtime"),ea=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,No.useReactFlow)(),{isMultipleSelection:i}=G(),[a,s]=(0,Qn.useState)(!1),l=f=>{n(e,{label:f})};return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,he.jsx)(qt,{className:S("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,he.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,he.jsx)(Q,{value:t.label,isEditing:a,onChange:l})})]}),(0,he.jsx)(pe,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!i&&o}),(0,he.jsx)(Z,{type:"source",position:No.Position.Right})]})};var Ot=require("@xyflow/react");var ee=require("react/jsx-runtime"),ta=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Ot.useReactFlow)(),{isMultipleSelection:i}=G(),a=m=>{n(e,{label:m})},s=t.variant?jt[t.variant].icon:null,l=t.attribute?Jt[t.attribute].icon:null,d=t.variant==="SUBPROCESS",E=s&&!d,f=l||d;return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsxs)("div",{className:S("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:S("m-1",{"py-6":E||f}),onChange:a}),s&&(0,ee.jsx)("div",{className:S("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:(0,ee.jsx)(s,{size:16,className:S(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:S("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:(0,ee.jsx)(l,{size:16,className:S(t.hasError?"text-red-500":"text-grey-500")})})})]}),(0,ee.jsx)(pe,{nodeId:e,nodeType:"TASK",isVisible:!r&&!i&&o}),(0,ee.jsx)(Et,{isVisible:!r&&!i&&o,minWidth:eo.MIN_WIDTH,minHeight:eo.MIN_HEIGHT}),(0,ee.jsx)(Z,{type:"source",position:Ot.Position.Right}),(0,ee.jsx)(Z,{type:"target",position:Ot.Position.Left})]})};var Fo=require("@xyflow/react");var Le=require("react/jsx-runtime"),oa=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=G();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)(pe,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),(0,Le.jsx)(Z,{type:"source",position:Fo.Position.Right}),(0,Le.jsx)(Z,{type:"target",position:Fo.Position.Left})]})};var yo=require("@xyflow/react"),ra=require("lodash"),Uo=require("react");var fe=require("react/jsx-runtime"),na=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:i,getNodes:a}=(0,yo.useReactFlow)(),{isMultipleSelection:s}=G(),l=a(),d=!n,E=(0,Uo.useMemo)(()=>(0,ra.orderBy)([...l.filter(g=>g.parentId===e&&g.type==="LANE")],"position.y","asc"),[l,e]),f=d?to.MIN_WIDTH:oe.MIN_WIDTH,m=(0,Uo.useMemo)(()=>{if(d&&E.length>1){let g=[...E];return g.pop(),g.reduce((b,u)=>{var c,v;return b+((v=(c=u.measured)==null?void 0:c.height)!=null?v:0)},0)+oe.MIN_HEIGHT}return oe.MIN_HEIGHT},[d,E]),p=g=>{i(e,{label:g})};return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsxs)("div",{className:S("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,fe.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:(0,fe.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,fe.jsx)(Q,{value:t.label,className:"w-full h-full",onChange:p})})}),(0,fe.jsx)("div",{className:"flex-1"})]}),(0,fe.jsx)(pe,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),(0,fe.jsx)(Et,{nodeId:e,minWidth:f,minHeight:m,isVisible:!r&&!s&&o}),d&&(0,fe.jsx)(Z,{type:"source",position:yo.Position.Right})]})};var aa={START_EVENT:ea,END_EVENT:qn,TASK:ta,GATEWAY:Jn,ANNOTATION:$n,LANE:na,UNSUPPORTED:oa},ia={SEQUENCE_EDGE:wr,MESSAGE_EDGE:Wr,ANNOTATION_EDGE:xr},sa="#fafafa",la="#bebebe",da=1,ca=10,pa="bottom-left",ma=.5,ua=4,fa={x:0,y:0,zoom:.75};var ga=require("@xyflow/react"),To=require("react"),ba=require("react/jsx-runtime"),Ci=e=>({width:e.width,height:e.height,transform:e.transform}),Ea=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:i,transform:a}=(0,ga.useStore)(Ci),s=(0,To.useRef)(null);return(0,To.useEffect)(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let E=window.devicePixelRatio;l.width=n*E,l.height=i*E,d.scale(E,E),d.clearRect(0,0,n,i),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*a[2]+a[0],0),d.lineTo(t*a[2]+a[0],i),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*a[2]+a[1]),d.lineTo(n,e*a[2]+a[1]),d.stroke())},[n,i,a,e,t,o,r]),(0,ba.jsx)("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};var W=require("lecom-ui"),ae=require("react/jsx-runtime"),ha=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=(0,W.useTranslation)(),i=!!e,a=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(E=>E.filter(f=>!l.some(m=>m.id===f.id))),d!=null&&d.length&&r(E=>E.filter(f=>!d.some(m=>m.id===f.id))),t(null)},s=()=>{t(null)};return(0,ae.jsx)(W.Dialog,{open:i,onOpenChange:s,children:(0,ae.jsxs)(W.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,ae.jsx)(W.DialogHeader,{children:(0,ae.jsx)(W.DialogTitle,{children:(0,ae.jsx)(W.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)(W.Notification,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),(0,ae.jsx)(W.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),(0,ae.jsxs)(W.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,ae.jsx)(W.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:(0,ae.jsx)(W.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),(0,ae.jsx)(W.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:a,children:n("editor.modals.delete_elements.confirm")})]})]})})};var Ce=require("lecom-ui");var Be=require("react/jsx-runtime"),va=()=>{let{t:e}=(0,Ce.useTranslation)(),{setDraggableNode:t}=ct(),o=[{type:"START_EVENT",icon:qt,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:tt,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Tt,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:sr,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:ir,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:ar,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:$t,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Zt,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:rr,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Kt,label:e("bpmn.annotation.variant.default")}],r=(n,i)=>{t({type:i.type,variant:i.variant,attribute:i.attribute}),n.dataTransfer.effectAllowed="move"};return(0,Be.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,i)=>(0,Be.jsxs)(Ce.Tooltip,{children:[(0,Be.jsx)(Ce.TooltipTrigger,{asChild:!0,children:(0,Be.jsx)(Ce.Button,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:a=>r(a,n),children:(0,Be.jsx)(n.icon,{})},i)}),(0,Be.jsx)(Ce.TooltipContent,{color:"black",side:"right",children:n.label})]},i))})};var xo=require("lecom-ui"),bt=require("lucide-react"),_o=require("react"),te=require("react/jsx-runtime"),Na=({validationResult:e,onClose:t})=>{let{t:o}=(0,xo.useTranslation)(),[r,n]=(0,_o.useState)(!1);if((0,_o.useEffect)(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:i,errors:a}=e;return(0,te.jsxs)("div",{className:S("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[(0,te.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,te.jsx)("div",{className:"flex-shrink-0",children:i?(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(i?"validation.success.title":"validation.errors.title")}),!i&&(0,te.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,te.jsx)(xo.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:i?(0,te.jsx)("p",{children:o("validation.success.message")}):(0,te.jsx)("div",{className:"list-disc list-inside",children:a.map(s=>(0,te.jsx)("li",{className:"mb-1",children:s.message},s.id))})})]})};var K=require("react/jsx-runtime"),Ii=[],xa=(0,ie.forwardRef)(({mode:e="edit"},t)=>{let o=(0,ie.useRef)(!1),[r,n,i]=(0,X.useNodesState)([]),[a,s,l]=(0,X.useEdgesState)([]),[d,E]=(0,ie.useState)(null),{isMoveTool:f,isHandTool:m,isReadOnly:p,setIsReadOnly:g,setIsMultipleSelection:T,isMinimapOpen:b}=G(),{validationResult:u,handleValidationComplete:c,clearValidation:v,isAutoValidationEnabled:C,validateDiagram:y}=Or(),{getNode:A,getNodes:h,getEdges:x}=(0,X.useReactFlow)(),k=nn(n,s);(0,ie.useImperativeHandle)(t,()=>k);let{onNodeDrag:w,onDrop:L,onDragOver:I,onNodeDragStop:P}=Kr({nodes:r,setNodes:n,setEdges:s}),{isValidConnection:se,onConnect:j}=Cr({setEdges:s});zr();let{createDiagram:Qe}=tn(),{undo:ze,redo:Fe,saveHistory:Co,canUndo:ka,canRedo:La}=dn(),{helperLineHorizontal:Pa,helperLineVertical:Da,customApplyNodeChanges:Pi}=Xr();on({LIA_CREATE_DIAGRAM:Qe,CLEAR_DIAGRAM:()=>{n([]),s([])}}),(0,ie.useEffect)(()=>{g(e==="readonly")},[e,g]);let Ra=()=>{v()},Ma=(0,ie.useCallback)(({nodes:J,edges:q})=>{let ht=J.length+q.length>1;T(ht)},[T]);(0,X.useOnSelectionChange)({onChange:Ma});let Va=J=>{let q=A(J.id);if(q!=null&&q.parentId&&(q==null?void 0:q.type)==="LANE"){let ht=Ye(q.parentId,r.filter(Xo=>Xo.id!==q.id&&Xo.type==="LANE"));n(Se(ht))}},Oa=J=>{J.forEach(q=>{switch(q.type){case"remove":Va(q);break}})},Ga=(0,ie.useCallback)(()=>{if(!C){o.current=!1;return}let J=h(),q=x(),ht=y({nodes:J,edges:q});c(ht),o.current=!1},[C,h,x,y,c]),Zo=(0,Ta.useDebouncedCallback)(Ga,300),$o=(0,ie.useCallback)(()=>{C&&!o.current&&(o.current=!0,Zo())},[C,Zo]),Ha=J=>{i(J),Co(J),$o(),Oa(J)},Ba=J=>{l(J),Co(J),$o()},za=()=>{Co("forceSave")},Fa=async({nodes:J,edges:q})=>(E({nodes:J,edges:q}),!1),Ua={nodes:r,edges:a};return(0,K.jsxs)("div",{className:"w-full h-full",children:[!p&&(0,K.jsx)(va,{}),(0,K.jsx)(cn,{}),(0,K.jsxs)(X.ReactFlow,{edges:a,nodes:r,nodeTypes:aa,edgeTypes:ia,minZoom:ma,maxZoom:ua,panOnDrag:m||p?!0:Ii,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!p&&f,nodesConnectable:!p&&f,nodesDraggable:!p&&f,isValidConnection:se,connectionLineComponent:Yr,onConnect:j,onDrop:L,onDropCapture:za,onDragOver:I,onNodesChange:Ha,onEdgesChange:Ba,onNodeDrag:w,onNodeDragStop:P,onBeforeDelete:Fa,selectionMode:X.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:fa,connectOnClick:!1,children:[b&&(0,K.jsx)(X.MiniMap,{pannable:!0,zoomable:!0,position:pa,className:"shadow-md rounded-md"}),(0,K.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!p&&(0,K.jsx)(On,{canUndo:ka,canRedo:La,undo:ze,redo:Fe}),(0,K.jsx)(Vn,{nodes:r,isReadOnly:p,diagram:Ua,onValidationComplete:c,onValidateDiagram:y}),(0,K.jsx)(Hn,{})]}),(0,K.jsx)(Ea,{horizontal:Pa,vertical:Da}),(0,K.jsx)(X.Background,{gap:ca,size:da,color:la,bgColor:sa}),u&&(0,K.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,K.jsx)(Na,{validationResult:u,onClose:Ra})})]}),(0,K.jsx)(ha,{pendingDelete:d,setPendingDelete:E,setNodes:n,setEdges:s})]})});xa.displayName="Editor";var Ai=({mode:e,locale:t="pt_BR",onConfigureElement:o,selectorRef:r})=>((0,ie.useEffect)(()=>{t&&ya.i18n.changeLanguage(t)},[t]),(0,K.jsx)(X.ReactFlowProvider,{children:(0,K.jsx)(hr,{value:{onConfigureElement:o},children:(0,K.jsx)(xa,{mode:e,ref:r})})})),Wo=Ai;var Yo=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 wo=require("lecom-ui");var _a={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 wa={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 Ca={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 Ia={pt_BR:Ca,en_US:_a,es_ES:wa};var Aa,Sa,Si=(Sa=(Aa=Yo("LecomUserLanguage"))!=null?Aa:Yo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Sa:wo.Translations.PT_BR;(0,wo.initializeI18n)({lng:Si,resources:Ia});var Ko=require("react/jsx-runtime"),ki=e=>(0,Ko.jsx)(Qo,{children:(0,Ko.jsx)(Wo,N({},e))});0&&(module.exports={ActivityVariant,ComplexVariant,ElementType,ExclusiveVariant,GatewayVariant,Modeler,RoutingVariant,useSelectionUtils});
|
|
34
|
+
`),T.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};var O=require("react/jsx-runtime");function Mn(){let{t:e}=(0,R.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:i,isPrintingHtml:a}=Dn(),[s,l]=(0,Rn.useState)(!1);return(0,O.jsxs)(R.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,O.jsx)(R.DropdownMenuTrigger,{asChild:!0,children:(0,O.jsx)("div",{children:(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,O.jsx)(Ge.FolderOutputIcon,{})})}),!s&&(0,O.jsx)(R.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,O.jsxs)(R.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,O.jsx)(Ge.FileImageIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>o(),children:(0,O.jsx)(Ge.FileCodeIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,O.jsxs)(R.Tooltip,{children:[(0,O.jsx)(R.TooltipTrigger,{asChild:!0,children:(0,O.jsx)(R.DropdownMenuItem,{className:"p-1.5",disabled:n,onClick:()=>r(),children:(0,O.jsx)(Ge.PrinterIcon,{})})}),(0,O.jsx)(R.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var D=require("react/jsx-runtime"),Vn=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:i}=(0,z.useTranslation)(),{deselectAll:a}=mt(),{isMoveTool:s,isHandTool:l,activeMoveTool:c,activeHandTool:E,isMinimapOpen:f,setIsMinimapOpen:m}=G(),p=(0,zo.useKeyPress)(["v","V"]),g=(0,zo.useKeyPress)(["h","H"]),T=(0,Rt.useCallback)(()=>{a(),E()},[a,E]),b=()=>{a();let u=n(o);r&&r(u)};return(0,Rt.useEffect)(()=>{p&&!s&&!t&&c()},[p,c,s,t]),(0,Rt.useEffect)(()=>{g&&!l&&!t&&T()},[g,T,l,t]),(0,D.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(z.Tooltip,{children:[(0,D.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,D.jsx)(z.Button,{size:"small",variant:"ghost",color:"grey",className:S(s&&"bg-grey-400"),iconButton:!0,onClick:c,children:(0,D.jsx)(He.MousePointerIcon,{})})}),(0,D.jsxs)(z.TooltipContent,{color:"black",children:[i("editor.controls.actions.move_tool"),(0,D.jsx)("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),(0,D.jsxs)(z.Tooltip,{children:[(0,D.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,D.jsx)(z.Button,{size:"small",variant:"ghost",color:"grey",className:S(l&&"bg-grey-400"),iconButton:!0,onClick:T,children:(0,D.jsx)(He.HandIcon,{})})}),(0,D.jsxs)(z.TooltipContent,{color:"black",children:[i("editor.controls.actions.hand_tool")," ",(0,D.jsx)("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),(0,D.jsxs)(z.Tooltip,{children:[(0,D.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,D.jsx)(z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:b,children:(0,D.jsx)(He.ListCheckIcon,{})})}),(0,D.jsx)(z.TooltipContent,{color:"black",children:i("editor.controls.actions.check")})]})]}),(0,D.jsx)(Mn,{}),!t&&(0,D.jsx)(kn,{disabled:e.length>0}),(0,D.jsxs)(z.Tooltip,{children:[(0,D.jsx)(z.TooltipTrigger,{asChild:!0,children:(0,D.jsx)(z.Button,{size:"small",variant:"ghost",color:"grey",className:S(f&&"bg-grey-400"),iconButton:!0,onClick:()=>m(!f),children:(0,D.jsx)(He.MapIcon,{})})}),(0,D.jsx)(z.TooltipContent,{color:"black",children:i(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var de=require("lecom-ui"),fo=require("lucide-react"),ue=require("react/jsx-runtime"),On=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=(0,de.useTranslation)();return(0,ue.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,ue.jsxs)(de.Tooltip,{children:[(0,ue.jsx)(de.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(de.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,ue.jsx)(fo.UndoIcon,{})})}),(0,ue.jsx)(de.TooltipContent,{color:"black",children:n("editor.controls.history.undo")})]}),(0,ue.jsxs)(de.Tooltip,{children:[(0,ue.jsx)(de.TooltipTrigger,{asChild:!0,children:(0,ue.jsx)(de.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:(0,ue.jsx)(fo.RedoIcon,{})})}),(0,ue.jsx)(de.TooltipContent,{color:"black",children:n("editor.controls.history.redo")})]})]})};var Gn=require("@xyflow/react"),U=require("lecom-ui"),gt=require("lucide-react");var H=require("react/jsx-runtime"),Hn=()=>{let{t:e}=(0,U.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=(0,Gn.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)(gt.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)(gt.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)(nr,{})})}),(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)(gt.ZoomIn,{})})}),(0,H.jsx)(U.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var vo=require("@xyflow/react");var Bn=require("@xyflow/react");var zn=require("react/jsx-runtime"),Z=({type:e,position:t,className:o})=>(0,zn.jsx)(Bn.Handle,{type:e,position:t,className:S("size-2.5 border border-grey-400 bg-white",o)});var go=require("@xyflow/react"),Un=require("lodash");var Fn=require("react/jsx-runtime"),Et=o=>{var r=o,{nodeId:e}=r,t=et(r,["nodeId"]);let{getNode:n,getNodes:i,setNodes:a}=(0,go.useReactFlow)(),s=({width:l,height:c})=>{if(!e)return;let E=n(e);if((E==null?void 0:E.type)!=="LANE")return;let f=[...i()],m=!E.parentId,p=m?E.id:E.parentId,g=f.filter(u=>u.type==="LANE"&&u.parentId===p);if(!g.length)return;let T=(0,Un.orderBy)(g,["position.y"]),b=0;T.forEach((u,d)=>{var y,A;let v=d===T.length-1,C=(A=(y=u.measured)==null?void 0:y.height)!=null?A:0;f=f.map(h=>{if(h.id===u.id){let x=m?l-re.HEADER_WIDTH:l,k=_(N({},h),{width:x,measured:_(N({},h.measured),{width:x}),position:_(N({},h.position),{y:b})});return v&&m&&(k.height=c-b),k}return h}),b+=C}),f=f.map(u=>{if(u.id===p){let d=m?l:l+re.HEADER_WIDTH;return _(N({},u),{width:d,height:m?c:b,measured:{width:d,height:m?c:b}})}return u}),a(f)};return(0,Fn.jsx)(go.NodeResizer,N({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>s(c)},t))};var ho=require("@xyflow/react"),_e=require("lecom-ui");var Eo=require("@xyflow/react"),F=require("lecom-ui"),Wn=require("lucide-react");var ae=require("react/jsx-runtime"),Yn=({nodeId:e})=>{let{t}=(0,F.useTranslation)(),{updateNodeData:o}=(0,Eo.useReactFlow)(),r=(0,Eo.useNodesData)(e),n=i=>{(r==null?void 0:r.data.variant)!==i&&o(e,{variant:i})};return(0,ae.jsxs)(F.DropdownMenu,{children:[(0,ae.jsxs)(F.Tooltip,{children:[(0,ae.jsx)(F.TooltipTrigger,{asChild:!0,children:(0,ae.jsx)(F.DropdownMenuTrigger,{asChild:!0,children:(0,ae.jsx)(F.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,ae.jsx)(Wn.WrenchIcon,{})})})}),(0,ae.jsx)(F.TooltipContent,{color:"black",children:t("bpmn.gateway.menu.title")})]}),(0,ae.jsxs)(F.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,ae.jsx)(F.DropdownMenuLabel,{className:"flex items-center",children:(0,ae.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),(0,ae.jsx)(F.DropdownMenuGroup,{children:Object.entries(Qt).map(([i,a])=>(0,ae.jsxs)(F.DropdownMenuItem,{className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[(0,ae.jsx)(a.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${i.toLowerCase()}`)]},i))})]})]})};var bo=require("@xyflow/react"),B=require("lecom-ui"),Kn=require("lucide-react");var $=require("react/jsx-runtime"),Zn=({nodeId:e})=>{let{t}=(0,B.useTranslation)(),{updateNodeData:o}=(0,bo.useReactFlow)(),r=(0,bo.useNodesData)(e),n=a=>{o(e,{variant:(r==null?void 0:r.data.variant)===a?"":a})},i=a=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===a?"":a})};return(0,$.jsxs)(B.DropdownMenu,{children:[(0,$.jsxs)(B.Tooltip,{children:[(0,$.jsx)(B.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(B.DropdownMenuTrigger,{asChild:!0,children:(0,$.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,$.jsx)(Kn.WrenchIcon,{})})})}),(0,$.jsx)(B.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,$.jsxs)(B.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,$.jsxs)(B.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,$.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,$.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(Jt).map(([a,s])=>(0,$.jsx)(B.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===a}),onClick:()=>i(a),children:(0,$.jsx)(s.icon,{className:"stroke-inherit"})},a))})]}),(0,$.jsx)(B.DropdownMenuGroup,{children:Object.entries(jt).map(([a,s])=>(0,$.jsxs)(B.DropdownMenuItem,{className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[(0,$.jsx)(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${a.toLowerCase()}`)]},a))})]})]})};var ce=require("react/jsx-runtime"),pe=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var E;let{t:n}=(0,_e.useTranslation)(),{setDraggableNode:i}=ct(),a=({event:f,type:m,variant:p})=>{i({type:m,variant:p}),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:Tt,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:Tt,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Kt,label:n("bpmn.annotation.variant.default")}},l=[{component:(0,ce.jsx)(ao,{elementId:e})}],c={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:(0,ce.jsx)(_t,{elementId:e})},{component:(0,ce.jsx)(Zn,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:(0,ce.jsx)(_t,{elementId:e})},{component:(0,ce.jsx)(Yn,{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,ce.jsx)(ho.NodeToolbar,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:ho.Position.Right,align:"start",isVisible:r,children:(E=c[t])==null?void 0:E.map((f,m)=>f.component?(0,ce.jsx)("div",{children:f.component},m):(0,ce.jsxs)(_e.Tooltip,{children:[(0,ce.jsx)(_e.TooltipTrigger,{asChild:!0,children:(0,ce.jsx)(_e.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:p=>a({event:p,type:f.type,variant:f.variant}),children:f.icon&&(0,ce.jsx)(f.icon,{size:16})})}),(0,ce.jsx)(_e.TooltipContent,{color:"black",children:f.label})]},m))})};var we=require("react/jsx-runtime"),$n=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,vo.useReactFlow)(),{isMultipleSelection:i}=G(),a=s=>{n(e,{label:s})};return(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)("div",{className:S("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,we.jsx)(ee,{value:t.label,className:"m-1 text-grey-600",onChange:a})}),(0,we.jsx)(pe,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!i&&o}),(0,we.jsx)(Et,{isVisible:!r&&!i&&o,minWidth:oo.MIN_WIDTH,minHeight:oo.MIN_HEIGHT}),(0,we.jsx)(Z,{type:"target",position:vo.Position.Left})]})};var Mt=require("@xyflow/react"),Xn=require("react");var ge=require("react/jsx-runtime"),qn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Mt.useReactFlow)(),{isMultipleSelection:i}=G(),[a,s]=(0,Xn.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:S("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)(ee,{value:t.label,isEditing:a,onChange:l})})]}),(0,ge.jsx)(pe,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!i&&o}),(0,ge.jsx)(Z,{type:"source",position:Mt.Position.Right}),(0,ge.jsx)(Z,{type:"target",position:Mt.Position.Left})]})};var Vt=require("@xyflow/react"),jn=require("react");var Ee=require("react/jsx-runtime"),Jn=({id:e,data:t,selected:o,dragging:r})=>{let n=Qt[t.variant].icon,{updateNodeData:i}=(0,Vt.useReactFlow)(),{isMultipleSelection:a}=G(),[s,l]=(0,jn.useState)(!1),c=m=>{i(e,{label:m})};return(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsxs)("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[(0,Ee.jsx)(n,{className:S("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,Ee.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Ee.jsx)(ee,{value:t.label,isEditing:s,onChange:c})})]}),(0,Ee.jsx)(pe,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!a&&o}),(0,Ee.jsx)(Z,{type:"target",position:Vt.Position.Left}),(0,Ee.jsx)(Z,{type:"source",position:Vt.Position.Right})]})};var No=require("@xyflow/react"),Qn=require("react");var he=require("react/jsx-runtime"),ea=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,No.useReactFlow)(),{isMultipleSelection:i}=G(),[a,s]=(0,Qn.useState)(!1),l=f=>{n(e,{label:f})};return(0,he.jsxs)(he.Fragment,{children:[(0,he.jsxs)("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[(0,he.jsx)(qt,{className:S("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,he.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,he.jsx)(ee,{value:t.label,isEditing:a,onChange:l})})]}),(0,he.jsx)(pe,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!i&&o}),(0,he.jsx)(Z,{type:"source",position:No.Position.Right})]})};var Ot=require("@xyflow/react");var te=require("react/jsx-runtime"),ta=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=(0,Ot.useReactFlow)(),{isMultipleSelection:i}=G(),a=m=>{n(e,{label:m})},s=t.variant?jt[t.variant].icon:null,l=t.attribute?Jt[t.attribute].icon:null,c=t.variant==="SUBPROCESS",E=s&&!c,f=l||c;return(0,te.jsxs)(te.Fragment,{children:[(0,te.jsxs)("div",{className:S("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,te.jsx)(ee,{value:t.label,className:S("m-1",{"py-6":E||f}),onChange:a}),s&&(0,te.jsx)("div",{className:S("absolute flex items-center p-1",c?"bottom-0":"top-0 left-0"),children:(0,te.jsx)(s,{size:16,className:S(t.hasError?"text-red-500":"text-grey-500")})}),l&&(0,te.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,te.jsx)("div",{className:S("flex items-center w-16 p-1",c?"justify-between":"justify-center"),children:(0,te.jsx)(l,{size:16,className:S(t.hasError?"text-red-500":"text-grey-500")})})})]}),(0,te.jsx)(pe,{nodeId:e,nodeType:"TASK",isVisible:!r&&!i&&o}),(0,te.jsx)(Et,{isVisible:!r&&!i&&o,minWidth:eo.MIN_WIDTH,minHeight:eo.MIN_HEIGHT}),(0,te.jsx)(Z,{type:"source",position:Ot.Position.Right}),(0,te.jsx)(Z,{type:"target",position:Ot.Position.Left})]})};var Uo=require("@xyflow/react");var Le=require("react/jsx-runtime"),oa=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=G();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)(pe,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),(0,Le.jsx)(Z,{type:"source",position:Uo.Position.Right}),(0,Le.jsx)(Z,{type:"target",position:Uo.Position.Left})]})};var yo=require("@xyflow/react"),ra=require("lodash"),Fo=require("react");var fe=require("react/jsx-runtime"),na=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:i,getNodes:a}=(0,yo.useReactFlow)(),{isMultipleSelection:s}=G(),l=a(),c=!n,E=(0,Fo.useMemo)(()=>(0,ra.orderBy)([...l.filter(g=>g.parentId===e&&g.type==="LANE")],"position.y","asc"),[l,e]),f=c?to.MIN_WIDTH:re.MIN_WIDTH,m=(0,Fo.useMemo)(()=>{if(c&&E.length>1){let g=[...E];return g.pop(),g.reduce((b,u)=>{var d,v;return b+((v=(d=u.measured)==null?void 0:d.height)!=null?v:0)},0)+re.MIN_HEIGHT}return re.MIN_HEIGHT},[c,E]),p=g=>{i(e,{label:g})};return(0,fe.jsxs)(fe.Fragment,{children:[(0,fe.jsxs)("div",{className:S("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,fe.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400 bg-white",children:(0,fe.jsx)("div",{className:"relative flex-1 [writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180",children:(0,fe.jsx)(ee,{value:t.label,className:"w-full h-full",onChange:p})})}),(0,fe.jsx)("div",{className:"flex-1"})]}),(0,fe.jsx)(pe,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!r&&!s&&o}),(0,fe.jsx)(Et,{nodeId:e,minWidth:f,minHeight:m,isVisible:!r&&!s&&o}),c&&(0,fe.jsx)(Z,{type:"source",position:yo.Position.Right})]})};var aa={START_EVENT:ea,END_EVENT:qn,TASK:ta,GATEWAY:Jn,ANNOTATION:$n,LANE:na,UNSUPPORTED:oa},ia={SEQUENCE_EDGE:wr,MESSAGE_EDGE:Wr,ANNOTATION_EDGE:xr},sa="#fafafa",la="#bebebe",da=1,ca=10,pa="bottom-left",ma=.5,ua=4,fa={x:0,y:0,zoom:.75};var ga=require("@xyflow/react"),To=require("react"),ba=require("react/jsx-runtime"),Ci=e=>({width:e.width,height:e.height,transform:e.transform}),Ea=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:i,transform:a}=(0,ga.useStore)(Ci),s=(0,To.useRef)(null);return(0,To.useEffect)(()=>{let l=s.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let E=window.devicePixelRatio;l.width=n*E,l.height=i*E,c.scale(E,E),c.clearRect(0,0,n,i),c.strokeStyle=o,c.setLineDash(r),typeof t=="number"&&(c.moveTo(t*a[2]+a[0],0),c.lineTo(t*a[2]+a[0],i),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*a[2]+a[1]),c.lineTo(n,e*a[2]+a[1]),c.stroke())},[n,i,a,e,t,o,r]),(0,ba.jsx)("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};var W=require("lecom-ui"),ie=require("react/jsx-runtime"),ha=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=(0,W.useTranslation)(),i=!!e,a=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(E=>E.filter(f=>!l.some(m=>m.id===f.id))),c!=null&&c.length&&r(E=>E.filter(f=>!c.some(m=>m.id===f.id))),t(null)},s=()=>{t(null)};return(0,ie.jsx)(W.Dialog,{open:i,onOpenChange:s,children:(0,ie.jsxs)(W.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,ie.jsx)(W.DialogHeader,{children:(0,ie.jsx)(W.DialogTitle,{children:(0,ie.jsx)(W.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),(0,ie.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,ie.jsx)("div",{className:"py-2",children:(0,ie.jsx)(W.Notification,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),(0,ie.jsx)(W.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),(0,ie.jsxs)(W.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,ie.jsx)(W.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:(0,ie.jsx)(W.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),(0,ie.jsx)(W.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:a,children:n("editor.modals.delete_elements.confirm")})]})]})})};var Ce=require("lecom-ui");var Be=require("react/jsx-runtime"),va=()=>{let{t:e}=(0,Ce.useTranslation)(),{setDraggableNode:t}=ct(),o=[{type:"START_EVENT",icon:qt,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:tt,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:Tt,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:sr,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:ir,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:ar,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:rt,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:$t,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Zt,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:rr,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Kt,label:e("bpmn.annotation.variant.default")}],r=(n,i)=>{t({type:i.type,variant:i.variant,attribute:i.attribute}),n.dataTransfer.effectAllowed="move"};return(0,Be.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,i)=>(0,Be.jsxs)(Ce.Tooltip,{children:[(0,Be.jsx)(Ce.TooltipTrigger,{asChild:!0,children:(0,Be.jsx)(Ce.Button,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:a=>r(a,n),children:(0,Be.jsx)(n.icon,{})},i)}),(0,Be.jsx)(Ce.TooltipContent,{color:"black",side:"right",children:n.label})]},i))})};var xo=require("lecom-ui"),bt=require("lucide-react"),_o=require("react"),oe=require("react/jsx-runtime"),Na=({validationResult:e,onClose:t})=>{let{t:o}=(0,xo.useTranslation)(),[r,n]=(0,_o.useState)(!1);if((0,_o.useEffect)(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:i,errors:a}=e;return(0,oe.jsxs)("div",{className:S("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[(0,oe.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,oe.jsx)("div",{className:"flex-shrink-0",children:i?(0,oe.jsx)(bt.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,oe.jsx)(bt.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,oe.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,oe.jsx)("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&(0,oe.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,oe.jsx)(xo.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:(0,oe.jsx)(bt.XIcon,{})})]}),(0,oe.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?(0,oe.jsx)("p",{children:o("validation.success.message")}):(0,oe.jsx)("div",{className:"list-disc list-inside",children:a.map(s=>(0,oe.jsx)("li",{className:"mb-1",children:s.message},s.id))})})]})};var K=require("react/jsx-runtime"),Ii=[],xa=(0,se.forwardRef)(({mode:e="edit"},t)=>{let o=(0,se.useRef)(!1),[r,n,i]=(0,X.useNodesState)([]),[a,s,l]=(0,X.useEdgesState)([]),[c,E]=(0,se.useState)(null),{isMoveTool:f,isHandTool:m,isReadOnly:p,setIsReadOnly:g,setIsMultipleSelection:T,isMinimapOpen:b}=G(),{validationResult:u,handleValidationComplete:d,clearValidation:v,isAutoValidationEnabled:C,validateDiagram:y}=Or(),{getNode:A,getNodes:h,getEdges:x}=(0,X.useReactFlow)(),k=nn(n,s);(0,se.useImperativeHandle)(t,()=>k);let{onNodeDrag:w,onDrop:L,onDragOver:I,onNodeDragStop:P}=Kr({nodes:r,setNodes:n,setEdges:s}),{isValidConnection:j,onConnect:J}=Cr({setEdges:s});zr();let{createDiagram:Qe}=tn(),{undo:ze,redo:Ue,saveHistory:Co,canUndo:ka,canRedo:La}=dn(),{helperLineHorizontal:Pa,helperLineVertical:Da,customApplyNodeChanges:Pi}=Xr();on({LIA_CREATE_DIAGRAM:Qe,CLEAR_DIAGRAM:()=>{n([]),s([])}}),(0,se.useEffect)(()=>{g(e==="readonly")},[e,g]);let Ra=()=>{v()},Ma=(0,se.useCallback)(({nodes:Q,edges:q})=>{let ht=Q.length+q.length>1;T(ht)},[T]);(0,X.useOnSelectionChange)({onChange:Ma});let Va=Q=>{let q=A(Q.id);if(q!=null&&q.parentId&&(q==null?void 0:q.type)==="LANE"){let ht=Ye(q.parentId,r.filter(Xo=>Xo.id!==q.id&&Xo.type==="LANE"));n(Se(ht))}},Oa=Q=>{Q.forEach(q=>{switch(q.type){case"remove":Va(q);break}})},Ga=(0,se.useCallback)(()=>{if(!C){o.current=!1;return}let Q=h(),q=x(),ht=y({nodes:Q,edges:q});d(ht),o.current=!1},[C,h,x,y,d]),Zo=(0,Ta.useDebouncedCallback)(Ga,300),$o=(0,se.useCallback)(()=>{C&&!o.current&&(o.current=!0,Zo())},[C,Zo]),Ha=Q=>{i(Q),Co(Q),$o(),Oa(Q)},Ba=Q=>{l(Q),Co(Q),$o()},za=()=>{Co("forceSave")},Ua=async({nodes:Q,edges:q})=>(E({nodes:Q,edges:q}),!1),Fa={nodes:r,edges:a};return(0,K.jsxs)("div",{className:"w-full h-full",children:[!p&&(0,K.jsx)(va,{}),(0,K.jsx)(cn,{}),(0,K.jsxs)(X.ReactFlow,{edges:a,nodes:r,nodeTypes:aa,edgeTypes:ia,minZoom:ma,maxZoom:ua,panOnDrag:m||p?!0:Ii,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!p&&f,nodesConnectable:!p&&f,nodesDraggable:!p&&f,isValidConnection:j,connectionLineComponent:Yr,onConnect:J,onDrop:L,onDropCapture:za,onDragOver:I,onNodesChange:Ha,onEdgesChange:Ba,onNodeDrag:w,onNodeDragStop:P,onBeforeDelete:Ua,selectionMode:X.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:fa,connectOnClick:!1,children:[b&&(0,K.jsx)(X.MiniMap,{pannable:!0,zoomable:!0,position:pa,className:"shadow-md rounded-md"}),(0,K.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!p&&(0,K.jsx)(On,{canUndo:ka,canRedo:La,undo:ze,redo:Ue}),(0,K.jsx)(Vn,{nodes:r,isReadOnly:p,diagram:Fa,onValidationComplete:d,onValidateDiagram:y}),(0,K.jsx)(Hn,{})]}),(0,K.jsx)(Ea,{horizontal:Pa,vertical:Da}),(0,K.jsx)(X.Background,{gap:ca,size:da,color:la,bgColor:sa}),u&&(0,K.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,K.jsx)(Na,{validationResult:u,onClose:Ra})})]}),(0,K.jsx)(ha,{pendingDelete:c,setPendingDelete:E,setNodes:n,setEdges:s})]})});xa.displayName="Editor";var Ai=({mode:e,locale:t="pt_BR",onConfigureElement:o,selectorRef:r})=>((0,se.useEffect)(()=>{t&&ya.i18n.changeLanguage(t)},[t]),(0,K.jsx)(X.ReactFlowProvider,{children:(0,K.jsx)(hr,{value:{onConfigureElement:o},children:(0,K.jsx)(xa,{mode:e,ref:r})})})),Wo=Ai;var Yo=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 wo=require("lecom-ui");var _a={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 wa={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 Ca={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 Ia={pt_BR:Ca,en_US:_a,es_ES:wa};var Aa,Sa,Si=(Sa=(Aa=Yo("LecomUserLanguage"))!=null?Aa:Yo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Sa:wo.Translations.PT_BR;(0,wo.initializeI18n)({lng:Si,resources:Ia});var Ko=require("react/jsx-runtime"),ki=e=>(0,Ko.jsx)(Qo,{children:(0,Ko.jsx)(Wo,N({},e))});0&&(module.exports={ActivityVariant,ComplexVariant,ElementType,ExclusiveVariant,GatewayVariant,Modeler,RoutingVariant,useSelectionUtils});
|
package/lib/index.d.cts
CHANGED
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var $n=Object.defineProperty,Xn=Object.defineProperties;var qn=Object.getOwnPropertyDescriptors;var Ye=Object.getOwnPropertySymbols;var ao=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable;var no=(e,t,o)=>t in e?$n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))ao.call(t,o)&&no(e,o,t[o]);if(Ye)for(var o of Ye(t))io.call(t,o)&&no(e,o,t[o]);return e},_=(e,t)=>Xn(e,qn(t));var Ee=(e,t)=>{var o={};for(var r in e)ao.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Ye)for(var r of Ye(e))t.indexOf(r)<0&&io.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as jn,Notification as Jn}from"lecom-ui";import{jsx as Qn,jsxs as ea}from"react/jsx-runtime";function so({children:e}){return ea(jn,{children:[Qn(Jn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{Background as Cd,MiniMap as Id,ReactFlow as Ad,ReactFlowProvider as Sd,SelectionMode as kd,useEdgesState as Ld,useNodesState as Pd,useOnSelectionChange as Dd,useReactFlow as Rd}from"@xyflow/react";import{i18n as Md}from"lecom-ui";import{forwardRef as Vd,useCallback as jt,useEffect as wn,useImperativeHandle as Od,useRef as Gd,useState as Hd}from"react";import{useDebouncedCallback as Bd}from"use-debounce";var Pt=(n=>(n.ACTIVITY="activity",n.ROUTING="routing",n.GATEWAY="gateway",n.SUB_PROCESS="sub_process",n))(Pt||{}),Dt=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(Dt||{}),Rt=(s=>(s.SIMPLE="simple",s.LOOP="loop",s.SCRIPT="script",s.COMPLEX="complex",s.EXCLUSIVE="exclusive",s.PARALLEL="parallel",s.FINAL="final",s))(Rt||{}),Mt=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Mt||{}),Vt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Vt||{});import{RotateCcw as ma,ScrollText as ua,SquarePlus as fa}from"lucide-react";import{jsx as Ke,jsxs as ta}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>ta("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[Ke("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),Ke("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),Ke("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),Ke("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as lo}from"react/jsx-runtime";var be=({size:e=24,className:t})=>lo("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: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 Ae,jsxs as oa}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>oa("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 Ot,jsxs as ra}from"react/jsx-runtime";var he=({size:e=24,className:t})=>ra("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:"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"}),Ot("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Gt,jsxs as na}from"react/jsx-runtime";var Xe=({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:[Gt("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"}),Gt("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Gt("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ht,jsxs as aa}from"react/jsx-runtime";var co=({size:e=24,className:t})=>Ht("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:aa("g",{children:[Ht("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"}),Ht("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as ia}from"clsx";import{twMerge as sa}from"tailwind-merge";function S(...e){return sa(ia(e))}var Se=(e,t)=>e<t?t:e;import{jsx as po,jsxs as la}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>la("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:S("stroke-2",t),children:[po("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"}),po("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Bt}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>Bt("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Bt("g",{children:Bt("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 fo}from"react/jsx-runtime";var qe=({size:e=24,className:t})=>fo("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:fo("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 go}from"react/jsx-runtime";var ke=({size:e=24,className:t})=>go("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:S("stroke-2",t),children:go("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 zt,jsxs as da}from"react/jsx-runtime";var Eo=({size:e=24,className:t})=>da("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:[zt("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"}),zt("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"}),zt("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Le,jsxs as ca}from"react/jsx-runtime";var bo=({size:e=24,className:t})=>ca("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 je,jsxs as pa}from"react/jsx-runtime";var ho=({size:e=24,className:t})=>pa("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:[je("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"}),je("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),je("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),je("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var R=(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))(R||{});var Je={SCRIPT:{icon:ua},SUBPROCESS:{icon:fa}};var Qe={LOOP:{icon:ma}},ae=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(ae||{}),et={EXCLUSIVE:{icon:he},PARALLEL:{icon:Xe},COMPLEX:{icon:$e}};import yo from"@dagrejs/dagre";import{getNodesBounds as Ta}from"@xyflow/react";import{orderBy as xa}from"lodash";var ga={MIN_WIDTH:36,MIN_HEIGHT:36},Ea={MIN_WIDTH:36,MIN_HEIGHT:36},ba={MIN_WIDTH:56,MIN_HEIGHT:56},tt={MIN_WIDTH:176,MIN_HEIGHT:96},ot={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},Y={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},rt={MIN_WIDTH:176,MIN_HEIGHT:64},ha={MIN_WIDTH:128,MIN_HEIGHT:64},V={START_EVENT:ga,END_EVENT:Ea,GATEWAY:ba,TASK:tt,LANE:Y,ANNOTATION:rt,UNSUPPORTED:ha};import{orderBy as va}from"lodash";var oe=e=>{var t,o,r,n,i,a,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:(a=(i=e.measured)==null?void 0:i.width)!=null?a:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},re=e=>va(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),vo=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:i}=oe(t);return{x:o-n,y:r-i}};var ve=({parentId:e,nodes:t,includeTypes:o=[...Object.values(R)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),Na=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:i}=oe(t),a=o-n,s=r-i;return Math.sqrt(a*a+s*s)},ya=(e,t)=>{let{x:o,y:r,w:n,h:i}=oe(e),{x:a,y:s,w:l,h:d}=oe(t);return o<a+l&&a<o+n&&r<s+d&&s<r+i},Pe=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&ya(e,n)){let i=Na(e,n);i<r&&(r=i,o=n)}return o},No=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,i;return Math.max(o,(i=(n=r.measured)==null?void 0:n.width)!=null?i:0)},0);var To=(e=[],t=[],o="LR")=>{let r=new yo.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>r.setNode(i,{width:a,height:s})),t.forEach(i=>r.setEdge(i.source,i.target)),yo.layout(r),{nodes:e.map(i=>{let a=r.node(i.id);return _(N({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},me=(e,t)=>{var m,p;let o=[...t],r=o.find(g=>g.id===e);if(!r)return o;let n=o.filter(g=>g.parentId===e&&g.type==="LANE");if(n.length===0)return o;let i=xa(n,["position.y"]),a=Math.max((p=(m=r.measured)==null?void 0:m.width)!=null?p:0,ot.MIN_WIDTH),s=No(e,i)||Y.MIN_WIDTH,l=Math.max(a,s),d=0,E=0;i.forEach(g=>{var T,b,u,c;o=o.map(v=>v.id===g.id?_(N({},v),{width:l-Y.HEADER_WIDTH,measured:_(N({},v.measured),{width:l-Y.HEADER_WIDTH}),position:{x:Y.HEADER_WIDTH,y:d}}):v),d+=(b=(T=g.measured)==null?void 0:T.height)!=null?b:0,E+=(c=(u=g.measured)==null?void 0:u.height)!=null?c:0}),o=o.map(g=>g.id===e?_(N({},g),{height:E,width:l,measured:_(N({},g.measured),{height:E,width:l})}):g);let f=o.find(g=>g.id===e);return f!=null&&f.parentId&&(o=me(f.parentId,o)),o},xo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},_a=50,_o=(e,t=_a)=>{let o=Ta(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as wa}from"zustand";var M=wa(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 Ro,useReactFlow as ii}from"@xyflow/react";import{BaseEdge as Ya,EdgeLabelRenderer as Ka,getStraightPath as Za,useNodes as $a,useViewport as Xa}from"@xyflow/react";import{getIncomers as nt,getOutgoers as Ft,useReactFlow as Sa}from"@xyflow/react";import{Button as ka,Tooltip as La,TooltipContent as Pa,TooltipTrigger as Da,useTranslation as Ra}from"lecom-ui";import{PencilIcon as Ma}from"lucide-react";import{createContext as Ca,useContext as Ia}from"react";var wo=Ca(null),Co=wo.Provider,Io=()=>{let e=Ia(wo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as at,jsxs as Va}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=Ra(),{getNode:r,getEdge:n,getNodes:i,getEdges:a}=Sa(),{onConfigureElement:s}=Io(),l=c=>{let v=i(),C=a(),y=nt(c,v,C),A=Ft(c,v,C),h=y.some(k=>k.type==="START_EVENT"),x=A.some(k=>k.type==="END_EVENT");return h?"start":x?"end":"between"},d=c=>{var k,w,L;let v=i(),C=a(),y=r(c.source),A=r(c.target);if(!y||!A)return"simple";if(Ft(y,v,C).some(I=>I.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((k=y.data)==null?void 0:k.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let I=(w=y.data)==null?void 0:w.variant,P=(L=y.data)==null?void 0:L.attribute;return I==="SCRIPT"?"script":P==="LOOP"?"loop":"simple"}return"simple"},E=c=>{var k;let v=r(c.source);if(!v||v.type!=="GATEWAY"||((k=v.data)==null?void 0:k.variant)!=="COMPLEX")return;let C=i(),y=a(),A=nt(v,C,y),h=!1,x=!1;if(A.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(x=!0))}),h&&x)return"script_loop";if(h)return"script";if(x)return"loop"},f=c=>{var k;let v=r(c.source);if(!v||v.type!=="GATEWAY"||((k=v.data)==null?void 0:k.variant)!=="EXCLUSIVE")return;let C=i(),y=a(),A=nt(v,C,y),h=!1,x=!1;if(A.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(x=!0))}),h)return"script";if(x)return"loop"},m=c=>{var x,k;if(c.type!=="GATEWAY")return;let v=i(),C=a(),y=nt(c,v,C),A=!1,h=!1;if(y.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(A=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(h=!0))}),((x=c.data)==null?void 0:x.variant)==="COMPLEX"){if(A&&h)return"script_loop";if(A)return"script";if(h)return"loop"}else if(((k=c.data)==null?void 0:k.variant)==="EXCLUSIVE"){if(A)return"script";if(h)return"loop"}},p=c=>Ft(c,i(),a()).map(y=>{var A,h;return{id:y.id,type:y.type,variant:(A=y.data)==null?void 0:A.variant,label:(h=y.data)==null?void 0:h.label}}),g=c=>a().filter(y=>y.source===c.id).map(y=>{var A;return{id:y.id,type:"routing",variant:d(y),label:(A=y.data)==null?void 0:A.label,target:r(y.target)}}),T=()=>{var v,C,y,A,h;let c=r(e);if(c){if(c.type==="TASK"&&((v=c.data)==null?void 0:v.variant)==="SUBPROCESS"){s==null||s({id:c.id,type:"sub_process",variant:l(c),label:(C=c.data)==null?void 0:C.label,targets:p(c),edgeTargets:g(c)});return}if(c.type!=="GATEWAY"){s==null||s({id:c.id,type:"activity",variant:l(c),label:(y=c.data)==null?void 0:y.label,targets:p(c),edgeTargets:g(c)});return}s==null||s({id:c.id,type:"gateway",variant:((A=c.data)==null?void 0:A.variant)||"EXCLUSIVE",label:(h=c.data)==null?void 0:h.label,subVariant:m(c),targets:p(c)})}},b=()=>{let c=n(e);if(c){let v=d(c),C;v==="complex"?C=E(c):v==="exclusive"&&(C=f(c)),s==null||s({id:c.id,type:"routing",variant:v,subVariant:C,target:r(c.target)})}};return Va(La,{children:[at(Da,{asChild:!0,children:at(ka,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":T();break;case"edge":b();break}},children:at(Ma,{size:16})})}),at(Pa,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Oa}from"@xyflow/react";import{Button as Ga,Tooltip as Ha,TooltipContent as Ba,TooltipTrigger as za,useTranslation as Fa}from"lecom-ui";import{TrashIcon as Ua}from"lucide-react";import{jsx as st,jsxs as Wa}from"react/jsx-runtime";var lt=({elementId:e,elementType:t="node"})=>{let{t:o}=Fa(),{deleteElements:r}=Oa();return Wa(Ha,{children:[st(za,{asChild:!0,children:st(Ga,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:st(Ua,{size:16})})}),st(Ba,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as dt}from"react/jsx-runtime";var Ne=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=Ee(n,["edgeId","edgeType"]);var s;let i=[{component:dt(lt,{elementId:e,elementType:"edge"})}],a={SEQUENCE_EDGE:[{component:dt(De,{elementId:e,elementType:"edge"})},...i],MESSAGE_EDGE:[...i],ANNOTATION_EDGE:[...i]};return dt("div",_(N({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=a[t])==null?void 0:s.map((l,d)=>dt("div",{children:l.component},d))}))};import{jsx as pt,jsxs as qa}from"react/jsx-runtime";var mt={type:"ANNOTATION_EDGE",zIndex:2e3},Ao=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,selected:s,data:l})=>{let d=$a(),{zoom:E}=Xa(),{isMultipleSelection:f}=M(),m=d.find(v=>v.id===t),p=d.find(v=>v.id===o),[g,T,b]=Za({sourceX:r,sourceY:n,targetX:i,targetY:a}),u=s||(m==null?void 0:m.selected)||(p==null?void 0:p.selected),c=1/E;return qa("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":u}),children:[pt(Ya,{id:e,path:g,strokeDasharray:4,className:S("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)]":u&&!(l!=null&&l.hasError)})}),pt(Ka,{children:pt("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${T}px, ${b}px)`},children:s&&!f&&pt(Ne,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${c})`}})})})]})};import{BaseEdge as Qa,EdgeLabelRenderer as ei,getSmoothStepPath as ti,MarkerType as Lo,useNodes as oi,useReactFlow as ri,useViewport as ni}from"@xyflow/react";import{useState as ai}from"react";import{useEffect as So,useRef as ja,useState as Ja}from"react";import{jsx as ko}from"react/jsx-runtime";var U=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:i,style:a})=>{let s=ja(null),[l,d]=Ja(!1);So(()=>{d(r!=null?r:!1)},[r]),So(()=>{if(l&&s.current){s.current.focus();let p=document.createRange();p.selectNodeContents(s.current),p.collapse(!1);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(p))}},[l]);let E=p=>{p.stopPropagation(),d(!0)},f=p=>{let g=p.currentTarget.innerText;t&&g.length>=t&&p.preventDefault()},m=p=>{d(!1),n==null||n(),o==null||o(p.currentTarget.innerText)};return ko("div",{className:S("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",i,{"border border-dashed border-grey-400":l}),style:a,onDoubleClick:E,children:ko("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:m,children:e})})};import{jsx as ut,jsxs as Po}from"react/jsx-runtime";var ie={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Lo.ArrowClosed},markerEnd:{type:Lo.Arrow},data:{label:""}},Do=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:d,selected:E})=>{let f=oi(),{zoom:m}=ni(),{updateEdgeData:p}=ri(),{isMultipleSelection:g}=M(),[T,b]=ai(!1),u=f.find(P=>P.id===t),c=f.find(P=>P.id===o),[v,C,y]=ti({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),A=E||(u==null?void 0:u.selected)||(c==null?void 0:c.selected),h=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",x=T||(d==null?void 0:d.label.trim().length)>0,k=1/m,w=()=>{b(!0)},L=()=>{b(!1)},I=P=>{p(e,{label:P.trim()})};return Po("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:L,onDoubleClick:w,children:[ut(Qa,{id:e,path:v,markerEnd:`url(#${h})`,className:S("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)})}),ut(ei,{children:Po("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C}px, ${y}px)`},children:[E&&!g&&ut(Ne,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${k})`}}),x&&ut(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:T,onChange:I})]})})]})};var Mo=({setEdges:e})=>{let{getNode:t}=ii();return{isValidConnection:n=>{let i=t(n.source),a=t(n.target);if((i==null?void 0:i.id)===(a==null?void 0:a.id))return!1;switch(i==null?void 0:i.type){case"START_EVENT":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"END_EVENT":return(a==null?void 0:a.type)==="ANNOTATION";case"TASK":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"GATEWAY":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"LANE":return(a==null?void 0:a.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(i=>{let a=t(n.target);return(a==null?void 0:a.type)==="ANNOTATION"?Ro(N(N({},n),mt),i):Ro(N(N({},n),ie),i)})}}};import{useState as Wo}from"react";import{useTranslation as si}from"lecom-ui";import{useReactFlow as li}from"@xyflow/react";var Re=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ue=(e=[])=>e.filter(t=>t.type==="END_EVENT"),se=(e=[])=>e.filter(t=>t.type==="TASK")||[],Vo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Oo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ft=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Go=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),X=(e,t=[])=>t.filter(o=>o.source===e),Me=(e,t=[])=>t.filter(o=>o.target===e),Ho=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(i=>i.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Bo=(e,t)=>{let o=X(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(i=>i.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},zo=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)}},Fo=(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=ue(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(i=>i.id)});let r=X(t[0].id,e.edges);if(!(r.length<=1)){let i=[...t.map(a=>a.id),...r.map(a=>a.target)];return D({isValid:!1,nodeIds:[...new Set(i)]})}return D({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=se(e.nodes),o=Q(t,r=>X(r.id,e.edges).length<=2);return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=se(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=se(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=se(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let i=n.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(i=>r.push(i.id));return D({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ft(e.nodes),o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.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),...ue(e.nodes)],o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(a.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=ue(e.nodes),o=[],r=[];for(let n of t){let i=Me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.source);if(s&&s.type==="TASK"){let l=X(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=Go(e.nodes),o=Q(t,n=>X(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>X(n,e.edges).map(i=>i.id));return D({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=se(e.nodes),o=Q(t,r=>!r.label||zo(r.label));return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var a,s;if(!((a=e==null?void 0:e.nodes)!=null&&a.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return D({isValid:!0});let t=ue(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=se(e.nodes).filter(l=>o.some(d=>d.source===l.id)),i=Q(n,l=>!Ho(l.id,e));return D({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=se(e.nodes),o=ue(e.nodes)[0];if(!o)return D({isValid:!0});let r=t.filter(l=>{let d=Me(l.id,e.edges),E=X(l.id,e.edges),f=d.some(p=>{var g;return((g=e.nodes.find(T=>T.id===p.source))==null?void 0:g.type)==="START_EVENT"}),m=E.some(p=>{var g;return((g=e.nodes.find(T=>T.id===p.target))==null?void 0:g.type)==="END_EVENT"});return f&&m}),n=Me(o.id,e.edges),i=n.length>1,a=n.map(l=>l.source),s={isValid:r.length===0&&!i,nodeIds:[...r.map(l=>l.id),...i?a:[]]};return D(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ft(e.nodes),o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(a.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=ft(e.nodes),o=Q(t,r=>X(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),...ue(e.nodes)],o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.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=Vo(e.nodes),o=Q(t,r=>!Bo(r.id,e));return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Oo(e.nodes),o=Q(t,r=>{var n,i;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((i=r.properties)==null?void 0:i.subprocessRef)!==""});return D({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Uo=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 Yo=()=>{let{t:e}=si(),[t,o]=Wo(null),{setNodes:r,setEdges:n,getNodes:i,getEdges:a}=li(),[s,l]=Wo(!1);return{validationResult:t,validateDiagram:m=>{let p=Fo(m.nodes,m.edges),g=Uo(p),T=g.errors.map(b=>_(N({},b),{message:e(`validation.errors.${b.id}`)}));return s||l(!0),{isValid:g.isValid,errors:T}},handleValidationComplete:m=>{if(o(m),!m)return;let p=[],g=[];m.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(x=>p.push(x)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(x=>g.push(x))});let T=[...new Set(p)];r(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:!1})}))),n(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:!1})})));let b=i(),u=a(),c=new Set(T),v=new Set;m.errors.forEach(h=>{var w,L;let x=Ve.find(I=>I.id===h.id);(x==null?void 0:x.highlightRelatedEdges)!==!1&&((w=h.edgeIds)==null||w.forEach(I=>v.add(I)),(L=h.nodeIds)==null||L.forEach(I=>{u.forEach(P=>{(P.source===I||P.target===I)&&v.add(P.id)})}))});let C=new Set,y=new Set,A=new Set;b.forEach(h=>{h.type==="START_EVENT"?C.add(h.id):h.type==="END_EVENT"&&y.add(h.id)}),u.forEach(h=>{C.has(h.source)&&A.add(h.target),y.has(h.target)&&A.add(h.source)}),A.forEach(h=>{var x,k;if(c.has(h)){let w=(x=m.errors.find(I=>{var P;return(P=I.nodeIds)==null?void 0:P.includes(h)}))==null?void 0:x.id;((k=Ve.find(I=>I.id===w))==null?void 0:k.highlightRelatedEdges)!==!1&&u.forEach(I=>{I.source===h&&y.has(I.target)&&(c.add(I.target),v.add(I.id)),I.target===h&&C.has(I.source)&&(c.add(I.source),v.add(I.id))})}}),c.size>0&&r(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:c.has(x.id)})}))),v.size>0&&n(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:v.has(x.id)})})))},clearValidation:()=>{o(null),l(!1),r(m=>m.map(p=>_(N({},p),{data:_(N({},p.data),{hasError:!1})}))),n(m=>m.map(p=>_(N({},p),{data:_(N({},p.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as di}from"@xyflow/react";import{useEffect as ci}from"react";import{v7 as Ko}from"uuid";var pi=15,Zo="bpmn:selection",$o=({offset:e=pi}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=di();ci(()=>{let i=s=>{var p;s.preventDefault();let l=t(),d=r(),E=l.filter(g=>g.selected);if(!E.length)return;let f=d.filter(g=>E.some(T=>T.id===g.source)&&E.some(T=>T.id===g.target)),m={nodes:E,edges:f};(p=s.clipboardData)==null||p.setData(Zo,JSON.stringify(m))},a=s=>{var m,p;s.preventDefault();let l=JSON.parse(((m=s.clipboardData)==null?void 0:m.getData(Zo))||"{}");if(!((p=l.nodes)!=null&&p.length))return;let d=new Map,E=l.nodes.map(g=>{let T=Ko();return d.set(g.id,T),_(N({},g),{id:T,selected:!0,position:{x:g.position.x+e,y:g.position.y+e}})}),f=l.edges.map(g=>_(N({},g),{id:Ko(),selected:!0,source:d.get(g.source)||g.source,target:d.get(g.target)||g.target}));o(g=>[...g.map(T=>_(N({},T),{selected:!1})),...E]),n(g=>[...g.map(T=>_(N({},T),{selected:!1})),...f])};return document.addEventListener("copy",i),document.addEventListener("paste",a),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",a)}},[t,o,r,n,e])};import{useReactFlow as Ti,useStoreApi as xi}from"@xyflow/react";import{v7 as Qo}from"uuid";import{create as mi}from"zustand";var ye=mi(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as ui,EdgeLabelRenderer as fi,getSmoothStepPath as gi,MarkerType as Ei,useNodes as bi,useReactFlow as hi,useViewport as vi}from"@xyflow/react";import{useState as Ni}from"react";import{jsx as gt,jsxs as Xo}from"react/jsx-runtime";var Km={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:Ei.Arrow},data:{label:""}},qo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:d,selected:E})=>{let f=bi(),{zoom:m}=vi(),{updateEdgeData:p}=hi(),{isMultipleSelection:g}=M(),[T,b]=Ni(!1),u=f.find(P=>P.id===t),c=f.find(P=>P.id===o),[v,C,y]=gi({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),A=E||(u==null?void 0:u.selected)||(c==null?void 0:c.selected),h=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",x=T||(d==null?void 0:d.label.trim().length)>0,k=1/m,w=()=>{b(!0)},L=()=>{b(!1)},I=P=>{p(e,{label:P.trim()})};return Xo("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:L,onDoubleClick:w,children:[gt(ui,{id:e,path:v,markerEnd:`url(#${h})`,strokeDasharray:4,className:S("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(fi,{children:Xo("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C}px, ${y}px)`},children:[E&&!g&>(Ne,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${k})`}}),x&>(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:T,onChange:I})]})})]})};import{jsx as jo,jsxs as yi}from"react/jsx-runtime";var Jo=({fromX:e,fromY:t,toX:o,toY:r})=>yi("g",{children:[jo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),jo("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var er=({nodes:e,setNodes:t,setEdges:o})=>{let r=xi(),{draggableNode:n,setDraggableNode:i}=ye(),{getInternalNode:a,screenToFlowPosition:s}=Ti(),l=b=>{let u="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(c=>c.map(v=>_(N({},v),{className:v.id===b?u:""})))},d=()=>{let{nodeLookup:b}=r.getState();return Array.from(b.values())},E=b=>{let u=a(b.id),c=d();if(b.type==="LANE"){if(ve({parentId:b.id,nodes:e,includeTypes:["LANE"]})){l();return}let x=c.filter(L=>L.id!==b.id&&L.type==="LANE"&&!L.parentId),k=Pe(u,x);if(!k){l();return}if(ve({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let C=c.filter(h=>h.id!==b.id&&h.type==="LANE"),y=Pe(u,C);if(!y){l();return}if(ve({parentId:y.id,nodes:e,includeTypes:["LANE"]})){l();return}l(y.id)},f=b=>{b.preventDefault(),b.dataTransfer.dropEffect="move"},m=(b,u)=>{b.preventDefault(),E(u)},p=(b,u,c)=>{var x,k;let v=w=>w.map(L=>_(N({},L),{className:void 0}));if(b.parentId===u.id){let w=me(u.id,c);t(re(v(w)));return}if(b.type==="LANE"){if(ve({parentId:u.id,nodes:c,excludeTypes:["LANE"]}))return;let I=c.filter(z=>z.parentId===u.id).reduce((z,ge)=>{var ce,pe;return z+((pe=(ce=ge.measured)==null?void 0:ce.height)!=null?pe:0)},0),P={x:Y.HEADER_WIDTH,y:I},K=c.map(z=>z.id===b.id?_(N({},z),{parentId:u.id,position:P,className:void 0}):_(N({},z),{className:void 0}));K=me(u.id,K),t(re(K));return}if(ve({parentId:u.id,nodes:c,includeTypes:["LANE"]})){let w;if(b.parentId){let I=a(b.parentId),{x:P,y:K}=oe(I);w={x:P+((x=b.position.x)!=null?x:0),y:K+((k=b.position.y)!=null?k:0)}}let L=c.map(I=>I.id===b.id?_(N({},I),{position:w!=null?w:I.position,parentId:void 0,className:void 0}):_(N({},I),{className:void 0}));t(re(L));return}let A=vo(b,u),h=c.map(w=>w.id===b.id?_(N({},w),{parentId:u.id,position:A,className:void 0}):_(N({},w),{className:void 0}));t(re(h))};return{onDragOver:f,onDrop:b=>{if(b.preventDefault(),!(n!=null&&n.type))return;let u=s({x:b.clientX,y:b.clientY}),c={width:V[n.type].MIN_WIDTH,height:V[n.type].MIN_HEIGHT},v={id:Qo(),type:n.type,position:u,measured:c,data:{label:"",variant:n.variant,attribute:n.attribute}},C=_(N({},v),{internals:{positionAbsolute:u}}),y=d(),A=n.type==="LANE",h=y.filter(w=>A?w.type==="LANE"&&!w.parentId:w.type==="LANE"),x=Pe(C,h);x?p(C,x,[...y,C]):t(w=>{let L=w.concat(v);return re(L)});let k=b.dataTransfer.getData("sourceId");if(k){let w={id:Qo(),source:k,target:v.id};if(n.type==="ANNOTATION"){o(L=>L.concat(N(N({},w),mt)));return}o(L=>L.concat(N(N({},w),ie)))}i(null)},onNodeDrag:m,onNodeDragStop:async(b,u)=>{var x,k;let{nodeLookup:c}=r.getState(),v=a(u.id),C=Array.from(c.values()),y=u.type==="LANE",A=C.filter(w=>w.id!==u.id&&(y?w.type==="LANE"&&!w.parentId:w.type==="LANE")),h=Pe(v,A);if(h){p(v,h,C);return}if(u.parentId){let w=a(u.parentId),{x:L,y:I}=oe(w),P={x:L+((x=u.position.x)!=null?x:0),y:I+((k=u.position.y)!=null?k:0)},K=e.map(z=>z.id===u.id?_(N({},z),{position:P,parentId:void 0}):z);K=me(u.parentId,K),t(re(K))}}}};import{applyNodeChanges as _i}from"@xyflow/react";import{useCallback as wi,useState as or}from"react";function tr(e,t,o=5){var l,d,E,f,m,p,g,T;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(b=>b.id===e.id);if(!n||!e.position)return r;let i={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=(E=n.measured)==null?void 0:E.height)!=null?f:0),width:(p=(m=n.measured)==null?void 0:m.width)!=null?p:0,height:(T=(g=n.measured)==null?void 0:g.height)!=null?T:0},a=o,s=o;return t.filter(b=>b.id!==n.id).reduce((b,u)=>{var L,I,P,K,z,ge,ce,pe;let c={left:u.position.x,right:u.position.x+((I=(L=u.measured)==null?void 0:L.width)!=null?I:0),top:u.position.y,bottom:u.position.y+((K=(P=u.measured)==null?void 0:P.height)!=null?K:0),width:(ge=(z=u.measured)==null?void 0:z.width)!=null?ge:0,height:(pe=(ce=u.measured)==null?void 0:ce.height)!=null?pe:0},v=Math.abs(i.left-c.left);v<s&&(b.snapPosition.x=c.left,b.vertical=c.left,s=v);let C=Math.abs(i.right-c.right);C<s&&(b.snapPosition.x=c.right-i.width,b.vertical=c.right,s=C);let y=Math.abs(i.left-c.right);y<s&&(b.snapPosition.x=c.right,b.vertical=c.right,s=y);let A=Math.abs(i.right-c.left);A<s&&(b.snapPosition.x=c.left-i.width,b.vertical=c.left,s=A);let h=Math.abs(i.top-c.top);h<a&&(b.snapPosition.y=c.top,b.horizontal=c.top,a=h);let x=Math.abs(i.bottom-c.top);x<a&&(b.snapPosition.y=c.top-i.height,b.horizontal=c.top,a=x);let k=Math.abs(i.bottom-c.bottom);k<a&&(b.snapPosition.y=c.bottom-i.height,b.horizontal=c.bottom,a=k);let w=Math.abs(i.top-c.bottom);return w<a&&(b.snapPosition.y=c.bottom,b.horizontal=c.bottom,a=w),b},r)}var rr=()=>{let[e,t]=or(void 0),[o,r]=or(void 0),n=wi((i,a)=>{var s,l;if(t(void 0),r(void 0),i.length===1&&i[0].type==="position"&&i[0].dragging&&i[0].position){let d=tr(i[0],a);i[0].position.x=(s=d.snapPosition.x)!=null?s:i[0].position.x,i[0].position.y=(l=d.snapPosition.y)!=null?l:i[0].position.y,t(d.horizontal),r(d.vertical)}return _i(i,a)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ii}from"@xyflow/react";import{v7 as lr}from"uuid";var ar={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},ir={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},nr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],a="",s="",l="";if(o.length){switch(o[1]){case"<start>":a="start-event";break;case"<end>":a="end-event";break}e=e.replace(o[1],"")}return r.length&&(a="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(a="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:a,label:s}),{step:e,type:a,label:s,edgeLabel:l}},Ci=e=>{e=e||"";let t=e.trim().split(`
|
|
2
|
-
`),o={},r=[];return t.forEach(n=>{n=n||"";let i=n.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=nr(i[0],o),s=nr(i[1],o);a&&s&&r.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},sr=e=>{let{components:t,connections:o}=Ci(e);return{nodes:t,edges:o}};var dr=()=>{let{setNodes:e,setEdges:t,fitView:o}=Ii();return{createDiagram:n=>{let{nodes:i,edges:a}=sr(n),s=[],l=new Map;for(let[m,p]of Object.entries(i)){let g=lr(),T=ar[p.type],b=ir[p.type];l.set(m,g);let u=V[T].MIN_WIDTH,
|
|
1
|
+
var $n=Object.defineProperty,Xn=Object.defineProperties;var qn=Object.getOwnPropertyDescriptors;var Ye=Object.getOwnPropertySymbols;var ao=Object.prototype.hasOwnProperty,io=Object.prototype.propertyIsEnumerable;var no=(e,t,o)=>t in e?$n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,N=(e,t)=>{for(var o in t||(t={}))ao.call(t,o)&&no(e,o,t[o]);if(Ye)for(var o of Ye(t))io.call(t,o)&&no(e,o,t[o]);return e},_=(e,t)=>Xn(e,qn(t));var Ee=(e,t)=>{var o={};for(var r in e)ao.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&Ye)for(var r of Ye(e))t.indexOf(r)<0&&io.call(e,r)&&(o[r]=e[r]);return o};import{TooltipProvider as jn,Notification as Jn}from"lecom-ui";import{jsx as Qn,jsxs as ea}from"react/jsx-runtime";function so({children:e}){return ea(jn,{children:[Qn(Jn,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),e]})}import{Background as Cd,MiniMap as Id,ReactFlow as Ad,ReactFlowProvider as Sd,SelectionMode as kd,useEdgesState as Ld,useNodesState as Pd,useOnSelectionChange as Dd,useReactFlow as Rd}from"@xyflow/react";import{i18n as Md}from"lecom-ui";import{forwardRef as Vd,useCallback as jt,useEffect as wn,useImperativeHandle as Od,useRef as Gd,useState as Hd}from"react";import{useDebouncedCallback as Bd}from"use-debounce";var Pt=(n=>(n.ACTIVITY="activity",n.ROUTING="routing",n.GATEWAY="gateway",n.SUB_PROCESS="sub_process",n))(Pt||{}),Dt=(r=>(r.START="start",r.END="end",r.BETWEEN="between",r))(Dt||{}),Rt=(l=>(l.SIMPLE="simple",l.LOOP="loop",l.SCRIPT="script",l.COMPLEX="complex",l.EXCLUSIVE="exclusive",l.PARALLEL="parallel",l.FINAL="final",l.TO_SUB_PROCESS="to_sub_process",l))(Rt||{}),Mt=(r=>(r.SCRIPT="script",r.LOOP="loop",r.SCRIPT_LOOP="script_loop",r))(Mt||{}),Vt=(o=>(o.SCRIPT="script",o.LOOP="loop",o))(Vt||{});import{RotateCcw as ma,ScrollText as ua,SquarePlus as fa}from"lucide-react";import{jsx as Ke,jsxs as ta}from"react/jsx-runtime";var Ze=({size:e=24,className:t})=>ta("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[Ke("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),Ke("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),Ke("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),Ke("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});import{jsx as lo}from"react/jsx-runtime";var be=({size:e=24,className:t})=>lo("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: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 Ae,jsxs as oa}from"react/jsx-runtime";var $e=({size:e=24,className:t})=>oa("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 Ot,jsxs as ra}from"react/jsx-runtime";var he=({size:e=24,className:t})=>ra("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:"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"}),Ot("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),Ot("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Gt,jsxs as na}from"react/jsx-runtime";var Xe=({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:[Gt("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"}),Gt("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),Gt("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Ht,jsxs as aa}from"react/jsx-runtime";var co=({size:e=24,className:t})=>Ht("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:aa("g",{children:[Ht("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"}),Ht("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});import{clsx as ia}from"clsx";import{twMerge as sa}from"tailwind-merge";function S(...e){return sa(ia(e))}var Se=(e,t)=>e<t?t:e;import{jsx as po,jsxs as la}from"react/jsx-runtime";var mo=({size:e=24,className:t})=>la("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"#6b7280",strokeWidth:2,xmlns:"http://www.w3.org/2000/svg",className:S("stroke-2",t),children:[po("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"}),po("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Bt}from"react/jsx-runtime";var uo=({size:e=24,className:t})=>Bt("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:Bt("g",{children:Bt("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 fo}from"react/jsx-runtime";var qe=({size:e=24,className:t})=>fo("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:fo("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 go}from"react/jsx-runtime";var ke=({size:e=24,className:t})=>go("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:S("stroke-2",t),children:go("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 zt,jsxs as da}from"react/jsx-runtime";var Eo=({size:e=24,className:t})=>da("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:[zt("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"}),zt("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"}),zt("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Le,jsxs as ca}from"react/jsx-runtime";var bo=({size:e=24,className:t})=>ca("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 je,jsxs as pa}from"react/jsx-runtime";var ho=({size:e=24,className:t})=>pa("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:[je("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"}),je("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),je("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),je("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var R=(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))(R||{});var Je={SCRIPT:{icon:ua},SUBPROCESS:{icon:fa}};var Qe={LOOP:{icon:ma}},ae=(r=>(r.EXCLUSIVE="EXCLUSIVE",r.PARALLEL="PARALLEL",r.COMPLEX="COMPLEX",r))(ae||{}),et={EXCLUSIVE:{icon:he},PARALLEL:{icon:Xe},COMPLEX:{icon:$e}};import yo from"@dagrejs/dagre";import{getNodesBounds as Ta}from"@xyflow/react";import{orderBy as xa}from"lodash";var ga={MIN_WIDTH:36,MIN_HEIGHT:36},Ea={MIN_WIDTH:36,MIN_HEIGHT:36},ba={MIN_WIDTH:56,MIN_HEIGHT:56},tt={MIN_WIDTH:176,MIN_HEIGHT:96},ot={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},K={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},rt={MIN_WIDTH:176,MIN_HEIGHT:64},ha={MIN_WIDTH:128,MIN_HEIGHT:64},V={START_EVENT:ga,END_EVENT:Ea,GATEWAY:ba,TASK:tt,LANE:K,ANNOTATION:rt,UNSUPPORTED:ha};import{orderBy as va}from"lodash";var oe=e=>{var t,o,r,n,i,a,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:(a=(i=e.measured)==null?void 0:i.width)!=null?a:0,h:(l=(s=e.measured)==null?void 0:s.height)!=null?l:0}},re=e=>va(e,[t=>t.parentId?1:t.type!=="LANE"?2:0],["asc"]),vo=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:i}=oe(t);return{x:o-n,y:r-i}};var ve=({parentId:e,nodes:t,includeTypes:o=[...Object.values(R)],excludeTypes:r=[]})=>t.some(n=>n.parentId===e&&(!o.length||o.includes(n.type))&&!r.includes(n.type)),Na=(e,t)=>{let{x:o,y:r}=oe(e),{x:n,y:i}=oe(t),a=o-n,s=r-i;return Math.sqrt(a*a+s*s)},ya=(e,t)=>{let{x:o,y:r,w:n,h:i}=oe(e),{x:a,y:s,w:l,h:c}=oe(t);return o<a+l&&a<o+n&&r<s+c&&s<r+i},Pe=(e,t)=>{let o=null,r=1/0;for(let n of t)if(n.id!==e.id&&ya(e,n)){let i=Na(e,n);i<r&&(r=i,o=n)}return o},No=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,r)=>{var n,i;return Math.max(o,(i=(n=r.measured)==null?void 0:n.width)!=null?i:0)},0);var To=(e=[],t=[],o="LR")=>{let r=new yo.graphlib.Graph;return r.setDefaultEdgeLabel(()=>({})),r.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>r.setNode(i,{width:a,height:s})),t.forEach(i=>r.setEdge(i.source,i.target)),yo.layout(r),{nodes:e.map(i=>{let a=r.node(i.id);return _(N({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},me=(e,t)=>{var m,p;let o=[...t],r=o.find(g=>g.id===e);if(!r)return o;let n=o.filter(g=>g.parentId===e&&g.type==="LANE");if(n.length===0)return o;let i=xa(n,["position.y"]),a=Math.max((p=(m=r.measured)==null?void 0:m.width)!=null?p:0,ot.MIN_WIDTH),s=No(e,i)||K.MIN_WIDTH,l=Math.max(a,s),c=0,E=0;i.forEach(g=>{var T,b,u,d;o=o.map(v=>v.id===g.id?_(N({},v),{width:l-K.HEADER_WIDTH,measured:_(N({},v.measured),{width:l-K.HEADER_WIDTH}),position:{x:K.HEADER_WIDTH,y:c}}):v),c+=(b=(T=g.measured)==null?void 0:T.height)!=null?b:0,E+=(d=(u=g.measured)==null?void 0:u.height)!=null?d:0}),o=o.map(g=>g.id===e?_(N({},g),{height:E,width:l,measured:_(N({},g.measured),{height:E,width:l})}):g);let f=o.find(g=>g.id===e);return f!=null&&f.parentId&&(o=me(f.parentId,o)),o},xo=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},_a=50,_o=(e,t=_a)=>{let o=Ta(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};import{create as wa}from"zustand";var M=wa(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 Ro,useReactFlow as ii}from"@xyflow/react";import{BaseEdge as Ya,EdgeLabelRenderer as Ka,getStraightPath as Za,useNodes as $a,useViewport as Xa}from"@xyflow/react";import{getIncomers as nt,getOutgoers as Ut,useReactFlow as Sa}from"@xyflow/react";import{Button as ka,Tooltip as La,TooltipContent as Pa,TooltipTrigger as Da,useTranslation as Ra}from"lecom-ui";import{PencilIcon as Ma}from"lucide-react";import{createContext as Ca,useContext as Ia}from"react";var wo=Ca(null),Co=wo.Provider,Io=()=>{let e=Ia(wo);if(!e)throw new Error("useEditor must be used within an <EditorProvider />");return e};import{jsx as at,jsxs as Va}from"react/jsx-runtime";var De=({elementId:e,elementType:t="node"})=>{let{t:o}=Ra(),{getNode:r,getEdge:n,getNodes:i,getEdges:a}=Sa(),{onConfigureElement:s}=Io(),l=d=>{let v=i(),C=a(),y=nt(d,v,C),A=Ut(d,v,C),h=y.some(k=>k.type==="START_EVENT"),x=A.some(k=>k.type==="END_EVENT");return h?"start":x?"end":"between"},c=d=>{var k,w,L,I;let v=i(),C=a(),y=r(d.source),A=r(d.target);if(!y||!A)return"simple";if(Ut(y,v,C).some(P=>P.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((k=y.data)==null?void 0:k.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let P=(w=y.data)==null?void 0:w.variant,z=(L=y.data)==null?void 0:L.attribute;return A.type==="TASK"&&((I=A.data)==null?void 0:I.variant)==="SUBPROCESS"?"to_sub_process":P==="SCRIPT"?"script":z==="LOOP"?"loop":"simple"}return"simple"},E=d=>{var k;let v=r(d.source);if(!v||v.type!=="GATEWAY"||((k=v.data)==null?void 0:k.variant)!=="COMPLEX")return;let C=i(),y=a(),A=nt(v,C,y),h=!1,x=!1;if(A.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(x=!0))}),h&&x)return"script_loop";if(h)return"script";if(x)return"loop"},f=d=>{var k;let v=r(d.source);if(!v||v.type!=="GATEWAY"||((k=v.data)==null?void 0:k.variant)!=="EXCLUSIVE")return;let C=i(),y=a(),A=nt(v,C,y),h=!1,x=!1;if(A.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(h=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(x=!0))}),h)return"script";if(x)return"loop"},m=d=>{var x,k;if(d.type!=="GATEWAY")return;let v=i(),C=a(),y=nt(d,v,C),A=!1,h=!1;if(y.forEach(w=>{var L,I;w.type==="TASK"&&(((L=w.data)==null?void 0:L.variant)==="SCRIPT"&&(A=!0),((I=w.data)==null?void 0:I.attribute)==="LOOP"&&(h=!0))}),((x=d.data)==null?void 0:x.variant)==="COMPLEX"){if(A&&h)return"script_loop";if(A)return"script";if(h)return"loop"}else if(((k=d.data)==null?void 0:k.variant)==="EXCLUSIVE"){if(A)return"script";if(h)return"loop"}},p=d=>Ut(d,i(),a()).map(y=>{var A,h;return{id:y.id,type:y.type,variant:(A=y.data)==null?void 0:A.variant,label:(h=y.data)==null?void 0:h.label}}),g=d=>a().filter(y=>y.source===d.id).map(y=>{var A;return{id:y.id,type:"routing",variant:c(y),label:(A=y.data)==null?void 0:A.label,target:r(y.target)}}),T=()=>{var v,C,y,A,h;let d=r(e);if(d){if(d.type==="TASK"&&((v=d.data)==null?void 0:v.variant)==="SUBPROCESS"){s==null||s({id:d.id,type:"sub_process",variant:l(d),label:(C=d.data)==null?void 0:C.label,targets:p(d),edgeTargets:g(d)});return}if(d.type!=="GATEWAY"){s==null||s({id:d.id,type:"activity",variant:l(d),label:(y=d.data)==null?void 0:y.label,targets:p(d),edgeTargets:g(d)});return}s==null||s({id:d.id,type:"gateway",variant:((A=d.data)==null?void 0:A.variant)||"EXCLUSIVE",label:(h=d.data)==null?void 0:h.label,subVariant:m(d),targets:p(d)})}},b=()=>{let d=n(e);if(d){let v=c(d),C;v==="complex"?C=E(d):v==="exclusive"&&(C=f(d)),s==null||s({id:d.id,type:"routing",variant:v,subVariant:C,target:r(d.target)}),console.log({id:d.id,type:"routing",variant:v,subVariant:C,target:r(d.target)})}};return Va(La,{children:[at(Da,{asChild:!0,children:at(ka,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":T();break;case"edge":b();break}},children:at(Ma,{size:16})})}),at(Pa,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};import{useReactFlow as Oa}from"@xyflow/react";import{Button as Ga,Tooltip as Ha,TooltipContent as Ba,TooltipTrigger as za,useTranslation as Ua}from"lecom-ui";import{TrashIcon as Fa}from"lucide-react";import{jsx as st,jsxs as Wa}from"react/jsx-runtime";var lt=({elementId:e,elementType:t="node"})=>{let{t:o}=Ua(),{deleteElements:r}=Oa();return Wa(Ha,{children:[st(za,{asChild:!0,children:st(Ga,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{r(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:st(Fa,{size:16})})}),st(Ba,{color:"black",children:o("editor.toolbar.delete")})]})};import{jsx as dt}from"react/jsx-runtime";var Ne=r=>{var n=r,{edgeId:e,edgeType:t}=n,o=Ee(n,["edgeId","edgeType"]);var s;let i=[{component:dt(lt,{elementId:e,elementType:"edge"})}],a={SEQUENCE_EDGE:[{component:dt(De,{elementId:e,elementType:"edge"})},...i],MESSAGE_EDGE:[...i],ANNOTATION_EDGE:[...i]};return dt("div",_(N({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},o),{children:(s=a[t])==null?void 0:s.map((l,c)=>dt("div",{children:l.component},c))}))};import{jsx as pt,jsxs as qa}from"react/jsx-runtime";var mt={type:"ANNOTATION_EDGE",zIndex:2e3},Ao=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,selected:s,data:l})=>{let c=$a(),{zoom:E}=Xa(),{isMultipleSelection:f}=M(),m=c.find(v=>v.id===t),p=c.find(v=>v.id===o),[g,T,b]=Za({sourceX:r,sourceY:n,targetX:i,targetY:a}),u=s||(m==null?void 0:m.selected)||(p==null?void 0:p.selected),d=1/E;return qa("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":u}),children:[pt(Ya,{id:e,path:g,strokeDasharray:4,className:S("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)]":u&&!(l!=null&&l.hasError)})}),pt(Ka,{children:pt("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${T}px, ${b}px)`},children:s&&!f&&pt(Ne,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${d})`}})})})]})};import{BaseEdge as Qa,EdgeLabelRenderer as ei,getSmoothStepPath as ti,MarkerType as Lo,useNodes as oi,useReactFlow as ri,useViewport as ni}from"@xyflow/react";import{useState as ai}from"react";import{useEffect as So,useRef as ja,useState as Ja}from"react";import{jsx as ko}from"react/jsx-runtime";var W=({value:e,maxLength:t,onChange:o,isEditing:r,onBlur:n,className:i,style:a})=>{let s=ja(null),[l,c]=Ja(!1);So(()=>{c(r!=null?r:!1)},[r]),So(()=>{if(l&&s.current){s.current.focus();let p=document.createRange();p.selectNodeContents(s.current),p.collapse(!1);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(p))}},[l]);let E=p=>{p.stopPropagation(),c(!0)},f=p=>{let g=p.currentTarget.innerText;t&&g.length>=t&&p.preventDefault()},m=p=>{c(!1),n==null||n(),o==null||o(p.currentTarget.innerText)};return ko("div",{className:S("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",i,{"border border-dashed border-grey-400":l}),style:a,onDoubleClick:E,children:ko("div",{ref:s,className:"outline-none whitespace-pre-wrap overflow-hidden",contentEditable:l,suppressContentEditableWarning:!0,onKeyDown:f,onBlur:m,children:e})})};import{jsx as ut,jsxs as Po}from"react/jsx-runtime";var ie={type:"SEQUENCE_EDGE",zIndex:2e3,markerStart:{type:Lo.ArrowClosed},markerEnd:{type:Lo.Arrow},data:{label:""}},Do=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:c,selected:E})=>{let f=oi(),{zoom:m}=ni(),{updateEdgeData:p}=ri(),{isMultipleSelection:g}=M(),[T,b]=ai(!1),u=f.find(P=>P.id===t),d=f.find(P=>P.id===o),[v,C,y]=ti({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),A=E||(u==null?void 0:u.selected)||(d==null?void 0:d.selected),h=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",x=T||(c==null?void 0:c.label.trim().length)>0,k=1/m,w=()=>{b(!0)},L=()=>{b(!1)},I=P=>{p(e,{label:P.trim()})};return Po("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:L,onDoubleClick:w,children:[ut(Qa,{id:e,path:v,markerEnd:`url(#${h})`,className:S("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(c!=null&&c.hasError)})}),ut(ei,{children:Po("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C}px, ${y}px)`},children:[E&&!g&&ut(Ne,{edgeId:e,edgeType:"SEQUENCE_EDGE",style:{transform:`scale(${k})`}}),x&&ut(W,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:T,onChange:I})]})})]})};var Mo=({setEdges:e})=>{let{getNode:t}=ii();return{isValidConnection:n=>{let i=t(n.source),a=t(n.target);if((i==null?void 0:i.id)===(a==null?void 0:a.id))return!1;switch(i==null?void 0:i.type){case"START_EVENT":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"END_EVENT":return(a==null?void 0:a.type)==="ANNOTATION";case"TASK":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"GATEWAY":return(a==null?void 0:a.type)==="TASK"||(a==null?void 0:a.type)==="END_EVENT"||(a==null?void 0:a.type)==="GATEWAY"||(a==null?void 0:a.type)==="ANNOTATION";case"LANE":return(a==null?void 0:a.type)==="ANNOTATION";default:return!1}},onConnect:n=>{e(i=>{let a=t(n.target);return(a==null?void 0:a.type)==="ANNOTATION"?Ro(N(N({},n),mt),i):Ro(N(N({},n),ie),i)})}}};import{useState as Wo}from"react";import{useTranslation as si}from"lecom-ui";import{useReactFlow as li}from"@xyflow/react";var Re=(e=[])=>e.filter(t=>t.type==="START_EVENT"),ue=(e=[])=>e.filter(t=>t.type==="END_EVENT"),se=(e=[])=>e.filter(t=>t.type==="TASK")||[],Vo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),Oo=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),ft=(e=[])=>e.filter(t=>t.type==="GATEWAY"),Go=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),X=(e,t=[])=>t.filter(o=>o.source===e),Me=(e,t=[])=>t.filter(o=>o.target===e),Ho=(e,t)=>{var r,n;let o=(r=t.nodes)==null?void 0:r.find(i=>i.id===e);return((n=o==null?void 0:o.properties)==null?void 0:n.attribute)==="LOOP"},Bo=(e,t)=>{let o=X(e,t.edges||[]);for(let r of o){let n=(t.nodes||[]).find(i=>i.id===r.target);if(n&&n.type==="END_EVENT")return!0}return!1},zo=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)}},Uo=(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=ue(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(i=>i.id)});let r=X(t[0].id,e.edges);if(!(r.length<=1)){let i=[...t.map(a=>a.id),...r.map(a=>a.target)];return D({isValid:!1,nodeIds:[...new Set(i)]})}return D({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=se(e.nodes),o=Q(t,r=>X(r.id,e.edges).length<=2);return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=se(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=se(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=se(e.nodes),o=new Map;for(let n of t){if(!n.label)continue;let i=n.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(n))}let r=[];for(let[,n]of o.entries())n.length>1&&n.forEach(i=>r.push(i.id));return D({isValid:r.length===0,nodeIds:r})}},{id:"nested_gateway",validate:e=>{let t=ft(e.nodes),o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.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),...ue(e.nodes)],o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&(s.type==="START_EVENT"||s.type==="END_EVENT")&&(o.push(n.id,s.id),r.push(a.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=ue(e.nodes),o=[],r=[];for(let n of t){let i=Me(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.source);if(s&&s.type==="TASK"){let l=X(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(c=>r.push(c.id)))}}}return D({isValid:o.length===0,nodeIds:o,edgeIds:r})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=Go(e.nodes),o=Q(t,n=>X(n.id,e.edges).length<=2),r=o.invalidIds.flatMap(n=>X(n,e.edges).map(i=>i.id));return D({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:r})}},{id:"activity_name_invalid",validate:e=>{let t=se(e.nodes),o=Q(t,r=>!r.label||zo(r.label));return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var a,s;if(!((a=e==null?void 0:e.nodes)!=null&&a.length)||!((s=e==null?void 0:e.edges)!=null&&s.length))return D({isValid:!0});let t=ue(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=se(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Q(n,l=>!Ho(l.id,e));return D({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=se(e.nodes),o=ue(e.nodes)[0];if(!o)return D({isValid:!0});let r=t.filter(l=>{let c=Me(l.id,e.edges),E=X(l.id,e.edges),f=c.some(p=>{var g;return((g=e.nodes.find(T=>T.id===p.source))==null?void 0:g.type)==="START_EVENT"}),m=E.some(p=>{var g;return((g=e.nodes.find(T=>T.id===p.target))==null?void 0:g.type)==="END_EVENT"});return f&&m}),n=Me(o.id,e.edges),i=n.length>1,a=n.map(l=>l.source),s={isValid:r.length===0&&!i,nodeIds:[...r.map(l=>l.id),...i?a:[]]};return D(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=ft(e.nodes),o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="END_EVENT"&&(o.push(n.id,s.id),r.push(a.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=ft(e.nodes),o=Q(t,r=>X(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),...ue(e.nodes)],o=[],r=[];for(let n of t){let i=X(n.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(n.id,s.id),r.push(a.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=Vo(e.nodes),o=Q(t,r=>!Bo(r.id,e));return D({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=Oo(e.nodes),o=Q(t,r=>{var n,i;return((n=r.properties)==null?void 0:n.subprocessRef)!==void 0&&((i=r.properties)==null?void 0:i.subprocessRef)!==""});return D({isValid:o.isValid,nodeIds:o.invalidIds})}}];var Fo=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 Yo=()=>{let{t:e}=si(),[t,o]=Wo(null),{setNodes:r,setEdges:n,getNodes:i,getEdges:a}=li(),[s,l]=Wo(!1);return{validationResult:t,validateDiagram:m=>{let p=Uo(m.nodes,m.edges),g=Fo(p),T=g.errors.map(b=>_(N({},b),{message:e(`validation.errors.${b.id}`)}));return s||l(!0),{isValid:g.isValid,errors:T}},handleValidationComplete:m=>{if(o(m),!m)return;let p=[],g=[];m.errors.forEach(h=>{h.nodeIds&&h.nodeIds.length>0&&h.nodeIds.forEach(x=>p.push(x)),h.edgeIds&&h.edgeIds.length>0&&h.edgeIds.forEach(x=>g.push(x))});let T=[...new Set(p)];r(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:!1})}))),n(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:!1})})));let b=i(),u=a(),d=new Set(T),v=new Set;m.errors.forEach(h=>{var w,L;let x=Ve.find(I=>I.id===h.id);(x==null?void 0:x.highlightRelatedEdges)!==!1&&((w=h.edgeIds)==null||w.forEach(I=>v.add(I)),(L=h.nodeIds)==null||L.forEach(I=>{u.forEach(P=>{(P.source===I||P.target===I)&&v.add(P.id)})}))});let C=new Set,y=new Set,A=new Set;b.forEach(h=>{h.type==="START_EVENT"?C.add(h.id):h.type==="END_EVENT"&&y.add(h.id)}),u.forEach(h=>{C.has(h.source)&&A.add(h.target),y.has(h.target)&&A.add(h.source)}),A.forEach(h=>{var x,k;if(d.has(h)){let w=(x=m.errors.find(I=>{var P;return(P=I.nodeIds)==null?void 0:P.includes(h)}))==null?void 0:x.id;((k=Ve.find(I=>I.id===w))==null?void 0:k.highlightRelatedEdges)!==!1&&u.forEach(I=>{I.source===h&&y.has(I.target)&&(d.add(I.target),v.add(I.id)),I.target===h&&C.has(I.source)&&(d.add(I.source),v.add(I.id))})}}),d.size>0&&r(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:d.has(x.id)})}))),v.size>0&&n(h=>h.map(x=>_(N({},x),{data:_(N({},x.data),{hasError:v.has(x.id)})})))},clearValidation:()=>{o(null),l(!1),r(m=>m.map(p=>_(N({},p),{data:_(N({},p.data),{hasError:!1})}))),n(m=>m.map(p=>_(N({},p),{data:_(N({},p.data),{hasError:!1})})))},isAutoValidationEnabled:s}};import{useReactFlow as di}from"@xyflow/react";import{useEffect as ci}from"react";import{v7 as Ko}from"uuid";var pi=15,Zo="bpmn:selection",$o=({offset:e=pi}={})=>{let{getNodes:t,setNodes:o,getEdges:r,setEdges:n}=di();ci(()=>{let i=s=>{var p;s.preventDefault();let l=t(),c=r(),E=l.filter(g=>g.selected);if(!E.length)return;let f=c.filter(g=>E.some(T=>T.id===g.source)&&E.some(T=>T.id===g.target)),m={nodes:E,edges:f};(p=s.clipboardData)==null||p.setData(Zo,JSON.stringify(m))},a=s=>{var m,p;s.preventDefault();let l=JSON.parse(((m=s.clipboardData)==null?void 0:m.getData(Zo))||"{}");if(!((p=l.nodes)!=null&&p.length))return;let c=new Map,E=l.nodes.map(g=>{let T=Ko();return c.set(g.id,T),_(N({},g),{id:T,selected:!0,position:{x:g.position.x+e,y:g.position.y+e}})}),f=l.edges.map(g=>_(N({},g),{id:Ko(),selected:!0,source:c.get(g.source)||g.source,target:c.get(g.target)||g.target}));o(g=>[...g.map(T=>_(N({},T),{selected:!1})),...E]),n(g=>[...g.map(T=>_(N({},T),{selected:!1})),...f])};return document.addEventListener("copy",i),document.addEventListener("paste",a),()=>{document.removeEventListener("copy",i),document.removeEventListener("paste",a)}},[t,o,r,n,e])};import{useReactFlow as Ti,useStoreApi as xi}from"@xyflow/react";import{v7 as Qo}from"uuid";import{create as mi}from"zustand";var ye=mi(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));import{BaseEdge as ui,EdgeLabelRenderer as fi,getSmoothStepPath as gi,MarkerType as Ei,useNodes as bi,useReactFlow as hi,useViewport as vi}from"@xyflow/react";import{useState as Ni}from"react";import{jsx as gt,jsxs as Xo}from"react/jsx-runtime";var Km={type:"MESSAGE_EDGE",zIndex:2e3,markerEnd:{type:Ei.Arrow},data:{label:""}},qo=({id:e,source:t,target:o,sourceX:r,sourceY:n,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,data:c,selected:E})=>{let f=bi(),{zoom:m}=vi(),{updateEdgeData:p}=hi(),{isMultipleSelection:g}=M(),[T,b]=Ni(!1),u=f.find(P=>P.id===t),d=f.find(P=>P.id===o),[v,C,y]=gi({sourceX:r,sourceY:n,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),A=E||(u==null?void 0:u.selected)||(d==null?void 0:d.selected),h=A?"sequence-edge-marker-highlighted":"sequence-edge-marker",x=T||(c==null?void 0:c.label.trim().length)>0,k=1/m,w=()=>{b(!0)},L=()=>{b(!1)},I=P=>{p(e,{label:P.trim()})};return Xo("g",{className:S("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":A}),onBlur:L,onDoubleClick:w,children:[gt(ui,{id:e,path:v,markerEnd:`url(#${h})`,strokeDasharray:4,className:S("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":c==null?void 0:c.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":A&&!(c!=null&&c.hasError)})}),gt(fi,{children:Xo("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${C}px, ${y}px)`},children:[E&&!g&>(Ne,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${k})`}}),x&>(W,{value:c==null?void 0:c.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:T,onChange:I})]})})]})};import{jsx as jo,jsxs as yi}from"react/jsx-runtime";var Jo=({fromX:e,fromY:t,toX:o,toY:r})=>yi("g",{children:[jo("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:`M${e},${t} C${e} ${r} ${e} ${r} ${o},${r}`}),jo("circle",{cx:o,cy:r,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]});var er=({nodes:e,setNodes:t,setEdges:o})=>{let r=xi(),{draggableNode:n,setDraggableNode:i}=ye(),{getInternalNode:a,screenToFlowPosition:s}=Ti(),l=b=>{let u="[&>div]:bg-blue-50 [&>div]:outline [&>div]:outline-2 [&>div]:outline-blue-500";t(d=>d.map(v=>_(N({},v),{className:v.id===b?u:""})))},c=()=>{let{nodeLookup:b}=r.getState();return Array.from(b.values())},E=b=>{let u=a(b.id),d=c();if(b.type==="LANE"){if(ve({parentId:b.id,nodes:e,includeTypes:["LANE"]})){l();return}let x=d.filter(L=>L.id!==b.id&&L.type==="LANE"&&!L.parentId),k=Pe(u,x);if(!k){l();return}if(ve({parentId:k.id,nodes:e,excludeTypes:["LANE"]})){l();return}l(k.id);return}let C=d.filter(h=>h.id!==b.id&&h.type==="LANE"),y=Pe(u,C);if(!y){l();return}if(ve({parentId:y.id,nodes:e,includeTypes:["LANE"]})){l();return}l(y.id)},f=b=>{b.preventDefault(),b.dataTransfer.dropEffect="move"},m=(b,u)=>{b.preventDefault(),E(u)},p=(b,u,d)=>{var x,k;let v=w=>w.map(L=>_(N({},L),{className:void 0}));if(b.parentId===u.id){let w=me(u.id,d);t(re(v(w)));return}if(b.type==="LANE"){if(ve({parentId:u.id,nodes:d,excludeTypes:["LANE"]}))return;let I=d.filter(U=>U.parentId===u.id).reduce((U,ge)=>{var ce,pe;return U+((pe=(ce=ge.measured)==null?void 0:ce.height)!=null?pe:0)},0),P={x:K.HEADER_WIDTH,y:I},z=d.map(U=>U.id===b.id?_(N({},U),{parentId:u.id,position:P,className:void 0}):_(N({},U),{className:void 0}));z=me(u.id,z),t(re(z));return}if(ve({parentId:u.id,nodes:d,includeTypes:["LANE"]})){let w;if(b.parentId){let I=a(b.parentId),{x:P,y:z}=oe(I);w={x:P+((x=b.position.x)!=null?x:0),y:z+((k=b.position.y)!=null?k:0)}}let L=d.map(I=>I.id===b.id?_(N({},I),{position:w!=null?w:I.position,parentId:void 0,className:void 0}):_(N({},I),{className:void 0}));t(re(L));return}let A=vo(b,u),h=d.map(w=>w.id===b.id?_(N({},w),{parentId:u.id,position:A,className:void 0}):_(N({},w),{className:void 0}));t(re(h))};return{onDragOver:f,onDrop:b=>{if(b.preventDefault(),!(n!=null&&n.type))return;let u=s({x:b.clientX,y:b.clientY}),d={width:V[n.type].MIN_WIDTH,height:V[n.type].MIN_HEIGHT},v={id:Qo(),type:n.type,position:u,measured:d,data:{label:"",variant:n.variant,attribute:n.attribute}},C=_(N({},v),{internals:{positionAbsolute:u}}),y=c(),A=n.type==="LANE",h=y.filter(w=>A?w.type==="LANE"&&!w.parentId:w.type==="LANE"),x=Pe(C,h);x?p(C,x,[...y,C]):t(w=>{let L=w.concat(v);return re(L)});let k=b.dataTransfer.getData("sourceId");if(k){let w={id:Qo(),source:k,target:v.id};if(n.type==="ANNOTATION"){o(L=>L.concat(N(N({},w),mt)));return}o(L=>L.concat(N(N({},w),ie)))}i(null)},onNodeDrag:m,onNodeDragStop:async(b,u)=>{var x,k;let{nodeLookup:d}=r.getState(),v=a(u.id),C=Array.from(d.values()),y=u.type==="LANE",A=C.filter(w=>w.id!==u.id&&(y?w.type==="LANE"&&!w.parentId:w.type==="LANE")),h=Pe(v,A);if(h){p(v,h,C);return}if(u.parentId){let w=a(u.parentId),{x:L,y:I}=oe(w),P={x:L+((x=u.position.x)!=null?x:0),y:I+((k=u.position.y)!=null?k:0)},z=e.map(U=>U.id===u.id?_(N({},U),{position:P,parentId:void 0}):U);z=me(u.parentId,z),t(re(z))}}}};import{applyNodeChanges as _i}from"@xyflow/react";import{useCallback as wi,useState as or}from"react";function tr(e,t,o=5){var l,c,E,f,m,p,g,T;let r={horizontal:void 0,vertical:void 0,snapPosition:{x:void 0,y:void 0}},n=t.find(b=>b.id===e.id);if(!n||!e.position)return r;let i={left:e.position.x,right:e.position.x+((c=(l=n.measured)==null?void 0:l.width)!=null?c:0),top:e.position.y,bottom:e.position.y+((f=(E=n.measured)==null?void 0:E.height)!=null?f:0),width:(p=(m=n.measured)==null?void 0:m.width)!=null?p:0,height:(T=(g=n.measured)==null?void 0:g.height)!=null?T:0},a=o,s=o;return t.filter(b=>b.id!==n.id).reduce((b,u)=>{var L,I,P,z,U,ge,ce,pe;let d={left:u.position.x,right:u.position.x+((I=(L=u.measured)==null?void 0:L.width)!=null?I:0),top:u.position.y,bottom:u.position.y+((z=(P=u.measured)==null?void 0:P.height)!=null?z:0),width:(ge=(U=u.measured)==null?void 0:U.width)!=null?ge:0,height:(pe=(ce=u.measured)==null?void 0:ce.height)!=null?pe:0},v=Math.abs(i.left-d.left);v<s&&(b.snapPosition.x=d.left,b.vertical=d.left,s=v);let C=Math.abs(i.right-d.right);C<s&&(b.snapPosition.x=d.right-i.width,b.vertical=d.right,s=C);let y=Math.abs(i.left-d.right);y<s&&(b.snapPosition.x=d.right,b.vertical=d.right,s=y);let A=Math.abs(i.right-d.left);A<s&&(b.snapPosition.x=d.left-i.width,b.vertical=d.left,s=A);let h=Math.abs(i.top-d.top);h<a&&(b.snapPosition.y=d.top,b.horizontal=d.top,a=h);let x=Math.abs(i.bottom-d.top);x<a&&(b.snapPosition.y=d.top-i.height,b.horizontal=d.top,a=x);let k=Math.abs(i.bottom-d.bottom);k<a&&(b.snapPosition.y=d.bottom-i.height,b.horizontal=d.bottom,a=k);let w=Math.abs(i.top-d.bottom);return w<a&&(b.snapPosition.y=d.bottom,b.horizontal=d.bottom,a=w),b},r)}var rr=()=>{let[e,t]=or(void 0),[o,r]=or(void 0),n=wi((i,a)=>{var s,l;if(t(void 0),r(void 0),i.length===1&&i[0].type==="position"&&i[0].dragging&&i[0].position){let c=tr(i[0],a);i[0].position.x=(s=c.snapPosition.x)!=null?s:i[0].position.x,i[0].position.y=(l=c.snapPosition.y)!=null?l:i[0].position.y,t(c.horizontal),r(c.vertical)}return _i(i,a)},[]);return{helperLineHorizontal:e,helperLineVertical:o,customApplyNodeChanges:n}};import{useReactFlow as Ii}from"@xyflow/react";import{v7 as lr}from"uuid";var ar={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},ir={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},nr=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],r=e.match(/(\[.*?\])/)||[],n=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],a="",s="",l="";if(o.length){switch(o[1]){case"<start>":a="start-event";break;case"<end>":a="end-event";break}e=e.replace(o[1],"")}return r.length&&(a="task",s=r[1].replace(/\[|\]/g,""),e=e.replace(r[1],"")),n.length&&(a="gateway-exclusive",s=n[1].replace(/\{|\}/g,""),e=e.replace(n[1],"")),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:a,label:s}),{step:e,type:a,label:s,edgeLabel:l}},Ci=e=>{e=e||"";let t=e.trim().split(`
|
|
2
|
+
`),o={},r=[];return t.forEach(n=>{n=n||"";let i=n.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=nr(i[0],o),s=nr(i[1],o);a&&s&&r.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:r}},sr=e=>{let{components:t,connections:o}=Ci(e);return{nodes:t,edges:o}};var dr=()=>{let{setNodes:e,setEdges:t,fitView:o}=Ii();return{createDiagram:n=>{let{nodes:i,edges:a}=sr(n),s=[],l=new Map;for(let[m,p]of Object.entries(i)){let g=lr(),T=ar[p.type],b=ir[p.type];l.set(m,g);let u=V[T].MIN_WIDTH,d=V[T].MIN_HEIGHT;s.push({id:g,type:T,data:{label:p.label||"",variant:b,attribute:""},position:{x:0,y:0},width:u,height:d,measured:{width:u,height:d}})}let c=[];for(let m of a){let p=_(N({},ie),{id:lr(),source:l.get(m.sourceId)||m.sourceId,target:l.get(m.targetId)||m.targetId});c.push(p)}let{nodes:E,edges:f}=To(s,c);e(E),t(f),o()}}};import{useEffect as Ai,useCallback as Si}from"react";var ki={origin:"*",debug:!1};function cr(e,t=ki){let{origin:o,debug:r}=t,n=Si((i,a)=>{r&&console.debug("[postMessage] sending:",{type:i,payload:a}),window.parent.postMessage({type:i,payload:a},o||"*")},[o,r]);return Ai(()=>{let i=a=>{let{type:s,data:l}=a.data||{};r&&console.debug("[postMessage] received:",a.data),s&&e[s]&&e[s](l)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,r]),{sendMessage:n}}import{useReactFlow as Li}from"@xyflow/react";var pr=(e,t)=>{let{getNodes:o,getEdges:r}=Li();return{selectElement:a=>{let s=o().map(c=>_(N({},c),{selected:c.id===a})),l=r().map(c=>_(N({},c),{selected:c.id===a}));return e(s),t(l),!0},isReady:()=>!0}};import{useReactFlow as Pi}from"@xyflow/react";import{useCallback as Oe,useState as mr}from"react";import{useDebouncedCallback as Di}from"use-debounce";var Ri={nodes:[],edges:[]},Mi=500,ur=10,fr=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:r}=Pi(),[n,i]=mr([Ri]),[a,s]=mr(0),l=n[a],c=a>0,E=a<n.length-1,f=Oe(d=>{o(n[d].nodes),r(n[d].edges)},[n,o,r]),m=Oe(()=>{if(a>0){let d=a-1;s(d),f(d)}},[a,f]),p=Oe(()=>{if(a<n.length-1){let d=a+1;s(d),f(d)}},[n,a,f]),g=d=>{let C=[...n.slice(0,a+1),d],y=C.length>ur?C.slice(C.length-ur):C;i(y),s(y.length-1)},T=Di(()=>{let d=e(),v=t(),C={nodes:d,edges:v};JSON.stringify(l)!==JSON.stringify(C)&&g(C)},Mi),b=Oe(d=>{if(d==="forceSave"){T();return}d.some(C=>C.type!=="select")&&T()},[T]),u=Oe(()=>{i([]),s(0)},[]);return{undo:m,redo:p,saveHistory:b,canUndo:c,canRedo:E,clearHistory:u}};import{jsx as gr}from"react/jsx-runtime";var Ft=({id:e,className:t})=>gr("marker",{id:e,className:S("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:gr("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});import{jsx as Wt,jsxs as Vi}from"react/jsx-runtime";var Er=()=>Wt("svg",{style:{position:"absolute",top:0,left:0},children:Vi("defs",{children:[Wt(Ft,{id:"sequence-edge-marker",className:"text-grey-400"}),Wt(Ft,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});import{useKeyPress as Rr}from"@xyflow/react";import{Button as yt,Tooltip as Tt,TooltipContent as xt,TooltipTrigger as _t,useTranslation as Ls}from"lecom-ui";import{HandIcon as Ps,ListCheckIcon as Ds,MapIcon as Rs,MousePointerIcon as Ms}from"lucide-react";import{useCallback as Vs,useEffect as Mr}from"react";import{useStore as Oi}from"@xyflow/react";var Gi=e=>({unselectAll:e.unselectNodesAndEdges}),Ge=()=>{let{unselectAll:e}=Oi(Gi);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};import{Tooltip as ds,TooltipContent as cs,TooltipTrigger as ps,useNotificationToast as ms,useTranslation as us}from"lecom-ui";var He=(u=>(u.START_EVENT="START_EVENT",u.END_EVENT="END_EVENT",u.TASK="TASK",u.SUBPROCESS="SUBPROCESS",u.GATEWAY="GATEWAY",u.ANNOTATION="ANNOTATION",u.CONNECTION="CONNECTION",u.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",u.ACTIVITY="ACTIVITY",u.PROCESS_INTERFACE="PROCESS_INTERFACE",u.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",u.VARIANT_ACTIVITY="VARIANT_ACTIVITY",u.AUTO_ACTIVITY="AUTO_ACTIVITY",u.DATA_STORE="DATA_STORE",u.DATA_OBJECT="DATA_OBJECT",u.DATA_OUTPUT="DATA_OUTPUT",u.DATA_INPUT="DATA_INPUT",u))(He||{});import{useReactFlow as es}from"@xyflow/react";import{useNotificationToast as ts,useTranslation as os,Button as rs}from"lecom-ui";var br=async e=>new Promise((t,o)=>{let r=new FileReader;r.onload=n=>{var i;t((i=n.target)==null?void 0:i.result)},r.onerror=n=>{var i;o((i=n.target)==null?void 0:i.error)},r.readAsText(e)});function hr({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let n="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
|
|
3
3
|
`),i=encodeURI(n);Et(i,`${o}.csv`)}var Et=(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 Xi}from"uuid";import{xml2json as Hi,json2xml as of}from"xml-js";var Bi={compact:!0,spaces:4},zi=e=>e.replaceAll(`
|
|
4
|
-
`,"
");function vr(e,t=Bi){if(e)return JSON.parse(Hi(e,_(N({},t),{attributeValueFn:zi})))}function Nr(e){return e==null?void 0:e.replaceAll("
"," ")}import{v7 as
|
|
4
|
+
`,"
");function vr(e,t=Bi){if(e)return JSON.parse(Hi(e,_(N({},t),{attributeValueFn:zi})))}function Nr(e){return e==null?void 0:e.replaceAll("
"," ")}import{v7 as Fi}from"uuid";var df={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},yr={script:"SCRIPT",subprocess:"SUBPROCESS"},Tr={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var Te=({cell:e,type:t,variant:o=""})=>{let{_attributes:r,mxGeometry:n}=e,{value:i}=r,a=Number(n._attributes.width),s=Number(n._attributes.height);return{id:r.id,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(n._attributes.x),y:Number(n._attributes.y)},width:a,height:s,measured:{width:a,height:s}}},Wi=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:Te({cell:e,type:"START_EVENT"}),status:r,originalType:o}},Yi=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:Te({cell:e,type:"END_EVENT"}),status:r,originalType:o}},Ki=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,r=yr[t],n="imported";return["script","none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=Se(e.mxGeometry._attributes.width,V.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=Se(e.mxGeometry._attributes.height,V.TASK.MIN_HEIGHT),{node:Te({cell:e,type:"TASK",variant:r}),status:n,originalType:o}},Zi=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,r=Tr[o],n=["none","inclusive","event-based"],i="imported";return n.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=V.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=V.GATEWAY.MIN_HEIGHT,{node:Te({cell:e,type:"GATEWAY",variant:r}),status:i,originalType:t}},$i=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=Se(e.mxGeometry._attributes.width,V.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=Se(e.mxGeometry._attributes.height,V.ANNOTATION.MIN_HEIGHT),{node:Te({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},xr=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:Te({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},_r=(e,t)=>{let{source:o,target:r}=e._attributes;return _(N({},ie),{id:Fi(),source:t.get(o)||o,target:t.get(r)||r})},wr={TASK:Ki,GATEWAY:Zi,START_EVENT:Wi,END_EVENT:Yi,ANNOTATION:$i};var qi=e=>{var a;let t=new Map,o=Object.values(He),r=e.filter(s=>{var l;return o.includes((l=s._attributes)==null?void 0:l.type)}),n=[],i=[];for(let s of r){let l=Xi(),{type:c}=s._attributes,E=wr[c]||xr;t.set((a=s._attributes)==null?void 0:a.id,l),s._attributes.id=l;let{node:f,status:m,originalType:p}=E(s);n.push(f),i.push({originalType:p,type:f.type,variant:f.data.variant,value:Nr(f.data.label),status:m})}return{nodes:n,governanceIdToNodeIdMap:t,summary:i}},ji=(e,t)=>e.filter(n=>{var i;return(i=n._attributes)==null?void 0:i.edge}).map(n=>_r(n,t)),Ji=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:r,summary:n}=qi(t.root.mxCell),i=ji(t.root.mxCell,r);return{nodes:o,edges:i,summary:n}},Qi=async e=>{let t=await br(e),o=vr(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:r,mxGraphModel:n}=o.modeler||{},i=(r==null?void 0:r.app)&&(r==null?void 0:r.diagramType)&&(r==null?void 0:r.version),a=n==null?void 0:n.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(n.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:r,mxGraphModel:n}},Cr=async e=>{try{let t=await Qi(e),{nodes:o,edges:r,summary:n}=Ji(t)||{};return{nodes:o,edges:r,summary:n}}catch(t){throw t}};import{jsx as ns}from"react/jsx-runtime";var Ir=()=>{let{t:e}=os(),{toast:t}=ts(),{setNodes:o,setEdges:r,fitView:n}=es(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=s.map(E=>[E.originalType,E.value,e(`adapter.governance.report.status.${E.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:ns(rs,{size:"small",variant:"ghost",onClick:()=>hr({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{createDiagram:async s=>{try{let{nodes:l,edges:c,summary:E}=await Cr(s);if(o(m=>m.concat(l)),r(m=>m.concat(c)),n(),E.some(m=>m.status==="unsupported")){i(E);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let c=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${c}`)})}}}};import{Button as as}from"lecom-ui";import{useRef as is}from"react";import{Fragment as ss,jsx as Ar,jsxs as ls}from"react/jsx-runtime";var Sr=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:r=!1,onClick:n,onFilesSelected:i}=l,a=Ee(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=is(null),E=m=>{let p=m.target.files;p!=null&&p.length&&i(p),c.current&&(c.current.value="")};return ls(ss,{children:[Ar(as,_(N({onClick:m=>{var p;(p=c.current)==null||p.click(),n==null||n(m)}},a),{children:e})),Ar("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:r,onChange:E})]})};import{jsx as bt,jsxs as fs}from"react/jsx-runtime";var kr=({disabled:e=!1})=>{let{t}=us(),{toast:o}=ms(),{createDiagram:r}=Ir(),n=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=a=>{let s=a[0];if(!s){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}r(s)};return fs(ds,{children:[bt(ps,{asChild:!0,children:bt(Sr,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:n,onFilesSelected:i,children:bt(co,{})})}),bt(cs,{color:"black",children:t("editor.controls.actions.import_governance")})]})};import{Button as ys,DropdownMenu as Ts,DropdownMenuContent as xs,DropdownMenuItem as Kt,DropdownMenuTrigger as _s,Tooltip as ht,TooltipContent as vt,TooltipTrigger as Nt,useTranslation as ws}from"lecom-ui";import{FileCodeIcon as Cs,FileImageIcon as Is,FolderOutputIcon as As,PrinterIcon as Ss}from"lucide-react";import{useState as ks}from"react";import{useReactFlow as gs}from"@xyflow/react";import{toPng as Lr,toSvg as Es}from"html-to-image";import{toast as bs,useTranslation as hs}from"lecom-ui";import{useState as vs}from"react";var Ns=3,Yt="diagram",Pr=()=>{let{t:e}=hs(),{getNodes:t}=gs(),{deselectAll:o}=Ge(),[r,n]=vs({png:!1,html:!1,print:!1}),i=()=>{let{x:E,y:f,width:m,height:p}=_o(t());return{width:m,height:p,style:{width:`${m}px`,height:`${p}px`,transform:`translate(${-E}px, ${-f}px)`}}},a=async(E,f)=>{n(_(N({},r),{[f]:!0})),await o();try{let m=xo();if(!m)throw new Error("Flow element not found");let p=i();return await E(m,p)}catch(m){bs({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{n(_(N({},r),{[f]:!1}))}};return{exportAsPng:async(E=Yt)=>{await a(async(f,m)=>{let p=await Lr(f,_(N({},m),{backgroundColor:"#fcfcfc"}));Et(p,`${E}.png`)},"png")},exportAsHtml:async(E=Yt)=>{await a(async(f,m)=>{let p=await Es(f,_(N({},m),{backgroundColor:"#fcfcfc"})),g=`
|
|
5
5
|
<!DOCTYPE html>
|
|
6
6
|
<html>
|
|
7
7
|
<head>
|
|
@@ -31,4 +31,4 @@ var $n=Object.defineProperty,Xn=Object.defineProperties;var qn=Object.getOwnProp
|
|
|
31
31
|
<img src="${p}" alt="Diagram" onload="window.print(); window.close();" />
|
|
32
32
|
</body>
|
|
33
33
|
</html>
|
|
34
|
-
`),T.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as O,jsxs as xe}from"react/jsx-runtime";function Dr(){let{t:e}=ws(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:i,isPrintingHtml:a}=Pr(),[s,l]=ks(!1);return xe(Ts,{modal:!1,open:s,onOpenChange:l,children:[O(_s,{asChild:!0,children:O("div",{children:xe(ht,{children:[O(Nt,{asChild:!0,children:O(ys,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:O(As,{})})}),!s&&O(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),xe(xs,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[xe(ht,{children:[O(Nt,{asChild:!0,children:O(Kt,{className:"p-1.5",disabled:i,onClick:()=>t(),children:O(Is,{})})}),O(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),xe(ht,{children:[O(Nt,{asChild:!0,children:O(Kt,{className:"p-1.5",disabled:a,onClick:()=>o(),children:O(Cs,{})})}),O(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),xe(ht,{children:[O(Nt,{asChild:!0,children:O(Kt,{className:"p-1.5",disabled:n,onClick:()=>r(),children:O(Ss,{})})}),O(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Os,jsx as G,jsxs as le}from"react/jsx-runtime";var Vr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:i}=Ls(),{deselectAll:a}=Ge(),{isMoveTool:s,isHandTool:l,activeMoveTool:d,activeHandTool:E,isMinimapOpen:f,setIsMinimapOpen:m}=M(),p=Rr(["v","V"]),g=Rr(["h","H"]),T=Vs(()=>{a(),E()},[a,E]),b=()=>{a();let u=n(o);r&&r(u)};return Mr(()=>{p&&!s&&!t&&d()},[p,d,s,t]),Mr(()=>{g&&!l&&!t&&T()},[g,T,l,t]),le("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&le(Os,{children:[le(Tt,{children:[G(_t,{asChild:!0,children:G(yt,{size:"small",variant:"ghost",color:"grey",className:S(s&&"bg-grey-400"),iconButton:!0,onClick:d,children:G(Ms,{})})}),le(xt,{color:"black",children:[i("editor.controls.actions.move_tool"),G("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),le(Tt,{children:[G(_t,{asChild:!0,children:G(yt,{size:"small",variant:"ghost",color:"grey",className:S(l&&"bg-grey-400"),iconButton:!0,onClick:T,children:G(Ps,{})})}),le(xt,{color:"black",children:[i("editor.controls.actions.hand_tool")," ",G("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),le(Tt,{children:[G(_t,{asChild:!0,children:G(yt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:b,children:G(Ds,{})})}),G(xt,{color:"black",children:i("editor.controls.actions.check")})]})]}),G(Dr,{}),!t&&G(kr,{disabled:e.length>0}),le(Tt,{children:[G(_t,{asChild:!0,children:G(yt,{size:"small",variant:"ghost",color:"grey",className:S(f&&"bg-grey-400"),iconButton:!0,onClick:()=>m(!f),children:G(Rs,{})})}),G(xt,{color:"black",children:i(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Or,Tooltip as Gr,TooltipContent as Hr,TooltipTrigger as Br,useTranslation as Gs}from"lecom-ui";import{RedoIcon as Hs,UndoIcon as Bs}from"lucide-react";import{jsx as de,jsxs as Zt}from"react/jsx-runtime";var zr=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Gs();return Zt("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Zt(Gr,{children:[de(Br,{asChild:!0,children:de(Or,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:de(Bs,{})})}),de(Hr,{color:"black",children:n("editor.controls.history.undo")})]}),Zt(Gr,{children:[de(Br,{asChild:!0,children:de(Or,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:de(Hs,{})})}),de(Hr,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as zs}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as It,TooltipTrigger as At,useTranslation as Fs}from"lecom-ui";import{ScanIcon as Us,ZoomIn as Ws,ZoomOut as Ys}from"lucide-react";import{jsx as W,jsxs as Be}from"react/jsx-runtime";var Fr=()=>{let{t:e}=Fs(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=zs();return Be("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Be(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:W(Us,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.fit")})]}),Be(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:W(Ys,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.out")})]}),Be(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:W(uo,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.reset")})]}),Be(Ct,{children:[W(At,{asChild:!0,children:W(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:W(Ws,{})})}),W(It,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Dl,useReactFlow as Rl}from"@xyflow/react";import{Handle as Ks}from"@xyflow/react";import{jsx as Zs}from"react/jsx-runtime";var H=({type:e,position:t,className:o})=>Zs(Ks,{type:e,position:t,className:S("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as $s,useReactFlow as Xs}from"@xyflow/react";import{orderBy as qs}from"lodash";import{jsx as js}from"react/jsx-runtime";var _e=o=>{var r=o,{nodeId:e}=r,t=Ee(r,["nodeId"]);let{getNode:n,getNodes:i,setNodes:a}=Xs(),s=({width:l,height:d})=>{if(!e)return;let E=n(e);if((E==null?void 0:E.type)!=="LANE")return;let f=[...i()],m=!E.parentId,p=m?E.id:E.parentId,g=f.filter(u=>u.type==="LANE"&&u.parentId===p);if(!g.length)return;let T=qs(g,["position.y"]),b=0;T.forEach((u,c)=>{var y,A;let v=c===T.length-1,C=(A=(y=u.measured)==null?void 0:y.height)!=null?A:0;f=f.map(h=>{if(h.id===u.id){let x=m?l-Y.HEADER_WIDTH:l,k=_(N({},h),{width:x,measured:_(N({},h.measured),{width:x}),position:_(N({},h.position),{y:b})});return v&&m&&(k.height=d-b),k}return h}),b+=C}),f=f.map(u=>{if(u.id===p){let c=m?l:l+Y.HEADER_WIDTH;return _(N({},u),{width:c,height:m?d:b,measured:{width:c,height:m?d:b}})}return u}),a(f)};return js($s,N({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 wl,NodeToolbar as Cl}from"@xyflow/react";import{Button as Il,Tooltip as Al,TooltipContent as Sl,TooltipTrigger as kl,useTranslation as Ll}from"lecom-ui";import{useNodesData as Js,useReactFlow as Qs}from"@xyflow/react";import{Button as el,DropdownMenu as tl,DropdownMenuContent as ol,DropdownMenuGroup as rl,DropdownMenuItem as nl,DropdownMenuLabel as al,DropdownMenuTrigger as il,Tooltip as sl,TooltipContent as ll,TooltipTrigger as dl,useTranslation as cl}from"lecom-ui";import{WrenchIcon as pl}from"lucide-react";import{jsx as ne,jsxs as St}from"react/jsx-runtime";var Ur=({nodeId:e})=>{let{t}=cl(),{updateNodeData:o}=Qs(),r=Js(e),n=i=>{(r==null?void 0:r.data.variant)!==i&&o(e,{variant:i})};return St(tl,{children:[St(sl,{children:[ne(dl,{asChild:!0,children:ne(il,{asChild:!0,children:ne(el,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ne(pl,{})})})}),ne(ll,{color:"black",children:t("bpmn.gateway.menu.title")})]}),St(ol,{align:"start",className:"w-60 bg-white text-grey-600",children:[ne(al,{className:"flex items-center",children:ne("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ne(rl,{children:Object.entries(et).map(([i,a])=>St(nl,{className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[ne(a.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${i.toLowerCase()}`)]},i))})]})]})};import{useNodesData as ml,useReactFlow as ul}from"@xyflow/react";import{Button as Wr,DropdownMenu as fl,DropdownMenuContent as gl,DropdownMenuGroup as El,DropdownMenuItem as bl,DropdownMenuLabel as hl,DropdownMenuTrigger as vl,Tooltip as Nl,TooltipContent as yl,TooltipTrigger as Tl,useTranslation as xl}from"lecom-ui";import{WrenchIcon as _l}from"lucide-react";import{jsx as q,jsxs as ze}from"react/jsx-runtime";var Yr=({nodeId:e})=>{let{t}=xl(),{updateNodeData:o}=ul(),r=ml(e),n=a=>{o(e,{variant:(r==null?void 0:r.data.variant)===a?"":a})},i=a=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===a?"":a})};return ze(fl,{children:[ze(Nl,{children:[q(Tl,{asChild:!0,children:q(vl,{asChild:!0,children:q(Wr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:q(_l,{})})})}),q(yl,{color:"black",children:t("bpmn.task.menu.title")})]}),ze(gl,{align:"start",className:"w-60 bg-white text-grey-600",children:[ze(hl,{className:"flex items-center gap-1",children:[q("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),q("div",{className:"flex items-center gap-1",children:Object.entries(Qe).map(([a,s])=>q(Wr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===a}),onClick:()=>i(a),children:q(s.icon,{className:"stroke-inherit"})},a))})]}),q(El,{children:Object.entries(Je).map(([a,s])=>ze(bl,{className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[q(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${a.toLowerCase()}`)]},a))})]})]})};import{jsx as j,jsxs as Pl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var E;let{t:n}=Ll(),{setDraggableNode:i}=ye(),a=({event:f,type:m,variant:p})=>{i({type:m,variant:p}),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:ke,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:be,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:ke,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ze,label:n("bpmn.annotation.variant.default")}},l=[{component:j(lt,{elementId:e})}],d={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(Yr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Ur,{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(Cl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:wl.Right,align:"start",isVisible:r,children:(E=d[t])==null?void 0:E.map((f,m)=>f.component?j("div",{children:f.component},m):Pl(Al,{children:[j(kl,{asChild:!0,children:j(Il,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:p=>a({event:p,type:f.type,variant:f.variant}),children:f.icon&&j(f.icon,{size:16})})}),j(Sl,{color:"black",children:f.label})]},m))})};import{Fragment as Ml,jsx as Fe,jsxs as Vl}from"react/jsx-runtime";var Kr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Rl(),{isMultipleSelection:i}=M(),a=s=>{n(e,{label:s})};return Vl(Ml,{children:[Fe("div",{className:S("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:Fe(U,{value:t.label,className:"m-1 text-grey-600",onChange:a})}),Fe(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!i&&o}),Fe(_e,{isVisible:!r&&!i&&o,minWidth:rt.MIN_WIDTH,minHeight:rt.MIN_HEIGHT}),Fe(H,{type:"target",position:Dl.Left})]})};import{Position as Zr,useReactFlow as Ol}from"@xyflow/react";import{useState as Gl}from"react";import{Fragment as Hl,jsx as we,jsxs as $r}from"react/jsx-runtime";var Xr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Ol(),{isMultipleSelection:i}=M(),[a,s]=Gl(!1),l=f=>{n(e,{label:f})};return $r(Hl,{children:[$r("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[we(be,{className:S("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})}),we("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:we(U,{value:t.label,isEditing:a,onChange:l})})]}),we(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!i&&o}),we(H,{type:"source",position:Zr.Right}),we(H,{type:"target",position:Zr.Left})]})};import{Position as qr,useReactFlow as Bl}from"@xyflow/react";import{useState as zl}from"react";import{Fragment as Fl,jsx as Ce,jsxs as jr}from"react/jsx-runtime";var Jr=({id:e,data:t,selected:o,dragging:r})=>{let n=et[t.variant].icon,{updateNodeData:i}=Bl(),{isMultipleSelection:a}=M(),[s,l]=zl(!1),d=m=>{i(e,{label:m})};return jr(Fl,{children:[jr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ce(n,{className:S("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})}),Ce("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(U,{value:t.label,isEditing:s,onChange:d})})]}),Ce(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!a&&o}),Ce(H,{type:"target",position:qr.Left}),Ce(H,{type:"source",position:qr.Right})]})};import{Position as Ul,useReactFlow as Wl}from"@xyflow/react";import{useState as Yl}from"react";import{Fragment as Kl,jsx as Ue,jsxs as Qr}from"react/jsx-runtime";var en=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Wl(),{isMultipleSelection:i}=M(),[a,s]=Yl(!1),l=f=>{n(e,{label:f})};return Qr(Kl,{children:[Qr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Ue(qe,{className:S("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})}),Ue("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ue(U,{value:t.label,isEditing:a,onChange:l})})]}),Ue(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!i&&o}),Ue(H,{type:"source",position:Ul.Right})]})};import{Position as tn,useReactFlow as Zl}from"@xyflow/react";import{Fragment as $l,jsx as ee,jsxs as on}from"react/jsx-runtime";var rn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Zl(),{isMultipleSelection:i}=M(),a=m=>{n(e,{label:m})},s=t.variant?Je[t.variant].icon:null,l=t.attribute?Qe[t.attribute].icon:null,d=t.variant==="SUBPROCESS",E=s&&!d,f=l||d;return on($l,{children:[on("div",{className:S("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:S("m-1",{"py-6":E||f}),onChange:a}),s&&ee("div",{className:S("absolute flex items-center p-1",d?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:S(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:S("flex items-center w-16 p-1",d?"justify-between":"justify-center"),children:ee(l,{size:16,className:S(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!i&&o}),ee(_e,{isVisible:!r&&!i&&o,minWidth:tt.MIN_WIDTH,minHeight:tt.MIN_HEIGHT}),ee(H,{type:"source",position:tn.Right}),ee(H,{type:"target",position:tn.Left})]})};import{Position as nn}from"@xyflow/react";import{Fragment as Xl,jsx as kt,jsxs as ql}from"react/jsx-runtime";var an=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=M();return ql(Xl,{children:[kt("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}),kt(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),kt(H,{type:"source",position:nn.Right}),kt(H,{type:"target",position:nn.Left})]})};import{Position as jl,useReactFlow as Jl}from"@xyflow/react";import{orderBy as Ql}from"lodash";import{useMemo as sn}from"react";import{Fragment as ed,jsx as fe,jsxs as ln}from"react/jsx-runtime";var dn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:i,getNodes:a}=Jl(),{isMultipleSelection:s}=M(),l=a(),d=!n,E=sn(()=>Ql([...l.filter(g=>g.parentId===e&&g.type==="LANE")],"position.y","asc"),[l,e]),f=d?ot.MIN_WIDTH:Y.MIN_WIDTH,m=sn(()=>{if(d&&E.length>1){let g=[...E];return g.pop(),g.reduce((b,u)=>{var c,v;return b+((v=(c=u.measured)==null?void 0:c.height)!=null?v:0)},0)+Y.MIN_HEIGHT}return Y.MIN_HEIGHT},[d,E]),p=g=>{i(e,{label:g})};return ln(ed,{children:[ln("div",{className:S("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:p})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!d,isVisible:!r&&!s&&o}),fe(_e,{nodeId:e,minWidth:f,minHeight:m,isVisible:!r&&!s&&o}),d&&fe(H,{type:"source",position:jl.Right})]})};var cn={START_EVENT:en,END_EVENT:Xr,TASK:rn,GATEWAY:Jr,ANNOTATION:Kr,LANE:dn,UNSUPPORTED:an},pn={SEQUENCE_EDGE:Do,MESSAGE_EDGE:qo,ANNOTATION_EDGE:Ao},mn="#fafafa",un="#bebebe",fn=1,gn=10,En="bottom-left",bn=.5,hn=4,vn={x:0,y:0,zoom:.75};import{useStore as td}from"@xyflow/react";import{useEffect as od,useRef as rd}from"react";import{jsx as ad}from"react/jsx-runtime";var nd=e=>({width:e.width,height:e.height,transform:e.transform}),Nn=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:i,transform:a}=td(nd),s=rd(null);return od(()=>{let l=s.current,d=l==null?void 0:l.getContext("2d");if(!d||!l)return;let E=window.devicePixelRatio;l.width=n*E,l.height=i*E,d.scale(E,E),d.clearRect(0,0,n,i),d.strokeStyle=o,d.setLineDash(r),typeof t=="number"&&(d.moveTo(t*a[2]+a[0],0),d.lineTo(t*a[2]+a[0],i),d.stroke()),typeof e=="number"&&(d.moveTo(0,e*a[2]+a[1]),d.lineTo(n,e*a[2]+a[1]),d.stroke())},[n,i,a,e,t,o,r]),ad("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as yn,Dialog as id,DialogContent as sd,DialogFooter as ld,DialogHeader as dd,DialogTitle as cd,Notification as pd,Typography as $t,useTranslation as md}from"lecom-ui";import{jsx as te,jsxs as Xt}from"react/jsx-runtime";var Tn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=md(),i=!!e,a=()=>{let{nodes:l,edges:d}=e||{};l!=null&&l.length&&o(E=>E.filter(f=>!l.some(m=>m.id===f.id))),d!=null&&d.length&&r(E=>E.filter(f=>!d.some(m=>m.id===f.id))),t(null)},s=()=>{t(null)};return te(id,{open:i,onOpenChange:s,children:Xt(sd,{className:"w-[488px] max-w-fit gap-2",children:[te(dd,{children:te(cd,{children:te($t,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),Xt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(pd,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te($t,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),Xt(ld,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(yn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te($t,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(yn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:a,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as ud,Tooltip as fd,TooltipContent as gd,TooltipTrigger as Ed,useTranslation as bd}from"lecom-ui";import{jsx as We,jsxs as hd}from"react/jsx-runtime";var xn=()=>{let{t:e}=bd(),{setDraggableNode:t}=ye(),o=[{type:"START_EVENT",icon:qe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:be,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:ke,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:ho,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:bo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:Eo,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Xe,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:$e,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:mo,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ze,label:e("bpmn.annotation.variant.default")}],r=(n,i)=>{t({type:i.type,variant:i.variant,attribute:i.attribute}),n.dataTransfer.effectAllowed="move"};return We("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,i)=>hd(fd,{children:[We(Ed,{asChild:!0,children:We(ud,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:a=>r(a,n),children:We(n.icon,{})},i)}),We(gd,{color:"black",side:"right",children:n.label})]},i))})};import{Button as vd,useTranslation as Nd}from"lecom-ui";import{AlertCircleIcon as yd,CircleCheckIcon as Td,XIcon as xd}from"lucide-react";import{useEffect as _d,useState as wd}from"react";import{jsx as J,jsxs as qt}from"react/jsx-runtime";var _n=({validationResult:e,onClose:t})=>{let{t:o}=Nd(),[r,n]=wd(!1);if(_d(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:i,errors:a}=e;return qt("div",{className:S("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[qt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:i?J(Td,{className:"text-green-500 size-5"}):J(yd,{className:"text-red-500 size-5"})}),qt("div",{className:"body-medium-500 text-grey-800",children:[J("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&J("div",{children:o("validation.errors.subtitle")})]}),J(vd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(xd,{})})]}),J("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?J("p",{children:o("validation.success.message")}):J("div",{className:"list-disc list-inside",children:a.map(s=>J("li",{className:"mb-1",children:s.message},s.id))})})]})};import{jsx as $,jsxs as Jt}from"react/jsx-runtime";var zd=[],Cn=Vd(({mode:e="edit"},t)=>{let o=Gd(!1),[r,n,i]=Pd([]),[a,s,l]=Ld([]),[d,E]=Hd(null),{isMoveTool:f,isHandTool:m,isReadOnly:p,setIsReadOnly:g,setIsMultipleSelection:T,isMinimapOpen:b}=M(),{validationResult:u,handleValidationComplete:c,clearValidation:v,isAutoValidationEnabled:C,validateDiagram:y}=Yo(),{getNode:A,getNodes:h,getEdges:x}=Rd(),k=pr(n,s);Od(t,()=>k);let{onNodeDrag:w,onDrop:L,onDragOver:I,onNodeDragStop:P}=er({nodes:r,setNodes:n,setEdges:s}),{isValidConnection:K,onConnect:z}=Mo({setEdges:s});$o();let{createDiagram:ge}=dr(),{undo:ce,redo:pe,saveHistory:Lt,canUndo:Rn,canRedo:Mn}=fr(),{helperLineHorizontal:Vn,helperLineVertical:On,customApplyNodeChanges:Kd}=rr();cr({LIA_CREATE_DIAGRAM:ge,CLEAR_DIAGRAM:()=>{n([]),s([])}}),wn(()=>{g(e==="readonly")},[e,g]);let Gn=()=>{v()},Hn=jt(({nodes:F,edges:B})=>{let Ie=F.length+B.length>1;T(Ie)},[T]);Dd({onChange:Hn});let Bn=F=>{let B=A(F.id);if(B!=null&&B.parentId&&(B==null?void 0:B.type)==="LANE"){let Ie=me(B.parentId,r.filter(ro=>ro.id!==B.id&&ro.type==="LANE"));n(re(Ie))}},zn=F=>{F.forEach(B=>{switch(B.type){case"remove":Bn(B);break}})},Fn=jt(()=>{if(!C){o.current=!1;return}let F=h(),B=x(),Ie=y({nodes:F,edges:B});c(Ie),o.current=!1},[C,h,x,y,c]),to=Bd(Fn,300),oo=jt(()=>{C&&!o.current&&(o.current=!0,to())},[C,to]),Un=F=>{i(F),Lt(F),oo(),zn(F)},Wn=F=>{l(F),Lt(F),oo()},Yn=()=>{Lt("forceSave")},Kn=async({nodes:F,edges:B})=>(E({nodes:F,edges:B}),!1),Zn={nodes:r,edges:a};return Jt("div",{className:"w-full h-full",children:[!p&&$(xn,{}),$(Er,{}),Jt(Ad,{edges:a,nodes:r,nodeTypes:cn,edgeTypes:pn,minZoom:bn,maxZoom:hn,panOnDrag:m||p?!0:zd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!p&&f,nodesConnectable:!p&&f,nodesDraggable:!p&&f,isValidConnection:K,connectionLineComponent:Jo,onConnect:z,onDrop:L,onDropCapture:Yn,onDragOver:I,onNodesChange:Un,onEdgesChange:Wn,onNodeDrag:w,onNodeDragStop:P,onBeforeDelete:Kn,selectionMode:kd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:vn,connectOnClick:!1,children:[b&&$(Id,{pannable:!0,zoomable:!0,position:En,className:"shadow-md rounded-md"}),Jt("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!p&&$(zr,{canUndo:Rn,canRedo:Mn,undo:ce,redo:pe}),$(Vr,{nodes:r,isReadOnly:p,diagram:Zn,onValidationComplete:c,onValidateDiagram:y}),$(Fr,{})]}),$(Nn,{horizontal:Vn,vertical:On}),$(Cd,{gap:gn,size:fn,color:un,bgColor:mn}),u&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(_n,{validationResult:u,onClose:Gn})})]}),$(Tn,{pendingDelete:d,setPendingDelete:E,setNodes:n,setEdges:s})]})});Cn.displayName="Editor";var Fd=({mode:e,locale:t="pt_BR",onConfigureElement:o,selectorRef:r})=>(wn(()=>{t&&Md.changeLanguage(t)},[t]),$(Sd,{children:$(Co,{value:{onConfigureElement:o},children:$(Cn,{mode:e,ref:r})})})),Qt=Fd;var eo=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 In={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 An={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 Sn={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 kn={pt_BR:Sn,en_US:In,es_ES:An};var Ln,Pn,Yd=(Pn=(Ln=eo("LecomUserLanguage"))!=null?Ln:eo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Pn:Wd.PT_BR;Ud({lng:Yd,resources:kn});import{jsx as Dn}from"react/jsx-runtime";var ub=e=>Dn(so,{children:Dn(Qt,N({},e))});export{Dt as ActivityVariant,Mt as ComplexVariant,Pt as ElementType,Vt as ExclusiveVariant,ae as GatewayVariant,ub as Modeler,Rt as RoutingVariant,Ge as useSelectionUtils};
|
|
34
|
+
`),T.close()},"print")},isPrintingPng:r.png,isPrintingHtml:r.html,isPrinting:r.print}};import{jsx as O,jsxs as xe}from"react/jsx-runtime";function Dr(){let{t:e}=ws(),{exportAsPng:t,exportAsHtml:o,printDiagram:r,isPrinting:n,isPrintingPng:i,isPrintingHtml:a}=Pr(),[s,l]=ks(!1);return xe(Ts,{modal:!1,open:s,onOpenChange:l,children:[O(_s,{asChild:!0,children:O("div",{children:xe(ht,{children:[O(Nt,{asChild:!0,children:O(ys,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:O(As,{})})}),!s&&O(vt,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),xe(xs,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[xe(ht,{children:[O(Nt,{asChild:!0,children:O(Kt,{className:"p-1.5",disabled:i,onClick:()=>t(),children:O(Is,{})})}),O(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),xe(ht,{children:[O(Nt,{asChild:!0,children:O(Kt,{className:"p-1.5",disabled:a,onClick:()=>o(),children:O(Cs,{})})}),O(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),xe(ht,{children:[O(Nt,{asChild:!0,children:O(Kt,{className:"p-1.5",disabled:n,onClick:()=>r(),children:O(Ss,{})})}),O(vt,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}import{Fragment as Os,jsx as G,jsxs as le}from"react/jsx-runtime";var Vr=({nodes:e,isReadOnly:t,diagram:o,onValidationComplete:r,onValidateDiagram:n})=>{let{t:i}=Ls(),{deselectAll:a}=Ge(),{isMoveTool:s,isHandTool:l,activeMoveTool:c,activeHandTool:E,isMinimapOpen:f,setIsMinimapOpen:m}=M(),p=Rr(["v","V"]),g=Rr(["h","H"]),T=Vs(()=>{a(),E()},[a,E]),b=()=>{a();let u=n(o);r&&r(u)};return Mr(()=>{p&&!s&&!t&&c()},[p,c,s,t]),Mr(()=>{g&&!l&&!t&&T()},[g,T,l,t]),le("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&le(Os,{children:[le(Tt,{children:[G(_t,{asChild:!0,children:G(yt,{size:"small",variant:"ghost",color:"grey",className:S(s&&"bg-grey-400"),iconButton:!0,onClick:c,children:G(Ms,{})})}),le(xt,{color:"black",children:[i("editor.controls.actions.move_tool"),G("span",{className:"ml-1 text-grey-400",children:"V"})]})]}),le(Tt,{children:[G(_t,{asChild:!0,children:G(yt,{size:"small",variant:"ghost",color:"grey",className:S(l&&"bg-grey-400"),iconButton:!0,onClick:T,children:G(Ps,{})})}),le(xt,{color:"black",children:[i("editor.controls.actions.hand_tool")," ",G("span",{className:"ml-2 text-grey-400",children:"H"})]})]}),le(Tt,{children:[G(_t,{asChild:!0,children:G(yt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:b,children:G(Ds,{})})}),G(xt,{color:"black",children:i("editor.controls.actions.check")})]})]}),G(Dr,{}),!t&&G(kr,{disabled:e.length>0}),le(Tt,{children:[G(_t,{asChild:!0,children:G(yt,{size:"small",variant:"ghost",color:"grey",className:S(f&&"bg-grey-400"),iconButton:!0,onClick:()=>m(!f),children:G(Rs,{})})}),G(xt,{color:"black",children:i(f?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};import{Button as Or,Tooltip as Gr,TooltipContent as Hr,TooltipTrigger as Br,useTranslation as Gs}from"lecom-ui";import{RedoIcon as Hs,UndoIcon as Bs}from"lucide-react";import{jsx as de,jsxs as Zt}from"react/jsx-runtime";var zr=({undo:e,redo:t,canUndo:o,canRedo:r})=>{let{t:n}=Gs();return Zt("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Zt(Gr,{children:[de(Br,{asChild:!0,children:de(Or,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:de(Bs,{})})}),de(Hr,{color:"black",children:n("editor.controls.history.undo")})]}),Zt(Gr,{children:[de(Br,{asChild:!0,children:de(Or,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!r,onClick:t,children:de(Hs,{})})}),de(Hr,{color:"black",children:n("editor.controls.history.redo")})]})]})};import{useReactFlow as zs}from"@xyflow/react";import{Button as wt,Tooltip as Ct,TooltipContent as It,TooltipTrigger as At,useTranslation as Us}from"lecom-ui";import{ScanIcon as Fs,ZoomIn as Ws,ZoomOut as Ys}from"lucide-react";import{jsx as Y,jsxs as Be}from"react/jsx-runtime";var Ur=()=>{let{t:e}=Us(),{zoomIn:t,zoomOut:o,zoomTo:r,fitView:n}=zs();return Be("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[Be(Ct,{children:[Y(At,{asChild:!0,children:Y(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(),children:Y(Fs,{})})}),Y(It,{color:"black",children:e("editor.controls.zoom.fit")})]}),Be(Ct,{children:[Y(At,{asChild:!0,children:Y(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:Y(Ys,{})})}),Y(It,{color:"black",children:e("editor.controls.zoom.out")})]}),Be(Ct,{children:[Y(At,{asChild:!0,children:Y(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(1),children:Y(uo,{})})}),Y(It,{color:"black",children:e("editor.controls.zoom.reset")})]}),Be(Ct,{children:[Y(At,{asChild:!0,children:Y(wt,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:Y(Ws,{})})}),Y(It,{color:"black",children:e("editor.controls.zoom.in")})]})]})};import{Position as Dl,useReactFlow as Rl}from"@xyflow/react";import{Handle as Ks}from"@xyflow/react";import{jsx as Zs}from"react/jsx-runtime";var H=({type:e,position:t,className:o})=>Zs(Ks,{type:e,position:t,className:S("size-2.5 border border-grey-400 bg-white",o)});import{NodeResizer as $s,useReactFlow as Xs}from"@xyflow/react";import{orderBy as qs}from"lodash";import{jsx as js}from"react/jsx-runtime";var _e=o=>{var r=o,{nodeId:e}=r,t=Ee(r,["nodeId"]);let{getNode:n,getNodes:i,setNodes:a}=Xs(),s=({width:l,height:c})=>{if(!e)return;let E=n(e);if((E==null?void 0:E.type)!=="LANE")return;let f=[...i()],m=!E.parentId,p=m?E.id:E.parentId,g=f.filter(u=>u.type==="LANE"&&u.parentId===p);if(!g.length)return;let T=qs(g,["position.y"]),b=0;T.forEach((u,d)=>{var y,A;let v=d===T.length-1,C=(A=(y=u.measured)==null?void 0:y.height)!=null?A:0;f=f.map(h=>{if(h.id===u.id){let x=m?l-K.HEADER_WIDTH:l,k=_(N({},h),{width:x,measured:_(N({},h.measured),{width:x}),position:_(N({},h.position),{y:b})});return v&&m&&(k.height=c-b),k}return h}),b+=C}),f=f.map(u=>{if(u.id===p){let d=m?l:l+K.HEADER_WIDTH;return _(N({},u),{width:d,height:m?c:b,measured:{width:d,height:m?c:b}})}return u}),a(f)};return js($s,N({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",onResizeEnd:(l,c)=>s(c)},t))};import{Position as wl,NodeToolbar as Cl}from"@xyflow/react";import{Button as Il,Tooltip as Al,TooltipContent as Sl,TooltipTrigger as kl,useTranslation as Ll}from"lecom-ui";import{useNodesData as Js,useReactFlow as Qs}from"@xyflow/react";import{Button as el,DropdownMenu as tl,DropdownMenuContent as ol,DropdownMenuGroup as rl,DropdownMenuItem as nl,DropdownMenuLabel as al,DropdownMenuTrigger as il,Tooltip as sl,TooltipContent as ll,TooltipTrigger as dl,useTranslation as cl}from"lecom-ui";import{WrenchIcon as pl}from"lucide-react";import{jsx as ne,jsxs as St}from"react/jsx-runtime";var Fr=({nodeId:e})=>{let{t}=cl(),{updateNodeData:o}=Qs(),r=Js(e),n=i=>{(r==null?void 0:r.data.variant)!==i&&o(e,{variant:i})};return St(tl,{children:[St(sl,{children:[ne(dl,{asChild:!0,children:ne(il,{asChild:!0,children:ne(el,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:ne(pl,{})})})}),ne(ll,{color:"black",children:t("bpmn.gateway.menu.title")})]}),St(ol,{align:"start",className:"w-60 bg-white text-grey-600",children:[ne(al,{className:"flex items-center",children:ne("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.gateway.menu.title")})}),ne(rl,{children:Object.entries(et).map(([i,a])=>St(nl,{className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===i}),onClick:()=>n(i),children:[ne(a.icon,{className:"stroke-current"}),t(`bpmn.gateway.variant.${i.toLowerCase()}`)]},i))})]})]})};import{useNodesData as ml,useReactFlow as ul}from"@xyflow/react";import{Button as Wr,DropdownMenu as fl,DropdownMenuContent as gl,DropdownMenuGroup as El,DropdownMenuItem as bl,DropdownMenuLabel as hl,DropdownMenuTrigger as vl,Tooltip as Nl,TooltipContent as yl,TooltipTrigger as Tl,useTranslation as xl}from"lecom-ui";import{WrenchIcon as _l}from"lucide-react";import{jsx as q,jsxs as ze}from"react/jsx-runtime";var Yr=({nodeId:e})=>{let{t}=xl(),{updateNodeData:o}=ul(),r=ml(e),n=a=>{o(e,{variant:(r==null?void 0:r.data.variant)===a?"":a})},i=a=>{o(e,{attribute:(r==null?void 0:r.data.attribute)===a?"":a})};return ze(fl,{children:[ze(Nl,{children:[q(Tl,{asChild:!0,children:q(vl,{asChild:!0,children:q(Wr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:q(_l,{})})})}),q(yl,{color:"black",children:t("bpmn.task.menu.title")})]}),ze(gl,{align:"start",className:"w-60 bg-white text-grey-600",children:[ze(hl,{className:"flex items-center gap-1",children:[q("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),q("div",{className:"flex items-center gap-1",children:Object.entries(Qe).map(([a,s])=>q(Wr,{variant:"ghost",color:"grey",size:"small",iconButton:!0,className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.attribute)===a}),onClick:()=>i(a),children:q(s.icon,{className:"stroke-inherit"})},a))})]}),q(El,{children:Object.entries(Je).map(([a,s])=>ze(bl,{className:S({"bg-grey-100 text-blue-500":(r==null?void 0:r.data.variant)===a}),onClick:()=>n(a),children:[q(s.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${a.toLowerCase()}`)]},a))})]})]})};import{jsx as j,jsxs as Pl}from"react/jsx-runtime";var Z=({nodeId:e,nodeType:t,isChild:o,isVisible:r})=>{var E;let{t:n}=Ll(),{setDraggableNode:i}=ye(),a=({event:f,type:m,variant:p})=>{i({type:m,variant:p}),f.dataTransfer.effectAllowed="move",f.dataTransfer.setData("sourceId",e)},s={START_EVENT:{type:"START_EVENT",icon:ke,label:n("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:be,label:n("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:ke,label:n("bpmn.task.variant.default")},GATEWAY:{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:n("bpmn.gateway.variant.exclusive")},ANNOTATION:{type:"ANNOTATION",icon:Ze,label:n("bpmn.annotation.variant.default")}},l=[{component:j(lt,{elementId:e})}],c={START_EVENT:[s.TASK,s.ANNOTATION,...l],TASK:[{component:j(De,{elementId:e})},{component:j(Yr,{nodeId:e})},s.TASK,s.GATEWAY,s.END_EVENT,s.ANNOTATION,...l],GATEWAY:[{component:j(De,{elementId:e})},{component:j(Fr,{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(Cl,{className:"-top-6 flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",position:wl.Right,align:"start",isVisible:r,children:(E=c[t])==null?void 0:E.map((f,m)=>f.component?j("div",{children:f.component},m):Pl(Al,{children:[j(kl,{asChild:!0,children:j(Il,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!0,onDragStart:p=>a({event:p,type:f.type,variant:f.variant}),children:f.icon&&j(f.icon,{size:16})})}),j(Sl,{color:"black",children:f.label})]},m))})};import{Fragment as Ml,jsx as Ue,jsxs as Vl}from"react/jsx-runtime";var Kr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Rl(),{isMultipleSelection:i}=M(),a=s=>{n(e,{label:s})};return Vl(Ml,{children:[Ue("div",{className:S("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:Ue(W,{value:t.label,className:"m-1 text-grey-600",onChange:a})}),Ue(Z,{nodeId:e,nodeType:"ANNOTATION",isVisible:!r&&!i&&o}),Ue(_e,{isVisible:!r&&!i&&o,minWidth:rt.MIN_WIDTH,minHeight:rt.MIN_HEIGHT}),Ue(H,{type:"target",position:Dl.Left})]})};import{Position as Zr,useReactFlow as Ol}from"@xyflow/react";import{useState as Gl}from"react";import{Fragment as Hl,jsx as we,jsxs as $r}from"react/jsx-runtime";var Xr=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Ol(),{isMultipleSelection:i}=M(),[a,s]=Gl(!1),l=f=>{n(e,{label:f})};return $r(Hl,{children:[$r("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[we(be,{className:S("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})}),we("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:we(W,{value:t.label,isEditing:a,onChange:l})})]}),we(Z,{nodeId:e,nodeType:"END_EVENT",isVisible:!r&&!i&&o}),we(H,{type:"source",position:Zr.Right}),we(H,{type:"target",position:Zr.Left})]})};import{Position as qr,useReactFlow as Bl}from"@xyflow/react";import{useState as zl}from"react";import{Fragment as Ul,jsx as Ce,jsxs as jr}from"react/jsx-runtime";var Jr=({id:e,data:t,selected:o,dragging:r})=>{let n=et[t.variant].icon,{updateNodeData:i}=Bl(),{isMultipleSelection:a}=M(),[s,l]=zl(!1),c=m=>{i(e,{label:m})};return jr(Ul,{children:[jr("div",{className:"relative",onBlur:()=>{l(!1)},onDoubleClick:()=>{l(!0)},children:[Ce(n,{className:S("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})}),Ce("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:Ce(W,{value:t.label,isEditing:s,onChange:c})})]}),Ce(Z,{nodeId:e,nodeType:"GATEWAY",isVisible:!r&&!a&&o}),Ce(H,{type:"target",position:qr.Left}),Ce(H,{type:"source",position:qr.Right})]})};import{Position as Fl,useReactFlow as Wl}from"@xyflow/react";import{useState as Yl}from"react";import{Fragment as Kl,jsx as Fe,jsxs as Qr}from"react/jsx-runtime";var en=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Wl(),{isMultipleSelection:i}=M(),[a,s]=Yl(!1),l=f=>{n(e,{label:f})};return Qr(Kl,{children:[Qr("div",{className:"relative",onBlur:()=>{s(!1)},onDoubleClick:()=>{s(!0)},children:[Fe(qe,{className:S("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(W,{value:t.label,isEditing:a,onChange:l})})]}),Fe(Z,{nodeId:e,nodeType:"START_EVENT",isVisible:!r&&!i&&o}),Fe(H,{type:"source",position:Fl.Right})]})};import{Position as tn,useReactFlow as Zl}from"@xyflow/react";import{Fragment as $l,jsx as ee,jsxs as on}from"react/jsx-runtime";var rn=({id:e,data:t,selected:o,dragging:r})=>{let{updateNodeData:n}=Zl(),{isMultipleSelection:i}=M(),a=m=>{n(e,{label:m})},s=t.variant?Je[t.variant].icon:null,l=t.attribute?Qe[t.attribute].icon:null,c=t.variant==="SUBPROCESS",E=s&&!c,f=l||c;return on($l,{children:[on("div",{className:S("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(W,{value:t.label,className:S("m-1",{"py-6":E||f}),onChange:a}),s&&ee("div",{className:S("absolute flex items-center p-1",c?"bottom-0":"top-0 left-0"),children:ee(s,{size:16,className:S(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:S("flex items-center w-16 p-1",c?"justify-between":"justify-center"),children:ee(l,{size:16,className:S(t.hasError?"text-red-500":"text-grey-500")})})})]}),ee(Z,{nodeId:e,nodeType:"TASK",isVisible:!r&&!i&&o}),ee(_e,{isVisible:!r&&!i&&o,minWidth:tt.MIN_WIDTH,minHeight:tt.MIN_HEIGHT}),ee(H,{type:"source",position:tn.Right}),ee(H,{type:"target",position:tn.Left})]})};import{Position as nn}from"@xyflow/react";import{Fragment as Xl,jsx as kt,jsxs as ql}from"react/jsx-runtime";var an=({id:e,data:t,selected:o,dragging:r})=>{let{isMultipleSelection:n}=M();return ql(Xl,{children:[kt("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}),kt(Z,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!r&&!n&&o}),kt(H,{type:"source",position:nn.Right}),kt(H,{type:"target",position:nn.Left})]})};import{Position as jl,useReactFlow as Jl}from"@xyflow/react";import{orderBy as Ql}from"lodash";import{useMemo as sn}from"react";import{Fragment as ed,jsx as fe,jsxs as ln}from"react/jsx-runtime";var dn=({id:e,data:t,selected:o,dragging:r,parentId:n})=>{let{updateNodeData:i,getNodes:a}=Jl(),{isMultipleSelection:s}=M(),l=a(),c=!n,E=sn(()=>Ql([...l.filter(g=>g.parentId===e&&g.type==="LANE")],"position.y","asc"),[l,e]),f=c?ot.MIN_WIDTH:K.MIN_WIDTH,m=sn(()=>{if(c&&E.length>1){let g=[...E];return g.pop(),g.reduce((b,u)=>{var d,v;return b+((v=(d=u.measured)==null?void 0:d.height)!=null?v:0)},0)+K.MIN_HEIGHT}return K.MIN_HEIGHT},[c,E]),p=g=>{i(e,{label:g})};return ln(ed,{children:[ln("div",{className:S("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(W,{value:t.label,className:"w-full h-full",onChange:p})})}),fe("div",{className:"flex-1"})]}),fe(Z,{nodeId:e,nodeType:"LANE",isChild:!c,isVisible:!r&&!s&&o}),fe(_e,{nodeId:e,minWidth:f,minHeight:m,isVisible:!r&&!s&&o}),c&&fe(H,{type:"source",position:jl.Right})]})};var cn={START_EVENT:en,END_EVENT:Xr,TASK:rn,GATEWAY:Jr,ANNOTATION:Kr,LANE:dn,UNSUPPORTED:an},pn={SEQUENCE_EDGE:Do,MESSAGE_EDGE:qo,ANNOTATION_EDGE:Ao},mn="#fafafa",un="#bebebe",fn=1,gn=10,En="bottom-left",bn=.5,hn=4,vn={x:0,y:0,zoom:.75};import{useStore as td}from"@xyflow/react";import{useEffect as od,useRef as rd}from"react";import{jsx as ad}from"react/jsx-runtime";var nd=e=>({width:e.width,height:e.height,transform:e.transform}),Nn=({horizontal:e,vertical:t,color:o="#3367d9",dashArray:r=[6,6]})=>{let{width:n,height:i,transform:a}=td(nd),s=rd(null);return od(()=>{let l=s.current,c=l==null?void 0:l.getContext("2d");if(!c||!l)return;let E=window.devicePixelRatio;l.width=n*E,l.height=i*E,c.scale(E,E),c.clearRect(0,0,n,i),c.strokeStyle=o,c.setLineDash(r),typeof t=="number"&&(c.moveTo(t*a[2]+a[0],0),c.lineTo(t*a[2]+a[0],i),c.stroke()),typeof e=="number"&&(c.moveTo(0,e*a[2]+a[1]),c.lineTo(n,e*a[2]+a[1]),c.stroke())},[n,i,a,e,t,o,r]),ad("canvas",{ref:s,className:"react-flow__canvas w-full h-full absolute z-10 pointer-events-none"})};import{Button as yn,Dialog as id,DialogContent as sd,DialogFooter as ld,DialogHeader as dd,DialogTitle as cd,Notification as pd,Typography as $t,useTranslation as md}from"lecom-ui";import{jsx as te,jsxs as Xt}from"react/jsx-runtime";var Tn=({pendingDelete:e,setPendingDelete:t,setNodes:o,setEdges:r})=>{let{t:n}=md(),i=!!e,a=()=>{let{nodes:l,edges:c}=e||{};l!=null&&l.length&&o(E=>E.filter(f=>!l.some(m=>m.id===f.id))),c!=null&&c.length&&r(E=>E.filter(f=>!c.some(m=>m.id===f.id))),t(null)},s=()=>{t(null)};return te(id,{open:i,onOpenChange:s,children:Xt(sd,{className:"w-[488px] max-w-fit gap-2",children:[te(dd,{children:te(cd,{children:te($t,{variant:"heading-small-600",textColor:"text-grey-950",children:n("editor.modals.delete_elements.title")})})}),Xt("div",{className:"flex flex-col gap-2",children:[te("div",{className:"py-2",children:te(pd,{type:"callout",variant:"warning",content:n("editor.modals.delete_elements.callout")})}),te($t,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:n("editor.modals.delete_elements.content")})]}),Xt(ld,{className:"flex items-center flex-row justify-end w-full gap-2",children:[te(yn,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:s,children:te($t,{variant:"body-medium-500",textColor:"text-grey-800",children:n("editor.modals.delete_elements.cancel")})}),te(yn,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:a,children:n("editor.modals.delete_elements.confirm")})]})]})})};import{Button as ud,Tooltip as fd,TooltipContent as gd,TooltipTrigger as Ed,useTranslation as bd}from"lecom-ui";import{jsx as We,jsxs as hd}from"react/jsx-runtime";var xn=()=>{let{t:e}=bd(),{setDraggableNode:t}=ye(),o=[{type:"START_EVENT",icon:qe,label:e("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:be,label:e("bpmn.end_event.variant.default")},{type:"TASK",icon:ke,label:e("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:ho,label:e("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:bo,label:e("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:Eo,label:e("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:he,label:e("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Xe,label:e("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:$e,label:e("bpmn.gateway.variant.complex")},{type:"LANE",icon:mo,label:e("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Ze,label:e("bpmn.annotation.variant.default")}],r=(n,i)=>{t({type:i.type,variant:i.variant,attribute:i.attribute}),n.dataTransfer.effectAllowed="move"};return We("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,i)=>hd(fd,{children:[We(Ed,{asChild:!0,children:We(ud,{className:"[&>svg]:size-6",size:"small",variant:"ghost",color:"grey",draggable:!0,iconButton:!0,onDragStart:a=>r(a,n),children:We(n.icon,{})},i)}),We(gd,{color:"black",side:"right",children:n.label})]},i))})};import{Button as vd,useTranslation as Nd}from"lecom-ui";import{AlertCircleIcon as yd,CircleCheckIcon as Td,XIcon as xd}from"lucide-react";import{useEffect as _d,useState as wd}from"react";import{jsx as J,jsxs as qt}from"react/jsx-runtime";var _n=({validationResult:e,onClose:t})=>{let{t:o}=Nd(),[r,n]=wd(!1);if(_d(()=>{e&&n(!0)},[e]),!r||!e)return null;let{isValid:i,errors:a}=e;return qt("div",{className:S("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[qt("div",{className:"flex flex-row items-start gap-4",children:[J("div",{className:"flex-shrink-0",children:i?J(Td,{className:"text-green-500 size-5"}):J(yd,{className:"text-red-500 size-5"})}),qt("div",{className:"body-medium-500 text-grey-800",children:[J("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&J("div",{children:o("validation.errors.subtitle")})]}),J(vd,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{n(!1),t()},children:J(xd,{})})]}),J("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?J("p",{children:o("validation.success.message")}):J("div",{className:"list-disc list-inside",children:a.map(s=>J("li",{className:"mb-1",children:s.message},s.id))})})]})};import{jsx as $,jsxs as Jt}from"react/jsx-runtime";var zd=[],Cn=Vd(({mode:e="edit"},t)=>{let o=Gd(!1),[r,n,i]=Pd([]),[a,s,l]=Ld([]),[c,E]=Hd(null),{isMoveTool:f,isHandTool:m,isReadOnly:p,setIsReadOnly:g,setIsMultipleSelection:T,isMinimapOpen:b}=M(),{validationResult:u,handleValidationComplete:d,clearValidation:v,isAutoValidationEnabled:C,validateDiagram:y}=Yo(),{getNode:A,getNodes:h,getEdges:x}=Rd(),k=pr(n,s);Od(t,()=>k);let{onNodeDrag:w,onDrop:L,onDragOver:I,onNodeDragStop:P}=er({nodes:r,setNodes:n,setEdges:s}),{isValidConnection:z,onConnect:U}=Mo({setEdges:s});$o();let{createDiagram:ge}=dr(),{undo:ce,redo:pe,saveHistory:Lt,canUndo:Rn,canRedo:Mn}=fr(),{helperLineHorizontal:Vn,helperLineVertical:On,customApplyNodeChanges:Kd}=rr();cr({LIA_CREATE_DIAGRAM:ge,CLEAR_DIAGRAM:()=>{n([]),s([])}}),wn(()=>{g(e==="readonly")},[e,g]);let Gn=()=>{v()},Hn=jt(({nodes:F,edges:B})=>{let Ie=F.length+B.length>1;T(Ie)},[T]);Dd({onChange:Hn});let Bn=F=>{let B=A(F.id);if(B!=null&&B.parentId&&(B==null?void 0:B.type)==="LANE"){let Ie=me(B.parentId,r.filter(ro=>ro.id!==B.id&&ro.type==="LANE"));n(re(Ie))}},zn=F=>{F.forEach(B=>{switch(B.type){case"remove":Bn(B);break}})},Un=jt(()=>{if(!C){o.current=!1;return}let F=h(),B=x(),Ie=y({nodes:F,edges:B});d(Ie),o.current=!1},[C,h,x,y,d]),to=Bd(Un,300),oo=jt(()=>{C&&!o.current&&(o.current=!0,to())},[C,to]),Fn=F=>{i(F),Lt(F),oo(),zn(F)},Wn=F=>{l(F),Lt(F),oo()},Yn=()=>{Lt("forceSave")},Kn=async({nodes:F,edges:B})=>(E({nodes:F,edges:B}),!1),Zn={nodes:r,edges:a};return Jt("div",{className:"w-full h-full",children:[!p&&$(xn,{}),$(Er,{}),Jt(Ad,{edges:a,nodes:r,nodeTypes:cn,edgeTypes:pn,minZoom:bn,maxZoom:hn,panOnDrag:m||p?!0:zd,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!p&&f,nodesConnectable:!p&&f,nodesDraggable:!p&&f,isValidConnection:z,connectionLineComponent:Jo,onConnect:U,onDrop:L,onDropCapture:Yn,onDragOver:I,onNodesChange:Fn,onEdgesChange:Wn,onNodeDrag:w,onNodeDragStop:P,onBeforeDelete:Kn,selectionMode:kd.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[10,10],defaultViewport:vn,connectOnClick:!1,children:[b&&$(Id,{pannable:!0,zoomable:!0,position:En,className:"shadow-md rounded-md"}),Jt("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!p&&$(zr,{canUndo:Rn,canRedo:Mn,undo:ce,redo:pe}),$(Vr,{nodes:r,isReadOnly:p,diagram:Zn,onValidationComplete:d,onValidateDiagram:y}),$(Ur,{})]}),$(Nn,{horizontal:Vn,vertical:On}),$(Cd,{gap:gn,size:fn,color:un,bgColor:mn}),u&&$("div",{className:"absolute top-6 right-6 z-[1000]",children:$(_n,{validationResult:u,onClose:Gn})})]}),$(Tn,{pendingDelete:c,setPendingDelete:E,setNodes:n,setEdges:s})]})});Cn.displayName="Editor";var Ud=({mode:e,locale:t="pt_BR",onConfigureElement:o,selectorRef:r})=>(wn(()=>{t&&Md.changeLanguage(t)},[t]),$(Sd,{children:$(Co,{value:{onConfigureElement:o},children:$(Cn,{mode:e,ref:r})})})),Qt=Ud;var eo=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 Wd}from"lecom-ui";var In={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 An={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 Sn={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 kn={pt_BR:Sn,en_US:In,es_ES:An};var Ln,Pn,Yd=(Pn=(Ln=eo("LecomUserLanguage"))!=null?Ln:eo("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Pn:Wd.PT_BR;Fd({lng:Yd,resources:kn});import{jsx as Dn}from"react/jsx-runtime";var ub=e=>Dn(so,{children:Dn(Qt,N({},e))});export{Dt as ActivityVariant,Mt as ComplexVariant,Pt as ElementType,Vt as ExclusiveVariant,ae as GatewayVariant,ub as Modeler,Rt as RoutingVariant,Ge as useSelectionUtils};
|