lecom-modeler 0.6.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -1,25 +1,25 @@
1
- "use strict";var gu=Object.create;var Io=Object.defineProperty,hu=Object.defineProperties,yu=Object.getOwnPropertyDescriptor,xu=Object.getOwnPropertyDescriptors,Eu=Object.getOwnPropertyNames,xn=Object.getOwnPropertySymbols,_u=Object.getPrototypeOf,zr=Object.prototype.hasOwnProperty,Vi=Object.prototype.propertyIsEnumerable;var Ri=(e,t,o)=>t in e?Io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,x=(e,t)=>{for(var o in t||(t={}))zr.call(t,o)&&Ri(e,o,t[o]);if(xn)for(var o of xn(t))Vi.call(t,o)&&Ri(e,o,t[o]);return e},v=(e,t)=>hu(e,xu(t));var He=(e,t)=>{var o={};for(var n in e)zr.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&xn)for(var n of xn(e))t.indexOf(n)<0&&Vi.call(e,n)&&(o[n]=e[n]);return o};var bu=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enumerable:!0})},Oi=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Eu(t))!zr.call(e,r)&&r!==o&&Io(e,r,{get:()=>t[r],enumerable:!(n=yu(t,r))||n.enumerable});return e};var Tu=(e,t,o)=>(o=e!=null?gu(_u(e)):{},Oi(t||!e||!e.__esModule?Io(o,"default",{value:e,enumerable:!0}):o,e)),vu=e=>Oi(Io({},"__esModule",{value:!0}),e);var zm={};bu(zm,{ActivityVariant:()=>_n,ComplexVariant:()=>Tn,ElementType:()=>So,ExclusiveVariant:()=>vn,GatewayVariant:()=>Me,Modeler:()=>Jd,ModelerProvider:()=>Kd,RoutingVariant:()=>bn,useModeler:()=>Gr,useSelectionUtils:()=>eo});module.exports=vu(zm);var Fr=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 En=require("lecom-ui");var Hi={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing",initial_task:"Initial Activity",gateway_limit_reached:"Exclusive gateway cannot have more than 2 outgoing connections",task_limit_reached:"Task cannot have more than 2 outgoing connections",gateway_to_gateway_not_allowed:"Gateways cannot connect directly to other gateways",start_event_already_exists:"A start event already exists. Delete the current event to add another",script_to_end_not_allowed:"Script activities cannot connect directly to the end event",loop_to_end_not_allowed:"Loop activities cannot connect directly to the end event",initial_activity_to_end_not_allowed:"Initial activity cannot connect directly to the end event",final_activity_cannot_connect:"Final activity cannot connect to other elements",activity_has_outgoing_connections:"Activity with outgoing connections cannot connect to end event",end_event_cannot_connect_to_initial_activity:"End event cannot connect to an initial activity",initial_activity_cannot_connect_to_start_event:"Initial activity cannot connect to start event",connect_node:"Connect element",connecting:"Connecting..."},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"}},task_menu:{loop_not_allowed_when_connected_to_end:"Cannot create loop on activity connected to end event",script_not_allowed_when_connected_to_end:"Cannot transform to Script activity connected to end event",loop_not_allowed_when_subprocess:"Cannot create loop on subprocess"}},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"},label:{prefix:"Activity"}},lane:{variant:{default:"Pool / 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 Gi={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento",initial_task:"Actividad Inicial",gateway_limit_reached:"Compuerta exclusiva no puede tener m\xE1s de 2 conexiones de salida",task_limit_reached:"Actividad no puede tener m\xE1s de 2 conexiones de salida",gateway_to_gateway_not_allowed:"Las compuertas no pueden conectarse directamente con otras compuertas",start_event_already_exists:"Ya existe un evento de inicio. Elimine el evento actual para agregar otro",script_to_end_not_allowed:"Las actividades Script no pueden conectarse directamente al evento final",loop_to_end_not_allowed:"Las actividades Loop no pueden conectarse directamente al evento final",initial_activity_to_end_not_allowed:"Actividad inicial no puede conectarse directamente al evento final",final_activity_cannot_connect:"Actividad final no puede conectarse a otros elementos",activity_has_outgoing_connections:"Actividad con conexiones de salida no puede conectarse al evento final",end_event_cannot_connect_to_initial_activity:"El evento final no puede conectarse a una actividad inicial",initial_activity_cannot_connect_to_start_event:"Actividad inicial no puede conectarse a evento de inicio",connect_node:"Conectar elemento",connecting:"Conectando..."},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"}},task_menu:{loop_not_allowed_when_connected_to_end:"No se puede crear bucle en actividad conectada al evento final",script_not_allowed_when_connected_to_end:"No se puede transformar a Script actividad conectada al evento final",loop_not_allowed_when_subprocess:"No se puede crear bucle en subproceso"}},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"},label:{prefix:"Actividad"}},lane:{variant:{default:"Piscina / Raia"}},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 Bi={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento",initial_task:"Atividade Inicial",gateway_limit_reached:"Gateway exclusivo n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",task_limit_reached:"Atividade n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",gateway_to_gateway_not_allowed:"Gateways n\xE3o podem se conectar diretamente com outros gateways",start_event_already_exists:"J\xE1 existe um evento de in\xEDcio. Exclua o evento atual para adicionar outro",script_to_end_not_allowed:"Atividades Script n\xE3o podem se conectar diretamente ao evento final",loop_to_end_not_allowed:"Atividades Loop n\xE3o podem se conectar diretamente ao evento final",initial_activity_to_end_not_allowed:"Atividade inicial n\xE3o pode se conectar diretamente ao evento final",final_activity_cannot_connect:"Atividade final n\xE3o pode se conectar a outros elementos",activity_has_outgoing_connections:"Atividade com conex\xF5es de sa\xEDda n\xE3o pode se conectar a um evento final",end_event_cannot_connect_to_initial_activity:"O evento final n\xE3o pode ser conectado a uma atividade inicial",initial_activity_cannot_connect_to_start_event:"Atividade inicial n\xE3o pode se conectar a evento de in\xEDcio",connect_node:"Conectar elemento",connecting:"Conectando..."},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"}},task_menu:{loop_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel criar loop em atividade conectada ao evento final",script_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel transformar em Script atividade conectada ao evento final",loop_not_allowed_when_subprocess:"N\xE3o \xE9 poss\xEDvel criar loop em subprocesso"}},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"},label:{prefix:"Atividade"}},lane:{variant:{default:"Piscina / Raia"}},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 zi={pt_BR:Bi,en_US:Hi,es_ES:Gi};var Fi,Ui,Nu=(Ui=(Fi=Fr("LecomUserLanguage"))!=null?Fi:Fr("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Ui:En.Translations.PT_BR;(0,En.initializeI18n)({lng:Nu,resources:zi});var So=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(So||{}),_n=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(_n||{}),bn=(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))(bn||{}),Tn=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(Tn||{}),vn=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(vn||{});var jt=require("lucide-react");var _t=require("react/jsx-runtime"),Nn=({size:e=24,className:t})=>(0,_t.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,_t.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,_t.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,_t.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,_t.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var Ur=require("react/jsx-runtime"),Yt=({size:e=24,className:t})=>(0,Ur.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#ff6565",stroke:"#ec1616",strokeWidth:3,className:t,children:(0,Ur.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 it=require("react/jsx-runtime"),$t=({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:"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,it.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,it.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,it.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,it.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Xt=require("react/jsx-runtime"),Kt=({size:e=24,className:t})=>(0,Xt.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,Xt.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,Xt.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Xt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var qt=require("react/jsx-runtime"),Zt=({size:e=24,className:t})=>(0,qt.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,qt.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,qt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,qt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var Jt=require("react/jsx-runtime"),Wi=({size:e=24,className:t})=>(0,Jt.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,Jt.jsxs)("g",{children:[(0,Jt.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,Jt.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Yi=require("clsx"),$i=require("tailwind-merge");function L(...e){return(0,$i.twMerge)((0,Yi.clsx)(e))}var st=(e=0,t=0)=>e<t?t:e;var Mo=require("react/jsx-runtime"),Xi=({size:e=24,className:t})=>(0,Mo.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:L("stroke-2",t),children:[(0,Mo.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,Mo.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var wn=require("react/jsx-runtime"),Ki=({size:e=24,className:t})=>(0,wn.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,wn.jsx)("g",{children:(0,wn.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 Wr=require("react/jsx-runtime"),An=({size:e=24,className:t})=>(0,Wr.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#5fd9b0",stroke:"#1cad86",strokeWidth:"2",className:t,children:(0,Wr.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 Yr=require("react/jsx-runtime"),Po=({size:e=24,className:t})=>(0,Yr.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:L("stroke-2",t),children:(0,Yr.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 Qt=require("react/jsx-runtime"),qi=({size:e=24,className:t})=>(0,Qt.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,Qt.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,Qt.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,Qt.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var at=require("react/jsx-runtime"),Zi=({size:e=24,className:t})=>(0,at.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,at.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,at.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,at.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,at.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,at.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var bt=require("react/jsx-runtime"),Ji=({size:e=24,className:t})=>(0,bt.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,bt.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,bt.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,bt.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,bt.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var D=(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))(D||{});var Cn={SCRIPT:{icon:jt.ScrollText},SUBPROCESS:{icon:jt.SquarePlus}};var In={LOOP:{icon:jt.RotateCcw}},Me=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(Me||{}),$r={EXCLUSIVE:{icon:Kt},PARALLEL:{icon:Zt},COMPLEX:{icon:$t}};var Qi=require("@xyflow/react"),wu=e=>({unselectAll:e.unselectNodesAndEdges}),eo=()=>{let{unselectAll:e}=(0,Qi.useStore)(wu);return{deselectAll:async()=>(e(),new Promise(o=>{setTimeout(o,1e3)}))}};var qd=require("@xyflow/react"),oe=require("react");var ie=require("@xyflow/react"),Ud=require("lecom-ui"),fe=require("react"),Wd=require("use-debounce"),Or=require("uuid");var ji=require("zustand"),es=require("@xyflow/react"),ts=require("react");var Sn=()=>{let{setEdges:e}=(0,es.useReactFlow)();return(0,ts.useCallback)(()=>{let o=Tt.getState().pathEdgeIds;e(n=>n.map(r=>v(x({},r),{selected:o.includes(r.id)})))},[e])},Tt=(0,ji.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=x({},n.statusByNodeId),i=x({},n.statusData),a=!1;return o.forEach(s=>{let l=`${s.diagramId}-${s.activityId}`;r[s.diagramId]!==s.status&&(r[s.diagramId]=s.status,i[l]=s,a=!0)}),a?{statusByNodeId:r,statusData:i}:n})},getTaskStatus:o=>t().statusByNodeId[o]||null,clearTaskStatuses:()=>e({statusByNodeId:{},statusData:{},pathEdgeIds:[]}),setPathEdges:o=>{e({pathEdgeIds:o})},getPathEdgeIds:()=>t().pathEdgeIds,clearPathEdges:()=>{e({pathEdgeIds:[]})},calculateFlowPath:(o,n)=>{if(!o.length||!n.length)return;t().clearPathEdges();let r=n.filter(c=>t().statusByNodeId[c]);if(r.length<=1)return;let i=[],a={};o.forEach(c=>{a[c.source]||(a[c.source]=[]),a[c.source].push({targetId:c.target,edgeId:c.id})});let s=r[0],l=r[r.length-1];o.forEach(c=>{c.target===s&&i.push(c.id)}),o.forEach(c=>{c.source===l&&i.push(c.id)});let d=(c,p)=>{let u=[],f=new Set;for(u.push({node:c,path:[]}),f.add(c);u.length>0;){let{node:h,path:g}=u.shift();if(h===p)return g;let E=a[h]||[];for(let{targetId:C,edgeId:T}of E)f.has(C)||(f.add(C),u.push({node:C,path:[...g,T]}))}return[]};for(let c=0;c<r.length-1;c++){let p=r[c],u=r[c+1],f=d(p,u);f.length>0&&i.push(...f)}i.length>0&&e({pathEdgeIds:i})}}));var io=require("@xyflow/react");var Au={value:()=>{}};function ns(){for(var e=0,t=arguments.length,o={},n;e<t;++e){if(!(n=arguments[e]+"")||n in o||/[\s.]/.test(n))throw new Error("illegal type: "+n);o[n]=[]}return new Mn(o)}function Mn(e){this._=e}function Cu(e,t){return e.trim().split(/^|\s+/).map(function(o){var n="",r=o.indexOf(".");if(r>=0&&(n=o.slice(r+1),o=o.slice(0,r)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:n}})}Mn.prototype=ns.prototype={constructor:Mn,on:function(e,t){var o=this._,n=Cu(e+"",o),r,i=-1,a=n.length;if(arguments.length<2){for(;++i<a;)if((r=(e=n[i]).type)&&(r=Iu(o[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(r=(e=n[i]).type)o[r]=os(o[r],e.name,t);else if(t==null)for(r in o)o[r]=os(o[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Mn(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var o=new Array(r),n=0,r,i;n<r;++n)o[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],n=0,r=i.length;n<r;++n)i[n].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],r=0,i=n.length;r<i;++r)n[r].value.apply(t,o)}};function Iu(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function os(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=Au,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var Xr=ns;var Pn="http://www.w3.org/1999/xhtml",Kr={svg:"http://www.w3.org/2000/svg",xhtml:Pn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xe(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Kr.hasOwnProperty(t)?{space:Kr[t],local:e}:e}function Su(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Pn&&t.documentElement.namespaceURI===Pn?t.createElement(e):t.createElementNS(o,e)}}function Mu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ln(e){var t=Xe(e);return(t.local?Mu:Su)(t)}function Pu(){}function vt(e){return e==null?Pu:function(){return this.querySelector(e)}}function rs(e){typeof e!="function"&&(e=vt(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=new Array(a),l,d,c=0;c<a;++c)(l=i[c])&&(d=e.call(l,l.__data__,c,i))&&("__data__"in l&&(d.__data__=l.__data__),s[c]=d);return new ee(n,this._parents)}function qr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Lu(){return[]}function Lo(e){return e==null?Lu:function(){return this.querySelectorAll(e)}}function ku(e){return function(){return qr(e.apply(this,arguments))}}function is(e){typeof e=="function"?e=ku(e):e=Lo(e);for(var t=this._groups,o=t.length,n=[],r=[],i=0;i<o;++i)for(var a=t[i],s=a.length,l,d=0;d<s;++d)(l=a[d])&&(n.push(e.call(l,l.__data__,d,a)),r.push(l));return new ee(n,r)}function ko(e){return function(){return this.matches(e)}}function kn(e){return function(t){return t.matches(e)}}var Du=Array.prototype.find;function Ru(e){return function(){return Du.call(this.children,e)}}function Vu(){return this.firstElementChild}function ss(e){return this.select(e==null?Vu:Ru(typeof e=="function"?e:kn(e)))}var Ou=Array.prototype.filter;function Hu(){return Array.from(this.children)}function Gu(e){return function(){return Ou.call(this.children,e)}}function as(e){return this.selectAll(e==null?Hu:Gu(typeof e=="function"?e:kn(e)))}function ls(e){typeof e!="function"&&(e=ko(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=[],l,d=0;d<a;++d)(l=i[d])&&e.call(l,l.__data__,d,i)&&s.push(l);return new ee(n,this._parents)}function Dn(e){return new Array(e.length)}function cs(){return new ee(this._enter||this._groups.map(Dn),this._parents)}function Do(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Do.prototype={constructor:Do,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ds(e){return function(){return e}}function Bu(e,t,o,n,r,i){for(var a=0,s,l=t.length,d=i.length;a<d;++a)(s=t[a])?(s.__data__=i[a],n[a]=s):o[a]=new Do(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function zu(e,t,o,n,r,i,a){var s,l,d=new Map,c=t.length,p=i.length,u=new Array(c),f;for(s=0;s<c;++s)(l=t[s])&&(u[s]=f=a.call(l,l.__data__,s,t)+"",d.has(f)?r[s]=l:d.set(f,l));for(s=0;s<p;++s)f=a.call(e,i[s],s,i)+"",(l=d.get(f))?(n[s]=l,l.__data__=i[s],d.delete(f)):o[s]=new Do(e,i[s]);for(s=0;s<c;++s)(l=t[s])&&d.get(u[s])===l&&(r[s]=l)}function Fu(e){return e.__data__}function us(e,t){if(!arguments.length)return Array.from(this,Fu);var o=t?zu:Bu,n=this._parents,r=this._groups;typeof e!="function"&&(e=ds(e));for(var i=r.length,a=new Array(i),s=new Array(i),l=new Array(i),d=0;d<i;++d){var c=n[d],p=r[d],u=p.length,f=Uu(e.call(c,c&&c.__data__,d,n)),h=f.length,g=s[d]=new Array(h),E=a[d]=new Array(h),C=l[d]=new Array(u);o(c,p,g,E,C,f,t);for(var T=0,b=0,m,y;T<h;++T)if(m=g[T]){for(T>=b&&(b=T+1);!(y=E[b])&&++b<h;);m._next=y||null}}return a=new ee(a,n),a._enter=s,a._exit=l,a}function Uu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ps(){return new ee(this._exit||this._groups.map(Dn),this._parents)}function fs(e,t,o){var n=this.enter(),r=this,i=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),o==null?i.remove():o(i),n&&r?n.merge(r).order():r}function ms(e){for(var t=e.selection?e.selection():e,o=this._groups,n=t._groups,r=o.length,i=n.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var d=o[l],c=n[l],p=d.length,u=s[l]=new Array(p),f,h=0;h<p;++h)(f=d[h]||c[h])&&(u[h]=f);for(;l<r;++l)s[l]=o[l];return new ee(s,this._parents)}function gs(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var n=e[t],r=n.length-1,i=n[r],a;--r>=0;)(a=n[r])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function hs(e){e||(e=Wu);function t(p,u){return p&&u?e(p.__data__,u.__data__):!p-!u}for(var o=this._groups,n=o.length,r=new Array(n),i=0;i<n;++i){for(var a=o[i],s=a.length,l=r[i]=new Array(s),d,c=0;c<s;++c)(d=a[c])&&(l[c]=d);l.sort(t)}return new ee(r,this._parents).order()}function Wu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ys(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xs(){return Array.from(this)}function Es(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length;r<i;++r){var a=n[r];if(a)return a}return null}function _s(){let e=0;for(let t of this)++e;return e}function bs(){return!this.node()}function Ts(e){for(var t=this._groups,o=0,n=t.length;o<n;++o)for(var r=t[o],i=0,a=r.length,s;i<a;++i)(s=r[i])&&e.call(s,s.__data__,i,r);return this}function Yu(e){return function(){this.removeAttribute(e)}}function $u(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xu(e,t){return function(){this.setAttribute(e,t)}}function Ku(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function qu(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Zu(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function vs(e,t){var o=Xe(e);if(arguments.length<2){var n=this.node();return o.local?n.getAttributeNS(o.space,o.local):n.getAttribute(o)}return this.each((t==null?o.local?$u:Yu:typeof t=="function"?o.local?Zu:qu:o.local?Ku:Xu)(o,t))}function Rn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ju(e){return function(){this.style.removeProperty(e)}}function Qu(e,t,o){return function(){this.style.setProperty(e,t,o)}}function ju(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function Ns(e,t,o){return arguments.length>1?this.each((t==null?Ju:typeof t=="function"?ju:Qu)(e,t,o==null?"":o)):lt(this.node(),e)}function lt(e,t){return e.style.getPropertyValue(t)||Rn(e).getComputedStyle(e,null).getPropertyValue(t)}function ep(e){return function(){delete this[e]}}function tp(e,t){return function(){this[e]=t}}function op(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function ws(e,t){return arguments.length>1?this.each((t==null?ep:typeof t=="function"?op:tp)(e,t)):this.node()[e]}function As(e){return e.trim().split(/^|\s+/)}function Zr(e){return e.classList||new Cs(e)}function Cs(e){this._node=e,this._names=As(e.getAttribute("class")||"")}Cs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Is(e,t){for(var o=Zr(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function Ss(e,t){for(var o=Zr(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function np(e){return function(){Is(this,e)}}function rp(e){return function(){Ss(this,e)}}function ip(e,t){return function(){(t.apply(this,arguments)?Is:Ss)(this,e)}}function Ms(e,t){var o=As(e+"");if(arguments.length<2){for(var n=Zr(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?ip:t?np:rp)(o,t))}function sp(){this.textContent=""}function ap(e){return function(){this.textContent=e}}function lp(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Ps(e){return arguments.length?this.each(e==null?sp:(typeof e=="function"?lp:ap)(e)):this.node().textContent}function cp(){this.innerHTML=""}function dp(e){return function(){this.innerHTML=e}}function up(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function Ls(e){return arguments.length?this.each(e==null?cp:(typeof e=="function"?up:dp)(e)):this.node().innerHTML}function pp(){this.nextSibling&&this.parentNode.appendChild(this)}function ks(){return this.each(pp)}function fp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ds(){return this.each(fp)}function Rs(e){var t=typeof e=="function"?e:Ln(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function mp(){return null}function Vs(e,t){var o=typeof e=="function"?e:Ln(e),n=t==null?mp:typeof t=="function"?t:vt(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function gp(){var e=this.parentNode;e&&e.removeChild(this)}function Os(){return this.each(gp)}function hp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function yp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hs(e){return this.select(e?yp:hp)}function Gs(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xp(e){return function(t){e.call(this,t,this.__data__)}}function Ep(e){return e.trim().split(/^|\s+/).map(function(t){var o="",n=t.indexOf(".");return n>=0&&(o=t.slice(n+1),t=t.slice(0,n)),{type:t,name:o}})}function _p(e){return function(){var t=this.__on;if(t){for(var o=0,n=-1,r=t.length,i;o<r;++o)i=t[o],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++n]=i;++n?t.length=n:delete this.__on}}}function bp(e,t,o){return function(){var n=this.__on,r,i=xp(t);if(n){for(var a=0,s=n.length;a<s;++a)if((r=n[a]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=o),r.value=t;return}}this.addEventListener(e.type,i,o),r={type:e.type,name:e.name,value:t,listener:i,options:o},n?n.push(r):this.__on=[r]}}function Bs(e,t,o){var n=Ep(e+""),r,i=n.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,d=s.length,c;l<d;++l)for(r=0,c=s[l];r<i;++r)if((a=n[r]).type===c.type&&a.name===c.name)return c.value}return}for(s=t?bp:_p,r=0;r<i;++r)this.each(s(n[r],t,o));return this}function zs(e,t,o){var n=Rn(e),r=n.CustomEvent;typeof r=="function"?r=new r(t,o):(r=n.document.createEvent("Event"),o?(r.initEvent(t,o.bubbles,o.cancelable),r.detail=o.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Tp(e,t){return function(){return zs(this,e,t)}}function vp(e,t){return function(){return zs(this,e,t.apply(this,arguments))}}function Fs(e,t){return this.each((typeof t=="function"?vp:Tp)(e,t))}function*Us(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length,a;r<i;++r)(a=n[r])&&(yield a)}var Np=[null];function ee(e,t){this._groups=e,this._parents=t}function Ws(){return new ee([[document.documentElement]],Np)}function wp(){return this}ee.prototype=Ws.prototype={constructor:ee,select:rs,selectAll:is,selectChild:ss,selectChildren:as,filter:ls,data:us,enter:cs,exit:ps,join:fs,merge:ms,selection:wp,order:gs,sort:hs,call:ys,nodes:xs,node:Es,size:_s,empty:bs,each:Ts,attr:vs,style:Ns,property:ws,classed:Ms,text:Ps,html:Ls,raise:ks,lower:Ds,append:Rs,insert:Vs,remove:Os,clone:Hs,datum:Gs,on:Bs,dispatch:Fs,[Symbol.iterator]:Us};var Ke=Ws;function Vn(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Jr(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function Oo(){}var Ro=.7,Gn=1/Ro,to="\\s*([+-]?\\d+)\\s*",Vo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Ap=/^#([0-9a-f]{3,8})$/,Cp=new RegExp(`^rgb\\(${to},${to},${to}\\)$`),Ip=new RegExp(`^rgb\\(${Ge},${Ge},${Ge}\\)$`),Sp=new RegExp(`^rgba\\(${to},${to},${to},${Vo}\\)$`),Mp=new RegExp(`^rgba\\(${Ge},${Ge},${Ge},${Vo}\\)$`),Pp=new RegExp(`^hsl\\(${Vo},${Ge},${Ge}\\)$`),Lp=new RegExp(`^hsla\\(${Vo},${Ge},${Ge},${Vo}\\)$`),Ys={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Vn(Oo,ct,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$s,formatHex:$s,formatHex8:kp,formatHsl:Dp,formatRgb:Xs,toString:Xs});function $s(){return this.rgb().formatHex()}function kp(){return this.rgb().formatHex8()}function Dp(){return js(this).formatHsl()}function Xs(){return this.rgb().formatRgb()}function ct(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Ap.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Ks(t):o===3?new xe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?On(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?On(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Cp.exec(e))?new xe(t[1],t[2],t[3],1):(t=Ip.exec(e))?new xe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Sp.exec(e))?On(t[1],t[2],t[3],t[4]):(t=Mp.exec(e))?On(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Pp.exec(e))?Js(t[1],t[2]/100,t[3]/100,1):(t=Lp.exec(e))?Js(t[1],t[2]/100,t[3]/100,t[4]):Ys.hasOwnProperty(e)?Ks(Ys[e]):e==="transparent"?new xe(NaN,NaN,NaN,0):null}function Ks(e){return new xe(e>>16&255,e>>8&255,e&255,1)}function On(e,t,o,n){return n<=0&&(e=t=o=NaN),new xe(e,t,o,n)}function Rp(e){return e instanceof Oo||(e=ct(e)),e?(e=e.rgb(),new xe(e.r,e.g,e.b,e.opacity)):new xe}function oo(e,t,o,n){return arguments.length===1?Rp(e):new xe(e,t,o,n==null?1:n)}function xe(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}Vn(xe,oo,Jr(Oo,{brighter(e){return e=e==null?Gn:Math.pow(Gn,e),new xe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ro:Math.pow(Ro,e),new xe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xe(wt(this.r),wt(this.g),wt(this.b),Bn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:qs,formatHex:qs,formatHex8:Vp,formatRgb:Zs,toString:Zs}));function qs(){return`#${Nt(this.r)}${Nt(this.g)}${Nt(this.b)}`}function Vp(){return`#${Nt(this.r)}${Nt(this.g)}${Nt(this.b)}${Nt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zs(){let e=Bn(this.opacity);return`${e===1?"rgb(":"rgba("}${wt(this.r)}, ${wt(this.g)}, ${wt(this.b)}${e===1?")":`, ${e})`}`}function Bn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Nt(e){return e=wt(e),(e<16?"0":"")+e.toString(16)}function Js(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new De(e,t,o,n)}function js(e){if(e instanceof De)return new De(e.h,e.s,e.l,e.opacity);if(e instanceof Oo||(e=ct(e)),!e)return new De;if(e instanceof De)return e;e=e.rgb();var t=e.r/255,o=e.g/255,n=e.b/255,r=Math.min(t,o,n),i=Math.max(t,o,n),a=NaN,s=i-r,l=(i+r)/2;return s?(t===i?a=(o-n)/s+(o<n)*6:o===i?a=(n-t)/s+2:a=(t-o)/s+4,s/=l<.5?i+r:2-i-r,a*=60):s=l>0&&l<1?0:a,new De(a,s,l,e.opacity)}function ea(e,t,o,n){return arguments.length===1?js(e):new De(e,t,o,n==null?1:n)}function De(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}Vn(De,ea,Jr(Oo,{brighter(e){return e=e==null?Gn:Math.pow(Gn,e),new De(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ro:Math.pow(Ro,e),new De(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,n=o+(o<.5?o:1-o)*t,r=2*o-n;return new xe(Qr(e>=240?e-240:e+120,r,n),Qr(e,r,n),Qr(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new De(Qs(this.h),Hn(this.s),Hn(this.l),Bn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Bn(this.opacity);return`${e===1?"hsl(":"hsla("}${Qs(this.h)}, ${Hn(this.s)*100}%, ${Hn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Qs(e){return e=(e||0)%360,e<0?e+360:e}function Hn(e){return Math.max(0,Math.min(1,e||0))}function Qr(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}function jr(e,t,o,n,r){var i=e*e,a=i*e;return((1-3*e+3*i-a)*t+(4-6*i+3*a)*o+(1+3*e+3*i-3*a)*n+a*r)/6}function ta(e){var t=e.length-1;return function(o){var n=o<=0?o=0:o>=1?(o=1,t-1):Math.floor(o*t),r=e[n],i=e[n+1],a=n>0?e[n-1]:2*r-i,s=n<t-1?e[n+2]:2*i-r;return jr((o-n/t)*t,a,r,i,s)}}function oa(e){var t=e.length;return function(o){var n=Math.floor(((o%=1)<0?++o:o)*t),r=e[(n+t-1)%t],i=e[n%t],a=e[(n+1)%t],s=e[(n+2)%t];return jr((o-n/t)*t,r,i,a,s)}}var ei=e=>()=>e;function Op(e,t){return function(o){return e+o*t}}function Hp(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(n){return Math.pow(e+n*t,o)}}function na(e){return(e=+e)==1?zn:function(t,o){return o-t?Hp(t,o,e):ei(isNaN(t)?o:t)}}function zn(e,t){var o=t-e;return o?Op(e,o):ei(isNaN(e)?t:e)}var Fn=function e(t){var o=na(t);function n(r,i){var a=o((r=oo(r)).r,(i=oo(i)).r),s=o(r.g,i.g),l=o(r.b,i.b),d=zn(r.opacity,i.opacity);return function(c){return r.r=a(c),r.g=s(c),r.b=l(c),r.opacity=d(c),r+""}}return n.gamma=e,n}(1);function ra(e){return function(t){var o=t.length,n=new Array(o),r=new Array(o),i=new Array(o),a,s;for(a=0;a<o;++a)s=oo(t[a]),n[a]=s.r||0,r[a]=s.g||0,i[a]=s.b||0;return n=e(n),r=e(r),i=e(i),s.opacity=1,function(l){return s.r=n(l),s.g=r(l),s.b=i(l),s+""}}}var Gp=ra(ta),Bp=ra(oa);function Pe(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var oi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ti=new RegExp(oi.source,"g");function zp(e){return function(){return e}}function Fp(e){return function(t){return e(t)+""}}function ni(e,t){var o=oi.lastIndex=ti.lastIndex=0,n,r,i,a=-1,s=[],l=[];for(e=e+"",t=t+"";(n=oi.exec(e))&&(r=ti.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:Pe(n,r)})),o=ti.lastIndex;return o<t.length&&(i=t.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?Fp(l[0].x):zp(t):(t=l.length,function(d){for(var c=0,p;c<t;++c)s[(p=l[c]).i]=p.x(d);return s.join("")})}var ia=180/Math.PI,Un={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ri(e,t,o,n,r,i){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*o+t*n)&&(o-=e*l,n-=t*l),(s=Math.sqrt(o*o+n*n))&&(o/=s,n/=s,l/=s),e*n<t*o&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*ia,skewX:Math.atan(l)*ia,scaleX:a,scaleY:s}}var Wn;function sa(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Un:ri(t.a,t.b,t.c,t.d,t.e,t.f)}function aa(e){return e==null?Un:(Wn||(Wn=document.createElementNS("http://www.w3.org/2000/svg","g")),Wn.setAttribute("transform",e),(e=Wn.transform.baseVal.consolidate())?(e=e.matrix,ri(e.a,e.b,e.c,e.d,e.e,e.f)):Un)}function la(e,t,o,n){function r(d){return d.length?d.pop()+" ":""}function i(d,c,p,u,f,h){if(d!==p||c!==u){var g=f.push("translate(",null,t,null,o);h.push({i:g-4,x:Pe(d,p)},{i:g-2,x:Pe(c,u)})}else(p||u)&&f.push("translate("+p+t+u+o)}function a(d,c,p,u){d!==c?(d-c>180?c+=360:c-d>180&&(d+=360),u.push({i:p.push(r(p)+"rotate(",null,n)-2,x:Pe(d,c)})):c&&p.push(r(p)+"rotate("+c+n)}function s(d,c,p,u){d!==c?u.push({i:p.push(r(p)+"skewX(",null,n)-2,x:Pe(d,c)}):c&&p.push(r(p)+"skewX("+c+n)}function l(d,c,p,u,f,h){if(d!==p||c!==u){var g=f.push(r(f)+"scale(",null,",",null,")");h.push({i:g-4,x:Pe(d,p)},{i:g-2,x:Pe(c,u)})}else(p!==1||u!==1)&&f.push(r(f)+"scale("+p+","+u+")")}return function(d,c){var p=[],u=[];return d=e(d),c=e(c),i(d.translateX,d.translateY,c.translateX,c.translateY,p,u),a(d.rotate,c.rotate,p,u),s(d.skewX,c.skewX,p,u),l(d.scaleX,d.scaleY,c.scaleX,c.scaleY,p,u),d=c=null,function(f){for(var h=-1,g=u.length,E;++h<g;)p[(E=u[h]).i]=E.x(f);return p.join("")}}}var ii=la(sa,"px, ","px)","deg)"),si=la(aa,", ",")",")");var no=0,Go=0,Ho=0,da=1e3,Yn,Bo,$n=0,At=0,Xn=0,zo=typeof performance=="object"&&performance.now?performance:Date,ua=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Uo(){return At||(ua(Up),At=zo.now()+Xn)}function Up(){At=0}function Fo(){this._call=this._time=this._next=null}Fo.prototype=Kn.prototype={constructor:Fo,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Uo():+o)+(t==null?0:+t),!this._next&&Bo!==this&&(Bo?Bo._next=this:Yn=this,Bo=this),this._call=e,this._time=o,ai()},stop:function(){this._call&&(this._call=null,this._time=1/0,ai())}};function Kn(e,t,o){var n=new Fo;return n.restart(e,t,o),n}function pa(){Uo(),++no;for(var e=Yn,t;e;)(t=At-e._time)>=0&&e._call.call(void 0,t),e=e._next;--no}function ca(){At=($n=zo.now())+Xn,no=Go=0;try{pa()}finally{no=0,Yp(),At=0}}function Wp(){var e=zo.now(),t=e-$n;t>da&&(Xn-=t,$n=e)}function Yp(){for(var e,t=Yn,o,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Yn=o);Bo=e,ai(n)}function ai(e){if(!no){Go&&(Go=clearTimeout(Go));var t=e-At;t>24?(e<1/0&&(Go=setTimeout(ca,e-zo.now()-Xn)),Ho&&(Ho=clearInterval(Ho))):(Ho||($n=zo.now(),Ho=setInterval(Wp,da)),no=1,ua(ca))}}function qn(e,t,o){var n=new Fo;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var $p=Xr("start","end","cancel","interrupt"),Xp=[],ga=0,fa=1,Jn=2,Zn=3,ma=4,Qn=5,Wo=6;function dt(e,t,o,n,r,i){var a=e.__transition;if(!a)e.__transition={};else if(o in a)return;Kp(e,o,{name:t,index:n,group:r,on:$p,tween:Xp,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ga})}function Yo(e,t){var o=te(e,t);if(o.state>ga)throw new Error("too late; already scheduled");return o}function se(e,t){var o=te(e,t);if(o.state>Zn)throw new Error("too late; already running");return o}function te(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function Kp(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=Kn(i,0,o.time);function i(d){o.state=fa,o.timer.restart(a,o.delay,o.time),o.delay<=d&&a(d-o.delay)}function a(d){var c,p,u,f;if(o.state!==fa)return l();for(c in n)if(f=n[c],f.name===o.name){if(f.state===Zn)return qn(a);f.state===ma?(f.state=Wo,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete n[c]):+c<t&&(f.state=Wo,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete n[c])}if(qn(function(){o.state===Zn&&(o.state=ma,o.timer.restart(s,o.delay,o.time),s(d))}),o.state=Jn,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Jn){for(o.state=Zn,r=new Array(u=o.tween.length),c=0,p=-1;c<u;++c)(f=o.tween[c].value.call(e,e.__data__,o.index,o.group))&&(r[++p]=f);r.length=p+1}}function s(d){for(var c=d<o.duration?o.ease.call(null,d/o.duration):(o.timer.restart(l),o.state=Qn,1),p=-1,u=r.length;++p<u;)r[p].call(e,c);o.state===Qn&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=Wo,o.timer.stop(),delete n[t];for(var d in n)return;delete e.__transition}}function li(e,t){var o=e.__transition,n,r,i=!0,a;if(o){t=t==null?null:t+"";for(a in o){if((n=o[a]).name!==t){i=!1;continue}r=n.state>Jn&&n.state<Qn,n.state=Wo,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[a]}i&&delete e.__transition}}function ha(e){return this.each(function(){li(this,e)})}function qp(e,t){var o,n;return function(){var r=se(this,e),i=r.tween;if(i!==o){n=o=i;for(var a=0,s=n.length;a<s;++a)if(n[a].name===t){n=n.slice(),n.splice(a,1);break}}r.tween=n}}function Zp(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=se(this,e),a=i.tween;if(a!==n){r=(n=a).slice();for(var s={name:t,value:o},l=0,d=r.length;l<d;++l)if(r[l].name===t){r[l]=s;break}l===d&&r.push(s)}i.tween=r}}function ya(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=te(this.node(),o).tween,r=0,i=n.length,a;r<i;++r)if((a=n[r]).name===e)return a.value;return null}return this.each((t==null?qp:Zp)(o,e,t))}function ro(e,t,o){var n=e._id;return e.each(function(){var r=se(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return te(r,n).value[t]}}function jn(e,t){var o;return(typeof t=="number"?Pe:t instanceof ct?Fn:(o=ct(t))?(t=o,Fn):ni)(e,t)}function Jp(e){return function(){this.removeAttribute(e)}}function Qp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function jp(e,t,o){var n,r=o+"",i;return function(){var a=this.getAttribute(e);return a===r?null:a===n?i:i=t(n=a,o)}}function ef(e,t,o){var n,r=o+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===r?null:a===n?i:i=t(n=a,o)}}function tf(e,t,o){var n,r,i;return function(){var a,s=o(this),l;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),l=s+"",a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s)))}}function of(e,t,o){var n,r,i;return function(){var a,s=o(this),l;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),l=s+"",a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s)))}}function xa(e,t){var o=Xe(e),n=o==="transform"?si:jn;return this.attrTween(e,typeof t=="function"?(o.local?of:tf)(o,n,ro(this,"attr."+e,t)):t==null?(o.local?Qp:Jp)(o):(o.local?ef:jp)(o,n,t))}function nf(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function rf(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function sf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&rf(e,i)),o}return r._value=t,r}function af(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&nf(e,i)),o}return r._value=t,r}function Ea(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var n=Xe(e);return this.tween(o,(n.local?sf:af)(n,t))}function lf(e,t){return function(){Yo(this,e).delay=+t.apply(this,arguments)}}function cf(e,t){return t=+t,function(){Yo(this,e).delay=t}}function _a(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?lf:cf)(t,e)):te(this.node(),t).delay}function df(e,t){return function(){se(this,e).duration=+t.apply(this,arguments)}}function uf(e,t){return t=+t,function(){se(this,e).duration=t}}function ba(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?df:uf)(t,e)):te(this.node(),t).duration}function pf(e,t){if(typeof t!="function")throw new Error;return function(){se(this,e).ease=t}}function Ta(e){var t=this._id;return arguments.length?this.each(pf(t,e)):te(this.node(),t).ease}function ff(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;se(this,e).ease=o}}function va(e){if(typeof e!="function")throw new Error;return this.each(ff(this._id,e))}function Na(e){typeof e!="function"&&(e=ko(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],a=i.length,s=n[r]=[],l,d=0;d<a;++d)(l=i[d])&&e.call(l,l.__data__,d,i)&&s.push(l);return new me(n,this._parents,this._name,this._id)}function wa(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,n=t.length,r=o.length,i=Math.min(n,r),a=new Array(n),s=0;s<i;++s)for(var l=t[s],d=o[s],c=l.length,p=a[s]=new Array(c),u,f=0;f<c;++f)(u=l[f]||d[f])&&(p[f]=u);for(;s<n;++s)a[s]=t[s];return new me(a,this._parents,this._name,this._id)}function mf(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function gf(e,t,o){var n,r,i=mf(t)?Yo:se;return function(){var a=i(this,e),s=a.on;s!==n&&(r=(n=s).copy()).on(t,o),a.on=r}}function Aa(e,t){var o=this._id;return arguments.length<2?te(this.node(),o).on.on(e):this.each(gf(o,e,t))}function hf(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Ca(){return this.on("end.remove",hf(this._id))}function Ia(e){var t=this._name,o=this._id;typeof e!="function"&&(e=vt(e));for(var n=this._groups,r=n.length,i=new Array(r),a=0;a<r;++a)for(var s=n[a],l=s.length,d=i[a]=new Array(l),c,p,u=0;u<l;++u)(c=s[u])&&(p=e.call(c,c.__data__,u,s))&&("__data__"in c&&(p.__data__=c.__data__),d[u]=p,dt(d[u],t,o,u,d,te(c,o)));return new me(i,this._parents,t,o)}function Sa(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Lo(e));for(var n=this._groups,r=n.length,i=[],a=[],s=0;s<r;++s)for(var l=n[s],d=l.length,c,p=0;p<d;++p)if(c=l[p]){for(var u=e.call(c,c.__data__,p,l),f,h=te(c,o),g=0,E=u.length;g<E;++g)(f=u[g])&&dt(f,t,o,g,u,h);i.push(u),a.push(c)}return new me(i,a,t,o)}var yf=Ke.prototype.constructor;function Ma(){return new yf(this._groups,this._parents)}function xf(e,t){var o,n,r;return function(){var i=lt(this,e),a=(this.style.removeProperty(e),lt(this,e));return i===a?null:i===o&&a===n?r:r=t(o=i,n=a)}}function Pa(e){return function(){this.style.removeProperty(e)}}function Ef(e,t,o){var n,r=o+"",i;return function(){var a=lt(this,e);return a===r?null:a===n?i:i=t(n=a,o)}}function _f(e,t,o){var n,r,i;return function(){var a=lt(this,e),s=o(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(e),lt(this,e))),a===l?null:a===n&&l===r?i:(r=l,i=t(n=a,s))}}function bf(e,t){var o,n,r,i="style."+t,a="end."+i,s;return function(){var l=se(this,e),d=l.on,c=l.value[i]==null?s||(s=Pa(t)):void 0;(d!==o||r!==c)&&(n=(o=d).copy()).on(a,r=c),l.on=n}}function La(e,t,o){var n=(e+="")=="transform"?ii:jn;return t==null?this.styleTween(e,xf(e,n)).on("end.style."+e,Pa(e)):typeof t=="function"?this.styleTween(e,_f(e,n,ro(this,"style."+e,t))).each(bf(this._id,e)):this.styleTween(e,Ef(e,n,t),o).on("end.style."+e,null)}function Tf(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function vf(e,t,o){var n,r;function i(){var a=t.apply(this,arguments);return a!==r&&(n=(r=a)&&Tf(e,a,o)),n}return i._value=t,i}function ka(e,t,o){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,vf(e,t,o==null?"":o))}function Nf(e){return function(){this.textContent=e}}function wf(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function Da(e){return this.tween("text",typeof e=="function"?wf(ro(this,"text",e)):Nf(e==null?"":e+""))}function Af(e){return function(t){this.textContent=e.call(this,t)}}function Cf(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&Af(r)),t}return n._value=e,n}function Ra(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Cf(e))}function Va(){for(var e=this._name,t=this._id,o=er(),n=this._groups,r=n.length,i=0;i<r;++i)for(var a=n[i],s=a.length,l,d=0;d<s;++d)if(l=a[d]){var c=te(l,t);dt(l,e,o,d,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new me(n,this._parents,e,o)}function Oa(){var e,t,o=this,n=o._id,r=o.size();return new Promise(function(i,a){var s={value:a},l={value:function(){--r===0&&i()}};o.each(function(){var d=se(this,n),c=d.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),d.on=t}),r===0&&i()})}var If=0;function me(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function Ha(e){return Ke().transition(e)}function er(){return++If}var qe=Ke.prototype;me.prototype=Ha.prototype={constructor:me,select:Ia,selectAll:Sa,selectChild:qe.selectChild,selectChildren:qe.selectChildren,filter:Na,merge:wa,selection:Ma,transition:Va,call:qe.call,nodes:qe.nodes,node:qe.node,size:qe.size,empty:qe.empty,each:qe.each,on:Aa,attr:xa,attrTween:Ea,style:La,styleTween:ka,text:Da,textTween:Ra,remove:Ca,tween:ya,delay:_a,duration:ba,ease:Ta,easeVarying:va,end:Oa,[Symbol.iterator]:qe[Symbol.iterator]};function tr(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Sf={time:null,delay:0,duration:250,ease:tr};function Mf(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function Ga(e){var t,o;e instanceof me?(t=e._id,e=e._name):(t=er(),(o=Sf).time=Uo(),e=e==null?null:e+"");for(var n=this._groups,r=n.length,i=0;i<r;++i)for(var a=n[i],s=a.length,l,d=0;d<s;++d)(l=a[d])&&dt(l,e,t,d,a,o||Mf(l,t));return new me(n,this._parents,e,t)}Ke.prototype.interrupt=ha;Ke.prototype.transition=Ga;function ut(e,t,o){this.k=e,this.x=t,this.y=o}ut.prototype={constructor:ut,scale:function(e){return e===1?this:new ut(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ut(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var or=new ut(1,0,0);nr.prototype=ut.prototype;function nr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return or;return e.__zoom}var Lf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var Ba;(function(e){e.Strict="strict",e.Loose="loose"})(Ba||(Ba={}));var za;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(za||(za={}));var Fa;(function(e){e.Partial="partial",e.Full="full"})(Fa||(Fa={}));var Ua;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ua||(Ua={}));var Wa;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Wa||(Wa={}));var Ee;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ee||(Ee={}));var Xx={[Ee.Left]:Ee.Right,[Ee.Right]:Ee.Left,[Ee.Top]:Ee.Bottom,[Ee.Bottom]:Ee.Top};var kf=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Df=(e,t=[0,0])=>{var s;let{width:o,height:n}=Rf(e),r=(s=e.origin)!=null?s:t,i=o*r[0],a=n*r[1];return{x:e.position.x-i,y:e.position.y-a}};var Te=(e,t=[0,0])=>{var r,i,a,s,l,d,c,p;let{x:o,y:n}=kf(e)?e.internals.positionAbsolute:Df(e,t);return{x:o,y:n,x2:o+((s=(a=(i=(r=e.measured)==null?void 0:r.width)!=null?i:e.width)!=null?a:e.initialWidth)!=null?s:0),y2:n+((p=(c=(d=(l=e.measured)==null?void 0:l.height)!=null?d:e.height)!=null?c:e.initialHeight)!=null?p:0)}};function Rf(e){var t,o,n,r,i,a,s,l;return{width:(r=(n=(o=(t=e.measured)==null?void 0:t.width)!=null?o:e.width)!=null?n:e.initialWidth)!=null?r:0,height:(l=(s=(a=(i=e.measured)==null?void 0:i.height)!=null?a:e.height)!=null?s:e.initialHeight)!=null?l:0}}var Kx={[Ee.Left]:{x:-1,y:0},[Ee.Right]:{x:1,y:0},[Ee.Top]:{x:0,y:-1},[Ee.Bottom]:{x:0,y:1}};var Vf={nodeOrigin:[0,0],nodeExtent:Lf,elevateNodesOnSelect:!0,defaults:{}},qx=v(x({},Vf),{checkEquality:!0});var Ya;(function(e){e.Line="line",e.Handle="handle"})(Ya||(Ya={}));var Of={width:0,height:0,x:0,y:0},Zx=v(x({},Of),{pointerX:0,pointerY:0,aspectRatio:1});var ve=require("react"),qa=require("zustand/shallow");var rr=10,Ct={top:{orientation:"horizontal",resolve:(e,t)=>t.y},bottom:{orientation:"horizontal",resolve:(e,t)=>t.y2},left:{orientation:"vertical",resolve:(e,t)=>t.x},right:{orientation:"vertical",resolve:(e,t)=>t.x2},centerX:{orientation:"vertical",resolve:(e,t)=>(t.x+t.x2)/2},centerY:{orientation:"horizontal",resolve:(e,t)=>(t.y+t.y2)/2}};var Hf=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function Gf(e,t){let o=Math.max(0,Math.min(e.x2,t.x2)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y2,t.y2)-Math.max(e.y,t.y));return o*n}function Bf(e,t){let o=Math.max(0,Math.max(e.x-t.x2,t.x-e.x2)),n=Math.max(0,Math.max(e.y-t.y2,t.y-e.y2));return Math.sqrt(o*o+n*n)}var ir=class{constructor(){this.xLines=[];this.yLines=[]}initialize(t){this.xLines=t.filter(o=>o.orientation==="vertical"),this.yLines=t.filter(o=>o.orientation==="horizontal"),this.xLines.sort((o,n)=>o.position-n.position),this.yLines.sort((o,n)=>o.position-n.position),this.lastHorizontalLine=void 0,this.lastVerticalLine=void 0}search(t,o,n,r){let i=t==="horizontal"?this.yLines:this.xLines,[a,s]=t==="horizontal"?[r.y,r.y2]:[r.x,r.x2],l=[];for(let u of i){if(u.position<a)continue;if(u.position>s)break;if(u.node.id===n.id||u.node.parentId===n.id||!Hf(u.nodeBox,r))continue;let f=Math.abs(u.position-o);if(f>rr)continue;let g=Gf(u.nodeBox,Te(n))>0?0:Bf(u.nodeBox,Te(n));l.push({line:u,lineDist:f,nodeDist:g})}let d=.5,c=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;l.sort((u,f)=>{if(c){if(u.line===c&&f.line!==c)return-1;if(f.line===c&&u.line!==c)return 1}return Math.abs(u.lineDist-f.lineDist)<=d?u.nodeDist-f.nodeDist:u.lineDist-f.lineDist});let p=l.length>0?l[0].line:void 0;return p&&(t==="horizontal"?this.lastHorizontalLine=p:this.lastVerticalLine=p),p}};function $a(e,t=Ct,o){let n=[];return e==null||e.forEach(r=>{let i=o(r.id);if(!i)throw new Error(`Node with id ${r.id} not found in internal nodes.`);let a=Te(i);Object.entries(t).forEach(([s,l])=>{var d;n.push({nodeBox:a,node:r,orientation:l.orientation,position:l.resolve(r,a),color:(d=r.style)==null?void 0:d.backgroundColor,anchorName:s})})}),n}function Xa(e,t,o,n,r=Object.keys(Ct)){let i=[];for(let s of r){let l=Ct[s],d=l.resolve(o,n),c=e.search(l.orientation,d,o,t);c&&i.push({anchorName:s,sourcePosition:d,anchor:l,line:c})}let a={horizontal:void 0,vertical:void 0};for(let s of i){let l=a[s.anchor.orientation],d=Math.abs(s.sourcePosition-s.line.position);(!l||d<Math.abs(l.sourcePosition-l.line.position))&&(a[s.anchor.orientation]=s)}return a}function Ka(e,t,o,n,r,i,a,s){var p,u,f,h,g,E,C,T;if(!(o!=null&&o.position))return{snappedX:!1,snappedY:!1};let l=!1,d=!1,c={x:o.position.x,y:o.position.y,x2:o.position.x+((u=(p=e.measured)==null?void 0:p.width)!=null?u:0),y2:o.position.y+((h=(f=e.measured)==null?void 0:f.height)!=null?h:0)};if(a){let m=a.anchor.resolve(e,c)-a.line.position;if(Math.abs(m)<=rr){if(o.position.y-=m,r!=null&&r.dimensions)if(n){let y=t.internals.positionAbsolute.y+((E=(g=e.measured)==null?void 0:g.height)!=null?E:0);r.dimensions.height=y-a.line.position}else r.dimensions.height=a.line.position-t.internals.positionAbsolute.y;d=!0}}if(s){let m=s.anchor.resolve(e,c)-s.line.position;if(Math.abs(m)<=rr){if(o.position.x-=m,r!=null&&r.dimensions)if(n){let y=t.internals.positionAbsolute.x+((T=(C=e.measured)==null?void 0:C.width)!=null?T:0);r.dimensions.width=y-s.line.position}else r.dimensions.width=s.line.position-t.internals.positionAbsolute.x;l=!0}}return i&&(l||d)&&(o.position.x-=i.position.x,o.position.y-=i.position.y),{snappedX:l,snappedY:d}}var Za=require("react/jsx-runtime"),zf=new ir;function so(){let[e,t]=(0,ve.useState)(void 0),[o,n]=(0,ve.useState)(void 0),{width:r,height:i}=(0,io.useStore)(E=>({width:E.width,height:E.height}),qa.shallow),a=(0,io.useNodesInitialized)(),s=(0,ve.useRef)(zf),{screenToFlowPosition:l,getInternalNode:d,getNodes:c}=(0,io.useReactFlow)(),p=(0,ve.useCallback)(()=>{t(void 0),n(void 0)},[]),u=(0,ve.useCallback)(E=>{let C=E!=null?E:c();p();let T=$a(C,Ct,d);s.current.initialize(T)},[d,p,c]),f=(0,ve.useCallback)(()=>{setTimeout(()=>{u()},100)},[u]);(0,ve.useEffect)(()=>{a&&u(c())},[a,u,c]);let h=(0,ve.useCallback)((E,C)=>{var B,Y,$,Ie,le;if(!s.current||E.length===0||E.length>2)return E;p();let T,b,m=Object.keys(Ct);E.length===1?E[0].type==="position"?T=E[0]:E[0].type==="dimensions"&&(b=E[0],m=["right","bottom"]):E[0].type==="position"&&E[1].type==="dimensions"&&E[1].dimensions&&(T=E[0],b=E[1],m=["top","left"]);let y=C.find(ot=>ot.id===E[0].id);if(!y)return E;let w=d(y.id);if(!w)throw new Error(`Node with id ${y.id} not found in internal nodes`);let _=d((B=w.parentId)!=null?B:""),A=Te(w);b!=null&&b.dimensions&&(A.x2=A.x+b.dimensions.width,A.y2=A.y+b.dimensions.height);let{x:P,y:N}=l({x:0,y:0}),{x:M,y:I}=l({x:r,y:i}),S={x:P,y:N,x2:M,y2:I},{horizontal:k,vertical:z}=Xa(s.current,S,y,A,m),G={id:y.id,type:"position",position:{x:w.internals.positionAbsolute.x,y:w.internals.positionAbsolute.y},dragging:!1};T!=null&&T.position&&G.position&&(_?(G.position.x=T.position.x+(($=(Y=_==null?void 0:_.position)==null?void 0:Y.x)!=null?$:0),G.position.y=T.position.y+((le=(Ie=_==null?void 0:_.position)==null?void 0:Ie.y)!=null?le:0)):(G.position.x=T.position.x,G.position.y=T.position.y));let{snappedX:J,snappedY:ne}=Ka(y,w,G,T,b,_,k,z);if(J||ne){if((b!=null&&b.resizing||T!=null&&T.dragging)&&(J&&n(z==null?void 0:z.line),ne&&t(k==null?void 0:k.line)),b&&T)return[G,b];if(T)return[G];if(b)return[b]}return E},[l,d,r,i,t,n,p]),g=(0,ve.useCallback)(()=>(0,Za.jsx)(Ja,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:u,forceRebuildIndex:f,updateHelperLines:h,helperLineHorizontal:e,helperLineVertical:o,HelperLines:g}}var gr=require("@xyflow/react"),di=require("react");var Re=require("@xyflow/react");var ao=require("@xyflow/react");function Qa(e,t){var b,m,y,w;let{width:o=0,height:n=0}=e.measured||{width:0,height:0},r=e.internals.positionAbsolute,i=t.internals.positionAbsolute,a=o/2,s=n/2,l=r.x+a,d=r.y+s,c=i.x+((m=(b=t==null?void 0:t.measured)==null?void 0:b.width)!=null?m:0)/2,p=i.y+((w=(y=t==null?void 0:t.measured)==null?void 0:y.height)!=null?w:0)/2,u=(c-l)/(2*a)-(p-d)/(2*s),f=(c-l)/(2*a)+(p-d)/(2*s),h=1/(Math.abs(u)+Math.abs(f)||1),g=h*u,E=h*f,C=a*(g+E)+l,T=s*(-g+E)+d;return{x:C,y:T}}function ja(e,t){var d,c,p,u;let{positionAbsolute:o}=e.internals,n=(c=(d=e.measured)==null?void 0:d.width)!=null?c:0,r=(u=(p=e.measured)==null?void 0:p.height)!=null?u:0,i=Math.round(o.x),a=Math.round(o.y),s=Math.round(t.x),l=Math.round(t.y);return s<=i+1?ao.Position.Left:s>=i+n-1?ao.Position.Right:l<=a+1?ao.Position.Top:l>=a+r-1?ao.Position.Bottom:ao.Position.Top}function pt(e,t){let o=Qa(e,t),n=Qa(t,e),r=ja(e,o),i=ja(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}var Le=require("@xyflow/react"),Be=require("lecom-ui"),el=require("lucide-react");var It=require("react/jsx-runtime"),Xo=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Be.useTranslation)(),{getNode:n,getEdge:r,getNodes:i,getEdges:a}=(0,Le.useReactFlow)(),{onConfigureElement:s}=R(),l=m=>{var y,w,_,A,P;return m?m.type==="TASK"&&((y=m.data)==null?void 0:y.variant)==="SUBPROCESS"?{id:m.id,type:"sub_process",variant:c(m),label:(w=m.data)==null?void 0:w.label}:m.type==="GATEWAY"?{id:m.id,type:"gateway",variant:((_=m.data)==null?void 0:_.variant)||"EXCLUSIVE",label:(A=m.data)==null?void 0:A.label}:{id:m.id,type:"activity",variant:c(m),label:(P=m.data)==null?void 0:P.label}:null},d=m=>{let y=i(),w=a(),_=(0,Le.getIncomers)(m,y,w);if(_.length===0)return;let A=_[0];return l(A)||void 0},c=m=>{let y=i(),w=a(),_=(0,Le.getIncomers)(m,y,w),A=(0,Le.getOutgoers)(m,y,w),P=_.some(M=>M.type==="START_EVENT"),N=A.some(M=>M.type==="END_EVENT");return P?"start":N?"end":"between"},p=m=>{var M,I,S,k;let y=i(),w=a(),_=n(m.source),A=n(m.target);if(!_||!A)return"simple";if((0,Le.getOutgoers)(_,y,w).some(z=>z.type==="END_EVENT"))return"final";if(_.type==="GATEWAY")switch((M=_.data)==null?void 0:M.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(_.type==="TASK"){let z=(I=_.data)==null?void 0:I.variant,G=(S=_.data)==null?void 0:S.attribute;return A.type==="TASK"&&((k=A.data)==null?void 0:k.variant)==="SUBPROCESS"?"to_sub_process":z==="SCRIPT"?"script":G==="LOOP"?"loop":"simple"}return"simple"},u=m=>{var M;let y=n(m.source);if(!y||y.type!=="GATEWAY"||((M=y.data)==null?void 0:M.variant)!=="COMPLEX")return;let w=i(),_=a(),A=(0,Le.getIncomers)(y,w,_),P=!1,N=!1;if(A.forEach(I=>{var S,k;I.type==="TASK"&&(((S=I.data)==null?void 0:S.variant)==="SCRIPT"&&(P=!0),((k=I.data)==null?void 0:k.attribute)==="LOOP"&&(N=!0))}),P&&N)return"script_loop";if(P)return"script";if(N)return"loop"},f=m=>{var M;let y=n(m.source);if(!y||y.type!=="GATEWAY"||((M=y.data)==null?void 0:M.variant)!=="EXCLUSIVE")return;let w=i(),_=a(),A=(0,Le.getIncomers)(y,w,_),P=!1,N=!1;if(A.forEach(I=>{var S,k;I.type==="TASK"&&(((S=I.data)==null?void 0:S.variant)==="SCRIPT"&&(P=!0),((k=I.data)==null?void 0:k.attribute)==="LOOP"&&(N=!0))}),P&&N)return"script_loop";if(P)return"script";if(N)return"loop"},h=m=>{var N,M;if(m.type!=="GATEWAY")return;let y=i(),w=a(),_=(0,Le.getIncomers)(m,y,w),A=!1,P=!1;if(_.forEach(I=>{var S,k;I.type==="TASK"&&(((S=I.data)==null?void 0:S.variant)==="SCRIPT"&&(A=!0),((k=I.data)==null?void 0:k.attribute)==="LOOP"&&(P=!0))}),((N=m.data)==null?void 0:N.variant)==="COMPLEX"){if(A&&P)return"script_loop";if(A)return"script";if(P)return"loop"}else if(((M=m.data)==null?void 0:M.variant)==="EXCLUSIVE"){if(A&&P)return"script_loop";if(A)return"script";if(P)return"loop"}},g=m=>(0,Le.getOutgoers)(m,i(),a()).map(_=>{var A,P;return{id:_.id,type:_.type,variant:(A=_.data)==null?void 0:A.variant,label:(P=_.data)==null?void 0:P.label}}),E=m=>a().filter(_=>_.source===m.id).map(_=>{var A;return{id:_.id,type:"routing",variant:p(_),label:(A=_.data)==null?void 0:A.label,target:n(_.target)}}),C=()=>{var w,_,A,P,N,M;let m=n(e);if(!m)return;let y=d(m);if(m.type==="TASK"&&((w=m.data)==null?void 0:w.variant)==="SUBPROCESS"){s==null||s({id:m.id,type:"sub_process",variant:c(m),label:(_=m.data)==null?void 0:_.label,origin:y,targets:g(m),edgeTargets:E(m)}),console.log({id:m.id,type:"sub_process",variant:c(m),label:(A=m.data)==null?void 0:A.label,origin:y,targets:g(m),edgeTargets:E(m)});return}if(m.type!=="GATEWAY"){s==null||s({id:m.id,type:"activity",variant:c(m),label:(P=m.data)==null?void 0:P.label,origin:y,targets:g(m),edgeTargets:E(m)});return}s==null||s({id:m.id,type:"gateway",variant:((N=m.data)==null?void 0:N.variant)||"EXCLUSIVE",label:(M=m.data)==null?void 0:M.label,origin:y,subVariant:h(m),targets:g(m)})},T=()=>{let m=r(e);if(m){let y=p(m),w;y==="complex"?w=u(m):y==="exclusive"&&(w=f(m));let _=n(m.source),A=_&&l(_)||void 0;s==null||s({id:m.id,type:"routing",variant:y,subVariant:w,origin:A,target:n(m.target)}),console.log({id:m.id,type:"routing",variant:y,subVariant:w,origin:A,target:n(m.target)})}};return(0,It.jsxs)(Be.Tooltip,{children:[(0,It.jsx)(Be.TooltipTrigger,{asChild:!0,children:(0,It.jsx)(Be.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{switch(t){case"node":C();break;case"edge":T();break}},children:(0,It.jsx)(el.Settings,{size:16})})}),(0,It.jsx)(Be.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var tl=require("@xyflow/react"),ze=require("lecom-ui"),ol=require("lucide-react"),St=require("react/jsx-runtime"),sr=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,ze.useTranslation)(),{deleteElements:n}=(0,tl.useReactFlow)();return(0,St.jsxs)(ze.Tooltip,{children:[(0,St.jsx)(ze.TooltipTrigger,{asChild:!0,children:(0,St.jsx)(ze.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,St.jsx)(ol.TrashIcon,{size:16})})}),(0,St.jsx)(ze.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var Fe=require("lecom-ui"),nl=require("lucide-react"),rl=require("react"),Mt=require("react/jsx-runtime"),Ko=({nodeId:e})=>{let{t}=(0,Fe.useTranslation)(),o=(0,rl.useCallback)(n=>{n.stopPropagation();let r=document.querySelector(`[data-id="${e}"]`);if(!r)return;let i=r.querySelector(".react-flow__handle.source");if(!i)return;let a=i.getBoundingClientRect(),s=a.left+a.width/2,l=a.top+a.height/2,d=new MouseEvent("mousedown",{clientX:s,clientY:l,bubbles:!0,cancelable:!0});i.dispatchEvent(d)},[e]);return(0,Mt.jsxs)(Fe.Tooltip,{children:[(0,Mt.jsx)(Fe.TooltipTrigger,{asChild:!0,children:(0,Mt.jsx)(Fe.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onMouseDown:o,children:(0,Mt.jsx)(nl.MoveUpRightIcon,{size:16})})}),(0,Mt.jsx)(Fe.TooltipContent,{color:"black",children:t("editor.toolbar.connect_node")})]})};var qo=require("react/jsx-runtime"),lo=i=>{var a=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=a,r=He(a,["edgeId","edgeType","sourceNode","targetNode"]);var c;let s=(o==null?void 0:o.type)!=="START_EVENT"&&(n==null?void 0:n.type)!=="END_EVENT",l=[{component:(0,qo.jsx)(sr,{elementId:e,elementType:"edge"})}],d={SEQUENCE_EDGE:[...s?[{component:(0,qo.jsx)(Xo,{elementId:e,elementType:"edge"})}]:[],...l],MESSAGE_EDGE:[...l],ANNOTATION_EDGE:[...l]};return(0,qo.jsx)("div",v(x({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:(c=d[t])==null?void 0:c.map((p,u)=>(0,qo.jsx)("div",{children:p.component},u))}))};var Pt=require("react/jsx-runtime"),co={type:"ANNOTATION_EDGE",reconnectable:!0},il=({id:e,source:t,target:o,selected:n,data:r})=>{let{zoom:i}=(0,Re.useViewport)(),{isMultipleSelection:a}=R(),s=(0,Re.useInternalNode)(t),l=(0,Re.useInternalNode)(o);if(!s||!l)return null;let{sx:d,sy:c,tx:p,ty:u}=pt(s,l),[f,h,g]=(0,Re.getStraightPath)({sourceX:d,sourceY:c,targetX:p,targetY:u}),E=n||(s==null?void 0:s.selected)||(l==null?void 0:l.selected),C=1/i;return(0,Pt.jsxs)("g",{className:L("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":E}),children:[(0,Pt.jsx)(Re.BaseEdge,{id:e,path:f,strokeDasharray:4,className:L("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":r==null?void 0:r.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":E&&!(r!=null&&r.hasError)})}),(0,Pt.jsx)(Re.EdgeLabelRenderer,{children:(0,Pt.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${g}px)`},children:n&&!a&&(0,Pt.jsx)(lo,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${C})`}})})})]})};var de=require("@xyflow/react"),sl=require("react");var Lt=require("react");var ci=require("react/jsx-runtime"),ce=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:a,onBlur:s})=>{let l=(0,Lt.useRef)(null),[d,c]=(0,Lt.useState)(!1);(0,Lt.useEffect)(()=>{c(i!=null?i:!1)},[i]),(0,Lt.useEffect)(()=>{if(d&&l.current){l.current.focus();let g=document.createRange();g.selectNodeContents(l.current);let E=window.getSelection();E&&(E.removeAllRanges(),E.addRange(g))}},[d]);let p=g=>{g.stopPropagation(),d||c(!0)},u=g=>{let E=g.currentTarget.innerText.trim(),C=t&&E.length>=t,T=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],b=g.ctrlKey||g.metaKey,m=b&&g.key==="a",y=b&&g.key==="c",w=b&&g.key==="x",_=b&&g.key==="v";function A(N){return/\w/.test(N)}if(E.length===0&&!A(g.key)&&!T.includes(g.key)&&!b){g.preventDefault();return}C&&(T.includes(g.key)||m||y||w||_||g.preventDefault())},f=g=>{if(!t)return;g.preventDefault();let E=g.clipboardData.getData("text/plain"),C=g.currentTarget.innerText,T=window.getSelection();if(!T||T.rangeCount===0)return;let b=T.getRangeAt(0);if((C.substring(0,b.startOffset)+E+C.substring(b.endOffset)).length>t){let y=t-(C.length-(b.endOffset-b.startOffset)),w=E.substring(0,Math.max(0,y));w&&(b.deleteContents(),b.insertNode(document.createTextNode(w)),b.setStartAfter(b.endContainer),b.collapse(!0),T.removeAllRanges(),T.addRange(b))}else b.deleteContents(),b.insertNode(document.createTextNode(E)),b.setStartAfter(b.endContainer),b.collapse(!0),T.removeAllRanges(),T.addRange(b)},h=g=>{c(!1);let E=g.currentTarget.innerText.trim();t&&E.length>t&&(E=E.substring(0,t)),g.currentTarget.innerText=E,s==null||s(),E!==e&&(a==null||a(E))};return(0,ci.jsx)("div",{className:L("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",n,{"border border-dashed border-grey-400":d}),style:o,onDoubleClick:p,children:(0,ci.jsx)("div",{ref:l,className:L("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":d}),contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:u,onPaste:f,onBlur:h,children:e})})};var mt=require("react/jsx-runtime"),Ne={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:de.MarkerType.ArrowClosed},markerEnd:{type:de.MarkerType.Arrow},data:{label:""}},al=({id:e,source:t,target:o,data:n,selected:r})=>{let{zoom:i}=(0,de.useViewport)(),{updateEdgeData:a}=(0,de.useReactFlow)(),{isMultipleSelection:s}=R(),[l,d]=(0,sl.useState)(!1),c=(0,de.useInternalNode)(t),p=(0,de.useInternalNode)(o);if(!c||!p)return null;let{sx:u,sy:f,tx:h,ty:g,sourcePos:E,targetPos:C}=pt(c,p),[T,b,m]=(0,de.getSmoothStepPath)({sourceX:u,sourceY:f,targetX:h,targetY:g,sourcePosition:E,targetPosition:C}),y=r||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),w=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",_=l||(n==null?void 0:n.label.trim().length)>0,A=1/i,P=()=>{d(!0)},N=()=>{d(!1)},M=I=>{a(e,{label:I.trim()})};return(0,mt.jsxs)("g",{className:L("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:N,onDoubleClick:P,children:[(0,mt.jsx)(de.BaseEdge,{id:e,path:T,markerEnd:`url(#${w})`,className:L("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":n==null?void 0:n.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(n!=null&&n.hasError)})}),(0,mt.jsx)(de.EdgeLabelRenderer,{children:(0,mt.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${b}px, ${m}px)`},children:[r&&!s&&(0,mt.jsx)(lo,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:c,targetNode:p,style:{transform:`scale(${A})`}}),_&&(0,mt.jsx)(ce,{value:n==null?void 0:n.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:l,onChange:M})]})})]})};var Jo=e=>new Map(e.map(t=>[t.id,t])),ar=e=>e.some(t=>t.type==="START_EVENT"),ll=(e,t,o,n)=>{let r=Jo(o),i=r.get(e);if(!i||i.type!=="START_EVENT")return!1;let a=r.get(t);return(a==null?void 0:a.type)==="ANNOTATION"?!1:n.filter(l=>{if(l.source!==e)return!1;let d=r.get(l.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=1},lr=(e,t,o)=>{var i;let n=t.find(a=>a.id===e);return!n||n.type!=="GATEWAY"||((i=n.data)==null?void 0:i.variant)!=="EXCLUSIVE"?!1:o.filter(a=>a.source===e).length>=2},cl=(e,t,o)=>{var a,s,l,d;let n=Jo(o),r=n.get(e),i=n.get(t);return(r==null?void 0:r.type)!=="GATEWAY"||(i==null?void 0:i.type)!=="GATEWAY"||((a=r==null?void 0:r.data)==null?void 0:a.variant)==="EXCLUSIVE"&&((s=i==null?void 0:i.data)==null?void 0:s.variant)==="PARALLEL"||((l=r==null?void 0:r.data)==null?void 0:l.variant)==="COMPLEX"&&((d=i==null?void 0:i.data)==null?void 0:d.variant)==="PARALLEL"},cr=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.variant)==="SCRIPT"},dr=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.attribute)==="LOOP"},ur=(e,t,o)=>{let n=Jo(t),r=n.get(e);return!r||r.type!=="TASK"?!1:o.filter(a=>a.target===e).some(a=>{let s=n.get(a.source);return(s==null?void 0:s.type)==="START_EVENT"})},pr=(e,t,o)=>{let n=Jo(t),r=n.get(e);return!r||r.type!=="TASK"?!1:o.filter(a=>a.source===e).some(a=>{let s=n.get(a.target);return(s==null?void 0:s.type)==="END_EVENT"})},fr=(e,t)=>t.filter(n=>n.source===e).length>0,mr=(e,t,o,n)=>{let r=Jo(o),i=r.get(e);if(!i||i.type!=="TASK")return!1;let a=t?r.get(t):null;return(a==null?void 0:a.type)==="ANNOTATION"?!1:n.filter(l=>{if(l.source!==e)return!1;let d=r.get(l.target);return(d==null?void 0:d.type)!=="ANNOTATION"}).length>=2};var Ff=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!ll(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"start_event_limit_reached"}),e=>({isValid:!lr(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"}),e=>({isValid:!mr(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"task_limit_reached"}),e=>({isValid:cl(e.sourceNodeId,e.targetNodeId,e.nodes),reason:"gateway_to_gateway_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="END_EVENT"),reason:"start_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="END_EVENT"),reason:"gateway_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="GATEWAY"),reason:"start_to_gateway_not_allowed"}),e=>({isValid:!(cr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(dr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(ur(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!(pr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(fr(e.sourceNodeId,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"activity_has_outgoing_connections"}),e=>({isValid:({START_EVENT:["TASK","ANNOTATION"],END_EVENT:["ANNOTATION"],TASK:["TASK","END_EVENT","GATEWAY","ANNOTATION"],GATEWAY:["TASK","END_EVENT","ANNOTATION","GATEWAY"],LANE:["ANNOTATION"],ANNOTATION:[],UNSUPPORTED:[]}[e.sourceNodeType]||[]).includes(e.targetNodeType),reason:"connection_type_not_allowed"})],dl=e=>{for(let t of Ff){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var Uf=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:lr(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:ar(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:cr(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:dr(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:ur(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:pr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:fr(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:mr(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],ul=e=>{let t=Uf.filter(o=>{let n=!o.sourceTypes||o.sourceTypes.includes(e.sourceNodeType),r=!o.targetTypes||o.targetTypes.includes(e.targetNodeType);return n&&r});for(let o of t){let n=o.validate(e);if(n.shouldDisable)return n}return{shouldDisable:!1}};var pl=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,gr.useReactFlow)(),r=(0,di.useCallback)(a=>{let s=t(a.source),l=t(a.target);if(!s||!l)return!1;let d={sourceNodeId:s.id,targetNodeId:l.id,sourceNodeType:s.type,targetNodeType:l.type,nodes:n(),edges:o()};return dl(d).isValid},[t,o,n]),i=(0,di.useCallback)(a=>{e(s=>{let l=t(a.target),d=(l==null?void 0:l.type)==="ANNOTATION"?co:Ne;return(0,gr.addEdge)(x(x({},a),d),s)})},[t,e]);return{isValidConnection:r,onConnect:i}};var ui=require("react"),bl=require("lecom-ui"),Tl=require("@xyflow/react");var Qo=(e=[])=>e.filter(t=>t.type==="START_EVENT"),kt=(e=[])=>e.filter(t=>t.type==="END_EVENT"),gt=(e=[])=>e.filter(t=>t.type==="TASK")||[],fl=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),ml=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),hr=(e=[])=>e.filter(t=>t.type==="GATEWAY"),gl=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),we=(e,t=[])=>t.filter(o=>o.source===e),jo=(e,t=[])=>t.filter(o=>o.target===e),hl=(e,t)=>{var n,r;let o=(n=t.nodes)==null?void 0:n.find(i=>i.id===e);return((r=o==null?void 0:o.properties)==null?void 0:r.attribute)==="LOOP"},yl=(e,t)=>{let o=we(e,t.edges||[]);for(let n of o){let r=(t.nodes||[]).find(i=>i.id===n.target);if(r&&r.type==="END_EVENT")return!0}return!1},xl=e=>e?/\w/g.test(e.trim()):!1,F=e=>{let{isValid:t,nodeIds:o,edgeIds:n}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&n&&n.length>0?n:[]}},Ue=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(n=>!t(n));return{isValid:o.length===0,invalidIds:o.map(n=>n.id)}},El=(e=[],t=[])=>({nodes:e.map(o=>{var n;return{id:o.id,type:o.type||"",label:typeof((n=o.data)==null?void 0:n.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 en=[{id:"start_event_not_found",validate:e=>{let t=Qo(e.nodes);return F({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=kt(e.nodes);return F({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=Qo(e.nodes),o=t.length===1;if(t.length===0)return F({isValid:!0});if(!o)return F({isValid:!1,nodeIds:t.map(i=>i.id)});let n=we(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(a=>a.id),...n.map(a=>a.target)];return F({isValid:!1,nodeIds:[...new Set(i)]})}return F({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=gt(e.nodes),o=Ue(t,n=>we(n.id,e.edges).length<=2);return F({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=gt(e.nodes),o=Ue(t,n=>!!n.label&&n.label.trim()!=="");return F({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=gt(e.nodes),n=Ue(o,r=>!r.label||r.label.length<=60);return F({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=gt(e.nodes),o=new Map;for(let r of t){if(!r.label)continue;let i=r.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(r))}let n=[];for(let[,r]of o.entries())r.length>1&&r.forEach(i=>n.push(i.id));return F({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=hr(e.nodes),o=[],n=[];for(let r of t){let i=we(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return F({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...Qo(e.nodes),...kt(e.nodes)],o=[],n=[];for(let r of t){let i=we(r.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(r.id,s.id),n.push(a.id))}}return F({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=kt(e.nodes),o=[],n=[];for(let r of t){let i=jo(r.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=we(s.id,e.edges);l.length>1&&(o.push(s.id),l.forEach(d=>n.push(d.id)))}}}return F({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=gl(e.nodes),o=Ue(t,r=>we(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>we(r,e.edges).map(i=>i.id));return F({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=gt(e.nodes),o=Ue(t,n=>!n.label||xl(n.label));return F({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 F({isValid:!0});let t=kt(e.nodes)[0];if(!t)return F({isValid:!0});let o=jo(t.id,e.edges);if(!o.length)return F({isValid:!0});let r=gt(e.nodes).filter(l=>o.some(d=>d.source===l.id)),i=Ue(r,l=>!hl(l.id,e));return F({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=gt(e.nodes),o=kt(e.nodes)[0];if(!o)return F({isValid:!0});let n=t.filter(l=>{let d=jo(l.id,e.edges),c=we(l.id,e.edges),p=d.some(f=>{var h;return((h=e.nodes.find(g=>g.id===f.source))==null?void 0:h.type)==="START_EVENT"}),u=c.some(f=>{var h;return((h=e.nodes.find(g=>g.id===f.target))==null?void 0:h.type)==="END_EVENT"});return p&&u}),r=jo(o.id,e.edges),i=r.length>1,a=r.map(l=>l.source),s={isValid:n.length===0&&!i,nodeIds:[...n.map(l=>l.id),...i?a:[]]};return F(s)}},{id:"gateway_flow_to_event",validate:e=>{let t=hr(e.nodes),o=[],n=[];for(let r of t){let i=we(r.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(r.id,s.id),n.push(a.id))}}return F({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=hr(e.nodes),o=Ue(t,n=>we(n.id,e.edges).length>=1);return F({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...Qo(e.nodes),...kt(e.nodes)],o=[],n=[];for(let r of t){let i=we(r.id,e.edges);for(let a of i){let s=e.nodes.find(l=>l.id===a.target);s&&s.type==="GATEWAY"&&(o.push(r.id,s.id),n.push(a.id))}}return F({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=fl(e.nodes),o=Ue(t,n=>!yl(n.id,e));return F({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=ml(e.nodes),o=Ue(t,n=>{var r,i;return((r=n.properties)==null?void 0:r.subprocessRef)!==void 0&&((i=n.properties)==null?void 0:i.subprocessRef)!==""});return F({isValid:o.isValid,nodeIds:o.invalidIds})}}];var _l=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of en){let r=n.validate(e);r.isValid||t.push({id:n.id,message:n.id,nodeIds:r.nodeIds||[],edgeIds:r.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var vl=()=>{let{t:e}=(0,bl.useTranslation)(),[t,o]=(0,ui.useState)(null),{setNodes:n,setEdges:r,getNodes:i,getEdges:a}=(0,Tl.useReactFlow)(),[s,l]=(0,ui.useState)(!1);return{validationResult:t,validateDiagram:u=>{let f=El(u.nodes,u.edges),h=_l(f),g=h.errors.map(E=>v(x({},E),{message:e(`validation.errors.${E.id}`)}));return s||l(!0),{isValid:h.isValid,errors:g}},handleValidationComplete:u=>{if(o(u),!u)return;let f=[],h=[];u.errors.forEach(_=>{_.nodeIds&&_.nodeIds.length>0&&_.nodeIds.forEach(A=>f.push(A)),_.edgeIds&&_.edgeIds.length>0&&_.edgeIds.forEach(A=>h.push(A))});let g=[...new Set(f)];n(_=>_.map(A=>v(x({},A),{data:v(x({},A.data),{hasError:!1})}))),r(_=>_.map(A=>v(x({},A),{data:v(x({},A.data),{hasError:!1})})));let E=i(),C=a(),T=new Set(g),b=new Set;u.errors.forEach(_=>{var N,M;let A=en.find(I=>I.id===_.id);(A==null?void 0:A.highlightRelatedEdges)!==!1&&((N=_.edgeIds)==null||N.forEach(I=>b.add(I)),(M=_.nodeIds)==null||M.forEach(I=>{C.forEach(S=>{(S.source===I||S.target===I)&&b.add(S.id)})}))});let m=new Set,y=new Set,w=new Set;E.forEach(_=>{_.type==="START_EVENT"?m.add(_.id):_.type==="END_EVENT"&&y.add(_.id)}),C.forEach(_=>{m.has(_.source)&&w.add(_.target),y.has(_.target)&&w.add(_.source)}),w.forEach(_=>{var A,P;if(T.has(_)){let N=(A=u.errors.find(I=>{var S;return(S=I.nodeIds)==null?void 0:S.includes(_)}))==null?void 0:A.id;((P=en.find(I=>I.id===N))==null?void 0:P.highlightRelatedEdges)!==!1&&C.forEach(I=>{I.source===_&&y.has(I.target)&&(T.add(I.target),b.add(I.id)),I.target===_&&m.has(I.source)&&(T.add(I.source),b.add(I.id))})}}),T.size>0&&n(_=>_.map(A=>v(x({},A),{data:v(x({},A.data),{hasError:T.has(A.id)})}))),b.size>0&&r(_=>_.map(A=>v(x({},A),{data:v(x({},A.data),{hasError:b.has(A.id)})})))},clearValidation:()=>{o(null),l(!1),n(u=>u.map(f=>v(x({},f),{data:v(x({},f.data),{hasError:!1})}))),r(u=>u.map(f=>v(x({},f),{data:v(x({},f.data),{hasError:!1})})))},isAutoValidationEnabled:s}};var Al=require("@xyflow/react"),Cl=require("lecom-ui"),Il=require("react"),pi=require("uuid");var yr=(e,t)=>{let n=e.filter(i=>i.type==="TASK").map(i=>{var s;let a=(s=i.data)==null?void 0:s.label;if(a&&a.startsWith(`${t} `)){let l=a.match(new RegExp(`^${t} (\\d+)$`));return l?parseInt(l[1],10):0}return 0}).filter(i=>i>0),r=n.length>0?Math.max(...n)+1:1;return`${t} ${r}`},uo=(e,t)=>{let n=t.filter(s=>s.type==="TASK").map(s=>{var l;return(l=s.data)==null?void 0:l.label}).filter(Boolean);if(!n.includes(e))return e;let r=e.replace(/\s+\(\d+\)$/,""),i=n.filter(s=>s===r||s.startsWith(`${r} (`)).map(s=>{if(s===r)return 1;let l=s.match(/\s+\((\d+)\)$/);return l?parseInt(l[1],10):0}).filter(s=>s>0),a=2;for(;i.includes(a);)a++;return`${r} (${a})`};var Wf=15,Nl="bpmn:selection",Yf=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},wl=e=>{if(!Yf(e.target))return!0;let t=window.getSelection(),o=t&&t.toString().length>0;if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement){let n=e.target;return n.selectionStart===n.selectionEnd&&!o}return!o},Sl=({offset:e=Wf}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,Al.useReactFlow)(),{t:i}=(0,Cl.useTranslation)();(0,Il.useEffect)(()=>{let a=l=>{var g,E;if(!wl(l))return;let d=t(),c=n(),p=d.filter(C=>C.selected);if(!p.length)return;l.preventDefault(),l.stopPropagation();let u=c.filter(C=>p.some(T=>T.id===C.source)&&p.some(T=>T.id===C.target)),h=JSON.stringify({nodes:p,edges:u});(g=l.clipboardData)==null||g.setData(Nl,h),(E=l.clipboardData)==null||E.setData("text/plain",`BPMN Selection: ${p.length} nodes`)},s=l=>{var b,m;if(!wl(l))return;let d=(b=l.clipboardData)==null?void 0:b.getData(Nl);if(!d)return;l.preventDefault(),l.stopPropagation();let c;try{c=JSON.parse(d)}catch(y){return}if(!((m=c.nodes)!=null&&m.length))return;let p=new Map,u=t(),f=[],h=u.some(y=>y.type==="START_EVENT"),g=c.nodes.filter(y=>y.type==="START_EVENT"),E=c.nodes;if(h&&g.length>0&&(E=c.nodes.filter(y=>y.type!=="START_EVENT"),E.length===0))return;let C=E.map(y=>{var A;let w=(0,pi.v7)();p.set(y.id,w);let _=v(x({},y),{id:w,selected:!0,position:{x:y.position.x+e,y:y.position.y+e}});if(y.type==="TASK"){let P=(A=y.data)==null?void 0:A.label,N=uo(P||i("bpmn.task.label.prefix"),[...u,...f]);_.data=v(x({},y.data),{label:N})}return f.push(_),_}),T=c.edges.map(y=>v(x({},y),{id:(0,pi.v7)(),selected:!0,source:p.get(y.source)||y.source,target:p.get(y.target)||y.target}));o(y=>[...y.map(w=>v(x({},w),{selected:!1})),...C]),r(y=>[...y.map(w=>v(x({},w),{selected:!1})),...T])};return document.addEventListener("copy",a,!0),document.addEventListener("paste",s,!0),()=>{document.removeEventListener("copy",a,!0),document.removeEventListener("paste",s,!0)}},[t,o,n,r,e,i])};var br=require("@xyflow/react");var Wl=require("lecom-ui"),Yl=require("react"),mi=require("uuid");var $f={MIN_WIDTH:36,MIN_HEIGHT:36},Xf={MIN_WIDTH:36,MIN_HEIGHT:36},Kf={MIN_WIDTH:56,MIN_HEIGHT:56},xr={MIN_WIDTH:176,MIN_HEIGHT:96},Er={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},q={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},_r={MIN_WIDTH:176,MIN_HEIGHT:64},qf={MIN_WIDTH:128,MIN_HEIGHT:64},V={START_EVENT:$f,END_EVENT:Xf,GATEWAY:Kf,TASK:xr,LANE:q,ANNOTATION:_r,UNSUPPORTED:qf};var fi=Tu(require("@dagrejs/dagre"),1),kl=require("@xyflow/react");var Dl=require("lodash");var Ml=require("lodash");var Ze=e=>{var t,o,n,r,i,a,s,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(r=(n=e.internals)==null?void 0:n.positionAbsolute.y)!=null?r: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}},Je=e=>(0,Ml.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),Pl=(e,t)=>{let{x:o,y:n}=Ze(e),{x:r,y:i}=Ze(t);return{x:o-r,y:n-i}};var po=({parentId:e,nodes:t,includeTypes:o=[...Object.values(D)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),Zf=(e,t)=>{let{x:o,y:n}=Ze(e),{x:r,y:i}=Ze(t),a=o-r,s=n-i;return Math.sqrt(a*a+s*s)},Jf=(e,t)=>{let{x:o,y:n,w:r,h:i}=Ze(e),{x:a,y:s,w:l,h:d}=Ze(t);return o<a+l&&a<o+r&&n<s+d&&s<n+i},tn=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&Jf(e,r)){let i=Zf(e,r);i<n&&(n=i,o=r)}return o},Ll=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,n)=>{var r,i;return Math.max(o,(i=(r=n.measured)==null?void 0:r.width)!=null?i:0)},0);var Rl=(e=[],t=[],o="LR")=>{let n=new fi.default.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:i,width:a,height:s})=>n.setNode(i,{width:a,height:s})),t.forEach(i=>n.setEdge(i.source,i.target)),fi.default.layout(n),{nodes:e.map(i=>{let a=n.node(i.id);return v(x({},i),{position:{x:a.x-i.width/2,y:a.y-i.height/2}})}),edges:t}},on=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=Dt(n.id,o)}),o},Dt=(e,t)=>{var f,h;let o=[...t],n=o.find(g=>g.id===e);if(!n)return o;let r=o.filter(g=>g.parentId===e&&g.type==="LANE");if(r.length===0)return o;let i=(0,Dl.orderBy)(r,["position.y"]),a=Math.max((h=(f=n.measured)==null?void 0:f.width)!=null?h:0,Er.MIN_WIDTH),s=Ll(e,i)||q.MIN_WIDTH,l=Math.max(a,s),d=a-q.HEADER_WIDTH>=s,c=0,p=0;i.forEach(g=>{var E,C,T,b;o=o.map(m=>m.id===g.id?v(x({},m),{width:d?l-q.HEADER_WIDTH:l,measured:v(x({},m.measured),{width:d?l-q.HEADER_WIDTH:l}),position:{x:q.HEADER_WIDTH,y:c}}):m),c+=(C=(E=g.measured)==null?void 0:E.height)!=null?C:0,p+=(b=(T=g.measured)==null?void 0:T.height)!=null?b:0}),o=o.map(g=>g.id===e?v(x({},g),{height:p,width:d?l:l+q.HEADER_WIDTH,measured:v(x({},g.measured),{height:p,width:d?l:l+q.HEADER_WIDTH})}):g);let u=o.find(g=>g.id===e);return u!=null&&u.parentId&&(o=Dt(u.parentId,o)),o},Vl=(e,t,o)=>{if(e.type==="LANE")return o;let n=Te(t),r=Te(e);return r.y<n.y&&(e.position.y=0),r.x<n.x+q.HEADER_WIDTH&&(e.position.x=q.HEADER_WIDTH),r.y2>n.y2&&(t.height=r.y2-n.y,t.measured.height=r.y2-n.y),r.x2>n.x2&&(t.width=r.x2-n.x,t.measured.width=r.x2-n.x),o=o.map(i=>i.id===t.id?v(x({},i),{height:t.height,width:t.width,measured:t.measured}):i.id===e.id?v(x({},i),{position:e.position}):i),o},Ol=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},Qf=50,Hl=(e,t=Qf)=>{let o=(0,kl.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Gl=require("zustand"),fo=(0,Gl.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var ge=require("@xyflow/react"),Bl=require("react");var ht=require("react/jsx-runtime"),nb={type:"MESSAGE_EDGE",markerEnd:{type:ge.MarkerType.Arrow},data:{label:""}},zl=({id:e,source:t,target:o,data:n,selected:r})=>{let{zoom:i}=(0,ge.useViewport)(),{updateEdgeData:a}=(0,ge.useReactFlow)(),{isMultipleSelection:s}=R(),[l,d]=(0,Bl.useState)(!1),c=(0,ge.useInternalNode)(t),p=(0,ge.useInternalNode)(o);if(!c||!p)return null;let{sx:u,sy:f,tx:h,ty:g,sourcePos:E,targetPos:C}=pt(c,p),[T,b,m]=(0,ge.getSmoothStepPath)({sourceX:u,sourceY:f,targetX:h,targetY:g,sourcePosition:E,targetPosition:C}),y=r||(c==null?void 0:c.selected)||(p==null?void 0:p.selected),w=y?"sequence-edge-marker-highlighted":"sequence-edge-marker",_=l||(n==null?void 0:n.label.trim().length)>0,A=1/i,P=()=>{d(!0)},N=()=>{d(!1)},M=I=>{a(e,{label:I.trim()})};return(0,ht.jsxs)("g",{className:L("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":y}),onBlur:N,onDoubleClick:P,children:[(0,ht.jsx)(ge.BaseEdge,{id:e,path:T,markerEnd:`url(#${w})`,strokeDasharray:4,className:L("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":n==null?void 0:n.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":y&&!(n!=null&&n.hasError)})}),(0,ht.jsx)(ge.EdgeLabelRenderer,{children:(0,ht.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${b}px, ${m}px)`},children:[r&&!s&&(0,ht.jsx)(lo,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${A})`}}),_&&(0,ht.jsx)(ce,{value:n==null?void 0:n.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:l,onChange:M})]})})]})};var Fl=require("@xyflow/react"),nn=require("react/jsx-runtime"),Ul=({toX:e,toY:t,fromPosition:o,toPosition:n,fromNode:r})=>{if(!r)return null;let i={id:"connection-target",measured:{width:1,height:1},internals:{positionAbsolute:{x:e,y:t}}},{sx:a,sy:s,tx:l,ty:d,sourcePos:c,targetPos:p}=pt(r,i),[u]=(0,Fl.getBezierPath)({sourceX:a,sourceY:s,sourcePosition:c||o,targetPosition:p||n,targetX:l||e,targetY:d||t});return(0,nn.jsxs)("g",{children:[(0,nn.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:u}),(0,nn.jsx)("circle",{cx:l||e,cy:d||t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var $l=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,br.useStoreApi)(),{getInternalNode:r,screenToFlowPosition:i}=(0,br.useReactFlow)(),{draggableNode:a,setDraggableNode:s}=fo(),{setIsDragging:l}=R(),{rebuildIndex:d,forceRebuildIndex:c}=so(),{t:p}=(0,Wl.useTranslation)(),[u,f]=(0,Yl.useState)(null),h=(N,M=!1)=>{let I=M?"[&>div]:bg-red-50 [&>div]:outline [&>div]:outline-[3px] [&>div]:outline-red-500":"[&>div]:bg-green-50/75 [&>div]:outline [&>div]:outline-[3px] [&>div]:outline-green-500";t(S=>S.map(k=>v(x({},k),{className:k.id===N?I:""})))},g=()=>{let{nodeLookup:N}=n.getState();return Array.from(N.values())},E=N=>{let M=r(N.id),I=g();if(N.type==="LANE"){if(po({parentId:N.id,nodes:e,includeTypes:["LANE"]})){h();return}let ne=I.filter($=>$.id!==N.id&&$.type==="LANE"&&!$.parentId),B=tn(M,ne);if(!B){h();return}if(po({parentId:B.id,nodes:e,excludeTypes:["LANE"]})){h(B.id,!0);return}h(B.id);return}let k=I.filter(J=>J.id!==N.id&&J.type==="LANE"),z=tn(M,k);if(!z){h();return}if(po({parentId:z.id,nodes:e,includeTypes:["LANE"]})){h();return}h(z.id)},C=N=>N.map(M=>v(x({},M),{className:void 0})),T=N=>N.some(I=>I.dragging)?N.map(I=>I.dragging?v(x({},I),{dragging:!1}):I):N,b=N=>{N.preventDefault(),N.dataTransfer.dropEffect="move"},m=(N,M)=>{N.preventDefault(),E(M)},y=(N,M,I)=>{var J,ne;let S=[...I];if(N.parentId===M.id)return S=Vl(N,M,S),S=on(S),C(S);if(N.type==="LANE"){if(po({parentId:M.id,nodes:S,excludeTypes:["LANE"]})){let le=Te(M),ot=50,Ut=50;return S.map(nt=>{var gn,hn;return nt.id===N.id?v(x({},nt),{position:{x:(gn=u==null?void 0:u.x)!=null?gn:le.x+ot,y:(hn=u==null?void 0:u.y)!=null?hn:le.y2+Ut}}):nt})}let $=S.filter(le=>le.parentId===M.id).reduce((le,ot)=>{var Ut,nt;return le+((nt=(Ut=ot.measured)==null?void 0:Ut.height)!=null?nt:0)},0),Ie={x:q.HEADER_WIDTH,y:$};return S=S.map(le=>le.id===N.id?v(x({},le),{parentId:M.id,position:Ie,className:void 0}):v(x({},le),{className:void 0})),S=Dt(M.id,S),S}if(po({parentId:M.id,nodes:S,includeTypes:["LANE"]})){let B;if(N.parentId){let Y=r(N.parentId),{x:$,y:Ie}=Ze(Y);B={x:$+((J=N.position.x)!=null?J:0),y:Ie+((ne=N.position.y)!=null?ne:0)}}return S=S.map(Y=>Y.id===N.id?v(x({},Y),{position:B!=null?B:Y.position,parentId:void 0,className:void 0}):v(x({},Y),{className:void 0})),S}let G=Pl(N,M);return S=S.map(B=>{if(B.id===N.id){let Y=Te(N),$=Te(M);return Y.y<$.y&&(G.y=0),Y.x<$.x+q.HEADER_WIDTH&&(G.x=q.HEADER_WIDTH),v(x({},B),{parentId:M.id,position:G,className:void 0})}return v(x({},B),{className:void 0})}),S=on(S),S},w=N=>{if(N.preventDefault(),!(a!=null&&a.type))return;let M=i({x:N.clientX,y:N.clientY}),I={width:V[a.type].MIN_WIDTH,height:V[a.type].MIN_HEIGHT},S={id:(0,mi.v7)(),type:a.type,position:M,measured:I,data:{label:a.type==="TASK"?yr(e,p("bpmn.task.label.prefix")):"",variant:a.variant,attribute:a.attribute},selected:!0},k=v(x({},S),{internals:{positionAbsolute:M}}),z=g(),G=a.type==="LANE",J=z.filter($=>G?$.type==="LANE"&&!$.parentId:$.type==="LANE"),ne=tn(k,J),B=[...e.map($=>v(x({},$),{selected:!1})),S];ne&&(B=y(k,ne,B)),B=Je(B),t(B),c();let Y=N.dataTransfer.getData("sourceId");if(Y){let $={id:(0,mi.v7)(),source:Y,target:S.id};if(a.type==="ANNOTATION"){o(Ie=>Ie.concat(x(x({},$),co)));return}o(Ie=>Ie.concat(x(x({},$),Ne)))}l(!1),s(null)},_=async(N,M,I)=>{let S=[...e];I.forEach(k=>{let z=g(),G=r(k.id),J=k.type==="LANE",ne=z.filter(Y=>Y.id!==k.id&&(J?Y.type==="LANE"&&!Y.parentId:Y.type==="LANE")),B=tn(G,ne);if(B){S=y(G,B,S);return}k.parentId&&(S=P(k,S))}),S=T(S),S=Je(S),S=C(S),t(S),d(S),f(null)},A=(N,M)=>{f({x:M.position.x,y:M.position.y})},P=(N,M)=>{var G,J;let I=r(N.parentId),{x:S,y:k}=Ze(I),z={x:S+((G=N.position.x)!=null?G:0),y:k+((J=N.position.y)!=null?J:0)};return M=M.map(ne=>ne.id===N.id?v(x({},ne),{position:z,parentId:void 0}):ne),M=Dt(N.parentId,M),M};return{onDragOver:b,onDrop:w,onNodeDrag:m,onNodeDragStart:A,onNodeDragStop:_}};var Xl=require("@xyflow/react"),Kl=require("lecom-ui"),ql=require("react"),gi=require("uuid");var jf=30,em=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},tm=e=>!em(e.target),Zl=({offset:e=jf}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,Xl.useReactFlow)(),{t:i}=(0,Kl.useTranslation)();(0,ql.useEffect)(()=>{let a=s=>{if(s.ctrlKey&&s.key.toLowerCase()==="d"&&tm(s)){s.preventDefault(),s.stopPropagation();let l=t(),d=n(),c=l.filter(b=>b.selected);if(!c.length)return;let p=new Map,u=[],f=l.some(b=>b.type==="START_EVENT"),h=c.filter(b=>b.type==="START_EVENT"),g=c;if(f&&h.length>0&&(g=c.filter(b=>b.type!=="START_EVENT"),g.length===0))return;let E=d.filter(b=>g.some(m=>m.id===b.source)&&g.some(m=>m.id===b.target)),C=g.map(b=>{var w;let m=(0,gi.v7)();p.set(b.id,m);let y=v(x({},b),{id:m,selected:!0,position:{x:b.position.x+e,y:b.position.y+e}});if(b.type==="TASK"){let _=(w=b.data)==null?void 0:w.label,A=uo(_||i("bpmn.task.label.prefix"),[...l,...u]);y.data=v(x({},b.data),{label:A})}return u.push(y),y}),T=E.map(b=>v(x({},b),{id:(0,gi.v7)(),selected:!0,source:p.get(b.source)||b.source,target:p.get(b.target)||b.target}));o(b=>[...b.map(m=>v(x({},m),{selected:!1})),...C]),r(b=>[...b.map(m=>v(x({},m),{selected:!1})),...T])}};return document.addEventListener("keydown",a,!0),()=>{document.removeEventListener("keydown",a,!0)}},[t,o,n,r,e,i])};var Vc=require("@xyflow/react"),dn=require("uuid");var Ql={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},jl={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Jl=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=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 n.length&&(a="task",s=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(a="gateway-exclusive",s=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),a||(a="task",s=e),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}},om=e=>{e=e||"";let t=e.trim().split(`
2
- `),o={},n=[];return t.forEach(r=>{r=r||"";let i=r.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let a=Jl(i[0],o),s=Jl(i[1],o);a&&s&&n.push({sourceId:a.step,targetId:s.step,label:a.edgeLabel||s.edgeLabel||""})}),{components:o,connections:n}},ec=e=>{let{components:t,connections:o}=om(e);return{nodes:t,edges:o}};var go=require("@xyflow/react");var rn=require("@xyflow/react");var hi=require("react/jsx-runtime"),ae=i=>{var a=i,{type:e,position:t,className:o,nodeType:n}=a,r=He(a,["type","position","className","nodeType"]);let s=n==="TASK";return(0,hi.jsx)(rn.Handle,x({type:e,position:t,className:L("size-2.5 border border-grey-400 bg-white relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":s,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":!s},o)},r))},Tr=s=>{var l=s,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,a=He(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:d}=(0,rn.useReactFlow)(),p=(()=>{if(n!=="source")return!1;let u=d();return t==="TASK"?u.filter(h=>h.source===e).length>=2:t==="GATEWAY"&&o==="EXCLUSIVE"?u.filter(h=>h.source===e).length>=2:!1})();return(0,hi.jsx)(rn.Handle,x({type:n,position:r,className:L("size-2.5 border border-grey-400 bg-white transition-all duration-200 relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":t==="TASK","before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":t!=="TASK","opacity-50 cursor-not-allowed pointer-events-none":p,"hover:border-grey-500":!p},i),style:{pointerEvents:p?"none":"auto"}},a))};var vr=require("@xyflow/react"),tc=require("lodash");var oc=require("react/jsx-runtime"),mo=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=He(r,["nodeId","isVisible"]);let{getNode:i,getNodes:a,setNodes:s}=(0,vr.useReactFlow)(),{isMultipleSelection:l}=R(),d=({width:p,height:u})=>{if(!e)return;let f=i(e);if((f==null?void 0:f.type)!=="LANE")return;let h=[...a()],g=!f.parentId,E=g?f.id:f.parentId,C=h.filter(m=>m.type==="LANE"&&m.parentId===E);if(!C.length)return;let T=(0,tc.orderBy)(C,["position.y"]),b=0;T.forEach((m,y)=>{var A,P;let w=y===T.length-1,_=(P=(A=m.measured)==null?void 0:A.height)!=null?P:0;h=h.map(N=>{if(N.id===m.id){let M=g?p-q.HEADER_WIDTH:p,I=v(x({},N),{width:M,measured:v(x({},N.measured),{width:M}),position:v(x({},N.position),{y:b})});return w&&g&&(I.height=u-b),I}return N}),b+=_}),h=h.map(m=>{if(m.id===E){let y=g?p:p+q.HEADER_WIDTH;return v(x({},m),{width:y,height:g?u:b,measured:{width:y,height:g?u:b}})}return m}),s(h)};return(0,oc.jsx)(vr.NodeResizer,x({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",isVisible:!l&&t,onResizeEnd:(p,u)=>d(u)},o))};var Ar=require("@xyflow/react"),We=require("lecom-ui"),sn=require("react");var Nr=require("react"),nc=(e,t=!1)=>{let[o,n]=(0,Nr.useState)({width:0,height:0});return(0,Nr.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var yt=require("@xyflow/react"),rc=require("react"),nm=120,rm=12,ic=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,yt.useReactFlow)(),{instanceId:i}=R();return(0,rc.useMemo)(()=>{var f,h;if(!t)return{position:yt.Position.Right,align:"start"};let a=n(e);if(!a)return{position:yt.Position.Right,align:"start"};let s=r(),l=a.position.x*s.zoom+s.x,d=(((f=a.measured)==null?void 0:f.width)||a.width||100)*s.zoom,c=(h=document.getElementById(`modeler-${i}`))==null?void 0:h.clientWidth;if(!c)return{position:yt.Position.Right,align:"start"};let p=(o==null?void 0:o.width)||nm;return{position:l+d+p+rm>c?yt.Position.Left:yt.Position.Right}},[i,e,t,o,n,r])};var wr=require("@xyflow/react"),O=require("lecom-ui"),sc=require("lucide-react");var X=require("react/jsx-runtime"),ac=({nodeId:e})=>{let{t}=(0,O.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,wr.useReactFlow)(),i=(0,wr.useNodesData)(e),s=n().filter(f=>f.source===e).some(f=>{let h=r(f.target);return(h==null?void 0:h.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",d=p=>{o(e,{variant:(i==null?void 0:i.data.variant)===p?"":p})},c=p=>{o(e,{attribute:(i==null?void 0:i.data.attribute)===p?"":p})};return(0,X.jsxs)(O.DropdownMenu,{children:[(0,X.jsxs)(O.Tooltip,{children:[(0,X.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(O.DropdownMenuTrigger,{asChild:!0,children:(0,X.jsx)(O.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,X.jsx)(sc.WrenchIcon,{})})})}),(0,X.jsx)(O.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,X.jsxs)(O.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,X.jsxs)(O.DropdownMenuLabel,{className:"flex items-center gap-1",children:[(0,X.jsx)("div",{className:"flex-1 text-sm font-semibold",children:t("bpmn.task.menu.title")}),(0,X.jsx)("div",{className:"flex items-center gap-1",children:Object.entries(In).map(([p,u])=>{let f=p==="LOOP"&&(s||l),g=(()=>{if(p==="LOOP"&&s)return t("editor.task_menu.loop_not_allowed_when_connected_to_end");if(p==="LOOP"&&l)return t("editor.task_menu.loop_not_allowed_when_subprocess")})();return(0,X.jsxs)(O.Tooltip,{children:[(0,X.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(O.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:f,className:L({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===p,"opacity-50 cursor-not-allowed":f}),onClick:f?void 0:()=>c(p),children:(0,X.jsx)(u.icon,{className:"stroke-inherit"})})}),g&&(0,X.jsx)(O.TooltipContent,{color:"black",children:g})]},p)})})]}),(0,X.jsx)(O.DropdownMenuGroup,{children:(0,X.jsxs)(O.Tooltip,{children:[(0,X.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,X.jsxs)(O.DropdownMenuItem,{className:L({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.variant)==="SCRIPT","opacity-50 cursor-not-allowed":s}),disabled:s,onClick:s?void 0:()=>d("SCRIPT"),children:[(0,X.jsx)(Cn.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})}),s&&(0,X.jsx)(O.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var j=require("react/jsx-runtime"),_e=({nodeId:e,nodeType:t,nodeVariant:o,isChild:n,isVisible:r})=>{var A;let i=(0,sn.useRef)(null),a=(0,sn.useRef)(null),{t:s}=(0,We.useTranslation)(),{setDraggableNode:l}=fo(),{getEdges:d,getNodes:c}=(0,Ar.useReactFlow)(),{setIsDragging:p}=R(),{dimensions:u}=nc(i,r),{position:f}=ic(e,r,u),[h,g]=(0,sn.useState)(void 0),E=c(),C=d(),T=o==="SUBPROCESS",b=(P,N)=>{l({type:N.type,variant:N.variant,attribute:N.attribute,icon:N.icon}),N.icon&&g((0,j.jsx)(N.icon,{})),P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("sourceId",e),a.current&&P.dataTransfer.setDragImage(a.current,10,10),setTimeout(()=>{p(!0)},100)},m={START_EVENT:{type:"START_EVENT",icon:Po,label:s("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:Yt,label:s("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:Po,label:s("bpmn.task.variant.default")},ANNOTATION:{type:"ANNOTATION",icon:Nn,label:s("bpmn.annotation.variant.default")}},y={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:Kt,label:s("bpmn.gateway.variant.exclusive")},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:Zt,label:s("bpmn.gateway.variant.parallel")},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:$t,label:s("bpmn.gateway.variant.complex")}},w=[{component:(0,j.jsx)(sr,{elementId:e})}],_={START_EVENT:[{component:(0,j.jsx)(Ko,{nodeId:e})},m.TASK,m.ANNOTATION,...w],TASK:[{component:(0,j.jsx)(Xo,{elementId:e})},...T?[]:[{component:(0,j.jsx)(ac,{nodeId:e})}],{component:(0,j.jsx)(Ko,{nodeId:e})},m.TASK,...Object.values(y),...w],GATEWAY:[{component:(0,j.jsx)(Xo,{elementId:e})},{component:(0,j.jsx)(Ko,{nodeId:e})},m.TASK,m.ANNOTATION,...w],END_EVENT:[{component:(0,j.jsx)(Ko,{nodeId:e})},m.ANNOTATION,...w],LANE:[...n?[]:[m.ANNOTATION],...w],ANNOTATION:[...w],UNSUPPORTED:[...w]};return(0,j.jsxs)(Ar.NodeToolbar,{position:f,align:"start",className:"-top-8",isVisible:r,children:[(0,j.jsx)("div",{ref:i,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:(A=_[t])==null?void 0:A.map((P,N)=>{if(P.component)return(0,j.jsx)("div",{children:P.component},N);let M={sourceNodeType:t,targetNodeType:P.type,sourceNodeId:e,nodes:E,edges:C},I=ul(M),S={gateway_limit_reached:s("editor.toolbar.gateway_limit_reached"),start_event_already_exists:s("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:s("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:s("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:s("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:s("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:s("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:s("editor.toolbar.task_limit_reached")},k=I.shouldDisable&&I.reason?S[I.reason]||P.label:P.label||"";return(0,j.jsxs)(We.Tooltip,{children:[(0,j.jsx)(We.TooltipTrigger,{asChild:!0,children:(0,j.jsx)(We.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!I.shouldDisable,disabled:I.shouldDisable,className:I.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:I.shouldDisable?void 0:z=>b(z,P),children:P.icon&&(0,j.jsx)(P.icon,{size:16})})}),(0,j.jsx)(We.TooltipContent,{color:"black",children:k})]},N)})}),(0,j.jsx)("div",{ref:a,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:h})]})};var Rt=require("react/jsx-runtime"),lc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,go.useReactFlow)(),{inProgress:i,fromNode:a}=(0,go.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:d}=R(),c=i&&(a==null?void 0:a.id)!==e,p=f=>{r(e,{label:f})},u=!s&&!l&&!d;return(0,Rt.jsxs)("div",{className:L("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm 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,Rt.jsx)(ce,{value:t.label,className:"m-1 text-grey-600",onChange:p}),u&&(0,Rt.jsx)(_e,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&o}),(0,Rt.jsx)(mo,{minWidth:_r.MIN_WIDTH,minHeight:_r.MIN_HEIGHT,isVisible:!n&&o}),(!i||c)&&(0,Rt.jsx)(ae,{type:"target",position:go.Position.Left,className:L({"annotation-handle":c})})]})};var Vt=require("@xyflow/react"),cc=require("react");var Qe=require("react/jsx-runtime"),dc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Vt.useReactFlow)(),{inProgress:i,fromNode:a}=(0,Vt.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:d}=R(),[c,p]=(0,cc.useState)(!1),u=i&&(a==null?void 0:a.id)!==e,f=C=>{r(e,{label:C})},h=()=>{p(!0)},g=()=>{p(!1)},E=!s&&!l&&!d;return(0,Qe.jsxs)("div",{className:"relative",onBlur:g,onDoubleClick:h,children:[(0,Qe.jsx)(Yt,{className:L("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,Qe.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,Qe.jsx)(ce,{value:t.label,isEditing:c,onChange:f})}),E&&(0,Qe.jsx)(_e,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&o}),(!i||u)&&(0,Qe.jsx)(ae,{type:"target",position:Vt.Position.Left,className:L({"event-handle":u})}),!i&&(0,Qe.jsx)(ae,{type:"source",position:Vt.Position.Right})]})};var Ot=require("@xyflow/react"),uc=require("react");var je=require("react/jsx-runtime"),pc=({id:e,data:t,selected:o,dragging:n})=>{let r=$r[t.variant].icon,{updateNodeData:i}=(0,Ot.useReactFlow)(),{inProgress:a,fromNode:s}=(0,Ot.useConnection)(),{isConnecting:l,isDragging:d,isMultipleSelection:c}=R(),[p,u]=(0,uc.useState)(!1),f=a&&(s==null?void 0:s.id)!==e,h=T=>{i(e,{label:T})},g=()=>{u(!0)},E=()=>{u(!1)},C=!l&&!d&&!c;return(0,je.jsxs)("div",{className:"relative",onBlur:E,onDoubleClick:g,children:[(0,je.jsx)(r,{className:L("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,je.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,je.jsx)(ce,{value:t.label,isEditing:p,onChange:h})}),C&&(0,je.jsx)(_e,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&o}),(!a||f)&&(0,je.jsx)(ae,{type:"target",position:Ot.Position.Left,className:L({"gateway-handle":f})}),!a&&(0,je.jsx)(Tr,{type:"source",position:Ot.Position.Right,nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})};var fc=require("@xyflow/react"),Ve=require("lecom-ui"),im=require("lucide-react");var mc=require("react/jsx-runtime");var Ht=require("@xyflow/react"),gc=require("react");var et=require("react/jsx-runtime"),hc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Ht.useReactFlow)(),{inProgress:i,fromNode:a}=(0,Ht.useConnection)(),{isConnecting:s,isDragging:l,isMultipleSelection:d}=R(),[c,p]=(0,gc.useState)(!1),u=i&&(a==null?void 0:a.id)!==e,f=C=>{r(e,{label:C})},h=()=>{p(!0)},g=()=>{p(!1)},E=!s&&!l&&!d;return(0,et.jsxs)("div",{className:"relative",onBlur:g,onDoubleClick:h,children:[(0,et.jsx)(An,{className:L("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,et.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,et.jsx)(ce,{value:t.label,isEditing:c,onChange:f})}),E&&(0,et.jsx)(_e,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&o}),(!i||u)&&(0,et.jsx)(ae,{type:"target",position:Ht.Position.Left,className:L({"event-handle":u})}),!i&&(0,et.jsx)(ae,{type:"source",position:Ht.Position.Right})]})};var Gt=require("@xyflow/react"),_c=require("lecom-ui");var an=require("react/jsx-runtime"),yc=e=>(0,an.jsxs)("svg",v(x({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,an.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,an.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var yi=require("react/jsx-runtime"),xc=e=>(0,yi.jsx)("svg",v(x({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,yi.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9C5 14.25 12 22 12 22C12 22 19 14.25 19 9C19 5.13 15.87 2 12 2ZM12 11.5C10.62 11.5 9.5 10.38 9.5 9C9.5 7.62 10.62 6.5 12 6.5C13.38 6.5 14.5 7.62 14.5 9C14.5 10.38 13.38 11.5 12 11.5Z",fill:"#38bdf8"})}));var ln=require("react/jsx-runtime"),Ec=e=>(0,ln.jsxs)("svg",v(x({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,ln.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,ln.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var he=require("react/jsx-runtime"),bc=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,_c.useTranslation)(),{updateNodeData:i,getNodes:a}=(0,Gt.useReactFlow)(),{inProgress:s,fromNode:l}=(0,Gt.useConnection)(),{isConnecting:d,isDragging:c,isMultipleSelection:p,onSubprocessValidationClick:u}=R(),{getTaskStatus:f}=Tt(),h=s&&(l==null?void 0:l.id)!==e,g=I=>{let S=I.trim(),k=t.label||"";if(S===k)return;let z=a(),G=S;S||(G=yr(z,r("bpmn.task.label.prefix")));let J=uo(G,z);J!==k&&i(e,{label:J})},E={APROVADO:yc,EM_ANDAMENTO:xc,REJEITADO:Ec},C={APROVADO:"border-green-500 border-[3px] border-solid",EM_ANDAMENTO:"border-turquoise-400 border-[3px] border-solid",REJEITADO:"border-red-500 border-[3px] border-solid",default:"border-grey-400 border-2 border-solid",error:"border-red-500 border-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)]"},T=f(e),b=T?E[T]:null,m=t.variant?Cn[t.variant].icon:null,y=t.attribute?In[t.attribute].icon:null,w=t.variant==="SUBPROCESS",_=m&&!w,A=y||w,P=()=>t.hasError?C.error:T?C[T]:C.default,N=()=>{u==null||u({id:e,type:"sub_process",label:t.label})},M=!d&&!c&&!p;return(0,he.jsxs)("div",{className:L("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 hover:shadow-md transition-colors duration-75",P(),{"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,he.jsx)(ce,{value:t.label,maxLength:60,className:L("m-1",{"py-6":_||A}),onChange:g}),m&&(0,he.jsx)("div",{className:L("absolute flex items-center p-1",w?"bottom-0":"top-0 left-0"),children:(0,he.jsx)(m,{size:16,className:L(t.hasError?"text-red-500":"text-grey-500",w&&"cursor-pointer"),onClick:w?N:void 0})}),y&&(0,he.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,he.jsx)("div",{className:L("flex items-center w-16 p-1",w?"justify-between":"justify-center"),children:(0,he.jsx)(y,{size:16,className:L(t.hasError?"text-red-500":"text-grey-500")})})}),b&&(0,he.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,he.jsx)(b,{})}),M&&(0,he.jsx)(_e,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant,isVisible:!n&&o}),(0,he.jsx)(mo,{minWidth:xr.MIN_WIDTH,minHeight:xr.MIN_HEIGHT,isVisible:!n&&o}),(!s||h)&&(0,he.jsx)(ae,{type:"target",position:Gt.Position.Left,className:L({"task-handle":h})}),!s&&(0,he.jsx)(Tr,{type:"source",position:Gt.Position.Right,nodeId:e,nodeType:"TASK"})]})};var xi=require("@xyflow/react");var tt=require("react/jsx-runtime"),Tc=({id:e,data:t,selected:o,dragging:n})=>{let{isConnecting:r,isDragging:i,isMultipleSelection:a}=R(),s=!r&&!i&&!a;return(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.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}),s&&(0,tt.jsx)(_e,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&o}),(0,tt.jsx)(ae,{type:"source",position:xi.Position.Right}),(0,tt.jsx)(ae,{type:"target",position:xi.Position.Left})]})};var Cr=require("@xyflow/react"),vc=require("lodash"),cn=require("react");var Ae=require("react/jsx-runtime"),Nc=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:a}=(0,Cr.useReactFlow)(),{isConnecting:s,isDragging:l,isMultipleSelection:d}=R(),[c,p]=(0,cn.useState)(!1),u=a(),f=!r,h=(0,cn.useMemo)(()=>(0,vc.orderBy)([...u.filter(y=>y.parentId===e&&y.type==="LANE")],"position.y","asc"),[u,e]),g=f?Er.MIN_WIDTH:q.MIN_WIDTH,E=(0,cn.useMemo)(()=>{if(f&&h.length>1){let y=[...h];return y.pop(),y.reduce((_,A)=>{var P,N;return _+((N=(P=A.measured)==null?void 0:P.height)!=null?N:0)},0)+q.MIN_HEIGHT}return q.MIN_HEIGHT},[f,h]),C=y=>{i(e,{label:y})},T=()=>{p(!0)},b=()=>{p(!1)},m=!s&&!l&&!d;return(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)("div",{className:L("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,Ae.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400",onBlur:b,onDoubleClick:T,children:(0,Ae.jsx)("div",{className:L("relative flex-1",{"[writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180":!c}),children:(0,Ae.jsx)(ce,{value:t.label,className:"w-full h-full pointer-events-none self-auto",contentClassName:L({"whitespace-nowrap":c}),isEditing:c,onChange:C})})}),(0,Ae.jsx)("div",{className:"flex-1"})]}),m&&(0,Ae.jsx)(_e,{nodeId:e,nodeType:"LANE",isChild:!f,isVisible:!n&&o}),(0,Ae.jsx)(mo,{nodeId:e,minWidth:g,minHeight:E,isVisible:!n&&o}),f&&(0,Ae.jsx)(ae,{type:"source",position:Cr.Position.Right})]})};var wc={START_EVENT:hc,END_EVENT:dc,TASK:bc,GATEWAY:pc,ANNOTATION:lc,LANE:Nc,UNSUPPORTED:Tc},Ac={SEQUENCE_EDGE:al,MESSAGE_EDGE:zl,ANNOTATION_EDGE:il},Cc="#fafafa",Ic="#bebebe",Sc=1,Mc=10,Pc="bottom-left",Lc=.5,kc=4,ho=.3,Dc={x:0,y:0,zoom:.75},sm=1,am=2,Rc=[sm,am];var Oc=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Vc.useReactFlow)();return{importFromLia:r=>{let i=typeof r=="string"?r:r.diagramXml||"",{nodes:a,edges:s}=ec(i),l=[],d=new Map,c=!1;for(let[h,g]of Object.entries(a)){let E=(0,dn.v7)(),C=Ql[g.type],T=jl[g.type];C==="START_EVENT"&&(c=!0),d.set(h,E);let b=V[C].MIN_WIDTH,m=V[C].MIN_HEIGHT;l.push({id:E,type:C,data:{label:g.label||"",variant:T,attribute:""},position:{x:0,y:0},width:b,height:m,measured:{width:b,height:m}})}let p=[];for(let h of s){let g=v(x({},Ne),{id:(0,dn.v7)(),source:d.get(h.sourceId)||h.sourceId,target:d.get(h.targetId)||h.targetId});p.push(g)}if(!c&&l.length>0){let h=(0,dn.v7)(),g={id:h,type:"START_EVENT",data:{label:"",variant:"",attribute:""},position:{x:0,y:0},width:V.START_EVENT.MIN_WIDTH,height:V.START_EVENT.MIN_HEIGHT,measured:{width:V.START_EVENT.MIN_WIDTH,height:V.START_EVENT.MIN_HEIGHT}};l.unshift(g);let E=l[1];if(E){let C=v(x({},Ne),{id:(0,dn.v7)(),source:h,target:E.id});p.unshift(C)}}let{nodes:u,edges:f}=Rl(l,p);e(u),t(f),o({padding:ho})}}};var Qc=require("@xyflow/react"),Ti=require("react");var un=(c=>(c.START_EVENT="start-event",c.END_EVENT_TERMINATE="end-event-terminate",c.TASK="task",c.TASK_SCRIPT="task-script",c.SUBPROCESS="subprocess-collapsed",c.GATEWAY_EXCLUSIVE="gateway-exclusive",c.GATEWAY_PARALLEL="gateway-parallel",c.GATEWAY_COMPLEX="gateway-complex",c.ANNOTATION="annotation",c.LANE="lane",c))(un||{});var Ir=require("xml-js");var Hc={compact:!0,spaces:4},lm=e=>e.replaceAll(`
3
- `,"&#xA;");function Sr(e,t=Hc){if(e)return JSON.parse((0,Ir.xml2json)(e,v(x({},t),{attributeValueFn:lm})))}function Gc(e,t=Hc){return e?(0,Ir.json2xml)(e,t):""}var bi=require("uuid");var Bc={"attribute-loop":"LOOP"},zc={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},Fc={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},Uc={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},Wc={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var yo=(e,t,o)=>{let n=e._attributes.width||0,r=e._attributes.height||0,i=st(Number(n),t),a=st(Number(r),o);return{width:i,height:a,measured:{width:i,height:a}}},xo=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,parent:r,value:i}=t,a={x:Number(o._attributes.x||0),y:Number(o._attributes.y||0)},s={id:n,position:a,data:{label:i||""}},l=r==="1"?void 0:r;return l&&(s.parentId=l),s},dm=e=>{let{mxGeometry:t}=e,o=xo(e),n=yo(t,V.START_EVENT.MIN_WIDTH,V.START_EVENT.MIN_HEIGHT);return v(x(x({},o),n),{type:"START_EVENT"})},um=e=>{let{mxGeometry:t}=e,o=xo(e),n=yo(t,V.END_EVENT.MIN_WIDTH,V.END_EVENT.MIN_HEIGHT);return v(x(x({},o),n),{type:"END_EVENT"})},Ei=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=xo(e),i=yo(n,V.TASK.MIN_WIDTH,V.TASK.MIN_HEIGHT),a=t==null?void 0:t.find(l=>{let{parent:d}=l._attributes;return d===e._attributes.id});if(a){let{style:l}=a._attributes,d=Bc[l];d&&(r.data.attribute=d)}let s=zc[o.style];return s&&(r.data.variant=s),v(x(x({},r),i),{type:"TASK"})},_i=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=xo(e),i=yo(o,V.GATEWAY.MIN_WIDTH,V.GATEWAY.MIN_HEIGHT);return r.data.variant=Fc[n],v(x(x({},r),i),{type:"GATEWAY"})},pm=e=>{let{mxGeometry:t}=e,o=xo(e),n=yo(t,V.ANNOTATION.MIN_WIDTH,V.ANNOTATION.MIN_HEIGHT);return v(x(x({},o),n),{type:"ANNOTATION"})},fm=e=>{let{mxGeometry:t}=e,o=xo(e),n=yo(t,V.LANE.MIN_WIDTH,V.LANE.MIN_HEIGHT);return v(x(x({},o),n),{type:"LANE"})},Yc={task:Ei,"task-script":Ei,"subprocess-collapsed":Ei,"start-event":dm,"end-event-terminate":um,"gateway-parallel":_i,"gateway-exclusive":_i,"gateway-complex":_i,annotation:pm,lane:fm},$c=e=>{let{_attributes:t}=e,{source:o,target:n,value:r,style:i}=t,a={id:(0,bi.v7)(),source:o,target:n,data:{label:r||""}};return i.includes("association")&&i.includes('endArrow=""')?x(x({},co),a):x(x({},Ne),a)},Xc=(e,t)=>{let{id:o,type:n,source:r,target:i,data:a}=e,s=t==null?void 0:t.find(c=>c.id===r),l="";return n==="ANNOTATION_EDGE"&&(l='association;endArrow=""'),{_attributes:{id:o,parent:(s==null?void 0:s.parentId)||"1",edge:"1",style:l,source:r,target:i,value:(a==null?void 0:a.label)||""},mxGeometry:{_attributes:{as:"geometry",relative:"1"}}}},Eo=e=>{let{id:t,parentId:o,position:n,measured:r,data:i}=e;return{_attributes:{id:t,parent:o||"1",value:i.label,vertex:"1"},mxGeometry:{_attributes:{as:"geometry",width:(r==null?void 0:r.width)||0,height:(r==null?void 0:r.height)||0,x:n.x||0,y:n.y||0}}}},mm=e=>{let{variant:t}=e.data,o=Eo(e);return v(x({},o),{_attributes:v(x({},o._attributes),{style:Uc[t]||"task"})})},gm=e=>{let t=Eo(e);return v(x({},t),{_attributes:v(x({},t._attributes),{style:"start-event"})})},hm=e=>{let t=Eo(e);return v(x({},t),{_attributes:v(x({},t._attributes),{style:"end-event-terminate"})})},ym=e=>{let{variant:t}=e.data,o=Eo(e);return v(x({},o),{_attributes:v(x({},o._attributes),{style:Wc[t]})})},xm=e=>{let t=Eo(e);return v(x({},t),{_attributes:v(x({},t._attributes),{style:"lane"})})},Em=e=>{let t=Eo(e);return v(x({},t),{_attributes:v(x({},t._attributes),{style:"annotation"})})},Kc={TASK:mm,START_EVENT:gm,END_EVENT:hm,GATEWAY:ym,ANNOTATION:Em,LANE:xm},qc=e=>{var i,a;let n=((i=e.measured)==null?void 0:i.width)||0,r=((a=e.measured)==null?void 0:a.height)||0;return{_attributes:{id:(0,bi.v7)(),parent:e.id,style:"attribute-loop",connectable:"0"},mxGeometry:{_attributes:{as:"geometry",x:n/2-22/2,y:r-22,width:22,height:22}}}};var _m=e=>{let t=Object.values(un),o=e.filter(i=>{var s;let a=(s=i._attributes)==null?void 0:s.style;return t.includes(a)}),n=e.filter(i=>{var s;let a=(s=i._attributes)==null?void 0:s.style;return["attribute-loop"].includes(a)}),r=[];for(let i of o){let{style:a}=i._attributes,s=Yc[a],l=s==null?void 0:s(i,n);if(!l){console.warn(`Node ${a} not supported`);continue}r.push(l)}return r},bm=(e,t)=>{let o=e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}),n=[];for(let r of o){let i=$c(r),a=t.find(l=>l.id===i.source),s=t.find(l=>l.id===i.target);(a==null?void 0:a.type)==="LANE"||(s==null?void 0:s.type)==="LANE"||n.push(i)}return n},Tm=e=>{let t=[];return e.forEach(o=>{var i,a;let n=(a=(i=Kc)[o.type])==null?void 0:a.call(i,o);if(!n){console.warn(`Node ${o.type} not supported`);return}if(t.push(n),o.type==="TASK"&&o.data.attribute==="LOOP"){let s=qc(o);t.push(s)}}),t},vm=(e,t)=>{let o=[];return e.forEach(n=>{let r=Xc(n,t);o.push(r)}),o},Zc=(e=[],t=[])=>{let o=Tm(e),n=vm(t,e),r={mxGraphModel:{root:{_attributes:{version:"1.1"},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...o,...n]}}};return Gc(JSON.stringify(r))},Jc=async e=>{var a,s;let t=await Sr(e),o=((s=(a=t==null?void 0:t.mxGraphModel)==null?void 0:a.root)==null?void 0:s.mxCell)||[],n=_m(o),r=bm(o,n);return{nodes:Je(on(n)),edges:r}};var jc=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,fitView:r}=(0,Qc.useReactFlow)(),i=(0,Ti.useCallback)(async(s="")=>{let{nodes:l,edges:d}=await Jc(s);o(l),n(d),r({padding:ho})},[o,n,r]),a=(0,Ti.useCallback)((s,l)=>{let d=s||e()||[],c=l||t()||[];return Zc(d,c)},[e,t]);return{importFromMxGraph:i,exportToMxGraph:a}};var Mr=require("react"),Nm={origin:"*",debug:!1};function ed(e,t=Nm){let{origin:o,debug:n}=t,r=(0,Mr.useCallback)((i,a)=>{let s={event:i,data:[i,{event:i,data:a}]};window.parent.postMessage(s,o||"*")},[o]);return(0,Mr.useEffect)(()=>{let i=a=>{let s=a.data;if(!(s!=null&&s.event)||!(s!=null&&s.data))return;let{event:l,data:d}=s,c;if(Array.isArray(d)){let[,p]=d;c=p.data}else c=d;n&&(console.debug("[postMessage] received:",s),console.debug("[postMessage] eventData:",c)),l&&e[l]&&e[l](c)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,n]),{sendMessage:r}}var td=require("@xyflow/react");var od=(e,t)=>{let{getNodes:o,getEdges:n}=(0,td.useReactFlow)();return{selectElement:a=>{let s=o().map(d=>v(x({},d),{selected:d.id===a})),l=n().map(d=>v(x({},d),{selected:d.id===a}));return e(s),t(l),!0},isReady:()=>!0}};var vi=require("react"),nd=require("@xyflow/react");function rd(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=Tt(),{getEdges:n}=(0,nd.useReactFlow)(),r=Sn(),i=(0,vi.useCallback)(s=>{if(!(s!=null&&s.activities))return;e(s.activities);let l=s.activities.map(c=>c.diagramId),d=n();o(d,l),setTimeout(()=>{r()},0)},[e,o,n,r]),a=(0,vi.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:a}}var ad=require("@xyflow/react"),ke=require("react"),ld=require("use-debounce");var id=[{nodes:[],edges:[]}],wm=500,sd=100,cd=(e=id)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,ad.useReactFlow)(),[i,a]=(0,ke.useState)(e),[s,l]=(0,ke.useState)(0),d=i[s],c=s>0,p=s<i.length-1,u=(0,ke.useCallback)(m=>{n(i[m].nodes),r(i[m].edges)},[i,n,r]),f=(0,ke.useCallback)(()=>{if(s>0){let m=s-1;l(m),u(m)}},[s,u]),h=(0,ke.useCallback)(()=>{if(s<i.length-1){let m=s+1;l(m),u(m)}},[i,s,u]),g=m=>{let w=[...i.slice(0,s+1),m],_=w.length>sd?w.slice(w.length-sd):w;a(_),l(_.length-1)},E=(0,ld.useDebouncedCallback)(()=>{let m=t(),y=o(),w=m.map(P=>v(x({},P),{selected:!1,className:""})),_={nodes:Je(w),edges:y};JSON.stringify(d)!==JSON.stringify(_)&&g(_)},wm),C=(0,ke.useCallback)(m=>{if(m==="forceSave"){E();return}m.some(_=>_.type==="select")||m.some(_=>_.type==="position"&&_.dragging)||E()},[E]),T=(0,ke.useCallback)(m=>{a(m||id),l(0)},[]),b=(0,ke.useCallback)(()=>{a([]),l(0)},[]);return(0,ke.useEffect)(()=>{let m=y=>{(y.ctrlKey||y.metaKey)&&(y.shiftKey&&y.key.toLowerCase()==="z"?(y.preventDefault(),h()):y.key.toLowerCase()==="z"&&(y.preventDefault(),f()))};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[f,h]),{history:i,undo:f,redo:h,canUndo:c,canRedo:p,saveHistory:C,resetHistory:T,clearHistory:b}};var Ni=require("react/jsx-runtime"),wi=({id:e,className:t})=>(0,Ni.jsx)("marker",{id:e,className:L("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,Ni.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var _o=require("react/jsx-runtime"),dd=()=>(0,_o.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,_o.jsxs)("defs",{children:[(0,_o.jsx)(wi,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,_o.jsx)(wi,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var Ii=require("@xyflow/react"),re=require("lecom-ui"),vo=require("lucide-react"),To=require("react");var Ye=require("lecom-ui");var pn=(T=>(T.START_EVENT="START_EVENT",T.END_EVENT="END_EVENT",T.TASK="TASK",T.SUBPROCESS="SUBPROCESS",T.GATEWAY="GATEWAY",T.LANE="LANE",T.ANNOTATION="ANNOTATION",T.CONNECTION="CONNECTION",T.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",T.ACTIVITY="ACTIVITY",T.PROCESS_INTERFACE="PROCESS_INTERFACE",T.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",T.VARIANT_ACTIVITY="VARIANT_ACTIVITY",T.AUTO_ACTIVITY="AUTO_ACTIVITY",T.DATA_STORE="DATA_STORE",T.DATA_OBJECT="DATA_OBJECT",T.DATA_OUTPUT="DATA_OUTPUT",T.DATA_INPUT="DATA_INPUT",T))(pn||{});var Td=require("@xyflow/react"),bo=require("lecom-ui");var ud=async e=>new Promise((t,o)=>{let n=new FileReader;n.onload=r=>{var i;t((i=r.target)==null?void 0:i.result)},n.onerror=r=>{var i;o((i=r.target)==null?void 0:i.error)},n.readAsText(e)});function pd({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(a=>a.join(",")).join(`
4
- `),i=encodeURI(r);Pr(i,`${o}.csv`)}var Pr=(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 _d=require("uuid");function fd(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}var hd=require("uuid");var kw={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},md={script:"SCRIPT",subprocess:"SUBPROCESS"},gd={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var Bt=({cell:e,type:t,variant:o=""})=>{let{_attributes:n,mxGeometry:r}=e,{value:i,parent:a}=n,s=Number(r._attributes.width),l=Number(r._attributes.height),d=a==="1"?void 0:a;return{id:n.id,parentId:d,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(r._attributes.x)||0,y:Number(r._attributes.y)||0},width:s,height:l,measured:{width:s,height:l}}},Cm=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=V.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.START_EVENT.MIN_HEIGHT,{node:Bt({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Im=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=V.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=V.END_EVENT.MIN_HEIGHT,{node:Bt({cell:e,type:"END_EVENT"}),status:n,originalType:o}},Sm=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=md[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=st(e.mxGeometry._attributes.width||0,V.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=st(e.mxGeometry._attributes.height||0,V.TASK.MIN_HEIGHT),{node:Bt({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},Mm=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=gd[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=V.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=V.GATEWAY.MIN_HEIGHT,{node:Bt({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},Pm=e=>{let{style:t}=e==null?void 0:e._attributes;return{node:Bt({cell:e,type:"LANE"}),status:"imported",originalType:t}},Lm=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=st(e.mxGeometry._attributes.width||0,V.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=st(e.mxGeometry._attributes.height||0,V.ANNOTATION.MIN_HEIGHT),{node:Bt({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},yd=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:Bt({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},xd=(e,t)=>{let{source:o,target:n,value:r}=e._attributes;return v(x({},Ne),{id:(0,hd.v7)(),source:t.get(o)||o,target:t.get(n)||n,data:{label:r||""}})},Ed={TASK:Sm,GATEWAY:Mm,START_EVENT:Cm,END_EVENT:Im,LANE:Pm,ANNOTATION:Lm};var km=(e,t)=>{let o=e.filter(n=>n.parentId);for(let n of o){let r=t.get(n.parentId);r&&(n.parentId=r)}return e},Dm=e=>{var a;let t=new Map,o=Object.values(pn),n=e.filter(s=>{var d;let l=(d=s._attributes)==null?void 0:d.type;return o.includes(l)}),r=[],i=[];for(let s of n){let l=(0,_d.v7)(),{type:d}=s._attributes,c=Ed[d]||yd;t.set((a=s._attributes)==null?void 0:a.id,l),s._attributes.id=l;let{node:p,status:u,originalType:f}=c(s);i.push(p),r.push({originalType:f,type:p.type,variant:p.data.variant,value:fd(p.data.label),status:u})}return i=km(i,t),{nodes:i,governanceIdToNodeIdMap:t,summary:r}},Rm=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>xd(r,t)),Vm=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=Dm(t.root.mxCell),i=Rm(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},Om=async e=>{let t=await ud(e),o=Sr(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},i=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),a=r==null?void 0:r.root;if(!i||!a)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},bd=async e=>{try{let t=await Om(e),{nodes:o,edges:n,summary:r}=Vm(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var Nd=require("react/jsx-runtime"),vd=()=>{let{t:e}=(0,bo.useTranslation)(),{toast:t}=(0,bo.useNotificationToast)(),{setNodes:o,setEdges:n,fitView:r}=(0,Td.useReactFlow)(),i=s=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],d=s.map(c=>[c.originalType,c.value,e(`adapter.governance.report.status.${c.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,Nd.jsx)(bo.Button,{size:"small",variant:"ghost",onClick:()=>pd({columns:l,rows:d,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{importFromGovernance:async s=>{try{let{nodes:l,edges:d,summary:c}=await bd(s);if(o(u=>u.concat(l)),n(u=>u.concat(d)),r({padding:ho}),c.some(u=>u.status==="unsupported")){i(c);return}t({variant:"success",content:e("adapter.governance.success.default")})}catch(l){let d=l instanceof Error?l.message:"DEFAULT";t({variant:"error",content:e(`adapter.governance.error.${d}`)})}}}};var wd=require("lecom-ui"),Ad=require("react");var zt=require("react/jsx-runtime"),Cd=s=>{var l=s,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,a=He(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let d=(0,Ad.useRef)(null),c=u=>{let f=u.target.files;f!=null&&f.length&&i(f),d.current&&(d.current.value="")};return(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)(wd.Button,v(x({onClick:u=>{var f;(f=d.current)==null||f.click(),r==null||r(u)}},a),{children:e})),(0,zt.jsx)("input",{type:"file",ref:d,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:c})]})};var Ft=require("react/jsx-runtime"),Id=({disabled:e=!1})=>{let{t}=(0,Ye.useTranslation)(),{toast:o}=(0,Ye.useNotificationToast)(),{importFromGovernance:n}=vd(),r=()=>{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}n(s)};return(0,Ft.jsxs)(Ye.Tooltip,{children:[(0,Ft.jsx)(Ye.TooltipTrigger,{asChild:!0,children:(0,Ft.jsx)(Cd,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:(0,Ft.jsx)(Wi,{})})}),(0,Ft.jsx)(Ye.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var Sd=require("react/jsx-runtime"),Ai=({shortcut:e})=>(0,Sd.jsx)("span",{className:"min-h-7.5 inline-flex justify-center items-center py-0.5 px-1.5 bg-grey-100 border border-grey-300 font-mono text-gray-800 shadow-lg rounded-md text-grey-900",children:e});var H=require("lecom-ui"),xt=require("lucide-react"),kd=require("react");var Md=require("@xyflow/react"),fn=require("html-to-image"),Lr=require("lecom-ui"),Pd=require("react");var Hm=3,Ci="diagram",Ld=()=>{let{t:e}=(0,Lr.useTranslation)(),{getNodes:t}=(0,Md.useReactFlow)(),{deselectAll:o}=eo(),[n,r]=(0,Pd.useState)({png:!1,html:!1,print:!1}),i=()=>{let{x:c,y:p,width:u,height:f}=Hl(t());return{width:u,height:f,style:{width:`${u}px`,height:`${f}px`,transform:`translate(${-c}px, ${-p}px)`}}},a=async(c,p)=>{r(v(x({},n),{[p]:!0})),await o();try{let u=Ol();if(!u)throw new Error("Flow element not found");let f=i();return await c(u,f)}catch(u){(0,Lr.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(v(x({},n),{[p]:!1}))}};return{exportAsPng:async(c=Ci)=>{await a(async(p,u)=>{let f=await(0,fn.toPng)(p,v(x({},u),{backgroundColor:"#fcfcfc"}));Pr(f,`${c}.png`)},"png")},exportAsHtml:async(c=Ci)=>{await a(async(p,u)=>{let f=await(0,fn.toSvg)(p,v(x({},u),{backgroundColor:"#fcfcfc"})),h=`
1
+ "use strict";var yu=Object.create;var Mo=Object.defineProperty,xu=Object.defineProperties,Eu=Object.getOwnPropertyDescriptor,_u=Object.getOwnPropertyDescriptors,bu=Object.getOwnPropertyNames,xn=Object.getOwnPropertySymbols,Tu=Object.getPrototypeOf,zr=Object.prototype.hasOwnProperty,Vi=Object.prototype.propertyIsEnumerable;var Ri=(e,t,o)=>t in e?Mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,_=(e,t)=>{for(var o in t||(t={}))zr.call(t,o)&&Ri(e,o,t[o]);if(xn)for(var o of xn(t))Vi.call(t,o)&&Ri(e,o,t[o]);return e},N=(e,t)=>xu(e,_u(t));var Ge=(e,t)=>{var o={};for(var n in e)zr.call(e,n)&&t.indexOf(n)<0&&(o[n]=e[n]);if(e!=null&&xn)for(var n of xn(e))t.indexOf(n)<0&&Vi.call(e,n)&&(o[n]=e[n]);return o};var vu=(e,t)=>{for(var o in t)Mo(e,o,{get:t[o],enumerable:!0})},Oi=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of bu(t))!zr.call(e,r)&&r!==o&&Mo(e,r,{get:()=>t[r],enumerable:!(n=Eu(t,r))||n.enumerable});return e};var Nu=(e,t,o)=>(o=e!=null?yu(Tu(e)):{},Oi(t||!e||!e.__esModule?Mo(o,"default",{value:e,enumerable:!0}):o,e)),wu=e=>Oi(Mo({},"__esModule",{value:!0}),e);var Fm={};vu(Fm,{ElementPosition:()=>_n,ElementType:()=>Po,GatewayElementVariant:()=>bn,GatewayVariant:()=>Pe,Modeler:()=>Zd,ModelerProvider:()=>Xd,NodeAttribute:()=>qe,NodeType:()=>k,NodeVariant:()=>Me,RoutingVariant:()=>Tn,useModeler:()=>Gr});module.exports=wu(Fm);var Fr=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 En=require("lecom-ui");var Hi={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Delete",configure_node:"Configure activity",configure_edge:"Configure routing",initial_task:"Initial Activity",gateway_limit_reached:"Exclusive gateway cannot have more than 2 outgoing connections",task_limit_reached:"Task cannot have more than 2 outgoing connections",gateway_to_gateway_not_allowed:"Gateways cannot connect directly to other gateways",start_event_already_exists:"A start event already exists. Delete the current event to add another",script_to_end_not_allowed:"Script activities cannot connect directly to the end event",loop_to_end_not_allowed:"Loop activities cannot connect directly to the end event",initial_activity_to_end_not_allowed:"Initial activity cannot connect directly to the end event",final_activity_cannot_connect:"Final activity cannot connect to other elements",activity_has_outgoing_connections:"Activity with outgoing connections cannot connect to end event",end_event_cannot_connect_to_initial_activity:"End event cannot connect to an initial activity",initial_activity_cannot_connect_to_start_event:"Initial activity cannot connect to start event",connect_node:"Connect element",connecting:"Connecting..."},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"}},task_menu:{loop_not_allowed_when_connected_to_end:"Cannot create loop on activity connected to end event",script_not_allowed_when_connected_to_end:"Cannot transform to Script activity connected to end event",loop_not_allowed_when_subprocess:"Cannot create loop on subprocess"}},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"},label:{prefix:"Activity"}},lane:{variant:{default:"Pool / 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 Gi={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Eliminar",configure_node:"Configurar actividad",configure_edge:"Configurar enrutamiento",initial_task:"Actividad Inicial",gateway_limit_reached:"Compuerta exclusiva no puede tener m\xE1s de 2 conexiones de salida",task_limit_reached:"Actividad no puede tener m\xE1s de 2 conexiones de salida",gateway_to_gateway_not_allowed:"Las compuertas no pueden conectarse directamente con otras compuertas",start_event_already_exists:"Ya existe un evento de inicio. Elimine el evento actual para agregar otro",script_to_end_not_allowed:"Las actividades Script no pueden conectarse directamente al evento final",loop_to_end_not_allowed:"Las actividades Loop no pueden conectarse directamente al evento final",initial_activity_to_end_not_allowed:"Actividad inicial no puede conectarse directamente al evento final",final_activity_cannot_connect:"Actividad final no puede conectarse a otros elementos",activity_has_outgoing_connections:"Actividad con conexiones de salida no puede conectarse al evento final",end_event_cannot_connect_to_initial_activity:"El evento final no puede conectarse a una actividad inicial",initial_activity_cannot_connect_to_start_event:"Actividad inicial no puede conectarse a evento de inicio",connect_node:"Conectar elemento",connecting:"Conectando..."},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"}},task_menu:{loop_not_allowed_when_connected_to_end:"No se puede crear bucle en actividad conectada al evento final",script_not_allowed_when_connected_to_end:"No se puede transformar a Script actividad conectada al evento final",loop_not_allowed_when_subprocess:"No se puede crear bucle en subproceso"}},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"},label:{prefix:"Actividad"}},lane:{variant:{default:"Piscina / Raia"}},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 Bi={translations:{general:{layout:{title:"Modeler"}},editor:{toolbar:{delete:"Excluir",configure_node:"Configurar atividade",configure_edge:"Configurar roteamento",initial_task:"Atividade Inicial",gateway_limit_reached:"Gateway exclusivo n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",task_limit_reached:"Atividade n\xE3o pode ter mais de 2 conex\xF5es de sa\xEDda",gateway_to_gateway_not_allowed:"Gateways n\xE3o podem se conectar diretamente com outros gateways",start_event_already_exists:"J\xE1 existe um evento de in\xEDcio. Exclua o evento atual para adicionar outro",script_to_end_not_allowed:"Atividades Script n\xE3o podem se conectar diretamente ao evento final",loop_to_end_not_allowed:"Atividades Loop n\xE3o podem se conectar diretamente ao evento final",initial_activity_to_end_not_allowed:"Atividade inicial n\xE3o pode se conectar diretamente ao evento final",final_activity_cannot_connect:"Atividade final n\xE3o pode se conectar a outros elementos",activity_has_outgoing_connections:"Atividade com conex\xF5es de sa\xEDda n\xE3o pode se conectar a um evento final",end_event_cannot_connect_to_initial_activity:"O evento final n\xE3o pode ser conectado a uma atividade inicial",initial_activity_cannot_connect_to_start_event:"Atividade inicial n\xE3o pode se conectar a evento de in\xEDcio",connect_node:"Conectar elemento",connecting:"Conectando..."},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"}},task_menu:{loop_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel criar loop em atividade conectada ao evento final",script_not_allowed_when_connected_to_end:"N\xE3o \xE9 poss\xEDvel transformar em Script atividade conectada ao evento final",loop_not_allowed_when_subprocess:"N\xE3o \xE9 poss\xEDvel criar loop em subprocesso"}},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"},label:{prefix:"Atividade"}},lane:{variant:{default:"Piscina / Raia"}},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 zi={pt_BR:Bi,en_US:Hi,es_ES:Gi};var Fi,Wi,Au=(Wi=(Fi=Fr("LecomUserLanguage"))!=null?Fi:Fr("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE"))!=null?Wi:En.Translations.PT_BR;(0,En.initializeI18n)({lng:Au,resources:zi});var Po=(r=>(r.ACTIVITY="activity",r.ROUTING="routing",r.GATEWAY="gateway",r.SUB_PROCESS="sub_process",r))(Po||{}),_n=(n=>(n.START="start",n.END="end",n.BETWEEN="between",n))(_n||{}),bn=(n=>(n.SCRIPT="script",n.LOOP="loop",n.SCRIPT_LOOP="script_loop",n))(bn||{}),Tn=(c=>(c.SIMPLE="simple",c.LOOP="loop",c.SCRIPT="script",c.SCRIPT_LOOP="script_loop",c.COMPLEX="complex",c.EXCLUSIVE="exclusive",c.PARALLEL="parallel",c.FINAL="final",c.TO_SUB_PROCESS="to_sub_process",c))(Tn||{});var to=require("lucide-react");var Tt=require("react/jsx-runtime"),vn=({size:e=24,className:t})=>(0,Tt.jsxs)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#6b7280",className:t,children:[(0,Tt.jsx)("path",{strokeWidth:"2",d:"M16 3V3.5085V11.9998V20.4915V21H16.5411H21.4592H22V19.123H21.4592H17.9974V11.9998V4.8773H21.4592H22V3H21.4592H16.5411H16Z"}),(0,Tt.jsx)("path",{d:"M4.41026 16.9999L2 18.7861L3.89693 21.1103L6.3072 19.324L4.41026 16.9999Z"}),(0,Tt.jsx)("path",{d:"M8.41026 13.9999L6 15.7861L7.89693 18.1103L10.3072 16.324L8.41026 13.9999Z"}),(0,Tt.jsx)("path",{d:"M12.4313 10.954L10.021 12.7402L11.9179 15.0644L14.3282 13.2781L12.4313 10.954Z"})]});var Wr=require("react/jsx-runtime"),Xt=({size:e=24,className:t})=>(0,Wr.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#ff6565",stroke:"#ec1616",strokeWidth:3,className:t,children:(0,Wr.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 st=require("react/jsx-runtime"),Kt=({size:e=24,className:t})=>(0,st.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,st.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,st.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,st.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,st.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,st.jsx)("path",{d:"M14.8281 9.17188L9.17127 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var qt=require("react/jsx-runtime"),Zt=({size:e=24,className:t})=>(0,qt.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,qt.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,qt.jsx)("path",{d:"M14.8286 9.17188L9.17176 14.8287",strokeLinecap:"round",strokeLinejoin:"round"}),(0,qt.jsx)("path",{d:"M9.17139 9.17188L14.8282 14.8287",strokeLinecap:"round",strokeLinejoin:"round"})]});var Jt=require("react/jsx-runtime"),Qt=({size:e=24,className:t})=>(0,Jt.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,Jt.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,Jt.jsx)("path",{d:"M12 8V16",strokeLinecap:"round",strokeLinejoin:"round"}),(0,Jt.jsx)("path",{d:"M8 12H16",strokeLinecap:"round",strokeLinejoin:"round"})]});var jt=require("react/jsx-runtime"),Ui=({size:e=24,className:t})=>(0,jt.jsx)("svg",{width:e,height:e,viewBox:"0 0 34 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",className:t,children:(0,jt.jsxs)("g",{children:[(0,jt.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,jt.jsx)("path",{d:"M24.5 4.5L28 1M28 1L31.5 4.5M28 1V8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})});var Yi=require("clsx"),$i=require("tailwind-merge");function P(...e){return(0,$i.twMerge)((0,Yi.clsx)(e))}var at=(e=0,t=0)=>e<t?t:e,Xi=(e=1e3)=>new Promise(t=>{setTimeout(t,e)});var Lo=require("react/jsx-runtime"),Ki=({size:e=24,className:t})=>(0,Lo.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:P("stroke-2",t),children:[(0,Lo.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,Lo.jsx)("path",{d:"M9 3V21",strokeLinecap:"round",strokeLinejoin:"round"})]});var Nn=require("react/jsx-runtime"),qi=({size:e=24,className:t})=>(0,Nn.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",className:t,children:(0,Nn.jsx)("g",{children:(0,Nn.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 Ur=require("react/jsx-runtime"),wn=({size:e=24,className:t})=>(0,Ur.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"#5fd9b0",stroke:"#1cad86",strokeWidth:"2",className:t,children:(0,Ur.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 Yr=require("react/jsx-runtime"),ko=({size:e=24,className:t})=>(0,Yr.jsx)("svg",{width:e,height:e,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"white",stroke:"#6b7280",className:P("stroke-2",t),children:(0,Yr.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 eo=require("react/jsx-runtime"),Zi=({size:e=24,className:t})=>(0,eo.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,eo.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,eo.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,eo.jsx)("path",{d:"M7.5 7.5V10H10",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]});var lt=require("react/jsx-runtime"),Ji=({size:e=24,className:t})=>(0,lt.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,lt.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,lt.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,lt.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,lt.jsx)("path",{d:"M13.5 12H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,lt.jsx)("path",{d:"M13.5 10H11",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var vt=require("react/jsx-runtime"),Qi=({size:e=24,className:t})=>(0,vt.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,vt.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,vt.jsx)("path",{d:"M8 21V14C8 13.4477 8.44772 13 9 13H15C15.5523 13 16 13.4477 16 14V21",strokeWidth:"1",fill:"none"}),(0,vt.jsx)("path",{d:"M10.2222 17H13.7777",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,vt.jsx)("path",{d:"M12 15.2227V18.7782",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})]});var k=(a=>(a.START_EVENT="START_EVENT",a.END_EVENT="END_EVENT",a.TASK="TASK",a.LANE="LANE",a.GATEWAY="GATEWAY",a.ANNOTATION="ANNOTATION",a.UNSUPPORTED="UNSUPPORTED",a))(k||{}),Me=(o=>(o.SCRIPT="SCRIPT",o.SUBPROCESS="SUBPROCESS",o))(Me||{}),An={SCRIPT:{icon:to.ScrollText},SUBPROCESS:{icon:to.SquarePlus}},qe=(t=>(t.LOOP="LOOP",t))(qe||{}),Cn={LOOP:{icon:to.RotateCcw}},Pe=(n=>(n.EXCLUSIVE="EXCLUSIVE",n.PARALLEL="PARALLEL",n.COMPLEX="COMPLEX",n))(Pe||{}),$r={EXCLUSIVE:{icon:Zt},PARALLEL:{icon:Qt},COMPLEX:{icon:Kt}};var Kd=require("@xyflow/react"),oe=require("react");var ie=require("@xyflow/react"),Fd=require("lecom-ui"),pe=require("react"),Wd=require("use-debounce"),Or=require("uuid");var ji=require("zustand"),es=require("@xyflow/react"),ts=require("react");var In=()=>{let{setEdges:e}=(0,es.useReactFlow)();return(0,ts.useCallback)(()=>{let o=Nt.getState().pathEdgeIds;e(n=>n.map(r=>N(_({},r),{selected:o.includes(r.id)})))},[e])},Nt=(0,ji.create)((e,t)=>({statusByNodeId:{},statusData:{},pathEdgeIds:[],setTaskStatuses:o=>{o!=null&&o.length&&e(n=>{let r=_({},n.statusByNodeId),i=_({},n.statusData),s=!1;return o.forEach(a=>{let l=`${a.diagramId}-${a.activityId}`;r[a.diagramId]!==a.status&&(r[a.diagramId]=a.status,i[l]=a,s=!0)}),s?{statusByNodeId:r,statusData:i}:n})},getTaskStatus:o=>t().statusByNodeId[o]||null,clearTaskStatuses:()=>e({statusByNodeId:{},statusData:{},pathEdgeIds:[]}),setPathEdges:o=>{e({pathEdgeIds:o})},getPathEdgeIds:()=>t().pathEdgeIds,clearPathEdges:()=>{e({pathEdgeIds:[]})},calculateFlowPath:(o,n)=>{if(!o.length||!n.length)return;t().clearPathEdges();let r=n.filter(d=>t().statusByNodeId[d]);if(r.length<=1)return;let i=[],s={};o.forEach(d=>{s[d.source]||(s[d.source]=[]),s[d.source].push({targetId:d.target,edgeId:d.id})});let a=r[0],l=r[r.length-1];o.forEach(d=>{d.target===a&&i.push(d.id)}),o.forEach(d=>{d.source===l&&i.push(d.id)});let c=(d,f)=>{let u=[],p=new Set;for(u.push({node:d,path:[]}),p.add(d);u.length>0;){let{node:h,path:m}=u.shift();if(h===f)return m;let g=s[h]||[];for(let{targetId:T,edgeId:x}of g)p.has(T)||(p.add(T),u.push({node:T,path:[...m,x]}))}return[]};for(let d=0;d<r.length-1;d++){let f=r[d],u=r[d+1],p=c(f,u);p.length>0&&i.push(...p)}i.length>0&&e({pathEdgeIds:i})}}));var so=require("@xyflow/react");var Cu={value:()=>{}};function ns(){for(var e=0,t=arguments.length,o={},n;e<t;++e){if(!(n=arguments[e]+"")||n in o||/[\s.]/.test(n))throw new Error("illegal type: "+n);o[n]=[]}return new Sn(o)}function Sn(e){this._=e}function Iu(e,t){return e.trim().split(/^|\s+/).map(function(o){var n="",r=o.indexOf(".");if(r>=0&&(n=o.slice(r+1),o=o.slice(0,r)),o&&!t.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:n}})}Sn.prototype=ns.prototype={constructor:Sn,on:function(e,t){var o=this._,n=Iu(e+"",o),r,i=-1,s=n.length;if(arguments.length<2){for(;++i<s;)if((r=(e=n[i]).type)&&(r=Su(o[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=n[i]).type)o[r]=os(o[r],e.name,t);else if(t==null)for(r in o)o[r]=os(o[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var o in t)e[o]=t[o].slice();return new Sn(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var o=new Array(r),n=0,r,i;n<r;++n)o[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],n=0,r=i.length;n<r;++n)i[n].value.apply(t,o)},apply:function(e,t,o){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],r=0,i=n.length;r<i;++r)n[r].value.apply(t,o)}};function Su(e,t){for(var o=0,n=e.length,r;o<n;++o)if((r=e[o]).name===t)return r.value}function os(e,t,o){for(var n=0,r=e.length;n<r;++n)if(e[n].name===t){e[n]=Cu,e=e.slice(0,n).concat(e.slice(n+1));break}return o!=null&&e.push({name:t,value:o}),e}var Xr=ns;var Mn="http://www.w3.org/1999/xhtml",Kr={svg:"http://www.w3.org/2000/svg",xhtml:Mn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ze(e){var t=e+="",o=t.indexOf(":");return o>=0&&(t=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),Kr.hasOwnProperty(t)?{space:Kr[t],local:e}:e}function Mu(e){return function(){var t=this.ownerDocument,o=this.namespaceURI;return o===Mn&&t.documentElement.namespaceURI===Mn?t.createElement(e):t.createElementNS(o,e)}}function Pu(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Pn(e){var t=Ze(e);return(t.local?Pu:Mu)(t)}function Lu(){}function wt(e){return e==null?Lu:function(){return this.querySelector(e)}}function rs(e){typeof e!="function"&&(e=wt(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=new Array(s),l,c,d=0;d<s;++d)(l=i[d])&&(c=e.call(l,l.__data__,d,i))&&("__data__"in l&&(c.__data__=l.__data__),a[d]=c);return new ee(n,this._parents)}function qr(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ku(){return[]}function Do(e){return e==null?ku:function(){return this.querySelectorAll(e)}}function Du(e){return function(){return qr(e.apply(this,arguments))}}function is(e){typeof e=="function"?e=Du(e):e=Do(e);for(var t=this._groups,o=t.length,n=[],r=[],i=0;i<o;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(n.push(e.call(l,l.__data__,c,s)),r.push(l));return new ee(n,r)}function Ro(e){return function(){return this.matches(e)}}function Ln(e){return function(t){return t.matches(e)}}var Ru=Array.prototype.find;function Vu(e){return function(){return Ru.call(this.children,e)}}function Ou(){return this.firstElementChild}function ss(e){return this.select(e==null?Ou:Vu(typeof e=="function"?e:Ln(e)))}var Hu=Array.prototype.filter;function Gu(){return Array.from(this.children)}function Bu(e){return function(){return Hu.call(this.children,e)}}function as(e){return this.selectAll(e==null?Gu:Bu(typeof e=="function"?e:Ln(e)))}function ls(e){typeof e!="function"&&(e=Ro(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new ee(n,this._parents)}function kn(e){return new Array(e.length)}function cs(){return new ee(this._enter||this._groups.map(kn),this._parents)}function Vo(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Vo.prototype={constructor:Vo,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function ds(e){return function(){return e}}function zu(e,t,o,n,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],n[s]=a):o[s]=new Vo(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Fu(e,t,o,n,r,i,s){var a,l,c=new Map,d=t.length,f=i.length,u=new Array(d),p;for(a=0;a<d;++a)(l=t[a])&&(u[a]=p=s.call(l,l.__data__,a,t)+"",c.has(p)?r[a]=l:c.set(p,l));for(a=0;a<f;++a)p=s.call(e,i[a],a,i)+"",(l=c.get(p))?(n[a]=l,l.__data__=i[a],c.delete(p)):o[a]=new Vo(e,i[a]);for(a=0;a<d;++a)(l=t[a])&&c.get(u[a])===l&&(r[a]=l)}function Wu(e){return e.__data__}function us(e,t){if(!arguments.length)return Array.from(this,Wu);var o=t?Fu:zu,n=this._parents,r=this._groups;typeof e!="function"&&(e=ds(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=n[c],f=r[c],u=f.length,p=Uu(e.call(d,d&&d.__data__,c,n)),h=p.length,m=a[c]=new Array(h),g=s[c]=new Array(h),T=l[c]=new Array(u);o(d,f,m,g,T,p,t);for(var x=0,y=0,E,b;x<h;++x)if(E=m[x]){for(x>=y&&(y=x+1);!(b=g[y])&&++y<h;);E._next=b||null}}return s=new ee(s,n),s._enter=a,s._exit=l,s}function Uu(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ps(){return new ee(this._exit||this._groups.map(kn),this._parents)}function fs(e,t,o){var n=this.enter(),r=this,i=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),o==null?i.remove():o(i),n&&r?n.merge(r).order():r}function ms(e){for(var t=e.selection?e.selection():e,o=this._groups,n=t._groups,r=o.length,i=n.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c=o[l],d=n[l],f=c.length,u=a[l]=new Array(f),p,h=0;h<f;++h)(p=c[h]||d[h])&&(u[h]=p);for(;l<r;++l)a[l]=o[l];return new ee(a,this._parents)}function gs(){for(var e=this._groups,t=-1,o=e.length;++t<o;)for(var n=e[t],r=n.length-1,i=n[r],s;--r>=0;)(s=n[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function hs(e){e||(e=Yu);function t(f,u){return f&&u?e(f.__data__,u.__data__):!f-!u}for(var o=this._groups,n=o.length,r=new Array(n),i=0;i<n;++i){for(var s=o[i],a=s.length,l=r[i]=new Array(a),c,d=0;d<a;++d)(c=s[d])&&(l[d]=c);l.sort(t)}return new ee(r,this._parents).order()}function Yu(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ys(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xs(){return Array.from(this)}function Es(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length;r<i;++r){var s=n[r];if(s)return s}return null}function _s(){let e=0;for(let t of this)++e;return e}function bs(){return!this.node()}function Ts(e){for(var t=this._groups,o=0,n=t.length;o<n;++o)for(var r=t[o],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function $u(e){return function(){this.removeAttribute(e)}}function Xu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ku(e,t){return function(){this.setAttribute(e,t)}}function qu(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Zu(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttribute(e):this.setAttribute(e,o)}}function Ju(e,t){return function(){var o=t.apply(this,arguments);o==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,o)}}function vs(e,t){var o=Ze(e);if(arguments.length<2){var n=this.node();return o.local?n.getAttributeNS(o.space,o.local):n.getAttribute(o)}return this.each((t==null?o.local?Xu:$u:typeof t=="function"?o.local?Ju:Zu:o.local?qu:Ku)(o,t))}function Dn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Qu(e){return function(){this.style.removeProperty(e)}}function ju(e,t,o){return function(){this.style.setProperty(e,t,o)}}function ep(e,t,o){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,o)}}function Ns(e,t,o){return arguments.length>1?this.each((t==null?Qu:typeof t=="function"?ep:ju)(e,t,o==null?"":o)):ct(this.node(),e)}function ct(e,t){return e.style.getPropertyValue(t)||Dn(e).getComputedStyle(e,null).getPropertyValue(t)}function tp(e){return function(){delete this[e]}}function op(e,t){return function(){this[e]=t}}function np(e,t){return function(){var o=t.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function ws(e,t){return arguments.length>1?this.each((t==null?tp:typeof t=="function"?np:op)(e,t)):this.node()[e]}function As(e){return e.trim().split(/^|\s+/)}function Zr(e){return e.classList||new Cs(e)}function Cs(e){this._node=e,this._names=As(e.getAttribute("class")||"")}Cs.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Is(e,t){for(var o=Zr(e),n=-1,r=t.length;++n<r;)o.add(t[n])}function Ss(e,t){for(var o=Zr(e),n=-1,r=t.length;++n<r;)o.remove(t[n])}function rp(e){return function(){Is(this,e)}}function ip(e){return function(){Ss(this,e)}}function sp(e,t){return function(){(t.apply(this,arguments)?Is:Ss)(this,e)}}function Ms(e,t){var o=As(e+"");if(arguments.length<2){for(var n=Zr(this.node()),r=-1,i=o.length;++r<i;)if(!n.contains(o[r]))return!1;return!0}return this.each((typeof t=="function"?sp:t?rp:ip)(o,t))}function ap(){this.textContent=""}function lp(e){return function(){this.textContent=e}}function cp(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function Ps(e){return arguments.length?this.each(e==null?ap:(typeof e=="function"?cp:lp)(e)):this.node().textContent}function dp(){this.innerHTML=""}function up(e){return function(){this.innerHTML=e}}function pp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function Ls(e){return arguments.length?this.each(e==null?dp:(typeof e=="function"?pp:up)(e)):this.node().innerHTML}function fp(){this.nextSibling&&this.parentNode.appendChild(this)}function ks(){return this.each(fp)}function mp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ds(){return this.each(mp)}function Rs(e){var t=typeof e=="function"?e:Pn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function gp(){return null}function Vs(e,t){var o=typeof e=="function"?e:Pn(e),n=t==null?gp:typeof t=="function"?t:wt(t);return this.select(function(){return this.insertBefore(o.apply(this,arguments),n.apply(this,arguments)||null)})}function hp(){var e=this.parentNode;e&&e.removeChild(this)}function Os(){return this.each(hp)}function yp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function xp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hs(e){return this.select(e?xp:yp)}function Gs(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ep(e){return function(t){e.call(this,t,this.__data__)}}function _p(e){return e.trim().split(/^|\s+/).map(function(t){var o="",n=t.indexOf(".");return n>=0&&(o=t.slice(n+1),t=t.slice(0,n)),{type:t,name:o}})}function bp(e){return function(){var t=this.__on;if(t){for(var o=0,n=-1,r=t.length,i;o<r;++o)i=t[o],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++n]=i;++n?t.length=n:delete this.__on}}}function Tp(e,t,o){return function(){var n=this.__on,r,i=Ep(t);if(n){for(var s=0,a=n.length;s<a;++s)if((r=n[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=o),r.value=t;return}}this.addEventListener(e.type,i,o),r={type:e.type,name:e.name,value:t,listener:i,options:o},n?n.push(r):this.__on=[r]}}function Bs(e,t,o){var n=_p(e+""),r,i=n.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,d;l<c;++l)for(r=0,d=a[l];r<i;++r)if((s=n[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Tp:bp,r=0;r<i;++r)this.each(a(n[r],t,o));return this}function zs(e,t,o){var n=Dn(e),r=n.CustomEvent;typeof r=="function"?r=new r(t,o):(r=n.document.createEvent("Event"),o?(r.initEvent(t,o.bubbles,o.cancelable),r.detail=o.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function vp(e,t){return function(){return zs(this,e,t)}}function Np(e,t){return function(){return zs(this,e,t.apply(this,arguments))}}function Fs(e,t){return this.each((typeof t=="function"?Np:vp)(e,t))}function*Ws(){for(var e=this._groups,t=0,o=e.length;t<o;++t)for(var n=e[t],r=0,i=n.length,s;r<i;++r)(s=n[r])&&(yield s)}var wp=[null];function ee(e,t){this._groups=e,this._parents=t}function Us(){return new ee([[document.documentElement]],wp)}function Ap(){return this}ee.prototype=Us.prototype={constructor:ee,select:rs,selectAll:is,selectChild:ss,selectChildren:as,filter:ls,data:us,enter:cs,exit:ps,join:fs,merge:ms,selection:Ap,order:gs,sort:hs,call:ys,nodes:xs,node:Es,size:_s,empty:bs,each:Ts,attr:vs,style:Ns,property:ws,classed:Ms,text:Ps,html:Ls,raise:ks,lower:Ds,append:Rs,insert:Vs,remove:Os,clone:Hs,datum:Gs,on:Bs,dispatch:Fs,[Symbol.iterator]:Ws};var Je=Us;function Rn(e,t,o){e.prototype=t.prototype=o,o.constructor=e}function Jr(e,t){var o=Object.create(e.prototype);for(var n in t)o[n]=t[n];return o}function Go(){}var Oo=.7,Hn=1/Oo,oo="\\s*([+-]?\\d+)\\s*",Ho="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Cp=/^#([0-9a-f]{3,8})$/,Ip=new RegExp(`^rgb\\(${oo},${oo},${oo}\\)$`),Sp=new RegExp(`^rgb\\(${Be},${Be},${Be}\\)$`),Mp=new RegExp(`^rgba\\(${oo},${oo},${oo},${Ho}\\)$`),Pp=new RegExp(`^rgba\\(${Be},${Be},${Be},${Ho}\\)$`),Lp=new RegExp(`^hsl\\(${Ho},${Be},${Be}\\)$`),kp=new RegExp(`^hsla\\(${Ho},${Be},${Be},${Ho}\\)$`),Ys={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Rn(Go,dt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:$s,formatHex:$s,formatHex8:Dp,formatHsl:Rp,formatRgb:Xs,toString:Xs});function $s(){return this.rgb().formatHex()}function Dp(){return this.rgb().formatHex8()}function Rp(){return js(this).formatHsl()}function Xs(){return this.rgb().formatRgb()}function dt(e){var t,o;return e=(e+"").trim().toLowerCase(),(t=Cp.exec(e))?(o=t[1].length,t=parseInt(t[1],16),o===6?Ks(t):o===3?new xe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):o===8?Vn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):o===4?Vn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ip.exec(e))?new xe(t[1],t[2],t[3],1):(t=Sp.exec(e))?new xe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Mp.exec(e))?Vn(t[1],t[2],t[3],t[4]):(t=Pp.exec(e))?Vn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Lp.exec(e))?Js(t[1],t[2]/100,t[3]/100,1):(t=kp.exec(e))?Js(t[1],t[2]/100,t[3]/100,t[4]):Ys.hasOwnProperty(e)?Ks(Ys[e]):e==="transparent"?new xe(NaN,NaN,NaN,0):null}function Ks(e){return new xe(e>>16&255,e>>8&255,e&255,1)}function Vn(e,t,o,n){return n<=0&&(e=t=o=NaN),new xe(e,t,o,n)}function Vp(e){return e instanceof Go||(e=dt(e)),e?(e=e.rgb(),new xe(e.r,e.g,e.b,e.opacity)):new xe}function no(e,t,o,n){return arguments.length===1?Vp(e):new xe(e,t,o,n==null?1:n)}function xe(e,t,o,n){this.r=+e,this.g=+t,this.b=+o,this.opacity=+n}Rn(xe,no,Jr(Go,{brighter(e){return e=e==null?Hn:Math.pow(Hn,e),new xe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Oo:Math.pow(Oo,e),new xe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xe(Ct(this.r),Ct(this.g),Ct(this.b),Gn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:qs,formatHex:qs,formatHex8:Op,formatRgb:Zs,toString:Zs}));function qs(){return`#${At(this.r)}${At(this.g)}${At(this.b)}`}function Op(){return`#${At(this.r)}${At(this.g)}${At(this.b)}${At((isNaN(this.opacity)?1:this.opacity)*255)}`}function Zs(){let e=Gn(this.opacity);return`${e===1?"rgb(":"rgba("}${Ct(this.r)}, ${Ct(this.g)}, ${Ct(this.b)}${e===1?")":`, ${e})`}`}function Gn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ct(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function At(e){return e=Ct(e),(e<16?"0":"")+e.toString(16)}function Js(e,t,o,n){return n<=0?e=t=o=NaN:o<=0||o>=1?e=t=NaN:t<=0&&(e=NaN),new Re(e,t,o,n)}function js(e){if(e instanceof Re)return new Re(e.h,e.s,e.l,e.opacity);if(e instanceof Go||(e=dt(e)),!e)return new Re;if(e instanceof Re)return e;e=e.rgb();var t=e.r/255,o=e.g/255,n=e.b/255,r=Math.min(t,o,n),i=Math.max(t,o,n),s=NaN,a=i-r,l=(i+r)/2;return a?(t===i?s=(o-n)/a+(o<n)*6:o===i?s=(n-t)/a+2:s=(t-o)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new Re(s,a,l,e.opacity)}function ea(e,t,o,n){return arguments.length===1?js(e):new Re(e,t,o,n==null?1:n)}function Re(e,t,o,n){this.h=+e,this.s=+t,this.l=+o,this.opacity=+n}Rn(Re,ea,Jr(Go,{brighter(e){return e=e==null?Hn:Math.pow(Hn,e),new Re(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Oo:Math.pow(Oo,e),new Re(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,n=o+(o<.5?o:1-o)*t,r=2*o-n;return new xe(Qr(e>=240?e-240:e+120,r,n),Qr(e,r,n),Qr(e<120?e+240:e-120,r,n),this.opacity)},clamp(){return new Re(Qs(this.h),On(this.s),On(this.l),Gn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Gn(this.opacity);return`${e===1?"hsl(":"hsla("}${Qs(this.h)}, ${On(this.s)*100}%, ${On(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Qs(e){return e=(e||0)%360,e<0?e+360:e}function On(e){return Math.max(0,Math.min(1,e||0))}function Qr(e,t,o){return(e<60?t+(o-t)*e/60:e<180?o:e<240?t+(o-t)*(240-e)/60:t)*255}function jr(e,t,o,n,r){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*o+(1+3*e+3*i-3*s)*n+s*r)/6}function ta(e){var t=e.length-1;return function(o){var n=o<=0?o=0:o>=1?(o=1,t-1):Math.floor(o*t),r=e[n],i=e[n+1],s=n>0?e[n-1]:2*r-i,a=n<t-1?e[n+2]:2*i-r;return jr((o-n/t)*t,s,r,i,a)}}function oa(e){var t=e.length;return function(o){var n=Math.floor(((o%=1)<0?++o:o)*t),r=e[(n+t-1)%t],i=e[n%t],s=e[(n+1)%t],a=e[(n+2)%t];return jr((o-n/t)*t,r,i,s,a)}}var ei=e=>()=>e;function Hp(e,t){return function(o){return e+o*t}}function Gp(e,t,o){return e=Math.pow(e,o),t=Math.pow(t,o)-e,o=1/o,function(n){return Math.pow(e+n*t,o)}}function na(e){return(e=+e)==1?Bn:function(t,o){return o-t?Gp(t,o,e):ei(isNaN(t)?o:t)}}function Bn(e,t){var o=t-e;return o?Hp(e,o):ei(isNaN(e)?t:e)}var zn=function e(t){var o=na(t);function n(r,i){var s=o((r=no(r)).r,(i=no(i)).r),a=o(r.g,i.g),l=o(r.b,i.b),c=Bn(r.opacity,i.opacity);return function(d){return r.r=s(d),r.g=a(d),r.b=l(d),r.opacity=c(d),r+""}}return n.gamma=e,n}(1);function ra(e){return function(t){var o=t.length,n=new Array(o),r=new Array(o),i=new Array(o),s,a;for(s=0;s<o;++s)a=no(t[s]),n[s]=a.r||0,r[s]=a.g||0,i[s]=a.b||0;return n=e(n),r=e(r),i=e(i),a.opacity=1,function(l){return a.r=n(l),a.g=r(l),a.b=i(l),a+""}}}var Bp=ra(ta),zp=ra(oa);function Le(e,t){return e=+e,t=+t,function(o){return e*(1-o)+t*o}}var oi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ti=new RegExp(oi.source,"g");function Fp(e){return function(){return e}}function Wp(e){return function(t){return e(t)+""}}function ni(e,t){var o=oi.lastIndex=ti.lastIndex=0,n,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(n=oi.exec(e))&&(r=ti.exec(t));)(i=r.index)>o&&(i=t.slice(o,i),a[s]?a[s]+=i:a[++s]=i),(n=n[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,l.push({i:s,x:Le(n,r)})),o=ti.lastIndex;return o<t.length&&(i=t.slice(o),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Wp(l[0].x):Fp(t):(t=l.length,function(c){for(var d=0,f;d<t;++d)a[(f=l[d]).i]=f.x(c);return a.join("")})}var ia=180/Math.PI,Fn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ri(e,t,o,n,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*o+t*n)&&(o-=e*l,n-=t*l),(a=Math.sqrt(o*o+n*n))&&(o/=a,n/=a,l/=a),e*n<t*o&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*ia,skewX:Math.atan(l)*ia,scaleX:s,scaleY:a}}var Wn;function sa(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Fn:ri(t.a,t.b,t.c,t.d,t.e,t.f)}function aa(e){return e==null?Fn:(Wn||(Wn=document.createElementNS("http://www.w3.org/2000/svg","g")),Wn.setAttribute("transform",e),(e=Wn.transform.baseVal.consolidate())?(e=e.matrix,ri(e.a,e.b,e.c,e.d,e.e,e.f)):Fn)}function la(e,t,o,n){function r(c){return c.length?c.pop()+" ":""}function i(c,d,f,u,p,h){if(c!==f||d!==u){var m=p.push("translate(",null,t,null,o);h.push({i:m-4,x:Le(c,f)},{i:m-2,x:Le(d,u)})}else(f||u)&&p.push("translate("+f+t+u+o)}function s(c,d,f,u){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),u.push({i:f.push(r(f)+"rotate(",null,n)-2,x:Le(c,d)})):d&&f.push(r(f)+"rotate("+d+n)}function a(c,d,f,u){c!==d?u.push({i:f.push(r(f)+"skewX(",null,n)-2,x:Le(c,d)}):d&&f.push(r(f)+"skewX("+d+n)}function l(c,d,f,u,p,h){if(c!==f||d!==u){var m=p.push(r(p)+"scale(",null,",",null,")");h.push({i:m-4,x:Le(c,f)},{i:m-2,x:Le(d,u)})}else(f!==1||u!==1)&&p.push(r(p)+"scale("+f+","+u+")")}return function(c,d){var f=[],u=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,f,u),s(c.rotate,d.rotate,f,u),a(c.skewX,d.skewX,f,u),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,u),c=d=null,function(p){for(var h=-1,m=u.length,g;++h<m;)f[(g=u[h]).i]=g.x(p);return f.join("")}}}var ii=la(sa,"px, ","px)","deg)"),si=la(aa,", ",")",")");var ro=0,zo=0,Bo=0,da=1e3,Un,Fo,Yn=0,It=0,$n=0,Wo=typeof performance=="object"&&performance.now?performance:Date,ua=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Yo(){return It||(ua(Up),It=Wo.now()+$n)}function Up(){It=0}function Uo(){this._call=this._time=this._next=null}Uo.prototype=Xn.prototype={constructor:Uo,restart:function(e,t,o){if(typeof e!="function")throw new TypeError("callback is not a function");o=(o==null?Yo():+o)+(t==null?0:+t),!this._next&&Fo!==this&&(Fo?Fo._next=this:Un=this,Fo=this),this._call=e,this._time=o,ai()},stop:function(){this._call&&(this._call=null,this._time=1/0,ai())}};function Xn(e,t,o){var n=new Uo;return n.restart(e,t,o),n}function pa(){Yo(),++ro;for(var e=Un,t;e;)(t=It-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ro}function ca(){It=(Yn=Wo.now())+$n,ro=zo=0;try{pa()}finally{ro=0,$p(),It=0}}function Yp(){var e=Wo.now(),t=e-Yn;t>da&&($n-=t,Yn=e)}function $p(){for(var e,t=Un,o,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(o=t._next,t._next=null,t=e?e._next=o:Un=o);Fo=e,ai(n)}function ai(e){if(!ro){zo&&(zo=clearTimeout(zo));var t=e-It;t>24?(e<1/0&&(zo=setTimeout(ca,e-Wo.now()-$n)),Bo&&(Bo=clearInterval(Bo))):(Bo||(Yn=Wo.now(),Bo=setInterval(Yp,da)),ro=1,ua(ca))}}function Kn(e,t,o){var n=new Uo;return t=t==null?0:+t,n.restart(r=>{n.stop(),e(r+t)},t,o),n}var Xp=Xr("start","end","cancel","interrupt"),Kp=[],ga=0,fa=1,Zn=2,qn=3,ma=4,Jn=5,$o=6;function ut(e,t,o,n,r,i){var s=e.__transition;if(!s)e.__transition={};else if(o in s)return;qp(e,o,{name:t,index:n,group:r,on:Xp,tween:Kp,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ga})}function Xo(e,t){var o=te(e,t);if(o.state>ga)throw new Error("too late; already scheduled");return o}function se(e,t){var o=te(e,t);if(o.state>qn)throw new Error("too late; already running");return o}function te(e,t){var o=e.__transition;if(!o||!(o=o[t]))throw new Error("transition not found");return o}function qp(e,t,o){var n=e.__transition,r;n[t]=o,o.timer=Xn(i,0,o.time);function i(c){o.state=fa,o.timer.restart(s,o.delay,o.time),o.delay<=c&&s(c-o.delay)}function s(c){var d,f,u,p;if(o.state!==fa)return l();for(d in n)if(p=n[d],p.name===o.name){if(p.state===qn)return Kn(s);p.state===ma?(p.state=$o,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete n[d]):+d<t&&(p.state=$o,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete n[d])}if(Kn(function(){o.state===qn&&(o.state=ma,o.timer.restart(a,o.delay,o.time),a(c))}),o.state=Zn,o.on.call("start",e,e.__data__,o.index,o.group),o.state===Zn){for(o.state=qn,r=new Array(u=o.tween.length),d=0,f=-1;d<u;++d)(p=o.tween[d].value.call(e,e.__data__,o.index,o.group))&&(r[++f]=p);r.length=f+1}}function a(c){for(var d=c<o.duration?o.ease.call(null,c/o.duration):(o.timer.restart(l),o.state=Jn,1),f=-1,u=r.length;++f<u;)r[f].call(e,d);o.state===Jn&&(o.on.call("end",e,e.__data__,o.index,o.group),l())}function l(){o.state=$o,o.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function li(e,t){var o=e.__transition,n,r,i=!0,s;if(o){t=t==null?null:t+"";for(s in o){if((n=o[s]).name!==t){i=!1;continue}r=n.state>Zn&&n.state<Jn,n.state=$o,n.timer.stop(),n.on.call(r?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete o[s]}i&&delete e.__transition}}function ha(e){return this.each(function(){li(this,e)})}function Zp(e,t){var o,n;return function(){var r=se(this,e),i=r.tween;if(i!==o){n=o=i;for(var s=0,a=n.length;s<a;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}r.tween=n}}function Jp(e,t,o){var n,r;if(typeof o!="function")throw new Error;return function(){var i=se(this,e),s=i.tween;if(s!==n){r=(n=s).slice();for(var a={name:t,value:o},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function ya(e,t){var o=this._id;if(e+="",arguments.length<2){for(var n=te(this.node(),o).tween,r=0,i=n.length,s;r<i;++r)if((s=n[r]).name===e)return s.value;return null}return this.each((t==null?Zp:Jp)(o,e,t))}function io(e,t,o){var n=e._id;return e.each(function(){var r=se(this,n);(r.value||(r.value={}))[t]=o.apply(this,arguments)}),function(r){return te(r,n).value[t]}}function Qn(e,t){var o;return(typeof t=="number"?Le:t instanceof dt?zn:(o=dt(t))?(t=o,zn):ni)(e,t)}function Qp(e){return function(){this.removeAttribute(e)}}function jp(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ef(e,t,o){var n,r=o+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===n?i:i=t(n=s,o)}}function tf(e,t,o){var n,r=o+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===n?i:i=t(n=s,o)}}function of(e,t,o){var n,r,i;return function(){var s,a=o(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a)))}}function nf(e,t,o){var n,r,i;return function(){var s,a=o(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a)))}}function xa(e,t){var o=Ze(e),n=o==="transform"?si:Qn;return this.attrTween(e,typeof t=="function"?(o.local?nf:of)(o,n,io(this,"attr."+e,t)):t==null?(o.local?jp:Qp)(o):(o.local?tf:ef)(o,n,t))}function rf(e,t){return function(o){this.setAttribute(e,t.call(this,o))}}function sf(e,t){return function(o){this.setAttributeNS(e.space,e.local,t.call(this,o))}}function af(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&sf(e,i)),o}return r._value=t,r}function lf(e,t){var o,n;function r(){var i=t.apply(this,arguments);return i!==n&&(o=(n=i)&&rf(e,i)),o}return r._value=t,r}function Ea(e,t){var o="attr."+e;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;var n=Ze(e);return this.tween(o,(n.local?af:lf)(n,t))}function cf(e,t){return function(){Xo(this,e).delay=+t.apply(this,arguments)}}function df(e,t){return t=+t,function(){Xo(this,e).delay=t}}function _a(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cf:df)(t,e)):te(this.node(),t).delay}function uf(e,t){return function(){se(this,e).duration=+t.apply(this,arguments)}}function pf(e,t){return t=+t,function(){se(this,e).duration=t}}function ba(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?uf:pf)(t,e)):te(this.node(),t).duration}function ff(e,t){if(typeof t!="function")throw new Error;return function(){se(this,e).ease=t}}function Ta(e){var t=this._id;return arguments.length?this.each(ff(t,e)):te(this.node(),t).ease}function mf(e,t){return function(){var o=t.apply(this,arguments);if(typeof o!="function")throw new Error;se(this,e).ease=o}}function va(e){if(typeof e!="function")throw new Error;return this.each(mf(this._id,e))}function Na(e){typeof e!="function"&&(e=Ro(e));for(var t=this._groups,o=t.length,n=new Array(o),r=0;r<o;++r)for(var i=t[r],s=i.length,a=n[r]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new me(n,this._parents,this._name,this._id)}function wa(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,o=e._groups,n=t.length,r=o.length,i=Math.min(n,r),s=new Array(n),a=0;a<i;++a)for(var l=t[a],c=o[a],d=l.length,f=s[a]=new Array(d),u,p=0;p<d;++p)(u=l[p]||c[p])&&(f[p]=u);for(;a<n;++a)s[a]=t[a];return new me(s,this._parents,this._name,this._id)}function gf(e){return(e+"").trim().split(/^|\s+/).every(function(t){var o=t.indexOf(".");return o>=0&&(t=t.slice(0,o)),!t||t==="start"})}function hf(e,t,o){var n,r,i=gf(t)?Xo:se;return function(){var s=i(this,e),a=s.on;a!==n&&(r=(n=a).copy()).on(t,o),s.on=r}}function Aa(e,t){var o=this._id;return arguments.length<2?te(this.node(),o).on.on(e):this.each(hf(o,e,t))}function yf(e){return function(){var t=this.parentNode;for(var o in this.__transition)if(+o!==e)return;t&&t.removeChild(this)}}function Ca(){return this.on("end.remove",yf(this._id))}function Ia(e){var t=this._name,o=this._id;typeof e!="function"&&(e=wt(e));for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s)for(var a=n[s],l=a.length,c=i[s]=new Array(l),d,f,u=0;u<l;++u)(d=a[u])&&(f=e.call(d,d.__data__,u,a))&&("__data__"in d&&(f.__data__=d.__data__),c[u]=f,ut(c[u],t,o,u,c,te(d,o)));return new me(i,this._parents,t,o)}function Sa(e){var t=this._name,o=this._id;typeof e!="function"&&(e=Do(e));for(var n=this._groups,r=n.length,i=[],s=[],a=0;a<r;++a)for(var l=n[a],c=l.length,d,f=0;f<c;++f)if(d=l[f]){for(var u=e.call(d,d.__data__,f,l),p,h=te(d,o),m=0,g=u.length;m<g;++m)(p=u[m])&&ut(p,t,o,m,u,h);i.push(u),s.push(d)}return new me(i,s,t,o)}var xf=Je.prototype.constructor;function Ma(){return new xf(this._groups,this._parents)}function Ef(e,t){var o,n,r;return function(){var i=ct(this,e),s=(this.style.removeProperty(e),ct(this,e));return i===s?null:i===o&&s===n?r:r=t(o=i,n=s)}}function Pa(e){return function(){this.style.removeProperty(e)}}function _f(e,t,o){var n,r=o+"",i;return function(){var s=ct(this,e);return s===r?null:s===n?i:i=t(n=s,o)}}function bf(e,t,o){var n,r,i;return function(){var s=ct(this,e),a=o(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),ct(this,e))),s===l?null:s===n&&l===r?i:(r=l,i=t(n=s,a))}}function Tf(e,t){var o,n,r,i="style."+t,s="end."+i,a;return function(){var l=se(this,e),c=l.on,d=l.value[i]==null?a||(a=Pa(t)):void 0;(c!==o||r!==d)&&(n=(o=c).copy()).on(s,r=d),l.on=n}}function La(e,t,o){var n=(e+="")=="transform"?ii:Qn;return t==null?this.styleTween(e,Ef(e,n)).on("end.style."+e,Pa(e)):typeof t=="function"?this.styleTween(e,bf(e,n,io(this,"style."+e,t))).each(Tf(this._id,e)):this.styleTween(e,_f(e,n,t),o).on("end.style."+e,null)}function vf(e,t,o){return function(n){this.style.setProperty(e,t.call(this,n),o)}}function Nf(e,t,o){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&vf(e,s,o)),n}return i._value=t,i}function ka(e,t,o){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,Nf(e,t,o==null?"":o))}function wf(e){return function(){this.textContent=e}}function Af(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function Da(e){return this.tween("text",typeof e=="function"?Af(io(this,"text",e)):wf(e==null?"":e+""))}function Cf(e){return function(t){this.textContent=e.call(this,t)}}function If(e){var t,o;function n(){var r=e.apply(this,arguments);return r!==o&&(t=(o=r)&&Cf(r)),t}return n._value=e,n}function Ra(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,If(e))}function Va(){for(var e=this._name,t=this._id,o=jn(),n=this._groups,r=n.length,i=0;i<r;++i)for(var s=n[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var d=te(l,t);ut(l,e,o,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new me(n,this._parents,e,o)}function Oa(){var e,t,o=this,n=o._id,r=o.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};o.each(function(){var c=se(this,n),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var Sf=0;function me(e,t,o,n){this._groups=e,this._parents=t,this._name=o,this._id=n}function Ha(e){return Je().transition(e)}function jn(){return++Sf}var Qe=Je.prototype;me.prototype=Ha.prototype={constructor:me,select:Ia,selectAll:Sa,selectChild:Qe.selectChild,selectChildren:Qe.selectChildren,filter:Na,merge:wa,selection:Ma,transition:Va,call:Qe.call,nodes:Qe.nodes,node:Qe.node,size:Qe.size,empty:Qe.empty,each:Qe.each,on:Aa,attr:xa,attrTween:Ea,style:La,styleTween:ka,text:Da,textTween:Ra,remove:Ca,tween:ya,delay:_a,duration:ba,ease:Ta,easeVarying:va,end:Oa,[Symbol.iterator]:Qe[Symbol.iterator]};function er(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Mf={time:null,delay:0,duration:250,ease:er};function Pf(e,t){for(var o;!(o=e.__transition)||!(o=o[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return o}function Ga(e){var t,o;e instanceof me?(t=e._id,e=e._name):(t=jn(),(o=Mf).time=Yo(),e=e==null?null:e+"");for(var n=this._groups,r=n.length,i=0;i<r;++i)for(var s=n[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&ut(l,e,t,c,s,o||Pf(l,t));return new me(n,this._parents,e,t)}Je.prototype.interrupt=ha;Je.prototype.transition=Ga;function pt(e,t,o){this.k=e,this.x=t,this.y=o}pt.prototype={constructor:pt,scale:function(e){return e===1?this:new pt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new pt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var tr=new pt(1,0,0);or.prototype=pt.prototype;function or(e){for(;!e.__zoom;)if(!(e=e.parentNode))return tr;return e.__zoom}var kf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]];var Ba;(function(e){e.Strict="strict",e.Loose="loose"})(Ba||(Ba={}));var za;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(za||(za={}));var Fa;(function(e){e.Partial="partial",e.Full="full"})(Fa||(Fa={}));var Wa;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Wa||(Wa={}));var Ua;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ua||(Ua={}));var Ee;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ee||(Ee={}));var Kx={[Ee.Left]:Ee.Right,[Ee.Right]:Ee.Left,[Ee.Top]:Ee.Bottom,[Ee.Bottom]:Ee.Top};var Df=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Rf=(e,t=[0,0])=>{var a;let{width:o,height:n}=Vf(e),r=(a=e.origin)!=null?a:t,i=o*r[0],s=n*r[1];return{x:e.position.x-i,y:e.position.y-s}};var Te=(e,t=[0,0])=>{var r,i,s,a,l,c,d,f;let{x:o,y:n}=Df(e)?e.internals.positionAbsolute:Rf(e,t);return{x:o,y:n,x2:o+((a=(s=(i=(r=e.measured)==null?void 0:r.width)!=null?i:e.width)!=null?s:e.initialWidth)!=null?a:0),y2:n+((f=(d=(c=(l=e.measured)==null?void 0:l.height)!=null?c:e.height)!=null?d:e.initialHeight)!=null?f:0)}};function Vf(e){var t,o,n,r,i,s,a,l;return{width:(r=(n=(o=(t=e.measured)==null?void 0:t.width)!=null?o:e.width)!=null?n:e.initialWidth)!=null?r:0,height:(l=(a=(s=(i=e.measured)==null?void 0:i.height)!=null?s:e.height)!=null?a:e.initialHeight)!=null?l:0}}var qx={[Ee.Left]:{x:-1,y:0},[Ee.Right]:{x:1,y:0},[Ee.Top]:{x:0,y:-1},[Ee.Bottom]:{x:0,y:1}};var Of={nodeOrigin:[0,0],nodeExtent:kf,elevateNodesOnSelect:!0,defaults:{}},Zx=N(_({},Of),{checkEquality:!0});var Ya;(function(e){e.Line="line",e.Handle="handle"})(Ya||(Ya={}));var Hf={width:0,height:0,x:0,y:0},Jx=N(_({},Hf),{pointerX:0,pointerY:0,aspectRatio:1});var ve=require("react"),qa=require("zustand/shallow");var nr=10,St={top:{orientation:"horizontal",resolve:(e,t)=>t.y},bottom:{orientation:"horizontal",resolve:(e,t)=>t.y2},left:{orientation:"vertical",resolve:(e,t)=>t.x},right:{orientation:"vertical",resolve:(e,t)=>t.x2},centerX:{orientation:"vertical",resolve:(e,t)=>(t.x+t.x2)/2},centerY:{orientation:"horizontal",resolve:(e,t)=>(t.y+t.y2)/2}};var Gf=(e,t)=>e.x<t.x2&&e.x2>t.x&&e.y<t.y2&&e.y2>t.y;function Bf(e,t){let o=Math.max(0,Math.min(e.x2,t.x2)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y2,t.y2)-Math.max(e.y,t.y));return o*n}function zf(e,t){let o=Math.max(0,Math.max(e.x-t.x2,t.x-e.x2)),n=Math.max(0,Math.max(e.y-t.y2,t.y-e.y2));return Math.sqrt(o*o+n*n)}var rr=class{constructor(){this.xLines=[];this.yLines=[]}initialize(t){this.xLines=t.filter(o=>o.orientation==="vertical"),this.yLines=t.filter(o=>o.orientation==="horizontal"),this.xLines.sort((o,n)=>o.position-n.position),this.yLines.sort((o,n)=>o.position-n.position),this.lastHorizontalLine=void 0,this.lastVerticalLine=void 0}search(t,o,n,r){let i=t==="horizontal"?this.yLines:this.xLines,[s,a]=t==="horizontal"?[r.y,r.y2]:[r.x,r.x2],l=[];for(let u of i){if(u.position<s)continue;if(u.position>a)break;if(u.node.id===n.id||u.node.parentId===n.id||!Gf(u.nodeBox,r))continue;let p=Math.abs(u.position-o);if(p>nr)continue;let m=Bf(u.nodeBox,Te(n))>0?0:zf(u.nodeBox,Te(n));l.push({line:u,lineDist:p,nodeDist:m})}let c=.5,d=t==="horizontal"?this.lastHorizontalLine:this.lastVerticalLine;l.sort((u,p)=>{if(d){if(u.line===d&&p.line!==d)return-1;if(p.line===d&&u.line!==d)return 1}return Math.abs(u.lineDist-p.lineDist)<=c?u.nodeDist-p.nodeDist:u.lineDist-p.lineDist});let f=l.length>0?l[0].line:void 0;return f&&(t==="horizontal"?this.lastHorizontalLine=f:this.lastVerticalLine=f),f}};function $a(e,t=St,o){let n=[];return e==null||e.forEach(r=>{let i=o(r.id);if(!i)throw new Error(`Node with id ${r.id} not found in internal nodes.`);let s=Te(i);Object.entries(t).forEach(([a,l])=>{var c;n.push({nodeBox:s,node:r,orientation:l.orientation,position:l.resolve(r,s),color:(c=r.style)==null?void 0:c.backgroundColor,anchorName:a})})}),n}function Xa(e,t,o,n,r=Object.keys(St)){let i=[];for(let a of r){let l=St[a],c=l.resolve(o,n),d=e.search(l.orientation,c,o,t);d&&i.push({anchorName:a,sourcePosition:c,anchor:l,line:d})}let s={horizontal:void 0,vertical:void 0};for(let a of i){let l=s[a.anchor.orientation],c=Math.abs(a.sourcePosition-a.line.position);(!l||c<Math.abs(l.sourcePosition-l.line.position))&&(s[a.anchor.orientation]=a)}return s}function Ka(e,t,o,n,r,i,s,a){var f,u,p,h,m,g,T,x;if(!(o!=null&&o.position))return{snappedX:!1,snappedY:!1};let l=!1,c=!1,d={x:o.position.x,y:o.position.y,x2:o.position.x+((u=(f=e.measured)==null?void 0:f.width)!=null?u:0),y2:o.position.y+((h=(p=e.measured)==null?void 0:p.height)!=null?h:0)};if(s){let E=s.anchor.resolve(e,d)-s.line.position;if(Math.abs(E)<=nr){if(o.position.y-=E,r!=null&&r.dimensions)if(n){let b=t.internals.positionAbsolute.y+((g=(m=e.measured)==null?void 0:m.height)!=null?g:0);r.dimensions.height=b-s.line.position}else r.dimensions.height=s.line.position-t.internals.positionAbsolute.y;c=!0}}if(a){let E=a.anchor.resolve(e,d)-a.line.position;if(Math.abs(E)<=nr){if(o.position.x-=E,r!=null&&r.dimensions)if(n){let b=t.internals.positionAbsolute.x+((x=(T=e.measured)==null?void 0:T.width)!=null?x:0);r.dimensions.width=b-a.line.position}else r.dimensions.width=a.line.position-t.internals.positionAbsolute.x;l=!0}}return i&&(l||c)&&(o.position.x-=i.position.x,o.position.y-=i.position.y),{snappedX:l,snappedY:c}}var Za=require("react/jsx-runtime"),Ff=new rr;function ao(){let[e,t]=(0,ve.useState)(void 0),[o,n]=(0,ve.useState)(void 0),{width:r,height:i}=(0,so.useStore)(g=>({width:g.width,height:g.height}),qa.shallow),s=(0,so.useNodesInitialized)(),a=(0,ve.useRef)(Ff),{screenToFlowPosition:l,getInternalNode:c,getNodes:d}=(0,so.useReactFlow)(),f=(0,ve.useCallback)(()=>{t(void 0),n(void 0)},[]),u=(0,ve.useCallback)(g=>{let T=g!=null?g:d();f();let x=$a(T,St,c);a.current.initialize(x)},[c,f,d]),p=(0,ve.useCallback)(()=>{setTimeout(()=>{u()},100)},[u]);(0,ve.useEffect)(()=>{s&&u(d())},[s,u,d]);let h=(0,ve.useCallback)((g,T)=>{var G,U,Y,Ie,fe;if(!a.current||g.length===0||g.length>2)return g;f();let x,y,E=Object.keys(St);g.length===1?g[0].type==="position"?x=g[0]:g[0].type==="dimensions"&&(y=g[0],E=["right","bottom"]):g[0].type==="position"&&g[1].type==="dimensions"&&g[1].dimensions&&(x=g[0],y=g[1],E=["top","left"]);let b=T.find(bt=>bt.id===g[0].id);if(!b)return g;let A=c(b.id);if(!A)throw new Error(`Node with id ${b.id} not found in internal nodes`);let v=c((G=A.parentId)!=null?G:""),C=Te(A);y!=null&&y.dimensions&&(C.x2=C.x+y.dimensions.width,C.y2=C.y+y.dimensions.height);let{x:L,y:w}=l({x:0,y:0}),{x:S,y:M}=l({x:r,y:i}),I={x:L,y:w,x2:S,y2:M},{horizontal:V,vertical:K}=Xa(a.current,I,b,C,E),z={id:b.id,type:"position",position:{x:A.internals.positionAbsolute.x,y:A.internals.positionAbsolute.y},dragging:!1};x!=null&&x.position&&z.position&&(v?(z.position.x=x.position.x+((Y=(U=v==null?void 0:v.position)==null?void 0:U.x)!=null?Y:0),z.position.y=x.position.y+((fe=(Ie=v==null?void 0:v.position)==null?void 0:Ie.y)!=null?fe:0)):(z.position.x=x.position.x,z.position.y=x.position.y));let{snappedX:J,snappedY:ne}=Ka(b,A,z,x,y,v,V,K);if(J||ne){if((y!=null&&y.resizing||x!=null&&x.dragging)&&(J&&n(K==null?void 0:K.line),ne&&t(V==null?void 0:V.line)),y&&x)return[z,y];if(x)return[z];if(y)return[y]}return g},[l,c,r,i,t,n,f]),m=(0,ve.useCallback)(()=>(0,Za.jsx)(Ja,{horizontal:e,vertical:o}),[e,o]);return{rebuildIndex:u,forceRebuildIndex:p,updateHelperLines:h,helperLineHorizontal:e,helperLineVertical:o,HelperLines:m}}var gr=require("@xyflow/react"),di=require("react");var Ve=require("@xyflow/react");var lo=require("@xyflow/react");function Qa(e,t){var y,E,b,A;let{width:o=0,height:n=0}=e.measured||{width:0,height:0},r=e.internals.positionAbsolute,i=t.internals.positionAbsolute,s=o/2,a=n/2,l=r.x+s,c=r.y+a,d=i.x+((E=(y=t==null?void 0:t.measured)==null?void 0:y.width)!=null?E:0)/2,f=i.y+((A=(b=t==null?void 0:t.measured)==null?void 0:b.height)!=null?A:0)/2,u=(d-l)/(2*s)-(f-c)/(2*a),p=(d-l)/(2*s)+(f-c)/(2*a),h=1/(Math.abs(u)+Math.abs(p)||1),m=h*u,g=h*p,T=s*(m+g)+l,x=a*(-m+g)+c;return{x:T,y:x}}function ja(e,t){var c,d,f,u;let{positionAbsolute:o}=e.internals,n=(d=(c=e.measured)==null?void 0:c.width)!=null?d:0,r=(u=(f=e.measured)==null?void 0:f.height)!=null?u:0,i=Math.round(o.x),s=Math.round(o.y),a=Math.round(t.x),l=Math.round(t.y);return a<=i+1?lo.Position.Left:a>=i+n-1?lo.Position.Right:l<=s+1?lo.Position.Top:l>=s+r-1?lo.Position.Bottom:lo.Position.Top}function ft(e,t){let o=Qa(e,t),n=Qa(t,e),r=ja(e,o),i=ja(t,n);return{sx:o.x,sy:o.y,tx:n.x,ty:n.y,sourcePos:r,targetPos:i}}var ze=require("lecom-ui"),tl=require("lucide-react");var ke=require("@xyflow/react");var el=require("@xyflow/react");var mt=()=>{let{getNodes:e,setNodes:t,getEdges:o,setEdges:n}=(0,el.useReactFlow)();return{selectElements:s=>{let a=e().map(c=>N(_({},c),{selected:s.includes(c.id)})),l=o().map(c=>N(_({},c),{selected:s.includes(c.id)}));return t(a),n(l),!0},clearSelection:async()=>{let s=e().map(l=>N(_({},l),{selected:!1})),a=o().map(l=>N(_({},l),{selected:!1}));return t(s),n(a),await Xi(),!0}}};var ir=()=>{let{getNode:e,getEdge:t,getNodes:o,getEdges:n}=(0,ke.useReactFlow)(),{selectElements:r}=mt(),i=g=>{let T=o(),x=n(),y=(0,ke.getIncomers)(g,T,x),E=(0,ke.getOutgoers)(g,T,x),b=y.some(v=>v.type==="START_EVENT"),A=E.some(v=>v.type==="END_EVENT");return b?"start":A?"end":"between"},s=(g,T,x)=>{var b,A,v,C;if(!g)return;let y={type:g.type,variant:(b=g.data)==null?void 0:b.variant,attribute:(A=g.data)==null?void 0:A.attribute},E={id:g.id,position:i(g),label:(v=g.data)==null?void 0:v.label,node:y};return g.type==="TASK"&&((C=g.data)==null?void 0:C.variant)==="SUBPROCESS"?N(_({},E),{type:"sub_process"}):g.type==="GATEWAY"?N(_({},E),{type:"gateway",variant:a(g,T,x)}):N(_({},E),{type:"activity"})},a=(g,T,x)=>{if(g.type!=="GATEWAY")return;let y=(0,ke.getIncomers)(g,T,x),E=!1,b=!1;if(y.forEach(A=>{var v,C;A.type==="TASK"&&(((v=A.data)==null?void 0:v.variant)==="SCRIPT"&&(E=!0),((C=A.data)==null?void 0:C.attribute)==="LOOP"&&(b=!0))}),E&&b)return"script_loop";if(E)return"script";if(b)return"loop"},l=(g,T,x)=>{var v,C,L,w;let y=e(g.source),E=e(g.target);if(!y||!E)return"simple";if((0,ke.getOutgoers)(y,T,x).some(S=>S.type==="END_EVENT"))return"final";if(y.type==="GATEWAY")switch((v=y.data)==null?void 0:v.variant){case"PARALLEL":return"parallel";case"EXCLUSIVE":return"exclusive";case"COMPLEX":return"complex";default:return"simple"}if(y.type==="TASK"){let S=(C=y.data)==null?void 0:C.variant,M=(L=y.data)==null?void 0:L.attribute;if(E.type==="TASK"&&((w=E.data)==null?void 0:w.variant)==="SUBPROCESS")return"to_sub_process";let I=S==="SCRIPT",V=M==="LOOP";return I&&V?"script_loop":I?"script":V?"loop":"simple"}return"simple"},c=(g,T,x)=>{let y=[];function E(A,v,C=0){let L=s(A,T,x);if(L.depth=C,v.push(L),A.type==="TASK"){y.push([...v]),v.pop();return}let w=(0,ke.getIncomers)(A,T,x);if(w.length)for(let S of w)E(S,v,C+1);v.pop()}let b=(0,ke.getIncomers)(g,T,x);for(let A of b)E(A,[]);return y},d=(g,T,x)=>{let y=[];function E(A,v,C=0){let L=s(A,T,x);if(L.depth=C,v.push(L),A.type==="TASK"){y.push([...v]),v.pop();return}let w=(0,ke.getOutgoers)(A,T,x);if(w.length)for(let S of w)E(S,v,C+1);v.pop()}let b=(0,ke.getOutgoers)(g,T,x);for(let A of b)E(A,[]);return y},f=(g,T,x)=>{x=x.filter(E=>E.source===g.id);let y=x.map(E=>{var v;let b=e(E.target),A;return b&&(A=s(b,T,x)),{id:E.id,type:"routing",variant:l(E,T,x),label:(v=E.data)==null?void 0:v.label,target:A}});return console.log(y),y},u=g=>{let T=e(g);if(!T)return;let x=o(),y=n(),E=s(T,x,y);return E.sources=c(T,x,y),E.targets=d(T,x,y),E.edgeTargets=f(T,x,y),T.type==="GATEWAY"&&(E.variant=a(T,x,y)),E},p=g=>{let T=t(g);if(!T)return;let x=o(),y=n(),E=l(T,x,y),A={id:T.id,type:"routing",variant:E,gatewayVariant:void 0},v=e(T.source);if(v){let L=s(v,x,y),w=c(v,x,y),S=a(v,x,y);A.source=L,A.sources=w.length?w:[[L]],A.gatewayVariant=S}let C=e(T.target);if(C){let L=s(C,x,y),w=d(C,x,y);A.target=L,A.targets=w.length?w:[[L]]}return A},h=g=>{let T=e(g);if(T)return u(T.id);let x=t(g);if(x)return p(x.id)};return{configureElement:g=>{let T=h(g);if(T)return r([g]),T},getConfigureElement:h,getNodeConfigure:u,getEdgeConfigure:p}};var Mt=require("react/jsx-runtime"),Ko=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,ze.useTranslation)(),{onConfigureElement:n}=D(),{getConfigureElement:r}=ir();return(0,Mt.jsxs)(ze.Tooltip,{children:[(0,Mt.jsx)(ze.TooltipTrigger,{asChild:!0,children:(0,Mt.jsx)(ze.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onClick:()=>{let s=r(e);s&&(n==null||n(s))},children:(0,Mt.jsx)(tl.Settings,{size:16})})}),(0,Mt.jsx)(ze.TooltipContent,{color:"black",children:o(t==="node"?"editor.toolbar.configure_node":"editor.toolbar.configure_edge")})]})};var ol=require("@xyflow/react"),Fe=require("lecom-ui"),nl=require("lucide-react"),Pt=require("react/jsx-runtime"),sr=({elementId:e,elementType:t="node"})=>{let{t:o}=(0,Fe.useTranslation)(),{deleteElements:n}=(0,ol.useReactFlow)();return(0,Pt.jsxs)(Fe.Tooltip,{children:[(0,Pt.jsx)(Fe.TooltipTrigger,{asChild:!0,children:(0,Pt.jsx)(Fe.Button,{variant:"ghost",color:"destructive",size:"small",iconButton:!0,onClick:()=>{n(t==="node"?{nodes:[{id:e}]}:{edges:[{id:e}]})},children:(0,Pt.jsx)(nl.TrashIcon,{size:16})})}),(0,Pt.jsx)(Fe.TooltipContent,{color:"black",children:o("editor.toolbar.delete")})]})};var We=require("lecom-ui"),rl=require("lucide-react"),il=require("react"),Lt=require("react/jsx-runtime"),qo=({nodeId:e})=>{let{t}=(0,We.useTranslation)(),o=(0,il.useCallback)(n=>{n.stopPropagation();let r=document.querySelector(`[data-id="${e}"]`);if(!r)return;let i=r.querySelector(".react-flow__handle.source");if(!i)return;let s=i.getBoundingClientRect(),a=s.left+s.width/2,l=s.top+s.height/2,c=new MouseEvent("mousedown",{clientX:a,clientY:l,bubbles:!0,cancelable:!0});i.dispatchEvent(c)},[e]);return(0,Lt.jsxs)(We.Tooltip,{children:[(0,Lt.jsx)(We.TooltipTrigger,{asChild:!0,children:(0,Lt.jsx)(We.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,onMouseDown:o,children:(0,Lt.jsx)(rl.MoveUpRightIcon,{size:16})})}),(0,Lt.jsx)(We.TooltipContent,{color:"black",children:t("editor.toolbar.connect_node")})]})};var Zo=require("react/jsx-runtime"),co=i=>{var s=i,{edgeId:e,edgeType:t,sourceNode:o,targetNode:n}=s,r=Ge(s,["edgeId","edgeType","sourceNode","targetNode"]);var h;let a=(o==null?void 0:o.type)==="START_EVENT",l=(n==null?void 0:n.type)==="END_EVENT",c=(o==null?void 0:o.type)==="GATEWAY"&&(n==null?void 0:n.type)==="GATEWAY",d=(o==null?void 0:o.type)==="TASK"&&(n==null?void 0:n.type)==="GATEWAY",f=!a&&!l&&!c&&!d,u=[{component:(0,Zo.jsx)(sr,{elementId:e,elementType:"edge"})}],p={SEQUENCE_EDGE:[...f?[{component:(0,Zo.jsx)(Ko,{elementId:e,elementType:"edge"})}]:[],...u],MESSAGE_EDGE:[...u],ANNOTATION_EDGE:[...u]};return(0,Zo.jsx)("div",N(_({className:"flex items-center gap-1 w-fit px-3 py-2 bg-white rounded-sm shadow-md"},r),{children:(h=p[t])==null?void 0:h.map((m,g)=>(0,Zo.jsx)("div",{children:m.component},g))}))};var kt=require("react/jsx-runtime"),uo={type:"ANNOTATION_EDGE",reconnectable:!0},sl=({id:e,source:t,target:o,selected:n,data:r})=>{let{zoom:i}=(0,Ve.useViewport)(),{isMultipleSelection:s}=D(),a=(0,Ve.useInternalNode)(t),l=(0,Ve.useInternalNode)(o);if(!a||!l)return null;let{sx:c,sy:d,tx:f,ty:u}=ft(a,l),[p,h,m]=(0,Ve.getStraightPath)({sourceX:c,sourceY:d,targetX:f,targetY:u}),g=n||(a==null?void 0:a.selected)||(l==null?void 0:l.selected),T=1/i;return(0,kt.jsxs)("g",{className:P("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":g}),children:[(0,kt.jsx)(Ve.BaseEdge,{id:e,path:p,strokeDasharray:4,className:P("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":r==null?void 0:r.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":g&&!(r!=null&&r.hasError)})}),(0,kt.jsx)(Ve.EdgeLabelRenderer,{children:(0,kt.jsx)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${h}px, ${m}px)`},children:n&&!s&&(0,kt.jsx)(co,{edgeId:e,edgeType:"ANNOTATION_EDGE",style:{transform:`scale(${T})`}})})})]})};var ce=require("@xyflow/react"),al=require("react");var Dt=require("react");var ci=require("react/jsx-runtime"),le=({value:e,maxLength:t,style:o,className:n,contentClassName:r,isEditing:i,onChange:s,onBlur:a})=>{let l=(0,Dt.useRef)(null),[c,d]=(0,Dt.useState)(!1);(0,Dt.useEffect)(()=>{d(i!=null?i:!1)},[i]),(0,Dt.useEffect)(()=>{if(c&&l.current){l.current.focus();let m=document.createRange();m.selectNodeContents(l.current);let g=window.getSelection();g&&(g.removeAllRanges(),g.addRange(m))}},[c]);let f=m=>{m.stopPropagation(),c||d(!0)},u=m=>{let g=m.currentTarget.innerText.trim(),T=t&&g.length>=t,x=["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","Tab","Enter","Escape","Shift"],y=m.ctrlKey||m.metaKey,E=y&&m.key==="a",b=y&&m.key==="c",A=y&&m.key==="x",v=y&&m.key==="v";function C(w){return/\w/.test(w)}if(g.length===0&&!C(m.key)&&!x.includes(m.key)&&!y){m.preventDefault();return}T&&(x.includes(m.key)||E||b||A||v||m.preventDefault())},p=m=>{if(!t)return;m.preventDefault();let g=m.clipboardData.getData("text/plain"),T=m.currentTarget.innerText,x=window.getSelection();if(!x||x.rangeCount===0)return;let y=x.getRangeAt(0);if((T.substring(0,y.startOffset)+g+T.substring(y.endOffset)).length>t){let b=t-(T.length-(y.endOffset-y.startOffset)),A=g.substring(0,Math.max(0,b));A&&(y.deleteContents(),y.insertNode(document.createTextNode(A)),y.setStartAfter(y.endContainer),y.collapse(!0),x.removeAllRanges(),x.addRange(y))}else y.deleteContents(),y.insertNode(document.createTextNode(g)),y.setStartAfter(y.endContainer),y.collapse(!0),x.removeAllRanges(),x.addRange(y)},h=m=>{d(!1);let g=m.currentTarget.innerText.trim();t&&g.length>t&&(g=g.substring(0,t)),m.currentTarget.innerText=g,a==null||a(),g!==e&&(s==null||s(g))};return(0,ci.jsx)("div",{className:P("flex-1 p-2 self-stretch content-center border border-transparent overflow-hidden text-ellipsis text-sm text-center",n,{"border border-dashed border-grey-400":c}),style:o,onDoubleClick:f,children:(0,ci.jsx)("div",{ref:l,className:P("outline-none whitespace-pre-wrap overflow-hidden",r,{"nodrag nopan cursor-text":c}),contentEditable:!0,suppressContentEditableWarning:!0,onKeyDown:u,onPaste:p,onBlur:h,children:e})})};var gt=require("react/jsx-runtime"),Ne={type:"SEQUENCE_EDGE",reconnectable:!0,markerStart:{type:ce.MarkerType.ArrowClosed},markerEnd:{type:ce.MarkerType.Arrow},data:{label:""}},ll=({id:e,source:t,target:o,data:n,selected:r})=>{let{zoom:i}=(0,ce.useViewport)(),{updateEdgeData:s}=(0,ce.useReactFlow)(),{isMultipleSelection:a}=D(),[l,c]=(0,al.useState)(!1),d=(0,ce.useInternalNode)(t),f=(0,ce.useInternalNode)(o);if(!d||!f)return null;let{sx:u,sy:p,tx:h,ty:m,sourcePos:g,targetPos:T}=ft(d,f),[x,y,E]=(0,ce.getSmoothStepPath)({sourceX:u,sourceY:p,targetX:h,targetY:m,sourcePosition:g,targetPosition:T}),b=r||(d==null?void 0:d.selected)||(f==null?void 0:f.selected),A=b?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=l||(n==null?void 0:n.label.trim().length)>0,C=1/i,L=()=>{c(!0)},w=()=>{c(!1)},S=M=>{s(e,{label:M.trim()})};return(0,gt.jsxs)("g",{className:P("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":b}),onBlur:w,onDoubleClick:L,children:[(0,gt.jsx)(ce.BaseEdge,{id:e,path:x,markerEnd:`url(#${A})`,className:P("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":n==null?void 0:n.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":b&&!(n!=null&&n.hasError)})}),(0,gt.jsx)(ce.EdgeLabelRenderer,{children:(0,gt.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${y}px, ${E}px)`},children:[r&&!a&&(0,gt.jsx)(co,{edgeId:e,edgeType:"SEQUENCE_EDGE",sourceNode:d,targetNode:f,style:{transform:`scale(${C})`}}),v&&(0,gt.jsx)(le,{value:n==null?void 0:n.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:l,onChange:S})]})})]})};var Qo=e=>new Map(e.map(t=>[t.id,t])),ar=e=>e.some(t=>t.type==="START_EVENT"),cl=(e,t,o,n)=>{let r=Qo(o),i=r.get(e);if(!i||i.type!=="START_EVENT")return!1;let s=r.get(t);return(s==null?void 0:s.type)==="ANNOTATION"?!1:n.filter(l=>{if(l.source!==e)return!1;let c=r.get(l.target);return(c==null?void 0:c.type)!=="ANNOTATION"}).length>=1},lr=(e,t,o)=>{var i;let n=t.find(s=>s.id===e);return!n||n.type!=="GATEWAY"||((i=n.data)==null?void 0:i.variant)!=="EXCLUSIVE"?!1:o.filter(s=>s.source===e).length>=2},dl=(e,t,o)=>{var s,a,l,c;let n=Qo(o),r=n.get(e),i=n.get(t);return(r==null?void 0:r.type)!=="GATEWAY"||(i==null?void 0:i.type)!=="GATEWAY"||((s=r==null?void 0:r.data)==null?void 0:s.variant)==="EXCLUSIVE"&&((a=i==null?void 0:i.data)==null?void 0:a.variant)==="PARALLEL"||((l=r==null?void 0:r.data)==null?void 0:l.variant)==="COMPLEX"&&((c=i==null?void 0:i.data)==null?void 0:c.variant)==="PARALLEL"},cr=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.variant)==="SCRIPT"},dr=(e,t)=>{var n;let o=t.find(r=>r.id===e);return!o||o.type!=="TASK"?!1:((n=o.data)==null?void 0:n.attribute)==="LOOP"},ur=(e,t,o)=>{let n=Qo(t),r=n.get(e);return!r||r.type!=="TASK"?!1:o.filter(s=>s.target===e).some(s=>{let a=n.get(s.source);return(a==null?void 0:a.type)==="START_EVENT"})},pr=(e,t,o)=>{let n=Qo(t),r=n.get(e);return!r||r.type!=="TASK"?!1:o.filter(s=>s.source===e).some(s=>{let a=n.get(s.target);return(a==null?void 0:a.type)==="END_EVENT"})},fr=(e,t)=>t.filter(n=>n.source===e).length>0,mr=(e,t,o,n)=>{let r=Qo(o),i=r.get(e);if(!i||i.type!=="TASK")return!1;let s=t?r.get(t):null;return(s==null?void 0:s.type)==="ANNOTATION"?!1:n.filter(l=>{if(l.source!==e)return!1;let c=r.get(l.target);return(c==null?void 0:c.type)!=="ANNOTATION"}).length>=2};var Wf=[e=>({isValid:e.sourceNodeId!==e.targetNodeId,reason:"self_connection_not_allowed"}),e=>({isValid:!cl(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"start_event_limit_reached"}),e=>({isValid:!lr(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"}),e=>({isValid:!mr(e.sourceNodeId,e.targetNodeId,e.nodes,e.edges),reason:"task_limit_reached"}),e=>({isValid:dl(e.sourceNodeId,e.targetNodeId,e.nodes),reason:"gateway_to_gateway_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="END_EVENT"),reason:"start_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="GATEWAY"&&e.targetNodeType==="END_EVENT"),reason:"gateway_to_end_not_allowed"}),e=>({isValid:!(e.sourceNodeType==="START_EVENT"&&e.targetNodeType==="GATEWAY"),reason:"start_to_gateway_not_allowed"}),e=>({isValid:!(cr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"script_to_end_not_allowed"}),e=>({isValid:!(dr(e.sourceNodeId,e.nodes)&&e.targetNodeType==="END_EVENT"),reason:"loop_to_end_not_allowed"}),e=>({isValid:!(ur(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"initial_activity_to_end_not_allowed"}),e=>({isValid:!(pr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION"),reason:"final_activity_cannot_connect"}),e=>({isValid:!(fr(e.sourceNodeId,e.edges)&&e.targetNodeType==="END_EVENT"),reason:"activity_has_outgoing_connections"}),e=>({isValid:({START_EVENT:["TASK","ANNOTATION"],END_EVENT:["ANNOTATION"],TASK:["TASK","END_EVENT","GATEWAY","ANNOTATION"],GATEWAY:["TASK","END_EVENT","ANNOTATION","GATEWAY"],LANE:["ANNOTATION"],ANNOTATION:[],UNSUPPORTED:[]}[e.sourceNodeType]||[]).includes(e.targetNodeType),reason:"connection_type_not_allowed"})],ul=e=>{for(let t of Wf){let o=t(e);if(!o.isValid)return o}return{isValid:!0}};var Uf=[{sourceTypes:["GATEWAY"],targetTypes:["TASK","GATEWAY"],validate:e=>({shouldDisable:lr(e.sourceNodeId,e.nodes,e.edges),reason:"gateway_limit_reached"})},{targetTypes:["START_EVENT"],validate:e=>({shouldDisable:ar(e.nodes),reason:"start_event_already_exists"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:cr(e.sourceNodeId,e.nodes),reason:"script_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:dr(e.sourceNodeId,e.nodes),reason:"loop_to_end_not_allowed"})},{sourceTypes:["TASK"],targetTypes:["END_EVENT"],validate:e=>({shouldDisable:ur(e.sourceNodeId,e.nodes,e.edges),reason:"initial_activity_to_end_not_allowed"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:pr(e.sourceNodeId,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"final_activity_cannot_connect"})},{targetTypes:["END_EVENT"],validate:e=>({shouldDisable:fr(e.sourceNodeId,e.edges),reason:"activity_has_outgoing_connections"})},{sourceTypes:["TASK"],validate:e=>({shouldDisable:mr(e.sourceNodeId,null,e.nodes,e.edges)&&e.targetNodeType!=="ANNOTATION",reason:"task_limit_reached"})}],pl=e=>{let t=Uf.filter(o=>{let n=!o.sourceTypes||o.sourceTypes.includes(e.sourceNodeType),r=!o.targetTypes||o.targetTypes.includes(e.targetNodeType);return n&&r});for(let o of t){let n=o.validate(e);if(n.shouldDisable)return n}return{shouldDisable:!1}};var fl=({setEdges:e})=>{let{getNode:t,getEdges:o,getNodes:n}=(0,gr.useReactFlow)(),r=(0,di.useCallback)(s=>{let a=t(s.source),l=t(s.target);if(!a||!l)return!1;let c={sourceNodeId:a.id,targetNodeId:l.id,sourceNodeType:a.type,targetNodeType:l.type,nodes:n(),edges:o()};return ul(c).isValid},[t,o,n]),i=(0,di.useCallback)(s=>{e(a=>{let l=t(s.target),c=(l==null?void 0:l.type)==="ANNOTATION"?uo:Ne;return(0,gr.addEdge)(_(_({},s),c),a)})},[t,e]);return{isValidConnection:r,onConnect:i}};var ui=require("react"),Tl=require("lecom-ui"),vl=require("@xyflow/react");var jo=(e=[])=>e.filter(t=>t.type==="START_EVENT"),Rt=(e=[])=>e.filter(t=>t.type==="END_EVENT"),ht=(e=[])=>e.filter(t=>t.type==="TASK")||[],ml=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SCRIPT"}),gl=(e=[])=>e.filter(t=>{var o;return t.type==="TASK"&&((o=t.properties)==null?void 0:o.variant)==="SUBPROCESS"}),hr=(e=[])=>e.filter(t=>t.type==="GATEWAY"),hl=(e=[])=>e.filter(t=>{var o;return t.type==="GATEWAY"&&((o=t.properties)==null?void 0:o.variant)==="EXCLUSIVE"}),we=(e,t=[])=>t.filter(o=>o.source===e),en=(e,t=[])=>t.filter(o=>o.target===e),yl=(e,t)=>{var n,r;let o=(n=t.nodes)==null?void 0:n.find(i=>i.id===e);return((r=o==null?void 0:o.properties)==null?void 0:r.attribute)==="LOOP"},xl=(e,t)=>{let o=we(e,t.edges||[]);for(let n of o){let r=(t.nodes||[]).find(i=>i.id===n.target);if(r&&r.type==="END_EVENT")return!0}return!1},El=e=>e?/\w/g.test(e.trim()):!1,B=e=>{let{isValid:t,nodeIds:o,edgeIds:n}=e;return{isValid:t,nodeIds:!t&&o&&o.length>0?o:[],edgeIds:!t&&n&&n.length>0?n:[]}},Ue=(e=[],t)=>{if(!e||e.length===0)return{isValid:!0,invalidIds:[]};let o=e.filter(n=>!t(n));return{isValid:o.length===0,invalidIds:o.map(n=>n.id)}},_l=(e=[],t=[])=>({nodes:e.map(o=>{var n;return{id:o.id,type:o.type||"",label:typeof((n=o.data)==null?void 0:n.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 tn=[{id:"start_event_not_found",validate:e=>{let t=jo(e.nodes);return B({isValid:t.length>=1})}},{id:"end_event_not_found",validate:e=>{let t=Rt(e.nodes);return B({isValid:t.length>=1})}},{id:"multiple_start_event_not_allowed",validate:e=>{let t=jo(e.nodes),o=t.length===1;if(t.length===0)return B({isValid:!0});if(!o)return B({isValid:!1,nodeIds:t.map(i=>i.id)});let n=we(t[0].id,e.edges);if(!(n.length<=1)){let i=[...t.map(s=>s.id),...n.map(s=>s.target)];return B({isValid:!1,nodeIds:[...new Set(i)]})}return B({isValid:!0})}},{id:"task_flows_limit_exceeds",validate:e=>{let t=ht(e.nodes),o=Ue(t,n=>we(n.id,e.edges).length<=2);return B({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_empty",highlightRelatedEdges:!1,validate:e=>{let t=ht(e.nodes),o=Ue(t,n=>!!n.label&&n.label.trim()!=="");return B({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"task_label_length",highlightRelatedEdges:!1,validate:e=>{let o=ht(e.nodes),n=Ue(o,r=>!r.label||r.label.length<=60);return B({isValid:n.isValid,nodeIds:n.invalidIds})}},{id:"duplicate_task_name",highlightRelatedEdges:!1,validate:e=>{let t=ht(e.nodes),o=new Map;for(let r of t){if(!r.label)continue;let i=r.label.trim();i&&(o.has(i)||o.set(i,[]),o.get(i).push(r))}let n=[];for(let[,r]of o.entries())r.length>1&&r.forEach(i=>n.push(i.id));return B({isValid:n.length===0,nodeIds:n})}},{id:"nested_gateway",validate:e=>{let t=hr(e.nodes),o=[],n=[];for(let r of t){let i=we(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="GATEWAY"&&(o.push(r.id,a.id),n.push(s.id))}}return B({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"events_nested",validate:e=>{let t=[...jo(e.nodes),...Rt(e.nodes)],o=[],n=[];for(let r of t){let i=we(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&(a.type==="START_EVENT"||a.type==="END_EVENT")&&(o.push(r.id,a.id),n.push(s.id))}}return B({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"flows_on_end_tasks_not_allowed",validate:e=>{let t=Rt(e.nodes),o=[],n=[];for(let r of t){let i=en(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.source);if(a&&a.type==="TASK"){let l=we(a.id,e.edges);l.length>1&&(o.push(a.id),l.forEach(c=>n.push(c.id)))}}}return B({isValid:o.length===0,nodeIds:o,edgeIds:n})}},{id:"conditions_flows_limit_exceeds",validate:e=>{let t=hl(e.nodes),o=Ue(t,r=>we(r.id,e.edges).length<=2),n=o.invalidIds.flatMap(r=>we(r,e.edges).map(i=>i.id));return B({isValid:o.isValid,nodeIds:o.invalidIds,edgeIds:n})}},{id:"activity_name_invalid",validate:e=>{let t=ht(e.nodes),o=Ue(t,n=>!n.label||El(n.label));return B({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"final_activity_has_loop",validate:e=>{var s,a;if(!((s=e==null?void 0:e.nodes)!=null&&s.length)||!((a=e==null?void 0:e.edges)!=null&&a.length))return B({isValid:!0});let t=Rt(e.nodes)[0];if(!t)return B({isValid:!0});let o=en(t.id,e.edges);if(!o.length)return B({isValid:!0});let r=ht(e.nodes).filter(l=>o.some(c=>c.source===l.id)),i=Ue(r,l=>!yl(l.id,e));return B({isValid:i.isValid,nodeIds:i.isValid?[]:[t.id,...i.invalidIds]})}},{id:"concurrent_initial_and_final_event",validate:e=>{let t=ht(e.nodes),o=Rt(e.nodes)[0];if(!o)return B({isValid:!0});let n=t.filter(l=>{let c=en(l.id,e.edges),d=we(l.id,e.edges),f=c.some(p=>{var h;return((h=e.nodes.find(m=>m.id===p.source))==null?void 0:h.type)==="START_EVENT"}),u=d.some(p=>{var h;return((h=e.nodes.find(m=>m.id===p.target))==null?void 0:h.type)==="END_EVENT"});return f&&u}),r=en(o.id,e.edges),i=r.length>1,s=r.map(l=>l.source),a={isValid:n.length===0&&!i,nodeIds:[...n.map(l=>l.id),...i?s:[]]};return B(a)}},{id:"gateway_flow_to_event",validate:e=>{let t=hr(e.nodes),o=[],n=[];for(let r of t){let i=we(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="END_EVENT"&&(o.push(r.id,a.id),n.push(s.id))}}return B({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"gateway_missing_output_streams",validate:e=>{let t=hr(e.nodes),o=Ue(t,n=>we(n.id,e.edges).length>=1);return B({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"event_to_condition",validate:e=>{let t=[...jo(e.nodes),...Rt(e.nodes)],o=[],n=[];for(let r of t){let i=we(r.id,e.edges);for(let s of i){let a=e.nodes.find(l=>l.id===s.target);a&&a.type==="GATEWAY"&&(o.push(r.id,a.id),n.push(s.id))}}return B({isValid:o.length===0,nodeIds:o.length>0?[...new Set(o)]:[],edgeIds:n})}},{id:"script_in_final_activity",validate:e=>{let t=ml(e.nodes),o=Ue(t,n=>!xl(n.id,e));return B({isValid:o.isValid,nodeIds:o.invalidIds})}},{id:"subprocess_referenced_not_configured",validate:e=>{let t=gl(e.nodes),o=Ue(t,n=>{var r,i;return((r=n.properties)==null?void 0:r.subprocessRef)!==void 0&&((i=n.properties)==null?void 0:i.subprocessRef)!==""});return B({isValid:o.isValid,nodeIds:o.invalidIds})}}];var bl=e=>{e=e||{nodes:[],edges:[]},e.nodes=e.nodes||[],e.edges=e.edges||[];let t=[];for(let n of tn){let r=n.validate(e);r.isValid||t.push({id:n.id,message:n.id,nodeIds:r.nodeIds||[],edgeIds:r.edgeIds||[]})}return{isValid:t.length===0,errors:t}};var Nl=()=>{let{t:e}=(0,Tl.useTranslation)(),[t,o]=(0,ui.useState)(null),{setNodes:n,setEdges:r,getNodes:i,getEdges:s}=(0,vl.useReactFlow)(),[a,l]=(0,ui.useState)(!1);return{validationResult:t,validateDiagram:u=>{let p=_l(u.nodes,u.edges),h=bl(p),m=h.errors.map(g=>N(_({},g),{message:e(`validation.errors.${g.id}`)}));return a||l(!0),{isValid:h.isValid,errors:m}},handleValidationComplete:u=>{if(o(u),!u)return;let p=[],h=[];u.errors.forEach(v=>{v.nodeIds&&v.nodeIds.length>0&&v.nodeIds.forEach(C=>p.push(C)),v.edgeIds&&v.edgeIds.length>0&&v.edgeIds.forEach(C=>h.push(C))});let m=[...new Set(p)];n(v=>v.map(C=>N(_({},C),{data:N(_({},C.data),{hasError:!1})}))),r(v=>v.map(C=>N(_({},C),{data:N(_({},C.data),{hasError:!1})})));let g=i(),T=s(),x=new Set(m),y=new Set;u.errors.forEach(v=>{var w,S;let C=tn.find(M=>M.id===v.id);(C==null?void 0:C.highlightRelatedEdges)!==!1&&((w=v.edgeIds)==null||w.forEach(M=>y.add(M)),(S=v.nodeIds)==null||S.forEach(M=>{T.forEach(I=>{(I.source===M||I.target===M)&&y.add(I.id)})}))});let E=new Set,b=new Set,A=new Set;g.forEach(v=>{v.type==="START_EVENT"?E.add(v.id):v.type==="END_EVENT"&&b.add(v.id)}),T.forEach(v=>{E.has(v.source)&&A.add(v.target),b.has(v.target)&&A.add(v.source)}),A.forEach(v=>{var C,L;if(x.has(v)){let w=(C=u.errors.find(M=>{var I;return(I=M.nodeIds)==null?void 0:I.includes(v)}))==null?void 0:C.id;((L=tn.find(M=>M.id===w))==null?void 0:L.highlightRelatedEdges)!==!1&&T.forEach(M=>{M.source===v&&b.has(M.target)&&(x.add(M.target),y.add(M.id)),M.target===v&&E.has(M.source)&&(x.add(M.source),y.add(M.id))})}}),x.size>0&&n(v=>v.map(C=>N(_({},C),{data:N(_({},C.data),{hasError:x.has(C.id)})}))),y.size>0&&r(v=>v.map(C=>N(_({},C),{data:N(_({},C.data),{hasError:y.has(C.id)})})))},clearValidation:()=>{o(null),l(!1),n(u=>u.map(p=>N(_({},p),{data:N(_({},p.data),{hasError:!1})}))),r(u=>u.map(p=>N(_({},p),{data:N(_({},p.data),{hasError:!1})})))},isAutoValidationEnabled:a}};var Cl=require("@xyflow/react"),Il=require("lecom-ui"),Sl=require("react"),pi=require("uuid");var yr=(e,t)=>{let n=e.filter(i=>i.type==="TASK").map(i=>{var a;let s=(a=i.data)==null?void 0:a.label;if(s&&s.startsWith(`${t} `)){let l=s.match(new RegExp(`^${t} (\\d+)$`));return l?parseInt(l[1],10):0}return 0}).filter(i=>i>0),r=n.length>0?Math.max(...n)+1:1;return`${t} ${r}`},po=(e,t)=>{let n=t.filter(a=>a.type==="TASK").map(a=>{var l;return(l=a.data)==null?void 0:l.label}).filter(Boolean);if(!n.includes(e))return e;let r=e.replace(/\s+\(\d+\)$/,""),i=n.filter(a=>a===r||a.startsWith(`${r} (`)).map(a=>{if(a===r)return 1;let l=a.match(/\s+\((\d+)\)$/);return l?parseInt(l[1],10):0}).filter(a=>a>0),s=2;for(;i.includes(s);)s++;return`${r} (${s})`};var Yf=15,wl="bpmn:selection",$f=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},Al=e=>{if(!$f(e.target))return!0;let t=window.getSelection(),o=t&&t.toString().length>0;if(e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement){let n=e.target;return n.selectionStart===n.selectionEnd&&!o}return!o},Ml=({offset:e=Yf}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,Cl.useReactFlow)(),{t:i}=(0,Il.useTranslation)();(0,Sl.useEffect)(()=>{let s=l=>{var m,g;if(!Al(l))return;let c=t(),d=n(),f=c.filter(T=>T.selected);if(!f.length)return;l.preventDefault(),l.stopPropagation();let u=d.filter(T=>f.some(x=>x.id===T.source)&&f.some(x=>x.id===T.target)),h=JSON.stringify({nodes:f,edges:u});(m=l.clipboardData)==null||m.setData(wl,h),(g=l.clipboardData)==null||g.setData("text/plain",`BPMN Selection: ${f.length} nodes`)},a=l=>{var y,E;if(!Al(l))return;let c=(y=l.clipboardData)==null?void 0:y.getData(wl);if(!c)return;l.preventDefault(),l.stopPropagation();let d;try{d=JSON.parse(c)}catch(b){return}if(!((E=d.nodes)!=null&&E.length))return;let f=new Map,u=t(),p=[],h=u.some(b=>b.type==="START_EVENT"),m=d.nodes.filter(b=>b.type==="START_EVENT"),g=d.nodes;if(h&&m.length>0&&(g=d.nodes.filter(b=>b.type!=="START_EVENT"),g.length===0))return;let T=g.map(b=>{var C;let A=(0,pi.v7)();f.set(b.id,A);let v=N(_({},b),{id:A,selected:!0,position:{x:b.position.x+e,y:b.position.y+e}});if(b.type==="TASK"){let L=(C=b.data)==null?void 0:C.label,w=po(L||i("bpmn.task.label.prefix"),[...u,...p]);v.data=N(_({},b.data),{label:w})}return p.push(v),v}),x=d.edges.map(b=>N(_({},b),{id:(0,pi.v7)(),selected:!0,source:f.get(b.source)||b.source,target:f.get(b.target)||b.target}));o(b=>[...b.map(A=>N(_({},A),{selected:!1})),...T]),r(b=>[...b.map(A=>N(_({},A),{selected:!1})),...x])};return document.addEventListener("copy",s,!0),document.addEventListener("paste",a,!0),()=>{document.removeEventListener("copy",s,!0),document.removeEventListener("paste",a,!0)}},[t,o,n,r,e,i])};var br=require("@xyflow/react");var Yl=require("lecom-ui"),$l=require("react"),mi=require("uuid");var Xf={MIN_WIDTH:36,MIN_HEIGHT:36},Kf={MIN_WIDTH:36,MIN_HEIGHT:36},qf={MIN_WIDTH:56,MIN_HEIGHT:56},xr={MIN_WIDTH:176,MIN_HEIGHT:96},Er={HEADER_WIDTH:40,MIN_WIDTH:840,MIN_HEIGHT:256},q={HEADER_WIDTH:40,MIN_WIDTH:800,MIN_HEIGHT:256},_r={MIN_WIDTH:176,MIN_HEIGHT:64},Zf={MIN_WIDTH:128,MIN_HEIGHT:64},R={START_EVENT:Xf,END_EVENT:Kf,GATEWAY:qf,TASK:xr,LANE:q,ANNOTATION:_r,UNSUPPORTED:Zf};var fi=Nu(require("@dagrejs/dagre"),1),Dl=require("@xyflow/react");var Rl=require("lodash");var Pl=require("lodash");var je=e=>{var t,o,n,r,i,s,a,l;return{x:(o=(t=e.internals)==null?void 0:t.positionAbsolute.x)!=null?o:0,y:(r=(n=e.internals)==null?void 0:n.positionAbsolute.y)!=null?r:0,w:(s=(i=e.measured)==null?void 0:i.width)!=null?s:0,h:(l=(a=e.measured)==null?void 0:a.height)!=null?l:0}},et=e=>(0,Pl.orderBy)(e,[o=>{let n=o.type==="LANE";return n&&!o.parentId?0:n?1:2}],["asc"]),Ll=(e,t)=>{let{x:o,y:n}=je(e),{x:r,y:i}=je(t);return{x:o-r,y:n-i}};var fo=({parentId:e,nodes:t,includeTypes:o=[...Object.values(k)],excludeTypes:n=[]})=>t.some(r=>r.parentId===e&&(!o.length||o.includes(r.type))&&!n.includes(r.type)),Jf=(e,t)=>{let{x:o,y:n}=je(e),{x:r,y:i}=je(t),s=o-r,a=n-i;return Math.sqrt(s*s+a*a)},Qf=(e,t)=>{let{x:o,y:n,w:r,h:i}=je(e),{x:s,y:a,w:l,h:c}=je(t);return o<s+l&&s<o+r&&n<a+c&&a<n+i},on=(e,t)=>{let o=null,n=1/0;for(let r of t)if(r.id!==e.id&&Qf(e,r)){let i=Jf(e,r);i<n&&(n=i,o=r)}return o},kl=(e,t)=>t.filter(o=>o.parentId===e).reduce((o,n)=>{var r,i;return Math.max(o,(i=(r=n.measured)==null?void 0:r.width)!=null?i:0)},0);var Vl=(e=[],t=[],o="LR")=>{let n=new fi.default.graphlib.Graph;return n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:o}),e.forEach(({id:i,width:s,height:a})=>n.setNode(i,{width:s,height:a})),t.forEach(i=>n.setEdge(i.source,i.target)),fi.default.layout(n),{nodes:e.map(i=>{let s=n.node(i.id);return N(_({},i),{position:{x:s.x-i.width/2,y:s.y-i.height/2}})}),edges:t}},nn=e=>{let t=e.filter(n=>n.type==="LANE"&&!n.parentId),o=[...e];return t.forEach(n=>{o=Vt(n.id,o)}),o},Vt=(e,t)=>{var p,h;let o=[...t],n=o.find(m=>m.id===e);if(!n)return o;let r=o.filter(m=>m.parentId===e&&m.type==="LANE");if(r.length===0)return o;let i=(0,Rl.orderBy)(r,["position.y"]),s=Math.max((h=(p=n.measured)==null?void 0:p.width)!=null?h:0,Er.MIN_WIDTH),a=kl(e,i)||q.MIN_WIDTH,l=Math.max(s,a),c=s-q.HEADER_WIDTH>=a,d=0,f=0;i.forEach(m=>{var g,T,x,y;o=o.map(E=>E.id===m.id?N(_({},E),{width:c?l-q.HEADER_WIDTH:l,measured:N(_({},E.measured),{width:c?l-q.HEADER_WIDTH:l}),position:{x:q.HEADER_WIDTH,y:d}}):E),d+=(T=(g=m.measured)==null?void 0:g.height)!=null?T:0,f+=(y=(x=m.measured)==null?void 0:x.height)!=null?y:0}),o=o.map(m=>m.id===e?N(_({},m),{height:f,width:c?l:l+q.HEADER_WIDTH,measured:N(_({},m.measured),{height:f,width:c?l:l+q.HEADER_WIDTH})}):m);let u=o.find(m=>m.id===e);return u!=null&&u.parentId&&(o=Vt(u.parentId,o)),o},Ol=(e,t,o)=>{if(e.type==="LANE")return o;let n=Te(t),r=Te(e);return r.y<n.y&&(e.position.y=0),r.x<n.x+q.HEADER_WIDTH&&(e.position.x=q.HEADER_WIDTH),r.y2>n.y2&&(t.height=r.y2-n.y,t.measured.height=r.y2-n.y),r.x2>n.x2&&(t.width=r.x2-n.x,t.measured.width=r.x2-n.x),o=o.map(i=>i.id===t.id?N(_({},i),{height:t.height,width:t.width,measured:t.measured}):i.id===e.id?N(_({},i),{position:e.position}):i),o},Hl=()=>{let e=document.querySelector(".react-flow__viewport");return e||(console.error("Flow element (.react-flow__viewport) not found."),null)},jf=50,Gl=(e,t=jf)=>{let o=(0,Dl.getNodesBounds)(e);return{x:o.x-t,y:o.y-t,width:o.width+t*2,height:o.height+t*2}};var Bl=require("zustand"),mo=(0,Bl.create)(e=>({draggableNode:null,setDraggableNode:t=>{e({draggableNode:t})}}));var ge=require("@xyflow/react"),zl=require("react");var yt=require("react/jsx-runtime"),hb={type:"MESSAGE_EDGE",markerEnd:{type:ge.MarkerType.Arrow},data:{label:""}},Fl=({id:e,source:t,target:o,data:n,selected:r})=>{let{zoom:i}=(0,ge.useViewport)(),{updateEdgeData:s}=(0,ge.useReactFlow)(),{isMultipleSelection:a}=D(),[l,c]=(0,zl.useState)(!1),d=(0,ge.useInternalNode)(t),f=(0,ge.useInternalNode)(o);if(!d||!f)return null;let{sx:u,sy:p,tx:h,ty:m,sourcePos:g,targetPos:T}=ft(d,f),[x,y,E]=(0,ge.getSmoothStepPath)({sourceX:u,sourceY:p,targetX:h,targetY:m,sourcePosition:g,targetPosition:T}),b=r||(d==null?void 0:d.selected)||(f==null?void 0:f.selected),A=b?"sequence-edge-marker-highlighted":"sequence-edge-marker",v=l||(n==null?void 0:n.label.trim().length)>0,C=1/i,L=()=>{c(!0)},w=()=>{c(!1)},S=M=>{s(e,{label:M.trim()})};return(0,yt.jsxs)("g",{className:P("text-grey-400 hover:text-grey-500",{"text-blue-500 hover:text-blue-600":b}),onBlur:w,onDoubleClick:L,children:[(0,yt.jsx)(ge.BaseEdge,{id:e,path:x,markerEnd:`url(#${A})`,strokeDasharray:4,className:P("stroke-2 stroke-current transition-colors duration-75",{"stroke-red-500 hover:stroke-red-600":n==null?void 0:n.hasError,"stroke-blue-500 hover:stroke-blue-600 drop-shadow-[0_0_3px_rgba(59,130,246,0.5)]":b&&!(n!=null&&n.hasError)})}),(0,yt.jsx)(ge.EdgeLabelRenderer,{children:(0,yt.jsxs)("div",{className:"absolute z-[3000] pointer-events-auto flex flex-col items-center gap-1",style:{transform:`translate(-50%, -50%) translate(${y}px, ${E}px)`},children:[r&&!a&&(0,yt.jsx)(co,{edgeId:e,edgeType:"MESSAGE_EDGE",style:{transform:`scale(${C})`}}),v&&(0,yt.jsx)(le,{value:n==null?void 0:n.label,className:"min-w-8 max-w-56 bg-white rounded-md px-2 py-1 text-xs",isEditing:l,onChange:S})]})})]})};var Wl=require("@xyflow/react"),rn=require("react/jsx-runtime"),Ul=({toX:e,toY:t,fromPosition:o,toPosition:n,fromNode:r})=>{if(!r)return null;let i={id:"connection-target",measured:{width:1,height:1},internals:{positionAbsolute:{x:e,y:t}}},{sx:s,sy:a,tx:l,ty:c,sourcePos:d,targetPos:f}=ft(r,i),[u]=(0,Wl.getBezierPath)({sourceX:s,sourceY:a,sourcePosition:d||o,targetPosition:f||n,targetX:l||e,targetY:c||t});return(0,rn.jsxs)("g",{children:[(0,rn.jsx)("path",{fill:"none",className:"stroke-2 stroke-grey-400 animated",d:u}),(0,rn.jsx)("circle",{cx:l||e,cy:c||t,fill:"none",r:4,className:"stroke-2 stroke-grey-500"})]})};var Xl=({nodes:e,setNodes:t,setEdges:o})=>{let n=(0,br.useStoreApi)(),{getInternalNode:r,screenToFlowPosition:i}=(0,br.useReactFlow)(),{draggableNode:s,setDraggableNode:a}=mo(),{setIsDragging:l}=D(),{rebuildIndex:c,forceRebuildIndex:d}=ao(),{t:f}=(0,Yl.useTranslation)(),[u,p]=(0,$l.useState)(null),h=(w,S=!1)=>{let M=S?"[&>div]:bg-red-50 [&>div]:outline [&>div]:outline-[3px] [&>div]:outline-red-500":"[&>div]:bg-green-50/75 [&>div]:outline [&>div]:outline-[3px] [&>div]:outline-green-500";t(I=>I.map(V=>N(_({},V),{className:V.id===w?M:""})))},m=()=>{let{nodeLookup:w}=n.getState();return Array.from(w.values())},g=w=>{let S=r(w.id),M=m();if(w.type==="LANE"){if(fo({parentId:w.id,nodes:e,includeTypes:["LANE"]})){h();return}let ne=M.filter(Y=>Y.id!==w.id&&Y.type==="LANE"&&!Y.parentId),G=on(S,ne);if(!G){h();return}if(fo({parentId:G.id,nodes:e,excludeTypes:["LANE"]})){h(G.id,!0);return}h(G.id);return}let V=M.filter(J=>J.id!==w.id&&J.type==="LANE"),K=on(S,V);if(!K){h();return}if(fo({parentId:K.id,nodes:e,includeTypes:["LANE"]})){h();return}h(K.id)},T=w=>w.map(S=>N(_({},S),{className:void 0})),x=w=>w.some(M=>M.dragging)?w.map(M=>M.dragging?N(_({},M),{dragging:!1}):M):w,y=w=>{w.preventDefault(),w.dataTransfer.dropEffect="move"},E=(w,S)=>{w.preventDefault(),g(S)},b=(w,S,M)=>{var J,ne;let I=[...M];if(w.parentId===S.id)return I=Ol(w,S,I),I=nn(I),T(I);if(w.type==="LANE"){if(fo({parentId:S.id,nodes:I,excludeTypes:["LANE"]})){let fe=Te(S),bt=50,Yt=50;return I.map(Ke=>{var So,hn;return Ke.id===w.id?N(_({},Ke),{position:{x:(So=u==null?void 0:u.x)!=null?So:fe.x+bt,y:(hn=u==null?void 0:u.y)!=null?hn:fe.y2+Yt}}):Ke})}let Y=I.filter(fe=>fe.parentId===S.id).reduce((fe,bt)=>{var Yt,Ke;return fe+((Ke=(Yt=bt.measured)==null?void 0:Yt.height)!=null?Ke:0)},0),Ie={x:q.HEADER_WIDTH,y:Y};return I=I.map(fe=>fe.id===w.id?N(_({},fe),{parentId:S.id,position:Ie,className:void 0}):N(_({},fe),{className:void 0})),I=Vt(S.id,I),I}if(fo({parentId:S.id,nodes:I,includeTypes:["LANE"]})){let G;if(w.parentId){let U=r(w.parentId),{x:Y,y:Ie}=je(U);G={x:Y+((J=w.position.x)!=null?J:0),y:Ie+((ne=w.position.y)!=null?ne:0)}}return I=I.map(U=>U.id===w.id?N(_({},U),{position:G!=null?G:U.position,parentId:void 0,className:void 0}):N(_({},U),{className:void 0})),I}let z=Ll(w,S);return I=I.map(G=>{if(G.id===w.id){let U=Te(w),Y=Te(S);return U.y<Y.y&&(z.y=0),U.x<Y.x+q.HEADER_WIDTH&&(z.x=q.HEADER_WIDTH),N(_({},G),{parentId:S.id,position:z,className:void 0})}return N(_({},G),{className:void 0})}),I=nn(I),I},A=w=>{if(w.preventDefault(),!(s!=null&&s.type))return;let S=i({x:w.clientX,y:w.clientY}),M={width:R[s.type].MIN_WIDTH,height:R[s.type].MIN_HEIGHT},I={id:(0,mi.v7)(),type:s.type,position:S,measured:M,data:{label:s.type==="TASK"?yr(e,f("bpmn.task.label.prefix")):"",variant:s.variant,attribute:s.attribute},selected:!0},V=N(_({},I),{internals:{positionAbsolute:S}}),K=m(),z=s.type==="LANE",J=K.filter(Y=>z?Y.type==="LANE"&&!Y.parentId:Y.type==="LANE"),ne=on(V,J),G=[...e.map(Y=>N(_({},Y),{selected:!1})),I];ne&&(G=b(V,ne,G)),G=et(G),t(G),d();let U=w.dataTransfer.getData("sourceId");if(U){let Y={id:(0,mi.v7)(),source:U,target:I.id};if(s.type==="ANNOTATION"){o(Ie=>Ie.concat(_(_({},Y),uo)));return}o(Ie=>Ie.concat(_(_({},Y),Ne)))}l(!1),a(null)},v=async(w,S,M)=>{let I=[...e];M.forEach(V=>{let K=m(),z=r(V.id),J=V.type==="LANE",ne=K.filter(U=>U.id!==V.id&&(J?U.type==="LANE"&&!U.parentId:U.type==="LANE")),G=on(z,ne);if(G){I=b(z,G,I);return}V.parentId&&(I=L(V,I))}),I=x(I),I=et(I),I=T(I),t(I),c(I),p(null)},C=(w,S)=>{p({x:S.position.x,y:S.position.y})},L=(w,S)=>{var z,J;let M=r(w.parentId),{x:I,y:V}=je(M),K={x:I+((z=w.position.x)!=null?z:0),y:V+((J=w.position.y)!=null?J:0)};return S=S.map(ne=>ne.id===w.id?N(_({},ne),{position:K,parentId:void 0}):ne),S=Vt(w.parentId,S),S};return{onDragOver:y,onDrop:A,onNodeDrag:E,onNodeDragStart:C,onNodeDragStop:v}};var Kl=require("@xyflow/react"),ql=require("lecom-ui"),Zl=require("react"),gi=require("uuid");var em=30,tm=e=>{if(!e||!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase(),o=t==="input"||t==="textarea",n=e.isContentEditable,r=t==="select",i=e.closest('[contenteditable="true"], input, textarea, select')!==null;return o||n||r||i},om=e=>!tm(e.target),Jl=({offset:e=em}={})=>{let{getNodes:t,setNodes:o,getEdges:n,setEdges:r}=(0,Kl.useReactFlow)(),{t:i}=(0,ql.useTranslation)();(0,Zl.useEffect)(()=>{let s=a=>{if(a.ctrlKey&&a.key.toLowerCase()==="d"&&om(a)){a.preventDefault(),a.stopPropagation();let l=t(),c=n(),d=l.filter(y=>y.selected);if(!d.length)return;let f=new Map,u=[],p=l.some(y=>y.type==="START_EVENT"),h=d.filter(y=>y.type==="START_EVENT"),m=d;if(p&&h.length>0&&(m=d.filter(y=>y.type!=="START_EVENT"),m.length===0))return;let g=c.filter(y=>m.some(E=>E.id===y.source)&&m.some(E=>E.id===y.target)),T=m.map(y=>{var A;let E=(0,gi.v7)();f.set(y.id,E);let b=N(_({},y),{id:E,selected:!0,position:{x:y.position.x+e,y:y.position.y+e}});if(y.type==="TASK"){let v=(A=y.data)==null?void 0:A.label,C=po(v||i("bpmn.task.label.prefix"),[...l,...u]);b.data=N(_({},y.data),{label:C})}return u.push(b),b}),x=g.map(y=>N(_({},y),{id:(0,gi.v7)(),selected:!0,source:f.get(y.source)||y.source,target:f.get(y.target)||y.target}));o(y=>[...y.map(E=>N(_({},E),{selected:!1})),...T]),r(y=>[...y.map(E=>N(_({},E),{selected:!1})),...x])}};return document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("keydown",s,!0)}},[t,o,n,r,e,i])};var Oc=require("@xyflow/react"),un=require("uuid");var jl={"start-event":"START_EVENT","end-event":"END_EVENT",task:"TASK","gateway-exclusive":"GATEWAY"},ec={"start-event":"","end-event":"",task:"","gateway-exclusive":"EXCLUSIVE"},Ql=(e,t)=>{if(!e){console.warn("Step not found");return}e=e.trim();let o=e.match(/(\<.*?\>)/)||[],n=e.match(/(\[.*?\])/)||[],r=e.match(/(\{.*?\})/)||[],i=e.match(/(--.*|\|.*?\|)/i)||[],s="",a="",l="";if(o.length){switch(o[1]){case"<start>":s="start-event";break;case"<end>":s="end-event";break}e=e.replace(o[1],"")}return n.length&&(s="task",a=n[1].replace(/\[|\]/g,""),e=e.replace(n[1],"")),r.length&&(s="gateway-exclusive",a=r[1].replace(/\{|\}/g,""),e=e.replace(r[1],"")),s||(s="task",a=e),i.length&&(l=i[1].replace(/(\||--)/g,""),e=e.replace(i[1],"")),e=e.trim(),t[e]||(t[e]={type:s,label:a}),{step:e,type:s,label:a,edgeLabel:l}},nm=e=>{e=e||"";let t=e.trim().split(`
2
+ `),o={},n=[];return t.forEach(r=>{r=r||"";let i=r.trim().split("-->");if(i.length!==2){console.warn("Invalid number of steps");return}let s=Ql(i[0],o),a=Ql(i[1],o);s&&a&&n.push({sourceId:s.step,targetId:a.step,label:s.edgeLabel||a.edgeLabel||""})}),{components:o,connections:n}},tc=e=>{let{components:t,connections:o}=nm(e);return{nodes:t,edges:o}};var ho=require("@xyflow/react");var sn=require("@xyflow/react");var hi=require("react/jsx-runtime"),ae=i=>{var s=i,{type:e,position:t,className:o,nodeType:n}=s,r=Ge(s,["type","position","className","nodeType"]);let a=n==="TASK";return(0,hi.jsx)(sn.Handle,_({type:e,position:t,className:P("size-2.5 border border-grey-400 bg-white relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":a,"before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":!a},o)},r))},Tr=a=>{var l=a,{nodeId:e,nodeType:t,gatewayVariant:o,type:n,position:r,className:i}=l,s=Ge(l,["nodeId","nodeType","gatewayVariant","type","position","className"]);let{getEdges:c}=(0,sn.useReactFlow)(),f=(()=>{if(n!=="source")return!1;let u=c();return t==="TASK"?u.filter(h=>h.source===e).length>=2:t==="GATEWAY"&&o==="EXCLUSIVE"?u.filter(h=>h.source===e).length>=2:!1})();return(0,hi.jsx)(sn.Handle,_({type:n,position:r,className:P("size-2.5 border border-grey-400 bg-white transition-all duration-200 relative",{"before:content-[''] before:absolute before:inset-[-16px] before:bg-transparent":t==="TASK","before:content-[''] before:absolute before:inset-[-4px] before:bg-transparent":t!=="TASK","opacity-50 cursor-not-allowed pointer-events-none":f,"hover:border-grey-500":!f},i),style:{pointerEvents:f?"none":"auto"}},s))};var vr=require("@xyflow/react"),oc=require("lodash");var nc=require("react/jsx-runtime"),go=n=>{var r=n,{nodeId:e,isVisible:t}=r,o=Ge(r,["nodeId","isVisible"]);let{getNode:i,getNodes:s,setNodes:a}=(0,vr.useReactFlow)(),{isMultipleSelection:l}=D(),c=({width:f,height:u})=>{if(!e)return;let p=i(e);if((p==null?void 0:p.type)!=="LANE")return;let h=[...s()],m=!p.parentId,g=m?p.id:p.parentId,T=h.filter(E=>E.type==="LANE"&&E.parentId===g);if(!T.length)return;let x=(0,oc.orderBy)(T,["position.y"]),y=0;x.forEach((E,b)=>{var C,L;let A=b===x.length-1,v=(L=(C=E.measured)==null?void 0:C.height)!=null?L:0;h=h.map(w=>{if(w.id===E.id){let S=m?f-q.HEADER_WIDTH:f,M=N(_({},w),{width:S,measured:N(_({},w.measured),{width:S}),position:N(_({},w.position),{y})});return A&&m&&(M.height=u-y),M}return w}),y+=v}),h=h.map(E=>{if(E.id===g){let b=m?f:f+q.HEADER_WIDTH;return N(_({},E),{width:b,height:m?u:y,measured:{width:b,height:m?u:y}})}return E}),a(h)};return(0,nc.jsx)(vr.NodeResizer,_({nodeId:e,handleClassName:"size-1.5 bg-blue-400",lineClassName:"border-blue-400/90 border-dashed",isVisible:!l&&t,onResizeEnd:(f,u)=>c(u)},o))};var Ar=require("@xyflow/react"),Ye=require("lecom-ui"),an=require("react");var Nr=require("react"),rc=(e,t=!1)=>{let[o,n]=(0,Nr.useState)({width:0,height:0});return(0,Nr.useEffect)(()=>{if(e.current&&t){let r=e.current.getBoundingClientRect();n({width:r.width,height:r.height})}},[t,e]),{dimensions:o}};var xt=require("@xyflow/react"),ic=require("react"),rm=120,im=12,sc=(e,t=!1,o)=>{let{getNode:n,getViewport:r}=(0,xt.useReactFlow)(),{instanceId:i}=D();return(0,ic.useMemo)(()=>{var p,h;if(!t)return{position:xt.Position.Right,align:"start"};let s=n(e);if(!s)return{position:xt.Position.Right,align:"start"};let a=r(),l=s.position.x*a.zoom+a.x,c=(((p=s.measured)==null?void 0:p.width)||s.width||100)*a.zoom,d=(h=document.getElementById(`modeler-${i}`))==null?void 0:h.clientWidth;if(!d)return{position:xt.Position.Right,align:"start"};let f=(o==null?void 0:o.width)||rm;return{position:l+c+f+im>d?xt.Position.Left:xt.Position.Right}},[i,e,t,o,n,r])};var wr=require("@xyflow/react"),O=require("lecom-ui"),ac=require("lucide-react");var $=require("react/jsx-runtime"),lc=({nodeId:e})=>{let{t}=(0,O.useTranslation)(),{updateNodeData:o,getEdges:n,getNode:r}=(0,wr.useReactFlow)(),i=(0,wr.useNodesData)(e),a=n().filter(p=>p.source===e).some(p=>{let h=r(p.target);return(h==null?void 0:h.type)==="END_EVENT"}),l=(i==null?void 0:i.data.variant)==="SUBPROCESS",c=f=>{o(e,{variant:(i==null?void 0:i.data.variant)===f?"":f})},d=f=>{o(e,{attribute:(i==null?void 0:i.data.attribute)===f?"":f})};return(0,$.jsxs)(O.DropdownMenu,{children:[(0,$.jsxs)(O.Tooltip,{children:[(0,$.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(O.DropdownMenuTrigger,{asChild:!0,children:(0,$.jsx)(O.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,children:(0,$.jsx)(ac.WrenchIcon,{})})})}),(0,$.jsx)(O.TooltipContent,{color:"black",children:t("bpmn.task.menu.title")})]}),(0,$.jsxs)(O.DropdownMenuContent,{align:"start",className:"w-60 bg-white text-grey-600",children:[(0,$.jsxs)(O.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(Cn).map(([f,u])=>{let p=f==="LOOP"&&(a||l),m=(()=>{if(f==="LOOP"&&a)return t("editor.task_menu.loop_not_allowed_when_connected_to_end");if(f==="LOOP"&&l)return t("editor.task_menu.loop_not_allowed_when_subprocess")})();return(0,$.jsxs)(O.Tooltip,{children:[(0,$.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,$.jsx)(O.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,disabled:p,className:P({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.attribute)===f,"opacity-50 cursor-not-allowed":p}),onClick:p?void 0:()=>d(f),children:(0,$.jsx)(u.icon,{className:"stroke-inherit"})})}),m&&(0,$.jsx)(O.TooltipContent,{color:"black",children:m})]},f)})})]}),(0,$.jsx)(O.DropdownMenuGroup,{children:(0,$.jsxs)(O.Tooltip,{children:[(0,$.jsx)(O.TooltipTrigger,{asChild:!0,children:(0,$.jsxs)(O.DropdownMenuItem,{className:P({"bg-grey-100 text-blue-500":(i==null?void 0:i.data.variant)==="SCRIPT","opacity-50 cursor-not-allowed":a}),disabled:a,onClick:a?void 0:()=>c("SCRIPT"),children:[(0,$.jsx)(An.SCRIPT.icon,{className:"stroke-current"}),t(`bpmn.task.variant.${"SCRIPT".toLowerCase()}`)]})}),a&&(0,$.jsx)(O.TooltipContent,{color:"black",children:t("editor.task_menu.script_not_allowed_when_connected_to_end")})]})})]})]})};var j=require("react/jsx-runtime"),_e=({nodeId:e,nodeType:t,nodeVariant:o,isChild:n,isVisible:r})=>{var C;let i=(0,an.useRef)(null),s=(0,an.useRef)(null),{t:a}=(0,Ye.useTranslation)(),{setDraggableNode:l}=mo(),{getEdges:c,getNodes:d}=(0,Ar.useReactFlow)(),{setIsDragging:f}=D(),{dimensions:u}=rc(i,r),{position:p}=sc(e,r,u),[h,m]=(0,an.useState)(void 0),g=d(),T=c(),x=o==="SUBPROCESS",y=(L,w)=>{l({type:w.type,variant:w.variant,attribute:w.attribute,icon:w.icon}),w.icon&&m((0,j.jsx)(w.icon,{})),L.dataTransfer.effectAllowed="move",L.dataTransfer.setData("sourceId",e),s.current&&L.dataTransfer.setDragImage(s.current,10,10),setTimeout(()=>{f(!0)},100)},E={START_EVENT:{type:"START_EVENT",icon:ko,label:a("bpmn.start_event.variant.default")},END_EVENT:{type:"END_EVENT",icon:Xt,label:a("bpmn.end_event.variant.default")},TASK:{type:"TASK",icon:ko,label:a("bpmn.task.variant.default")},ANNOTATION:{type:"ANNOTATION",icon:vn,label:a("bpmn.annotation.variant.default")}},b={EXCLUSIVE:{type:"GATEWAY",variant:"EXCLUSIVE",icon:Zt,label:a("bpmn.gateway.variant.exclusive")},PARALLEL:{type:"GATEWAY",variant:"PARALLEL",icon:Qt,label:a("bpmn.gateway.variant.parallel")},COMPLEX:{type:"GATEWAY",variant:"COMPLEX",icon:Kt,label:a("bpmn.gateway.variant.complex")}},A=[{component:(0,j.jsx)(sr,{elementId:e})}],v={START_EVENT:[{component:(0,j.jsx)(qo,{nodeId:e})},E.TASK,E.ANNOTATION,...A],TASK:[{component:(0,j.jsx)(Ko,{elementId:e})},...x?[]:[{component:(0,j.jsx)(lc,{nodeId:e})}],{component:(0,j.jsx)(qo,{nodeId:e})},E.TASK,...Object.values(b),...A],GATEWAY:[{component:(0,j.jsx)(Ko,{elementId:e})},{component:(0,j.jsx)(qo,{nodeId:e})},E.TASK,E.ANNOTATION,...A],END_EVENT:[{component:(0,j.jsx)(qo,{nodeId:e})},E.ANNOTATION,...A],LANE:[...n?[]:[E.ANNOTATION],...A],ANNOTATION:[...A],UNSUPPORTED:[...A]};return(0,j.jsxs)(Ar.NodeToolbar,{position:p,align:"start",className:"-top-8",isVisible:r,children:[(0,j.jsx)("div",{ref:i,className:"flex items-center gap-1 px-3 py-2 bg-white rounded-sm shadow-md",children:(C=v[t])==null?void 0:C.map((L,w)=>{if(L.component)return(0,j.jsx)("div",{children:L.component},w);let S={sourceNodeType:t,targetNodeType:L.type,sourceNodeId:e,nodes:g,edges:T},M=pl(S),I={gateway_limit_reached:a("editor.toolbar.gateway_limit_reached"),start_event_already_exists:a("editor.toolbar.start_event_already_exists"),script_to_end_not_allowed:a("editor.toolbar.script_to_end_not_allowed"),loop_to_end_not_allowed:a("editor.toolbar.loop_to_end_not_allowed"),initial_activity_to_end_not_allowed:a("editor.toolbar.initial_activity_to_end_not_allowed"),final_activity_cannot_connect:a("editor.toolbar.final_activity_cannot_connect"),activity_has_outgoing_connections:a("editor.toolbar.activity_has_outgoing_connections"),task_limit_reached:a("editor.toolbar.task_limit_reached")},V=M.shouldDisable&&M.reason?I[M.reason]||L.label:L.label||"";return(0,j.jsxs)(Ye.Tooltip,{children:[(0,j.jsx)(Ye.TooltipTrigger,{asChild:!0,children:(0,j.jsx)(Ye.Button,{variant:"ghost",color:"grey",size:"small",iconButton:!0,draggable:!M.shouldDisable,disabled:M.shouldDisable,className:M.shouldDisable?"opacity-50 cursor-not-allowed":"",onDragStart:M.shouldDisable?void 0:K=>y(K,L),children:L.icon&&(0,j.jsx)(L.icon,{size:16})})}),(0,j.jsx)(Ye.TooltipContent,{color:"black",children:V})]},w)})}),(0,j.jsx)("div",{ref:s,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:h})]})};var Ot=require("react/jsx-runtime"),cc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,ho.useReactFlow)(),{inProgress:i,fromNode:s}=(0,ho.useConnection)(),{isConnecting:a,isDragging:l,isMultipleSelection:c}=D(),d=i&&(s==null?void 0:s.id)!==e,f=p=>{r(e,{label:p})},u=!a&&!l&&!c;return(0,Ot.jsxs)("div",{className:P("relative w-full h-full min-w-44 min-h-16 flex text-grey-400 hover:text-grey-500 bg-white rounded-sm 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,Ot.jsx)(le,{value:t.label,className:"m-1 text-grey-600",onChange:f}),u&&(0,Ot.jsx)(_e,{nodeId:e,nodeType:"ANNOTATION",isVisible:!n&&o}),(0,Ot.jsx)(go,{minWidth:_r.MIN_WIDTH,minHeight:_r.MIN_HEIGHT,isVisible:!n&&o}),(!i||d)&&(0,Ot.jsx)(ae,{type:"target",position:ho.Position.Left,className:P({"annotation-handle":d})})]})};var Ht=require("@xyflow/react"),dc=require("react");var tt=require("react/jsx-runtime"),uc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Ht.useReactFlow)(),{inProgress:i,fromNode:s}=(0,Ht.useConnection)(),{isConnecting:a,isDragging:l,isMultipleSelection:c}=D(),[d,f]=(0,dc.useState)(!1),u=i&&(s==null?void 0:s.id)!==e,p=T=>{r(e,{label:T})},h=()=>{f(!0)},m=()=>{f(!1)},g=!a&&!l&&!c;return(0,tt.jsxs)("div",{className:"relative",onBlur:m,onDoubleClick:h,children:[(0,tt.jsx)(Xt,{className:P("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,tt.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,tt.jsx)(le,{value:t.label,isEditing:d,onChange:p})}),g&&(0,tt.jsx)(_e,{nodeId:e,nodeType:"END_EVENT",isVisible:!n&&o}),(!i||u)&&(0,tt.jsx)(ae,{type:"target",position:Ht.Position.Left,className:P({"event-handle":u})}),!i&&(0,tt.jsx)(ae,{type:"source",position:Ht.Position.Right})]})};var Gt=require("@xyflow/react"),pc=require("react");var ot=require("react/jsx-runtime"),fc=({id:e,data:t,selected:o,dragging:n})=>{let r=$r[t.variant].icon,{updateNodeData:i}=(0,Gt.useReactFlow)(),{inProgress:s,fromNode:a}=(0,Gt.useConnection)(),{isConnecting:l,isDragging:c,isMultipleSelection:d}=D(),[f,u]=(0,pc.useState)(!1),p=s&&(a==null?void 0:a.id)!==e,h=x=>{i(e,{label:x})},m=()=>{u(!0)},g=()=>{u(!1)},T=!l&&!c&&!d;return(0,ot.jsxs)("div",{className:"relative",onBlur:g,onDoubleClick:m,children:[(0,ot.jsx)(r,{className:P("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,ot.jsx)("div",{className:"absolute top-14 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,ot.jsx)(le,{value:t.label,isEditing:f,onChange:h})}),T&&(0,ot.jsx)(_e,{nodeId:e,nodeType:"GATEWAY",isVisible:!n&&o}),(!s||p)&&(0,ot.jsx)(ae,{type:"target",position:Gt.Position.Left,className:P({"gateway-handle":p})}),!s&&(0,ot.jsx)(Tr,{type:"source",position:Gt.Position.Right,nodeId:e,nodeType:"GATEWAY",gatewayVariant:t.variant})]})};var mc=require("@xyflow/react"),Oe=require("lecom-ui"),sm=require("lucide-react");var gc=require("react/jsx-runtime");var Bt=require("@xyflow/react"),hc=require("react");var nt=require("react/jsx-runtime"),yc=({id:e,data:t,selected:o,dragging:n})=>{let{updateNodeData:r}=(0,Bt.useReactFlow)(),{inProgress:i,fromNode:s}=(0,Bt.useConnection)(),{isConnecting:a,isDragging:l,isMultipleSelection:c}=D(),[d,f]=(0,hc.useState)(!1),u=i&&(s==null?void 0:s.id)!==e,p=T=>{r(e,{label:T})},h=()=>{f(!0)},m=()=>{f(!1)},g=!a&&!l&&!c;return(0,nt.jsxs)("div",{className:"relative",onBlur:m,onDoubleClick:h,children:[(0,nt.jsx)(wn,{className:P("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,nt.jsx)("div",{className:"absolute top-9 left-1/2 -translate-x-1/2 max-w-80 w-max",children:(0,nt.jsx)(le,{value:t.label,isEditing:d,onChange:p})}),g&&(0,nt.jsx)(_e,{nodeId:e,nodeType:"START_EVENT",isVisible:!n&&o}),(!i||u)&&(0,nt.jsx)(ae,{type:"target",position:Bt.Position.Left,className:P({"event-handle":u})}),!i&&(0,nt.jsx)(ae,{type:"source",position:Bt.Position.Right})]})};var zt=require("@xyflow/react"),bc=require("lecom-ui");var ln=require("react/jsx-runtime"),xc=e=>(0,ln.jsxs)("svg",N(_({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,ln.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#10B981"}),(0,ln.jsx)("path",{d:"M7 12L10 15L17 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var yi=require("react/jsx-runtime"),Ec=e=>(0,yi.jsx)("svg",N(_({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:(0,yi.jsx)("path",{d:"M12 2C8.13 2 5 5.13 5 9C5 14.25 12 22 12 22C12 22 19 14.25 19 9C19 5.13 15.87 2 12 2ZM12 11.5C10.62 11.5 9.5 10.38 9.5 9C9.5 7.62 10.62 6.5 12 6.5C13.38 6.5 14.5 7.62 14.5 9C14.5 10.38 13.38 11.5 12 11.5Z",fill:"#38bdf8"})}));var cn=require("react/jsx-runtime"),_c=e=>(0,cn.jsxs)("svg",N(_({width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[(0,cn.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"#EF4444"}),(0,cn.jsx)("path",{d:"M8 8L16 16M8 16L16 8",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}));var he=require("react/jsx-runtime"),Tc=({id:e,data:t,selected:o,dragging:n})=>{let{t:r}=(0,bc.useTranslation)(),{updateNodeData:i,getNodes:s}=(0,zt.useReactFlow)(),{inProgress:a,fromNode:l}=(0,zt.useConnection)(),{isConnecting:c,isDragging:d,isMultipleSelection:f,onSubprocessValidationClick:u}=D(),{getTaskStatus:p}=Nt(),h=a&&(l==null?void 0:l.id)!==e,m=M=>{let I=M.trim(),V=t.label||"";if(I===V)return;let K=s(),z=I;I||(z=yr(K,r("bpmn.task.label.prefix")));let J=po(z,K);J!==V&&i(e,{label:J})},g={APROVADO:xc,EM_ANDAMENTO:Ec,REJEITADO:_c},T={APROVADO:"border-green-500 border-[3px] border-solid",EM_ANDAMENTO:"border-turquoise-400 border-[3px] border-solid",REJEITADO:"border-red-500 border-[3px] border-solid",default:"border-grey-400 border-2 border-solid",error:"border-red-500 border-[3px] shadow-[0_0_5px_rgba(255,0,0,0.5)]"},x=p(e),y=x?g[x]:null,E=t.variant?An[t.variant].icon:null,b=t.attribute?Cn[t.attribute].icon:null,A=t.variant==="SUBPROCESS",v=E&&!A,C=b||A,L=()=>t.hasError?T.error:x?T[x]:T.default,w=()=>{u==null||u({id:e,type:"sub_process",label:t.label})},S=!c&&!d&&!f;return(0,he.jsxs)("div",{className:P("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 hover:shadow-md transition-colors duration-75",L(),{"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,he.jsx)(le,{value:t.label,maxLength:60,className:P("m-1",{"py-6":v||C}),onChange:m}),E&&(0,he.jsx)("div",{className:P("absolute flex items-center p-1",A?"bottom-0":"top-0 left-0"),children:(0,he.jsx)(E,{size:16,className:P(t.hasError?"text-red-500":"text-grey-500",A&&"cursor-pointer"),onClick:A?w:void 0})}),b&&(0,he.jsx)("div",{className:"absolute bottom-0 left-0 w-full flex items-center justify-center",children:(0,he.jsx)("div",{className:P("flex items-center w-16 p-1",A?"justify-between":"justify-center"),children:(0,he.jsx)(b,{size:16,className:P(t.hasError?"text-red-500":"text-grey-500")})})}),y&&(0,he.jsx)("div",{className:"absolute top-0 right-0 flex items-center p-1",children:(0,he.jsx)(y,{})}),S&&(0,he.jsx)(_e,{nodeId:e,nodeType:"TASK",nodeVariant:t.variant,isVisible:!n&&o}),(0,he.jsx)(go,{minWidth:xr.MIN_WIDTH,minHeight:xr.MIN_HEIGHT,isVisible:!n&&o}),(!a||h)&&(0,he.jsx)(ae,{type:"target",position:zt.Position.Left,className:P({"task-handle":h})}),!a&&(0,he.jsx)(Tr,{type:"source",position:zt.Position.Right,nodeId:e,nodeType:"TASK"})]})};var xi=require("@xyflow/react");var rt=require("react/jsx-runtime"),vc=({id:e,data:t,selected:o,dragging:n})=>{let{isConnecting:r,isDragging:i,isMultipleSelection:s}=D(),a=!r&&!i&&!s;return(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.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}),a&&(0,rt.jsx)(_e,{nodeId:e,nodeType:"UNSUPPORTED",isVisible:!n&&o}),(0,rt.jsx)(ae,{type:"source",position:xi.Position.Right}),(0,rt.jsx)(ae,{type:"target",position:xi.Position.Left})]})};var Cr=require("@xyflow/react"),Nc=require("lodash"),dn=require("react");var Ae=require("react/jsx-runtime"),wc=({id:e,data:t,selected:o,dragging:n,parentId:r})=>{let{updateNodeData:i,getNodes:s}=(0,Cr.useReactFlow)(),{isConnecting:a,isDragging:l,isMultipleSelection:c}=D(),[d,f]=(0,dn.useState)(!1),u=s(),p=!r,h=(0,dn.useMemo)(()=>(0,Nc.orderBy)([...u.filter(b=>b.parentId===e&&b.type==="LANE")],"position.y","asc"),[u,e]),m=p?Er.MIN_WIDTH:q.MIN_WIDTH,g=(0,dn.useMemo)(()=>{if(p&&h.length>1){let b=[...h];return b.pop(),b.reduce((v,C)=>{var L,w;return v+((w=(L=C.measured)==null?void 0:L.height)!=null?w:0)},0)+q.MIN_HEIGHT}return q.MIN_HEIGHT},[p,h]),T=b=>{i(e,{label:b})},x=()=>{f(!0)},y=()=>{f(!1)},E=!a&&!l&&!c;return(0,Ae.jsxs)(Ae.Fragment,{children:[(0,Ae.jsxs)("div",{className:P("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,Ae.jsx)("div",{className:"flex align-items justify-center w-10 border-r-2 border-grey-400",onBlur:y,onDoubleClick:x,children:(0,Ae.jsx)("div",{className:P("relative flex-1",{"[writing-mode:vertical-rl] [text-orientation:sideways] transform rotate-180":!d}),children:(0,Ae.jsx)(le,{value:t.label,className:"w-full h-full pointer-events-none self-auto",contentClassName:P({"whitespace-nowrap":d}),isEditing:d,onChange:T})})}),(0,Ae.jsx)("div",{className:"flex-1"})]}),E&&(0,Ae.jsx)(_e,{nodeId:e,nodeType:"LANE",isChild:!p,isVisible:!n&&o}),(0,Ae.jsx)(go,{nodeId:e,minWidth:m,minHeight:g,isVisible:!n&&o}),p&&(0,Ae.jsx)(ae,{type:"source",position:Cr.Position.Right})]})};var Ac={START_EVENT:yc,END_EVENT:uc,TASK:Tc,GATEWAY:fc,ANNOTATION:cc,LANE:wc,UNSUPPORTED:vc},Cc={SEQUENCE_EDGE:ll,MESSAGE_EDGE:Fl,ANNOTATION_EDGE:sl},Ic="#fafafa",Sc="#bebebe",Mc=1,Pc=10,Lc="bottom-left",kc=.2,Dc=5,yo=.3,Rc={x:0,y:0,zoom:.75},am=1,lm=2,Vc=[am,lm];var Hc=()=>{let{setNodes:e,setEdges:t,fitView:o}=(0,Oc.useReactFlow)();return{importFromLia:r=>{let i=typeof r=="string"?r:r.diagramXml||"",{nodes:s,edges:a}=tc(i),l=[],c=new Map,d=!1;for(let[h,m]of Object.entries(s)){let g=(0,un.v7)(),T=jl[m.type],x=ec[m.type];T==="START_EVENT"&&(d=!0),c.set(h,g);let y=R[T].MIN_WIDTH,E=R[T].MIN_HEIGHT;l.push({id:g,type:T,data:{label:m.label||"",variant:x,attribute:""},position:{x:0,y:0},width:y,height:E,measured:{width:y,height:E}})}let f=[];for(let h of a){let m=N(_({},Ne),{id:(0,un.v7)(),source:c.get(h.sourceId)||h.sourceId,target:c.get(h.targetId)||h.targetId});f.push(m)}if(!d&&l.length>0){let h=(0,un.v7)(),m={id:h,type:"START_EVENT",data:{label:"",variant:"",attribute:""},position:{x:0,y:0},width:R.START_EVENT.MIN_WIDTH,height:R.START_EVENT.MIN_HEIGHT,measured:{width:R.START_EVENT.MIN_WIDTH,height:R.START_EVENT.MIN_HEIGHT}};l.unshift(m);let g=l[1];if(g){let T=N(_({},Ne),{id:(0,un.v7)(),source:h,target:g.id});f.unshift(T)}}let{nodes:u,edges:p}=Vl(l,f);e(u),t(p),o({padding:yo})}}};var jc=require("@xyflow/react"),Ti=require("react");var pn=(d=>(d.START_EVENT="start-event",d.END_EVENT_TERMINATE="end-event-terminate",d.TASK="task",d.TASK_SCRIPT="task-script",d.SUBPROCESS="subprocess-collapsed",d.GATEWAY_EXCLUSIVE="gateway-exclusive",d.GATEWAY_PARALLEL="gateway-parallel",d.GATEWAY_COMPLEX="gateway-complex",d.ANNOTATION="annotation",d.LANE="lane",d))(pn||{});var Ir=require("xml-js");var Gc={compact:!0,spaces:4},cm=e=>e.replaceAll(`
3
+ `,"&#xA;");function Sr(e,t=Gc){if(e)return JSON.parse((0,Ir.xml2json)(e,N(_({},t),{attributeValueFn:cm})))}function Bc(e,t=Gc){return e?(0,Ir.json2xml)(e,t):""}var bi=require("uuid");var zc={"attribute-loop":"LOOP"},Fc={"task-script":"SCRIPT","subprocess-collapsed":"SUBPROCESS"},Wc={"gateway-exclusive":"EXCLUSIVE","gateway-parallel":"PARALLEL","gateway-complex":"COMPLEX"},Uc={SCRIPT:"task-script",SUBPROCESS:"subprocess-collapsed"},Yc={EXCLUSIVE:"gateway-exclusive",PARALLEL:"gateway-parallel",COMPLEX:"gateway-complex"};var xo=(e,t,o)=>{let n=e._attributes.width||0,r=e._attributes.height||0,i=at(Number(n),t),s=at(Number(r),o);return{width:i,height:s,measured:{width:i,height:s}}},Eo=e=>{let{_attributes:t,mxGeometry:o}=e,{id:n,parent:r,value:i}=t,s={x:Number(o._attributes.x||0),y:Number(o._attributes.y||0)},a={id:n,position:s,data:{label:i||""}},l=r==="1"?void 0:r;return l&&(a.parentId=l),a},um=e=>{let{mxGeometry:t}=e,o=Eo(e),n=xo(t,R.START_EVENT.MIN_WIDTH,R.START_EVENT.MIN_HEIGHT);return N(_(_({},o),n),{type:"START_EVENT"})},pm=e=>{let{mxGeometry:t}=e,o=Eo(e),n=xo(t,R.END_EVENT.MIN_WIDTH,R.END_EVENT.MIN_HEIGHT);return N(_(_({},o),n),{type:"END_EVENT"})},Ei=(e,t)=>{let{_attributes:o,mxGeometry:n}=e,r=Eo(e),i=xo(n,R.TASK.MIN_WIDTH,R.TASK.MIN_HEIGHT),s=t==null?void 0:t.find(l=>{let{parent:c}=l._attributes;return c===e._attributes.id});if(s){let{style:l}=s._attributes,c=zc[l];c&&(r.data.attribute=c)}let a=Fc[o.style];return a&&(r.data.variant=a),N(_(_({},r),i),{type:"TASK"})},_i=e=>{let{_attributes:t,mxGeometry:o}=e,{style:n}=t,r=Eo(e),i=xo(o,R.GATEWAY.MIN_WIDTH,R.GATEWAY.MIN_HEIGHT);return r.data.variant=Wc[n],N(_(_({},r),i),{type:"GATEWAY"})},fm=e=>{let{mxGeometry:t}=e,o=Eo(e),n=xo(t,R.ANNOTATION.MIN_WIDTH,R.ANNOTATION.MIN_HEIGHT);return N(_(_({},o),n),{type:"ANNOTATION"})},mm=e=>{let{mxGeometry:t}=e,o=Eo(e),n=xo(t,R.LANE.MIN_WIDTH,R.LANE.MIN_HEIGHT);return N(_(_({},o),n),{type:"LANE"})},$c={task:Ei,"task-script":Ei,"subprocess-collapsed":Ei,"start-event":um,"end-event-terminate":pm,"gateway-parallel":_i,"gateway-exclusive":_i,"gateway-complex":_i,annotation:fm,lane:mm},Xc=e=>{let{_attributes:t}=e,{source:o,target:n,value:r,style:i}=t,s={id:(0,bi.v7)(),source:o,target:n,data:{label:r||""}};return i.includes("association")&&i.includes('endArrow=""')?_(_({},uo),s):_(_({},Ne),s)},Kc=(e,t)=>{let{id:o,type:n,source:r,target:i,data:s}=e,a=t==null?void 0:t.find(d=>d.id===r),l="";return n==="ANNOTATION_EDGE"&&(l='association;endArrow=""'),{_attributes:{id:o,parent:(a==null?void 0:a.parentId)||"1",edge:"1",style:l,source:r,target:i,value:(s==null?void 0:s.label)||""},mxGeometry:{_attributes:{as:"geometry",relative:"1"}}}},_o=e=>{let{id:t,parentId:o,position:n,measured:r,data:i}=e;return{_attributes:{id:t,parent:o||"1",value:i.label,vertex:"1"},mxGeometry:{_attributes:{as:"geometry",width:(r==null?void 0:r.width)||0,height:(r==null?void 0:r.height)||0,x:n.x||0,y:n.y||0}}}},gm=e=>{let{variant:t}=e.data,o=_o(e);return N(_({},o),{_attributes:N(_({},o._attributes),{style:Uc[t]||"task"})})},hm=e=>{let t=_o(e);return N(_({},t),{_attributes:N(_({},t._attributes),{style:"start-event"})})},ym=e=>{let t=_o(e);return N(_({},t),{_attributes:N(_({},t._attributes),{style:"end-event-terminate"})})},xm=e=>{let{variant:t}=e.data,o=_o(e);return N(_({},o),{_attributes:N(_({},o._attributes),{style:Yc[t]})})},Em=e=>{let t=_o(e);return N(_({},t),{_attributes:N(_({},t._attributes),{style:"lane"})})},_m=e=>{let t=_o(e);return N(_({},t),{_attributes:N(_({},t._attributes),{style:"annotation"})})},qc={TASK:gm,START_EVENT:hm,END_EVENT:ym,GATEWAY:xm,ANNOTATION:_m,LANE:Em},Zc=e=>{var i,s;let n=((i=e.measured)==null?void 0:i.width)||0,r=((s=e.measured)==null?void 0:s.height)||0;return{_attributes:{id:(0,bi.v7)(),parent:e.id,style:"attribute-loop",connectable:"0"},mxGeometry:{_attributes:{as:"geometry",x:n/2-22/2,y:r-22,width:22,height:22}}}};var bm=e=>{let t=Object.values(pn),o=e.filter(i=>{var a;let s=(a=i._attributes)==null?void 0:a.style;return t.includes(s)}),n=e.filter(i=>{var a;let s=(a=i._attributes)==null?void 0:a.style;return["attribute-loop"].includes(s)}),r=[];for(let i of o){let{style:s}=i._attributes,a=$c[s],l=a==null?void 0:a(i,n);if(!l){console.warn(`Node ${s} not supported`);continue}r.push(l)}return r},Tm=(e,t)=>{let o=e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}),n=[];for(let r of o){let i=Xc(r),s=t.find(l=>l.id===i.source),a=t.find(l=>l.id===i.target);(s==null?void 0:s.type)==="LANE"||(a==null?void 0:a.type)==="LANE"||n.push(i)}return n},vm=e=>{let t=[];return e.forEach(o=>{var i,s;let n=(s=(i=qc)[o.type])==null?void 0:s.call(i,o);if(!n){console.warn(`Node ${o.type} not supported`);return}if(t.push(n),o.type==="TASK"&&o.data.attribute==="LOOP"){let a=Zc(o);t.push(a)}}),t},Nm=(e,t)=>{let o=[];return e.forEach(n=>{let r=Kc(n,t);o.push(r)}),o},Jc=(e=[],t=[])=>{let o=vm(e),n=Nm(t,e),r={mxGraphModel:{root:{_attributes:{version:"1.1"},mxCell:[{_attributes:{id:"0"}},{_attributes:{id:"1",parent:"0"}},...o,...n]}}};return Bc(JSON.stringify(r))},Qc=async e=>{var s,a;let t=await Sr(e),o=((a=(s=t==null?void 0:t.mxGraphModel)==null?void 0:s.root)==null?void 0:a.mxCell)||[],n=bm(o),r=Tm(o,n);return{nodes:et(nn(n)),edges:r}};var ed=()=>{let{getNodes:e,getEdges:t,setNodes:o,setEdges:n,fitView:r}=(0,jc.useReactFlow)(),i=(0,Ti.useCallback)(async(a="")=>{let{nodes:l,edges:c}=await Qc(a);o(l),n(c),r({padding:yo})},[o,n,r]),s=(0,Ti.useCallback)((a,l)=>{let c=a||e()||[],d=l||t()||[];return Jc(c,d)},[e,t]);return{importFromMxGraph:i,exportToMxGraph:s}};var Mr=require("react"),wm={origin:"*",debug:!1};function td(e,t=wm){let{origin:o,debug:n}=t,r=(0,Mr.useCallback)((i,s)=>{let a={event:i,data:[i,{event:i,data:s}]};window.parent.postMessage(a,o||"*")},[o]);return(0,Mr.useEffect)(()=>{let i=s=>{let a=s.data;if(!(a!=null&&a.event)||!(a!=null&&a.data))return;let{event:l,data:c}=a,d;if(Array.isArray(c)){let[,f]=c;d=f.data}else d=c;n&&(console.debug("[postMessage] received:",a),console.debug("[postMessage] eventData:",d)),l&&e[l]&&e[l](d)};return window.addEventListener("message",i),()=>window.removeEventListener("message",i)},[e,n]),{sendMessage:r}}var vi=require("react"),od=require("@xyflow/react");function nd(){let{setTaskStatuses:e,clearTaskStatuses:t,calculateFlowPath:o}=Nt(),{getEdges:n}=(0,od.useReactFlow)(),r=In(),i=(0,vi.useCallback)(a=>{if(!(a!=null&&a.activities))return;e(a.activities);let l=a.activities.map(d=>d.diagramId),c=n();o(c,l),setTimeout(()=>{r()},0)},[e,o,n,r]),s=(0,vi.useCallback)(()=>{t(),setTimeout(()=>{r()},0)},[t,r]);return{handleTasksStatus:i,handleClearTaskStatus:s}}var sd=require("@xyflow/react"),De=require("react"),ad=require("use-debounce");var rd=[{nodes:[],edges:[]}],Am=500,id=100,ld=(e=rd)=>{let{getNodes:t,getEdges:o,setNodes:n,setEdges:r}=(0,sd.useReactFlow)(),[i,s]=(0,De.useState)(e),[a,l]=(0,De.useState)(0),c=i[a],d=a>0,f=a<i.length-1,u=(0,De.useCallback)(E=>{n(i[E].nodes),r(i[E].edges)},[i,n,r]),p=(0,De.useCallback)(()=>{if(a>0){let E=a-1;l(E),u(E)}},[a,u]),h=(0,De.useCallback)(()=>{if(a<i.length-1){let E=a+1;l(E),u(E)}},[i,a,u]),m=E=>{let A=[...i.slice(0,a+1),E],v=A.length>id?A.slice(A.length-id):A;s(v),l(v.length-1)},g=(0,ad.useDebouncedCallback)(()=>{let E=t(),b=o(),A=E.map(L=>N(_({},L),{selected:!1,className:""})),v={nodes:et(A),edges:b};JSON.stringify(c)!==JSON.stringify(v)&&m(v)},Am),T=(0,De.useCallback)(E=>{if(E==="forceSave"){g();return}E.some(v=>v.type==="select")||E.some(v=>v.type==="position"&&v.dragging)||g()},[g]),x=(0,De.useCallback)(E=>{s(E||rd),l(0)},[]),y=(0,De.useCallback)(()=>{s([]),l(0)},[]);return(0,De.useEffect)(()=>{let E=b=>{(b.ctrlKey||b.metaKey)&&(b.shiftKey&&b.key.toLowerCase()==="z"?(b.preventDefault(),h()):b.key.toLowerCase()==="z"&&(b.preventDefault(),p()))};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E)}},[p,h]),{history:i,undo:p,redo:h,canUndo:d,canRedo:f,saveHistory:T,resetHistory:x,clearHistory:y}};var Ni=require("react/jsx-runtime"),wi=({id:e,className:t})=>(0,Ni.jsx)("marker",{id:e,className:P("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,Ni.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 Z"})});var bo=require("react/jsx-runtime"),cd=()=>(0,bo.jsx)("svg",{style:{position:"absolute",top:0,left:0},children:(0,bo.jsxs)("defs",{children:[(0,bo.jsx)(wi,{id:"sequence-edge-marker",className:"text-grey-400"}),(0,bo.jsx)(wi,{id:"sequence-edge-marker-highlighted",className:"text-blue-500"})]})});var Ii=require("@xyflow/react"),re=require("lecom-ui"),No=require("lucide-react"),vo=require("react");var $e=require("lecom-ui");var fn=(x=>(x.START_EVENT="START_EVENT",x.END_EVENT="END_EVENT",x.TASK="TASK",x.SUBPROCESS="SUBPROCESS",x.GATEWAY="GATEWAY",x.LANE="LANE",x.ANNOTATION="ANNOTATION",x.CONNECTION="CONNECTION",x.INTERMEDIATE_EVENT="INTERMEDIATE_EVENT",x.ACTIVITY="ACTIVITY",x.PROCESS_INTERFACE="PROCESS_INTERFACE",x.WORKFLOW_INTERFACE="WORKFLOW_INTERFACE",x.VARIANT_ACTIVITY="VARIANT_ACTIVITY",x.AUTO_ACTIVITY="AUTO_ACTIVITY",x.DATA_STORE="DATA_STORE",x.DATA_OBJECT="DATA_OBJECT",x.DATA_OUTPUT="DATA_OUTPUT",x.DATA_INPUT="DATA_INPUT",x))(fn||{});var bd=require("@xyflow/react"),To=require("lecom-ui");var dd=async e=>new Promise((t,o)=>{let n=new FileReader;n.onload=r=>{var i;t((i=r.target)==null?void 0:i.result)},n.onerror=r=>{var i;o((i=r.target)==null?void 0:i.error)},n.readAsText(e)});function ud({columns:e=[],rows:t=[],fileName:o="report"}){if(!e.length||!t.length)return;let r="data:text/csv;charset=utf-8,"+[e,...t].map(s=>s.join(",")).join(`
4
+ `),i=encodeURI(r);Pr(i,`${o}.csv`)}var Pr=(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 Ed=require("uuid");function pd(e){return e==null?void 0:e.replaceAll("&#xA;"," ")}var gd=require("uuid");var Uw={START_EVENT:"START_EVENT",END_EVENT:"END_EVENT",TASK:"TASK",GATEWAY:"GATEWAY",ANNOTATION:"ANNOTATION"},fd={script:"SCRIPT",subprocess:"SUBPROCESS"},md={complex:"COMPLEX",none:"EXCLUSIVE",exclusive:"EXCLUSIVE",parallel:"PARALLEL"};var Ft=({cell:e,type:t,variant:o=""})=>{let{_attributes:n,mxGeometry:r}=e,{value:i,parent:s}=n,a=Number(r._attributes.width),l=Number(r._attributes.height),c=s==="1"?void 0:s;return{id:n.id,parentId:c,type:t,data:{label:i||"",variant:o,attribute:""},position:{x:Number(r._attributes.x)||0,y:Number(r._attributes.y)||0},width:a,height:l,measured:{width:a,height:l}}},Im=e=>{let{subType:t,style:o}=e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=R.START_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=R.START_EVENT.MIN_HEIGHT,{node:Ft({cell:e,type:"START_EVENT"}),status:n,originalType:o}},Sm=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n="imported";return["none"].includes(t)||(n="adapted"),e.mxGeometry._attributes.width=R.END_EVENT.MIN_WIDTH,e.mxGeometry._attributes.height=R.END_EVENT.MIN_HEIGHT,{node:Ft({cell:e,type:"END_EVENT"}),status:n,originalType:o}},Mm=e=>{let{subType:t,style:o}=e==null?void 0:e._attributes,n=fd[t],r="imported";return["script","none"].includes(t)||(r="adapted"),e.mxGeometry._attributes.width=at(e.mxGeometry._attributes.width||0,R.TASK.MIN_WIDTH),e.mxGeometry._attributes.height=at(e.mxGeometry._attributes.height||0,R.TASK.MIN_HEIGHT),{node:Ft({cell:e,type:"TASK",variant:n}),status:r,originalType:o}},Pm=e=>{let{style:t,subType:o}=e==null?void 0:e._attributes,n=md[o],r=["none","inclusive","event-based"],i="imported";return r.includes(o)&&(i="adapted"),e.mxGeometry._attributes.width=R.GATEWAY.MIN_WIDTH,e.mxGeometry._attributes.height=R.GATEWAY.MIN_HEIGHT,{node:Ft({cell:e,type:"GATEWAY",variant:n}),status:i,originalType:t}},Lm=e=>{let{style:t}=e==null?void 0:e._attributes;return{node:Ft({cell:e,type:"LANE"}),status:"imported",originalType:t}},km=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=at(e.mxGeometry._attributes.width||0,R.ANNOTATION.MIN_WIDTH),e.mxGeometry._attributes.height=at(e.mxGeometry._attributes.height||0,R.ANNOTATION.MIN_HEIGHT),{node:Ft({cell:e,type:"ANNOTATION"}),status:"imported",originalType:t}},hd=e=>{let{style:t}=e==null?void 0:e._attributes;return e.mxGeometry._attributes.width=R.UNSUPPORTED.MIN_WIDTH,e.mxGeometry._attributes.height=R.UNSUPPORTED.MIN_HEIGHT,{node:Ft({cell:e,type:"UNSUPPORTED"}),status:"unsupported",originalType:t}},yd=(e,t)=>{let{source:o,target:n,value:r}=e._attributes;return N(_({},Ne),{id:(0,gd.v7)(),source:t.get(o)||o,target:t.get(n)||n,data:{label:r||""}})},xd={TASK:Mm,GATEWAY:Pm,START_EVENT:Im,END_EVENT:Sm,LANE:Lm,ANNOTATION:km};var Dm=(e,t)=>{let o=e.filter(n=>n.parentId);for(let n of o){let r=t.get(n.parentId);r&&(n.parentId=r)}return e},Rm=e=>{var s;let t=new Map,o=Object.values(fn),n=e.filter(a=>{var c;let l=(c=a._attributes)==null?void 0:c.type;return o.includes(l)}),r=[],i=[];for(let a of n){let l=(0,Ed.v7)(),{type:c}=a._attributes,d=xd[c]||hd;t.set((s=a._attributes)==null?void 0:s.id,l),a._attributes.id=l;let{node:f,status:u,originalType:p}=d(a);i.push(f),r.push({originalType:p,type:f.type,variant:f.data.variant,value:pd(f.data.label),status:u})}return i=Dm(i,t),{nodes:i,governanceIdToNodeIdMap:t,summary:r}},Vm=(e,t)=>e.filter(r=>{var i;return(i=r._attributes)==null?void 0:i.edge}).map(r=>yd(r,t)),Om=e=>{let{mxGraphModel:t}=e,{nodes:o,governanceIdToNodeIdMap:n,summary:r}=Rm(t.root.mxCell),i=Vm(t.root.mxCell,n);return{nodes:o,edges:i,summary:r}},Hm=async e=>{let t=await dd(e),o=Sr(t);if(!o)throw new Error("EMPTY_FILE");let{metadata:n,mxGraphModel:r}=o.modeler||{},i=(n==null?void 0:n.app)&&(n==null?void 0:n.diagramType)&&(n==null?void 0:n.version),s=r==null?void 0:r.root;if(!i||!s)throw new Error("INVALID_FILE");if(!Object.keys(r.root.mxCell||{}).length)throw new Error("CONTAIN_NO_CELLS");return{metadata:n,mxGraphModel:r}},_d=async e=>{try{let t=await Hm(e),{nodes:o,edges:n,summary:r}=Om(t)||{};return{nodes:o,edges:n,summary:r}}catch(t){throw t}};var vd=require("react/jsx-runtime"),Td=()=>{let{t:e}=(0,To.useTranslation)(),{toast:t}=(0,To.useNotificationToast)(),{setNodes:o,setEdges:n,fitView:r}=(0,bd.useReactFlow)(),i=a=>{let l=[e("adapter.governance.report.columns.type"),e("adapter.governance.report.columns.value"),e("adapter.governance.report.columns.status")],c=a.map(d=>[d.originalType,d.value,e(`adapter.governance.report.status.${d.status.toLowerCase()}`)]);t({variant:"warning",content:e("adapter.governance.success.incompatible_cells"),duration:1e3*60*1,action:(0,vd.jsx)(To.Button,{size:"small",variant:"ghost",onClick:()=>ud({columns:l,rows:c,fileName:"governance-imported-cells"}),children:e("adapter.governance.action.download")})})};return{importFromGovernance:async a=>{try{let{nodes:l,edges:c,summary:d}=await _d(a);if(o(u=>u.concat(l)),n(u=>u.concat(c)),r({padding:yo}),d.some(u=>u.status==="unsupported")){i(d);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 Nd=require("lecom-ui"),wd=require("react");var Wt=require("react/jsx-runtime"),Ad=a=>{var l=a,{children:e,accept:t="*",multiple:o=!1,disabled:n=!1,onClick:r,onFilesSelected:i}=l,s=Ge(l,["children","accept","multiple","disabled","onClick","onFilesSelected"]);let c=(0,wd.useRef)(null),d=u=>{let p=u.target.files;p!=null&&p.length&&i(p),c.current&&(c.current.value="")};return(0,Wt.jsxs)(Wt.Fragment,{children:[(0,Wt.jsx)(Nd.Button,N(_({onClick:u=>{var p;(p=c.current)==null||p.click(),r==null||r(u)}},s),{children:e})),(0,Wt.jsx)("input",{type:"file",ref:c,className:"sr-only",accept:t,multiple:o,disabled:n,onChange:d})]})};var Ut=require("react/jsx-runtime"),Cd=({disabled:e=!1})=>{let{t}=(0,$e.useTranslation)(),{toast:o}=(0,$e.useNotificationToast)(),{importFromGovernance:n}=Td(),r=()=>{if(e){o({variant:"error",content:t("adapter.governance.error.ALREADY_INITIALIZED")});return}},i=s=>{let a=s[0];if(!a){o({variant:"error",content:t("adapter.governance.error.NO_FILE")});return}n(a)};return(0,Ut.jsxs)($e.Tooltip,{children:[(0,Ut.jsx)($e.TooltipTrigger,{asChild:!0,children:(0,Ut.jsx)(Ad,{className:"[&>svg]:size-7 p-0",variant:"ghost",size:"small",color:"grey",iconButton:!0,accept:".mdr",disabled:e,onClick:r,onFilesSelected:i,children:(0,Ut.jsx)(Ui,{})})}),(0,Ut.jsx)($e.TooltipContent,{color:"black",children:t("editor.controls.actions.import_governance")})]})};var Id=require("react/jsx-runtime"),Ai=({shortcut:e})=>(0,Id.jsx)("span",{className:"min-h-7.5 inline-flex justify-center items-center py-0.5 px-1.5 bg-grey-100 border border-grey-300 font-mono text-gray-800 shadow-lg rounded-md text-grey-900",children:e});var H=require("lecom-ui"),Et=require("lucide-react"),Ld=require("react");var Sd=require("@xyflow/react"),mn=require("html-to-image"),Lr=require("lecom-ui"),Md=require("react");var Gm=3,Ci="diagram",Pd=()=>{let{t:e}=(0,Lr.useTranslation)(),{getNodes:t}=(0,Sd.useReactFlow)(),{clearSelection:o}=mt(),[n,r]=(0,Md.useState)({png:!1,html:!1,print:!1}),i=()=>{let{x:d,y:f,width:u,height:p}=Gl(t());return{width:u,height:p,style:{width:`${u}px`,height:`${p}px`,transform:`translate(${-d}px, ${-f}px)`}}},s=async(d,f)=>{r(N(_({},n),{[f]:!0})),await o();try{let u=Hl();if(!u)throw new Error("Flow element not found");let p=i();return await d(u,p)}catch(u){(0,Lr.toast)({content:e("editor.controls.actions.export.feedback.error"),variant:"error"})}finally{r(N(_({},n),{[f]:!1}))}};return{exportAsPng:async(d=Ci)=>{await s(async(f,u)=>{let p=await(0,mn.toPng)(f,N(_({},u),{backgroundColor:"#fcfcfc"}));Pr(p,`${d}.png`)},"png")},exportAsHtml:async(d=Ci)=>{await s(async(f,u)=>{let p=await(0,mn.toSvg)(f,N(_({},u),{backgroundColor:"#fcfcfc"})),h=`
5
5
  <!DOCTYPE html>
6
6
  <html>
7
7
  <head>
8
- <title>${c}</title>
8
+ <title>${d}</title>
9
9
  <style>
10
10
  body { margin: 0; display: flex; justify-content: center; align-items: center; min-height: 100vh; background: #eee; }
11
11
  img { max-width: 95%; max-height: 95vh; background: white; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
12
12
  </style>
13
13
  </head>
14
14
  <body>
15
- <img src="${f}" alt="Diagram" />
15
+ <img src="${p}" alt="Diagram" />
16
16
  </body>
17
17
  </html>
18
- `,g=new Blob([h],{type:"text/html"}),E=URL.createObjectURL(g);Pr(E,`${c}.html`),setTimeout(()=>URL.revokeObjectURL(E),100)},"html")},printDiagram:async(c=Ci)=>{await a(async(p,u)=>{let f=await(0,fn.toPng)(p,v(x({},u),{pixelRatio:Hm})),h=window.open("","_blank");if(!h)throw new Error("Failed to open print window.");let g=h.document;g.open(),g.write(`
18
+ `,m=new Blob([h],{type:"text/html"}),g=URL.createObjectURL(m);Pr(g,`${d}.html`),setTimeout(()=>URL.revokeObjectURL(g),100)},"html")},printDiagram:async(d=Ci)=>{await s(async(f,u)=>{let p=await(0,mn.toPng)(f,N(_({},u),{pixelRatio:Gm})),h=window.open("","_blank");if(!h)throw new Error("Failed to open print window.");let m=h.document;m.open(),m.write(`
19
19
  <!DOCTYPE html>
20
20
  <html>
21
21
  <head>
22
- <title>${c}</title>
22
+ <title>${d}</title>
23
23
  <style>
24
24
  @page { size: auto; margin: 0mm; }
25
25
  @media print { body { margin: 0; } img { width: 100%; height: auto; vertical-align: middle; } }
@@ -28,7 +28,7 @@
28
28
  </style>
29
29
  </head>
30
30
  <body>
31
- <img src="${f}" alt="Diagram" onload="window.print(); window.close();" />
31
+ <img src="${p}" alt="Diagram" onload="window.print(); window.close();" />
32
32
  </body>
33
33
  </html>
34
- `),g.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};var U=require("react/jsx-runtime");function Dd(){let{t:e}=(0,H.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:a}=Ld(),[s,l]=(0,kd.useState)(!1);return(0,U.jsxs)(H.DropdownMenu,{modal:!1,open:s,onOpenChange:l,children:[(0,U.jsx)(H.DropdownMenuTrigger,{asChild:!0,children:(0,U.jsx)("div",{children:(0,U.jsxs)(H.Tooltip,{children:[(0,U.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,U.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,U.jsx)(xt.FolderOutputIcon,{})})}),!s&&(0,U.jsx)(H.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,U.jsxs)(H.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,U.jsxs)(H.Tooltip,{children:[(0,U.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,U.jsx)(H.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,U.jsx)(xt.FileImageIcon,{})})}),(0,U.jsx)(H.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,U.jsxs)(H.Tooltip,{children:[(0,U.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,U.jsx)(H.DropdownMenuItem,{className:"p-1.5",disabled:a,onClick:()=>o(),children:(0,U.jsx)(xt.FileCodeIcon,{})})}),(0,U.jsx)(H.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,U.jsxs)(H.Tooltip,{children:[(0,U.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,U.jsx)(H.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,U.jsx)(xt.PrinterIcon,{})})}),(0,U.jsx)(H.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var W=require("react/jsx-runtime"),Rd=({nodes:e,isReadOnly:t})=>{let{t:o}=(0,re.useTranslation)(),{deselectAll:n}=eo(),{isMinimapOpen:r,setIsMinimapOpen:i,isMoveTool:a,isHandTool:s,setIsMoveTool:l,setIsHandTool:d}=R(),c=(0,Ii.useKeyPress)(["v","V"]),p=(0,Ii.useKeyPress)(["h","H"]),u=(0,To.useCallback)(()=>{n(),d(!0),l(!1)},[n,d,l]),f=(0,To.useCallback)(()=>{l(!0),d(!1)},[l,d]);return(0,To.useEffect)(()=>{c&&!a&&!t&&f()},[c,f,a,t]),(0,To.useEffect)(()=>{p&&!s&&!t&&u()},[p,u,s,t]),(0,W.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(re.Tooltip,{children:[(0,W.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,W.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",className:L(a&&"bg-grey-400"),iconButton:!0,onClick:f,children:(0,W.jsx)(vo.MousePointerIcon,{})})}),(0,W.jsxs)(re.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[o("editor.controls.actions.move_tool"),(0,W.jsx)(Ai,{shortcut:"V"})]})]}),(0,W.jsxs)(re.Tooltip,{children:[(0,W.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,W.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",className:L(s&&"bg-grey-400"),iconButton:!0,onClick:u,children:(0,W.jsx)(vo.HandIcon,{})})}),(0,W.jsxs)(re.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[o("editor.controls.actions.hand_tool")," ",(0,W.jsx)(Ai,{shortcut:"H"})]})]})]}),(0,W.jsx)(Dd,{}),!t&&(0,W.jsx)(Id,{disabled:e.length>0}),(0,W.jsxs)(re.Tooltip,{children:[(0,W.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,W.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",className:L(r&&"bg-grey-400"),iconButton:!0,onClick:()=>i(!r),children:(0,W.jsx)(vo.MapIcon,{})})}),(0,W.jsx)(re.TooltipContent,{color:"black",children:o(r?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var be=require("lecom-ui"),kr=require("lucide-react"),Ce=require("react/jsx-runtime"),Vd=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,be.useTranslation)();return(0,Ce.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,Ce.jsxs)(be.Tooltip,{children:[(0,Ce.jsx)(be.TooltipTrigger,{asChild:!0,children:(0,Ce.jsx)(be.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,Ce.jsx)(kr.UndoIcon,{})})}),(0,Ce.jsx)(be.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,Ce.jsxs)(be.Tooltip,{children:[(0,Ce.jsx)(be.TooltipTrigger,{asChild:!0,children:(0,Ce.jsx)(be.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,Ce.jsx)(kr.RedoIcon,{})})}),(0,Ce.jsx)(be.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var Od=require("@xyflow/react"),Z=require("lecom-ui"),No=require("lucide-react");var K=require("react/jsx-runtime"),Hd=()=>{let{t:e}=(0,Z.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,Od.useReactFlow)();return(0,K.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,K.jsxs)(Z.Tooltip,{children:[(0,K.jsx)(Z.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(Z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,K.jsx)(No.ScanIcon,{})})}),(0,K.jsx)(Z.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,K.jsxs)(Z.Tooltip,{children:[(0,K.jsx)(Z.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(Z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,K.jsx)(No.ZoomOut,{})})}),(0,K.jsx)(Z.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,K.jsxs)(Z.Tooltip,{children:[(0,K.jsx)(Z.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(Z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:(0,K.jsx)(Ki,{})})}),(0,K.jsx)(Z.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,K.jsxs)(Z.Tooltip,{children:[(0,K.jsx)(Z.TooltipTrigger,{asChild:!0,children:(0,K.jsx)(Z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,K.jsx)(No.ZoomIn,{})})}),(0,K.jsx)(Z.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var Q=require("lecom-ui");var ye=require("react/jsx-runtime"),Gd=({pendingDelete:e,setPendingDelete:t,nodes:o,setNodes:n,setEdges:r,saveHistory:i})=>{let{t:a}=(0,Q.useTranslation)(),{forceRebuildIndex:s}=so(),l=!!e,d=()=>{let{nodes:f}=e||{};if(f!=null&&f.length){let h=o.filter(g=>!f.some(E=>E.id===g.id));f.forEach(g=>{(g==null?void 0:g.type)==="LANE"&&(g!=null&&g.parentId)&&(h=Dt(g.parentId,h))}),n(Je(h))}},c=()=>{let{edges:f}=e||{};f!=null&&f.length&&r(h=>h.filter(g=>!f.some(E=>E.id===g.id)))},p=()=>{d(),c(),i("forceSave"),s(),t(null)},u=()=>{t(null)};return(0,ye.jsx)(Q.Dialog,{open:l,onOpenChange:u,children:(0,ye.jsxs)(Q.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,ye.jsx)(Q.DialogHeader,{children:(0,ye.jsx)(Q.DialogTitle,{children:(0,ye.jsx)(Q.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:a("editor.modals.delete_elements.title")})})}),(0,ye.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,ye.jsx)("div",{className:"py-2",children:(0,ye.jsx)(Q.Notification,{type:"callout",variant:"warning",content:a("editor.modals.delete_elements.callout")})}),(0,ye.jsx)(Q.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:a("editor.modals.delete_elements.content")})]}),(0,ye.jsxs)(Q.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,ye.jsx)(Q.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:u,children:(0,ye.jsx)(Q.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:a("editor.modals.delete_elements.cancel")})}),(0,ye.jsx)(Q.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:p,children:a("editor.modals.delete_elements.confirm")})]})]})})};var Bd=require("@xyflow/react"),$e=require("lecom-ui"),Dr=require("react");var Oe=require("react/jsx-runtime"),zd=()=>{let e=(0,Dr.useRef)(null),{t}=(0,$e.useTranslation)(),{setDraggableNode:o}=fo(),{getNodes:n}=(0,Bd.useReactFlow)(),{setIsDragging:r}=R(),[i,a]=(0,Dr.useState)(void 0),s=n(),l=ar(s),d=[{type:"START_EVENT",icon:An,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Yt,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:Po,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:Ji,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Zi,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:qi,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:Kt,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Zt,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:$t,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:Xi,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:Nn,label:t("bpmn.annotation.variant.default")}],c=(p,u)=>{o({type:u.type,variant:u.variant,attribute:u.attribute,icon:u.icon}),a((0,Oe.jsx)(u.icon,{})),p.dataTransfer.effectAllowed="move",e.current&&p.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,Oe.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,Oe.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:d.map((p,u)=>{let f=l&&p.type==="START_EVENT",h=f?t("editor.toolbar.start_event_already_exists"):p.label;return(0,Oe.jsxs)($e.Tooltip,{children:[(0,Oe.jsx)($e.TooltipTrigger,{asChild:!0,children:(0,Oe.jsx)($e.Button,{className:L("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":f}),size:"small",variant:"ghost",color:"grey",draggable:!f,disabled:f,iconButton:!0,onDragStart:f?void 0:g=>c(g,p),children:(0,Oe.jsx)(p.icon,{})},u)}),(0,Oe.jsx)($e.TooltipContent,{color:"black",side:"right",children:h})]},u)})}),(0,Oe.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var Rr=require("lecom-ui"),wo=require("lucide-react"),Vr=require("react"),ue=require("react/jsx-runtime"),Fd=({validationResult:e,onClose:t})=>{let{t:o}=(0,Rr.useTranslation)(),[n,r]=(0,Vr.useState)(!1);if((0,Vr.useEffect)(()=>{e&&r(!0)},[e]),!n||!e)return null;let{isValid:i,errors:a}=e;return(0,ue.jsxs)("div",{className:L("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[(0,ue.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,ue.jsx)("div",{className:"flex-shrink-0",children:i?(0,ue.jsx)(wo.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,ue.jsx)(wo.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,ue.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,ue.jsx)("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&(0,ue.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,ue.jsx)(Rr.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:(0,ue.jsx)(wo.XIcon,{})})]}),(0,ue.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?(0,ue.jsx)("p",{children:o("validation.success.message")}):(0,ue.jsx)("div",{className:"list-disc list-inside",children:a.map(s=>(0,ue.jsx)("li",{className:"mb-1",children:s.message},s.id))})})]})};var pe=require("react/jsx-runtime"),Si=(0,fe.forwardRef)((e,t)=>{let o=(0,fe.useRef)(!1),{instanceId:n,isReadOnly:r,isMinimapOpen:i,isMoveTool:a,isHandTool:s,setIsConnecting:l,setIsMultipleSelection:d}=R(),{importFromMxGraph:c,exportToMxGraph:p}=jc();(0,fe.useEffect)(()=>(Ao.set(n,{importFromMxGraph:c,exportToMxGraph:p}),()=>{Ao.delete(n)}),[n,c,p]);let[u,f]=(0,ie.useNodesState)([]),[h,g,E]=(0,ie.useEdgesState)([]),[C,T]=(0,fe.useState)(null),{validationResult:b,handleValidationComplete:m,clearValidation:y,isAutoValidationEnabled:w,validateDiagram:_}=vl(),{getNodes:A,getEdges:P}=(0,ie.useReactFlow)(),N=od(f,g);(0,fe.useImperativeHandle)(t,()=>N);let{updateHelperLines:M,HelperLines:I}=so(),{onNodeDrag:S,onDrop:k,onDragOver:z,onNodeDragStop:G,onNodeDragStart:J}=$l({nodes:u,setNodes:f,setEdges:g}),{isValidConnection:ne,onConnect:B}=pl({setEdges:g});Sl(),Zl();let{importFromLia:Y}=Oc(),{handleTasksStatus:$,handleClearTaskStatus:Ie}=rd(),{clearPathEdges:le}=Tt(),ot=Sn(),Ut=(0,fe.useCallback)(()=>{f([]),g([]),le(),setTimeout(()=>{ot()},0)},[f,g,le,ot]),{undo:nt,redo:gn,canUndo:hn,canRedo:Qd,saveHistory:yn}=cd();ed({LIA_CREATE_DIAGRAM:Y,CLEAR_DIAGRAM:Ut,TASKS_STATUS:$,CLEAR_TASKS_STATUS:Ie}),(0,fe.useEffect)(()=>{if(u.length===0&&h.length===0&&!r){let ki=(0,Or.v7)(),cu={id:ki,type:"START_EVENT",position:{x:200,y:300},data:{}},Di=(0,Or.v7)(),du={id:Di,type:"TASK",position:{x:400,y:270},data:{label:Ud.i18n.t("editor.toolbar.initial_task")}},uu=(0,Or.v7)(),pu=v(x({},Ne),{id:uu,source:ki,target:Di}),fu=[cu,du],mu=[pu];f(fu),g(mu)}},[u.length,h.length,r,f,g]);let jd=()=>{y()},eu=(0,fe.useCallback)(({nodes:Se,edges:rt})=>{let Wt=Se.length+rt.length>1;d(Wt)},[d]);(0,ie.useOnSelectionChange)({onChange:eu});let tu=(0,fe.useCallback)(()=>{if(!w){o.current=!1;return}let Se=A(),rt=P(),Wt=_({nodes:Se,edges:rt});m(Wt),o.current=!1},[w,A,P,_,m]),Pi=(0,Wd.useDebouncedCallback)(tu,300),Li=(0,fe.useCallback)(()=>{w&&!o.current&&(o.current=!0,Pi())},[w,Pi]),ou=Se=>{let rt=M(Se,u);f(Wt=>(0,ie.applyNodeChanges)(rt,Wt)),yn(Se),Li()},nu=Se=>{E(Se),yn(Se),Li()},ru=()=>{yn("forceSave")},iu=async({nodes:Se,edges:rt})=>(T({nodes:Se,edges:rt}),!1),su=()=>{l(!0)},au=()=>{l(!1)},lu={nodes:u,edges:h};return(0,pe.jsxs)("div",{className:"w-full h-full",children:[!r&&(0,pe.jsx)(zd,{}),(0,pe.jsx)(dd,{}),(0,pe.jsxs)(ie.ReactFlow,{id:`modeler-${n}`,edges:h,nodes:u,nodeTypes:wc,edgeTypes:Ac,minZoom:Lc,maxZoom:kc,panOnDrag:s||r?!0:Rc,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!r&&a,nodesConnectable:!r&&a,nodesDraggable:!r&&a,isValidConnection:ne,connectionLineComponent:Ul,onConnect:B,onDrop:k,onDropCapture:ru,onDragOver:z,onNodesChange:ou,onEdgesChange:nu,onNodeDrag:S,onNodeDragStart:J,onNodeDragStop:G,onBeforeDelete:iu,onConnectEnd:au,onConnectStart:su,selectionMode:ie.SelectionMode.Partial,proOptions:{hideAttribution:!0},multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[5,5],defaultViewport:Dc,connectOnClick:!1,children:[(0,pe.jsx)(ie.Background,{gap:Mc,size:Sc,color:Ic,bgColor:Cc}),i&&(0,pe.jsx)(ie.MiniMap,{pannable:!0,zoomable:!0,position:Pc,className:"shadow-md rounded-md"}),(0,pe.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!r&&(0,pe.jsx)(Vd,{canUndo:hn,canRedo:Qd,undo:nt,redo:gn}),(0,pe.jsx)(Rd,{nodes:u,isReadOnly:r,diagram:lu,onValidationComplete:m,onValidateDiagram:_}),(0,pe.jsx)(Hd,{})]}),(0,pe.jsx)(I,{}),b&&(0,pe.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,pe.jsx)(Fd,{validationResult:b,onClose:jd})})]}),(0,pe.jsx)(Gd,{pendingDelete:C,setPendingDelete:T,nodes:u,setNodes:f,setEdges:g,saveHistory:yn})]})});Si.displayName="Editor";var Yd=require("@xyflow/react"),Hr=require("react"),$d=require("react/jsx-runtime"),Gm=e=>({width:e.width,height:e.height,transform:e.transform}),Mi="rgba(51, 103, 217, 0.4)",Ja=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,Yd.useStore)(Gm),i=(0,Hr.useRef)(null);return(0,Hr.useEffect)(()=>{let a=i.current,s=a==null?void 0:a.getContext("2d");if(!s||!a)return;let l=window.devicePixelRatio;a.width=o*l,a.height=n*l,s.clearRect(0,0,o,n),s.scale(l,l),s.strokeStyle=Mi,t&&(s.beginPath(),s.strokeStyle=t.color||Mi,s.moveTo(t.position*r[2]+r[0],0),s.lineTo(t.position*r[2]+r[0],n),s.stroke()),e&&(s.beginPath(),s.strokeStyle=e.color||Mi,s.moveTo(0,e.position*r[2]+r[1]),s.lineTo(o,e.position*r[2]+r[1]),s.stroke())},[o,n,r,e,t]),(0,$d.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var Co=require("lecom-ui"),Et=require("react");var mn=require("react/jsx-runtime"),Xd=(0,Et.createContext)(null),Ao=new Map,Gr=()=>{let e=(0,Et.useContext)(Xd);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},Kd=({locale:e,defaultMode:t="edit",children:o})=>{let[n,r]=(0,Et.useState)(e||"pt_BR");(0,Et.useEffect)(()=>{e&&(r(e),Co.i18n.changeLanguage(e))},[e]);let i=l=>{let d=Ao.size;if(d===0)throw new Error("No modeler instances found");if(d===1||!l){let[p]=Ao.values();return p}let c=Ao.get(l);if(!c)throw new Error(`Modeler instance with ID "${l}" not found`);return c},a=async(l,d)=>{let c=i(d);await(c==null?void 0:c.importFromMxGraph(l))},s=l=>{let d=i(l);return d==null?void 0:d.exportToMxGraph()};return(0,mn.jsx)(Xd.Provider,{value:{defaultMode:t,locale:n,importDiagram:a,exportDiagram:s},children:(0,mn.jsxs)(Co.TooltipProvider,{children:[(0,mn.jsx)(Co.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),o]})})};var Br=require("react/jsx-runtime"),Zd=(0,oe.createContext)(null),R=()=>{let e=(0,oe.useContext)(Zd);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},Jd=({selectorRef:e,instanceId:t,mode:o,onConfigureElement:n,onSubprocessValidationClick:r})=>{let{defaultMode:i}=Gr(),a=(0,oe.useId)(),[s]=(0,oe.useState)(t||a),[l,d]=(0,oe.useState)(o||i||"edit"),[c,p]=(0,oe.useState)(!0),[u,f]=(0,oe.useState)(!1),[h,g]=(0,oe.useState)(!1),[E,C]=(0,oe.useState)(!1),[T,b]=(0,oe.useState)(!1),[m,y]=(0,oe.useState)(!1),[w,_]=(0,oe.useState)(!1);return(0,oe.useEffect)(()=>{o&&d(o)},[o]),(0,oe.useEffect)(()=>{g(l==="readonly")},[l]),(0,Br.jsx)(qd.ReactFlowProvider,{children:(0,Br.jsx)(Zd.Provider,{value:{instanceId:s,isReadOnly:h,isMinimapOpen:E,isMoveTool:c,isHandTool:u,isDragging:T,isMultipleSelection:w,isConnecting:m,setIsMinimapOpen:C,setIsMoveTool:p,setIsHandTool:f,setIsDragging:b,setIsConnecting:y,setIsMultipleSelection:_,onConfigureElement:n,onSubprocessValidationClick:r},children:(0,Br.jsx)(Si,{ref:e})})})};0&&(module.exports={ActivityVariant,ComplexVariant,ElementType,ExclusiveVariant,GatewayVariant,Modeler,ModelerProvider,RoutingVariant,useModeler,useSelectionUtils});
34
+ `),m.close()},"print")},isPrintingPng:n.png,isPrintingHtml:n.html,isPrinting:n.print}};var F=require("react/jsx-runtime");function kd(){let{t:e}=(0,H.useTranslation)(),{exportAsPng:t,exportAsHtml:o,printDiagram:n,isPrinting:r,isPrintingPng:i,isPrintingHtml:s}=Pd(),[a,l]=(0,Ld.useState)(!1);return(0,F.jsxs)(H.DropdownMenu,{modal:!1,open:a,onOpenChange:l,children:[(0,F.jsx)(H.DropdownMenuTrigger,{asChild:!0,children:(0,F.jsx)("div",{children:(0,F.jsxs)(H.Tooltip,{children:[(0,F.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,F.jsx)(H.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,children:(0,F.jsx)(Et.FolderOutputIcon,{})})}),!a&&(0,F.jsx)(H.TooltipContent,{color:"black",children:e("editor.controls.actions.export.title")})]})})}),(0,F.jsxs)(H.DropdownMenuContent,{align:"center",side:"top",sideOffset:16,className:"min-w-0 flex flex-col gap-2 p-2 shadow-sm",children:[(0,F.jsxs)(H.Tooltip,{children:[(0,F.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,F.jsx)(H.DropdownMenuItem,{className:"p-1.5",disabled:i,onClick:()=>t(),children:(0,F.jsx)(Et.FileImageIcon,{})})}),(0,F.jsx)(H.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.png")})]}),(0,F.jsxs)(H.Tooltip,{children:[(0,F.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,F.jsx)(H.DropdownMenuItem,{className:"p-1.5",disabled:s,onClick:()=>o(),children:(0,F.jsx)(Et.FileCodeIcon,{})})}),(0,F.jsx)(H.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.html")})]}),(0,F.jsxs)(H.Tooltip,{children:[(0,F.jsx)(H.TooltipTrigger,{asChild:!0,children:(0,F.jsx)(H.DropdownMenuItem,{className:"p-1.5",disabled:r,onClick:()=>n(),children:(0,F.jsx)(Et.PrinterIcon,{})})}),(0,F.jsx)(H.TooltipContent,{side:"right",color:"black",children:e("editor.controls.actions.export.print")})]})]})]})}var W=require("react/jsx-runtime"),Dd=({nodes:e,isReadOnly:t})=>{let{t:o}=(0,re.useTranslation)(),{clearSelection:n}=mt(),{isMinimapOpen:r,setIsMinimapOpen:i,isMoveTool:s,isHandTool:a,setIsMoveTool:l,setIsHandTool:c}=D(),d=(0,Ii.useKeyPress)(["v","V"]),f=(0,Ii.useKeyPress)(["h","H"]),u=(0,vo.useCallback)(()=>{n(),c(!0),l(!1)},[n,c,l]),p=(0,vo.useCallback)(()=>{l(!0),c(!1)},[l,c]);return(0,vo.useEffect)(()=>{d&&!s&&!t&&p()},[d,p,s,t]),(0,vo.useEffect)(()=>{f&&!a&&!t&&u()},[f,u,a,t]),(0,W.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[!t&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(re.Tooltip,{children:[(0,W.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,W.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",className:P(s&&"bg-grey-400"),iconButton:!0,onClick:p,children:(0,W.jsx)(No.MousePointerIcon,{})})}),(0,W.jsxs)(re.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[o("editor.controls.actions.move_tool"),(0,W.jsx)(Ai,{shortcut:"V"})]})]}),(0,W.jsxs)(re.Tooltip,{children:[(0,W.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,W.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",className:P(a&&"bg-grey-400"),iconButton:!0,onClick:u,children:(0,W.jsx)(No.HandIcon,{})})}),(0,W.jsxs)(re.TooltipContent,{color:"black",className:"flex items-center gap-2",children:[o("editor.controls.actions.hand_tool")," ",(0,W.jsx)(Ai,{shortcut:"H"})]})]})]}),(0,W.jsx)(kd,{}),!t&&(0,W.jsx)(Cd,{disabled:e.length>0}),(0,W.jsxs)(re.Tooltip,{children:[(0,W.jsx)(re.TooltipTrigger,{asChild:!0,children:(0,W.jsx)(re.Button,{size:"small",variant:"ghost",color:"grey",className:P(r&&"bg-grey-400"),iconButton:!0,onClick:()=>i(!r),children:(0,W.jsx)(No.MapIcon,{})})}),(0,W.jsx)(re.TooltipContent,{color:"black",children:o(r?"editor.controls.actions.minimap.close":"editor.controls.actions.minimap.open")})]})]})};var be=require("lecom-ui"),kr=require("lucide-react"),Ce=require("react/jsx-runtime"),Rd=({undo:e,redo:t,canUndo:o,canRedo:n})=>{let{t:r}=(0,be.useTranslation)();return(0,Ce.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,Ce.jsxs)(be.Tooltip,{children:[(0,Ce.jsx)(be.TooltipTrigger,{asChild:!0,children:(0,Ce.jsx)(be.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!o,onClick:e,children:(0,Ce.jsx)(kr.UndoIcon,{})})}),(0,Ce.jsx)(be.TooltipContent,{color:"black",children:r("editor.controls.history.undo")})]}),(0,Ce.jsxs)(be.Tooltip,{children:[(0,Ce.jsx)(be.TooltipTrigger,{asChild:!0,children:(0,Ce.jsx)(be.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,disabled:!n,onClick:t,children:(0,Ce.jsx)(kr.RedoIcon,{})})}),(0,Ce.jsx)(be.TooltipContent,{color:"black",children:r("editor.controls.history.redo")})]})]})};var Vd=require("@xyflow/react"),Z=require("lecom-ui"),wo=require("lucide-react");var X=require("react/jsx-runtime"),Od=()=>{let{t:e}=(0,Z.useTranslation)(),{zoomIn:t,zoomOut:o,zoomTo:n,fitView:r}=(0,Vd.useReactFlow)();return(0,X.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-white rounded-sm shadow-md",children:[(0,X.jsxs)(Z.Tooltip,{children:[(0,X.jsx)(Z.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(Z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>r(),children:(0,X.jsx)(wo.ScanIcon,{})})}),(0,X.jsx)(Z.TooltipContent,{color:"black",children:e("editor.controls.zoom.fit")})]}),(0,X.jsxs)(Z.Tooltip,{children:[(0,X.jsx)(Z.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(Z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>o(),children:(0,X.jsx)(wo.ZoomOut,{})})}),(0,X.jsx)(Z.TooltipContent,{color:"black",children:e("editor.controls.zoom.out")})]}),(0,X.jsxs)(Z.Tooltip,{children:[(0,X.jsx)(Z.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(Z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>n(1),children:(0,X.jsx)(qi,{})})}),(0,X.jsx)(Z.TooltipContent,{color:"black",children:e("editor.controls.zoom.reset")})]}),(0,X.jsxs)(Z.Tooltip,{children:[(0,X.jsx)(Z.TooltipTrigger,{asChild:!0,children:(0,X.jsx)(Z.Button,{size:"small",variant:"ghost",color:"grey",iconButton:!0,onClick:()=>t(),children:(0,X.jsx)(wo.ZoomIn,{})})}),(0,X.jsx)(Z.TooltipContent,{color:"black",children:e("editor.controls.zoom.in")})]})]})};var Q=require("lecom-ui");var ye=require("react/jsx-runtime"),Hd=({pendingDelete:e,setPendingDelete:t,nodes:o,setNodes:n,setEdges:r,saveHistory:i})=>{let{t:s}=(0,Q.useTranslation)(),{forceRebuildIndex:a}=ao(),l=!!e,c=()=>{let{nodes:p}=e||{};if(p!=null&&p.length){let h=o.filter(m=>!p.some(g=>g.id===m.id));p.forEach(m=>{(m==null?void 0:m.type)==="LANE"&&(m!=null&&m.parentId)&&(h=Vt(m.parentId,h))}),n(et(h))}},d=()=>{let{edges:p}=e||{};p!=null&&p.length&&r(h=>h.filter(m=>!p.some(g=>g.id===m.id)))},f=()=>{c(),d(),i("forceSave"),a(),t(null)},u=()=>{t(null)};return(0,ye.jsx)(Q.Dialog,{open:l,onOpenChange:u,children:(0,ye.jsxs)(Q.DialogContent,{className:"w-[488px] max-w-fit gap-2",children:[(0,ye.jsx)(Q.DialogHeader,{children:(0,ye.jsx)(Q.DialogTitle,{children:(0,ye.jsx)(Q.Typography,{variant:"heading-small-600",textColor:"text-grey-950",children:s("editor.modals.delete_elements.title")})})}),(0,ye.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,ye.jsx)("div",{className:"py-2",children:(0,ye.jsx)(Q.Notification,{type:"callout",variant:"warning",content:s("editor.modals.delete_elements.callout")})}),(0,ye.jsx)(Q.Typography,{variant:"body-large-400",textColor:"text-grey-800",className:"py-2",children:s("editor.modals.delete_elements.content")})]}),(0,ye.jsxs)(Q.DialogFooter,{className:"flex items-center flex-row justify-end w-full gap-2",children:[(0,ye.jsx)(Q.Button,{variant:"outlined",color:"grey",disabled:!1,size:"small",onClick:u,children:(0,ye.jsx)(Q.Typography,{variant:"body-medium-500",textColor:"text-grey-800",children:s("editor.modals.delete_elements.cancel")})}),(0,ye.jsx)(Q.Button,{size:"small",variant:"filled",color:"destructive",autoFocus:!0,onClick:f,children:s("editor.modals.delete_elements.confirm")})]})]})})};var Gd=require("@xyflow/react"),Xe=require("lecom-ui"),Dr=require("react");var He=require("react/jsx-runtime"),Bd=()=>{let e=(0,Dr.useRef)(null),{t}=(0,Xe.useTranslation)(),{setDraggableNode:o}=mo(),{getNodes:n}=(0,Gd.useReactFlow)(),{setIsDragging:r}=D(),[i,s]=(0,Dr.useState)(void 0),a=n(),l=ar(a),c=[{type:"START_EVENT",icon:wn,label:t("bpmn.start_event.variant.default")},{type:"END_EVENT",icon:Xt,label:t("bpmn.end_event.variant.default")},{type:"TASK",icon:ko,label:t("bpmn.task.variant.default")},{type:"TASK",variant:"SUBPROCESS",icon:Qi,label:t("bpmn.task.variant.subprocess")},{type:"TASK",variant:"SCRIPT",icon:Ji,label:t("bpmn.task.variant.script")},{type:"TASK",attribute:"LOOP",icon:Zi,label:t("bpmn.task.attribute.loop")},{type:"GATEWAY",variant:"EXCLUSIVE",icon:Zt,label:t("bpmn.gateway.variant.exclusive")},{type:"GATEWAY",variant:"PARALLEL",icon:Qt,label:t("bpmn.gateway.variant.parallel")},{type:"GATEWAY",variant:"COMPLEX",icon:Kt,label:t("bpmn.gateway.variant.complex")},{type:"LANE",icon:Ki,label:t("bpmn.lane.variant.default")},{type:"ANNOTATION",icon:vn,label:t("bpmn.annotation.variant.default")}],d=(f,u)=>{o({type:u.type,variant:u.variant,attribute:u.attribute,icon:u.icon}),s((0,He.jsx)(u.icon,{})),f.dataTransfer.effectAllowed="move",e.current&&f.dataTransfer.setDragImage(e.current,10,10),setTimeout(()=>{r(!0)},100)};return(0,He.jsxs)("aside",{className:"sidebar absolute z-[1] top-4 left-4",children:[(0,He.jsx)("div",{className:"grid grid-cols-1 gap-2 p-2 bg-white rounded-md shadow-md",children:c.map((f,u)=>{let p=l&&f.type==="START_EVENT",h=p?t("editor.toolbar.start_event_already_exists"):f.label;return(0,He.jsxs)(Xe.Tooltip,{children:[(0,He.jsx)(Xe.TooltipTrigger,{asChild:!0,children:(0,He.jsx)(Xe.Button,{className:P("[&>svg]:size-6",{"opacity-50 cursor-not-allowed":p}),size:"small",variant:"ghost",color:"grey",draggable:!p,disabled:p,iconButton:!0,onDragStart:p?void 0:m=>d(m,f),children:(0,He.jsx)(f.icon,{})},u)}),(0,He.jsx)(Xe.TooltipContent,{color:"black",side:"right",children:h})]},u)})}),(0,He.jsx)("div",{ref:e,className:"absolute w-0 h-0 top-0 left-0 z-[-1] bg-transparent",children:i})]})};var Rr=require("lecom-ui"),Ao=require("lucide-react"),Vr=require("react"),de=require("react/jsx-runtime"),zd=({validationResult:e,onClose:t})=>{let{t:o}=(0,Rr.useTranslation)(),[n,r]=(0,Vr.useState)(!1);if((0,Vr.useEffect)(()=>{e&&r(!0)},[e]),!n||!e)return null;let{isValid:i,errors:s}=e;return(0,de.jsxs)("div",{className:P("w-72 max-w-[95vw] rounded-lg border px-4 py-2",{"bg-green-100":i,"bg-red-100":!i}),children:[(0,de.jsxs)("div",{className:"flex flex-row items-start gap-4",children:[(0,de.jsx)("div",{className:"flex-shrink-0",children:i?(0,de.jsx)(Ao.CircleCheckIcon,{className:"text-green-500 size-5"}):(0,de.jsx)(Ao.AlertCircleIcon,{className:"text-red-500 size-5"})}),(0,de.jsxs)("div",{className:"body-medium-500 text-grey-800",children:[(0,de.jsx)("div",{children:o(i?"validation.success.title":"validation.errors.title")}),!i&&(0,de.jsx)("div",{children:o("validation.errors.subtitle")})]}),(0,de.jsx)(Rr.Button,{variant:"ghost",size:"small",color:"grey",className:"size-5 hover:bg-transparent",iconButton:!0,onClick:()=>{r(!1),t()},children:(0,de.jsx)(Ao.XIcon,{})})]}),(0,de.jsx)("div",{className:"max-h-80 overflow-y-auto mt-2 px-9 body-medium-400 text-grey-800",children:i?(0,de.jsx)("p",{children:o("validation.success.message")}):(0,de.jsx)("div",{className:"list-disc list-inside",children:s.map(a=>(0,de.jsx)("li",{className:"mb-1",children:a.message},a.id))})})]})};var ue=require("react/jsx-runtime"),Si=(0,pe.forwardRef)((e,t)=>{let o=(0,pe.useRef)(!1),[n,r]=(0,ie.useNodesState)([]),[i,s,a]=(0,ie.useEdgesState)([]),[l,c]=(0,pe.useState)(null),{getNodes:d,getEdges:f}=(0,ie.useReactFlow)(),{instanceId:u,isReadOnly:p,isMinimapOpen:h,isMoveTool:m,isHandTool:g,setIsConnecting:T,setIsMultipleSelection:x}=D(),{selectElements:y,clearSelection:E}=mt(),{importFromMxGraph:b,exportToMxGraph:A}=ed(),{configureElement:v,getConfigureElement:C}=ir();(0,pe.useEffect)(()=>(Co.set(u,{importFromMxGraph:b,exportToMxGraph:A,selectElements:y,clearSelection:E,configureElement:v,getConfigureElement:C}),()=>{Co.delete(u)}),[u,b,A,y,E,v,C]);let{validationResult:L,handleValidationComplete:w,clearValidation:S,isAutoValidationEnabled:M,validateDiagram:I}=Nl();(0,pe.useImperativeHandle)(t,()=>({selectElements:y,clearSelection:E}));let{updateHelperLines:V,HelperLines:K}=ao(),{onNodeDrag:z,onDrop:J,onDragOver:ne,onNodeDragStop:G,onNodeDragStart:U}=Xl({nodes:n,setNodes:r,setEdges:s}),{isValidConnection:Y,onConnect:Ie}=fl({setEdges:s});Ml(),Jl();let{importFromLia:fe}=Hc(),{handleTasksStatus:bt,handleClearTaskStatus:Yt}=nd(),{clearPathEdges:Ke}=Nt(),So=In(),hn=(0,pe.useCallback)(()=>{r([]),s([]),Ke(),setTimeout(()=>{So()},0)},[r,s,Ke,So]),{undo:Jd,redo:Qd,canUndo:jd,canRedo:eu,saveHistory:yn}=ld();td({LIA_CREATE_DIAGRAM:fe,CLEAR_DIAGRAM:hn,TASKS_STATUS:bt,CLEAR_TASKS_STATUS:Yt}),(0,pe.useEffect)(()=>{if(n.length===0&&i.length===0&&!p){let ki=(0,Or.v7)(),uu={id:ki,type:"START_EVENT",position:{x:200,y:300},data:{}},Di=(0,Or.v7)(),pu={id:Di,type:"TASK",position:{x:400,y:270},data:{label:Fd.i18n.t("editor.toolbar.initial_task")}},fu=(0,Or.v7)(),mu=N(_({},Ne),{id:fu,source:ki,target:Di}),gu=[uu,pu],hu=[mu];r(gu),s(hu)}},[n.length,i.length,p,r,s]);let tu=()=>{S()},ou=(0,pe.useCallback)(({nodes:Se,edges:it})=>{let $t=Se.length+it.length>1;x($t)},[x]);(0,ie.useOnSelectionChange)({onChange:ou});let nu=(0,pe.useCallback)(()=>{if(!M){o.current=!1;return}let Se=d(),it=f(),$t=I({nodes:Se,edges:it});w($t),o.current=!1},[M,d,f,I,w]),Pi=(0,Wd.useDebouncedCallback)(nu,300),Li=(0,pe.useCallback)(()=>{M&&!o.current&&(o.current=!0,Pi())},[M,Pi]),ru=Se=>{let it=V(Se,n);r($t=>(0,ie.applyNodeChanges)(it,$t)),yn(Se),Li()},iu=Se=>{a(Se),yn(Se),Li()},su=()=>{yn("forceSave")},au=async({nodes:Se,edges:it})=>(c({nodes:Se,edges:it}),!1),lu=()=>{T(!0)},cu=()=>{T(!1)},du={nodes:n,edges:i};return(0,ue.jsxs)("div",{className:"w-full h-full",children:[!p&&(0,ue.jsx)(Bd,{}),(0,ue.jsx)(cd,{}),(0,ue.jsxs)(ie.ReactFlow,{id:`modeler-${u}`,edges:i,nodes:n,nodeTypes:Ac,edgeTypes:Cc,minZoom:kc,maxZoom:Dc,panOnDrag:g||p?!0:Vc,panOnScroll:!0,selectionOnDrag:!0,elevateEdgesOnSelect:!0,elevateNodesOnSelect:!0,elementsSelectable:!p&&m,nodesConnectable:!p&&m,nodesDraggable:!p&&m,isValidConnection:Y,connectionLineComponent:Ul,selectionMode:ie.SelectionMode.Partial,multiSelectionKeyCode:"Shift",deleteKeyCode:"Delete",selectionKeyCode:null,snapToGrid:!0,snapGrid:[5,5],defaultViewport:Rc,connectOnClick:!1,proOptions:{hideAttribution:!0},onNodesChange:ru,onEdgesChange:iu,onConnect:Ie,onDrop:J,onDropCapture:su,onDragOver:ne,onNodeDrag:z,onNodeDragStart:U,onNodeDragStop:G,onBeforeDelete:au,onConnectEnd:cu,onConnectStart:lu,children:[(0,ue.jsx)(ie.Background,{gap:Pc,size:Mc,color:Sc,bgColor:Ic}),h&&(0,ue.jsx)(ie.MiniMap,{pannable:!0,zoomable:!0,position:Lc,className:"shadow-md rounded-md"}),(0,ue.jsxs)("div",{className:"absolute z-10 bottom-4 left-1/2 -translate-x-1/2 flex gap-4",children:[!p&&(0,ue.jsx)(Rd,{canUndo:jd,canRedo:eu,undo:Jd,redo:Qd}),(0,ue.jsx)(Dd,{nodes:n,isReadOnly:p,diagram:du,onValidationComplete:w,onValidateDiagram:I}),(0,ue.jsx)(Od,{})]}),(0,ue.jsx)(K,{}),L&&(0,ue.jsx)("div",{className:"absolute top-6 right-6 z-[1000]",children:(0,ue.jsx)(zd,{validationResult:L,onClose:tu})})]}),(0,ue.jsx)(Hd,{pendingDelete:l,setPendingDelete:c,nodes:n,setNodes:r,setEdges:s,saveHistory:yn})]})});Si.displayName="Editor";var Ud=require("@xyflow/react"),Hr=require("react"),Yd=require("react/jsx-runtime"),Bm=e=>({width:e.width,height:e.height,transform:e.transform}),Mi="rgba(51, 103, 217, 0.4)",Ja=({horizontal:e,vertical:t})=>{let{width:o,height:n,transform:r}=(0,Ud.useStore)(Bm),i=(0,Hr.useRef)(null);return(0,Hr.useEffect)(()=>{let s=i.current,a=s==null?void 0:s.getContext("2d");if(!a||!s)return;let l=window.devicePixelRatio;s.width=o*l,s.height=n*l,a.clearRect(0,0,o,n),a.scale(l,l),a.strokeStyle=Mi,t&&(a.beginPath(),a.strokeStyle=t.color||Mi,a.moveTo(t.position*r[2]+r[0],0),a.lineTo(t.position*r[2]+r[0],n),a.stroke()),e&&(a.beginPath(),a.strokeStyle=e.color||Mi,a.moveTo(0,e.position*r[2]+r[1]),a.lineTo(o,e.position*r[2]+r[1]),a.stroke())},[o,n,r,e,t]),(0,Yd.jsx)("canvas",{ref:i,className:"w-full h-full absolute z-10 pointer-events-none"})};var Io=require("lecom-ui"),_t=require("react");var gn=require("react/jsx-runtime"),Co=new Map,$d=(0,_t.createContext)(null),Gr=()=>{let e=(0,_t.useContext)($d);if(!e)throw new Error("useModeler must be used within an <ModelerProvider />");return e},Xd=({locale:e,defaultMode:t="edit",children:o})=>{let[n,r]=(0,_t.useState)(e||"pt_BR");(0,_t.useEffect)(()=>{e&&(r(e),Io.i18n.changeLanguage(e))},[e]);let i=u=>{let p=Co.size;if(p===0)throw new Error("No modeler instances found");if(p===1||!u){let[m]=Co.values();return m}let h=Co.get(u);if(!h)throw new Error(`Modeler instance with ID "${u}" not found`);return h},s=(u,p)=>{let h=i(p);return h==null?void 0:h.selectElements(u)},a=async u=>{let p=i(u);return p==null?void 0:p.clearSelection()},l=(u,p)=>{let h=i(p);return h==null?void 0:h.configureElement(u)},c=(u,p)=>{let h=i(p);return h==null?void 0:h.getConfigureElement(u)},d=async(u,p)=>{let h=i(p);await(h==null?void 0:h.importFromMxGraph(u))},f=u=>{let p=i(u);return p==null?void 0:p.exportToMxGraph()};return(0,gn.jsx)($d.Provider,{value:{defaultMode:t,locale:n,selectElements:s,clearSelection:a,configureElement:l,getConfigureElement:c,importDiagram:d,exportDiagram:f},children:(0,gn.jsxs)(Io.TooltipProvider,{children:[(0,gn.jsx)(Io.Notification,{type:"toast",placement:"topRight",enableClose:!0,showProgress:!0,pauseOnHover:!0}),o]})})};var Br=require("react/jsx-runtime"),qd=(0,oe.createContext)(null),D=()=>{let e=(0,oe.useContext)(qd);if(!e)throw new Error("useModelerInstance must be used within an <Modeler />");return e},Zd=({selectorRef:e,instanceId:t,mode:o,onConfigureElement:n,onSubprocessValidationClick:r})=>{let{defaultMode:i}=Gr(),s=(0,oe.useId)(),[a]=(0,oe.useState)(t||s),[l,c]=(0,oe.useState)(o||i||"edit"),[d,f]=(0,oe.useState)(!0),[u,p]=(0,oe.useState)(!1),[h,m]=(0,oe.useState)(!1),[g,T]=(0,oe.useState)(!1),[x,y]=(0,oe.useState)(!1),[E,b]=(0,oe.useState)(!1),[A,v]=(0,oe.useState)(!1);return(0,oe.useEffect)(()=>{o&&c(o)},[o]),(0,oe.useEffect)(()=>{m(l==="readonly")},[l]),(0,Br.jsx)(Kd.ReactFlowProvider,{children:(0,Br.jsx)(qd.Provider,{value:{instanceId:a,isReadOnly:h,isMinimapOpen:g,isMoveTool:d,isHandTool:u,isDragging:x,isMultipleSelection:A,isConnecting:E,setIsMinimapOpen:T,setIsMoveTool:f,setIsHandTool:p,setIsDragging:y,setIsConnecting:b,setIsMultipleSelection:v,onConfigureElement:n,onSubprocessValidationClick:r},children:(0,Br.jsx)(Si,{ref:e})})})};0&&(module.exports={ElementPosition,ElementType,GatewayElementVariant,GatewayVariant,Modeler,ModelerProvider,NodeAttribute,NodeType,NodeVariant,RoutingVariant,useModeler});