var kt=Object.defineProperty;var Bt=(n,t,e)=>t in n?kt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var g=(n,t,e)=>Bt(n,typeof t!="symbol"?t+"":t,e);import{f as xt}from"./mxgraph.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&s(r)}).observe(document,{childList:!0,subtree:!0});function e(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=e(o);fetch(o.href,i)}})();var J=(n=>(n.None="None",n.HorizontalVertical="HorizontalVertical",n.Horizontal="Horizontal",n.Vertical="Vertical",n.Center="Center",n))(J||{}),Mt=(n=>(n.In="in",n.Out="out",n))(Mt||{});function Vt(n){return n instanceof HTMLElement?n:document.querySelector(`#${n}`)}var h=(n=>(n.LANE="lane",n.POOL="pool",n.CALL_ACTIVITY="callActivity",n.SUB_PROCESS="subProcess",n.TASK="task",n.TASK_USER="userTask",n.TASK_SERVICE="serviceTask",n.TASK_RECEIVE="receiveTask",n.TASK_SEND="sendTask",n.TASK_MANUAL="manualTask",n.TASK_SCRIPT="scriptTask",n.TASK_BUSINESS_RULE="businessRuleTask",n.GLOBAL_TASK="globalTask",n.GLOBAL_TASK_USER="globalUserTask",n.GLOBAL_TASK_MANUAL="globalManualTask",n.GLOBAL_TASK_SCRIPT="globalScriptTask",n.GLOBAL_TASK_BUSINESS_RULE="globalBusinessRuleTask",n.GROUP="group",n.TEXT_ANNOTATION="textAnnotation",n.GATEWAY_PARALLEL="parallelGateway",n.GATEWAY_EXCLUSIVE="exclusiveGateway",n.GATEWAY_INCLUSIVE="inclusiveGateway",n.GATEWAY_EVENT_BASED="eventBasedGateway",n.GATEWAY_COMPLEX="complexGateway",n.EVENT_START="startEvent",n.EVENT_END="endEvent",n.EVENT_INTERMEDIATE_CATCH="intermediateCatchEvent",n.EVENT_INTERMEDIATE_THROW="intermediateThrowEvent",n.EVENT_BOUNDARY="boundaryEvent",n))(h||{}),ee=(n=>(n.CALLING_PROCESS="process",n.CALLING_GLOBAL_TASK="global task",n))(ee||{}),te=(n=>(n.Exclusive="Exclusive",n.None="None",n.Parallel="Parallel",n))(te||{}),y=(n=>(n.NONE="none",n.TERMINATE="terminate",n.CANCEL="cancel",n.COMPENSATION="compensate",n.CONDITIONAL="conditional",n.ERROR="error",n.ESCALATION="escalation",n.LINK="link",n.MESSAGE="message",n.SIGNAL="signal",n.TIMER="timer",n))(y||{}),_=(n=>(n.ADHOC="adhoc",n.COMPENSATION="compensation",n.EXPAND="expand",n.LOOP="loop",n.MULTI_INSTANCE_PARALLEL="multi-parallel",n.MULTI_INSTANCE_SEQUENTIAL="multi-sequential",n))(_||{}),Y=(n=>(n.AD_HOC="adhoc",n.EMBEDDED="embedded",n.EVENT="event",n.TRANSACTION="transaction",n))(Y||{});function Yt(n,t){return n===""?t?{}:void 0:n}function I(n,t=!1){return n==null?[]:(Array.isArray(n)?n:[n]).map(e=>Yt(e,t)).filter(Boolean)}function Gt(n,t,e){const s=[];e!=null&&e.startingWith?s.push(`^(${e.startingWith}).*`):e!=null&&e.notStartingWith&&s.push(`^(?!(${e.notStartingWith})).*`),s.push(`${t}$`);const o=s.join("");return n.filter(i=>e!=null&&e.ignoreCase?new RegExp(o,"i").test(i):new RegExp(o).test(i))}class C{static isEvent(t){return ie(De,t)}static eventKinds(){return[...De]}static isBoundaryEvent(t){return h.EVENT_BOUNDARY===t}static isStartEvent(t){return h.EVENT_START===t}static isCatchEvent(t){return h.EVENT_INTERMEDIATE_CATCH===t||h.EVENT_BOUNDARY===t||h.EVENT_START===t}static isIntermediateCatchEvent(t){return h.EVENT_INTERMEDIATE_CATCH===t}static isIntermediateThrowEvent(t){return h.EVENT_INTERMEDIATE_THROW===t}static isCallActivity(t){return h.CALL_ACTIVITY===t}static isSubProcess(t){return h.SUB_PROCESS===t}static canHaveNoneEvent(t){return h.EVENT_INTERMEDIATE_THROW===t||h.EVENT_END===t||h.EVENT_START===t}static isActivity(t){return ie(Se,t)}static activityKinds(){return[...Se]}static isWithDefaultSequenceFlow(t){return Dt.has(t)}static isTask(t){return ie(Ee,t)}static taskKinds(){return[...Ee]}static gatewayKinds(){return[...Ue]}static isGateway(t){return ie(Ue,t)}static flowNodeKinds(){return Object.values(h).filter(t=>!C.isPoolOrLane(t))}static isPoolOrLane(t){return t==h.POOL||t==h.LANE}}function ye(n,t){return Gt(Object.values(h),n,t)}function ie(n,t){return Object.values(n).map(e=>e).includes(t)}const De=ye("Event"),Ue=ye("Gateway"),Ee=ye("Task",{ignoreCase:!0,notStartingWith:"global"}),Se=[...Ee,h.CALL_ACTIVITY,h.SUB_PROCESS],Dt=new Set([...Se,h.GATEWAY_EXCLUSIVE,h.GATEWAY_INCLUSIVE,h.GATEWAY_COMPLEX]),ot=Object.values(y).filter(n=>n!=y.NONE);var X=(n=>(n.NONE="None",n.ONE="One",n.BOTH="Both",n))(X||{}),P=(n=>(n.SEQUENCE_FLOW="sequenceFlow",n.MESSAGE_FLOW="messageFlow",n.ASSOCIATION_FLOW="association",n))(P||{}),ne=(n=>(n.NONE="none",n.INITIATING="initiating",n.NON_INITIATING="non_initiating",n))(ne||{}),B=(n=>(n.NORMAL="normal",n.DEFAULT="default",n.CONDITIONAL_FROM_ACTIVITY="conditional_from_activity",n.CONDITIONAL_FROM_GATEWAY="conditional_from_gateway",n))(B||{});class de{constructor(t,e,s,o,i){this.id=t,this.name=e,this.kind=s,this.sourceReferenceId=o,this.targetReferenceId=i}}class it extends de{constructor(t,e,s,o,i=B.NORMAL){super(t,e,P.SEQUENCE_FLOW,s,o),this.sequenceFlowKind=i}}class rt extends de{constructor(t,e,s,o){super(t,e,P.MESSAGE_FLOW,s,o)}}class lt extends de{constructor(t,e,s,o,i=X.NONE){super(t,e,P.ASSOCIATION_FLOW,s,o),this.associationDirectionKind=i}}const O=Wt(),Ut=O.mxCellRenderer,at=O.mxClient,c=O.mxConstants,G=O.mxEvent,We=O.mxPerimeter,F=O.mxPoint,Ce=O.mxRectangle,we=O.mxRectangleShape,Re=O.mxSvgCanvas2D,N=O.mxUtils;function Wt(){return window.mxForceIncludes=!1,window.mxLoadResources=!1,window.mxLoadStylesheets=!1,window.mxResourceExtension=".txt",xt({})}class Ht{constructor(t){this.graph=t}computeRelativeCoordinates(t,e){const s=this.getTranslateForRoot(t),o=e.x+s.x,i=e.y+s.y;return new F(o,i)}getTranslateForRoot(t){const e=this.graph.getModel(),s=new F(0,0);for(;t!=null;){const o=e.getGeometry(t);o!=null&&(s.x-=o.x,s.y-=o.y),t=e.getParent(t)}return s}computeEdgeCenter(t){const e=t.geometry.points,s=e[0],o=e.at(-1),i=o.x-s.x,r=o.y-s.y;return new F(s.x+i/2,s.y+r/2)}}class le{constructor(t,e,s,o,i){g(this,"extensions",{});this.id=t,this.bpmnElement=e,this.bounds=s,this.label=o,this.isHorizontal=i}}class x{constructor(t,e,s,o,i=!1){g(this,"incomingIds",[]);g(this,"outgoingIds",[]);this.id=t,this.name=e,this.kind=s,this.parentId=o,this.instantiate=i}}class he extends x{constructor(t,e,s,o,i,r=[]){super(t,e,s,o,i),this.markers=r}}class z extends he{constructor(t,e,s,o,i,r){super(t,e,h.CALL_ACTIVITY,o,void 0,i),this.callActivityKind=s,this.globalTaskKind=r}}class se extends he{constructor(t,e,s,o,i){s==Y.AD_HOC&&!i.includes(_.ADHOC)&&i.push(_.ADHOC),super(t,e,h.SUB_PROCESS,o,void 0,i),this.subProcessKind=s}}class U extends x{constructor(t,e,s,o,i){super(t,e,s,i),this.eventDefinitionKind=o}}class me extends U{constructor(e,s,o,i){super(e,s,h.EVENT_INTERMEDIATE_CATCH,o,i);g(this,"sourceIds",[])}}class Ie extends U{constructor(e,s,o,i){super(e,s,h.EVENT_INTERMEDIATE_THROW,o,i);g(this,"targetId")}}class ct extends U{constructor(t,e,s,o,i){super(t,e,h.EVENT_START,s,o),this.isInterrupting=i}}class ut extends U{constructor(t,e,s,o,i=!0){super(t,e,h.EVENT_BOUNDARY,s,o),this.isInterrupting=i}}class dt extends x{constructor(t,e,s,o,i=te.None){super(t,e,h.GATEWAY_EVENT_BASED,s,o),this.gatewayKind=i}}function ae(n,t,e,s){return Math.min(Math.max(n??s,t),e)}function Kt(n){return Math.max(n??0,0)}function zt(n){const t=n??{};return t.debounceDelay=ae(t.debounceDelay,0,100,50),t.throttleDelay=ae(t.throttleDelay,0,100,50),t}function fe(n){return n=="default"?void 0:ae(n,0,100,100)}function Xt(n){return n=="default"?void 0:ae(n,1,50,1)}const m={EDGE:"bpmn.edge",EDGE_START_FILL_COLOR:"bpmn.edge.startFillColor",EDGE_END_FILL_COLOR:"bpmn.edge.endFillColor",EVENT_BASED_GATEWAY_KIND:"bpmn.gatewayKind",EVENT_DEFINITION_KIND:"bpmn.eventDefinitionKind",GLOBAL_TASK_KIND:"bpmn.globalTaskKind",SUB_PROCESS_KIND:"bpmn.subProcessKind",IS_INITIATING:"bpmn.isInitiating",IS_INSTANTIATING:"bpmn.isInstantiating",IS_INTERRUPTING:"bpmn.isInterrupting",EXTRA_CSS_CLASSES:"bpmn.extra.css.classes",MARKERS:"bpmn.markers",MESSAGE_FLOW_ICON:"bpmn.messageFlowIcon"},ht={ARROW_DASH:"bpmn.dash"},p={STROKE_WIDTH_THIN:2,STROKE_WIDTH_THICK:5,SHAPE_ACTIVITY_BOTTOM_MARGIN:7,SHAPE_ACTIVITY_TOP_MARGIN:7,SHAPE_ACTIVITY_LEFT_MARGIN:7,SHAPE_ACTIVITY_MARKER_ICON_MARGIN:5,SHAPE_ACTIVITY_MARKER_ICON_SIZE:20,POOL_LABEL_SIZE:30,POOL_LABEL_FILL_COLOR:"none",LANE_LABEL_SIZE:30,LANE_LABEL_FILL_COLOR:"none",SUB_PROCESS_TRANSACTION_INNER_RECT_OFFSET:4,SUB_PROCESS_TRANSACTION_INNER_RECT_ARC_SIZE:6,TEXT_ANNOTATION_BORDER_LENGTH:10,TEXT_ANNOTATION_FILL_COLOR:"none",GROUP_FILL_COLOR:"none",DEFAULT_FILL_COLOR:"White",DEFAULT_STROKE_COLOR:"Black",DEFAULT_FONT_FAMILY:"Arial, Helvetica, sans-serif",DEFAULT_FONT_SIZE:11,DEFAULT_FONT_COLOR:"Black",DEFAULT_MARGIN:0,SHAPE_ARC_SIZE:20,DEFAULT_OVERLAY_FILL_COLOR:"White",DEFAULT_OVERLAY_FILL_OPACITY:100,DEFAULT_OVERLAY_STROKE_COLOR:"Black",DEFAULT_OVERLAY_STROKE_WIDTH:1,DEFAULT_OVERLAY_FONT_SIZE:11,DEFAULT_OVERLAY_FONT_COLOR:"Black",SEQUENCE_FLOW_CONDITIONAL_FROM_ACTIVITY_MARKER_FILL_COLOR:"White",MESSAGE_FLOW_MARKER_START_FILL_COLOR:"White",MESSAGE_FLOW_MARKER_END_FILL_COLOR:"White"},ft=n=>N.getValue(n,m.IS_INSTANTIATING,"false")=="true",ce=n=>n=="default"?void 0:n,$t=(n,t)=>(t&&(n=R(n,c.STYLE_STROKECOLOR,t.color,ce),n=R(n,c.STYLE_STROKE_OPACITY,t.opacity,fe),n=R(n,c.STYLE_STROKEWIDTH,t.width,Xt)),n),R=(n,t,e,s=o=>o)=>e==null?n:N.setStyle(n,t,s(e)),re=(n,t,e,s)=>s==null?n:N.setStyleFlag(n,t,e,s),Zt=(n,t)=>(t&&(n=R(n,c.STYLE_FONTCOLOR,t.color,ce),n=R(n,c.STYLE_FONTSIZE,t.size),n=R(n,c.STYLE_FONTFAMILY,t.family),n=re(n,c.STYLE_FONTSTYLE,c.FONT_BOLD,t.isBold),n=re(n,c.STYLE_FONTSTYLE,c.FONT_ITALIC,t.isItalic),n=re(n,c.STYLE_FONTSTYLE,c.FONT_UNDERLINE,t.isUnderline),n=re(n,c.STYLE_FONTSTYLE,c.FONT_STRIKETHROUGH,t.isStrikeThrough),n=R(n,c.STYLE_TEXT_OPACITY,t.opacity,fe)),n),qt=(n,t,e)=>(n==null?void 0:n.split(";").map(s=>s.split("=")).filter(([s])=>s===t).map(([,s])=>s)[0])??e,jt=n=>{switch(n){case"right-to-left":return c.DIRECTION_WEST;case"bottom-to-top":return c.DIRECTION_NORTH;case"top-to-bottom":return c.DIRECTION_SOUTH;default:return c.DIRECTION_EAST}},Qt=(n,t)=>{const e=t.color;if(e){const s=en(e),o=s?e.startColor:e;n=R(n,c.STYLE_FILLCOLOR,o,ce),s?(n=N.setStyle(n,c.STYLE_GRADIENTCOLOR,e.endColor),n=N.setStyle(n,c.STYLE_GRADIENT_DIRECTION,jt(e.direction))):e==="default"&&(n=N.setStyle(n,c.STYLE_GRADIENTCOLOR,void 0),n=N.setStyle(n,c.STYLE_GRADIENT_DIRECTION,void 0)),(n.includes(h.POOL)||n.includes(h.LANE))&&(n=R(n,c.STYLE_SWIMLANE_FILLCOLOR,o,ce))}return n=R(n,c.STYLE_FILL_OPACITY,t.opacity,fe),n},Jt=n=>n&&typeof n=="object"&&"fill"in n,en=n=>n&&typeof n=="object";class tn{constructor(t){g(this,"ignoreBpmnColors");this.ignoreBpmnColors=(t==null?void 0:t.ignoreBpmnColors)??!0}computeStyle(t,e){const s=[t.bpmnElement.kind];let o;t instanceof le?o=this.computeShapeStyleValues(t):(s.push(...on(t)),o=this.computeEdgeStyleValues(t));const i=this.computeFontStyleValues(t),r=rn(t,e);return s.push(...He([...o,...i,...r])),s.join(";")}computeShapeStyleValues(t){const e=new Map,s=t.bpmnElement;if(s instanceof U?nn(s,e):s instanceof he?sn(s,e):C.isPoolOrLane(s.kind)?e.set(c.STYLE_HORIZONTAL,t.isHorizontal?"0":"1"):s instanceof dt&&(e.set(m.IS_INSTANTIATING,String(s.instantiate)),e.set(m.EVENT_BASED_GATEWAY_KIND,String(s.gatewayKind))),!this.ignoreBpmnColors){const o=t.extensions,i=o.fillColor;i&&(e.set(c.STYLE_FILLCOLOR,i),C.isPoolOrLane(s.kind)&&e.set(c.STYLE_SWIMLANE_FILLCOLOR,i)),o.strokeColor&&e.set(c.STYLE_STROKECOLOR,o.strokeColor)}return e}computeEdgeStyleValues(t){const e=new Map;if(!this.ignoreBpmnColors){const s=t.extensions;s.strokeColor&&e.set(c.STYLE_STROKECOLOR,s.strokeColor)}return e}computeFontStyleValues(t){var o,i;const e=new Map,s=(o=t.label)==null?void 0:o.font;if(s&&(e.set(c.STYLE_FONTFAMILY,s.name),e.set(c.STYLE_FONTSIZE,s.size),e.set(c.STYLE_FONTSTYLE,ln(s))),!this.ignoreBpmnColors){const r=(i=t.label)==null?void 0:i.extensions;r!=null&&r.color&&e.set(c.STYLE_FONTCOLOR,r.color)}return e}computeMessageFlowIconStyle(t){const e=[];return e.push(["shape",m.MESSAGE_FLOW_ICON],[m.IS_INITIATING,String(t.messageVisibleKind===ne.INITIATING)]),this.ignoreBpmnColors||t.extensions.strokeColor&&e.push([c.STYLE_STROKECOLOR,t.extensions.strokeColor]),He(e).join(";")}}function nn(n,t){t.set(m.EVENT_DEFINITION_KIND,n.eventDefinitionKind),(n instanceof ut||n instanceof ct&&n.isInterrupting!==void 0)&&t.set(m.IS_INTERRUPTING,String(n.isInterrupting))}function sn(n,t){n instanceof se?t.set(m.SUB_PROCESS_KIND,n.subProcessKind):n.kind===h.TASK_RECEIVE?t.set(m.IS_INSTANTIATING,String(n.instantiate)):n instanceof z&&t.set(m.GLOBAL_TASK_KIND,n.globalTaskKind);const e=n.markers;e.length>0&&t.set(m.MARKERS,e.join(","))}function on(n){const t=[],e=n.bpmnElement;return e instanceof it&&t.push(e.sequenceFlowKind),e instanceof lt&&t.push(e.associationDirectionKind),t}function rn(n,t){const e=new Map,s=n.bpmnElement;return t?(e.set(c.STYLE_VERTICAL_ALIGN,c.ALIGN_TOP),n.bpmnElement.kind!=h.TEXT_ANNOTATION&&e.set(c.STYLE_ALIGN,c.ALIGN_CENTER),n instanceof le&&(e.set(c.STYLE_LABEL_WIDTH,t.width+1),e.set(c.STYLE_LABEL_POSITION,"ignore"),e.set(c.STYLE_VERTICAL_LABEL_POSITION,c.ALIGN_MIDDLE))):n instanceof le&&(s instanceof se||s instanceof z&&s.callActivityKind===ee.CALLING_PROCESS)&&!s.markers.includes(_.EXPAND)&&e.set(c.STYLE_VERTICAL_ALIGN,c.ALIGN_TOP),e}function ln(n){let t=0;return n.isBold&&(t+=c.FONT_BOLD),n.isItalic&&(t+=c.FONT_ITALIC),n.isStrikeThrough&&(t+=c.FONT_STRIKETHROUGH),n.isUnderline&&(t+=c.FONT_UNDERLINE),t}function He(n){return n.filter(([,t])=>t&&t!="undefined").map(([t,e])=>`${t}=${e}`)}class an{constructor(t,e,s){this.graph=t,this.coordinatesTranslator=e,this.styleComputer=s}render(t,e){this.insertShapesAndEdges(t),this.graph.customFit(e)}insertShapesAndEdges({pools:t,lanes:e,subprocesses:s,otherFlowNodes:o,boundaryEvents:i,edges:r}){this.graph.batchUpdate(()=>{this.graph.getModel().clear(),this.insertShapes(t),this.insertShapes(e),this.insertShapes(s),this.insertShapes(o),this.insertShapes(i),this.insertEdges(r)})}insertShapes(t){for(const e of t)this.insertShape(e)}getParent(t){return this.getCell(t.parentId)??this.graph.getDefaultParent()}insertShape(t){var l;const e=t.bpmnElement,s=this.getParent(e),o=t.bounds;let i=(l=t.label)==null?void 0:l.bounds;i=C.isPoolOrLane(e.kind)?void 0:i;const r=this.styleComputer.computeStyle(t,i);this.insertVertex(s,e.id,e.name,o,i,r)}insertEdges(t){var e;for(const s of t){const o=s.bpmnElement,i=this.graph.getDefaultParent(),r=this.getCell(o.sourceReferenceId),l=this.getCell(o.targetReferenceId),a=(e=s.label)==null?void 0:e.bounds,u=this.styleComputer.computeStyle(s,a),d=this.graph.insertEdge(i,o.id,o.name,r,l,u);if(this.insertWaypoints(s.waypoints,d),a){d.geometry.width=a.width,d.geometry.height=a.height;const f=this.coordinatesTranslator.computeEdgeCenter(d);d.geometry.relative=!1;const T=this.coordinatesTranslator.computeRelativeCoordinates(d.parent,new F(a.x,a.y)),E=T.x+a.width/2-f.x,S=T.y-f.y;d.geometry.offset=new F(E,S)}this.insertMessageFlowIconIfNeeded(s,d)}}insertMessageFlowIconIfNeeded(t,e){if(t.bpmnElement instanceof rt&&t.messageVisibleKind!==ne.NONE){const s=this.graph.insertVertex(e,be(e.id),void 0,0,0,20,14,this.styleComputer.computeMessageFlowIconStyle(t));s.geometry.relative=!0,s.geometry.offset=new F(-10,-7)}}insertWaypoints(t,e){t&&(e.geometry.points=t.map(s=>this.coordinatesTranslator.computeRelativeCoordinates(e.parent,new F(s.x,s.y))))}getCell(t){return this.graph.getModel().getCell(t)}insertVertex(t,e,s,o,i,r){const l=this.coordinatesTranslator.computeRelativeCoordinates(t,new F(o.x,o.y)),a=this.graph.insertVertex(t,e,s,l.x,l.y,o.width,o.height,r);if(i){const u=i.x-o.x,d=i.y-o.y;a.geometry.offset=new F(u,d)}return a}}function cn(n,t){return new an(n,new Ht(n),new tn(t))}function be(n){return`messageFlowIcon_of_${n}`}function un(n,t,{signal:e}={}){let s=null;const o=function(...r){s!==null&&clearTimeout(s),!(e!=null&&e.aborted)&&(s=setTimeout(()=>{n(...r),s=null},t))},i=function(){o.cancel()};return o.cancel=function(){s!==null&&(clearTimeout(s),s=null)},e==null||e.addEventListener("abort",i,{once:!0}),o}function dn(n,t){let e;return function(...o){const i=Date.now();(e==null||i-e>=t)&&(e=i,n(...o))}}class gt extends O.mxCellOverlay{constructor(e,s){super(null,"",s.position.horizontalAlign,s.position.verticalAlign,null,"default");g(this,"style");this.label=e,this.style=s.style}getBounds(e){const s=e.view.graph.getModel().isEdge(e.cell),o=e.view.scale;let i;const r=0,l=0;return s?i=this.computeEdgeBounds(e):(i=new F,this.align==c.ALIGN_LEFT?i.x=e.x:this.align==c.ALIGN_CENTER?i.x=e.x+e.width/2:i.x=e.x+e.width,this.verticalAlign==c.ALIGN_TOP?i.y=e.y:this.verticalAlign==c.ALIGN_MIDDLE?i.y=e.y+e.height/2:i.y=e.y+e.height),new Ce(Math.round(i.x-(r*this.defaultOverlap-this.offset.x)*o),Math.round(i.y-(l*this.defaultOverlap-this.offset.y)*o),r*o,l*o)}computeEdgeBounds(e){const s=e.absolutePoints;if(this.align==c.ALIGN_LEFT)return s[0];if(this.align==c.ALIGN_CENTER){if(s.length%2==1)return s[Math.floor(s.length/2)];{const o=s.length/2,i=s[o-1],r=s[o];return new F(i.x+(r.x-i.x)/2,i.y+(r.y-i.y)/2)}}else return s.at(-1)}}class Ke extends O.mxText{constructor(t,e,s){super(t,e,void 0,void 0,s.font.color,void 0,s.font.size,void 0,void 0,void 0,void 0,void 0,void 0,void 0,s.fill.color,s.stroke.color),this.fillOpacity=s.fill.opacity,this.strokewidth=s.stroke.width}}function hn(n){return Object.values(P).map(t=>t).includes(n)}function fn(n,t){return gn(n.style,t)}function gn(n,t){const e=[],s=n.split(";"),i=s[0].replace(/shape=bpmn./g,""),r=new Map;r.set("bpmn-type-activity",C.isActivity(i)),r.set("bpmn-type-container",C.isPoolOrLane(i)),r.set("bpmn-type-event",C.isEvent(i)),r.set("bpmn-type-flow",hn(i)),r.set("bpmn-type-gateway",C.isGateway(i)),r.set("bpmn-type-task",C.isTask(i));for(const[l]of[...r].filter(([,a])=>a))e.push(l);e.push(Ae(i));for(const[l,a]of s.map(u=>{const d=u.split("=");return[d[0],d[1]]}))switch(l){case m.EVENT_DEFINITION_KIND:{e.push(`bpmn-event-def-${a}`);break}case m.EVENT_BASED_GATEWAY_KIND:{e.push(`bpmn-gateway-kind-${a.toLowerCase()}`);break}case m.IS_INITIATING:{e.push(a=="true"?"bpmn-icon-initiating":"bpmn-icon-non-initiating");break}case m.SUB_PROCESS_KIND:{e.push(`bpmn-sub-process-${a.toLowerCase()}`);break}case m.GLOBAL_TASK_KIND:{e.push(Ae(a));break}}return t&&e.push("bpmn-label"),e}function Ae(n){return n?"bpmn-"+n.replace(/([A-Z])/g,t=>"-"+t[0].toLowerCase()):""}const ze=function(n){const t=n.createSvgCanvas;n.createSvgCanvas=function(){var o;const e=t.bind(this)(),s=e.getTextCss;if(e.getTextCss=function(){const i=this.pointerEvents;this.pointerEvents=!1;const r=s.bind(this)();return this.pointerEvents=i,r},(o=this.state)!=null&&o.cell){const i=this.state.cell,r=fn(i,this.dialect===c.DIALECT_STRICTHTML),l=this.state.style[m.EXTRA_CSS_CLASSES];typeof l=="string"&&r.push(...l.split(",")),this.node.setAttribute("class",r.join(" ")),this.node.dataset.bpmnId=this.state.cell.id}return e}};class Tn extends O.mxCellRenderer{constructor(t){super(),this.iconPainter=t}createCellOverlays(t){const s=t.view.graph.getCellOverlays(t.cell);let o=null;if(s!=null){o=new O.mxDictionary;for(const i of s){const r=t.overlays==null?null:t.overlays.remove(i);if(r!=null){o.put(i,r);continue}let l;i instanceof gt?l=new Ke(i.label,new Ce(0,0,0,0),i.style):(l=new O.mxImageShape(new Ce(0,0,0,0),i.image.src),l.preserveImageAspect=!1),l.dialect=t.view.graph.dialect,l.overlay=i,this.initializeOverlay(t,l),this.installCellOverlayListeners(t,i,l),i.cursor!=null&&(l.node.style.cursor=i.cursor),l instanceof Ke&&(l.node.classList.add("overlay-badge"),l.node.dataset.bpmnId=t.cell.id),o.put(i,l)}}t.overlays!=null&&t.overlays.visit(function(i,r){r.destroy()}),t.overlays=o}createShape(t){const e=super.createShape(t);return"iconPainter"in e&&(e.iconPainter=this.iconPainter),ze(e),e}createLabel(t,e){super.createLabel(t,e),ze(t.text)}}function pn(n,t,e,s){let o,i;n.heightE.setIconOriginForIconCentered(),shapeConfig:{x:t,y:e,width:s,height:o,strokeWidth:u},iconStyleConfig:{isFilled:l,fillColor:d,strokeColor:f,strokeWidth:a,margin:T}}}class Sn{newBpmnCanvas({canvas:t,ratioFromParent:e,setIconOriginFunct:s,shapeConfig:o,iconStyleConfig:i},r){return new En({canvas:t,shapeConfig:o,iconConfig:{originalSize:r,styleConfig:i,ratioFromParent:e,setIconOriginFunct:s}})}paintEnvelopeIcon(t){const e={width:485.41,height:321.76},s=this.newBpmnCanvas(t,e),o=e.width,i=e.height;s.rect(0,0,o,i),s.fillAndStroke();const{iconStyleConfig:r}=t;r.isFilled&&s.setStrokeColor(r.fillColor),s.begin(),s.moveTo(0,0),s.lineTo(o*.5,i*.6),s.lineTo(o,0),s.moveTo(0,i),s.lineTo(o/3,i*.45),s.moveTo(o,i),s.lineTo(o*2/3,i*.45),s.stroke()}paintCircleIcon(t){const e={width:t.shapeConfig.width,height:t.shapeConfig.height},s=this.newBpmnCanvas(t,e),o=e.width,i=e.height;o>0&&i>0&&s.ellipse(0,0,o,i),t.iconStyleConfig.isFilled?s.fillAndStroke():s.stroke()}paintClockIcon(t){const e=this.newBpmnCanvas(t,{height:152,width:152});e.begin(),e.moveTo(184,60),e.curveTo(188.4,60,192,56.4,192,52),e.lineTo(192,48),e.curveTo(192,40,188.4,40,184,40),e.curveTo(179.6,40,176,43.6,176,48),e.lineTo(176,52),e.curveTo(176,56.4,179.6,60,184,60),e.close(),e.moveTo(184,308),e.curveTo(179.6,308,176,311.6,176,316),e.lineTo(176,320),e.curveTo(176,324.4,179.6,328,184,328),e.curveTo(188.4,328,192,324.4,192,320),e.lineTo(192,316),e.curveTo(192,311.6,188.4,308,184,308),e.close(),e.moveTo(52,176),e.lineTo(48,176),e.curveTo(43.6,176,40,179.6,40,184),e.curveTo(40,188.4,43.6,192,48,192),e.lineTo(52,192),e.curveTo(56.4,192,69,188.4,60,184),e.curveTo(60,179.6,56.4,176,52,176),e.close(),e.moveTo(320,176),e.lineTo(316,176),e.curveTo(311.6,176,308,179.6,308,184),e.curveTo(308,188.4,311.6,192,316,192),e.lineTo(320,192),e.curveTo(324.4,192,328,188.4,328,184),e.curveTo(328,179.6,324.4,176,320,176),e.moveTo(93.6,82.4),e.curveTo(90.4,79.2,85.6,79.2,82.4,82.4),e.curveTo(79.2,85.6,79.2,90.4,82.4,93.6),e.lineTo(85.2,96.4),e.curveTo(86.8,98,88.8,98.8,90.8,98.8),e.curveTo(92.8,98.8,94.4,98,96.4,96.4),e.curveTo(99.6,93.2,99.6,88.4,96.4,85.2),e.lineTo(93.6,82.4),e.moveTo(85.2,271.6),e.lineTo(82.4,274.4),e.curveTo(79.2,277.6,79.2,282.4,82.4,285.6),e.curveTo(84,287.2,86,288,88,288),e.curveTo(90,288,92,287.2,93.6,285.6),e.lineTo(96.4,282.8),e.curveTo(99.6,279.6,99.6,274.8,96.4,271.6),e.curveTo(93.2,268.4,88.4,268.4,85.2,271.6),e.moveTo(274.4,82.4),e.lineTo(271.6,85.2),e.curveTo(268.4,88.4,268.4,93.2,271.6,96.4),e.curveTo(273.298,98,275.2,98.8,277.2,98.8),e.curveTo(279.2,98.8,281.2,98,282.8,96.4),e.lineTo(285.6,93.6),e.curveTo(288.8,90.4,288.8,85.6,285.6,82.4),e.curveTo(282.4,79.2,277.6,79.2,274.4,82.4),e.moveTo(192,180.8),e.lineTo(192,108),e.curveTo(192,103.6,188.4,100,184,100),e.curveTo(179.6,100,176,103.6,176,108),e.lineTo(176,184),e.curveTo(176,186,176.8,188,178.4,189.6),e.lineTo(266,277.2),e.curveTo(267.6,278.8,269.6,279.6,271.6,279.6),e.curveTo(273.6,279.6,275.6,278.8,277.2,277.2),e.curveTo(280.4,274,280.4,269.2,277.2,266),e.lineTo(192,180.8),e.moveTo(184,0),e.curveTo(82.4,0,0,82.4,0,184),e.curveTo(0,285.6,82.4,368,184,368),e.curveTo(285.6,368,368,285.6,368,184),e.curveTo(368,82.4,285.6,0,184,0),e.moveTo(184,352),e.curveTo(91.2,352,16,276.8,16,184),e.curveTo(16,91.2,91.2,16,184,16),e.curveTo(276.8,16,352,91.2,352,184),e.curveTo(352,276.8,276.8,352,184,352),e.fillAndStroke()}paintTriangleIcon(t){const e=this.newBpmnCanvas(t,{height:735,width:849});e.begin(),e.moveTo(497,55),e.lineTo(817,609),e.curveTo(849,665,808,735,744,735),e.lineTo(105,735),e.curveTo(40,735,0,665,32,609),e.lineTo(352,55),e.curveTo(384,0,465,0,497,55),e.close(),e.fillAndStroke()}paintUpArrowheadIcon(t){const e=this.newBpmnCanvas(t,{height:50,width:40});e.begin(),e.moveTo(0,49.5),e.lineTo(19.5,1),e.curveTo(19.75,.25,20,0,20.25,.25),e.lineTo(40,49.5),e.curveTo(40,49.5,39.75,50,39.6,49.75),e.lineTo(20,30),e.lineTo(.4,49.75),e.curveTo(.4,49.75,.25,50,0,49.5),e.close(),e.fillAndStroke()}paintDoubleLeftArrowheadsIcon(t){const e=this.newBpmnCanvas(t,{height:53.5,width:105});e.begin(),e.moveTo(91.4,0),e.curveTo(91.4,0,91.2,0,91,.2),e.lineTo(50,25),e.curveTo(47.9,25.8,46.7,26.6,46.4,27.3),e.lineTo(46.4,0),e.curveTo(46.4,0,46.2,0,46,.2),e.lineTo(4.9,25),e.curveTo(2,26.2,0,27.3,4.9,28.5),e.lineTo(45.8,53),e.curveTo(46,53.3,46.2,53.5,46.4,53.5),e.lineTo(46.4,27),e.curveTo(46.6,27.3,47.8,28.1,49.9,29.9),e.lineTo(90.8,53.3),e.curveTo(91,53.3,91.2,53.5,91.4,53.5),e.lineTo(91.4,0),e.close(),e.fillAndStroke()}drawCrossIcon(t){const e=this.newBpmnCanvas(t,{height:1,width:1});return e.begin(),e.moveTo(.38,0),e.lineTo(.62,0),e.lineTo(.62,.38),e.lineTo(1,.38),e.lineTo(1,.62),e.lineTo(.62,.62),e.lineTo(.62,1),e.lineTo(.38,1),e.lineTo(.38,.62),e.lineTo(0,.62),e.lineTo(0,.38),e.lineTo(.38,.38),e.close(),e}paintListIcon(t){const e=this.newBpmnCanvas(t,{height:60,width:60});e.begin(),e.moveTo(0,0),e.lineTo(60,0),e.lineTo(60,60),e.lineTo(0,60),e.lineTo(0,0),e.close(),e.moveTo(5,5),e.lineTo(55,5),e.close(),e.moveTo(5,21.6),e.lineTo(55,21.6),e.close(),e.moveTo(5,38.3),e.lineTo(55,38.3),e.close(),e.moveTo(5,55),e.lineTo(55,55),e.close(),e.fillAndStroke()}paintXCrossIcon(t){const e=this.drawCrossIcon(t);e.rotateOnIconCenter(45),e.fillAndStroke()}paintPlusCrossIcon(t){this.drawCrossIcon(t).fillAndStroke()}paintAsteriskIcon(t){const e=this.newBpmnCanvas(t,{height:1,width:1});Te(e),e.fillAndStroke(),Te(e),e.rotateOnIconCenter(60),e.fillAndStroke(),Te(e),e.rotateOnIconCenter(240),e.fillAndStroke()}paintPersonIcon(t){const e=this.newBpmnCanvas({...t,iconStyleConfig:{...t.iconStyleConfig,isFilled:!0}},{height:239.68,width:143.61});e.begin(),e.moveTo(124.31,150.29),e.lineTo(99.66,141.03),e.arcTo(6.43,6.43,0,0,1,95.51,135.03),e.lineTo(95.51,130.66),e.arcTo(47.75,47.75,0,0,0,119.51,89.25),e.lineTo(119.51,71.25),e.arcTo(47.62,47.62,0,0,0,101.18,33.64),e.arcTo(29.35,29.35,0,0,0,101.52,29.14),e.arcTo(29.68,29.68,0,0,0,42.17,29.14),e.arcTo(29.24,29.24,0,0,0,42.53,33.63),e.arcTo(47.65,47.65,0,0,0,24.14,71.23),e.lineTo(24.14,89.23),e.arcTo(47.7,47.7,0,0,0,48.19,130.63),e.lineTo(48.19,135.03),e.arcTo(6.43,6.43,0,0,1,44.03,141.03),e.lineTo(19.31,150.29),e.arcTo(29.81,29.81,0,0,0,.09,178.03),e.lineTo(.09,233.51),e.arcTo(5.63,5.63,0,1,0,11.34,233.51),e.lineTo(11.34,178.03),e.arcTo(18.19,18.19,0,0,1,11.57,175.17),e.lineTo(20.5,184.11),e.arcTo(12.32,12.32,0,0,1,24.14,192.89),e.lineTo(24.14,233.51),e.arcTo(5.63,5.63,0,1,0,35.39,233.51),e.lineTo(35.39,192.93),e.arcTo(23.5,23.5,0,0,0,28.46,176.2),e.lineTo(17.04,164.78),e.arcTo(18.34,18.34,0,0,1,23.29,160.78),e.lineTo(43.65,153.15),e.lineTo(66.22,175.72),e.lineTo(66.22,233.51),e.arcTo(5.63,5.63,0,1,0,77.47,233.51),e.lineTo(77.47,175.76),e.lineTo(100.04,153.19),e.lineTo(120.4,160.82),e.arcTo(18.39,18.39,0,0,1,126.65,164.82),e.lineTo(115.24,176.24),e.arcTo(23.5,23.5,0,0,0,108.31,192.93),e.lineTo(108.31,233.55),e.arcTo(5.63,5.63,0,1,0,119.56,233.55),e.lineTo(119.56,192.93),e.arcTo(12.35,12.35,0,0,1,123.19,184.15),e.lineTo(132.13,175.22),e.arcTo(18,18,0,0,1,132.36,178.08),e.lineTo(132.36,233.56),e.arcTo(5.63,5.63,0,0,0,143.61,233.56),e.lineTo(143.61,178.03),e.arcTo(29.81,29.81,0,0,0,124.31,150.29),e.close(),e.moveTo(71.85,10.72),e.arcTo(18.46,18.46,0,0,1,90.17,27.18),e.arcTo(47.68,47.68,0,0,0,53.53,27.18),e.arcTo(18.44,18.44,0,0,1,71.85,10.72),e.close(),e.moveTo(35.39,71.23),e.arcTo(36.46,36.46,0,0,1,108.31,71.23),e.lineTo(108.31,77.4),e.curveTo(82.12,75.4,56.97,60.55,56.71,60.4),e.arcTo(5.62,5.62,0,0,0,48.78,62.71),e.curveTo(46.24,67.79,40.45,71.89,35.39,74.62),e.close(),e.moveTo(35.39,89.23),e.lineTo(35.39,87.08),e.curveTo(40.55,84.85,49.73,80.08,55.67,72.66),e.curveTo(64.83,77.46,85.92,87.21,108.31,88.66),e.lineTo(108.31,89.24),e.arcTo(36.46,36.46,0,1,1,35.39,89.24),e.close(),e.moveTo(71.85,165.45),e.lineTo(54.06,147.69),e.arcTo(17.7,17.7,0,0,0,59.43,135.32),e.arcTo(47.57,47.57,0,0,0,84.27,135.32),e.arcTo(17.7,17.7,0,0,0,89.64,147.69),e.close(),e.fill()}paintGearIcon(t){const e=this.newBpmnCanvas(t,{height:100,width:100});Cn(e),e.translateIconOrigin(14,14),mn(e)}paintExpandIcon(t){const e={width:16,height:16},s=this.newBpmnCanvas(t,e),o=e.width,i=e.height;s.roundrect(0,0,o,i,2,2),s.stroke(),s.begin(),s.moveTo(o/2,i/4),s.lineTo(o/2,i*3/4),s.close(),s.moveTo(o/4,i/2),s.lineTo(o*3/4,i/2),s.close(),s.fillAndStroke()}paintLoopIcon(t){const{iconStyleConfig:e}=t;e.fillColor=e.strokeColor;const s=this.newBpmnCanvas(t,{width:22.49,height:21.62});s.begin(),s.moveTo(5.5,19.08),s.arcTo(8,8,0,1,1,10.5,21.08),s.stroke(),s.begin(),s.moveTo(7.5,14.08),s.lineTo(5.75,19.08),s.lineTo(0,17.08),s.close(),s.fillAndStroke()}paintSequentialMultiInstanceIcon(t){const e={width:16,height:16},s=this.newBpmnCanvas(t,e),{canvas:o,iconStyleConfig:i}=t;o.setFillColor(i.strokeColor);const r=e.width,l=e.height/5;s.rect(0,0,r,l),s.fill(),s.rect(0,2*l,r,l),s.fill(),s.rect(0,4*l,r,l),s.fill()}paintParallelMultiInstanceIcon(t){const e={width:16,height:16},s=this.newBpmnCanvas(t,e),{canvas:o,iconStyleConfig:i}=t;o.setFillColor(i.strokeColor);const r=e.width/5,l=e.height;s.begin(),s.rect(0,0,r,l),s.fill(),s.rect(2*r,0,r,l),s.fill(),s.rect(4*r,0,r,l),s.fill()}paintRightArrowIcon(t){const e=this.newBpmnCanvas(t,{width:512,height:415.23});e.setRoundLineJoin(),e.begin(),e.moveTo(512,207.61),e.lineTo(304.38,0),e.lineTo(304.38,135.39),e.lineTo(0,135.39),e.lineTo(0,279.84),e.lineTo(304.38,279.84),e.lineTo(304.38,415.23),e.lineTo(512,207.61),e.close(),e.fillAndStroke()}paintErrorIcon(t){const e=this.newBpmnCanvas(t,{width:72.44,height:71.82});e.begin(),e.moveTo(0,53.32),e.lineTo(19.48,0),e.lineTo(19.48,0),e.lineTo(50.85,40.07),e.lineTo(72.44,18.21),e.lineTo(53.12,71.82),e.lineTo(22.5,31.37),e.close(),e.fillAndStroke()}paintHandIcon(t){const e=this.newBpmnCanvas(t,{width:343.65,height:354.12});e.begin(),e.moveTo(231.66,336.39),e.curveTo(240.84,316.9,220.53,306.92,220.53,306.92),e.curveTo(215.2,303.67,188.58,287.43,140.67,258.19),e.lineTo(146.33,248.39),e.curveTo(223.98,269.38,267.12,281.04,275.75,283.38),e.curveTo(275.75,283.38,297.25,288,301.42,267.77),e.curveTo(306.34,245.29,288.32,238.63,288.32,238.63),e.curveTo(279.91,236.44,237.86,225.48,162.18,205.75),e.lineTo(165.2,194.8),e.curveTo(255.88,204.4,306.27,209.73,316.34,210.8),e.curveTo(316.34,210.8,339.89,212.16,341.76,189.55),e.curveTo(343.65,166.93,320.5,164.13,320.5,164.13),e.curveTo(310.43,163.1,260.04,157.99,169.35,148.77),e.lineTo(169.35,138.97),e.curveTo(253.41,132.12,300.11,128.32,309.45,127.56),e.curveTo(309.45,127.56,332.27,122.38,332.27,102.61),e.curveTo(332.27,82.85,305.48,81.87,305.48,81.87),e.curveTo(293.99,82.2,236.54,83.88,133.13,86.9),e.lineTo(127.61,81.87),e.curveTo(145.3,59.39,155.12,46.9,157.09,44.41),e.curveTo(157.09,44.41,171.12,26.8,156.78,12.72),e.curveTo(143.83,0,124.08,14.49,124.08,14.49),e.curveTo(116.45,19.41,78.35,44.06,9.77,88.43),e.lineTo(0,251.94),e.curveTo(122.84,308.79,191.09,340.37,204.74,346.69),e.curveTo(204.74,346.69,222.91,354.12,231.66,336.39),e.fillAndStroke()}paintScriptIcon(t){t.iconStyleConfig.fillColor=t.iconStyleConfig.strokeColor;const e=this.newBpmnCanvas(t,{width:458.75,height:461.64});e.begin(),e.moveTo(67.85,.57),e.curveTo(50.73,0,33.26,8.86,22.35,18.84),e.curveTo(8.11,32.15,0,50.77,0,70.26),e.curveTo(0,73.15,0,87.59,0,113.6),e.curveTo(55.4,113.6,86.18,113.6,92.33,113.6),e.curveTo(94.92,150.46,85.64,180.4,74.22,211.27),e.curveTo(40.16,298.07,30.77,339.83,55.56,410.87),e.curveTo(63.72,438.26,87.59,457.85,114.91,461.09),e.curveTo(216.96,460.85,294.9,461.64,388.41,461.2),e.curveTo(407.2,461.09,425.14,453.55,438.3,440.13),e.curveTo(451.46,426.71,458.75,403.06,458.46,384.26),e.curveTo(458.43,382.23,458.18,365.93,458.15,363.89),e.curveTo(432.12,364.24,406.09,364.04,380.06,364.04),e.curveTo(377.61,347.52,377.24,337.58,378.28,324.48),e.curveTo(380.5,296.47,389.08,273.36,398.59,247.1),e.curveTo(408.11,220.83,418.41,191.47,420.86,154.24),e.curveTo(422.11,135.34,421.4,110.24,417.77,86.75),e.curveTo(417.76,86.71,417.73,86.54,417.69,86.22),e.curveTo(417.64,85.95,417.61,85.79,417.6,85.76),e.curveTo(414.03,68.13,410.49,48.84,399.79,31.47),e.curveTo(389.09,14.11,366.95,.59,341.75,.59),e.curveTo(286.97,.59,122.63,.57,67.85,.57),e.close(),e.moveTo(85.04,72.68),e.curveTo(80.63,72.68,45.33,72.68,40.92,72.68),e.curveTo(40.46,58.4,47.15,51.87,50.27,48.75),e.curveTo(55.8,44.28,59.84,41,73.82,41),e.curveTo(78.45,52.13,82.23,62.71,85.04,72.68),e.close(),e.moveTo(364.94,52.9),e.curveTo(370,61.11,373.9,76.44,377.38,93.51),e.curveTo(380.35,113.1,381.01,136.42,380.02,151.57),e.curveTo(377.97,182.76,369.51,207.12,360.1,233.1),e.curveTo(350.69,259.09,340.27,286.77,337.53,321.27),e.curveTo(336.38,335.86,336.72,346.69,338.87,364.01),e.curveTo(326.35,364.01,263.75,364.01,151.06,364.01),e.curveTo(151.06,382.2,151.06,392.31,151.06,394.33),e.curveTo(147.77,404.8,138.9,418.2,127.43,419.94),e.curveTo(111.49,422.35,97.86,411.8,94.75,399.19),e.curveTo(65.14,321.99,94.93,275.54,112.57,225.47),e.curveTo(130.14,177.95,137.92,117.41,112.71,42.09),e.curveTo(192.88,41.9,274.33,42.21,342.89,41.98),e.curveTo(357.15,42.03,359.83,44.61,364.94,52.9),e.close(),e.moveTo(409.96,399.48),e.curveTo(409.96,408.42,398.54,425.67,392.02,425.67),e.curveTo(325.19,425.79,252.29,425.67,185.23,425.67),e.curveTo(189.88,424.43,194.66,405.64,194.66,399.48),e.curveTo(237.72,399.48,388.43,399.48,409.96,399.48),e.close(),e.fill(),e.begin(),e.moveTo(182.1,131.2),e.lineTo(182.1,151.68),e.lineTo(321.89,151.68),e.lineTo(321.89,131.2),e.lineTo(182.1,131.2),e.close(),e.moveTo(162.25,251.09),e.lineTo(162.25,271.49),e.lineTo(301.96,271.49),e.lineTo(301.96,251.09),e.lineTo(162.25,251.09),e.close(),e.fill()}paintTableIcon(t){const e=this.newBpmnCanvas(t,{width:640,height:640});e.begin(),e.moveTo(.19,.1),e.lineTo(298.78,.1),e.lineTo(298.78,198.88),e.lineTo(.19,198.88),e.lineTo(.19,.1),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(0,0),e.lineTo(298.78,0),e.lineTo(298.78,48.88),e.lineTo(0,48.88),e.lineTo(0,0),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(0,48.88),e.lineTo(98.78,48.88),e.lineTo(98.78,198.88),e.lineTo(0,198.88),e.lineTo(0,48.88),e.close(),e.fillAndStroke(),e.begin(),e.moveTo(1.09,122.69),e.lineTo(298.78,122.69),e.close(),e.fillAndStroke(),e.setFillColor(t.iconStyleConfig.strokeColor),e.begin(),e.moveTo(0,0),e.lineTo(298.78,0),e.lineTo(298.78,48.88),e.lineTo(0,48.88),e.lineTo(0,0),e.close(),e.fillAndStroke()}paintPentagon(t){const e=this.newBpmnCanvas(t,{width:16,height:16});e.begin(),e.moveTo(16,6.5),e.lineTo(8,0),e.lineTo(0,6.5),e.lineTo(3,16),e.lineTo(13,16),e.lineTo(16,6.5),e.lineTo(8,0),e.stroke()}}function Te(n){n.begin(),n.moveTo(.38,0),n.lineTo(.62,0),n.lineTo(.62,1),n.lineTo(.38,1),n.close()}function Cn(n){n.begin(),n.moveTo(2.06,24.62),n.lineTo(10.17,30.95),n.lineTo(9.29,37.73),n.lineTo(0,41.42),n.lineTo(2.95,54.24),n.lineTo(13.41,52.92),n.lineTo(17.39,58.52),n.lineTo(13.56,67.66),n.lineTo(24.47,74.44),n.lineTo(30.81,66.33),n.lineTo(37.88,67.21),n.lineTo(41.57,76.5),n.lineTo(54.24,73.55),n.lineTo(53.06,62.94),n.lineTo(58.52,58.52),n.lineTo(67.21,63.09),n.lineTo(74.58,51.88),n.lineTo(66.03,45.25),n.lineTo(66.92,38.62),n.lineTo(76.5,34.93),n.lineTo(73.7,22.26),n.lineTo(62.64,23.44),n.lineTo(58.81,18.42),n.lineTo(62.79,8.7),n.lineTo(51.74,2.21),n.lineTo(44.81,10.47),n.lineTo(38.03,9.43),n.lineTo(33.75,0),n.lineTo(21.52,3.24),n.lineTo(22.7,13.56),n.lineTo(18.13,17.54),n.lineTo(8.7,13.56),n.close(),Ne(n,24.8,39)}function mn(n){n.begin(),n.moveTo(16.46,41.42),n.lineTo(24.57,47.75),n.lineTo(23.69,54.53),n.lineTo(14.4,58.22),n.lineTo(17.35,71.04),n.lineTo(27.81,69.72),n.lineTo(31.79,75.32),n.lineTo(27.96,84.46),n.lineTo(38.87,91.24),n.lineTo(45.21,83.13),n.lineTo(52.28,84.01),n.lineTo(55.97,93.3),n.lineTo(68.64,90.35),n.lineTo(67.46,79.74),n.lineTo(72.92,75.32),n.lineTo(81.61,79.89),n.lineTo(88.98,68.68),n.lineTo(80.43,62.05),n.lineTo(81.32,55.42),n.lineTo(90.9,51.73),n.lineTo(88.1,39.06),n.lineTo(77.04,40.24),n.lineTo(73.21,35.22),n.lineTo(77.19,25.5),n.lineTo(66.14,19.01),n.lineTo(59.21,27.27),n.lineTo(52.43,26.23),n.lineTo(48.15,16.8),n.lineTo(35.92,20.04),n.lineTo(37.1,30.36),n.lineTo(32.53,34.34),n.lineTo(23.1,30.36),n.close();const t=39.2,e=55.8;Ne(n,t,e),n.begin(),Ne(n,t,e)}function Ne(n,t,e){n.moveTo(t,e),n.arcTo(13.5,13.5,0,1,1,t+2*13.5,e),n.arcTo(13.5,13.5,0,0,1,t,e),n.close(),n.fillAndStroke()}class Tt{static get(){return this.instance}static set(t){this.instance=t}}g(Tt,"instance",new Sn);const ve=1.25,In=1/ve;class An extends O.mxGraph{constructor(e){super(e);g(this,"currentZoomLevel",1);this.zoomFactor=ve,this.container&&(this.container.style.cursor="default")}createGraphView(){return new Nn(this)}createCellRenderer(){return new Tn(Tt.get())}batchUpdate(e){this.model.beginUpdate();try{e()}finally{this.model.endUpdate()}}fit(e,s,o,i,r,l,a){const u=super.fit(e,s,o,i,r,l,a);return this.setCurrentZoomLevel(u),u}setCurrentZoomLevel(e){this.currentZoomLevel=e??this.view.scale}zoomActual(){super.zoomActual(),this.setCurrentZoomLevel()}zoomIn(){super.zoomIn(),this.setCurrentZoomLevel()}zoomOut(){super.zoomOut(),this.setCurrentZoomLevel()}customFit(e){this.zoomActual();const s=e==null?void 0:e.type;if(s==null||s==J.None)return;const o=Kt(e==null?void 0:e.margin);if(s==J.Center){const r=this.getGraphBounds(),l=this.container.clientWidth-o,a=this.container.clientHeight-o,u=r.width/this.view.scale,d=r.height/this.view.scale,f=Math.min(3,Math.min(l/u,a/d));this.setCurrentZoomLevel(f),this.view.scaleAndTranslate(f,(o+l-u*f)/(2*f)-r.x/this.view.scale,(o+a-d*f)/(2*f)-r.y/this.view.scale)}else{let i=!1,r=!1;switch(s){case J.Horizontal:{r=!0;break}case J.Vertical:{i=!0;break}}this.fit(this.border,!1,o,!0,i,r)}}registerMouseWheelZoomListeners(e){e=zt(e),G.addMouseWheelListener(un(this.createMouseWheelZoomListener(!0),e.debounceDelay),this.container),G.addMouseWheelListener(dn(this.createMouseWheelZoomListener(!1),e.throttleDelay),this.container)}manageMouseWheelZoomEvent(e,s,o){if(o){const[i,r]=this.getEventRelativeCoordinates(s),[l,a,u]=this.getScaleAndTranslationDeltas(i,r);this.view.scaleAndTranslate(l,this.view.translate.x+a,this.view.translate.y+u),G.consume(s)}else this.currentZoomLevel*=e?ve:In}createMouseWheelZoomListener(e){return(s,o)=>{if(G.isConsumed(s)||!(s instanceof MouseEvent))return;s.ctrlKey&&!s.altKey&&!s.shiftKey&&!s.metaKey&&this.manageMouseWheelZoomEvent(o,s,e)}}getEventRelativeCoordinates(e){const s=this.container.getBoundingClientRect(),o=e.clientX-s.left,i=e.clientY-s.top;return[o,i]}getScaleAndTranslationDeltas(e,s){const[o,i]=this.calculateFactorAndScale(),[r,l]=this.calculateTranslationDeltas(o,i,e*2,s*2);return[i,r,l]}calculateTranslationDeltas(e,s,o,i){if(e>1){const r=(e-1)/(s*2);o*=-r,i*=-r}else{const r=(1/e-1)/(this.view.scale*2);o*=r,i*=r}return[o,i]}calculateFactorAndScale(){const e=Math.round(this.currentZoomLevel*100)/100;return[e/this.view.scale,e]}}class Nn extends O.mxGraphView{getFloatingTerminalPoint(t,e,s,o){if(t.absolutePoints.filter(Boolean).length<2)return super.getFloatingTerminalPoint(t,e,s,o);const l=t.absolutePoints;return o?l[1]:l.at(-2)}}class vn{configureMarkers(){this.registerArrowDashMarker()}registerArrowDashMarker(){const t=(e,s,o,i,r,l,a,u,d)=>{const f=r*(a+d+4),T=l*(a+d+4);return function(){e.begin(),e.moveTo(i.x-f/2-T/2,i.y-T/2+f/2),e.lineTo(i.x+T/2-3*f/2,i.y-3*T/2-f/2),e.stroke()}};O.mxMarker.addMarker(ht.ARROW_DASH,t)}}const On=[_.LOOP,_.MULTI_INSTANCE_PARALLEL,_.MULTI_INSTANCE_SEQUENTIAL,_.COMPENSATION,_.EXPAND,_.ADHOC];function Ln(n){const t=On.filter(e=>n.includes(e));for(const e of n.filter(s=>!t.includes(s)))t.push(e);return t}function _n(n,t){return n===1?e=>e.setIconOriginForIconBottomCentered():e=>{e.setIconOriginForIconBottomCentered();const s=Math.pow(-1,t)*(p.SHAPE_ACTIVITY_MARKER_ICON_SIZE+p.SHAPE_ACTIVITY_MARKER_ICON_MARGIN)/2;e.translateIconOrigin(s,0)}}class Fe extends we{constructor(){super(void 0,void 0,void 0);g(this,"iconPainter");g(this,"markerPainterFunctions",new Map([[_.EXPAND,e=>this.iconPainter.paintExpandIcon(e)],[_.LOOP,e=>this.iconPainter.paintLoopIcon(e)],[_.MULTI_INSTANCE_PARALLEL,e=>this.iconPainter.paintParallelMultiInstanceIcon(e)],[_.MULTI_INSTANCE_SEQUENTIAL,e=>this.iconPainter.paintSequentialMultiInstanceIcon(e)]]))}paintForeground(e,s,o,i,r){super.paintForeground(e,s,o,i,r),this.paintMarkerIcons(Z({canvas:e,x:s,y:o,width:i,height:r,shape:this,ratioFromParent:0,iconStrokeWidth:1.5}))}paintMarkerIcons(e){var o;const s=N.getValue(this.style,m.MARKERS,void 0);if(s){const i=Ln(s.split(","));for(const[r,l]of i.entries())e={...e,setIconOriginFunct:_n(i.length,r+1)},e.canvas.save(),(o=this.markerPainterFunctions.get(l))==null||o(e),e.canvas.restore()}}paintEnvelopeIcon(e,s){this.iconPainter.paintEnvelopeIcon({...e,setIconOriginFunct:o=>o.setIconOriginToShapeTopLeft(),ratioFromParent:.2,iconStyleConfig:{...e.iconStyleConfig,isFilled:s}})}}class W extends Fe{paintForeground(t,e,s,o,i){super.paintForeground(t,e,s,o,i),this.paintTaskIcon(Z({canvas:t,x:e,y:s,width:o,height:i,shape:this}))}}class yn extends W{paintTaskIcon(t){}}class wn extends W{paintTaskIcon(t){this.iconPainter.paintGearIcon({...t,setIconOriginFunct:e=>e.setIconOriginToShapeTopLeftProportionally(20)})}}class Rn extends W{paintTaskIcon(t){this.iconPainter.paintPersonIcon({...t,setIconOriginFunct:e=>e.setIconOriginToShapeTopLeftProportionally(20)})}}class bn extends W{paintTaskIcon(t){if(!ft(this.style)){this.paintEnvelopeIcon(t,!1);return}const e=4,s=4,o={...t.shapeConfig,width:20,height:20};this.iconPainter.paintCircleIcon({canvas:t.canvas,shapeConfig:o,iconStyleConfig:{...t.iconStyleConfig,isFilled:!1},ratioFromParent:void 0,setIconOriginFunct:i=>i.setIconOriginToShapeTopLeft(s,e)}),o.x+=e,o.y+=s,this.iconPainter.paintEnvelopeIcon({...t,shapeConfig:o,ratioFromParent:.65,setIconOriginFunct:i=>i.setIconOriginForIconCentered()})}}class Fn extends W{paintTaskIcon(t){this.paintEnvelopeIcon(t,!0)}}class Pn extends W{paintTaskIcon(t){this.iconPainter.paintHandIcon({...t,ratioFromParent:.18,setIconOriginFunct:e=>e.setIconOriginToShapeTopLeftProportionally(20)})}}class kn extends W{paintTaskIcon(t){this.iconPainter.paintScriptIcon({...t,ratioFromParent:.22,setIconOriginFunct:e=>e.setIconOriginToShapeTopLeftProportionally(20)})}}class Bn extends Fe{paintForeground(t,e,s,o,i){super.paintForeground(t,e,s,o,i);const r=Z({canvas:t,x:e,y:s,width:o,height:i,shape:this});switch(N.getValue(this.style,m.GLOBAL_TASK_KIND,void 0)){case h.GLOBAL_TASK_MANUAL:{this.iconPainter.paintHandIcon({...r,ratioFromParent:.18,setIconOriginFunct:l=>l.setIconOriginToShapeTopLeftProportionally(20)});break}case h.GLOBAL_TASK_SCRIPT:{this.iconPainter.paintScriptIcon({...r,ratioFromParent:.22,setIconOriginFunct:l=>l.setIconOriginToShapeTopLeftProportionally(20)});break}case h.GLOBAL_TASK_USER:{this.iconPainter.paintPersonIcon({...r,setIconOriginFunct:l=>l.setIconOriginToShapeTopLeftProportionally(20)});break}case h.GLOBAL_TASK_BUSINESS_RULE:{this.iconPainter.paintTableIcon({...r,ratioFromParent:.6,setIconOriginFunct:l=>l.setIconOriginToShapeTopLeftProportionally(15)});break}}}}class xn extends Fe{paintBackground(t,e,s,o,i){const r=N.getValue(this.style,m.SUB_PROCESS_KIND,void 0);if(t.save(),r===Y.EVENT&&(t.setDashed(!0,!1),t.setDashPattern("1 2")),super.paintBackground(t,e,s,o,i),r===Y.TRANSACTION){const l=p.SUB_PROCESS_TRANSACTION_INNER_RECT_OFFSET,a=p.SUB_PROCESS_TRANSACTION_INNER_RECT_ARC_SIZE;t.roundrect(e+l,s+l,o-2*l,i-2*l,a,a),t.stroke()}t.restore()}}class Mn extends W{paintTaskIcon(t){this.iconPainter.paintTableIcon({...t,ratioFromParent:.6,setIconOriginFunct:e=>e.setIconOriginToShapeTopLeftProportionally(15)})}}class Vn extends O.mxConnector{paintEdgeShape(t,e){const s=this.createMarker(t,e,!0),o=this.createMarker(t,e,!1);this.paintEdgeLine(t,e),t.setShadow(!1),t.setDashed(!1,!1),s!=null&&(t.setFillColor(N.getValue(this.style,m.EDGE_START_FILL_COLOR,this.stroke)),s()),o!=null&&(t.setFillColor(N.getValue(this.style,m.EDGE_END_FILL_COLOR,this.stroke)),o())}paintEdgeLine(t,e){const s=Yn(t);Xe(t,"stroke"),this.paintLine(t,e,this.isRounded),Xe(t,s)}}function Yn(n){return n instanceof Re?n.pointerEventsValue:null}function Xe(n,t){n instanceof Re&&(n.pointerEventsValue=t)}class Pe extends O.mxEllipse{constructor(){super(void 0,void 0,void 0);g(this,"iconPainter");g(this,"iconPainters",new Map([[y.MESSAGE,e=>this.iconPainter.paintEnvelopeIcon({...e,ratioFromParent:.5})],[y.TERMINATE,e=>this.iconPainter.paintCircleIcon({...e,ratioFromParent:.6})],[y.TIMER,e=>this.iconPainter.paintClockIcon({...e,setIconOriginFunct:s=>s.setIconOriginToShapeTopLeftProportionally(5)})],[y.SIGNAL,e=>this.iconPainter.paintTriangleIcon({...e,ratioFromParent:.55,iconStyleConfig:{...e.iconStyleConfig,strokeWidth:p.STROKE_WIDTH_THIN.valueOf()},setIconOriginFunct:s=>s.setIconOriginToShapeTopLeftProportionally(4)})],[y.LINK,e=>this.iconPainter.paintRightArrowIcon({...e,ratioFromParent:.55,iconStyleConfig:{...e.iconStyleConfig,strokeWidth:1.5}})],[y.ERROR,e=>this.iconPainter.paintErrorIcon({...e,ratioFromParent:.55,iconStyleConfig:{...e.iconStyleConfig,strokeWidth:1.5}})],[y.COMPENSATION,e=>this.iconPainter.paintDoubleLeftArrowheadsIcon({...e,ratioFromParent:.7,iconStyleConfig:{...e.iconStyleConfig,strokeWidth:1.5}})],[y.CANCEL,e=>this.iconPainter.paintXCrossIcon({...e,ratioFromParent:.78})],[y.ESCALATION,e=>this.iconPainter.paintUpArrowheadIcon({...e,ratioFromParent:.55,iconStyleConfig:{...e.iconStyleConfig,strokeWidth:p.STROKE_WIDTH_THIN.valueOf()}})],[y.CONDITIONAL,e=>this.iconPainter.paintListIcon({...e,ratioFromParent:.6,iconStyleConfig:{...e.iconStyleConfig,strokeWidth:1.5}})]]));g(this,"withFilledIcon",!1)}paintVertexShape(e,s,o,i,r){const l=Z({canvas:e,x:s,y:o,width:i,height:r,shape:this,isFilled:this.withFilledIcon});Gn(l,N.getValue(this.style,m.IS_INTERRUPTING,void 0)),this.paintOuterShape(l),Dn(l),this.paintInnerShape(l)}paintOuterShape({canvas:e,shapeConfig:{x:s,y:o,width:i,height:r}}){super.paintVertexShape(e,s,o,i,r)}paintInnerShape(e){const s=this.iconPainters.get(N.getValue(this.style,m.EVENT_DEFINITION_KIND,y.NONE));s==null||s(e)}}function Gn(n,t){n.canvas.save(),t==="false"&&(n.canvas.setDashed(!0,!1),n.canvas.setDashPattern("3 2"))}function Dn(n){n.canvas.restore()}class Un extends Pe{constructor(){super(),this.withFilledIcon=!0}}class Oe extends Pe{paintOuterShape({canvas:t,shapeConfig:{x:e,y:s,width:o,height:i,strokeWidth:r}}){t.ellipse(e,s,o,i),t.fillAndStroke();const l=r*1.5;t.ellipse(o*.02+l+e,i*.02+l+s,o*.96-2*l,i*.96-2*l),t.stroke()}}class Wn extends Oe{constructor(){super(),this.withFilledIcon=!0}}class Hn extends we{constructor(){super(...arguments);g(this,"iconPainter")}paintVertexShape(e,s,o,i,r){const l=Z({canvas:e,x:s,y:o,width:i,height:r,shape:this,ratioFromParent:1,isFilled:N.getValue(this.style,m.IS_INITIATING,"true")=="false"});this.iconPainter.paintEnvelopeIcon(l)}}class oe extends O.mxRhombus{constructor(){super(...arguments);g(this,"iconPainter")}paintVertexShape(e,s,o,i,r){const l=Z({canvas:e,x:s,y:o,width:i,height:r,shape:this});this.paintOuterShape(l),this.paintInnerShape(l)}paintOuterShape({canvas:e,shapeConfig:{x:s,y:o,width:i,height:r}}){super.paintVertexShape(e,s,o,i,r)}}class Kn extends oe{paintInnerShape(t){this.iconPainter.paintXCrossIcon({...t,iconStyleConfig:{...t.iconStyleConfig,isFilled:!0},ratioFromParent:.5})}}class zn extends oe{paintInnerShape(t){this.iconPainter.paintPlusCrossIcon({...t,iconStyleConfig:{...t.iconStyleConfig,isFilled:!0},ratioFromParent:.5})}}class Xn extends oe{paintInnerShape(t){this.iconPainter.paintCircleIcon({...t,ratioFromParent:.62,iconStyleConfig:{...t.iconStyleConfig,isFilled:!1,strokeWidth:p.STROKE_WIDTH_THICK.valueOf()}})}}class $n extends oe{paintInnerShape(t){this.iconPainter.paintAsteriskIcon({...t,iconStyleConfig:{...t.iconStyleConfig,isFilled:!0},ratioFromParent:.5})}}class Zn extends oe{paintInnerShape(t){t={...t,iconStyleConfig:{...t.iconStyleConfig,strokeWidth:1}},this.iconPainter.paintCircleIcon({...t,ratioFromParent:.55}),ft(this.style)||this.iconPainter.paintCircleIcon({...t,ratioFromParent:.45});const e={...t,ratioFromParent:.3};N.getValue(this.style,m.EVENT_BASED_GATEWAY_KIND,te.Exclusive)==te.Parallel?this.iconPainter.paintPlusCrossIcon(e):this.iconPainter.paintPentagon(e)}}class qn extends we{paintForeground(t,e,s,o,i){t.begin(),t.moveTo(e+p.TEXT_ANNOTATION_BORDER_LENGTH,s),t.lineTo(e,s),t.lineTo(e,s+i),t.lineTo(e+p.TEXT_ANNOTATION_BORDER_LENGTH,s+i),t.stroke()}paintBackground(t,e,s,o,i){t.save(),t.setStrokeColor("none"),super.paintBackground(t,e,s,o,i),t.restore()}}const jn=()=>{const n=[[h.EVENT_END,Un],[h.EVENT_START,Pe],[h.EVENT_INTERMEDIATE_THROW,Wn],[h.EVENT_INTERMEDIATE_CATCH,Oe],[h.EVENT_BOUNDARY,Oe],[h.GATEWAY_COMPLEX,$n],[h.GATEWAY_EVENT_BASED,Zn],[h.GATEWAY_EXCLUSIVE,Kn],[h.GATEWAY_INCLUSIVE,Xn],[h.GATEWAY_PARALLEL,zn],[h.SUB_PROCESS,xn],[h.CALL_ACTIVITY,Bn],[h.TASK,yn],[h.TASK_SERVICE,wn],[h.TASK_USER,Rn],[h.TASK_RECEIVE,bn],[h.TASK_SEND,Fn],[h.TASK_MANUAL,Pn],[h.TASK_SCRIPT,kn],[h.TASK_BUSINESS_RULE,Mn],[h.TEXT_ANNOTATION,qn],[m.EDGE,Vn],[m.MESSAGE_FLOW_ICON,Hn]];for(const[t,e]of n)Ut.registerShape(t,e)};class Qn{configureShapes(){jn()}}const pt=12;class ke extends Map{get(t){return super.get(t)??(()=>{})}}const Jn=new ke([[P.SEQUENCE_FLOW,n=>{n[c.STYLE_ENDARROW]=c.ARROW_BLOCK_THIN}],[P.MESSAGE_FLOW,n=>{n[c.STYLE_DASHED]=!0,n[c.STYLE_DASH_PATTERN]="8 5",n[c.STYLE_STARTARROW]=c.ARROW_OVAL,n[c.STYLE_STARTSIZE]=8,n[c.STYLE_STARTFILL]=!0,n[m.EDGE_START_FILL_COLOR]=p.MESSAGE_FLOW_MARKER_START_FILL_COLOR,n[c.STYLE_ENDARROW]=c.ARROW_BLOCK_THIN,n[c.STYLE_ENDFILL]=!0,n[m.EDGE_END_FILL_COLOR]=p.MESSAGE_FLOW_MARKER_END_FILL_COLOR}],[P.ASSOCIATION_FLOW,n=>{n[c.STYLE_DASHED]=!0,n[c.STYLE_DASH_PATTERN]="1 2",n[c.STYLE_STARTSIZE]=pt}]]),es=new ke([[B.DEFAULT,n=>{n[c.STYLE_STARTARROW]=ht.ARROW_DASH}],[B.CONDITIONAL_FROM_ACTIVITY,n=>{n[c.STYLE_STARTARROW]=c.ARROW_DIAMOND_THIN,n[c.STYLE_STARTSIZE]=18,n[c.STYLE_STARTFILL]=!0,n[m.EDGE_START_FILL_COLOR]=p.SEQUENCE_FLOW_CONDITIONAL_FROM_ACTIVITY_MARKER_FILL_COLOR}]]),ts=new ke([[X.NONE,n=>{}],[X.ONE,n=>{n[c.STYLE_ENDARROW]=c.ARROW_OPEN_THIN}],[X.BOTH,n=>{n[c.STYLE_STARTARROW]=c.ARROW_OPEN_THIN,n[c.STYLE_ENDARROW]=c.ARROW_OPEN_THIN}]]);class Et{constructor(t){this.graph=t}configureStyles(){this.configureDefaultVertexStyle(),this.configurePoolStyle(),this.configureLaneStyle(),this.configureTextAnnotationStyle(),this.configureGroupStyle(),this.configureActivityStyles(),this.configureEventStyles(),this.configureGatewayStyles(),this.configureDefaultEdgeStyle(),this.configureFlowStyles()}getStylesheet(){return this.graph.getStylesheet()}putCellStyle(t,e){this.getStylesheet().putCellStyle(t,e)}configureDefaultVertexStyle(){const t=this.getStylesheet().getDefaultVertexStyle();$e(t),t[c.STYLE_ABSOLUTE_ARCSIZE]=!0,t[c.STYLE_ARCSIZE]=p.SHAPE_ARC_SIZE}configurePoolStyle(){const t={};t[c.STYLE_SHAPE]=c.SHAPE_SWIMLANE,t[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_MIDDLE,t[c.STYLE_ALIGN]=c.ALIGN_CENTER,t[c.STYLE_STARTSIZE]=p.POOL_LABEL_SIZE,t[c.STYLE_FILLCOLOR]=p.POOL_LABEL_FILL_COLOR,this.graph.getStylesheet().putCellStyle(h.POOL,t)}configureLaneStyle(){const t={};t[c.STYLE_SHAPE]=c.SHAPE_SWIMLANE,t[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_MIDDLE,t[c.STYLE_ALIGN]=c.ALIGN_CENTER,t[c.STYLE_SWIMLANE_LINE]=0,t[c.STYLE_STARTSIZE]=p.LANE_LABEL_SIZE,t[c.STYLE_FILLCOLOR]=p.LANE_LABEL_FILL_COLOR,this.graph.getStylesheet().putCellStyle(h.LANE,t)}configureEventStyles(){for(const t of C.eventKinds()){const e={};e[c.STYLE_SHAPE]=t,e[c.STYLE_PERIMETER]=We.EllipsePerimeter,e[c.STYLE_STROKEWIDTH]=t==h.EVENT_END?p.STROKE_WIDTH_THICK:p.STROKE_WIDTH_THIN,e[c.STYLE_VERTICAL_LABEL_POSITION]=c.ALIGN_BOTTOM,this.putCellStyle(t,e)}}configureTextAnnotationStyle(){const t={};t[c.STYLE_SHAPE]=h.TEXT_ANNOTATION,t[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_MIDDLE,t[c.STYLE_ALIGN]=c.ALIGN_LEFT,t[c.STYLE_SPACING_LEFT]=5,t[c.STYLE_FILLCOLOR]=p.TEXT_ANNOTATION_FILL_COLOR,t[c.STYLE_STROKEWIDTH]=p.STROKE_WIDTH_THIN,this.putCellStyle(h.TEXT_ANNOTATION,t)}configureGroupStyle(){const t={};t[c.STYLE_ROUNDED]=!0,t[c.STYLE_DASHED]=!0,t[c.STYLE_DASH_PATTERN]="7 4 1 4",t[c.STYLE_STROKEWIDTH]=p.STROKE_WIDTH_THIN,t[c.STYLE_FILLCOLOR]=p.GROUP_FILL_COLOR,t[c.STYLE_ALIGN]=c.ALIGN_CENTER,t[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_TOP,this.putCellStyle(h.GROUP,t)}configureActivityStyles(){for(const t of C.activityKinds()){const e={};e[c.STYLE_SHAPE]=t,e[c.STYLE_ROUNDED]=!0,e[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_MIDDLE,e[c.STYLE_STROKEWIDTH]=t==h.CALL_ACTIVITY?p.STROKE_WIDTH_THICK:p.STROKE_WIDTH_THIN,this.putCellStyle(t,e)}}configureGatewayStyles(){for(const t of C.gatewayKinds()){const e={};e[c.STYLE_SHAPE]=t,e[c.STYLE_PERIMETER]=We.RhombusPerimeter,e[c.STYLE_STROKEWIDTH]=p.STROKE_WIDTH_THIN,e[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_TOP,e[c.STYLE_LABEL_POSITION]=c.ALIGN_LEFT,e[c.STYLE_VERTICAL_LABEL_POSITION]=c.ALIGN_TOP,this.putCellStyle(t,e)}}configureDefaultEdgeStyle(){const t=this.getStylesheet().getDefaultEdgeStyle();$e(t),t[c.STYLE_SHAPE]=m.EDGE,t[c.STYLE_ENDSIZE]=pt,t[c.STYLE_STROKEWIDTH]=1.5,t[c.STYLE_ROUNDED]=!0,t[c.STYLE_ARCSIZE]=5,t[c.STYLE_VERTICAL_ALIGN]=c.ALIGN_BOTTOM,delete t[c.STYLE_ENDARROW]}configureEdgeStyles(t,e){for(const s of t){const o={};e.get(s)(o),this.graph.getStylesheet().putCellStyle(s.toString(),o)}}configureFlowStyles(){this.configureEdgeStyles(Object.values(P),Jn),this.configureEdgeStyles(Object.values(B),es),this.configureEdgeStyles(Object.values(X),ts)}}function $e(n){n[c.STYLE_FONTFAMILY]=p.DEFAULT_FONT_FAMILY,n[c.STYLE_FONTSIZE]=p.DEFAULT_FONT_SIZE,n[c.STYLE_FONTCOLOR]=p.DEFAULT_FONT_COLOR,n[c.STYLE_FILLCOLOR]=p.DEFAULT_FILL_COLOR,n[c.STYLE_STROKECOLOR]=p.DEFAULT_STROKE_COLOR,n[c.STYLE_LABEL_BACKGROUNDCOLOR]=c.NONE,n[c.STYLE_WHITE_SPACE]="wrap"}class ns{constructor(t){g(this,"graph");this.graph=new An(t)}configure(t){return this.configureGraph(),this.configureNavigationSupport(t),new Et(this.graph).configureStyles(),new Qn().configureShapes(),new vn().configureMarkers(),this.graph}configureGraph(){this.graph.setCellsLocked(!0),this.graph.setCellsSelectable(!1),this.graph.setEdgeLabelsMovable(!1),this.graph.setHtmlLabels(!0),this.graph.setConstrainChildren(!1),this.graph.setExtendParents(!1),this.graph.foldingEnabled=!1}configureNavigationSupport(t){var s;const e=this.graph.panningHandler;(s=t==null?void 0:t.navigation)!=null&&s.enabled?(e.addListener(G.PAN_START,Ze(this.graph,"grab")),e.addListener(G.PAN_END,Ze(this.graph,"default")),e.usePopupTrigger=!1,e.isForcePanningEvent=o=>G.isLeftMouseButton(o.getEvent())||G.isMultiTouchEvent(o.getEvent()),this.graph.setPanning(!0),this.graph.registerMouseWheelZoomListeners(t.navigation.zoom)):(this.graph.setPanning(!1),e.setPinchEnabled(!1),e.isForcePanningEvent=o=>!1)}}function Ze(n,t){return()=>{n.container.style.cursor=t}}class ss{constructor(t){this.graph=t}fit(t){this.graph.customFit(t)}zoom(t){t=="in"?this.graph.zoomIn():this.graph.zoomOut()}}class os{constructor(t){this.convertedElements=t}deserialize(t){const e=I(t.category).flatMap(s=>I(s.categoryValue));for(const s of e)this.convertedElements.registerCategoryValue(s.id,s.value)}}class q{}class is{constructor(t){this.options=t}warning(t){var s;if((s=this.options)!=null&&s.disableConsoleLog)return;const e=t.getMessage();console.warn(`[bv-parser] ${e.template}`,...e.arguments)}}class rs extends q{constructor(t,e){super(),this.groupBpmnElementId=t,this.categoryValueReference=e}getMessage(){return{arguments:[this.categoryValueReference,this.groupBpmnElementId],template:"Group json deserialization: unable to find category value ref %s for bpmn element %s"}}}class ls extends q{constructor(t){super(),this.bpmnElementId=t}getMessage(){return{arguments:[this.bpmnElementId],template:"Shape json deserialization: unable to find bpmn element with id %s"}}}class as extends q{constructor(t){super(),this.bpmnElementId=t}getMessage(){return{arguments:[this.bpmnElementId],template:"Edge json deserialization: unable to find bpmn element with id %s"}}}class cs extends q{constructor(t,e){super(),this.shapeOrEdgeId=t,this.labelStyleId=e}getMessage(){return{arguments:[this.labelStyleId,this.shapeOrEdgeId],template:"Unable to assign font from style %s to shape/edge %s"}}}class us extends q{constructor(t,e){super(),this.laneId=t,this.flowNodeReference=e}getMessage(){return{arguments:[this.flowNodeReference,this.laneId],template:"Unable to assign lane %s as parent: flow node %s is not found"}}}class ds extends q{constructor(t,e,s){super(),this.bpmnElementId=t,this.attachedToReference=e,this.attachedToKind=s}getMessage(){return{arguments:[this.bpmnElementId,this.attachedToReference,this.attachedToKind],template:"The boundary event %s must be attached to an activity, and not to %s of kind %s"}}}class hs{constructor(){g(this,"poolsById",new Map);g(this,"poolsByProcessRef",new Map);g(this,"messageFlows",new Map);g(this,"flowNodes",new Map);g(this,"lanes",new Map);g(this,"sequenceFlows",new Map);g(this,"associationFlows",new Map);g(this,"eventDefinitionsOfDefinitions",new Map);g(this,"globalTasks",new Map);g(this,"categoryValues",new Map)}getFlows(){return[...this.messageFlows.values(),...this.sequenceFlows.values(),...this.associationFlows.values()]}findPoolById(t){return this.poolsById.get(t)}findPoolByProcessRef(t){return this.poolsByProcessRef.get(t)}registerPool(t,e){this.poolsById.set(t.id,t),e&&this.poolsByProcessRef.set(e,t)}findMessageFlow(t){return this.messageFlows.get(t)}registerMessageFlow(t){this.messageFlows.set(t.id,t)}findFlowNode(t){return this.flowNodes.get(t)}registerFlowNode(t){this.flowNodes.set(t.id,t)}findLane(t){return this.lanes.get(t)}registerLane(t){this.lanes.set(t.id,t)}findSequenceFlow(t){return this.sequenceFlows.get(t)}registerSequenceFlow(t){this.sequenceFlows.set(t.id,t)}findAssociationFlow(t){return this.associationFlows.get(t)}registerAssociationFlow(t){this.associationFlows.set(t.id,t)}findEventDefinitionOfDefinition(t){return this.eventDefinitionsOfDefinitions.get(t)}registerEventDefinitionsOfDefinition(t,e){this.eventDefinitionsOfDefinitions.set(t,e)}findGlobalTask(t){return this.globalTasks.get(t)}registerGlobalTask(t,e){this.globalTasks.set(t,e)}findCategoryValue(t){return this.categoryValues.get(t)}registerCategoryValue(t,e){this.categoryValues.set(t,{value:e})}}const St=(n,t,e,s)=>{const o=n.findCategoryValue(e.categoryValueRef);if(o)return new x(e.id,o.value,h.GROUP,s);t.warning(new rs(e.id,e.categoryValueRef))};class fs{constructor(t,e){this.convertedElements=t,this.parsingMessageCollector=e}deserialize(t){for(const e of I(t))this.parseCollaboration(e)}parseCollaboration(t){this.buildParticipant(t.participant),this.buildMessageFlows(t.messageFlow),this.buildGroups(t.group)}buildParticipant(t){for(const e of I(t))this.convertedElements.registerPool(new x(e.id,e.name,h.POOL),e.processRef)}buildMessageFlows(t){for(const e of I(t))this.convertedElements.registerMessageFlow(new rt(e.id,e.name,e.sourceRef,e.targetRef))}buildGroups(t){for(const e of I(t)){const s=St(this.convertedElements,this.parsingMessageCollector,e);s&&this.convertedElements.registerFlowNode(s)}}}class gs{constructor(t,e,s,o){this.x=t,this.y=e,this.width=s,this.height=o}}class Ts{constructor(t,e,s,o,i=ne.NONE){g(this,"extensions",{});this.id=t,this.bpmnElement=e,this.waypoints=s,this.label=o,this.messageVisibleKind=i}}class ps{constructor(t,e){this.x=t,this.y=e}}class Es{constructor(t,e){g(this,"extensions",{});this.font=t,this.bounds=e}}class Ss{constructor(t,e,s,o,i,r){this.name=t,this.size=e,this.isBold=s,this.isItalic=o,this.isUnderline=i,this.isStrikeThrough=r}}class Cs{constructor(t,e){g(this,"convertedFonts",new Map);this.convertedElements=t,this.parsingMessageCollector=e}deserialize(t){const e=[],s=[],o=[],i=[],r=I(t)[0];if(r){this.deserializeFonts(r.BPMNLabelStyle);const l=r.BPMNPlane,a=this.deserializeEdges(l.BPMNEdge),u=this.deserializeShapes(l.BPMNShape);e.push(...u.flowNodes),s.push(...u.lanes),o.push(...u.pools),i.push(...a)}return{flowNodes:e,lanes:s,pools:o,edges:i}}deserializeFonts(t){this.convertedFonts=new Map;for(const e of I(t))for(const s of I(e.Font))this.convertedFonts.set(e.id,new Ss(s.name,s.size,s.isBold,s.isItalic,s.isUnderline,s.isStrikeThrough))}deserializeShapes(t){const e={flowNodes:[],lanes:[],pools:[]};for(const s of I(t))this.deserializeShapeAndStoreIfFound(s,e.flowNodes,o=>this.convertedElements.findFlowNode(o))||this.deserializeShapeAndStoreIfFound(s,e.lanes,o=>this.convertedElements.findLane(o))||this.deserializeShapeAndStoreIfFound(s,e.pools,o=>this.convertedElements.findPoolById(o))||this.parsingMessageCollector.warning(new ls(s.bpmnElement));return e}deserializeShapeAndStoreIfFound(t,e,s){const o=this.deserializeShape(t,s);return o?(e.push(o),!0):!1}deserializeShape(t,e){const s=e(t.bpmnElement);if(s){const o=qe(t);(s instanceof se||s instanceof z&&s.callActivityKind===ee.CALLING_PROCESS)&&!t.isExpanded&&s.markers.push(_.EXPAND);let i;C.isPoolOrLane(s.kind)&&(i=t.isHorizontal??!0);const r=t.BPMNLabel,l=this.deserializeLabel(r,t.id),a=new le(t.id,s,o,l,i);return ms(a,t),a}}deserializeEdges(t){return I(t).map(e=>{const s=this.convertedElements.findSequenceFlow(e.bpmnElement)||this.convertedElements.findMessageFlow(e.bpmnElement)||this.convertedElements.findAssociationFlow(e.bpmnElement);if(!s){this.parsingMessageCollector.warning(new as(e.bpmnElement));return}const o=this.deserializeWaypoints(e.waypoint),i=this.deserializeLabel(e.BPMNLabel,e.id),r=e.messageVisibleKind?e.messageVisibleKind:ne.NONE,l=new Ts(e.id,s,o,i,r);return Is(l,e),l}).filter(Boolean)}deserializeWaypoints(t){return I(t).map(e=>new ps(e.x,e.y))}deserializeLabel(t,e){if(t&&typeof t=="object"){const s=this.findFont(t.labelStyle,e),o=qe(t),i=new Es(s,o);if("color"in t)return i.extensions.color=t.color,i;if(s||o)return i}}findFont(t,e){let s;return t&&(s=this.convertedFonts.get(t),s||this.parsingMessageCollector.warning(new cs(e,t))),s}}function ms(n,t){"background-color"in t?n.extensions.fillColor=t["background-color"]:"fill"in t&&(n.extensions.fillColor=t.fill),"border-color"in t?n.extensions.strokeColor=t["border-color"]:"stroke"in t&&(n.extensions.strokeColor=t.stroke)}function qe(n){const t=n.Bounds;if(t)return new gs(t.x,t.y,t.width,t.height)}function Is(n,t){"border-color"in t?n.extensions.strokeColor=t["border-color"]:"stroke"in t&&(n.extensions.strokeColor=t.stroke)}const As=n=>"source"in n||"target"in n;class Ns{constructor(t){this.convertedElements=t}deserialize(t){for(const e of ot){const s=t[e+"EventDefinition"];for(const o of I(s,!0))this.convertedElements.registerEventDefinitionsOfDefinition(o.id,{id:o.id,kind:e,...As(o)?{source:o.source,target:o.target}:{}})}}}class vs{constructor(t){this.convertedElements=t}deserialize(t){this.parseGlobalTasks(t.globalTask,h.GLOBAL_TASK),this.parseGlobalTasks(t.globalBusinessRuleTask,h.GLOBAL_TASK_BUSINESS_RULE),this.parseGlobalTasks(t.globalManualTask,h.GLOBAL_TASK_MANUAL),this.parseGlobalTasks(t.globalScriptTask,h.GLOBAL_TASK_SCRIPT),this.parseGlobalTasks(t.globalUserTask,h.GLOBAL_TASK_USER)}parseGlobalTasks(t,e){for(const s of I(t))this.convertedElements.registerGlobalTask(s.id,e)}}const Os=(n,t)=>{switch(n){case"adHocSubProcess":return Y.AD_HOC;case"transaction":return Y.TRANSACTION;default:return t.triggeredByEvent?Y.EVENT:Y.EMBEDDED}},Ls=["adHocSubProcess","transaction",...C.flowNodeKinds().filter(n=>n!==h.EVENT_BOUNDARY),h.EVENT_BOUNDARY];function _s(n){return["adHocSubProcess","transaction"].includes(n)?h.SUB_PROCESS:n}class ys{constructor(t,e){g(this,"defaultSequenceFlowIds",[]);g(this,"elementsWithoutParentByProcessId",new Map);g(this,"callActivitiesCallingProcess",new Map);g(this,"eventsByLinkEventDefinition",new Map);this.convertedElements=t,this.parsingMessageCollector=e}deserialize(t){for(const e of I(t))this.parseProcess(e);for(const e of I(t))this.assignParentOfProcessElementsCalledByCallActivity(e.id);this.assignIncomingAndOutgoingIdsFromFlows(),this.assignSourceAndTargetIdsToLinkEvents()}assignParentOfProcessElementsCalledByCallActivity(t){const e=this.callActivitiesCallingProcess.get(t);if(e){const s=this.convertedElements.findPoolByProcessRef(t);s&&(s.parentId=e.id);for(const o of this.elementsWithoutParentByProcessId.get(t))o.parentId=e.id}}assignIncomingAndOutgoingIdsFromFlows(){const t=(e,s,o)=>{const i=this.convertedElements.findFlowNode(e)??this.convertedElements.findLane(e)??this.convertedElements.findPoolById(e);i&&!i[s].includes(o)&&i[s].push(o)};for(const e of this.convertedElements.getFlows())t(e.sourceReferenceId,"outgoingIds",e.id),t(e.targetReferenceId,"incomingIds",e.id)}assignSourceAndTargetIdsToLinkEvents(){var e;const t=[...this.eventsByLinkEventDefinition.entries()].filter(([s])=>s.id);for(const[s,o]of this.eventsByLinkEventDefinition)if(o instanceof Ie){const i=t.find(([r])=>s.target===r.id);o.targetId=(e=i==null?void 0:i[1])==null?void 0:e.id}else o instanceof me&&(o.sourceIds=t.filter(([i])=>Array.isArray(s.source)?s.source.includes(i.id):s.source===i.id).map(([,i])=>i.id))}parseProcess(t){const e=t.id,s=this.convertedElements.findPoolByProcessRef(e);s&&!s.name&&this.convertedElements.registerPool(new x(s.id,t.name,h.POOL),e),this.buildProcessInnerElements(t,s==null?void 0:s.id)}buildProcessInnerElements(t,e){this.elementsWithoutParentByProcessId.set(t.id,[]);for(const s of Ls)this.buildFlowNodeBpmnElements(t[s],_s(s),e,t.id,s);this.buildLaneSetBpmnElements(t.laneSet,e,t.id),this.buildSequenceFlows(t.sequenceFlow),this.buildAssociationFlows(t.association)}buildFlowNodeBpmnElements(t,e,s,o,i){for(const r of I(t)){const l=this.buildFlowNodeBpmnElement(e,r,s,i);"default"in r&&C.isWithDefaultSequenceFlow(e)&&this.defaultSequenceFlowIds.push(r.default),l&&(this.convertedElements.registerFlowNode(l),s||this.elementsWithoutParentByProcessId.get(o).push(l))}}buildFlowNodeBpmnElement(t,e,s,o){if(C.isEvent(t))return this.buildShapeBpmnEvent(e,t,s);if(C.isActivity(t))return this.buildShapeBpmnActivity(e,t,s,o);if(t==h.GATEWAY_EVENT_BASED){const i=e;return new dt(i.id,i.name,s,i.instantiate,te[i.eventGatewayType])}else{if(t==h.GROUP)return St(this.convertedElements,this.parsingMessageCollector,e,s);{const i=t===h.TEXT_ANNOTATION?e.text:e.name;return new x(e.id,i,t,s,e.instantiate)}}}buildShapeBpmnActivity(t,e,s,o){const i=ws(t);return C.isSubProcess(e)?this.buildShapeBpmnSubProcess(t,s,Os(o,t),i):C.isCallActivity(e)?this.buildShapeBpmnCallActivity(t,s,i):new he(t.id,t.name,e,s,t.instantiate,i)}buildShapeBpmnCallActivity(t,e,s){const o=this.convertedElements.findGlobalTask(t.calledElement);if(!o){const i=new z(t.id,t.name,ee.CALLING_PROCESS,e,s);return this.callActivitiesCallingProcess.set(t.calledElement,i),i}return new z(t.id,t.name,ee.CALLING_GLOBAL_TASK,e,s,o)}buildShapeBpmnEvent(t,e,s){const o=this.getEventDefinitions(t),i=[...o.entries()].map(([,r])=>r.length).reduce((r,l)=>r+l,0);if(i==0&&C.canHaveNoneEvent(e))return new U(t.id,t.name,e,y.NONE,s);if(i==1){const[r,l]=[...o.entries()][0],a=C.isCatchEvent(e)?this.buildShapeBpmnCatchEvent(t,e,r,s):this.buildShapeBpmnThrowEvent(t,e,r,s);return r===y.LINK&&(l[0].id||l[0].target||l[0].source)&&this.eventsByLinkEventDefinition.set(l[0],a),a}}buildShapeBpmnCatchEvent(t,e,s,o){return C.isBoundaryEvent(e)?this.buildShapeBpmnBoundaryEvent(t,s):C.isStartEvent(e)?new ct(t.id,t.name,s,o,t.isInterrupting):new me(t.id,t.name,s,o)}buildShapeBpmnThrowEvent(t,e,s,o){return C.isIntermediateThrowEvent(e)?new Ie(t.id,t.name,s,o):new U(t.id,t.name,e,s,o)}buildShapeBpmnBoundaryEvent(t,e){const s=this.convertedElements.findFlowNode(t.attachedToRef);if(C.isActivity(s==null?void 0:s.kind))return new ut(t.id,t.name,e,t.attachedToRef,t.cancelActivity);this.parsingMessageCollector.warning(new ds(t.id,t.attachedToRef,s==null?void 0:s.kind))}getEventDefinitions(t){const e=new Map;for(const s of ot){const o=t[`${s}EventDefinition`];e.set(s,I(o,!0))}for(const s of I(t.eventDefinitionRef)){const o=this.convertedElements.findEventDefinitionOfDefinition(s);o&&e.get(o.kind).push(o)}for(const[s]of[...e.entries()].filter(([,o])=>o.length===0))e.delete(s);return e}buildShapeBpmnSubProcess(t,e,s,o){const i=new se(t.id,t.name,s,e,o);return this.buildProcessInnerElements(t,t.id),i}buildLaneSetBpmnElements(t,e,s){for(const o of I(t))this.buildLaneBpmnElements(o.lane,e,s)}buildLaneBpmnElements(t,e,s){var o;for(const i of I(t)){const r=new x(i.id,i.name,h.LANE,e);this.convertedElements.registerLane(r),e||this.elementsWithoutParentByProcessId.get(s).push(r),this.assignParentOfLaneFlowNodes(i),(o=i.childLaneSet)!=null&&o.lane&&this.buildLaneBpmnElements(i.childLaneSet.lane,i.id,s)}}assignParentOfLaneFlowNodes(t){for(const e of I(t.flowNodeRef)){const s=this.convertedElements.findFlowNode(e),o=t.id;s?C.isBoundaryEvent(s.kind)||(s.parentId=o):this.parsingMessageCollector.warning(new us(o,e))}}buildSequenceFlows(t){for(const e of I(t)){const s=this.getSequenceFlowKind(e);this.convertedElements.registerSequenceFlow(new it(e.id,e.name,e.sourceRef,e.targetRef,s))}}buildAssociationFlows(t){for(const e of I(t)){const s=e.associationDirection;this.convertedElements.registerAssociationFlow(new lt(e.id,void 0,e.sourceRef,e.targetRef,s))}}getSequenceFlowKind(t){if(this.defaultSequenceFlowIds.includes(t.id))return B.DEFAULT;{const e=this.convertedElements.findFlowNode(t.sourceRef);if(e&&C.isWithDefaultSequenceFlow(e.kind)&&t.conditionExpression)return C.isActivity(e.kind)?B.CONDITIONAL_FROM_ACTIVITY:B.CONDITIONAL_FROM_GATEWAY}return B.NORMAL}}const ws=n=>{const t=[],e=n.standardLoopCharacteristics,s=I(n.multiInstanceLoopCharacteristics,!0)[0];return e!==void 0?t.push(_.LOOP):s&&t.push(s.isSequential?_.MULTI_INSTANCE_SEQUENTIAL:_.MULTI_INSTANCE_PARALLEL),t};class Rs{constructor(t,e,s,o,i,r){this.categoryConverter=t,this.collaborationConverter=e,this.eventDefinitionConverter=s,this.globalTaskConverter=o,this.processConverter=i,this.diagramConverter=r}parse(t){const e=t.definitions;return this.categoryConverter.deserialize(e),this.collaborationConverter.deserialize(e.collaboration),this.eventDefinitionConverter.deserialize(e),this.globalTaskConverter.deserialize(e),this.processConverter.deserialize(e.process),this.diagramConverter.deserialize(e.BPMNDiagram)}}function bs(n){const t=new hs;return new Rs(new os(t),new fs(t,n),new Ns(t),new vs(t),new ys(t,n),new Cs(t,n))}var Be={},ge={};(function(n){const t=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",e=t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",s="["+t+"]["+e+"]*",o=new RegExp("^"+s+"$"),i=function(l,a){const u=[];let d=a.exec(l);for(;d;){const f=[];f.startIndex=a.lastIndex-d[0].length;const T=d.length;for(let E=0;E"u")};n.isExist=function(l){return typeof l<"u"},n.isEmptyObject=function(l){return Object.keys(l).length===0},n.merge=function(l,a,u){if(a){const d=Object.keys(a),f=d.length;for(let T=0;T"&&n[i]!==" "&&n[i]!==" "&&n[i]!==` `&&n[i]!=="\r";i++)a+=n[i];if(a=a.trim(),a[a.length-1]==="/"&&(a=a.substring(0,a.length-1),i--),!Gs(a)){let f;return a.trim().length===0?f="Invalid space after '<'.":f="Tag '"+a+"' is an invalid name.",L("InvalidTag",f,w(n,i))}const u=Bs(n,i);if(u===!1)return L("InvalidAttr","Attributes for '"+a+"' have open quote.",w(n,i));let d=u.value;if(i=u.index,d[d.length-1]==="/"){const f=i-d.length;d=d.substring(0,d.length-1);const T=et(d,t);if(T===!0)s=!0;else return L(T.err.code,T.err.msg,w(n,f+T.err.line))}else if(l)if(u.tagClosed){if(d.trim().length>0)return L("InvalidTag","Closing tag '"+a+"' can't have attributes or invalid starting.",w(n,r));if(e.length===0)return L("InvalidTag","Closing tag '"+a+"' has not been opened.",w(n,r));{const f=e.pop();if(a!==f.tagName){let T=w(n,f.tagStartPos);return L("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+T.line+", col "+T.col+") instead of closing tag '"+a+"'.",w(n,r))}e.length==0&&(o=!0)}}else return L("InvalidTag","Closing tag '"+a+"' doesn't have proper closing.",w(n,i));else{const f=et(d,t);if(f!==!0)return L(f.err.code,f.err.msg,w(n,i-d.length+f.err.line));if(o===!0)return L("InvalidXml","Multiple possible root nodes found.",w(n,i));t.unpairedTags.indexOf(a)!==-1||e.push({tagName:a,tagStartPos:r}),s=!0}for(i++;i0)return L("InvalidXml","Invalid '"+JSON.stringify(e.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return L("InvalidXml","Start tag expected.",1);return!0};function je(n){return n===" "||n===" "||n===` `||n==="\r"}function Qe(n,t){const e=t;for(;t5&&s==="xml")return L("InvalidXml","XML declaration allowed only at the start of the document.",w(n,t));if(n[t]=="?"&&n[t+1]==">"){t++;break}else continue}return t}function Je(n,t){if(n.length>t+5&&n[t+1]==="-"&&n[t+2]==="-"){for(t+=3;t"){t+=2;break}}else if(n.length>t+8&&n[t+1]==="D"&&n[t+2]==="O"&&n[t+3]==="C"&&n[t+4]==="T"&&n[t+5]==="Y"&&n[t+6]==="P"&&n[t+7]==="E"){let e=1;for(t+=8;t"&&(e--,e===0))break}else if(n.length>t+9&&n[t+1]==="["&&n[t+2]==="C"&&n[t+3]==="D"&&n[t+4]==="A"&&n[t+5]==="T"&&n[t+6]==="A"&&n[t+7]==="["){for(t+=8;t"){t+=2;break}}return t}const Ps='"',ks="'";function Bs(n,t){let e="",s="",o=!1;for(;t"&&s===""){o=!0;break}e+=n[t]}return s!==""?!1:{value:e,index:t,tagClosed:o}}const xs=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function et(n,t){const e=xe.getAllMatches(n,xs),s={};for(let o=0;o!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(n,t,e){return n}},Ds=function(n){return Object.assign({},Ct,n)};Me.buildOptions=Ds;Me.defaultOptions=Ct;class Us{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}var Ws=Us;const Hs=ge;function Ks(n,t){const e={};if(n[t+3]==="O"&&n[t+4]==="C"&&n[t+5]==="T"&&n[t+6]==="Y"&&n[t+7]==="P"&&n[t+8]==="E"){t=t+9;let s=1,o=!1,i=!1,r="";for(;t"){if(i?n[t-1]==="-"&&n[t-2]==="-"&&(i=!1,s--):s--,s===0)break}else n[t]==="["?o=!0:r+=n[t];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:e,i:t}}function zs(n,t){let e="";for(;t0&&o&&e[2]!==".")return n;if(!t.leadingZeros&&i.length>0&&!o&&e[1]!==".")return n;{const a=Number(e),u=""+a;return u.search(/[eE]/)!==-1||l?t.eNotation?a:n:e.indexOf(".")!==-1?u==="0"&&r===""||u===r||o&&u==="-"+r?a:n:i?r===u||o+r===u?a:n:e===u||e===o+u?a:n}}else return n}}function oo(n){return n&&n.indexOf(".")!==-1&&(n=n.replace(/0+$/,""),n==="."?n="0":n[0]==="."?n="0"+n:n[n.length-1]==="."&&(n=n.substr(0,n.length-1))),n}var io=so;const mt=ge,Q=Ws,ro=Js,lo=io;let ao=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,s)=>String.fromCharCode(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,s)=>String.fromCharCode(Number.parseInt(s,16))}},this.addExternalEntities=co,this.parseXml=To,this.parseTextData=uo,this.resolveNameSpace=ho,this.buildAttributesMap=go,this.isItStopNode=Co,this.replaceEntitiesValue=Eo,this.readStopNodeData=Io,this.saveTextToParentTag=So,this.addChild=po}};function co(n){const t=Object.keys(n);for(let e=0;e0)){r||(n=this.replaceEntitiesValue(n));const l=this.options.tagValueProcessor(t,n,e,o,i);return l==null?n:typeof l!=typeof n||l!==n?l:this.options.trimValues?_e(n,this.options.parseTagValue,this.options.numberParseOptions):n.trim()===n?_e(n,this.options.parseTagValue,this.options.numberParseOptions):n}}function ho(n){if(this.options.removeNSPrefix){const t=n.split(":"),e=n.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(n=e+t[1])}return n}const fo=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function go(n,t,e){if(!this.options.ignoreAttributes&&typeof n=="string"){const s=mt.getAllMatches(n,fo),o=s.length,i={};for(let r=0;r",i,"Closing Tag is not closed.");let a=n.substring(i+2,l).trim();if(this.options.removeNSPrefix){const f=a.indexOf(":");f!==-1&&(a=a.substr(f+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),e&&(s=this.saveTextToParentTag(s,e,o));const u=o.substring(o.lastIndexOf(".")+1);if(a&&this.options.unpairedTags.indexOf(a)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let d=0;u&&this.options.unpairedTags.indexOf(u)!==-1?(d=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=o.lastIndexOf("."),o=o.substring(0,d),e=this.tagsNodeStack.pop(),s="",i=l}else if(n[i+1]==="?"){let l=Le(n,i,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,e,o),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const a=new Q(l.tagName);a.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(a[":@"]=this.buildAttributesMap(l.tagExp,o,l.tagName)),this.addChild(e,a,o)}i=l.closeIndex+1}else if(n.substr(i+1,3)==="!--"){const l=K(n,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const a=n.substring(i+4,l-2);s=this.saveTextToParentTag(s,e,o),e.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}i=l}else if(n.substr(i+1,2)==="!D"){const l=ro(n,i);this.docTypeEntities=l.entities,i=l.i}else if(n.substr(i+1,2)==="!["){const l=K(n,"]]>",i,"CDATA is not closed.")-2,a=n.substring(i+9,l);s=this.saveTextToParentTag(s,e,o);let u=this.parseTextData(a,e.tagname,o,!0,!1,!0,!0);u==null&&(u=""),this.options.cdataPropName?e.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):e.add(this.options.textNodeName,u),i=l+2}else{let l=Le(n,i,this.options.removeNSPrefix),a=l.tagName;const u=l.rawTagName;let d=l.tagExp,f=l.attrExpPresent,T=l.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),e&&s&&e.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,e,o,!1));const E=e;if(E&&this.options.unpairedTags.indexOf(E.tagname)!==-1&&(e=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),a!==t.tagname&&(o+=o?"."+a:a),this.isItStopNode(this.options.stopNodes,o,a)){let S="";if(d.length>0&&d.lastIndexOf("/")===d.length-1)a[a.length-1]==="/"?(a=a.substr(0,a.length-1),o=o.substr(0,o.length-1),d=a):d=d.substr(0,d.length-1),i=l.closeIndex;else if(this.options.unpairedTags.indexOf(a)!==-1)i=l.closeIndex;else{const V=this.readStopNodeData(n,u,T+1);if(!V)throw new Error(`Unexpected end of ${u}`);i=V.i,S=V.tagContent}const M=new Q(a);a!==d&&f&&(M[":@"]=this.buildAttributesMap(d,o,a)),S&&(S=this.parseTextData(S,a,o,!0,f,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),M.add(this.options.textNodeName,S),this.addChild(e,M,o)}else{if(d.length>0&&d.lastIndexOf("/")===d.length-1){a[a.length-1]==="/"?(a=a.substr(0,a.length-1),o=o.substr(0,o.length-1),d=a):d=d.substr(0,d.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const S=new Q(a);a!==d&&f&&(S[":@"]=this.buildAttributesMap(d,o,a)),this.addChild(e,S,o),o=o.substr(0,o.lastIndexOf("."))}else{const S=new Q(a);this.tagsNodeStack.push(e),a!==d&&f&&(S[":@"]=this.buildAttributesMap(d,o,a)),this.addChild(e,S,o),e=S}s="",i=T}}else s+=n[i];return t.child};function po(n,t,e){const s=this.options.updateTag(t.tagname,e,t[":@"]);s===!1||(typeof s=="string"&&(t.tagname=s),n.addChild(t))}const Eo=function(n){if(this.options.processEntities){for(let t in this.docTypeEntities){const e=this.docTypeEntities[t];n=n.replace(e.regx,e.val)}for(let t in this.lastEntities){const e=this.lastEntities[t];n=n.replace(e.regex,e.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const e=this.htmlEntities[t];n=n.replace(e.regex,e.val)}n=n.replace(this.ampEntity.regex,this.ampEntity.val)}return n};function So(n,t,e,s){return n&&(s===void 0&&(s=Object.keys(t.child).length===0),n=this.parseTextData(n,t.tagname,e,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,s),n!==void 0&&n!==""&&t.add(this.options.textNodeName,n),n=""),n}function Co(n,t,e){const s="*."+e;for(const o in n){const i=n[o];if(s===i||t===i)return!0}return!1}function mo(n,t,e=">"){let s,o="";for(let i=t;i",e,`${t} is not closed`);if(n.substring(e+2,i).trim()===t&&(o--,o===0))return{tagContent:n.substring(s,e),i};e=i}else if(n[e+1]==="?")e=K(n,"?>",e+1,"StopNode is not closed.");else if(n.substr(e+1,3)==="!--")e=K(n,"-->",e+3,"StopNode is not closed.");else if(n.substr(e+1,2)==="![")e=K(n,"]]>",e,"StopNode is not closed.")-2;else{const i=Le(n,e,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,e=i.closeIndex)}}function _e(n,t,e){if(t&&typeof n=="string"){const s=n.trim();return s==="true"?!0:s==="false"?!1:lo(n,e)}else return mt.isExist(n)?n:""}var Ao=ao,It={};function No(n,t){return At(n,t)}function At(n,t,e){let s;const o={};for(let i=0;i0&&(o[t.textNodeName]=s):s!==void 0&&(o[t.textNodeName]=s),o}function vo(n){const t=Object.keys(n);for(let e=0;e0&&(e=Po),Nt(n,t,"",e)}function Nt(n,t,e,s){let o="",i=!1;for(let r=0;r`,i=!1;continue}else if(a===t.commentPropName){o+=s+``,i=!0;continue}else if(a[0]==="?"){const S=tt(l[":@"],t),M=a==="?xml"?"":s;let V=l[a][0][t.textNodeName];V=V.length!==0?" "+V:"",o+=M+`<${a}${V}${S}?>`,i=!0;continue}let d=s;d!==""&&(d+=t.indentBy);const f=tt(l[":@"],t),T=s+`<${a}${f}`,E=Nt(l[a],t,u,d);t.unpairedTags.indexOf(a)!==-1?t.suppressUnpairedNode?o+=T+">":o+=T+"/>":(!E||E.length===0)&&t.suppressEmptyNode?o+=T+"/>":E&&E.endsWith(">")?o+=T+`>${E}${s}`:(o+=T+">",E&&s!==""&&(E.includes("/>")||E.includes("`),i=!0}return o}function Bo(n){const t=Object.keys(n);for(let e=0;e0&&t.processEntities)for(let e=0;e","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function H(n){this.options=Object.assign({},Yo,n),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Uo),this.processTextOrObjNode=Go,this.options.format?(this.indentate=Do,this.tagEndChar=`> `,this.newLine=` `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}H.prototype.build=function(n){return this.options.preserveOrder?Vo(n,this.options):(Array.isArray(n)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(n={[this.options.arrayNodeName]:n}),this.j2x(n,0).val)};H.prototype.j2x=function(n,t){let e="",s="";for(let o in n)if(Object.prototype.hasOwnProperty.call(n,o))if(typeof n[o]>"u")this.isAttribute(o)&&(s+="");else if(n[o]===null)this.isAttribute(o)?s+="":o[0]==="?"?s+=this.indentate(t)+"<"+o+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+o+"/"+this.tagEndChar;else if(n[o]instanceof Date)s+=this.buildTextValNode(n[o],o,"",t);else if(typeof n[o]!="object"){const i=this.isAttribute(o);if(i)e+=this.buildAttrPairStr(i,""+n[o]);else if(o===this.options.textNodeName){let r=this.options.tagValueProcessor(o,""+n[o]);s+=this.replaceEntitiesValue(r)}else s+=this.buildTextValNode(n[o],o,"",t)}else if(Array.isArray(n[o])){const i=n[o].length;let r="",l="";for(let a=0;a"u"))if(u===null)o[0]==="?"?s+=this.indentate(t)+"<"+o+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+o+"/"+this.tagEndChar;else if(typeof u=="object")if(this.options.oneListGroup){const d=this.j2x(u,t+1);r+=d.val,this.options.attributesGroupName&&u.hasOwnProperty(this.options.attributesGroupName)&&(l+=d.attrStr)}else r+=this.processTextOrObjNode(u,o,t);else if(this.options.oneListGroup){let d=this.options.tagValueProcessor(o,u);d=this.replaceEntitiesValue(d),r+=d}else r+=this.buildTextValNode(u,o,"",t)}this.options.oneListGroup&&(r=this.buildObjectNode(r,o,l,t)),s+=r}else if(this.options.attributesGroupName&&o===this.options.attributesGroupName){const i=Object.keys(n[o]),r=i.length;for(let l=0;l"+n+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(s)+``+this.newLine:this.indentate(s)+"<"+t+e+i+this.tagEndChar+n+this.indentate(s)+o}};H.prototype.closeTag=function(n){let t="";return this.options.unpairedTags.indexOf(n)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(s)+``+this.newLine;if(t[0]==="?")return this.indentate(s)+"<"+t+e+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,n);return o=this.replaceEntitiesValue(o),o===""?this.indentate(s)+"<"+t+e+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+e+">"+o+"0&&this.options.processEntities)for(let t=0;t"},{regex:/&(lt|#60|#x3c|#x3C);/g,val:"<"},{regex:/&(quot|#34|#x22);/g,val:'"'}],Zo=new Set(["BPMNShape.Bounds","BPMNShape.BPMNLabel.Bounds","BPMNEdge.BPMNLabel.Bounds","BPMNEdge.waypoint"].map(n=>`definitions.BPMNDiagram.BPMNPlane.${n}`)),qo=new Set(["x","y","width","height"]),jo=(n,t)=>Zo.has(t)&&qo.has(n);class Qo{constructor(t){g(this,"x2jOptions",{attributeNamePrefix:"",removeNSPrefix:!0,ignoreAttributes:!1,parseAttributeValue:!0,processEntities:!1,attributeValueProcessor:(t,e,s)=>jo(t,s)?Number(e):this.processAttribute(e)});g(this,"xmlParser",new Xo.XMLParser(this.x2jOptions));this.options=t}parse(t){let e;try{e=this.xmlParser.parse(t)}catch{throw new Error("XML parsing failed. Invalid BPMN source.")}if(!e.definitions)throw new Error("XML parsing failed. Unable to retrieve 'definitions' from the BPMN source.");return e}processAttribute(t){var e;for(const s of $o)t=t.replace(s.regex,s.val);return(e=this.options)!=null&&e.additionalXmlAttributeProcessor&&(t=this.options.additionalXmlAttributeProcessor(t)),t}}class Jo{constructor(t,e){this.jsonParser=t,this.xmlParser=e}parse(t){const e=this.xmlParser.parse(t);return this.jsonParser.parse(e)}}function ei(n){return new Jo(bs(new is(n)),new Qo(n))}function ti(n){return new ni(n)}class ni{constructor(t){this.graph=t}updateAndRefreshCssClassesOfCell(t,e){this.updateAndRefreshCssClassesOfElement(t,e),this.updateAndRefreshCssClassesOfElement(be(t),e)}updateAndRefreshCssClassesOfElement(t,e){const s=this.graph.getModel(),o=s.getCell(t);if(!o)return;let i=o.getStyle();i=R(i,m.EXTRA_CSS_CLASSES,e.join(",")),s.setStyle(o,i)}}function si(n){return new oi(ti(n),new ii)}class oi{constructor(t,e){this.cssClassesUpdater=t,this.cssClassesCache=e}clearCache(){this.cssClassesCache.clear()}addCssClasses(t,e){this.updateCssClasses(t,e,this.cssClassesCache.addClassNames)}removeCssClasses(t,e){this.updateCssClasses(t,e,this.cssClassesCache.removeClassNames)}removeAllCssClasses(t){if(t||t=="")for(const e of I(t)){const s=this.cssClassesCache.removeAllClassNames(e);this.updateCellIfChanged(s,e)}else{const e=this.cssClassesCache.getBpmnIds();this.cssClassesCache.clear();for(const s of e)this.updateCellIfChanged(!0,s)}}toggleCssClasses(t,e){this.updateCssClasses(t,e,this.cssClassesCache.toggleClassNames)}updateCssClasses(t,e,s){const o=I(e);for(const i of I(t))this.updateCellIfChanged(s(i,o),i)}updateCellIfChanged(t,e){if(t){const s=this.cssClassesCache.getClassNames(e);this.cssClassesUpdater.updateAndRefreshCssClassesOfCell(e,s)}}}class ii{constructor(){g(this,"classNamesByBpmnId",new Map);g(this,"clear",()=>{this.classNamesByBpmnId.clear()});g(this,"addClassNames",(t,e)=>this.updateClassNames(t,e,(s,o)=>s.add(o)));g(this,"removeClassNames",(t,e)=>this.updateClassNames(t,e,(s,o)=>s.delete(o)));g(this,"toggleClassNames",(t,e)=>(this.updateClassNames(t,e,(s,o)=>s.has(o)?s.delete(o):s.add(o)),e&&e.length>0))}getClassNames(t){return this.classNamesByBpmnId.has(t)?[...this.classNamesByBpmnId.get(t)]:[]}getBpmnIds(){return[...this.classNamesByBpmnId.keys()]}removeAllClassNames(t){const e=this.getOrInitializeClassNames(t),s=e.size;return e.clear(),e.sizeri.get(n.position),ai=(n,t)=>{t&&(n.fill.color=t.color??n.fill.color,n.fill.opacity=t.opacity??n.fill.opacity)},ci=(n,t)=>{t&&(n.stroke.color=t.color??n.stroke.color,n.stroke.width=t.width??n.stroke.width)},ui=(n,t)=>{t&&(n.font.color=t.color??n.font.color,n.font.size=t.size??n.font.size)},di=n=>{const t={fill:{color:p.DEFAULT_OVERLAY_FILL_COLOR.valueOf(),opacity:p.DEFAULT_OVERLAY_FILL_OPACITY.valueOf()},stroke:{color:p.DEFAULT_OVERLAY_STROKE_COLOR.valueOf(),width:p.DEFAULT_OVERLAY_STROKE_WIDTH.valueOf()},font:{color:p.DEFAULT_OVERLAY_FONT_COLOR.valueOf(),size:p.DEFAULT_OVERLAY_FONT_SIZE.valueOf()}},e=n.style,s={...t};return e&&(ai(s,e.fill),ci(s,e.stroke),ui(s,e.font)),s};class hi{convert(t){const e=li(t),s=di(t);return{position:e,style:s}}}function fi(n){return new gi(n,new hi)}class gi{constructor(t,e){this.graph=t,this.overlayConverter=e}addOverlays(t,e){const s=this.graph.getModel().getCell(t);if(s)for(const o of I(e)){const i=new gt(o.label,this.overlayConverter.convert(o));this.graph.addCellOverlay(s,i)}}removeAllOverlays(t){const e=this.graph.getModel().getCell(t);e&&this.graph.removeCellOverlays(e)}}function Ti(n){return new pi(fi(n))}class pi{constructor(t){this.overlaysUpdater=t}addOverlays(t,e){this.overlaysUpdater.addOverlays(t,e)}removeAllOverlays(t){this.overlaysUpdater.removeAllOverlays(t)}}class Ei{element(t){return`svg > g > g > g[data-bpmn-id="${t}"]`}elementsOfKind(t){return`svg > g > g > g.${t}:not(.bpmn-label)`}}function Si(n){return new Ci(n,new mi(n.getModel()))}const nt=n=>{const t=I(n);return t.push(...t.map(e=>be(e))),t};class Ci{constructor(t,e){this.graph=t,this.styleManager=e}clear(){this.styleManager.clear()}updateStyle(t,e){if(!e)return;const s=this.graph.getModel(),o=nt(t).map(i=>s.getCell(i)).filter(Boolean);o.length!==0&&this.graph.batchUpdate(()=>{for(const i of o){this.styleManager.ensureStyleIsStored(i);let r=i.getStyle();r=R(r,c.STYLE_OPACITY,e.opacity,fe),r=$t(r,e.stroke),r=Zt(r,e.font),Jt(e)&&(r=Qt(r,e.fill)),s.setStyle(i,r)}})}resetStyle(t){this.graph.batchUpdate(()=>{if(t||t=="")for(const e of nt(t))this.styleManager.resetStyleIfIsStored(e);else this.styleManager.resetAllStyles()})}}const st=m.EXTRA_CSS_CLASSES;class mi{constructor(t){g(this,"stylesCache",new Map);this.model=t}clear(){this.stylesCache.clear()}resetAllStyles(){for(const t of this.stylesCache.keys())this.resetStyle(t,this.stylesCache.get(t))}resetStyleIfIsStored(t){const e=this.stylesCache.get(t);e&&this.resetStyle(t,e)}resetStyle(t,e){const s=this.model.getCell(t),o=qt(s.getStyle(),st,""),i=R(e,st,o);this.model.setStyle(s,i),this.stylesCache.delete(t)}ensureStyleIsStored(t){const e=t.getId();this.stylesCache.has(e)||this.stylesCache.set(e,t.getStyle())}}function Ii(n){return new Ai(Si(n))}class Ai{constructor(t){this.styleUpdater=t}clearCache(){this.styleUpdater.clear()}updateStyle(t,e){this.styleUpdater.updateStyle(t,e)}resetStyle(t){this.styleUpdater.resetStyle(t)}}function Ni(n,t){return new vi(n,new Oi(t.container,new Ei),si(t),Ti(t),Ii(t))}class vi{constructor(t,e,s,o,i){this.bpmnModelRegistry=t,this.htmlElementRegistry=e,this.cssClassesRegistry=s,this.overlaysRegistry=o,this.styleRegistry=i,this.bpmnModelRegistry.registerOnLoadCallback(()=>{this.cssClassesRegistry.clearCache(),this.styleRegistry.clearCache()})}getModelElementsByIds(t){return pe(t).map(e=>this.bpmnModelRegistry.getBpmnSemantic(e)).filter(Boolean)}getElementsByIds(t){return this.getModelElementsByIds(t).map(e=>({bpmnSemantic:e,htmlElement:this.htmlElementRegistry.getBpmnHtmlElement(e.id)}))}getModelElementsByKinds(t){return pe(t).flatMap(e=>this.htmlElementRegistry.getBpmnHtmlElements(e)).map(e=>this.getRelatedBpmnSemantic(e))}getElementsByKinds(t){return pe(t).flatMap(e=>this.htmlElementRegistry.getBpmnHtmlElements(e)).map(e=>({htmlElement:e,bpmnSemantic:this.getRelatedBpmnSemantic(e)}))}getRelatedBpmnSemantic(t){return this.bpmnModelRegistry.getBpmnSemantic(t.dataset.bpmnId)}addCssClasses(t,e){this.cssClassesRegistry.addCssClasses(t,e)}removeCssClasses(t,e){this.cssClassesRegistry.removeCssClasses(t,e)}removeAllCssClasses(t){this.cssClassesRegistry.removeAllCssClasses(t)}toggleCssClasses(t,e){this.cssClassesRegistry.toggleCssClasses(t,e)}addOverlays(t,e){this.overlaysRegistry.addOverlays(t,e)}removeAllOverlays(t){this.overlaysRegistry.removeAllOverlays(t)}updateStyle(t,e){this.styleRegistry.updateStyle(t,e)}resetStyle(t){this.styleRegistry.resetStyle(t)}}class Oi{constructor(t,e){this.container=t,this.querySelectors=e}getBpmnHtmlElement(t){return this.container.querySelector(this.querySelectors.element(t))}getBpmnHtmlElements(t){const e=this.querySelectors.elementsOfKind(Ae(t));return[...this.container.querySelectorAll(e)]}}const pe=n=>[...new Set(I(n))];class Li{filter(t,e){const s=[],o=[];for(const E of I(e==null?void 0:e.pools).filter(S=>S&&Object.keys(S).length>0))E.id?s.push(E.id):E.name&&o.push(E.name);if(s.length===0&&o.length===0)return t;const{filteredPools:i,filteredPoolIds:r}=_i(t,s,o),l=[...s,...r],{filteredLanes:a,filteredLaneIds:u,filteredFlowNodes:d,filteredFlowNodeIds:f}=Ot(t.lanes,t.flowNodes,l),T=wi(t.edges,[...l,...u,...f]);if(i.length===0&&a.length===0&&d.length===0&&T.length===0){let E=s.length>0?` for ids [${s}]`:"";const S=E?" and":"";throw E+=o.length>0?`${S} for names [${o}]`:"",new Error("No matching pools"+E)}return{lanes:a,flowNodes:d,pools:i,edges:T}}}function _i(n,t,e){const s=n.pools.filter(i=>t.includes(i.bpmnElement.id)||e.includes(i.bpmnElement.name)),o=s.map(i=>i.bpmnElement.id);return{filteredPools:s,filteredPoolIds:o}}function Ot(n,t,e){const{filteredLanes:s,filteredLaneIds:o}=Lt(n,e),{filteredLanes:i,filteredLaneIds:r,filteredFlowNodes:l,filteredFlowNodeIds:a}=yi(t,[...e,...o],n);return s.push(...i),o.push(...r),{filteredLanes:s,filteredLaneIds:o,filteredFlowNodes:l,filteredFlowNodeIds:a}}function Lt(n,t){const e=n.filter(o=>t.includes(o.bpmnElement.parentId)),s=e.map(o=>o.bpmnElement.id);if(e.length>0){const{filteredLanes:o,filteredLaneIds:i}=Lt(n,s);e.push(...o),s.push(...i)}return{filteredLanes:e,filteredLaneIds:s}}function yi(n,t,e){const s=n.filter(u=>t.includes(u.bpmnElement.parentId));if(s.length===0)return{filteredLanes:[],filteredLaneIds:[],filteredFlowNodes:[],filteredFlowNodeIds:[]};const o=s.map(u=>u.bpmnElement.id),{filteredLanes:i,filteredLaneIds:r,filteredFlowNodes:l,filteredFlowNodeIds:a}=Ot(e,n,o);return s.push(...l),o.push(...a),{filteredLanes:i,filteredLaneIds:r,filteredFlowNodes:s,filteredFlowNodeIds:o}}function wi(n,t){return n.filter(e=>t.includes(e.bpmnElement.sourceReferenceId)&&t.includes(e.bpmnElement.targetReferenceId))}class Ri{constructor(){g(this,"searchableModel");g(this,"onLoadCallback")}load(t,e){var o;const s=new Li().filter(t,e);return this.searchableModel=new Fi(s),(o=this.onLoadCallback)==null||o.call(this),bi(s)}registerOnLoadCallback(t){this.onLoadCallback=t}getBpmnSemantic(t){var i;const e=(i=this.searchableModel)==null?void 0:i.elementById(t);if(!e)return;const s=e.bpmnElement,o=s instanceof x;return{id:t,isShape:o,kind:s.kind,name:s.name,...s instanceof de?{sourceRefId:s.sourceReferenceId,targetRefId:s.targetReferenceId}:{callActivityGlobalTaskKind:s instanceof z?s.globalTaskKind:void 0,callActivityKind:s instanceof z?s.callActivityKind:void 0,eventDefinitionKind:s instanceof U?s.eventDefinitionKind:void 0,linkEventSourceIds:s instanceof me&&s.eventDefinitionKind==y.LINK?s.sourceIds:void 0,linkEventTargetId:s instanceof Ie?s.targetId:void 0,incomingIds:s.incomingIds,outgoingIds:s.outgoingIds,parentId:s.parentId,subProcessKind:s instanceof se?s.subProcessKind:void 0}}}}function bi(n){const t=new Set(n.flowNodes.filter(i=>{const r=i.bpmnElement;return C.isSubProcess(r.kind)&&r.markers.includes(_.EXPAND)}).map(i=>i.bpmnElement.id)),e=[],s=[],o=[];for(const i of n.flowNodes){const r=i.bpmnElement.kind;C.isSubProcess(r)?e.push(i):C.isBoundaryEvent(r)?s.push(i):t.has(i.bpmnElement.parentId)||o.push(i)}return{boundaryEvents:s,edges:n.edges,lanes:n.lanes,otherFlowNodes:o,pools:n.pools,subprocesses:e}}class Fi{constructor(t){g(this,"elements",new Map);for(const e of[...t.pools,...t.lanes,...t.flowNodes,...t.edges])this.elements.set(e.bpmnElement.id,e)}elementById(t){return this.elements.get(t)}}const Pi="0.44.0",ki=()=>({lib:Pi,dependencies:new Map([["mxGraph",at.VERSION]])});class Bi{constructor(t){g(this,"graph");g(this,"navigation");g(this,"bpmnElementsRegistry");g(this,"bpmnModelRegistry");g(this,"parserOptions");g(this,"rendererOptions");this.rendererOptions=t==null?void 0:t.renderer;const e=new ns(Vt(t==null?void 0:t.container));this.graph=e.configure(t),this.navigation=new ss(this.graph),this.bpmnModelRegistry=new Ri,this.bpmnElementsRegistry=Ni(this.bpmnModelRegistry,this.graph),this.parserOptions=t==null?void 0:t.parser}load(t,e){const s=ei(this.parserOptions).parse(t),o=this.bpmnModelRegistry.load(s,e==null?void 0:e.modelFilter);cn(this.graph,this.rendererOptions).render(o,e==null?void 0:e.fit)}getVersion(){return ki()}}function or(n){document.readyState==="complete"||document.readyState==="interactive"?setTimeout(n,1):document.addEventListener("DOMContentLoaded",n)}function A(n,...t){Ve("[DEMO]",n,...t)}function Ve(n,t,...e){console.info(`${n} ${t}`,...e)}function b(n,...t){Ve("[DEMO STARTUP]",n,...t)}function _t(n,t){yt(n),window.alert(n)}function yt(n){console.error("[DEMO]",n)}function $(n,...t){Ve("[DEMO DOWNLOAD]",n,...t)}async function xi(n){A(`Fetching BPMN content from url ${n}`);const t=await fetch(n);if(!t.ok)throw new Error(`HTTP status ${t.status}`);return await t.text()}function wt(n,t,e){const s=document.createElement("a");t.startsWith("data:image/svg+xml")&&(e=encodeURIComponent(e),t+=","),s.setAttribute("href",t+e),s.setAttribute("download",n),s.style.display="none",document.body.append(s),s.click(),s.remove()}function Mi(n){$("Start SVG download"),wt("diagram.svg","data:image/svg+xml",n),$("Download completed")}function Vi(n){$("Start PNG download");const t=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),e=URL.createObjectURL(t),s=document.createElement("img");s.setAttribute("style","position: absolute; top: -9999px"),s.crossOrigin="anonymous",document.body.append(s);const o=document.createElement("canvas"),i=o.getContext("2d");s.addEventListener("load",function(){const r=new Image;o.width=s.naturalWidth,o.height=s.naturalHeight,r.crossOrigin="Anonymous",r.addEventListener("load",function(){i.drawImage(r,0,0),URL.revokeObjectURL(e);const l=o.toDataURL("image/png");s.remove(),wt("diagram.png","",l),$("Download completed")}),r.src=s.src}),s.src=e}class Yi{constructor(t,e,s,o){g(this,"document");g(this,"head");this.window=t,this.outerContainerId=e,this.containerToFade=s,this.dropCallback=o,this.document=t.document,this.head=document.head,this.initializeDragAndDrop()}initializeDragAndDrop(){this.containerToFade.classList.add("faded-container"),this.addDomElements(this.containerToFade),this.addStyle();const t=document.querySelector(`#${this.outerContainerId}`);this.preventDefaultsOnEvents(["dragover","drop"],this.window),this.preventDefaultsOnEvents(["dragover","dragleave","drop"],t),this.addEventsOnDropContainer(t,this.containerToFade),this.addEventsOnDocument(this.outerContainerId,this.containerToFade)}preventDefaults(t){t.preventDefault(),t.stopPropagation()}preventDefaultsOnEvents(t,e){for(const s of t)e.addEventListener(s,this.preventDefaults.bind(this),!1)}addDomElements(t){const e=this.document.createElement("p");e.textContent="open BPMN diagram";const s=this.document.createElement("div");s.classList.add("drop-here-text"),s.append(e);const o=this.document.createElement("div");o.id=this.outerContainerId,o.append(s),t.parentNode.prepend(o)}addStyle(){const t=` .faded-container { opacity: 1; } .faded-container.faded { opacity: 0.1; } #${this.outerContainerId} { display: none; overflow: hidden; position: absolute; top: 10px; right: 10px; bottom: 10px; left: 10px; font-weight: bold; text-align: center; color: #555; padding: 10px; } #${this.outerContainerId}.dragging { display: block; } #${this.outerContainerId} .drop-here-text { border: 2px solid transparent; width: 100%; height: 100%; overflow: hidden; } #${this.outerContainerId} .drop-here-text p { font-style: normal; font-family: monospace; font-size: 40px; color: rgba(1,1,1,.2); } #${this.outerContainerId}.dragging .drop-here-text { cursor: default; display: flex; justify-content: center; align-items: center; border: 2px dashed rgba(0,0,0,.2); border-radius: 7px; }`,e=document.createElement("style");e.append(document.createTextNode(t)),this.head.append(e)}addEventsOnDropContainer(t,e){t.addEventListener("dragover",this.getAddClassCallback(e,!1),!1),t.addEventListener("mousedown",this.getRemoveClassCallback(e,!1),!1),t.addEventListener("drop",this.getDropCallbackForElement(e,!1,this.dropCallback),!1)}addEventsOnDocument(t,e){this.document.addEventListener("dragover",this.getAddClassCallback(e,!0,t),!1),this.document.addEventListener("dragleave",this.getRemoveClassCallback(e,!0,t),!1),this.document.addEventListener("drop",this.getDropCallbackForElement(e,!0,this.dropCallback,t),!1)}getAddClassCallback(t,e,s){return function(){e?this.querySelector("#"+s).classList.add("dragging"):this.classList.add("dragging"),t.classList.add("faded")}}getRemoveClassCallback(t,e,s){return function(){e?this.querySelector("#"+s).classList.remove("dragging"):this.classList.remove("dragging"),t.classList.remove("faded")}}getDropCallbackForElement(t,e,s,o){return function(i){try{const l=i.dataTransfer.files;s(l[0])}catch(r){const l=r instanceof Error?r.message:String(r);_t(l)}finally{e?this.querySelector("#"+o).classList.remove("dragging"):this.classList.remove("dragging"),t.classList.remove("faded")}}}}class Rt{constructor(t){this.graph=t}exportSvg(){return this.doSvgExport(!0)}exportSvgForPng(){const t=at.IS_FF;return this.doSvgExport(t)}doSvgExport(t){const e=this.computeSvg({scale:1,border:25,enableForeignObjectForLabel:t});return` ${N.getXml(e)} `}computeSvg(t){const e=t.scale??1,s=t.border??0,o=t.crisp??!0,i=t.enableForeignObjectForLabel??!0,r=this.graph.getGraphBounds(),l=this.graph.view.scale,a=N.createXmlDocument(),u=a.createElementNS(c.NS_SVG,"svg"),d=e/l,f=Math.max(1,Math.ceil(r.width*d)+2*s),T=Math.max(1,Math.ceil(r.height*d)+2*s);u.setAttribute("version","1.1"),u.setAttribute("width",f+"px"),u.setAttribute("height",T+"px"),u.setAttribute("viewBox",(o?"-0.5 -0.5":"0 0")+" "+f+" "+T),a.append(u);const E=a.createElementNS(c.NS_SVG,"g");u.append(E);const S=this.createSvgCanvas(E);S.foEnabled=i,S.foOffset=o?-.5:0,S.textOffset=o?-.5:0,S.imageOffset=o?-.5:0,S.translate(Math.floor((s/e-r.x)/l),Math.floor((s/e-r.y)/l)),S.scale(d);const M=new O.mxImageExport;return M.includeOverlays=!0,M.drawState(this.graph.getView().getState(this.graph.model.root),S),a}createSvgCanvas(t){const e=new Gi(t);return e.pointerEvents=!0,e}}class Gi extends Re{constructor(e){super(e);g(this,"htmlConverter",document.createElement("div"))}getAlternateText(e,s,o,i,r,l,a,u,d,f,T,E,S){return this.computeTruncatedText(l,i)}plainText(e,s,o,i,r,l,a,u,d,f,T,E){r=this.computeTruncatedText(r,o),super.plainText(e,s,o,i,r,l,a,u,d,f,T,E)}computeTruncatedText(e,s){if(e==null||this.state.fontSize<=0)return"";try{this.htmlConverter.innerHTML=e,e=N.extractTextWithWhitespace(this.htmlConverter.childNodes);const o=Math.ceil(2*s/this.state.fontSize),i=[];let r=0,l=0;for(;(o==0||r0)break}else i.push(e.charAt(l)),a<255&&r++;l++}i.length1&&(e=N.trim(i.join(""))+"...")}catch(o){console.warn("Error while computing txt label",o)}return e}}const Di=new Map([["dark",{defaultFillColor:"#334352",defaultFontColor:"white",defaultStrokeColor:"#c0ddeb",endEventFillColor:"pink",endEventStrokeColor:"FireBrick",startEventFillColor:"DarkSeaGreen",startEventStrokeColor:"DarkGreen",taskAndCallActivityFillColor:"#5c8599",laneFillColor:"#2b3742",poolFillColor:"#232b33"}],["brown",{defaultFillColor:"#ede7e1",defaultFontColor:"#414666",defaultStrokeColor:"#414666",flowColor:"#666666",catchAndThrowEventStrokeColor:"#377f87",endEventFillColor:"pink",endEventStrokeColor:"FireBrick",startEventFillColor:"DarkSeaGreen",startEventStrokeColor:"DarkGreen",taskAndCallActivityFillColor:"#dadce8",laneFillColor:"#d4c3b2",poolFillColor:"#d1b9a1"}],["light-blue",{defaultFillColor:"#ffffff",defaultFontColor:"#002395",defaultStrokeColor:"#002395",endEventFillColor:"#f9dadc",endEventStrokeColor:"#e20613",startEventFillColor:"#ffffff",startEventStrokeColor:"#05d99e",taskAndCallActivityFillColor:"rgba(132,158,253,0.1)",textAnnotationFillColor:"rgba(237,237,245,0.5)",laneFillColor:"#edeef5",poolFillColor:"#dbefff"}]]);class Ui extends Bi{configureTheme(t){if(t=="default")return new Et(this.graph).configureStyles(),!0;const e=Di.get(t);if(!e)return!1;const s=this.graph.getStylesheet();for(const d of C.eventKinds()){let f,T;switch(d){case"endEvent":{f=e.endEventFillColor,T=e.endEventStrokeColor;break}case"startEvent":{f=e.startEventFillColor,T=e.startEventStrokeColor;break}case"intermediateCatchEvent":case"intermediateThrowEvent":case"boundaryEvent":{f=e.defaultFillColor,T=e.catchAndThrowEventStrokeColor??e.defaultStrokeColor;break}default:{f=e.defaultFillColor,T=e.defaultStrokeColor;break}}const E=s.styles[d];E.fillColor=f,E.strokeColor=T}for(const d of C.taskKinds()){const f=s.styles[d];f.fillColor=e.taskAndCallActivityFillColor}const o=s.styles[h.CALL_ACTIVITY];o.fillColor=e.taskAndCallActivityFillColor;const i=s.styles[h.TEXT_ANNOTATION];i.fillColor=e.textAnnotationFillColor??p.TEXT_ANNOTATION_FILL_COLOR;const r=s.styles[h.POOL];r.fillColor=e.poolFillColor,r.swimlaneFillColor=e.defaultFillColor;const l=s.styles[h.LANE];l.fillColor=e.laneFillColor;const a=s.getDefaultVertexStyle();a.fontColor=e.defaultFontColor,a.fillColor=e.defaultFillColor,a.strokeColor=e.defaultStrokeColor;const u=s.getDefaultEdgeStyle();return u.fontColor=e.defaultFontColor,u.fillColor=e.defaultFillColor,u.strokeColor=e.flowColor??e.defaultStrokeColor,!0}configureSequenceFlowColor(t){b(`Use dedicated ${t} color for sequence flows`);const s=this.graph.getStylesheet().styles[P.SEQUENCE_FLOW];s[c.STYLE_STROKECOLOR]=t,s[c.STYLE_FILLCOLOR]=t,b("Sequence flows style updated")}}let v,D={},Ye,Ge,ue,k;function ir(n){A("Updating load options"),D.fit=n,A("Load options updated",D)}function rr(){return{...D}}function lr(){return ue}function ar(n){A("Switching theme from %s to %s",ue,n),v.configureTheme(n)?(v.graph.refresh(),A("Theme switch done"),ue=n):A("Unknown theme, do nothing")}function bt(n,t=!0){A("Loading bpmn...");try{v.load(n,D),A("BPMN loaded with configuration",D),Hi(Ge),document.dispatchEvent(new CustomEvent("diagramLoaded"))}catch(e){if(t)Ye(`Cannot load the BPMN diagram: ${e instanceof Error?e.message:String(e)}`);else throw e}}function cr(n){A("Fitting..."),v.navigation.fit(n),A("Fit done with configuration",n)}function ur(n){A(`Zooming '${n}'...`),v.navigation.zoom(n),A("Zoom done")}function dr(n){return v.bpmnElementsRegistry.getModelElementsByKinds(n)}function Wi(n){return v.bpmnElementsRegistry.getModelElementsByIds(n)}function Ft(n){const t=v.graph.model,e=t.getCell(n);return t.getParent(e)}function hr(n){return n.map(t=>Ft(t).getId()).filter((t,e,s)=>s.indexOf(t)===e)}function fr(n){var s;const t=Ft(n),e=Wi(t.getId());return e&&((s=e[0])==null?void 0:s.kind)===h.SUB_PROCESS}function gr(n,t){return v.bpmnElementsRegistry.addCssClasses(n,t)}function Tr(n,t){return v.bpmnElementsRegistry.removeCssClasses(n,t)}function pr(n,t){return v.bpmnElementsRegistry.addOverlays(n,[t])}function Er(n){return v.bpmnElementsRegistry.removeAllOverlays(n)}function Hi(n){if(!Ge)return;A("Updating model, bpmnElement to collapse:",n);const t=v.graph.getModel(),e=t.getCell(n);if(e){t.beginUpdate();try{t.setCollapsed(e,!0)}finally{t.endUpdate()}A("Model updated")}else A("Element not found in the model, do nothing")}function Pt(n){n.text().then(t=>{bt(t)}).catch(t=>{throw t})}function Sr(n){const t=n.target.files;if(t&&t.length>0){const e=t[0];Pt(e)}}function Ki(n){xi(n).catch(t=>{throw new Error(`Unable to fetch ${n}. ${t}`)}).then(t=>(A("BPMN content fetched"),t)).then(t=>{bt(t,!1),A(`BPMN content loaded from url ${n}`)}).then(()=>{Qi()}).catch(t=>{Ye(t.message)})}function Cr(n){_t(n)}function zi(n){yt(n)}function Xi(n,t){var i;const e=((i=n.loadOptions)==null?void 0:i.fit)??{},s=t.get("fitTypeOnLoad");s&&(e.type=s);const o=t.get("fitMargin");return o&&(e.margin=Number(o)),e}function $i(n){if(n.get("style.container.alternative.background.color")=="true"){const i="yellow";b("Use alternative color for the bpmn container background, color",i);const r=v.graph.container;r.style.backgroundColor=i,b("Bpmn container style updated")}const e=n.get("style.theme");b(`Configuring the '${e}' BPMN theme`),v.configureTheme(e)?(ue=e,b(`'${e}' BPMN theme configured`)):b(`Unknown '${e}' BPMN theme, skipping configuration`),n.get("style.seqFlow.light.colors")=="true"&&v.configureSequenceFlowColor("#E9E9E9"),b('Configuring the "Update Style" API from query parameters'),[...n.keys()].some(i=>i.startsWith("style.api."))?(k={stroke:{},font:{},fill:{}},n.get("style.api.stroke.color")&&(k.stroke.color=n.get("style.api.stroke.color")),n.get("style.api.font.color")&&(k.font.color=n.get("style.api.font.color")),n.get("style.api.font.opacity")&&(k.font.opacity=Number(n.get("style.api.font.opacity"))),n.get("style.api.fill.color")?k.fill.color=n.get("style.api.fill.color"):n.get("style.api.fill.color.startColor")&&n.get("style.api.fill.color.endColor")&&n.get("style.api.fill.color.direction")&&(k.fill.color={startColor:n.get("style.api.fill.color.startColor"),endColor:n.get("style.api.fill.color.endColor"),direction:n.get("style.api.fill.color.direction")}),n.get("style.api.fill.opacity")&&(k.fill.opacity=Number(n.get("style.api.fill.opacity"))),b('Prepared "Update Style" API object',k)):b('No query parameters, do not set the "Update Style" API object')}function Zi(n){Ge=n.get("bpmn.element.id.collapsed")}function qi(n){const t=n.get("bpmn.filter.pool.ids");if(!t)return;const e=t.split(",");return A("Configuring load options to only include pool id: ",e),{pools:e.map(s=>({id:s}))}}function mr(n){const t=b;t("Initializing BpmnVisualization with container:",n.globalOptions.container);const e=new URLSearchParams(window.location.search),s=e.get("renderer.ignore.bpmn.colors");if(s){const i=s==="true";t('Ignore support for "BPMN in Color"?',i),!n.globalOptions.renderer&&(n.globalOptions.renderer={}),n.globalOptions.renderer.ignoreBpmnColors=i}v=new Ui(n.globalOptions),t("Initialization completed"),new Yi(window,"drop-container",v.graph.container,Pt),t("Drag&Drop support initialized"),Ye=n.statusKoNotifier??zi,t("Configuring Load Options"),D=n.loadOptions??{},D.fit=Xi(n,e),D.modelFilter=qi(e),$i(e),Zi(e),t("Checking if an 'url to fetch BPMN content' is provided as query parameter");const o=e.get("url");if(o){const i=decodeURIComponent(o);Ki(i);return}t("No 'url to fetch BPMN content' provided")}function Ir(){$("Trigger SVG Download"),Mi(new Rt(v.graph).exportSvg())}function Ar(){$("Trigger PNG Download"),Vi(new Rt(v.graph).exportSvgForPng())}function ji(n,t){A("Applying style using the style API: %O",t),v.bpmnElementsRegistry.updateStyle(n,t),A("New style applied on: %O",n)}function Nr(n){A("Resetting styles using the style API!"),v.bpmnElementsRegistry.resetStyle(n),A("Styles reset")}function Qi(){if(k){const n=Ji();A("Number of elements whose style is to be updated",n.length),ji(n,k)}}function Ji(){A("Retrieving ids of all BPMN elements");const n=[...Object.values(h),...Object.values(P)],t=v.bpmnElementsRegistry.getModelElementsByKinds(n).map(e=>e.id);return A("All BPMN elements ids retrieved:",t.length),t}export{J as F,h as S,Mt as Z,ar as a,ki as b,lr as c,or as d,Er as e,cr as f,rr as g,Sr as h,gr as i,Ir as j,Ar as k,A as l,fr as m,dr as n,ji as o,C as p,hr as q,Tr as r,mr as s,Nr as t,ir as u,hn as v,Cr as w,pr as x,ur as z};